=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientdatavalue/PatientDataValue.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientdatavalue/PatientDataValue.java 2012-05-23 15:02:50 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientdatavalue/PatientDataValue.java 2012-06-04 10:03:56 +0000 @@ -53,7 +53,7 @@ private String value; - //private boolean providedElsewhere; + private Boolean providedElsewhere; // ------------------------------------------------------------------------- // Constructors @@ -135,6 +135,16 @@ this.programStageInstance = programStageInstance; } + public Boolean getProvidedElsewhere() + { + return providedElsewhere; + } + + public void setProvidedElsewhere( Boolean providedElsewhere ) + { + this.providedElsewhere = providedElsewhere; + } + public ProgramStageInstance getProgramStageInstance() { return programStageInstance; @@ -169,4 +179,5 @@ { return value; } + } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageDataElement.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageDataElement.java 2012-06-04 06:14:40 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageDataElement.java 2012-06-04 10:03:56 +0000 @@ -58,15 +58,15 @@ * programStage */ private boolean compulsory = false; - - private boolean allowProvidedElsewhere; + + private Boolean allowProvidedElsewhere; private Integer sortOrder; // ------------------------------------------------------------------------- // Constructors // ------------------------------------------------------------------------- - + public ProgramStageDataElement( ProgramStage programStage, DataElement dataElement, boolean compulsory ) { this.programStage = programStage; @@ -107,12 +107,12 @@ this.dataElement = dataElement; } - public boolean isAllowProvidedElsewhere() + public Boolean getAllowProvidedElsewhere() { return allowProvidedElsewhere; } - public void setAllowProvidedElsewhere( boolean allowProvidedElsewhere ) + public void setAllowProvidedElsewhere( Boolean allowProvidedElsewhere ) { this.allowProvidedElsewhere = allowProvidedElsewhere; } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstance.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstance.java 2012-03-15 09:25:30 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstance.java 2012-06-04 10:03:56 +0000 @@ -46,9 +46,9 @@ public static final String COLOR_RED = "#fb4754"; public static final String COLOR_YELLOW = "#f9f95a"; - + public static final String COLOR_GREEN = "#8ffe8f"; - + public static final String COLOR_LIGHTRED = "#fb6bfb"; private int id; @@ -62,13 +62,11 @@ private Date dueDate; private Date executionDate; - + private OrganisationUnit organisationUnit; private boolean completed = false; - private Boolean providedByAnotherFacility = false; - private String storedBy; // ------------------------------------------------------------------------- @@ -122,7 +120,7 @@ result = result * prime + programInstance.hashCode(); result = result * prime + programStage.hashCode(); result = result * prime + dueDate.hashCode(); - result = result * prime + ( ( executionDate == null) ? 0 : executionDate.hashCode() ); + result = result * prime + ((executionDate == null) ? 0 : executionDate.hashCode()); result = result * prime + stageInProgram; return result; @@ -227,7 +225,7 @@ { return stageInProgram; } - + /** * @return the completed */ @@ -253,15 +251,6 @@ { this.organisationUnit = organisationUnit; } - public void setProvidedByAnotherFacility( Boolean providedByAnotherFacility ) - { - this.providedByAnotherFacility = providedByAnotherFacility; - } - - public Boolean isProvidedByAnotherFacility() - { - return providedByAnotherFacility; - } public String getStoredBy() { === 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-06-04 04:06:04 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2012-06-04 10:03:56 +0000 @@ -94,7 +94,7 @@ executeSql( "ALTER TABLE program DROP COLUMN anonymous" ); executeSql( "UPDATE program SET type=1 where type is null" ); - executeSql( "UPDATE programstage set irregular=false where irregular is null" ); + executeSql( "UPDATE programstage SET irregular=false WHERE irregular is null" ); executeSql( "DROP TABLE programattributevalue" ); executeSql( "DROP TABLE programinstance_attributes" ); @@ -110,6 +110,10 @@ executeSql( "ALTER TABLE caseaggregationcondition RENAME description TO name" ); updateCaseAggregationCondition(); + + executeSql( "UPDATE programstage_dataelements SET allowProvidedElsewhere=false WHERE allowProvidedElsewhere is null" ); + executeSql( "UPDATE patientdatavalue SET providedElsewhere=false WHERE providedElsewhere is null" ); + executeSql( "ALTER TABLE programstageinstance DROP COLUMN providedbyanotherfacility" ); } // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java 2012-05-30 03:30:10 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java 2012-06-04 10:03:56 +0000 @@ -366,6 +366,8 @@ // ----------------------------------------------------------------- String compulsory = "null"; + boolean allowProvidedElsewhere = false; + String dataElementCode = dataElementMatcher.group( 1 ); Matcher identifierMatcher = IDENTIFIER_PATTERN_FIELD.matcher( dataElementCode ); if ( identifierMatcher.find() && identifierMatcher.groupCount() > 0 ) @@ -375,7 +377,6 @@ // ------------------------------------------------------------- int programStageId = Integer.parseInt( identifierMatcher.group( 1 ) ); - int dataElementId = Integer.parseInt( identifierMatcher.group( 2 ) ); DataElement dataElement = null; @@ -400,6 +401,7 @@ ProgramStageDataElement psde = programStageDataElementService.get( programStage, dataElement ); compulsory = BooleanUtils.toStringTrueFalse( psde.isCompulsory() ); + allowProvidedElsewhere = psde.getAllowProvidedElsewhere(); } if ( dataElement == null ) @@ -509,7 +511,15 @@ { disabled = "disabled"; } + else if ( !programStageInstance.isCompleted() && allowProvidedElsewhere) + { + // ----------------------------------------------------------- + // Add ProvidedByOtherFacility checkbox + // ----------------------------------------------------------- + appendCode = addProvidedElsewherCheckbox( appendCode, patientDataValue, programStage ); + } + // ----------------------------------------------------------- // // ----------------------------------------------------------- @@ -570,6 +580,7 @@ // ----------------------------------------------------------------- String compulsory = "null"; + boolean providedElsewhere = false; String dataElementCode = dataElementMatcher.group( 1 ); Matcher identifierMatcher = IDENTIFIER_PATTERN_FIELD.matcher( dataElementCode ); @@ -606,6 +617,7 @@ ProgramStageDataElement psde = programStageDataElementService.get( programStage, dataElement ); compulsory = BooleanUtils.toStringTrueFalse( psde.isCompulsory() ); + providedElsewhere = psde.getAllowProvidedElsewhere(); } if ( dataElement == null ) @@ -708,11 +720,21 @@ // ----------------------------------------------------------- disabled = ""; + if ( programStageId != programStage.getId() ) { disabled = "disabled=\"\""; } + + else if ( !programStageInstance.isCompleted() && providedElsewhere ) + { + // ----------------------------------------------------------- + // Add ProvidedByOtherFacility checkbox + // ----------------------------------------------------------- + appendCode = addProvidedElsewherCheckbox( appendCode, patientDataValue, programStage ); + } + // ----------------------------------------------------------- // // ----------------------------------------------------------- @@ -779,8 +801,9 @@ // ----------------------------------------------------------------- String compulsory = "null"; + boolean allowProvidedElsewhere = false; + String dataElementCode = dataElementMatcher.group( 1 ); - Matcher identifierMatcher = IDENTIFIER_PATTERN_FIELD.matcher( dataElementCode ); if ( identifierMatcher.find() && identifierMatcher.groupCount() > 0 ) @@ -814,6 +837,7 @@ ProgramStageDataElement psde = programStageDataElementService.get( programStage, dataElement ); compulsory = BooleanUtils.toStringTrueFalse( psde.isCompulsory() ); + allowProvidedElsewhere = psde.getAllowProvidedElsewhere(); } if ( dataElement == null ) @@ -914,6 +938,15 @@ appendCode += jQueryCalendar; + if ( programStageId == programStage.getId() && !programStageInstance.isCompleted() && allowProvidedElsewhere ) + { + // ----------------------------------------------------------- + // Add ProvidedByOtherFacility checkbox + // ----------------------------------------------------------- + + appendCode = addProvidedElsewherCheckbox( appendCode, patientDataValue, programStage ); + } + // ------------------------------------------------------------- // // ------------------------------------------------------------- @@ -937,7 +970,25 @@ return sb.toString(); } - + + private String addProvidedElsewherCheckbox( String appendCode, PatientDataValue patientDataValue, ProgramStage programStage ) + { + appendCode += ""; + + String display = ( !programStage.getProgram().isRegistration() ) ? "none" : "block"; + appendCode = appendCode.replace( "$DISPLAY", display ); + + return appendCode; + + } + /** * Returns the value of the PatientDataValue in the Collection of DataValues * with the given data element identifier. === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientdatavalue/hibernate/PatientDataValue.hbm.xml' --- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientdatavalue/hibernate/PatientDataValue.hbm.xml 2012-03-05 04:22:57 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientdatavalue/hibernate/PatientDataValue.hbm.xml 2012-06-04 10:03:56 +0000 @@ -16,6 +16,8 @@ + + === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStageDataElement.hbm.xml' --- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStageDataElement.hbm.xml 2012-03-07 02:40:08 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStageDataElement.hbm.xml 2012-06-04 10:03:56 +0000 @@ -14,6 +14,8 @@ + + === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStageInstance.hbm.xml' --- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStageInstance.hbm.xml 2012-03-15 09:25:30 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStageInstance.hbm.xml 2012-06-04 10:03:56 +0000 @@ -26,8 +26,6 @@ - - === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/CreateAnonymousEncounterAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/CreateAnonymousEncounterAction.java 2012-03-05 08:41:21 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/CreateAnonymousEncounterAction.java 2012-06-04 10:03:56 +0000 @@ -138,7 +138,6 @@ programStageInstance.setDueDate( date ); programStageInstance.setExecutionDate( date ); programStageInstance.setOrganisationUnit( selectedStateManager.getSelectedOrganisationUnit() ); - programStageInstance.setProvidedByAnotherFacility( false ); programStageInstanceService.addProgramStageInstance( programStageInstance ); === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveExecutionDateAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveExecutionDateAction.java 2012-05-24 10:44:17 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveExecutionDateAction.java 2012-06-04 10:03:56 +0000 @@ -100,13 +100,14 @@ { this.format = format; } - + private CurrentUserService currentUserService; public void setCurrentUserService( CurrentUserService currentUserService ) { this.currentUserService = currentUserService; } + // ------------------------------------------------------------------------- // Input/Output // ------------------------------------------------------------------------- @@ -157,11 +158,12 @@ ProgramStage programStage = programStageService.getProgramStage( programStageId ); Program program = programStage.getProgram(); int type = program.getType(); - + ProgramInstance programInstance = null; + if ( type == Program.SINGLE_EVENT_WITH_REGISTRATION ) { // Add a new program-instance - ProgramInstance programInstance = new ProgramInstance(); + programInstance = new ProgramInstance(); programInstance.setEnrollmentDate( dateValue ); programInstance.setDateOfIncident( dateValue ); programInstance.setProgram( program ); @@ -172,40 +174,25 @@ patientService.updatePatient( patient ); programInstanceService.addProgramInstance( programInstance ); - - // Add a new program-stage-instance - programStageInstance = new ProgramStageInstance(); - programStageInstance.setProgramInstance( programInstance ); - programStageInstance.setProgramStage( programStage ); - programStageInstance.setStageInProgram( programStage.getStageInProgram() ); - programStageInstance.setDueDate( dateValue ); - programStageInstance.setExecutionDate( dateValue ); - programStageInstance.setStoredBy( storedBy ); - programStageInstance.setOrganisationUnit( selectedStateManager.getSelectedOrganisationUnit() ); - programStageInstance.setProvidedByAnotherFacility( false ); - - programStageInstanceService.addProgramStageInstance( programStageInstance ); - selectedStateManager.setSelectedProgramInstance( programInstance ); } else if ( type == Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) { - ProgramInstance programInstance = programInstanceService.getProgramInstances( patient, program ).iterator().next(); - - // Add a new program-stage-instance - programStageInstance = new ProgramStageInstance(); - programStageInstance.setProgramInstance( programInstance ); - programStageInstance.setProgramStage( programStage ); - programStageInstance.setStageInProgram( programStage.getStageInProgram() ); - programStageInstance.setDueDate( dateValue ); - programStageInstance.setExecutionDate( dateValue ); - programStageInstance.setStoredBy( storedBy ); - programStageInstance.setOrganisationUnit( selectedStateManager.getSelectedOrganisationUnit() ); - programStageInstance.setProvidedByAnotherFacility( false ); - - programStageInstanceService.addProgramStageInstance( programStageInstance ); - selectedStateManager.setSelectedProgramInstance( programInstance ); + programInstance = programInstanceService.getProgramInstances( patient, program ) + .iterator().next(); } + // Add a new program-stage-instance + programStageInstance = new ProgramStageInstance(); + programStageInstance.setProgramInstance( programInstance ); + programStageInstance.setProgramStage( programStage ); + programStageInstance.setStageInProgram( programStage.getStageInProgram() ); + programStageInstance.setDueDate( dateValue ); + programStageInstance.setExecutionDate( dateValue ); + programStageInstance.setStoredBy( storedBy ); + programStageInstance.setOrganisationUnit( selectedStateManager.getSelectedOrganisationUnit() ); + + programStageInstanceService.addProgramStageInstance( programStageInstance ); + selectedStateManager.setSelectedProgramInstance( programInstance ); selectedStateManager.setSelectedProgramStageInstance( programStageInstance ); } else === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveProvidingFacilityAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveProvidingFacilityAction.java 2012-03-16 02:00:50 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveProvidingFacilityAction.java 2012-06-04 10:03:56 +0000 @@ -28,9 +28,11 @@ package org.hisp.dhis.caseentry.action.caseentry; import org.hisp.dhis.caseentry.state.SelectedStateManager; -import org.hisp.dhis.organisationunit.OrganisationUnit; +import org.hisp.dhis.dataelement.DataElement; +import org.hisp.dhis.dataelement.DataElementService; +import org.hisp.dhis.patientdatavalue.PatientDataValue; +import org.hisp.dhis.patientdatavalue.PatientDataValueService; import org.hisp.dhis.program.ProgramStageInstance; -import org.hisp.dhis.program.ProgramStageInstanceService; import com.opensymphony.xwork2.Action; @@ -52,22 +54,36 @@ this.selectedStateManager = selectedStateManager; } - private ProgramStageInstanceService programStageInstanceService; - - public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService ) - { - this.programStageInstanceService = programStageInstanceService; + private DataElementService dataElementService; + + public void setDataElementService( DataElementService dataElementService ) + { + this.dataElementService = dataElementService; + } + + private PatientDataValueService patientDataValueService; + + public void setPatientDataValueService( PatientDataValueService patientDataValueService ) + { + this.patientDataValueService = patientDataValueService; } // ------------------------------------------------------------------------- // Input/Output // ------------------------------------------------------------------------- - private boolean providedByAnotherFacility; - - public void setProvidedByAnotherFacility( boolean providedByAnotherFacility ) - { - this.providedByAnotherFacility = providedByAnotherFacility; + private int dataElementId; + + public void setDataElementId( int dataElementId ) + { + this.dataElementId = dataElementId; + } + + private Boolean providedElsewhere; + + public void setProvidedElsewhere( Boolean providedElsewhere ) + { + this.providedElsewhere = providedElsewhere; } private int statusCode; @@ -86,21 +102,18 @@ { ProgramStageInstance programStageInstance = selectedStateManager.getSelectedProgramStageInstance(); - if ( programStageInstance != null ) + DataElement dataElement = dataElementService.getDataElement( dataElementId ); + + PatientDataValue patientDataValue = patientDataValueService.getPatientDataValue( programStageInstance, + dataElement ); + + if ( patientDataValue != null ) { - if ( programStageInstance.getOrganisationUnit() == null ) - { - OrganisationUnit organisationUnit = selectedStateManager.getSelectedOrganisationUnit(); - programStageInstance.setOrganisationUnit( organisationUnit ); - } - - programStageInstance.setProvidedByAnotherFacility( providedByAnotherFacility ); + patientDataValue.setProvidedElsewhere( providedElsewhere ); - programStageInstanceService.updateProgramStageInstance( programStageInstance ); + patientDataValueService.updatePatientDataValue( patientDataValue ); } - statusCode = 0; - return SUCCESS; } } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValueAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValueAction.java 2012-05-30 15:51:44 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValueAction.java 2012-06-04 10:03:56 +0000 @@ -83,6 +83,13 @@ this.selectedStateManager = selectedStateManager; } + private Boolean providedElsewhere; + + public void setProvidedElsewhere( Boolean providedElsewhere ) + { + this.providedElsewhere = providedElsewhere; + } + // ------------------------------------------------------------------------- // Input/Output // ------------------------------------------------------------------------- @@ -158,11 +165,14 @@ programStageInstanceService.updateProgramStageInstance( programStageInstance ); } + providedElsewhere = (providedElsewhere == null) ? false : true; + if ( patientDataValue == null && value != null ) { LOG.debug( "Adding PatientDataValue, value added" ); patientDataValue = new PatientDataValue( programStageInstance, dataElement, new Date(), value ); + patientDataValue.setProvidedElsewhere( providedElsewhere ); patientDataValueService.savePatientDataValue( patientDataValue ); } @@ -172,6 +182,7 @@ patientDataValue.setValue( value ); patientDataValue.setTimestamp( new Date() ); + patientDataValue.setProvidedElsewhere( providedElsewhere ); patientDataValueService.updatePatientDataValue( patientDataValue ); } === 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-05-31 04:22:45 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2012-06-04 10:03:56 +0000 @@ -90,8 +90,10 @@ scope="prototype"> - + +
- ##providedByAnotherFacility - - #if($programStageInstance.programInstance.program.displayProvidedOtherFacility == 'true' ) - - - - #end -
- #set( $id = $programStageInstance.programStage.id + '_facility' ) - #if( $!programStageInstance.providedByAnotherFacility) - #if( $!programStageInstance.providedByAnotherFacility == 'true' ) - $i18n.getString( "orgunit_provided_service" ): $programStageInstance.organisationUnit.name - #elseif( $!programStageInstance.providedByAnotherFacility == 'false' ) - $i18n.getString( "orgunit_provided_service" ): $i18n.getString("other_facility") - #end - #else - $i18n.getString( "provided_elsewhere" ) - - #end -
- #if( $customDataEntryFormCode )
$customDataEntryFormCode @@ -76,6 +55,7 @@ $i18n.getString( "data_element" ) $i18n.getString( "entry" ) + $i18n.getString( "provided_elsewhere" ) #set( $dataElementRowCount = 0 ) #set( $mark = true ) @@ -118,10 +98,19 @@ #else #end - + + + + #set( $id = $programStageDataElement.programStage.id + '_' + $programStageDataElement.dataElement.id + '_facility' ) + #if( $programStageDataElement.allowProvidedElsewhere == 'true') + + #end + - #set( $tabIndex = $tabIndex + 1 ) - #end + #end + #set( $tabIndex = $tabIndex + 1 ) #end
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js 2012-05-30 03:30:10 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js 2012-06-04 10:03:56 +0000 @@ -227,13 +227,13 @@ valueSaver.save(); } -function updateProvidingFacility() +function updateProvidingFacility( dataElementId, checkField ) { var programStageId = byId( 'programStageId' ).value; - var checkField = byId( programStageId + '_facility'); + var checked= checkField.checked; checkField.style.backgroundColor = '#ffffcc'; - var facilitySaver = new FacilitySaver( checkField.checked, '#ccffcc' ); + var facilitySaver = new FacilitySaver( dataElementId, checked, '#ccffcc' ); facilitySaver.save(); } @@ -381,6 +381,7 @@ var ERROR = '#ccccff'; var dataElementId = dataElementId_; + var providedElsewhereId = getFieldValue('programStageId') + "_" + dataElementId_ + "_facility"; var value = value_; var type = dataElementType_; var resultColor = resultColor_; @@ -388,7 +389,8 @@ this.save = function() { var params = 'dataElementId=' + dataElementId; - params += '&value=' ; + params += '&value='; + params += '&providedElsewhere=' + byId( providedElsewhereId ).checked; if( value != '') params += htmlEncode(value); @@ -442,17 +444,19 @@ } } -function FacilitySaver( providedByAnotherFacility_, resultColor_ ) +function FacilitySaver( dataElementId_, providedElsewhere_, resultColor_ ) { var SUCCESS = 'success'; var ERROR = '#error'; - var providedByAnotherFacility = providedByAnotherFacility_; + var dataElementId = dataElementId_; + var providedElsewhere = providedElsewhere_; var resultColor = resultColor_; this.save = function() { - var params = 'providedByAnotherFacility=' + providedByAnotherFacility ; + var params = 'dataElementId=' + dataElementId; + params += '&providedElsewhere=' + providedElsewhere ; $.ajax({ type: "POST", url: "saveProvidingFacility.action", === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js 2012-06-04 08:37:52 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js 2012-06-04 10:03:56 +0000 @@ -821,7 +821,7 @@ $.ajax({ url: 'searchRegistrationPatient.action', type:"POST", - data: getParamsForDiv( 'searchPatientDiv' ), + data: getParamsForDiv('searchPatientDiv'), success: function( html ){ statusSearching = 1; setInnerHTML( 'listPatientDiv', html ); === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/report.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/report.vm 2012-05-30 06:36:41 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/report.vm 2012-06-04 10:03:56 +0000 @@ -10,7 +10,7 @@ #foreach( $programInstance in $programInstances ) - $programInstance.patient.getFullName() + #foreach( $programStageInstance in $programInstance.programStageInstances ) === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/AddProgramStageAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/AddProgramStageAction.java 2012-05-23 16:19:55 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/AddProgramStageAction.java 2012-06-04 10:03:56 +0000 @@ -131,6 +131,13 @@ { this.compulsories = compulsories; } + + private List allowProvidedElsewhere = new ArrayList(); + + public void setAllowProvidedElsewhere( List allowProvidedElsewhere ) + { + this.allowProvidedElsewhere = allowProvidedElsewhere; + } private Boolean irregular; @@ -177,6 +184,7 @@ DataElement dataElement = dataElementService.getDataElement( selectedDataElementsValidator.get( i ) ); ProgramStageDataElement programStageDataElement = new ProgramStageDataElement( programStage, dataElement, this.compulsories.get( i ), new Integer( i ) ); + programStageDataElement.setAllowProvidedElsewhere( allowProvidedElsewhere.get( i ) ); programStageDataElementService.addProgramStageDataElement( programStageDataElement ); } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/UpdateProgramStageAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/UpdateProgramStageAction.java 2012-05-23 16:19:55 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/UpdateProgramStageAction.java 2012-06-04 10:03:56 +0000 @@ -119,7 +119,12 @@ { this.compulsories = compulsories; } - + private List allowProvidedElsewhere = new ArrayList(); + + public void setAllowProvidedElsewhere( List allowProvidedElsewhere ) + { + this.allowProvidedElsewhere = allowProvidedElsewhere; + } private int programId; public int getProgramId() @@ -184,6 +189,8 @@ programStageDataElement.setSortOrder( new Integer( i ) ); + programStageDataElement.setAllowProvidedElsewhere( allowProvidedElsewhere.get( i ) ); + programStageDataElementService.updateProgramStageDataElement( programStageDataElement ); programStageDataElements.remove( programStageDataElement ); === 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-06-04 04:06:04 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2012-06-04 10:03:56 +0000 @@ -243,4 +243,5 @@ due_date=Due date stage_visited = Stage visited report_date = Report date -program_stage_properties = Program stage properties \ No newline at end of file +program_stage_properties = Program stage properties +allow_provided_elsewhere = Allow provided elsewhere \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm 2012-05-26 17:38:10 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm 2012-06-04 10:03:56 +0000 @@ -48,6 +48,7 @@ $i18n.getString( "selected_data_elements" ) + @@ -68,6 +69,7 @@ $i18n.getString( "dataelement" ) $i18n.getString( "compulsory" ) + $i18n.getString( "allow_provided_elsewhere" ) === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addProgramStageForm.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addProgramStageForm.js 2012-06-04 04:06:04 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addProgramStageForm.js 2012-06-04 10:03:56 +0000 @@ -3,17 +3,26 @@ validation( 'addProgramStageForm', function( form ){ form.submit(); }, function(){ - selectedDataElementsValidator = jQuery( "#selectedDataElementsValidator" ); + var selectedDataElementsValidator = jQuery( "#selectedDataElementsValidator" ); selectedDataElementsValidator.empty(); - compulsories = jQuery( "#compulsories" ); + var compulsories = jQuery( "#compulsories" ); compulsories.empty(); + allowProvidedElsewhere = jQuery( "#allowProvidedElsewhere" ); + allowProvidedElsewhere.empty(); + jQuery("#selectedList").find("tr").each( function( i, item ){ + selectedDataElementsValidator.append( "" ); + var compulsory = jQuery( item ).find( "input[name='compulsory']:first"); var checked = compulsory.attr('checked') ? true : false; compulsories.append( "" ); + + var allowProvided = jQuery( item ).find( "input[name='allowProvided']:first"); + checked = allowProvided.attr('checked') ? true : false; + allowProvidedElsewhere.append( "" ); }); }); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programStage.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programStage.js 2012-05-23 16:19:55 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programStage.js 2012-06-04 10:03:56 +0000 @@ -65,6 +65,7 @@ if( item.selected ){ html = "" + item.text + ""; html += ""; + html += ""; html += ""; selectedList.append( html ); jQuery( item ).remove(); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramStageForm.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramStageForm.js 2012-06-04 04:06:04 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramStageForm.js 2012-06-04 10:03:56 +0000 @@ -9,13 +9,21 @@ compulsories = jQuery( "#compulsories" ); compulsories.empty(); + allowProvidedElsewhere = jQuery( "#allowProvidedElsewhere" ); + allowProvidedElsewhere.empty(); + jQuery("#selectedList").find("tr").each( function( i, item ){ + selectedDataElementsValidator.append( "" ); + var compulsory = jQuery( item ).find( "input[name='compulsory']:first"); - var isShow = jQuery( item ).find( "input[name='isShow']:first"); - var checked = compulsory.attr('checked') ? true : false; compulsories.append( "" ); + + + var allowProvided = jQuery( item ).find( "input[name='allowProvided']:first"); + checked = allowProvided.attr('checked') ? true : false; + allowProvidedElsewhere.append( "" ); }); }); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm 2012-05-30 03:38:42 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm 2012-06-04 10:03:56 +0000 @@ -47,6 +47,7 @@ $i18n.getString( "selected_data_elements" ) + @@ -68,6 +69,7 @@ $i18n.getString( "dataelement" ) $i18n.getString( "compulsory" ) + $i18n.getString( "allow_provided_elsewhere" ) @@ -75,6 +77,7 @@ $encoder.htmlEncode( $programStageDataElement.dataElement.name ) + #end