=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2012-12-12 09:15:45 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2012-12-26 03:02:05 +0000 @@ -157,7 +157,9 @@ executeSql( "UPDATE programstage SET displayGenerateEventBox=true WHERE displayGenerateEventBox is null" ); executeSql( "ALTER TABLE patientidentifier DROP COLUMN preferred"); - + + executeSql( "UPDATE patientidentifiertype SET personDisplayName=false WHERE personDisplayName is null"); + } // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java 2012-12-18 05:57:32 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java 2012-12-26 03:02:05 +0000 @@ -39,7 +39,12 @@ import org.hisp.dhis.caseentry.state.SelectedStateManager; import org.hisp.dhis.dataentryform.DataEntryForm; import org.hisp.dhis.i18n.I18n; +import org.hisp.dhis.i18n.I18nFormat; import org.hisp.dhis.organisationunit.OrganisationUnit; +import org.hisp.dhis.patient.Patient; +import org.hisp.dhis.patient.PatientAttribute; +import org.hisp.dhis.patient.PatientAttributeService; +import org.hisp.dhis.patientattributevalue.PatientAttributeValueService; import org.hisp.dhis.patientdatavalue.PatientDataValue; import org.hisp.dhis.patientdatavalue.PatientDataValueService; import org.hisp.dhis.program.Program; @@ -73,6 +78,12 @@ private SelectedStateManager selectedStateManager; + private PatientAttributeService patientAttributeService; + + private PatientAttributeValueService patientAttributeValueService; + + private I18nFormat format; + // ------------------------------------------------------------------------- // Input && Output // ------------------------------------------------------------------------- @@ -97,6 +108,8 @@ private Set sections = new HashSet(); + private Map calAttributeValueMap = new HashMap(); + // ------------------------------------------------------------------------- // Getters && Setters // ------------------------------------------------------------------------- @@ -106,6 +119,21 @@ this.programStageInstanceService = programStageInstanceService; } + public void setPatientAttributeService( PatientAttributeService patientAttributeService ) + { + this.patientAttributeService = patientAttributeService; + } + + public void setPatientAttributeValueService( PatientAttributeValueService patientAttributeValueService ) + { + this.patientAttributeValueService = patientAttributeValueService; + } + + public void setFormat( I18nFormat format ) + { + this.format = format; + } + public void setProgramStageInstanceId( Integer programStageInstanceId ) { this.programStageInstanceId = programStageInstanceId; @@ -178,6 +206,18 @@ return visitor; } + private Patient patient; + + public Patient getPatient() + { + return patient; + } + + public Map getCalAttributeValueMap() + { + return calAttributeValueMap; + } + // ------------------------------------------------------------------------- // Implementation Action // ------------------------------------------------------------------------- @@ -201,6 +241,24 @@ selectedStateManager.setSelectedProgramStageInstance( programStageInstance ); + if ( program.isRegistration() ) + { + patient = programStageInstance.getProgramInstance().getPatient(); + + Collection calAttributes = patientAttributeService + .getPatientAttributesByValueType( PatientAttribute.TYPE_CALCULATED ); + + for ( PatientAttribute calAttribute : calAttributes ) + { + Double value = patientAttributeValueService.getCalculatedPatientAttributeValue( patient, + calAttribute, format ); + if ( value != null ) + { + calAttributeValueMap.put( calAttribute.getName(), value ); + } + } + } + // --------------------------------------------------------------------- // Get data values // --------------------------------------------------------------------- === removed file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ProgramStageCustomDataEntryAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ProgramStageCustomDataEntryAction.java 2012-12-17 13:13:51 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ProgramStageCustomDataEntryAction.java 1970-01-01 00:00:00 +0000 @@ -1,264 +0,0 @@ -/* - * Copyright (c) 2004-2009, University of Oslo - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of the HISP project nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package org.hisp.dhis.caseentry.action.caseentry; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.hisp.dhis.caseentry.state.SelectedStateManager; -import org.hisp.dhis.dataelement.DataElement; -import org.hisp.dhis.dataentryform.DataEntryForm; -import org.hisp.dhis.i18n.I18n; -import org.hisp.dhis.organisationunit.OrganisationUnit; -import org.hisp.dhis.patient.Patient; -import org.hisp.dhis.patientdatavalue.PatientDataValue; -import org.hisp.dhis.patientdatavalue.PatientDataValueService; -import org.hisp.dhis.program.Program; -import org.hisp.dhis.program.ProgramDataEntryService; -import org.hisp.dhis.program.ProgramStage; -import org.hisp.dhis.program.ProgramStageDataElement; -import org.hisp.dhis.program.ProgramStageInstance; -import org.hisp.dhis.program.ProgramStageInstanceService; -import org.hisp.dhis.program.comparator.ProgramStageDataElementSortOrderComparator; - -import com.opensymphony.xwork2.Action; - -public class ProgramStageCustomDataEntryAction - implements Action -{ - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private ProgramStageInstanceService programStageInstanceService; - - public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService ) - { - this.programStageInstanceService = programStageInstanceService; - } - - private PatientDataValueService patientDataValueService; - - public void setPatientDataValueService( PatientDataValueService patientDataValueService ) - { - this.patientDataValueService = patientDataValueService; - } - - private SelectedStateManager selectedStateManager; - - public void setSelectedStateManager( SelectedStateManager selectedStateManager ) - { - this.selectedStateManager = selectedStateManager; - } - - private ProgramDataEntryService programDataEntryService; - - public void setProgramDataEntryService( ProgramDataEntryService programDataEntryService ) - { - this.programDataEntryService = programDataEntryService; - } - - // ------------------------------------------------------------------------- - // Output - // ------------------------------------------------------------------------- - - private String customDataEntryFormCode = null; - - public String getCustomDataEntryFormCode() - { - return this.customDataEntryFormCode; - } - - // ------------------------------------------------------------------------- - // Input / Output - // ------------------------------------------------------------------------- - - private Integer id; - - public void setId( Integer id ) - { - this.id = id; - } - - public Integer getId() - { - return id; - } - - private Integer programStageInstanceId; - - public void setProgramStageInstanceId( Integer programStageInstanceId ) - { - this.programStageInstanceId = programStageInstanceId; - } - - private Patient patient; - - public Patient getPatient() - { - return patient; - } - - private Program program; - - public Program getProgram() - { - return program; - } - - private ProgramStage programStage; - - public ProgramStage getProgramStage() - { - return programStage; - } - - private Collection dataElements = new ArrayList(); - - public Collection getDataElements() - { - return dataElements; - } - - private Map patientDataValueMap; - - public Map getPatientDataValueMap() - { - return patientDataValueMap; - } - - private OrganisationUnit organisationUnit; - - public OrganisationUnit getOrganisationUnit() - { - return organisationUnit; - } - - private DataEntryForm dataEntryForm; - - public DataEntryForm getDataEntryForm() - { - return this.dataEntryForm; - } - - private I18n i18n; - - public void setI18n( I18n i18n ) - { - this.i18n = i18n; - } - - private boolean customDataEntryFormExists; - - public boolean isCustomDataEntryFormExists() - { - return customDataEntryFormExists; - } - - public void setCustomDataEntryFormExists( boolean customDataEntryFormExists ) - { - this.customDataEntryFormExists = customDataEntryFormExists; - } - - public ProgramStageInstance programStageInstance; - - public int getProgramStageInstanceId() - { - return programStageInstance.getId(); - } - - private List programStageDataElements; - - public List getProgramStageDataElements() - { - return programStageDataElements; - } - - // ------------------------------------------------------------------------- - // Implementation Action - // ------------------------------------------------------------------------- - - public String execute() - throws Exception - { - // --------------------------------------------------------------------- - // Get Orgunit & Program, ProgramStage - // --------------------------------------------------------------------- - - organisationUnit = selectedStateManager.getSelectedOrganisationUnit(); - - programStageInstance = programStageInstanceService.getProgramStageInstance( programStageInstanceId ); - - programStage = programStageInstance.getProgramStage(); - - programStageDataElements = new ArrayList( programStage.getProgramStageDataElements() ); - - Collections.sort( programStageDataElements, new ProgramStageDataElementSortOrderComparator() ); - - program = programStage.getProgram(); - - patient = programStageInstance.getProgramInstance().getPatient(); - - selectedStateManager.setSelectedProgramStageInstance( programStageInstance ); - - selectedStateManager.setSelectedProgramStageInstance( programStageInstance ); - - // --------------------------------------------------------------------- - // Get data values - // --------------------------------------------------------------------- - - Collection patientDataValues = patientDataValueService - .getPatientDataValues( programStageInstance ); - - patientDataValueMap = new HashMap( patientDataValues.size() ); - - for ( PatientDataValue patientDataValue : patientDataValues ) - { - int key = patientDataValue.getDataElement().getId() ; - patientDataValueMap.put( key, patientDataValue ); - } - - DataEntryForm dataEntryForm = programStage.getDataEntryForm(); - - if ( dataEntryForm != null ) - { - customDataEntryFormExists = true; - - customDataEntryFormCode = programDataEntryService.prepareDataEntryFormForEntry( - dataEntryForm.getHtmlCode(), patientDataValues, "", i18n, programStage, programStageInstance, - organisationUnit ); - } - - return SUCCESS; - } - -} === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2012-12-21 09:23:20 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2012-12-26 03:02:05 +0000 @@ -101,6 +101,10 @@ ref="org.hisp.dhis.program.ProgramStageInstanceService" /> + + - - - - - - - + class="org.hisp.dhis.caseentry.action.caseentry.LoadDataEntryAction"> /content.vm /dhis-web-caseentry/reportDataEntryForm.vm javascript/entry.js,../dhis-web-commons/javascripts/date.js @@ -251,7 +251,7 @@ + class="org.hisp.dhis.caseentry.action.caseentry.LoadDataEntryAction"> /content.vm /dhis-web-caseentry/dataEntryForm.vm ../dhis-web-commons/javascripts/date.js === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportDataEntryForm.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportDataEntryForm.vm 2012-12-17 08:43:52 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportDataEntryForm.vm 2012-12-26 03:02:05 +0000 @@ -26,6 +26,12 @@ $i18n.getString('program_stage'): $programStageInstance.programStage.name + #foreach( $attributeName in $calAttributeValueMap.keySet() ) + + $attributeName + $calAttributeValueMap.get($attributeName) + + #end   #end === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2012-12-21 09:23:20 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2012-12-26 03:02:05 +0000 @@ -326,4 +326,5 @@ display_generate_event_box_after_completed = Display generate event box after completed calculated = Calculated enrollment_date = Enrollment date -incident_date = Incident date \ No newline at end of file +incident_date = Incident date +current_date = Current date \ No newline at end of file