← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15550: Fixed bug - The Days when to send message isn't save if this values is nagetive

 

------------------------------------------------------------
revno: 15550
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-06-04 19:14:18 +0800
message:
  Fixed bug - The Days when to send message isn't save if this values is nagetive
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/org/hisp/dhis/trackedentity/i18n_module.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramStageReminder.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programStageReminder.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programStageReminder.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramStageReminder.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-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/org/hisp/dhis/trackedentity/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/org/hisp/dhis/trackedentity/i18n_module.properties	2014-06-03 04:55:04 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/org/hisp/dhis/trackedentity/i18n_module.properties	2014-06-04 11:14:18 +0000
@@ -251,7 +251,6 @@
 attributes = Attributes
 displayed_in_list = Display in list
 report_date_description = Description of report date
-days_before_after_due_date = Days before/after due date
 template_reminder_message = Template reminder message
 message = Message
 params = Parameters
@@ -364,7 +363,6 @@
 validate_success = The registration form passed validation successfully
 ask_user_to_complete_program_when_stage_complete = Ask user to complete program when stage is complete
 days_since_enrollment_date = Days since enrollment date
-days_before_after_comparison_date = Days before/after comparison date
 incident_date = Incident date
 date_to_compare = Date to compare
 program_indicator_management = Program Indicator Management
@@ -469,6 +467,7 @@
 create_new_template_reminder_message = Create new template reminder message
 confirm_delete_template_reminder_message=Are you sure you want to delete template reminder message?
 days_before = day(s) before
+days_after = day(s) after
 data_entry_method_for_option_sets=Data entry method for option sets
 users = Users
 attribute_users = Attribute users

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramStageReminder.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramStageReminder.vm	2014-06-02 02:07:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramStageReminder.vm	2014-06-04 11:14:18 +0000
@@ -41,17 +41,17 @@
 			</td>
 		</tr>
 		<tr>
-			<td><label for="daysAllowedSendMessage">$i18n.getString( "send_message" )</label></td>
-			<td><input type="text" id="daysAllowedSendMessage" name="daysAllowedSendMessage" 
+			<td><label for="days">$i18n.getString( "send_message" )</label></td>
+			<td><input type="text" id="days" name="days" 
 				class="{validate:{required:true,number:true}}"
-				onkeyup='setRealDays();' style="width:100px;"
-				realvalue="$!reminder.daysAllowedSendMessage" />
+				onkeyup='setRealDays();' style="width:100px;"/>
 				$i18n.getString('days')
 				<select id='time' name='time' onchange='setRealDays();' style="width:100px;">
 					<option value='1' >$i18n.getString('before')</option>
 					<option value='-1' >$i18n.getString('after')</option>
 				</select>
 				$i18n.getString('scheduled_date')
+				<input type="hidden" id="daysAllowedSendMessage" name="daysAllowedSendMessage" />
 			</td>
 		</tr>
 		<tr>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programStageReminder.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programStageReminder.js	2014-03-24 09:02:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programStageReminder.js	2014-06-04 11:14:18 +0000
@@ -50,11 +50,18 @@
 	programStageId: getFieldValue('programStageId')
   }, function( json ) {
     setInnerHTML('nameField', json.reminder.name);
-    setInnerHTML('daysAllowedSendMessageField', json.reminder.daysAllowedSendMessage);
+	
+	var days = json.reminder.daysAllowedSendMessage;
+	if( eval(days)>=0 ){
+		setInnerHTML('daysAllowedSendMessageField', days + " " + i18n_days_before);
+	}
+	else{
+		setInnerHTML('daysAllowedSendMessageField', -1 * eval(days) + " " + i18n_days_after);
+	}
     setInnerHTML('templateMessageField', json.reminder.templateMessage);
     setInnerHTML('dateToCompareField', json.reminder.dateToCompare);
 	
-	var map = sendToMap();
+	var map = recipientsMap();
 	setInnerHTML( 'sendToField', map[json.reminder.sendTo] ); 
 	
 	var whenToSend = i18n_days_scheduled;
@@ -73,14 +80,16 @@
 	else if( json.reminder.whenToSend=='3'){
 		whenToSend = i18n_both;
 	}
-    setInnerHTML('messageTypeField', json.reminder.messageType);
+	
+	map = messageTypeMap();
+    setInnerHTML('messageTypeField', map[json.reminder.messageType]);
 	
     setInnerHTML('userGroupField', json.reminder.userGroup);
     showDetails();
   });
 }
 
-function sendToMap()
+function recipientsMap()
 {
 	var typeMap = [];
 	typeMap['1'] = i18n_tracked_entity_sms_only;
@@ -91,6 +100,14 @@
 	return typeMap;
 }
 
+function messageTypeMap()
+{
+	var typeMap = [];
+	typeMap['1'] = i18n_direct_sms;
+	typeMap['2'] = i18n_message;
+	typeMap['3'] = i18n_both;
+	return typeMap;
+}
 function showHideUserGroup() {
   jQuery(".sendTo").each(function( i, item ) {
     var numb = i + 1;
@@ -145,9 +162,9 @@
 }
 
 function setRealDays( ) {
-  var daysAllowedSendMessage = jQuery("#daysAllowedSendMessage");
+  var days = jQuery("#days");
   var time = jQuery("#time option:selected ").val();
-  daysAllowedSendMessage.attr("realvalue", time * eval(daysAllowedSendMessage).val());
+  jQuery("#daysAllowedSendMessage").val(time * eval(days).val());
 }
 
 function onchangeUserGroup() {

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programStageReminder.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programStageReminder.vm	2014-05-17 12:04:42 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programStageReminder.vm	2014-06-04 11:14:18 +0000
@@ -47,7 +47,7 @@
           <a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/hide.png" alt="$i18n.getString( 'hide_details' )"></a>
 				</div>
         <p><label class="bold">$i18n.getString( "name" ):</label><br><span id="nameField"></span></p>
-        <p><label class="bold">$i18n.getString( "send_message" ):</label><br><span id="daysAllowedSendMessageField"></span> $i18n.getString("days_before")</p>
+        <p><label class="bold">$i18n.getString( "send_message" ):</label><br><span id="daysAllowedSendMessageField"></span></p>
         <p><label class="bold">$i18n.getString( "message" ):</label><br><span id="templateMessageField"></span></p>
         <p><label class="bold">$i18n.getString( "date_to_compare" ):</label><br><span id="dateToCompareField"></span></p>
 		<p><label class="bold">$i18n.getString( "recipients" ):</label><br><span id="sendToField"></span></p>
@@ -85,4 +85,6 @@
 	var i18n_direct_sms = '$encoder.jsEscape( $i18n.getString( "direct_sms" ) , "'")';
 	var i18n_message = '$encoder.jsEscape( $i18n.getString( "message" ) , "'")';
 	var i18n_both = '$encoder.jsEscape( $i18n.getString( "both" ) , "'")';
+	var i18n_days_before = '$encoder.jsEscape( $i18n.getString( "days_before" ) , "'")';
+	var i18n_days_after = '$encoder.jsEscape( $i18n.getString( "days_after" ) , "'")';
 </script>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramStageReminder.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramStageReminder.vm	2014-06-02 02:07:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramStageReminder.vm	2014-06-04 11:14:18 +0000
@@ -48,12 +48,11 @@
 				#set($time = '-1')
 				#set($value=-1 * $value)
 			#end
-			<td><label for="daysAllowedSendMessage">$i18n.getString( "send_message" )</label></td>
-			<td><input type="text" id="daysAllowedSendMessage" name="daysAllowedSendMessage" 
+			<td><label for="days">$i18n.getString( "send_message" )</label></td>
+			<td><input type="text" id="days" name="days" 
 				class="{validate:{required:true,number:true}}" value="$!value"
 				onkeyup='setRealDays();' style="width:100px;"
-				#if($!reminder.whenToSend==1 || $!reminder.whenToSend==3 ) disabled #end 
-				realvalue="$!reminder.daysAllowedSendMessage" />
+				#if($!reminder.whenToSend==1 || $!reminder.whenToSend==3 ) disabled #end />
 				$i18n.getString('days')
 				<select id='time' name='time' onchange='setRealDays();' style="width:100px;"
 					#if($!reminder.whenToSend==1 || $!reminder.whenToSend==3 ) disabled #end  >
@@ -61,6 +60,7 @@
 					<option value='-1' #if($time=='-1') selected #end  >$i18n.getString('after')</option>
 				</select>
 				$i18n.getString('scheduled_date')
+				<input type="hidden" id="daysAllowedSendMessage" name="daysAllowedSendMessage" value="$!reminder.daysAllowedSendMessage" />
 			</td>
 		</tr>
 		<tr>