dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #18885
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8029: Automatic SMS reminder (WIP).
------------------------------------------------------------
revno: 8029
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-09-11 10:54:32 +0700
message:
Automatic SMS reminder (WIP).
modified:
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/scheduling/SendScheduledMessageTask.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.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/scheduling.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStageList.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/scheduleSendMessage.vm
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-settings/src/main/java/org/hisp/dhis/settings/action/system/SetGeneralSettingsAction.java
--
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/ProgramStage.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStage.java 2012-09-11 01:58:59 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStage.java 2012-09-11 03:54:32 +0000
@@ -44,7 +44,7 @@
public static final String TYPE_CUSTOM = "custom";
- public static final String TEMPLATE_MESSSAGE_PATIENT_NAME = "{patient-name}";
+ public static final String TEMPLATE_MESSSAGE_PATIENT_NAME = "{person-name}";
public static final String TEMPLATE_MESSSAGE_PROGRAM_NAME = "{program-name}";
public static final String TEMPLATE_MESSSAGE_PROGAM_STAGE_NAME = "{program-stage-name}";
public static final String TEMPLATE_MESSSAGE_DUE_DATE = "{due-date}";
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/scheduling/SendScheduledMessageTask.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/scheduling/SendScheduledMessageTask.java 2012-09-11 01:58:59 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/scheduling/SendScheduledMessageTask.java 2012-09-11 03:54:32 +0000
@@ -112,6 +112,7 @@
{
OutboundSms outboundSms = new OutboundSms( message, phoneNumber );
outboundSmsService.sendMessage( outboundSms, gatewayId );
+ System.out.println("\n\n === \n outboundSms : " + outboundSms.getId() );
// List<OutboundSms> outboundSmsList = programStageInstance.getOutboundSms();
// if ( outboundSmsList == null )
=== 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 2012-09-11 01:58:59 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java 2012-09-11 03:54:32 +0000
@@ -288,21 +288,21 @@
+ " and p.phonenumber is not NULL and p.phonenumber != '' "
+ " and ps.templatemessage is not NULL and ps.templatemessage != '' "
+ " and pg.type=1 and ps.daysallowedsendmessage is not null "
- + " and (DATE(now()) - DATE(psi.duedate) ) = ps.daysallowedsendmessage ";
+ + " and ( DATE(now()) - DATE(psi.duedate) ) = ps.daysallowedsendmessage ";
SqlRowSet rs = jdbcTemplate.queryForRowSet( sql );
-
+
int cols = rs.getMetaData().getColumnCount();
Collection<SchedulingProgramObject> schedulingProgramObjects = new HashSet<SchedulingProgramObject>();
while ( rs.next() )
{
-
+ String message = "";
for ( int i = 1; i <= cols; i++ )
{
- String message = rs.getString( "templatemessage" );
+ message = rs.getString( "templatemessage" );
String patientName = rs.getString( "firstName" );
String organisationunitName = rs.getString( "orgunitName" );
String programName = rs.getString( "programName" );
@@ -310,21 +310,20 @@
String daysSinceDueDate = rs.getString( "days_since_due_date" );
String dueDate = rs.getString( "duedate" );
- message.replaceAll( ProgramStage.TEMPLATE_MESSSAGE_PATIENT_NAME, patientName );
- message.replaceAll( ProgramStage.TEMPLATE_MESSSAGE_PROGRAM_NAME, programName );
- message.replaceAll( ProgramStage.TEMPLATE_MESSSAGE_PROGAM_STAGE_NAME, programStageName );
- message.replaceAll( ProgramStage.TEMPLATE_MESSSAGE_DUE_DATE, dueDate );
- message.replaceAll( ProgramStage.TEMPLATE_MESSSAGE_ORGUNIT_NAME, organisationunitName );
- message.replaceAll( ProgramStage.TEMPLATE_MESSSAGE_DAYS_SINCE_DUE_DATE, daysSinceDueDate );
-
- SchedulingProgramObject schedulingProgramObject = new SchedulingProgramObject();
- schedulingProgramObject.setProgramStageInstance( get(rs.getInt( "programstageinstanceid" )) );
- schedulingProgramObject.setPhoneNumber( rs.getString( "phonenumber" ) );
- schedulingProgramObject.setMessage( message );
-
- schedulingProgramObjects.add(schedulingProgramObject);
-
+ message = message.replace( ProgramStage.TEMPLATE_MESSSAGE_PATIENT_NAME, patientName );
+ message = message.replace( ProgramStage.TEMPLATE_MESSSAGE_PROGRAM_NAME, programName );
+ message = message.replace( ProgramStage.TEMPLATE_MESSSAGE_PROGAM_STAGE_NAME, programStageName );
+ message = message.replace( ProgramStage.TEMPLATE_MESSSAGE_DUE_DATE, dueDate );
+ message = message.replace( ProgramStage.TEMPLATE_MESSSAGE_ORGUNIT_NAME, organisationunitName );
+ message = message.replace( ProgramStage.TEMPLATE_MESSSAGE_DAYS_SINCE_DUE_DATE, daysSinceDueDate );
}
+
+ SchedulingProgramObject schedulingProgramObject = new SchedulingProgramObject();
+ schedulingProgramObject.setProgramStageInstance( get(rs.getInt( "programstageinstanceid" )) );
+ schedulingProgramObject.setPhoneNumber( rs.getString( "phonenumber" ) );
+ schedulingProgramObject.setMessage( message );
+
+ schedulingProgramObjects.add(schedulingProgramObject);
}
/*
=== 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-09-11 01:58:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2012-09-11 03:54:32 +0000
@@ -269,7 +269,8 @@
identifiers_and_attributes = Identifiers / Attributes
displayed_in_list = Displayed in list
report_date_description = Description of report date
-days_allowed_send_message = Days allowed send message
+days_before_due_date = Days after due date
+days_after_due_date = Days after due date
template_message = Template reminder message
params = Parameters
patient_name = Patient name
@@ -285,7 +286,8 @@
stop = Stop
scheduling_is = Scheduling is
not_started = not started
-running = running
+running = actived
+negative_numbers = Negative numbers
gateway_type = Gateway type
execute = Execute
time_for_sending_message = Time for sending message
\ 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-09-10 02:46:35 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm 2012-09-11 03:54:32 +0000
@@ -46,9 +46,15 @@
</tr>
<tr>
- <td><label>$i18n.getString( "days_allowed_send_message" )</label></td>
+ <td><label>$i18n.getString( "days_after_due_date" )</label></td>
<td><input type="text" id="daysAllowedSendMessage" name="daysAllowedSendMessage" class="{validate:{number:true}}"/></td>
</tr>
+ <tr>
+ <td></td>
+ <td><i>($i18n.getString("negative_numbers") = $i18n.getString( "days_before_due_date" ))</i></td>
+ </tr>
+
+ <tr><td> </td></tr>
<tr>
<td>$i18n.getString( "params" )</td>
@@ -66,7 +72,7 @@
<tr>
<td><label>$i18n.getString( "template_message" )</label></td>
- <td><textarea id="templateMessage" name="templateMessage"></textarea></td>
+ <td><textarea id="templateMessage" name="templateMessage" style="width:320px"></textarea></td>
</tr>
<tr><td> </td><td> </td></tr>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/scheduling.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/scheduling.js 2012-09-11 01:58:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/scheduling.js 2012-09-11 03:54:32 +0000
@@ -7,7 +7,7 @@
timeSendingMessage: getFieldValue("timeSendingMessage")
}, function( json ){
setMessage(i18n_scheduling_is + " " + json.scheduleTasks.status);
- if( json.scheduleTasks.running ){
+ if( json.scheduleTasks.running=="true" ){
setFieldValue('scheduledBtn', i18n_stop );
}
else{
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStageList.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStageList.vm 2012-09-10 02:46:35 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStageList.vm 2012-09-11 03:54:32 +0000
@@ -49,7 +49,7 @@
<p><label class="bold">$i18n.getString( "standard_interval_days" ):</label><br><span id="standardIntervalField"></span></p>
<p><label class="bold">$i18n.getString( "report_date_description" ):</label><br><span id="reportDateDescriptionField"></span></p>
<p><label class="bold">$i18n.getString( "no_of_dataelements" ):</label><br><span id="dataElementCountField"></span></p>
- <p><label class="bold">$i18n.getString( "days_allowed_send_message" ):</label><br><span id="daysAllowedSendMessageField"></span></p>
+ <p><label class="bold">$i18n.getString( "days_after_due_date" ):</label><br><span id="daysAllowedSendMessageField"></span></p>
<p><label class="bold">$i18n.getString( "template_message" ):</label><br><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/scheduleSendMessage.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/scheduleSendMessage.vm 2012-09-11 01:58:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/scheduleSendMessage.vm 2012-09-11 03:54:32 +0000
@@ -24,7 +24,7 @@
<td></td>
<td>
<input type="button" style="width:150px;" id="scheduledBtn" name="scheduledBtn"
- #if ( $running )
+ #if ( $running=='true' )
value="$i18n.getString( 'stop' )"
#else
value="$i18n.getString( 'start' )"
=== 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-09-10 02:46:35 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm 2012-09-11 03:54:32 +0000
@@ -48,11 +48,18 @@
</tr>
<tr>
- <td><label>$i18n.getString( "days_allowed_send_message" )</label></td>
+ <td><label>$i18n.getString( "days_after_due_date" )</label></td>
<td><input type="text" id="daysAllowedSendMessage" name="daysAllowedSendMessage" class="{validate:{number:true}}" value="$!programStage.daysAllowedSendMessage"/></td>
</tr>
<tr>
+ <td></td>
+ <td><i>($i18n.getString("negative_numbers") = $i18n.getString( "days_before_due_date" ))</i></td>
+ </tr>
+
+ <tr><td> </td></tr>
+
+ <tr>
<td>$i18n.getString( "params" )</td>
<td>
<select multiple size='6' ondblclick="insertParams(this.value);">
@@ -68,7 +75,7 @@
<tr>
<td><label>$i18n.getString( "template_message" )</label></td>
- <td><textarea id="templateMessage" name="templateMessage">$!programStage.templateMessage</textarea></td>
+ <td><textarea id="templateMessage" name="templateMessage" style="width:320px">$!programStage.templateMessage</textarea></td>
</tr>
<tr><td> </td></tr>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/SetGeneralSettingsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/SetGeneralSettingsAction.java 2012-09-11 01:58:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/SetGeneralSettingsAction.java 2012-09-11 03:54:32 +0000
@@ -192,8 +192,7 @@
systemSettingManager.saveSystemSetting( KEY_DISABLE_DATAENTRYFORM_WHEN_COMPLETED, disableDataEntryWhenCompleted );
systemSettingManager.saveSystemSetting( KEY_FACTOR_OF_DEVIATION, factorDeviation );
systemSettingManager.saveSystemSetting( KEY_COMPLETENESS_OFFSET, completenessOffset );
- systemSettingManager.saveSystemSetting( KEY_TIME_FOR_SENDING_MESSAGE, timeSendingMessage );
-
+
Configuration configuration = configurationService.getConfiguration();
if ( feedbackRecipients != null )