dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #24331
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11910: fix bug fail to send sns to person has more than one phone number
------------------------------------------------------------
revno: 11910
committer: Long <Long@Long-Laptop>
branch nick: dhis2
timestamp: Wed 2013-09-04 17:01:16 +0700
message:
fix bug fail to send sns to person has more than one phone number
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/DataValueSMSListener.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/UnregisteredSMSListener.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientReminderService.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smscommand/edit-sms-command.vm
dhis-2/dhis-web/dhis-web-sms/src/main/java/org/hisp/dhis/sms/outcoming/ProcessingSendSMSAction.java
dhis-2/dhis-web/dhis-web-sms/src/main/webapp/dhis-web-sms/sendBeneficiarySMSPage.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-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/DataValueSMSListener.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/DataValueSMSListener.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/DataValueSMSListener.java 2013-09-04 10:01:16 +0000
@@ -69,7 +69,7 @@
public class DataValueSMSListener
implements IncomingSmsListener
-{
+{
private static final String defaultPattern = "([a-zA-Z]+)\\s*(\\d+)";
private CompleteDataSetRegistrationService registrationService;
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/UnregisteredSMSListener.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/UnregisteredSMSListener.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/UnregisteredSMSListener.java 2013-09-04 10:01:16 +0000
@@ -37,6 +37,8 @@
import org.hisp.dhis.message.MessageService;
import org.hisp.dhis.sms.incoming.IncomingSms;
import org.hisp.dhis.sms.incoming.IncomingSmsListener;
+import org.hisp.dhis.sms.incoming.IncomingSmsService;
+import org.hisp.dhis.sms.incoming.SmsMessageStatus;
import org.hisp.dhis.sms.parse.ParserType;
import org.hisp.dhis.sms.parse.SMSParserException;
import org.hisp.dhis.smscommand.SMSCommand;
@@ -58,6 +60,8 @@
private SmsMessageSender smsMessageSender;
+ private IncomingSmsService incomingSmsService;
+
@Transactional
@Override
public boolean accept( IncomingSms sms )
@@ -127,17 +131,18 @@
{
anonymousUser = userService.getUserCredentialsByUsername( "admin" );
}
- /*MessageConversation conversation = new MessageConversation( smsCommand.getName(),
- anonymousUser.getUser() );
-
- conversation.addMessage( new Message( message, null, anonymousUser.getUser() ) );
-
- for ( User receiver : receivers )
- {
- boolean read = false;
-
- conversation.addUserMessage( new UserMessage( receiver, read ) );
- }*/
+ /*
+ * MessageConversation conversation = new MessageConversation(
+ * smsCommand.getName(), anonymousUser.getUser() );
+ *
+ * conversation.addMessage( new Message( message, null,
+ * anonymousUser.getUser() ) );
+ *
+ * for ( User receiver : receivers ) { boolean read = false;
+ *
+ * conversation.addUserMessage( new UserMessage( receiver, read
+ * ) ); }
+ */
// forward to user group by SMS, E-mail, DHIS conversation
messageService.sendMessage( smsCommand.getName(), message, null, receivers, anonymousUser.getUser(),
@@ -150,6 +155,11 @@
feedbackList.add( sender );
smsMessageSender.sendMessage( smsCommand.getName(), smsCommand.getReceivedMessage(), null,
feedbackList, true );
+
+ // update the status of the sms after process
+ sms.setStatus( SmsMessageStatus.PROCESSED );
+ incomingSmsService.update( sms );
+
}
}
}
@@ -173,5 +183,5 @@
{
this.smsMessageSender = smsMessageSender;
}
-
+
}
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientReminderService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientReminderService.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientReminderService.java 2013-09-04 10:01:16 +0000
@@ -146,7 +146,18 @@
default:
if ( patient.getPhoneNumber() != null && !patient.getPhoneNumber().isEmpty() )
{
- phoneNumbers.add( patient.getPhoneNumber() );
+ if ( patient.getPhoneNumber().contains( ";" ) )
+ {
+ String token[] = patient.getPhoneNumber().split( ";" );
+ for ( String phoneNumber : token )
+ {
+ phoneNumbers.add( phoneNumber );
+ }
+ }
+ else
+ {
+ phoneNumbers.add( patient.getPhoneNumber() );
+ }
}
break;
}
=== 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-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsAction.java 2013-09-04 10:01:16 +0000
@@ -57,7 +57,7 @@
// -------------------------------------------------------------------------
private SmsSender smsSender;
-
+
public void setSmsSender( SmsSender smsSender )
{
this.smsSender = smsSender;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smscommand/edit-sms-command.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smscommand/edit-sms-command.vm 2013-07-11 07:56:43 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smscommand/edit-sms-command.vm 2013-09-04 10:01:16 +0000
@@ -85,6 +85,11 @@
<tr>
<td style="width:130px">$i18n.getString( "no_codes_message" )</td>
<td><textarea cols="35" type="text" name="defaultMessage">#if($smsCommand.defaultMessage)$smsCommand.defaultMessage#end</textarea></td>
+ </tr>
+
+ <tr>
+ <td style="width:130px">$i18n.getString( "wrong_format_message" )</td>
+ <td><textarea cols="35" type="text" name="defaultMessage">#if($smsCommand.defaultMessage)$smsCommand.defaultMessage#end</textarea></td>
</tr>
</table>
=== modified file 'dhis-2/dhis-web/dhis-web-sms/src/main/java/org/hisp/dhis/sms/outcoming/ProcessingSendSMSAction.java'
--- dhis-2/dhis-web/dhis-web-sms/src/main/java/org/hisp/dhis/sms/outcoming/ProcessingSendSMSAction.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-sms/src/main/java/org/hisp/dhis/sms/outcoming/ProcessingSendSMSAction.java 2013-09-04 10:01:16 +0000
@@ -188,6 +188,7 @@
{
each = "+" + each;
}
+
User user = new User();
user.setPhoneNumber( each );
recipientsList.add( user );
=== modified file 'dhis-2/dhis-web/dhis-web-sms/src/main/webapp/dhis-web-sms/sendBeneficiarySMSPage.vm'
--- dhis-2/dhis-web/dhis-web-sms/src/main/webapp/dhis-web-sms/sendBeneficiarySMSPage.vm 2013-03-20 04:23:51 +0000
+++ dhis-2/dhis-web/dhis-web-sms/src/main/webapp/dhis-web-sms/sendBeneficiarySMSPage.vm 2013-09-04 10:01:16 +0000
@@ -68,7 +68,7 @@
</tr>
<tr><th colspan="2">$i18n.getString( "message" ) ($i18n.getString( "do_not_send_patient_confidential_messages_using_sms" ))</th></tr>
- <tr><td colspan="2"><textarea id="smsMessage" name="smsMessage" rows="5" style="width:600px;" class="{validate:{required:true}}"></textarea></td></tr>
+ <tr><td colspan="2"><textarea id="text" name="text" rows="5" style="width:600px;" class="{validate:{required:true}}"></textarea></td></tr>
</tbody>
<tbody>