← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8028: Move Time Setting for sending message from system-setting to maintenance-patient.

 

------------------------------------------------------------
revno: 8028
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-09-11 08:58:59 +0700
message:
  Move Time Setting for sending message from system-setting to maintenance-patient.
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-commons/src/main/java/org/hisp/dhis/interceptor/SystemSettingInterceptor.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/schedule/GetGatewayAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/schedule/ScheduleSendMessageTasksAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml
  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/javascript/scheduling.js
  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-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/resources/org/hisp/dhis/settings/i18n_module.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemGeneralSettings.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/ProgramStage.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStage.java	2012-09-10 02:46:35 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStage.java	2012-09-11 01:58:59 +0000
@@ -44,12 +44,12 @@
 
     public static final String TYPE_CUSTOM = "custom";
     
-    public static final String TEMPLATE_MESSSAGE_PATIENT_NAME = "patient-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";
-    public static final String TEMPLATE_MESSSAGE_ORGUNIT_NAME = "orgunit-name";
-    public static final String TEMPLATE_MESSSAGE_DAYS_SINCE_DUE_DATE = "days-since-due-date";
+    public static final String TEMPLATE_MESSSAGE_PATIENT_NAME = "{patient-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}";
+    public static final String TEMPLATE_MESSSAGE_ORGUNIT_NAME = "{orgunit-name}";
+    public static final String TEMPLATE_MESSSAGE_DAYS_SINCE_DUE_DATE = "{days-since-due-date}";
 
     /**
      * Determines if a de-serialized file is compatible with this class.

=== 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-10 10:28:33 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/scheduling/SendScheduledMessageTask.java	2012-09-11 01:58:59 +0000
@@ -29,9 +29,7 @@
 
 import static org.hisp.dhis.setting.SystemSettingManager.KEY_SEND_MESSAGE_GATEWAY;
 
-import java.util.ArrayList;
 import java.util.Collection;
-import java.util.List;
 
 import org.hisp.dhis.program.ProgramStageInstance;
 import org.hisp.dhis.program.ProgramStageInstanceService;

=== 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-10 10:28:33 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java	2012-09-11 01:58:59 +0000
@@ -307,7 +307,7 @@
                 String organisationunitName = rs.getString( "orgunitName" );
                 String programName = rs.getString( "programName" );
                 String programStageName = rs.getString( "programStageName" );
-                String days_since_due_date = rs.getString( "days_since_due_date" );
+                String daysSinceDueDate = rs.getString( "days_since_due_date" );
                 String dueDate = rs.getString( "duedate" );
                 
                 message.replaceAll( ProgramStage.TEMPLATE_MESSSAGE_PATIENT_NAME, patientName );
@@ -315,7 +315,7 @@
                 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, dueDate );
+                message.replaceAll( ProgramStage.TEMPLATE_MESSSAGE_DAYS_SINCE_DUE_DATE, daysSinceDueDate );
                 
                 SchedulingProgramObject schedulingProgramObject = new SchedulingProgramObject();
                 schedulingProgramObject.setProgramStageInstance( get(rs.getInt( "programstageinstanceid" )) );

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/SystemSettingInterceptor.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/SystemSettingInterceptor.java	2012-09-10 03:17:24 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/SystemSettingInterceptor.java	2012-09-11 01:58:59 +0000
@@ -27,7 +27,19 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.hisp.dhis.setting.SystemSettingManager.*;
+import static org.hisp.dhis.setting.SystemSettingManager.DEFAULT_COMPLETENESS_OFFSET;
+import static org.hisp.dhis.setting.SystemSettingManager.DEFAULT_FACTOR_OF_DEVIATION;
+import static org.hisp.dhis.setting.SystemSettingManager.DEFAULT_START_MODULE;
+import static org.hisp.dhis.setting.SystemSettingManager.KEY_APPLICATION_TITLE;
+import static org.hisp.dhis.setting.SystemSettingManager.KEY_CACHE_STRATEGY;
+import static org.hisp.dhis.setting.SystemSettingManager.KEY_COMPLETENESS_OFFSET;
+import static org.hisp.dhis.setting.SystemSettingManager.KEY_DISABLE_DATAENTRYFORM_WHEN_COMPLETED;
+import static org.hisp.dhis.setting.SystemSettingManager.KEY_FACTOR_OF_DEVIATION;
+import static org.hisp.dhis.setting.SystemSettingManager.KEY_FLAG;
+import static org.hisp.dhis.setting.SystemSettingManager.KEY_FLAG_IMAGE;
+import static org.hisp.dhis.setting.SystemSettingManager.KEY_OMIT_INDICATORS_ZERO_NUMERATOR_DATAMART;
+import static org.hisp.dhis.setting.SystemSettingManager.KEY_START_MODULE;
+import static org.hisp.dhis.setting.SystemSettingManager.KEY_SYSTEM_IDENTIFIER;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -82,7 +94,6 @@
         map.put( KEY_DISABLE_DATAENTRYFORM_WHEN_COMPLETED, systemSettingManager.getSystemSetting( KEY_DISABLE_DATAENTRYFORM_WHEN_COMPLETED, false ) );
         map.put( KEY_FACTOR_OF_DEVIATION, systemSettingManager.getSystemSetting( KEY_FACTOR_OF_DEVIATION, DEFAULT_FACTOR_OF_DEVIATION ) );
         map.put( KEY_COMPLETENESS_OFFSET, systemSettingManager.getSystemSetting( KEY_COMPLETENESS_OFFSET, DEFAULT_COMPLETENESS_OFFSET ) );
-        map.put( KEY_TIME_FOR_SENDING_MESSAGE, systemSettingManager.getSystemSetting( KEY_TIME_FOR_SENDING_MESSAGE, DEFAULT_TIME_FOR_SENDING_MESSAGE ) );
         
         invocation.getStack().push( map );
         

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/schedule/GetGatewayAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/schedule/GetGatewayAction.java	2012-09-10 10:28:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/schedule/GetGatewayAction.java	2012-09-11 01:58:59 +0000
@@ -27,9 +27,13 @@
 
 package org.hisp.dhis.patient.action.schedule;
 
+import static org.hisp.dhis.setting.SystemSettingManager.KEY_TIME_FOR_SENDING_MESSAGE;
+import static org.hisp.dhis.setting.SystemSettingManager.DEFAULT_TIME_FOR_SENDING_MESSAGE;
+
 import java.util.Map;
 
 import org.hisp.dhis.patient.scheduling.ProgramSchedulingManager;
+import org.hisp.dhis.setting.SystemSettingManager;
 import org.hisp.dhis.sms.outbound.OutboundSmsTransportService;
 import org.hisp.dhis.system.scheduling.Scheduler;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -48,6 +52,13 @@
     // Dependencies
     // -------------------------------------------------------------------------
 
+    private SystemSettingManager systemSettingManager;
+
+    public void setSystemSettingManager( SystemSettingManager systemSettingManager )
+    {
+        this.systemSettingManager = systemSettingManager;
+    }
+
     @Autowired
     private OutboundSmsTransportService transportService;
 
@@ -62,6 +73,13 @@
     // Input/Output
     // -------------------------------------------------------------------------
 
+    private String timeSendingMessage;
+
+    public String getTimeSendingMessage()
+    {
+        return timeSendingMessage;
+    }
+
     public Map<String, String> gatewayMap;
 
     public Map<String, String> getGatewayMap()
@@ -91,6 +109,8 @@
     public String execute()
         throws Exception
     {
+        timeSendingMessage = (String)systemSettingManager.getSystemSetting( KEY_TIME_FOR_SENDING_MESSAGE, DEFAULT_TIME_FOR_SENDING_MESSAGE );
+        
         gatewayMap = transportService.getGatewayMap();
 
         status = schedulingManager.getTaskStatus();

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/schedule/ScheduleSendMessageTasksAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/schedule/ScheduleSendMessageTasksAction.java	2012-09-10 10:28:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/schedule/ScheduleSendMessageTasksAction.java	2012-09-11 01:58:59 +0000
@@ -92,6 +92,13 @@
         this.gateWayId = gateWayId;
     }
 
+    private String timeSendingMessage;
+
+    public void setTimeSendingMessage( String timeSendingMessage )
+    {
+        this.timeSendingMessage = timeSendingMessage;
+    }
+
     // -------------------------------------------------------------------------
     // Output
     // -------------------------------------------------------------------------
@@ -116,6 +123,7 @@
 
     public String execute()
     {
+        systemSettingManager.saveSystemSetting( KEY_TIME_FOR_SENDING_MESSAGE, timeSendingMessage );
         systemSettingManager.saveSystemSetting( KEY_SEND_MESSAGE_GATEWAY, gateWayId );
 
         if ( execute )
@@ -149,7 +157,7 @@
                     minute = "0";
                 }
 
-                String cron = "0 " + Integer.parseInt(minute) + " " + Integer.parseInt( hour ) + " ? * *";
+                String cron = "0 " + Integer.parseInt( minute ) + " " + Integer.parseInt( hour ) + " ? * *";
 
                 keyCronMap.put( KEY_SEND_MESSAGE_SCHEDULED_TASKS, cron );
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml	2012-09-10 10:28:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml	2012-09-11 01:58:59 +0000
@@ -886,6 +886,7 @@
 	<bean id="org.hisp.dhis.patient.action.schedule.GetGatewayAction"
 		class="org.hisp.dhis.patient.action.schedule.GetGatewayAction"
 		scope="prototype">
+		<property name="systemSettingManager" ref="org.hisp.dhis.setting.SystemSettingManager" />
 		<property name="schedulingManager" ref="org.hisp.dhis.patient.scheduling.ProgramSchedulingManager" />
 	</bean>
 	

=== 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-10 10:28:33 +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 01:58:59 +0000
@@ -270,7 +270,7 @@
 displayed_in_list = Displayed in list
 report_date_description = Description of report date
 days_allowed_send_message = Days allowed send message
-template_message = Template message
+template_message = Template reminder message
 params = Parameters
 patient_name = Patient name
 program_name = Program name
@@ -283,9 +283,9 @@
 schedule = Schedule
 start = Start
 stop = Stop
-schedule_sending_message = Schedule sending message
 scheduling_is = Scheduling is
 not_started = not started
 running = running
 gateway_type = Gateway type
-execute = Execute
\ No newline at end of file
+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/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-10 10:28:33 +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 01:58:59 +0000
@@ -3,7 +3,8 @@
 	$.post( 'scheduleTasks.action',{
 		execute:false,
 		schedule: true,
-		gateWayId: getFieldValue("gatewayId")
+		gateWayId: getFieldValue("gatewayId"),
+		timeSendingMessage: getFieldValue("timeSendingMessage")
 	}, function( json ){
 		setMessage(i18n_scheduling_is + " " + json.scheduleTasks.status);
 		if( json.scheduleTasks.running ){
@@ -20,6 +21,7 @@
 	$.post( 'scheduleTasks.action',{
 		execute:true,
 		schedule: false,
-		gateWayId: getFieldValue("gatewayId")
+		gateWayId: getFieldValue("gatewayId"),
+		timeSendingMessage: getFieldValue("timeSendingMessage")
 	});
 }

=== 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-10 10:28:33 +0000
+++ 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
@@ -2,6 +2,13 @@
 <table>
 	<tbody>
 		<tr>
+			<td>$i18n.getString( "time_for_sending_message" )</td>
+			<td>
+				<input type="text" id="timeSendingMessage" name="timeSendingMessage" value="$!timeSendingMessage" style="width:295px;"/>
+			</td>
+		</tr>
+
+		<tr>
 			<td>$i18n.getString( "gateway_type" )</td>
 			<td>
 				#set( $keys = $!gatewayMap.keySet() )

=== 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-10 03:17:24 +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 01:58:59 +0000
@@ -167,13 +167,6 @@
         this.completenessOffset = completenessOffset;
     }
 
-    private String timeSendingMessage;
-    
-    public void setTimeSendingMessage( String timeSendingMessage )
-    {
-        this.timeSendingMessage = timeSendingMessage;
-    }
-
     private String message;
 
     public String getMessage()

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties	2012-09-10 03:17:24 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties	2012-09-11 01:58:59 +0000
@@ -103,5 +103,4 @@
 no_cache=No cache
 cache_until_6am_tomorrow=Cache until 6 AM tomorrow
 cache_for_two_weeks=Cache for two weeks
-max_levels_to_offline=Maximum Organisation Unit Levels to Offline
-time_for_sending_message = Time for sending message
+max_levels_to_offline=Maximum Organisation Unit Levels to Offline
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemGeneralSettings.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemGeneralSettings.vm	2012-09-10 03:17:24 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemGeneralSettings.vm	2012-09-11 01:58:59 +0000
@@ -11,8 +11,7 @@
 				omitIndicatorsZeroNumeratorDataMart: jQuery( '#omitIndicatorsZeroNumeratorDataMart' ).is( ':checked' ),
 				disableDataEntryWhenCompleted: jQuery( '#disableDataEntryWhenCompleted' ).is( ':checked' ),
 				factorDeviation: getFieldValue( 'factorDeviation' ),
-				completenessOffset: getFieldValue( 'completenessOffset' ),
-				timeSendingMessage: getFieldValue( 'timeSendingMessage' )
+				completenessOffset: getFieldValue( 'completenessOffset' )
 			}, function( json ) {
 				if ( json.response == "success" )
 					setHeaderDelayMessage( json.message );
@@ -122,11 +121,4 @@
 	<input type="text" id="completenessOffset" name="completenessOffset" value="$!completenessOffset"/>
 </p>
 
-
-<!-- days_after_period_timeliness -->
-<h4>$i18n.getString( "time_for_sending_message" )</h4>
-
-<p>
-	<input type="text" id="timeSendingMessage" name="timeSendingMessage" value="$!timeSendingMessage"/>
-</p>
 <p><input type="button" value="$i18n.getString( 'save' )" style="width:10em"/></p>
\ No newline at end of file