dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #23062
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11211: Add sendTo property for PatientReminder
------------------------------------------------------------
revno: 11211
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-06-14 22:52:56 +0700
message:
Add sendTo property for PatientReminder
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientReminder.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/hibernate/HibernateProgramInstanceStore.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java
dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientReminder.hbm.xml
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/UpdateProgramAction.java
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/addProgramForm.vm
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/addProgramStageForm.js
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/programStage.js
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/updateProgramForm.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/patient/PatientReminder.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientReminder.java 2013-04-11 03:23:04 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientReminder.java 2013-06-14 15:52:56 +0000
@@ -39,11 +39,11 @@
private static final long serialVersionUID = 3101502417481903219L;
public static final String DUE_DATE_TO_COMPARE = "duedate";
-
+
public static final String ENROLLEMENT_DATE_TO_COMPARE = "enrollmentdate";
-
+
public static final String INCIDENT_DATE_TO_COMPARE = "dateofincident";
-
+
public static final String TEMPLATE_MESSSAGE_PATIENT_NAME = "{patient-name}";
public static final String TEMPLATE_MESSSAGE_PROGRAM_NAME = "{program-name}";
@@ -64,6 +64,14 @@
public static final String TEMPLATE_MESSSAGE_DAYS_SINCE_INCIDENT_DATE = "{days-since-incident-date}";
+ public static final int SEND_TO_PATIENT = 1;
+
+ public static final int SEND_TO_HEALTH_WORKER = 2;
+
+ public static final int SEND_TO_ORGUGNIT_REGISTERED = 3;
+
+ public static final int SEND_TO_ALL_USERS_IN_ORGUGNIT_REGISTERED = 4;
+
private int id;
private String name;
@@ -74,6 +82,8 @@
private String dateToCompare;
+ private Integer sendTo;
+
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
@@ -144,4 +154,14 @@
this.dateToCompare = dateToCompare;
}
+ public Integer getSendTo()
+ {
+ return sendTo;
+ }
+
+ public void setSendTo( Integer sendTo )
+ {
+ this.sendTo = sendTo;
+ }
+
}
=== 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-05-30 09:08:10 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2013-06-14 15:52:56 +0000
@@ -200,6 +200,8 @@
executeSql( "update program set remindCompleted=false where remindCompleted is null" );
executeSql( "update patientreminder set dateToCompare='duedate' where programstageid is not null" );
executeSql( "UPDATE programinstance SET followup=false where followup is null" );
+ executeSql( "UPDATE patientreminder SET sendTo=1 where sendTo is null" );
+
updateUid();
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramInstanceStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramInstanceStore.java 2013-04-12 08:56:05 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramInstanceStore.java 2013-06-14 15:52:56 +0000
@@ -212,23 +212,14 @@
public Collection<SchedulingProgramObject> getSendMesssageEvents( String dateToCompare )
{
- String sql = "SELECT pi.programinstanceid, p.phonenumber, prm.templatemessage, "
- + " p.firstname, p.middlename, p.lastname, org.name as orgunitName, "
- + " pg.name as programName, pi.dateofincident , "
- + " pi.enrollmentdate,(DATE(now()) - DATE(pi.enrollmentdate) ) as days_since_erollment_date, "
- + " (DATE(now()) - DATE(pi.dateofincident) ) as days_since_incident_date "
- + " FROM patient p INNER JOIN programinstance pi "
- + " ON p.patientid=pi.patientid INNER JOIN program pg "
- + " ON pg.programid=pi.programid INNER JOIN organisationunit org "
- + " ON org.organisationunitid = p.organisationunitid INNER JOIN patientreminder prm "
- + " ON prm.programid = pi.programid "
- + " WHERE pi.status= " + ProgramInstance.STATUS_ACTIVE
- + " and p.phonenumber is not NULL and p.phonenumber != '' "
- + " and prm.templatemessage is not NULL and prm.templatemessage != '' "
- + " and pg.type=1 and prm.daysallowedsendmessage is not null "
- + " and ( DATE(now()) - DATE(pi." + dateToCompare + ") ) = prm.daysallowedsendmessage "
- + " and prm.dateToCompare='" + dateToCompare + "'";
+ String sql = " ( " + sendToPatientSql( dateToCompare ) + " ) ";
+
+ sql += " UNION ( " + sendToHealthWorkerSql( dateToCompare ) + " ) ";
+
+ sql += " UNION ( " + sendMessageToOrgunitRegisteredSql( dateToCompare ) + " ) ";
+ sql += " UNION ( " + sendMessageToUsersSql( dateToCompare ) + " ) ";
+
SqlRowSet rs = jdbcTemplate.queryForRowSet( sql );
int cols = rs.getMetaData().getColumnCount();
@@ -244,9 +235,17 @@
String patientName = rs.getString( "firstName" );
String organisationunitName = rs.getString( "orgunitName" );
String programName = rs.getString( "programName" );
- String incidentDate = rs.getString( "dateofincident" ).split( " " )[0];// just get date, remove timestamp
+ String incidentDate = rs.getString( "dateofincident" ).split( " " )[0];// just
+ // get
+ // date,
+ // remove
+ // timestamp
String daysSinceIncidentDate = rs.getString( "days_since_incident_date" );
- String erollmentDate = rs.getString( "enrollmentdate" ).split( " " )[0];// just get date, remove timestamp
+ String erollmentDate = rs.getString( "enrollmentdate" ).split( " " )[0];// just
+ // get
+ // date,
+ // remove
+ // timestamp
String daysSinceEnrollementDate = rs.getString( "days_since_erollment_date" );
message = message.replace( PatientReminder.TEMPLATE_MESSSAGE_PATIENT_NAME, patientName );
@@ -254,8 +253,10 @@
message = message.replace( PatientReminder.TEMPLATE_MESSSAGE_ORGUNIT_NAME, organisationunitName );
message = message.replace( PatientReminder.TEMPLATE_MESSSAGE_INCIDENT_DATE, incidentDate );
message = message.replace( PatientReminder.TEMPLATE_MESSSAGE_ENROLLMENT_DATE, erollmentDate );
- message = message.replace( PatientReminder.TEMPLATE_MESSSAGE_DAYS_SINCE_ENROLLMENT_DATE, daysSinceEnrollementDate );
- message = message.replace( PatientReminder.TEMPLATE_MESSSAGE_DAYS_SINCE_INCIDENT_DATE, daysSinceIncidentDate );
+ message = message.replace( PatientReminder.TEMPLATE_MESSSAGE_DAYS_SINCE_ENROLLMENT_DATE,
+ daysSinceEnrollementDate );
+ message = message.replace( PatientReminder.TEMPLATE_MESSSAGE_DAYS_SINCE_INCIDENT_DATE,
+ daysSinceIncidentDate );
}
SchedulingProgramObject schedulingProgramObject = new SchedulingProgramObject();
@@ -268,5 +269,99 @@
return schedulingProgramObjects;
}
-
+
+
+ private String sendToPatientSql( String dateToCompare )
+ {
+ return "SELECT pi.programinstanceid, p.phonenumber, prm.templatemessage, "
+ + " p.firstname, p.middlename, p.lastname, org.name as orgunitName, "
+ + " pg.name as programName, pi.dateofincident , "
+ + " pi.enrollmentdate,(DATE(now()) - DATE(pi.enrollmentdate) ) as days_since_erollment_date, "
+ + " (DATE(now()) - DATE(pi.dateofincident) ) as days_since_incident_date "
+ + " FROM patient p INNER JOIN programinstance pi "
+ + " ON p.patientid=pi.patientid INNER JOIN program pg "
+ + " ON pg.programid=pi.programid INNER JOIN organisationunit org "
+ + " ON org.organisationunitid = p.organisationunitid INNER JOIN patientreminder prm "
+ + " ON prm.programid = pi.programid " + " WHERE pi.status= "
+ + ProgramInstance.STATUS_ACTIVE + " and p.phonenumber is not NULL and p.phonenumber != '' "
+ + " and prm.templatemessage is not NULL and prm.templatemessage != '' "
+ + " and pg.type=1 and prm.daysallowedsendmessage is not null "
+ + " and ( DATE(now()) - DATE(pi." + dateToCompare + ") ) = prm.daysallowedsendmessage "
+ + " and prm.dateToCompare='" + dateToCompare + "' and prm.sendto = "
+ + PatientReminder.SEND_TO_PATIENT;
+ }
+
+ private String sendToHealthWorkerSql( String dateToCompare )
+ {
+ return "SELECT pi.programinstanceid, uif.phonenumber, prm.templatemessage, p.firstname, p.middlename, p.lastname, org.name as orgunitName, "
+ + " pg.name as programName, pi.dateofincident, pi.enrollmentdate,(DATE(now()) - DATE(pi.enrollmentdate) ) as days_since_erollment_date, "
+ + " (DATE(now()) - DATE(pi.dateofincident) ) as days_since_incident_date "
+ + " FROM patient p INNER JOIN programinstance pi "
+ + " ON p.patientid=pi.patientid INNER JOIN program pg "
+ + " ON pg.programid=pi.programid INNER JOIN organisationunit org "
+ + " ON org.organisationunitid = p.organisationunitid INNER JOIN patientreminder prm "
+ + " ON prm.programid = pi.programid INNER JOIN users us "
+ + " ON us.userid=p.healthworkerid INNER JOIN userinfo uif "
+ + " ON us.userid=uif.userinfoid "
+ + " WHERE pi.status = "
+ + ProgramInstance.STATUS_ACTIVE
+ + " and uif.phonenumber is not NULL and uif.phonenumber != '' "
+ + " and prm.templatemessage is not NULL and prm.templatemessage != '' "
+ + " and pg.type=1 and prm.daysallowedsendmessage is not null "
+ + " and ( DATE(now()) - DATE( pi."
+ + dateToCompare
+ + " ) ) = prm.daysallowedsendmessage "
+ + " and prm.dateToCompare='"
+ + dateToCompare
+ + "' and prm.sendto = " + PatientReminder.SEND_TO_HEALTH_WORKER;
+ }
+
+ private String sendMessageToOrgunitRegisteredSql( String dateToCompare )
+ {
+ return "SELECT pi.programinstanceid, org.phonenumber, prm.templatemessage, p.firstname, p.middlename, p.lastname, org.name as orgunitName, "
+ + " pg.name as programName, pi.dateofincident, pi.enrollmentdate,(DATE(now()) - DATE(pi.enrollmentdate) ) as days_since_erollment_date, "
+ + " (DATE(now()) - DATE(pi.dateofincident) ) as days_since_incident_date "
+ + " FROM patient p INNER JOIN programinstance pi "
+ + " ON p.patientid=pi.patientid INNER JOIN program pg "
+ + " ON pg.programid=pi.programid INNER JOIN organisationunit org "
+ + " ON org.organisationunitid = p.organisationunitid INNER JOIN patientreminder prm "
+ + " ON prm.programid = pi.programid "
+ + " WHERE pi.status = "
+ + ProgramInstance.STATUS_ACTIVE
+ + " and org.phonenumber is not NULL and org.phonenumber != '' "
+ + " and prm.templatemessage is not NULL and prm.templatemessage != '' "
+ + " and pg.type=1 and prm.daysallowedsendmessage is not null "
+ + " and ( DATE(now()) - DATE( pi."
+ + dateToCompare
+ + " ) ) = prm.daysallowedsendmessage "
+ + " and prm.dateToCompare='"
+ + dateToCompare
+ + "' and prm.sendto = " + PatientReminder.SEND_TO_ORGUGNIT_REGISTERED;
+ }
+
+ private String sendMessageToUsersSql( String dateToCompare )
+ {
+ return "SELECT pi.programinstanceid, uif.phonenumber, prm.templatemessage, p.firstname, p.middlename, p.lastname, org.name as orgunitName, pg.name as programName, pi.dateofincident ,"
+ + "pi.enrollmentdate,(DATE(now()) - DATE(pi.enrollmentdate) ) as days_since_erollment_date, "
+ + "(DATE(now()) - DATE(pi.dateofincident) ) as days_since_incident_date "
+ + "FROM patient p INNER JOIN programinstance pi "
+ + " ON p.patientid=pi.patientid INNER JOIN program pg "
+ + " ON pg.programid=pi.programid INNER JOIN organisationunit org "
+ + " ON org.organisationunitid = p.organisationunitid INNER JOIN patientreminder prm "
+ + " ON prm.programid = pi.programid INNER JOIN usermembership ums "
+ + " ON ums.organisationunitid = p.organisationunitid INNER JOIN userinfo uif "
+ + " ON uif.userinfoid = ums.userinfoid "
+ + "WHERE pi.status= 0 "
+ + " and uif.phonenumber is not NULL and uif.phonenumber != '' "
+ + " and prm.templatemessage is not NULL and prm.templatemessage != '' "
+ + " and pg.type=1 and prm.daysallowedsendmessage is not null "
+ + " and ( DATE(now()) - DATE( "
+ + dateToCompare
+ + " ) ) = prm.daysallowedsendmessage "
+ + " and prm.dateToCompare='"
+ + dateToCompare
+ + "' and prm.sendto = "
+ + PatientReminder.SEND_TO_ALL_USERS_IN_ORGUGNIT_REGISTERED;
+ }
+
}
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java 2013-06-07 02:58:05 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java 2013-06-14 15:52:56 +0000
@@ -393,27 +393,13 @@
public Collection<SchedulingProgramObject> getSendMesssageEvents()
{
- String sql = "select psi.programstageinstanceid, p.phonenumber, prm.templatemessage, p.firstname, p.middlename, p.lastname, org.name as orgunitName "
- + ",pg.name as programName, ps.name as programStageName, psi.duedate,(DATE(now()) - DATE(psi.duedate) ) as days_since_due_date,psi.duedate "
- + "from patient p INNER JOIN programinstance pi "
- + " ON p.patientid=pi.patientid "
- + " INNER JOIN programstageinstance psi "
- + " ON psi.programinstanceid=pi.programinstanceid "
- + " INNER JOIN program pg "
- + " ON pg.programid=pi.programid "
- + " INNER JOIN programstage ps "
- + " ON ps.programstageid=psi.programstageid "
- + " INNER JOIN organisationunit org "
- + " ON org.organisationunitid = p.organisationunitid "
- + " INNER JOIN patientreminder prm "
- + " ON prm.programstageid = ps.programstageid "
- + "WHERE pi.status="
- + ProgramInstance.STATUS_ACTIVE
- + " and p.phonenumber is not NULL and p.phonenumber != '' "
- + " and prm.templatemessage is not NULL and prm.templatemessage != '' "
- + " and pg.type=1 and prm.daysallowedsendmessage is not null "
- + " and psi.executiondate is null "
- + " and ( DATE(now()) - DATE(psi.duedate) ) = prm.daysallowedsendmessage ";
+ String sql = " ( " + sendMessageToPatientSql() + " ) ";
+
+ sql += " UNION ( " + sendMessageToHealthWorkerSql() + " ) ";
+
+ sql += " UNION ( " + sendMessageToOrgunitRegisteredSql() + " ) ";
+
+ sql += " UNION ( " + sendMessageToUsersSql() + " ) ";
SqlRowSet rs = jdbcTemplate.queryForRowSet( sql );
@@ -510,12 +496,12 @@
}
// Filter is only one orgunit
-
+
if ( position == PatientAggregateReport.POSITION_ROW_PERIOD_COLUMN_DATA )
{
String orgunitName = organisationUnitService.getOrganisationUnit( orgunitIds.iterator().next() )
.getDisplayName();
-
+
grid.setSubtitle( subTitle + i18n.getString( "orgunit" ) + ": " + orgunitName );
}
// Filter is only one period
@@ -537,7 +523,7 @@
String endDate = format.formatDate( period.getEndDate() );
periodName += startDate + " -> " + endDate;
}
-
+
grid.setSubtitle( subTitle + i18n.getString( "period" ) + ": " + periodName );
}
else
@@ -577,7 +563,7 @@
{
filterDataDes = "; " + i18n.getString( "data_filter" ) + ": " + filterDataDes;
}
-
+
subTitle += filterOrgunitDes + filterPeriodDes + filterDataDes;
if ( subTitle.isEmpty() )
{
@@ -588,7 +574,7 @@
grid.setSubtitle( subTitle );
}
}
-
+
// ---------------------------------------------------------------------
// Get SQL and build grid
// ---------------------------------------------------------------------
@@ -1288,13 +1274,13 @@
}
sql = sql.substring( 0, sql.length() - 6 ) + " ) ";
-
+
sql += " ORDER BY orgunit asc ";
if ( limit != null )
{
sql += "LIMIT " + limit;
}
-
+
return sql;
}
@@ -1379,13 +1365,13 @@
}
sql = sql.substring( 0, sql.length() - 10 );
-
- if( periods.size() > 1 )
-
- if ( limit != null )
- {
- sql += " LIMIT " + limit;
- }
+
+ if ( periods.size() > 1 )
+
+ if ( limit != null )
+ {
+ sql += " LIMIT " + limit;
+ }
return sql;
}
@@ -1909,7 +1895,7 @@
**/
private String getAggregateReportSQL9( ProgramStage programStage, Integer root, String facilityLB,
String filterSQL, Integer deGroupBy, Integer deSum, Collection<Period> periods, String aggregateType,
- Integer limit, Boolean useCompletedEvents, Boolean useFormNameDataElement,I18nFormat format )
+ Integer limit, Boolean useCompletedEvents, Boolean useFormNameDataElement, I18nFormat format )
{
String sql = "";
Collection<Integer> allOrgunitIds = getOrganisationUnits( root, facilityLB );
@@ -1954,7 +1940,7 @@
{
groupByName = dataElement.getFormNameFallback();
}
-
+
for ( String deValue : deValues )
{
sql += "(SELECT DISTINCT '" + deValue + "' as \"" + groupByName + "\", ";
@@ -2247,7 +2233,7 @@
for ( int i = 1; i <= cols; i++ )
{
// meta column
- if ( rs.getMetaData().getColumnType( i ) == Types.VARCHAR
+ if ( rs.getMetaData().getColumnType( i ) == Types.VARCHAR
|| rs.getMetaData().getColumnType( i ) == Types.OTHER )
{
grid.addValue( rs.getObject( i ) );
@@ -2390,4 +2376,120 @@
}
}
+ private String sendMessageToPatientSql()
+ {
+ return "select psi.programstageinstanceid, p.phonenumber, prm.templatemessage, p.firstname, p.middlename, p.lastname, org.name as orgunitName "
+ + ",pg.name as programName, ps.name as programStageName, psi.duedate,(DATE(now()) - DATE(psi.duedate) ) as days_since_due_date "
+ + "from patient p INNER JOIN programinstance pi "
+ + " ON p.patientid=pi.patientid "
+ + " INNER JOIN programstageinstance psi "
+ + " ON psi.programinstanceid=pi.programinstanceid "
+ + " INNER JOIN program pg "
+ + " ON pg.programid=pi.programid "
+ + " INNER JOIN programstage ps "
+ + " ON ps.programstageid=psi.programstageid "
+ + " INNER JOIN organisationunit org "
+ + " ON org.organisationunitid = p.organisationunitid "
+ + " INNER JOIN patientreminder prm "
+ + " ON prm.programstageid = ps.programstageid "
+ + "WHERE pi.status="
+ + ProgramInstance.STATUS_ACTIVE
+ + " and p.phonenumber is not NULL and p.phonenumber != '' "
+ + " and prm.templatemessage is not NULL and prm.templatemessage != '' "
+ + " and pg.type=1 and prm.daysallowedsendmessage is not null "
+ + " and psi.executiondate is null "
+ + " and ( DATE(now()) - DATE(psi.duedate) ) = prm.daysallowedsendmessage "
+ + " and prm.sendto = " + PatientReminder.SEND_TO_PATIENT;
+ }
+
+ private String sendMessageToHealthWorkerSql()
+ {
+ return "SELECT psi.programstageinstanceid, uif.phonenumber, prm.templatemessage,p.firstname, p.middlename, p.lastname, org.name as orgunitName, "
+ + "pg.name as programName, ps.name as programStageName, psi.duedate, "
+ + " (DATE(now()) - DATE(psi.duedate) ) as days_since_due_date "
+ + " FROM patient p INNER JOIN programinstance pi "
+ + " ON p.patientid=pi.patientid "
+ + " INNER JOIN programstageinstance psi "
+ + " ON psi.programinstanceid=pi.programinstanceid "
+ + " INNER JOIN program pg "
+ + " ON pg.programid=pi.programid "
+ + " INNER JOIN programstage ps "
+ + " ON ps.programstageid=psi.programstageid "
+ + " INNER JOIN organisationunit org "
+ + " ON org.organisationunitid = p.organisationunitid "
+ + " INNER JOIN patientreminder prm "
+ + " ON prm.programstageid = ps.programstageid "
+ + " INNER JOIN users us"
+ + " ON us.userid=p.healthworkerid "
+ + " INNER JOIN userinfo uif "
+ + " ON us.userid=uif.userinfoid "
+ + " WHERE pi.status="
+ + ProgramInstance.STATUS_ACTIVE
+ + " and uif.phonenumber is not NULL and uif.phonenumber != '' "
+ + " and prm.templatemessage is not NULL and prm.templatemessage != '' "
+ + " and pg.type=1 and prm.daysallowedsendmessage is not null "
+ + " and psi.executiondate is null "
+ + " and ( DATE(now()) - DATE(psi.duedate) ) = prm.daysallowedsendmessage "
+ + " and prm.sendto = " + PatientReminder.SEND_TO_HEALTH_WORKER;
+ }
+
+ private String sendMessageToOrgunitRegisteredSql()
+ {
+ return "select psi.programstageinstanceid, ou.phonenumber, prm.templatemessage, p.firstname, p.middlename, p.lastname, org.name as orgunitName, "
+ + "pg.name as programName, ps.name as programStageName, psi.duedate,"
+ + "(DATE(now()) - DATE(psi.duedate) ) as days_since_due_date "
+ + " from patient p INNER JOIN programinstance pi "
+ + " ON p.patientid=pi.patientid "
+ + " INNER JOIN programstageinstance psi "
+ + " ON psi.programinstanceid=pi.programinstanceid "
+ + " INNER JOIN program pg "
+ + " ON pg.programid=pi.programid "
+ + " INNER JOIN programstage ps "
+ + " ON ps.programstageid=psi.programstageid "
+ + " INNER JOIN organisationunit org "
+ + " ON org.organisationunitid = p.organisationunitid "
+ + " INNER JOIN patientreminder prm "
+ + " ON prm.programstageid = ps.programstageid "
+ + " INNER JOIN organisationunit ou "
+ + " ON ou.organisationunitid=p.organisationunitid "
+ + "WHERE pi.status= "
+ + ProgramInstance.STATUS_ACTIVE
+ + " and ou.phonenumber is not NULL and ou.phonenumber != '' "
+ + " and prm.templatemessage is not NULL and prm.templatemessage != '' "
+ + " and pg.type=1 and prm.daysallowedsendmessage is not null "
+ + " and psi.executiondate is null "
+ + " and ( DATE(now()) - DATE(psi.duedate) ) = prm.daysallowedsendmessage "
+ + " and prm.sendto = " + + PatientReminder.SEND_TO_ORGUGNIT_REGISTERED;
+ }
+
+ private String sendMessageToUsersSql()
+ {
+ return "select psi.programstageinstanceid, uif.phonenumber,prm.templatemessage, p.firstname, p.middlename, p.lastname, org.name as orgunitName ,"
+ + " pg.name as programName, ps.name as programStageName, psi.duedate, "
+ + "(DATE(now()) - DATE(psi.duedate) ) as days_since_due_date "
+ + " from patient p INNER JOIN programinstance pi "
+ + " ON p.patientid=pi.patientid "
+ + " INNER JOIN programstageinstance psi "
+ + " ON psi.programinstanceid=pi.programinstanceid "
+ + " INNER JOIN program pg "
+ + " ON pg.programid=pi.programid "
+ + " INNER JOIN programstage ps "
+ + " ON ps.programstageid=psi.programstageid "
+ + " INNER JOIN patientreminder prm "
+ + " ON prm.programstageid = ps.programstageid "
+ + " INNER JOIN organisationunit org "
+ + " ON org.organisationunitid = p.organisationunitid "
+ + " INNER JOIN usermembership ums "
+ + " ON ums.organisationunitid = p.organisationunitid "
+ + " INNER JOIN userinfo uif "
+ + " ON uif.userinfoid = ums.userinfoid "
+ + " WHERE pi.status= "
+ + ProgramInstance.STATUS_ACTIVE
+ + " and uif.phonenumber is not NULL and uif.phonenumber != '' "
+ + " and prm.templatemessage is not NULL and prm.templatemessage != '' "
+ + " and pg.type=1 and prm.daysallowedsendmessage is not null "
+ + " and psi.executiondate is null "
+ + " and ( DATE(now()) - DATE(psi.duedate) ) = prm.daysallowedsendmessage "
+ + " and prm.sendto = " + PatientReminder.SEND_TO_ALL_USERS_IN_ORGUGNIT_REGISTERED;
+ }
}
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientReminder.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientReminder.hbm.xml 2013-04-11 03:23:04 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientReminder.hbm.xml 2013-06-14 15:52:56 +0000
@@ -17,6 +17,8 @@
<property name="templateMessage" />
<property name="dateToCompare" />
+
+ <property name="sendTo" />
</class>
</hibernate-mapping>
=== 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-05-15 09:14:57 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java 2013-06-14 15:52:56 +0000
@@ -221,6 +221,13 @@
this.datesToCompare = datesToCompare;
}
+ private List<Integer> sendTo = new ArrayList<Integer>();
+
+ public void setSendTo( List<Integer> sendTo )
+ {
+ this.sendTo = sendTo;
+ }
+
private Boolean disableRegistrationFields;
public void setDisableRegistrationFields( Boolean disableRegistrationFields )
@@ -316,6 +323,7 @@
PatientReminder reminder = new PatientReminder( "", daysAllowedSendMessages.get( i ),
templateMessages.get( i ) );
reminder.setDateToCompare( datesToCompare.get( i ) );
+ reminder.setSendTo( sendTo.get( i ) );
patientReminders.add( reminder );
}
program.setPatientReminders( patientReminders );
=== 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-05-21 04:05:54 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UpdateProgramAction.java 2013-06-14 15:52:56 +0000
@@ -217,6 +217,13 @@
this.datesToCompare = datesToCompare;
}
+ private List<Integer> sendTo = new ArrayList<Integer>();
+
+ public void setSendTo( List<Integer> sendTo )
+ {
+ this.sendTo = sendTo;
+ }
+
private Boolean disableRegistrationFields;
public void setDisableRegistrationFields( Boolean disableRegistrationFields )
@@ -309,6 +316,7 @@
PatientReminder reminder = new PatientReminder( "", daysAllowedSendMessages.get( i ),
templateMessages.get( i ) );
reminder.setDateToCompare( datesToCompare.get( i ) );
+ reminder.setSendTo( sendTo.get( i ) );
patientReminders.add( reminder );
}
program.setPatientReminders( 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-05-29 09:05:09 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/AddProgramStageAction.java 2013-06-14 15:52:56 +0000
@@ -177,6 +177,13 @@
this.templateMessages = templateMessages;
}
+ private List<Integer> sendTo = new ArrayList<Integer>();
+
+ public void setSendTo( List<Integer> sendTo )
+ {
+ this.sendTo = sendTo;
+ }
+
private Boolean autoGenerateEvent;
public void setAutoGenerateEvent( Boolean autoGenerateEvent )
@@ -204,14 +211,14 @@
{
this.displayGenerateEventBox = displayGenerateEventBox;
}
-
+
private Boolean captureCoordinates;
-
+
public void setCaptureCoordinates( Boolean captureCoordinates )
{
this.captureCoordinates = captureCoordinates;
}
-
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -224,8 +231,8 @@
autoGenerateEvent = (autoGenerateEvent == null) ? false : autoGenerateEvent;
validCompleteOnly = (validCompleteOnly == null) ? false : validCompleteOnly;
displayGenerateEventBox = (displayGenerateEventBox == null) ? false : displayGenerateEventBox;
- captureCoordinates = (captureCoordinates == null) ? false : captureCoordinates;
-
+ captureCoordinates = (captureCoordinates == null) ? false : captureCoordinates;
+
ProgramStage programStage = new ProgramStage();
Program program = programService.getProgram( id );
@@ -247,6 +254,7 @@
PatientReminder reminder = new PatientReminder( "", daysAllowedSendMessages.get( i ),
templateMessages.get( i ) );
reminder.setDateToCompare( PatientReminder.DUE_DATE_TO_COMPARE );
+ reminder.setSendTo( sendTo.get( i ) );
patientReminders.add( reminder );
}
programStage.setPatientReminders( patientReminders );
=== 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-05-29 09:05:09 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/UpdateProgramStageAction.java 2013-06-14 15:52:56 +0000
@@ -170,6 +170,13 @@
this.templateMessages = templateMessages;
}
+ private List<Integer> sendTo = new ArrayList<Integer>();
+
+ public void setSendTo( List<Integer> sendTo )
+ {
+ this.sendTo = sendTo;
+ }
+
private Boolean autoGenerateEvent;
public void setAutoGenerateEvent( Boolean autoGenerateEvent )
@@ -238,6 +245,7 @@
PatientReminder reminder = new PatientReminder( "", daysAllowedSendMessages.get( i ),
templateMessages.get( i ) );
reminder.setDateToCompare( PatientReminder.DUE_DATE_TO_COMPARE );
+ reminder.setSendTo( sendTo.get( i ) );
patientReminders.add( reminder );
}
programStage.setPatientReminders( patientReminders );
=== 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-06-06 13:14:39 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2013-06-14 15:52:56 +0000
@@ -411,4 +411,7 @@
patient_attribute_visit_schedule = Patient Attribute Visit Schedule
patient_attribute_visit_schedule_form = Patient attribute visit schedule
intro_patient_attribute_visit_schedule = Configure which person attributes are added to the visit schedule. Gives better overview when used for tracking.
-selected_program_stages = Selected program stages
\ No newline at end of file
+selected_program_stages = Selected program stages
+patient = Person
+orgunit_registered = Organisation unit registered
+all_users_in_orgunit_registered = All users in organisation unit registered
\ 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-05-30 06:49:25 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramForm.vm 2013-06-14 15:52:56 +0000
@@ -31,6 +31,9 @@
var datesToCompare = jQuery( "#datesToCompare" );
datesToCompare.empty();
+ var sendTo = jQuery( "#sendTo" );
+ sendTo.empty();
+
jQuery(".daysAllowedSendMessage").each( function( i, item ){
daysAllowedSendMessages.append( "<option value='" + item.value + "' selected='true'>" + item.value +"</option>" );
});
@@ -43,6 +46,10 @@
datesToCompare.append( "<option value='" + item.value + "' selected='true'>" +item.value+"</option>" );
});
+ jQuery(".sendTo").each( function( i, item ){
+ sendTo.append( "<option value='" + item.value + "' selected='true'>" + item.value +"</option>" );
+ });
+
var selectedPropertyIds = jQuery( "#selectedPropertyIds" );
selectedPropertyIds.empty();
var personDisplayNames = jQuery( "#personDisplayNames" );
@@ -66,11 +73,13 @@
<h3>$i18n.getString( "create_new_program" )</h3>
-<form id="addProgramForm" name="addProgramForm" action="addProgram.action" method="post" >
+<form id="addProgramForm" name="addProgramForm" action="addProgram.action" method="get" >
<select id='daysAllowedSendMessages' name="daysAllowedSendMessages" multiple="multiple" class="hidden"></select>
<select id='templateMessages' name="templateMessages" multiple="multiple" class="hidden"></select>
<select id='datesToCompare' name="datesToCompare" multiple="multiple" class="hidden"></select>
+<select id='sendTo' name="sendTo" multiple="multiple" class="hidden"></select>
+
<table>
<thead>
<tr>
@@ -276,4 +285,9 @@
var i18n_message = '$encoder.jsEscape( $i18n.getString( "message" ) , "'")';
var i18n_name_exists = '$encoder.jsEscape( $i18n.getString( "name_exists" ) , "'")';
var i18n_date_to_compare = '$encoder.jsEscape( $i18n.getString( "date_to_compare" ) , "'")';
+ var i18n_send_to = '$encoder.jsEscape( $i18n.getString( "send_to" ) , "'")';
+ var i18n_patient = '$encoder.jsEscape( $i18n.getString( "patient" ) , "'")';
+ var i18n_health_worker = '$encoder.jsEscape( $i18n.getString( "health_worker" ) , "'")';
+ var i18n_orgunit_registered = '$encoder.jsEscape( $i18n.getString( "orgunit_registered" ) , "'")';
+ var i18n_all_users_in_orgunit_registered = '$encoder.jsEscape( $i18n.getString( "all_users_in_orgunit_registered" ) , "'")';
</script>
=== 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-04-18 06:45:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm 2013-06-14 15:52:56 +0000
@@ -9,6 +9,8 @@
<input type='hidden' id="id" name="id" value="$program.id"/>
<select id='daysAllowedSendMessages' name="daysAllowedSendMessages" multiple="multiple" class="hidden"></select>
<select id='templateMessages' name="templateMessages" multiple="multiple" class="hidden"></select>
+ <select id='sendTo' name="sendTo" multiple="multiple" class="hidden"></select>
+
<table>
<thead>
<tr><th colspan="2">$i18n.getString( "program_stage_details" )</th></tr>
@@ -175,6 +177,11 @@
var i18n_days_since_due_date = '$encoder.jsEscape( $i18n.getString( "days_since_due_date" ) , "'")';
var i18n_message = '$encoder.jsEscape( $i18n.getString( "message" ) , "'")';
var i18n_name_exists = '$encoder.jsEscape( $i18n.getString( "name_exists" ) , "'")';
+ var i18n_send_to = '$encoder.jsEscape( $i18n.getString( "send_to" ) , "'")';
+ var i18n_patient = '$encoder.jsEscape( $i18n.getString( "patient" ) , "'")';
+ var i18n_health_worker = '$encoder.jsEscape( $i18n.getString( "health_worker" ) , "'")';
+ var i18n_orgunit_registered = '$encoder.jsEscape( $i18n.getString( "orgunit_registered" ) , "'")';
+ var i18n_all_users_in_orgunit_registered = '$encoder.jsEscape( $i18n.getString( "all_users_in_orgunit_registered" ) , "'")';
var programStageList = new Array();
#foreach($programStage in $program.programStages)
=== 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 2013-04-08 08:33:27 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addProgramStageForm.js 2013-06-14 15:52:56 +0000
@@ -37,6 +37,9 @@
var allowProvidedElsewhere = jQuery( "#allowProvidedElsewhere" );
allowProvidedElsewhere.empty();
+ var sendTo = jQuery( "#sendTo" );
+ sendTo.empty();
+
jQuery("#selectedList").find("tr").each( function( i, item ){
selectedDataElementsValidator.append( "<option value='" + item.id + "' selected='true'>" + item.id + "</option>" );
@@ -59,6 +62,9 @@
jQuery(".templateMessage").each( function( i, item ){
templateMessages.append( "<option value='" + item.value + "' selected='true'>" +item.value+"</option>" );
});
+ jQuery(".sendTo").each( function( i, item ){
+ sendTo.append( "<option value='" + item.value + "' selected='true'>" + item.value +"</option>" );
+ });
});
jQuery("#availableList").dhisAjaxSelect({
=== 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-05-16 06:09:31 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js 2013-06-14 15:52:56 +0000
@@ -139,7 +139,6 @@
}
}
-
function selectAllProperties()
{
var selectedList = jQuery("#selectedList");
@@ -169,7 +168,6 @@
});
}
-
function unSelectAllProperties()
{
var availableList = jQuery("#availablePropertyIds");
@@ -281,6 +279,17 @@
+ '<td><label>' + i18n_days_before_after_comparison_date + '</label></td>'
+ '<td><input type="text" id="daysAllowedSendMessage' + rowId + '" name="daysAllowedSendMessage' + rowId + '" class="daysAllowedSendMessage {validate:{required:true,number:true}}"/></td>'
+ '</tr>'
+ + '<tr>'
+ + '<td><label>' + i18n_send_to + '</label></td>'
+ + '<td>'
+ + '<select id="sendTo' + rowId + '" name="sendTo' + rowId + '" class="sendTo" >'
+ + '<option value="1">' + i18n_patient + '</option>'
+ + '<option value="2">' + i18n_health_worker + '</option>'
+ + '<option value="3">' + i18n_orgunit_registered + '</option>'
+ + '<option value="4">' + i18n_all_users_in_orgunit_registered + '</option>'
+ + '</select>'
+ + '</td>'
+ + '/<tr>'
+ '<tr name="tr' + rowId + '">'
+ '<td>' + i18n_params + '</td>'
+ '<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-04-08 08:46:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programStage.js 2013-06-14 15:52:56 +0000
@@ -269,6 +269,17 @@
+ '<td><label>' + i18n_days_before_after_due_date + '</label></td>'
+ '<td><input type="text" id="daysAllowedSendMessage' + rowId + '" name="daysAllowedSendMessage' + rowId + '" class="daysAllowedSendMessage {validate:{required:true,number:true}}"/></td>'
+ '</tr>'
+ + '<tr>'
+ + '<td><label>' + i18n_send_to + '</label></td>'
+ + '<td>'
+ + '<select id="sendTo' + rowId + '" name="sendTo' + rowId + '" class="sendTo" >'
+ + '<option value="1">' + i18n_patient + '</option>'
+ + '<option value="2">' + i18n_health_worker + '</option>'
+ + '<option value="3">' + i18n_orgunit_registered + '</option>'
+ + '<option value="4">' + i18n_all_users_in_orgunit_registered + '</option>'
+ + '</select>'
+ + '</td>'
+ + '/<tr>'
+ '<tr name="tr' + rowId + '">'
+ '<td>' + i18n_params + '</td>'
+ '<td>'
=== 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 2013-04-08 08:46:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramStageForm.js 2013-06-14 15:52:56 +0000
@@ -34,6 +34,9 @@
var templateMessages = jQuery( "#templateMessages" );
templateMessages.empty();
+ var sendTo = jQuery( "#sendTo" );
+ sendTo.empty();
+
allowProvidedElsewhere = jQuery( "#allowProvidedElsewhere" );
allowProvidedElsewhere.empty();
@@ -59,6 +62,9 @@
jQuery(".templateMessage").each( function( i, item ){
templateMessages.append( "<option value='" + item.value + "' selected='true'>" +item.value+"</option>" );
});
+ jQuery(".sendTo").each( function( i, item ){
+ sendTo.append( "<option value='" + item.value + "' selected='true'>" + item.value +"</option>" );
+ });
});
checkValueIsExist( "name", "validateProgramStage.action", {id:getFieldValue('programId'), programStageId:getFieldValue('id')});
=== 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-05-17 09:12:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramForm.vm 2013-06-14 15:52:56 +0000
@@ -31,6 +31,9 @@
var datesToCompare = jQuery( "#datesToCompare" );
datesToCompare.empty();
+ var sendTo = jQuery( "#sendTo" );
+ sendTo.empty();
+
jQuery(".daysAllowedSendMessage").each( function( i, item ){
daysAllowedSendMessages.append( "<option value='" + item.value + "' selected='true'>" + item.value +"</option>" );
});
@@ -43,6 +46,10 @@
datesToCompare.append( "<option value='" + item.value + "' selected='true'>" +item.value+"</option>" );
});
+ jQuery(".sendTo").each( function( i, item ){
+ sendTo.append( "<option value='" + item.value + "' selected='true'>" + item.value +"</option>" );
+ });
+
var selectedPropertyIds = jQuery( "#selectedPropertyIds" );
selectedPropertyIds.empty();
var personDisplayNames = jQuery( "#personDisplayNames" );
@@ -69,6 +76,8 @@
<select id='daysAllowedSendMessages' name="daysAllowedSendMessages" multiple="multiple" class="hidden"></select>
<select id='templateMessages' name="templateMessages" multiple="multiple" class="hidden"></select>
<select id='datesToCompare' name="datesToCompare" multiple="multiple" class="hidden"></select>
+ <select id='sendTo' name="sendTo" multiple="multiple" class="hidden"></select>
+
<input type="hidden" id="id" name="id" value="$program.id">
<table id="detailsList">
<thead>
@@ -286,6 +295,17 @@
<td><input type="text" id="daysAllowedSendMessage$index" name="daysAllowedSendMessage$index" class="daysAllowedSendMessage {validate:{required:true,number:true}}" value="$!reminder.daysAllowedSendMessage"/></td>
</tr>
<tr name="tr$index">
+ <td><label>$i18n.getString( "send_to" )</label></td>
+ <td>
+ <select type="text" id="sendTo$index" name="sendTo$index" class="sendTo {validate:{required:true,number:true}}">
+ <option value="1" #if($!reminder.sendTo==1) selected #end >$i18n.getString("patient")</option>
+ <option value="2" #if($!reminder.sendTo==2) selected #end >$i18n.getString("health_worker")</option>
+ <option value="3" #if($!reminder.sendTo==3) selected #end >$i18n.getString("orgunit_registered")</option>
+ <option value="4" #if($!reminder.sendTo==4) selected #end >$i18n.getString("all_users_in_orgunit_registered")</option>
+ </select>
+ </td>
+ </tr>
+ <tr name="tr$index">
<td>$i18n.getString( "params" )</td>
<td>
<select multiple size='4' ondblclick="insertParams(this.value, $index);">
@@ -340,5 +360,10 @@
var i18n_message = '$encoder.jsEscape( $i18n.getString( "message" ) , "'")';
var i18n_name_exists = '$encoder.jsEscape( $i18n.getString( "name_exists" ) , "'")';
var i18n_date_to_compare = '$encoder.jsEscape( $i18n.getString( "date_to_compare" ) , "'")';
+ var i18n_send_to = '$encoder.jsEscape( $i18n.getString( "send_to" ) , "'")';
+ var i18n_patient = '$encoder.jsEscape( $i18n.getString( "patient" ) , "'")';
+ var i18n_health_worker = '$encoder.jsEscape( $i18n.getString( "health_worker" ) , "'")';
+ var i18n_orgunit_registered = '$encoder.jsEscape( $i18n.getString( "orgunit_registered" ) , "'")';
+ var i18n_all_users_in_orgunit_registered = '$encoder.jsEscape( $i18n.getString( "all_users_in_orgunit_registered" ) , "'")';
programOnChange();
</script>
=== 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-04-12 12:06:21 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm 2013-06-14 15:52:56 +0000
@@ -9,7 +9,8 @@
<input type="hidden" id="programId" name="programId" value="$programStage.program.id"/>
<select id='daysAllowedSendMessages' name="daysAllowedSendMessages" multiple="multiple" class="hidden"></select>
<select id='templateMessages' name="templateMessages" multiple="multiple" class="hidden"></select>
-
+ <select id='sendTo' name="sendTo" multiple="multiple" class="hidden"></select>
+
<table id="detailsList">
<thead>
<tr><th colspan="2">$i18n.getString( "program_stage_details" )</th></tr>
@@ -170,6 +171,17 @@
<td><input type="text" id="daysAllowedSendMessage$index" name="daysAllowedSendMessage$index" class="daysAllowedSendMessage {validate:{required:true,number:true}}" value="$!reminder.daysAllowedSendMessage"/></td>
</tr>
<tr name="tr$index">
+ <td><label>$i18n.getString( "send_to" )</label></td>
+ <td>
+ <select type="text" id="sendTo$index" name="sendTo$index" class="sendTo {validate:{required:true,number:true}}">
+ <option value="1" #if($!reminder.sendTo==1) selected #end >$i18n.getString("patient")</option>
+ <option value="2" #if($!reminder.sendTo==2) selected #end >$i18n.getString("health_worker")</option>
+ <option value="3" #if($!reminder.sendTo==3) selected #end >$i18n.getString("orgunit_registered")</option>
+ <option value="4" #if($!reminder.sendTo==4) selected #end >$i18n.getString("all_users_in_orgunit_registered")</option>
+ </select>
+ </td>
+ </tr>
+ <tr name="tr$index">
<td>$i18n.getString( "params" )</td>
<td>
<select multiple size='4' ondblclick="insertParams(this.value, $index);">
@@ -221,4 +233,9 @@
var i18n_days_since_due_date = '$encoder.jsEscape( $i18n.getString( "days_since_due_date" ) , "'")';
var i18n_message = '$encoder.jsEscape( $i18n.getString( "message" ) , "'")';
var i18n_days_before_after_due_date = '$encoder.jsEscape( $i18n.getString( "days_before_after_due_date" ) , "'")';
+ var i18n_send_to = '$encoder.jsEscape( $i18n.getString( "send_to" ) , "'")';
+ var i18n_patient = '$encoder.jsEscape( $i18n.getString( "patient" ) , "'")';
+ var i18n_health_worker = '$encoder.jsEscape( $i18n.getString( "health_worker" ) , "'")';
+ var i18n_orgunit_registered = '$encoder.jsEscape( $i18n.getString( "orgunit_registered" ) , "'")';
+ var i18n_all_users_in_orgunit_registered = '$encoder.jsEscape( $i18n.getString( "all_users_in_orgunit_registered" ) , "'")';
</script>
\ No newline at end of file