← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11597: Minor fix for sms function in Lost-to-follow-up.

 

------------------------------------------------------------
revno: 11597
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-08-07 11:10:58 +0700
message:
  Minor fix for sms function in Lost-to-follow-up.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml


--
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-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsAction.java	2013-07-12 06:09:21 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsAction.java	2013-08-07 04:10:58 +0000
@@ -28,12 +28,12 @@
 package org.hisp.dhis.caseentry.action.reminder;
 
 import java.util.ArrayList;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
 import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.patient.PatientReminder;
+import org.hisp.dhis.patient.PatientReminderService;
 import org.hisp.dhis.program.ProgramStageInstance;
 import org.hisp.dhis.program.ProgramStageInstanceService;
 import org.hisp.dhis.sms.SmsServiceException;
@@ -76,6 +76,13 @@
         this.currentUserService = currentUserService;
     }
 
+    private PatientReminderService patientReminderService;
+
+    public void setPatientReminderService( PatientReminderService patientReminderService )
+    {
+        this.patientReminderService = patientReminderService;
+    }
+
     private I18n i18n;
 
     public void setI18n( I18n i18n )
@@ -126,29 +133,12 @@
         ProgramStageInstance programStageInstance = programStageInstanceService
             .getProgramStageInstance( programStageInstanceId );
 
-        Set<String> phoneNumbers = new HashSet<String>();
+        PatientReminder patientReminder = new PatientReminder();
+        patientReminder.setTemplateMessage( msg );
+        patientReminder.setSendTo( sendTo );
 
-        switch ( sendTo )
-        {
-        case PatientReminder.SEND_TO_PATIENT:
-            String[] _phoneNumbers = programStageInstance.getProgramInstance().getPatient().getPhoneNumber().split( ";" );
-            for ( String phoneNumber : _phoneNumbers )
-            {
-                phoneNumbers.add(phoneNumber);
-            }
-            break;
-        case PatientReminder.SEND_TO_HEALTH_WORKER:
-            phoneNumbers
-                .add( programStageInstance.getProgramInstance().getPatient().getHealthWorker().getPhoneNumber() );
-            break;
-        case PatientReminder.SEND_TO_ORGUGNIT_REGISTERED:
-            phoneNumbers.add( programStageInstance.getProgramInstance().getPatient().getOrganisationUnit()
-                .getPhoneNumber() );
-            break;
-        default:
-            phoneNumbers.add( programStageInstance.getProgramInstance().getPatient().getPhoneNumber() );
-            break;
-        }
+        Set<String> phoneNumbers = patientReminderService.getPhonenumbers( patientReminder, programStageInstance
+            .getProgramInstance().getPatient() );
 
         try
         {

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2013-08-07 03:44:17 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2013-08-07 04:10:58 +0000
@@ -1079,6 +1079,7 @@
 		<property name="programStageInstanceService"
 			ref="org.hisp.dhis.program.ProgramStageInstanceService" />
 		<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+		<property name="patientReminderService" ref="org.hisp.dhis.patient.PatientReminderService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.caseentry.action.reminder.SendSmsToListAction"