=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java 2013-02-19 13:19:21 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java 2013-03-01 07:34:20 +0000 @@ -109,6 +109,8 @@ private Boolean blockEntryForm = false; private Set userRoles = new HashSet(); + + private Boolean onlyEnrollOnce = false; // ------------------------------------------------------------------------- // Constructors @@ -461,4 +463,14 @@ this.userRoles = userRoles; } + public Boolean getOnlyEnrollOnce() + { + return onlyEnrollOnce; + } + + public void setOnlyEnrollOnce( Boolean onlyEnrollOnce ) + { + this.onlyEnrollOnce = onlyEnrollOnce; + } + } === 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 2013-02-27 14:39:27 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2013-03-01 07:34:20 +0000 @@ -178,6 +178,8 @@ executeSql( "UPDATE patientattribute SET valueType='calculated' WHERE valueType='CALCULATED'" ); executeSql( "UPDATE patientidentifiertype SET type='string' WHERE type='text'" ); + executeSql( "UPDATE program SET onlyEnrollOnce='false' WHERE onlyEnrollOnce is null" ); + updateUid(); } === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml' --- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml 2013-02-20 08:38:11 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml 2013-03-01 07:34:20 +0000 @@ -45,6 +45,8 @@ + + === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/CompleteDataEntryAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/CompleteDataEntryAction.java 2012-09-07 09:53:13 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/CompleteDataEntryAction.java 2013-03-01 07:34:20 +0000 @@ -29,6 +29,8 @@ import java.util.Date; import java.util.Set; +import org.hisp.dhis.patient.Patient; +import org.hisp.dhis.patient.PatientService; import org.hisp.dhis.program.Program; import org.hisp.dhis.program.ProgramInstance; import org.hisp.dhis.program.ProgramInstanceService; @@ -61,6 +63,13 @@ this.programInstanceService = programInstanceService; } + private PatientService patientService; + + public void setPatientService( PatientService patientService ) + { + this.patientService = patientService; + } + // ------------------------------------------------------------------------- // Input / Output // ------------------------------------------------------------------------- @@ -127,6 +136,14 @@ programInstance.setEndDate( new Date() ); programInstanceService.updateProgramInstance( programInstance ); + + Program program = programInstance.getProgram(); + if ( !program.getOnlyEnrollOnce() ) + { + Patient patient = programInstance.getPatient(); + patient.getPrograms().remove( program ); + patientService.updatePatient( patient ); + } } return "programcompleted"; === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/RemoveEnrollmentAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/RemoveEnrollmentAction.java 2012-08-28 05:48:46 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/RemoveEnrollmentAction.java 2013-03-01 07:34:20 +0000 @@ -80,7 +80,7 @@ { return programs; } - + public void setProgramInstanceId( Integer programInstanceId ) { this.programInstanceId = programInstanceId; @@ -111,9 +111,12 @@ // Set Completed status all program-instaces of Death case // --------------------------------------------------------------------- - patient.getPrograms().remove( program ); - patientService.updatePatient( patient ); - + if ( !program.getOnlyEnrollOnce() ) + { + patient.getPrograms().remove( program ); + patientService.updatePatient( patient ); + } + 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 2013-02-28 08:50:43 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2013-03-01 07:34:20 +0000 @@ -116,6 +116,7 @@ + === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/visitSchedule.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/visitSchedule.vm 2013-01-23 10:27:28 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/visitSchedule.vm 2013-03-01 07:34:20 +0000 @@ -107,5 +107,10 @@ #end #if( $programInstance.completed=='false') datePickerInRangeValid( 'dateOfIncident' , 'enrollmentDate' ); + #else + jQuery(":input").attr('disabled', true); + jQuery("img").removeAttr("onclick"); #end + + var i18n_insert_a_due_date = '$encoder.jsEscape( $i18n.getString( "insert_a_due_date" ) , "'")'; \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonProgram.vm' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonProgram.vm 2013-01-23 04:48:39 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonProgram.vm 2013-03-01 07:34:20 +0000 @@ -13,6 +13,7 @@ "programStageCount": "${program.programStages.size()}", "noAttributes": "$!program.patientAttributes.size()", "noIdentifierTypes": "$!program.patientIdentifierTypes.size()", - "blockEntryForm": "$!program.blockEntryForm" + "blockEntryForm": "$!program.blockEntryForm", + "onlyEnrollOnce": "$!program.onlyEnrollOnce" } } \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java 2013-01-24 13:37:59 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java 2013-03-01 07:34:20 +0000 @@ -182,6 +182,13 @@ { this.blockEntryForm = blockEntryForm; } + + private Boolean onlyEnrollOnce = false; + + public void setOnlyEnrollOnce( Boolean onlyEnrollOnce ) + { + this.onlyEnrollOnce = onlyEnrollOnce; + } // ------------------------------------------------------------------------- // Action implementation @@ -195,6 +202,7 @@ generateBydEnrollmentDate = (generateBydEnrollmentDate == null) ? false : generateBydEnrollmentDate; ignoreOverdueEvents = (ignoreOverdueEvents == null) ? false : ignoreOverdueEvents; blockEntryForm = (blockEntryForm == null) ? false : blockEntryForm; + onlyEnrollOnce = (onlyEnrollOnce == null) ? false : onlyEnrollOnce; Program program = new Program(); @@ -207,6 +215,8 @@ program.setDisplayProvidedOtherFacility( displayProvidedOtherFacility ); program.setDisplayIncidentDate( displayIncidentDate ); program.setBlockEntryForm( blockEntryForm ); + program.setOnlyEnrollOnce( onlyEnrollOnce ); + if ( type == Program.MULTIPLE_EVENTS_WITH_REGISTRATION ) { program.setGeneratedByEnrollmentDate( generateBydEnrollmentDate ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UpdateProgramAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UpdateProgramAction.java 2013-01-24 13:47:32 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UpdateProgramAction.java 2013-03-01 07:34:20 +0000 @@ -178,7 +178,15 @@ { this.blockEntryForm = blockEntryForm; } - + + private Boolean onlyEnrollOnce = false; + + public void setOnlyEnrollOnce( Boolean onlyEnrollOnce ) + { + this.onlyEnrollOnce = onlyEnrollOnce; + } + + // ------------------------------------------------------------------------- // Action implementation // ------------------------------------------------------------------------- @@ -202,6 +210,8 @@ program.setDisplayProvidedOtherFacility( displayProvidedOtherFacility ); program.setDisplayIncidentDate( displayIncidentDate ); program.setBlockEntryForm( blockEntryForm ); + program.setOnlyEnrollOnce( onlyEnrollOnce ); + if ( type == Program.MULTIPLE_EVENTS_WITH_REGISTRATION ) { program.setGeneratedByEnrollmentDate( generateBydEnrollmentDate ); === 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 2013-02-26 08:38:13 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2013-03-01 07:34:20 +0000 @@ -358,4 +358,6 @@ insert_properties = Insert properties insert_images = Insert images patient_registration_form = Person Registration Form -insert_data_elements = Insert data elements \ No newline at end of file +insert_data_elements = Insert data elements +only_enroll_once = Only enroll one +insert_a_due_date = Please insert a due-date \ 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/addProgramForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramForm.vm 2013-02-13 15:58:32 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramForm.vm 2013-03-01 07:34:20 +0000 @@ -69,6 +69,12 @@ + + + + + + === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js 2013-01-28 09:09:20 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js 2013-03-01 07:34:20 +0000 @@ -32,6 +32,9 @@ var ignoreOverdueEvents = ( json.program.ignoreOverdueEvents == 'true') ? i18n_yes : i18n_no; setInnerHTML( 'ignoreOverdueEventsField', ignoreOverdueEvents ); + var onlyEnrollOnce = ( json.program.onlyEnrollOnce == 'true') ? i18n_yes : i18n_no; + setInnerHTML( 'onlyEnrollOnceField', onlyEnrollOnce ); + setInnerHTML( 'dateOfEnrollmentDescriptionField', json.program.dateOfEnrollmentDescription ); setInnerHTML( 'dateOfIncidentDescriptionField', json.program.dateOfIncidentDescription ); setInnerHTML( 'programStageCountField', json.program.programStageCount ); @@ -58,6 +61,7 @@ // anonymous if(type == "3") { + disable('onlyEnrollOnce'); disable('dateOfEnrollmentDescription'); disable("displayIncidentDate"); disable("dateOfIncidentDescription"); @@ -71,6 +75,7 @@ jQuery("[name=nonAnonymous]").hide(); } else{ + enable('onlyEnrollOnce'); jQuery("[name=displayed]").prop("disabled", false); enable("availablePropertyIds"); showById("selectedList"); @@ -82,6 +87,7 @@ jQuery("[name=nonAnonymous]").show(); if( type == 2 ){ disable('ignoreOverdueEvents'); + disable('onlyEnrollOnce'); } if(byId('displayIncidentDate').checked){ === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramForm.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramForm.js 2013-02-20 08:38:11 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramForm.js 2013-03-01 07:34:20 +0000 @@ -21,6 +21,5 @@ } }); - //checkValueIsExist( "name", "validateProgram.action", {id:getFieldValue('id')}); programOnChange(); }); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm 2013-02-20 15:10:33 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm 2013-03-01 07:34:20 +0000 @@ -80,10 +80,11 @@




-





+


+





=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramForm.vm 2013-02-13 15:58:32 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramForm.vm 2013-03-01 07:34:20 +0000 @@ -75,6 +75,12 @@ + + + + + +