dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #24708
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12157: Allow to configure program stage to take place at registration.
------------------------------------------------------------
revno: 12157
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-09-19 15:26:17 +0700
message:
Allow to configure program stage to take place at registration.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstance.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStage.java
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/program/DefaultProgramInstanceService.java
dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStage.hbm.xml
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SaveProgramEnrollmentAction.java
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/patientDashboard.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonProgramStage.vm
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/UpdateProgramStageAction.java
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/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/javascript/programStage.js
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/programStage.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstance.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstance.java 2013-09-11 15:26:20 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstance.java 2013-09-19 08:26:17 +0000
@@ -409,4 +409,27 @@
return null;
}
+
+ public ProgramStageInstance getActiveProgramStageInstance()
+ {
+ for ( ProgramStageInstance programStageInstance : programStageInstances )
+ {
+ if ( programStageInstance.getProgramStage().getOpenAfterEnrollment() && !programStageInstance.isCompleted()
+ && ( programStageInstance.getStatus() != null && programStageInstance.getStatus() != ProgramStageInstance.SKIPPED_STATUS ) )
+ {
+ return programStageInstance;
+ }
+ }
+
+ for ( ProgramStageInstance programStageInstance : programStageInstances )
+ {
+ if ( !programStageInstance.isCompleted()
+ && ( programStageInstance.getStatus() != null && programStageInstance.getStatus() != ProgramStageInstance.SKIPPED_STATUS ) )
+ {
+ return programStageInstance;
+ }
+ }
+
+ return null;
+ }
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStage.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStage.java 2013-09-12 05:49:31 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStage.java 2013-09-19 08:26:17 +0000
@@ -58,6 +58,12 @@
public static final String TYPE_CUSTOM = "custom";
+ public static final String REPORT_DATE_TO_USE_REGISTRATION_DATE = "registrationDate";
+
+ public static final String REPORT_DATE_TO_USE_INCIDENT_DATE = "dateOfIncident";
+
+ public static final String REPORT_DATE_TO_USE_ENROLLMENT_DATE = "enrollmentDate";
+
/**
* Determines if a de-serialized file is compatible with this class.
*/
@@ -103,6 +109,10 @@
private Boolean allowGenerateNextVisit = false;
+ private Boolean openAfterEnrollment = false;
+
+ private String reportDateToUse;
+
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
@@ -377,4 +387,30 @@
this.allowGenerateNextVisit = allowGenerateNextVisit;
}
+ @JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class } )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ public Boolean getOpenAfterEnrollment()
+ {
+ return openAfterEnrollment;
+ }
+
+ public void setOpenAfterEnrollment( Boolean openAfterEnrollment )
+ {
+ this.openAfterEnrollment = openAfterEnrollment;
+ }
+
+ @JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class } )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ public String getReportDateToUse()
+ {
+ return reportDateToUse;
+ }
+
+ public void setReportDateToUse( String reportDateToUse )
+ {
+ this.reportDateToUse = reportDateToUse;
+ }
+
}
=== 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-09-19 03:24:26 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2013-09-19 08:26:17 +0000
@@ -242,6 +242,9 @@
executeSql( "DROP TABLE patient_programs" );
executeSql( "DROP TABLE patient_attributes" );
+
+ executeSql( "update programstage set openAfterEnrollment=false where openAfterEnrollment is null" );
+ executeSql( "update programstage set reportDateToUse=false where reportDateToUse is null" );
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java 2013-09-18 13:55:25 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java 2013-09-19 08:26:17 +0000
@@ -190,12 +190,14 @@
return programInstanceStore.get( programs );
}
- public Collection<ProgramInstance> getProgramInstances( Collection<Program> programs, OrganisationUnit organisationUnit )
+ public Collection<ProgramInstance> getProgramInstances( Collection<Program> programs,
+ OrganisationUnit organisationUnit )
{
return programInstanceStore.get( programs, organisationUnit );
}
- public Collection<ProgramInstance> getProgramInstances( Collection<Program> programs, OrganisationUnit organisationUnit, int status )
+ public Collection<ProgramInstance> getProgramInstances( Collection<Program> programs,
+ OrganisationUnit organisationUnit, int status )
{
return programInstanceStore.get( programs, organisationUnit, status );
}
@@ -616,8 +618,8 @@
}
@Override
- public ProgramInstance enrollPatient( Patient patient, Program program, Date enrollmentDate,
- Date dateOfIncident, OrganisationUnit organisationUnit, I18nFormat format )
+ public ProgramInstance enrollPatient( Patient patient, Program program, Date enrollmentDate, Date dateOfIncident,
+ OrganisationUnit organisationUnit, I18nFormat format )
{
if ( enrollmentDate == null )
{
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStage.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStage.hbm.xml 2013-09-12 05:49:31 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStage.hbm.xml 2013-09-19 08:26:17 +0000
@@ -64,6 +64,10 @@
<property name="remindCompleted" />
<property name="allowGenerateNextVisit" />
+
+ <property name="openAfterEnrollment" />
+
+ <property name="reportDateToUse" />
</class>
</hibernate-mapping>
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SaveProgramEnrollmentAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SaveProgramEnrollmentAction.java 2013-09-18 09:17:43 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SaveProgramEnrollmentAction.java 2013-09-19 08:26:17 +0000
@@ -180,8 +180,8 @@
if ( programInstance == null )
{
- programInstance = programInstanceService.enrollPatient( patient, program, enrollment, incident,
- orgunit, format );
+ programInstance = programInstanceService.enrollPatient( patient, program, enrollment, incident, orgunit,
+ format );
}
// ---------------------------------------------------------------------
@@ -204,15 +204,7 @@
programInstance.getProgramStageInstances() );
Collections.sort( programStageInstances, new ProgramStageInstanceVisitDateComparator() );
- for ( ProgramStageInstance programStageInstance : programStageInstances )
- {
- if ( !programStageInstance.isCompleted()
- && programStageInstance.getStatus() != ProgramStageInstance.SKIPPED_STATUS )
- {
- activeProgramStageInstance = programStageInstance;
- break;
- }
- }
+ activeProgramStageInstance = programInstance.getActiveProgramStageInstance();
return SUCCESS;
}
=== 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 2013-09-17 06:08:16 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js 2013-09-19 08:26:17 +0000
@@ -80,6 +80,7 @@
var dateOfIncident = jQuery('#patientForm [id=dateOfIncident]').val();
var enrollmentDate = jQuery('#patientForm [id=enrollmentDate]').val();
+ // Enroll patient into the program
if( programId !='' && enrollmentDate != '')
{
jQuery.postJSON( "saveProgramEnrollment.action",
@@ -428,5 +429,13 @@
resize();
hideLoader();
hideById('contentDiv');
+
+ var reportDateToUse = selectedProgramStageInstance.attr('reportDateToUse');
+ if(reportDateToUse!='' && $('#executionDate').val() == '' ){
+ $('#executionDate').val(reportDateToUse);
+ $('#executionDate').change();
+ }
+
} );
+
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm 2013-09-17 09:47:21 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm 2013-09-19 08:26:17 +0000
@@ -122,19 +122,26 @@
<div class="contentProviderTable">
<table id='activeTB' name='activeTB' style='cursor:pointer;'>
#foreach( $programInstance in $activeProgramInstances )
- #set($programStageInstanceId = '')
- #if($programInstance.program.type==1)
- #foreach( $programStageInstance in $programInstance.programStageInstances)
- #set($programStageInstanceId = $programStageInstance.id)
+ #set($programStageInstance='')
+ #foreach ( $psi in $programInstance.programStageInstances )
+ #if( $psi.programStage.openAfterEnrollment=='true' && $psi.getStatus() != 1 && $psi.getStatus() != 5 )
+ #set($programStageInstance=$psi)
#end
#end
- #set($flag = 'false')
- #foreach( $programStageInstance in $programInstance.programStageInstances )
+ #if($programStageInstance=='')
+ #foreach( $psi in $programInstance.programStageInstances )
+ #if ( $psi.getStatus() != 1 && $psi.getStatus() != 5 )
+ #set($programStageInstance=$psi)
+ #end
+ #end
+ #end
+
+ #set($programStageInstance = $programInstance.getActiveProgramStageInstance())
+ #if( $!programStageInstance)
#set( $status = $programStageInstance.getEventStatus() )
- #if( $status!=1 && $status!=5 && $flag=='false')
<tr id='tr1_$programInstance.id' type='$programInstance.program.type'
- programStageInstanceId='$programStageInstanceId'
+ programStageInstanceId='$programStageInstance.id'
relationshipText='$!programInstance.program.relationshipText'
relationshipType='$!programInstance.program.relationshipType.id'
relationshipSide='$!programInstance.program.relationshipSide'
@@ -156,12 +163,9 @@
</td>
</tr>
#end
- #set($flag = 'true')
- #end
- #end
- #if($flag=='false')
+ #else
<tr id='tr1_$programInstance.id' type='$programInstance.program.type'
- programStageInstanceId='$programStageInstanceId' style='cursor:pointer;'
+ programStageInstanceId='$programStageInstance.id' style='cursor:pointer;'
relationshipText='$!programInstance.program.relationshipText'
relationshipType='$!programInstance.program.relationshipType.id'
relationshipSide='$!programInstance.program.relationshipSide'
@@ -325,4 +329,5 @@
var i18n_save_comment = '$encoder.jsEscape( $i18n.getString( "save_comment" ) , "'")';
var i18n_update_success = '$encoder.jsEscape( $i18n.getString( "update_success" ) , "'")';
var i18n_save_success = '$encoder.jsEscape( $i18n.getString( "save_success" ) , "'")';
+ var i18n_please_enter_report_date = '$encoder.jsEscape( $i18n.getString( "please_enter_report_date " ) , "'")';
</script>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm 2013-09-19 03:16:23 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm 2013-09-19 08:26:17 +0000
@@ -19,6 +19,15 @@
#if($!programStageInstance.executionDate)
#set($valueDate=$format.formatDate( $programStageInstance.executionDate ))
#end
+
+ #set($reportDateToUse = "")
+ #if($programStageInstance.programStage.reportDateToUse=='registrationDate' )
+ #set($reportDateToUse = "$format.formatDate( $programInstance.patient.registrationDate)")
+ #elseif($programStageInstance.programStage.reportDateToUse=='dateOfIncident' )
+ #set($reportDateToUse = "$format.formatDate( $programInstance.dateOfIncident)")
+ #elseif($programStageInstance.programStage.reportDateToUse=='enrollmentDate' )
+ #set($reportDateToUse = "$format.formatDate( $programInstance.enrollmentDate)")
+ #end
<div class="orgunit-object" id="org_$!programStageInstance.id"> $!programStageInstance.organisationUnit.name</div>
<input type="button" name="programStageBtn"
id="ps_$!programStageInstance.id"
@@ -32,6 +41,8 @@
reportDate="$!format.formatDate( $!programStageInstance.executionDate )"
reportDateDes="$programStageInstance.programStage.reportDateDescription"
dueDate="$format.formatDate( $programStageInstance.dueDate )"
+ openAfterEnrollment="$programStageInstance.programStage.openAfterEnrollment"
+ reportDateToUse="$reportDateToUse"
class="stage-object"
value="$programStageInstance.programStage.displayName $valueDate"
linkedEvent='false'
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonProgramStage.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonProgramStage.vm 2013-09-12 05:49:31 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonProgramStage.vm 2013-09-19 08:26:17 +0000
@@ -11,6 +11,8 @@
"remindCompleted": "$!programStage.remindCompleted",
"allowGenerateNextVisit": "$!programStage.allowGenerateNextVisit",
"generatedByEnrollmentDate": "$!programStage.generatedByEnrollmentDate",
+ "openAfterEnrollment": "$!programStage.openAfterEnrollment",
+ "reportDateToUse": "$!programStage.reportDateToUse",
"patientReminders":[
#foreach($patientReminder in $programStage.patientReminders)
{
=== 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 2013-09-16 09:47:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/AddProgramStageAction.java 2013-09-19 08:26:17 +0000
@@ -291,7 +291,21 @@
{
this.allowGenerateNextVisit = allowGenerateNextVisit;
}
-
+
+ private Boolean openAfterEnrollment;
+
+ public void setOpenAfterEnrollment( Boolean openAfterEnrollment )
+ {
+ this.openAfterEnrollment = openAfterEnrollment;
+ }
+
+ private String reportDateToUse;
+
+ public void setReportDateToUse( String reportDateToUse )
+ {
+ this.reportDateToUse = reportDateToUse;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -310,6 +324,7 @@
blockEntryForm = (blockEntryForm == null) ? false : blockEntryForm;
remindCompleted = (remindCompleted == null) ? false : remindCompleted;
allowGenerateNextVisit = (allowGenerateNextVisit == null) ? false : allowGenerateNextVisit;
+ openAfterEnrollment = (openAfterEnrollment == null) ? false : openAfterEnrollment;
ProgramStage programStage = new ProgramStage();
Program program = programService.getProgram( id );
@@ -329,6 +344,8 @@
programStage.setRemindCompleted( remindCompleted );
programStage.setGeneratedByEnrollmentDate( generatedByEnrollmentDate );
programStage.setAllowGenerateNextVisit( allowGenerateNextVisit );
+ programStage.setOpenAfterEnrollment( openAfterEnrollment );
+ programStage.setReportDateToUse( reportDateToUse );
Set<PatientReminder> patientReminders = new HashSet<PatientReminder>();
for ( int i = 0; i < daysAllowedSendMessages.size(); i++ )
@@ -360,7 +377,7 @@
Boolean allowed = allowProvidedElsewhere.get( i ) == null ? false : allowProvidedElsewhere.get( i );
Boolean displayInReport = displayInReports.get( i ) == null ? false : displayInReports.get( i );
Boolean allowDate = allowDateInFutures.get( i ) == null ? false : allowDateInFutures.get( i );
-
+
ProgramStageDataElement programStageDataElement = new ProgramStageDataElement( programStage, dataElement,
this.compulsories.get( i ), new Integer( i ) );
programStageDataElement.setAllowProvidedElsewhere( allowed );
=== 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 2013-09-16 09:47:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/UpdateProgramStageAction.java 2013-09-19 08:26:17 +0000
@@ -285,6 +285,20 @@
this.allowGenerateNextVisit = allowGenerateNextVisit;
}
+ private Boolean openAfterEnrollment;
+
+ public void setOpenAfterEnrollment( Boolean openAfterEnrollment )
+ {
+ this.openAfterEnrollment = openAfterEnrollment;
+ }
+
+ private String reportDateToUse;
+
+ public void setReportDateToUse( String reportDateToUse )
+ {
+ this.reportDateToUse = reportDateToUse;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -303,6 +317,7 @@
blockEntryForm = (blockEntryForm == null) ? false : blockEntryForm;
remindCompleted = (remindCompleted == null) ? false : remindCompleted;
allowGenerateNextVisit = (allowGenerateNextVisit == null) ? false : allowGenerateNextVisit;
+ openAfterEnrollment = (openAfterEnrollment == null) ? false : openAfterEnrollment;
ProgramStage programStage = programStageService.getProgramStage( id );
@@ -318,6 +333,8 @@
programStage.setRemindCompleted( remindCompleted );
programStage.setGeneratedByEnrollmentDate( generatedByEnrollmentDate );
programStage.setAllowGenerateNextVisit( allowGenerateNextVisit );
+ programStage.setOpenAfterEnrollment( openAfterEnrollment );
+ programStage.setReportDateToUse( reportDateToUse );
if ( !programStage.getProgram().isSingleEvent() )
{
@@ -361,7 +378,7 @@
Boolean allowed = allowProvidedElsewhere.get( i ) == null ? false : allowProvidedElsewhere.get( i );
Boolean displayInReport = displayInReports.get( i ) == null ? false : displayInReports.get( i );
Boolean allowDate = allowDateInFutures.get( i ) == null ? false : allowDateInFutures.get( i );
-
+
ProgramStageDataElement programStageDataElement = programStageDataElementService.get( programStage,
dataElement );
=== 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-09-19 03:16:23 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2013-09-19 08:26:17 +0000
@@ -475,5 +475,8 @@
data_entry_method = Data entry method
local_identifier = Local Identifier
scope = Scope
-drop_down_lists = drop-down lists
-radio_buttons = radio buttons
\ No newline at end of file
+drop_down_lists = Drop-down lists
+radio_buttons = Radio buttons
+open_data_entry_form_after_enrolment = Open data entry form after enrolment
+report_date_to_use = Report Date to use
+the_properties_to_open_data_entry_form_after_enrolment_is_active_in_the_stage = The properties to open data entry form after enrolment is active in the stage
\ 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 2013-09-16 09:47:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm 2013-09-19 08:26:17 +0000
@@ -67,6 +67,42 @@
<tr><th colspan="2">$i18n.getString( "form_details" )</th></tr>
+ #set($openAfterEnrollment = '' )
+ #foreach($ps in $program.programStages )
+ #if( $ps.openAfterEnrollment=='true')
+ #set($openAfterEnrollment = $ps.displayName )
+ #end
+ #end
+
+ #if($openAfterEnrollment!='' )
+ <tr>
+ <td colspan='2' style="color:grey;font-style:italic">$i18n.getString('the_properties_to_open_data_entry_form_after_enrolment_is_active_in_the_stage'): $openAfterEnrollment</td>
+ <td></td>
+ </tr>
+ #end
+
+ <tr>
+ <td><label>$i18n.getString( "open_data_entry_form_after_enrolment" )</label></td>
+ <td><input type="checkbox" id="openAfterEnrollment" name="openAfterEnrollment" value='true'
+ onchange="openAfterEnrollmentOnchange();"
+ #if($openAfterEnrollment!='' ) disabled #end >
+ </td>
+ <td></td>
+ </tr>
+
+ <tr>
+ <td><label>$i18n.getString( "report_date_to_use" )</label></td>
+ <td>
+ <select id="reportDateToUse" name="reportDateToUse" disabled class="{validate:{required:true}}" >
+ <option value=''>[$i18n.getString('please_select')]</option>
+ <option value='registrationDate'>$i18n.getString("registration_date")</option>
+ <option value='dateOfIncident'>$i18n.getString("date_of_incident")</option>
+ <option value='enrollmentDate'>$i18n.getString("date_of_enrollment")</option>
+ </select>
+ </td>
+ <td></td>
+ </tr>
+
<tr>
<td><label>$i18n.getString( "block_entry_form_after_completed" )</label></td>
<td><input type="checkbox" id="blockEntryForm" name="blockEntryForm" value='true'></td>
=== 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 2013-09-16 09:47:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programStage.js 2013-09-19 08:26:17 +0000
@@ -93,6 +93,11 @@
var allowGenerateNextVisit = ( json.programStage.allowGenerateNextVisit == 'true') ? i18n_yes : i18n_no;
setInnerHTML( 'allowGenerateNextVisitField', allowGenerateNextVisit );
+ var openAfterEnrollment = ( json.programStage.openAfterEnrollment == 'true') ? i18n_yes : i18n_no;
+ setInnerHTML( 'openAfterEnrollmentField', openAfterEnrollment );
+
+ setInnerHTML( 'reportDateToUseField', json.programStage.reportDateToUse );
+
var templateMessage = "";
for(var i in json.programStage.patientReminders){
var index = eval(i) + 1;
@@ -451,3 +456,13 @@
daysAllowedSendMessage.attr("realvalue", time * eval(daysAllowedSendMessage).val());
var aasdf= 0;
}
+
+function openAfterEnrollmentOnchange()
+{
+ if(byId('openAfterEnrollment').checked){
+ enable('reportDateToUse');
+ }
+ else{
+ disable('reportDateToUse');
+ }
+}
=== 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-09-18 15:34:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm 2013-09-19 08:26:17 +0000
@@ -46,9 +46,9 @@
#end
#if( $auth.hasAccess( "dhis-web-maintenance-patient", "programIndicator" ) && $program.type !='3' )
- <a href="programIndicator.action?programId=$program.id" title="$i18n.getString( 'program_indicator_management_form' )"><img src="../images/indicator.png" ></a>
+ <a href="programIndicator.action?programId=$program.id" title="$i18n.getString( 'program_indicator_management_form' )"><img src="images/program_indicator.png" ></a>
#else
- <img src="../images/indicator_disabled.png">
+ <img src="images/program_indicator_disabled.png">
#end
#if ( $security.canManage( $program ) )
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStage.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStage.vm 2013-09-12 05:49:31 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStage.vm 2013-09-19 08:26:17 +0000
@@ -73,6 +73,8 @@
<p><label class="bold">$i18n.getString( "capture_coordinates" ):</label><br><span id="captureCoordinatesField"></span></p>
<p><label class="bold">$i18n.getString( "complete_allowed_only_if_validation_passes" ):</label><br><span id="validCompleteOnlyField"></span></p>
<p><label class="bold">$i18n.getString( "report_date_description" ):</label><br><span id="reportDateDescriptionField"></span></p>
+ <p><label class="bold">$i18n.getString( "open_data_entry_form_after_enrolment" ):</label><br><span id="openAfterEnrollmentField"></span></p>
+ <p><label class="bold">$i18n.getString( "report_date_to_use" ):</label><br><span id="reportDateToUseField"></span></p>
<p><label class="bold">$i18n.getString( "no_of_dataelements" ):</label><br><span id="dataElementCountField"></span></p>
<p><span id="templateMessageField"></span></p>
</div>
=== 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 2013-09-16 09:47:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm 2013-09-19 08:26:17 +0000
@@ -69,6 +69,43 @@
<tr><th colspan="2">$i18n.getString( "form_details" )</th></tr>
+ #set($openAfterEnrollment = '' )
+ #foreach($ps in $programStage.program.programStages )
+ #if( $ps.openAfterEnrollment=='true' && $ps.id != $programStage.id )
+ #set($openAfterEnrollment = $ps.displayName )
+ #end
+ #end
+
+ #if($openAfterEnrollment!='' )
+ <tr>
+ <td colspan='2' style="color:grey;font-style:italic">$i18n.getString('the_properties_to_open_data_entry_form_after_enrolment_is_active_in_the_stage'): $openAfterEnrollment</td>
+ <td></td>
+ </tr>
+ #end
+
+ <tr>
+ <td><label>$i18n.getString( "open_data_entry_form_after_enrolment" )</label></td>
+ <td><input type="checkbox" id="openAfterEnrollment" name="openAfterEnrollment" value='true'
+ #if($programStage.openAfterEnrollment=='true') checked #end
+ #if($openAfterEnrollment!='' ) disabled #end
+ onchange="openAfterEnrollmentOnchange()" ></td>
+ <td></td>
+ </tr>
+
+ <tr>
+ <td><label>$i18n.getString( "report_date_to_use" )</label></td>
+ <td>
+ <select id="reportDateToUse" name="reportDateToUse" class="{validate:{required:true}}"
+ #if($openAfterEnrollment!='' ) disabled #elseif($programStage.openAfterEnrollment=='false') disabled #end >
+ <option value=''>[$i18n.getString('please_select')]</option>
+ <option value='registrationDate' #if($programStage.reportDateToUse=='registrationDate') selected #end >$i18n.getString("registration_date")</option>
+ <option value='dateOfIncident' #if($programStage.reportDateToUse=='dateOfIncident') selected #end >$i18n.getString("date_of_incident")</option>
+ <option value='enrollmentDate' #if($programStage.reportDateToUse=='enrollmentDate') selected #end >$i18n.getString("date_of_enrollment")</option>
+ </select>
+ </td>
+ <td></td>
+ </tr>
+
<tr>
<td><label>$i18n.getString( "block_entry_form_after_completed" )</label></td>
<td><input type="checkbox" id="blockEntryForm" name="blockEntryForm" value='true' #if( $programStage.blockEntryForm=='true' ) checked #end ></td>