dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #23750
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11563: Remove sending email and creating message-conversation after completing a program/an event; add s...
------------------------------------------------------------
revno: 11563
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-08-05 10:00:51 +0700
message:
Remove sending email and creating message-conversation after completing a program/an event; add sending sms function into setting event status function.
modified:
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/CompleteDataEntryAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SetProgramInstanceStatusAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SetEventStatusAction.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/caseentry/CompleteDataEntryAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/CompleteDataEntryAction.java 2013-07-31 06:38:55 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/CompleteDataEntryAction.java 2013-08-05 03:00:51 +0000
@@ -35,11 +35,6 @@
import java.util.Set;
import org.hisp.dhis.i18n.I18nFormat;
-import org.hisp.dhis.message.Message;
-import org.hisp.dhis.message.MessageConversation;
-import org.hisp.dhis.message.MessageConversationStore;
-import org.hisp.dhis.message.MessageSender;
-import org.hisp.dhis.message.UserMessage;
import org.hisp.dhis.patient.Patient;
import org.hisp.dhis.patient.PatientReminder;
import org.hisp.dhis.patient.PatientService;
@@ -110,20 +105,6 @@
this.format = format;
}
- private MessageConversationStore messageConversationStore;
-
- public void setMessageConversationStore( MessageConversationStore messageConversationStore )
- {
- this.messageConversationStore = messageConversationStore;
- }
-
- private MessageSender emailMessageSender;
-
- public void setEmailMessageSender( MessageSender emailMessageSender )
- {
- this.emailMessageSender = emailMessageSender;
- }
-
// -------------------------------------------------------------------------
// Input / Output
// -------------------------------------------------------------------------
@@ -271,37 +252,6 @@
}
}
- // send to user group
- if ( reminder.getSendTo() == PatientReminder.SEND_TO_USER_GROUP )
- {
- String msg = getStringMsgFromTemplateMsg( reminder, programStageInstance, patient );
- String programStageName = programStageInstance.getProgramStage().getName();
-
- // forward to user group by E-mail
- emailMessageSender.sendMessage( programStageName, msg, currentUserService.getCurrentUser(), reminder
- .getUserGroup().getMembers(), false );
-
- // forward to user group by DHIS message
- Set<User> receivers = new HashSet<User>( reminder.getUserGroup().getMembers() );
-
- User sender = currentUserService.getCurrentUser();
- if ( sender != null )
- {
- receivers.add( sender );
- }
-
- MessageConversation conversation = new MessageConversation( programStageName, sender );
-
- conversation.addMessage( new Message( msg, null, sender ) );
-
- for ( User receiver : receivers )
- {
- boolean read = receiver != null && receiver.equals( sender );
-
- conversation.addUserMessage( new UserMessage( receiver, read ) );
- }
- messageConversationStore.save( conversation );
- }
}
private void sendSMSToCompletedProgram( ProgramInstance programInstance )
@@ -351,37 +301,7 @@
e.printStackTrace();
}
}
-
- if ( reminder.getSendTo() == PatientReminder.SEND_TO_USER_GROUP )
- {
- String msg = getStringMsgFromTemplateMsg( reminder, programInstance, patient );
- String programName = programInstance.getProgram().getName();
-
- // forward to user group by E-mail
- emailMessageSender.sendMessage( programName, msg, currentUserService.getCurrentUser(), reminder
- .getUserGroup().getMembers(), false );
-
- // forward to user group by DHIS message
- Set<User> receivers = new HashSet<User>( reminder.getUserGroup().getMembers() );
-
- User sender = currentUserService.getCurrentUser();
- if ( sender != null )
- {
- receivers.add( sender );
- }
-
- MessageConversation conversation = new MessageConversation( programName, sender );
-
- conversation.addMessage( new Message( msg, null, sender ) );
-
- for ( User receiver : receivers )
- {
- boolean read = receiver != null && receiver.equals( sender );
-
- conversation.addUserMessage( new UserMessage( receiver, read ) );
- }
- messageConversationStore.save( conversation );
- }
+
}
private Set<String> getPhonenumbers( PatientReminder reminder, Patient patient )
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SetProgramInstanceStatusAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SetProgramInstanceStatusAction.java 2013-07-23 02:58:17 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SetProgramInstanceStatusAction.java 2013-08-05 03:00:51 +0000
@@ -153,7 +153,7 @@
if ( status == ProgramInstance.STATUS_COMPLETED )
{
sendSMSToCompletedProgram( programInstance );
-
+
programInstance.setEndDate( new Date() );
if ( !program.getOnlyEnrollOnce() )
{
@@ -161,7 +161,7 @@
patientService.updatePatient( patient );
}
}
-
+
else if ( status == ProgramInstance.STATUS_CANCELLED )
{
Calendar today = Calendar.getInstance();
@@ -249,13 +249,22 @@
phoneNumbers.add( patient.getOrganisationUnit().getPhoneNumber() );
}
break;
+ case PatientReminder.SEND_TO_USER_GROUP:
+ for ( User user : reminder.getUserGroup().getMembers() )
+ {
+ if ( user.getPhoneNumber() != null && !user.getPhoneNumber().isEmpty() )
+ {
+ phoneNumbers.add( user.getPhoneNumber() );
+ }
+ }
+ break;
default:
if ( patient.getPhoneNumber() != null && !patient.getPhoneNumber().isEmpty() )
{
String[] _phoneNumbers = patient.getPhoneNumber().split( ";" );
for ( String phoneNumber : _phoneNumbers )
{
- phoneNumbers.add(phoneNumber);
+ phoneNumbers.add( phoneNumber );
}
}
break;
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SetEventStatusAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SetEventStatusAction.java 2013-07-23 02:52:29 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SetEventStatusAction.java 2013-08-05 03:00:51 +0000
@@ -251,6 +251,15 @@
phoneNumbers.add( patient.getOrganisationUnit().getPhoneNumber() );
}
break;
+ case PatientReminder.SEND_TO_USER_GROUP:
+ for ( User user : reminder.getUserGroup().getMembers() )
+ {
+ if ( user.getPhoneNumber() != null && !user.getPhoneNumber().isEmpty() )
+ {
+ phoneNumbers.add( user.getPhoneNumber() );
+ }
+ }
+ break;
default:
if ( patient.getPhoneNumber() != null && !patient.getPhoneNumber().isEmpty() )
{
=== 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-02 03:34:24 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2013-08-05 03:00:51 +0000
@@ -122,8 +122,6 @@
<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
<property name="outboundSmsService" ref="org.hisp.dhis.sms.outbound.OutboundSmsService" />
- <property name="emailMessageSender" ref="emailMessageSender" />
- <property name="messageConversationStore" ref="org.hisp.dhis.message.MessageConversationStore" />
</bean>
<bean