dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #18913
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8041: Add sender property for Outboundsms object to save a sender for SMS messages.
------------------------------------------------------------
revno: 8041
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-09-12 11:14:03 +0700
message:
Add sender property for Outboundsms object to save a sender for SMS messages.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/outbound/OutboundSms.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/scheduling/SendScheduledMessageTask.java
dhis-2/dhis-services/dhis-service-sms/src/main/resources/org/hisp/dhis/sms/outbound/OutboundSms.hbm.xml
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/AddPatientAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/UpdatePatientAction.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-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsToListAction.java
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/org/hisp/dhis/caseentry/i18n_module.properties
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/eventMessage.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingList.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.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/sms/outbound/OutboundSms.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/outbound/OutboundSms.java 2012-03-01 08:56:47 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/outbound/OutboundSms.java 2012-09-12 04:14:03 +0000
@@ -36,6 +36,8 @@
{
private int id;
+ private String sender;
+
private Set<String> recipients;
private Date date;
@@ -95,6 +97,16 @@
this.message = message;
}
+ public String getSender()
+ {
+ return sender;
+ }
+
+ public void setSender( String sender )
+ {
+ this.sender = sender;
+ }
+
public OutboundSmsStatus getStatus()
{
return status;
=== 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-11 04:54:34 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/scheduling/SendScheduledMessageTask.java 2012-09-12 04:14:03 +0000
@@ -47,6 +47,8 @@
public class SendScheduledMessageTask
implements Runnable
{
+ private final String DHIS_SYSTEM = "DHIS system";
+
private SystemSettingManager systemSettingManager;
public void setSystemSettingManager( SystemSettingManager systemSettingManager )
@@ -113,6 +115,7 @@
try
{
OutboundSms outboundSms = new OutboundSms( message, phoneNumber );
+ outboundSms.setSender( DHIS_SYSTEM );
outboundSmsService.sendMessage( outboundSms, gatewayId );
String sql = " INSERT INTO programstageinstance_outboundsms"
=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/resources/org/hisp/dhis/sms/outbound/OutboundSms.hbm.xml'
--- dhis-2/dhis-services/dhis-service-sms/src/main/resources/org/hisp/dhis/sms/outbound/OutboundSms.hbm.xml 2011-12-16 10:26:08 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/resources/org/hisp/dhis/sms/outbound/OutboundSms.hbm.xml 2012-09-12 04:14:03 +0000
@@ -24,6 +24,8 @@
<param name="enumClass">org.hisp.dhis.sms.outbound.OutboundSmsStatus</param>
</type>
</property>
+
+ <property name="sender" />
</class>
</hibernate-mapping>
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/AddPatientAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/AddPatientAction.java 2012-09-11 07:31:17 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/AddPatientAction.java 2012-09-12 04:14:03 +0000
@@ -174,8 +174,11 @@
patient.setPhoneNumber( phoneNumber );
patient.setUnderAge( underAge );
patient.setOrganisationUnit( organisationUnit );
- patient.setHealthWorker( userService.getUser( healthWorkerId ) );
-
+ if ( healthWorkerId != null )
+ {
+ patient.setHealthWorker( userService.getUser( healthWorkerId ) );
+ }
+
Character dobType = (verified) ? 'V' : 'D';
if ( !verified && age != null )
@@ -316,7 +319,7 @@
// -----------------------------------------------------------------------------
// Getter/Setter
// -----------------------------------------------------------------------------
-
+
public void setUserService( UserService userService )
{
this.userService = userService;
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/UpdatePatientAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/UpdatePatientAction.java 2012-09-11 07:31:17 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/UpdatePatientAction.java 2012-09-12 04:14:03 +0000
@@ -171,7 +171,10 @@
patient.setGender( gender );
patient.setIsDead( isDead );
patient.setPhoneNumber( phoneNumber );
- patient.setHealthWorker( userService.getUser( healthWorkerId ) );
+ if ( healthWorkerId != null )
+ {
+ patient.setHealthWorker( userService.getUser( healthWorkerId ) );
+ }
if ( deathDate != null )
{
=== 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 2012-08-09 08:57:01 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsAction.java 2012-09-12 04:14:03 +0000
@@ -36,6 +36,7 @@
import org.hisp.dhis.sms.SmsServiceException;
import org.hisp.dhis.sms.outbound.OutboundSms;
import org.hisp.dhis.sms.outbound.OutboundSmsService;
+import org.hisp.dhis.user.CurrentUserService;
import com.opensymphony.xwork2.Action;
@@ -64,7 +65,14 @@
{
this.programStageInstanceService = programStageInstanceService;
}
+
+ private CurrentUserService currentUserService;
+ public void setCurrentUserService( CurrentUserService currentUserService )
+ {
+ this.currentUserService = currentUserService;
+ }
+
private I18n i18n;
public void setI18n( I18n i18n )
@@ -122,6 +130,7 @@
try
{
OutboundSms outboundSms = new OutboundSms( msg, phoneNumber );
+ outboundSms.setSender( currentUserService.getCurrentUsername() );
outboundSmsService.sendMessage( outboundSms, gatewayId );
List<OutboundSms> outboundSmsList = programStageInstance.getOutboundSms();
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsToListAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsToListAction.java 2012-09-10 10:28:33 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsToListAction.java 2012-09-12 04:14:03 +0000
@@ -41,6 +41,7 @@
import org.hisp.dhis.sms.SmsServiceException;
import org.hisp.dhis.sms.outbound.OutboundSms;
import org.hisp.dhis.sms.outbound.OutboundSmsService;
+import org.hisp.dhis.user.CurrentUserService;
import com.opensymphony.xwork2.Action;
@@ -64,6 +65,8 @@
private ProgramStageInstanceService programStageInstanceService;
+ private CurrentUserService currentUserService;
+
private I18n i18n;
// -------------------------------------------------------------------------
@@ -77,6 +80,11 @@
// -------------------------------------------------------------------------
// Getters && Setters
// -------------------------------------------------------------------------
+
+ public void setCurrentUserService( CurrentUserService currentUserService )
+ {
+ this.currentUserService = currentUserService;
+ }
public void setOutboundSmsService( OutboundSmsService outboundSmsService )
{
@@ -116,7 +124,7 @@
// -------------------------------------------------------------------------
// Input & Output
// -------------------------------------------------------------------------
-
+
private String gatewayId;
public void setGatewayId( String gatewayId )
@@ -159,6 +167,7 @@
OutboundSms outboundSms = new OutboundSms();
outboundSms.setMessage( msg );
outboundSms.setRecipients( phoneNumberList );
+ outboundSms.setSender( currentUserService.getCurrentUsername() );
outboundSmsService.sendMessage( outboundSms, gatewayId );
@@ -173,5 +182,5 @@
return SUCCESS;
}
-
+
}
=== 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 2012-09-11 13:35:26 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2012-09-12 04:14:03 +0000
@@ -982,6 +982,7 @@
ref="org.hisp.dhis.sms.outbound.OutboundSmsService" />
<property name="programStageInstanceService"
ref="org.hisp.dhis.program.ProgramStageInstanceService" />
+ <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
</bean>
<bean id="org.hisp.dhis.caseentry.action.reminder.SendSmsToListAction"
@@ -994,6 +995,7 @@
ref="org.hisp.dhis.sms.outbound.OutboundSmsService" />
<property name="programStageInstanceService"
ref="org.hisp.dhis.program.ProgramStageInstanceService" />
+ <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
</bean>
<bean id="org.hisp.dhis.caseentry.action.reminder.SetEventStatusAction"
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2012-09-12 02:49:08 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2012-09-12 04:14:03 +0000
@@ -443,4 +443,5 @@
skipped = Skipped
unknown = Unknown
health_worker = Health worker
-please_select_criteria = Please select criteria
\ No newline at end of file
+please_select_criteria = Please select criteria
+sender = Sender
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/eventMessage.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/eventMessage.vm 2012-09-12 02:49:08 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/eventMessage.vm 2012-09-12 04:14:03 +0000
@@ -5,6 +5,7 @@
<tr>
<th>$i18n.getString( "date" )</th>
<th>$i18n.getString( "program_stage" )</th>
+ <th>$i18n.getString( "sender" )</th>
<th>$i18n.getString( "message" )</th>
</tr>
@@ -17,7 +18,8 @@
<tr id="comment_$comment.id" #alternate($mark)>
<td>$format.formatDate($comment.createdDate)</td>
<td>$programStageInstance.programStage.name</td>
- <td>$comment.creator - $comment.commentText</td>
+ <td>$comment.creator</td>
+ <td>$comment.commentText</td>
#set($index = $index + 1)
#set( $mark = !$mark)
</tr>
@@ -30,6 +32,7 @@
<tr id="tr${sms.id}" #alternate($mark) >
<td>$format.formatDate($!sms.date)</td>
<td> $programStageInstance.programStage.name</td>
+ <td>$sms.sender</td>
<td>$sms.message</td>
#set( $mark = !$mark)
</tr>
@@ -41,8 +44,9 @@
#if( $index >= 5 )
<tr id="comment_$comment.id" #alternate($mark) class="hidden">
<td>$format.formatDate($comment.createdDate)</td>
- <td> $programStageInstance.programStage.name</td>
- <td>$comment.creator - $comment.commentText</td>
+ <td>$programStageInstance.programStage.name</td>
+ <td>$comment.creator</td>
+ <td>$comment.commentText</td>
#set( $mark = !$mark)
</tr>
#end
@@ -55,6 +59,7 @@
<tr id="tr${sms.id}" #alternate($mark) >
<td>$format.formatDate($!sms.date)</td>
<td>$programStageInstance.programStage.name</td>
+ <td>$sms.sender</td>
<td>$sms.message</td>
#set( $mark = !$mark)
</tr>
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js 2012-09-12 02:49:08 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js 2012-09-12 04:14:03 +0000
@@ -155,6 +155,7 @@
showSuccessMessage( json.message );
jQuery('#commentTB').prepend("<tr><td>" + getFieldValue('currentDate') + "</td>"
+ "<td>" + getFieldValue('programStageName') + "</td>"
+ + "<td>" + getFieldValue('currentUsername') + "</td>"
+ "<td>" + getFieldValue('smsMessage') + "</td></tr>");
var noMessage = eval( getInnerHTML('noMessageDiv_' + programStageInstanceId)) + 1;
}
@@ -231,7 +232,8 @@
var programStageName = jQuery("#box_" + programStageInstanceId).attr('programStageName');
jQuery('#commentTB').prepend("<tr><td>" + getFieldValue("currentDate") + "</td>"
+ "<td>" + programStageName + "</td>"
- + "<td>" + getFieldValue('currentUsername') + " - " + commentText + "</td></tr>");
+ + "<td>" + getFieldValue('currentUsername') + "</td>"
+ + "<td>" + commentText + "</td></tr>");
field.value="";
showSuccessMessage( i18n_comment_added );
field.style.backgroundColor = SUCCESS_COLOR;
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingList.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingList.vm 2012-09-12 02:49:08 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingList.vm 2012-09-12 04:14:03 +0000
@@ -124,6 +124,7 @@
<tr>
<th>$i18n.getString( "date" )</th>
<th>$i18n.getString( "program_stage" )</th>
+ <th>$i18n.getString( "sender" )</th>
<th>$i18n.getString( "message" )</th>
</tr>
@@ -134,7 +135,8 @@
<tr id="comment_$comment.id">
<td>$format.formatDate($comment.createdDate)</td>
<td>$programStageInstance.programStage.name</td>
- <td>$comment.creator - $comment.commentText</td>
+ <td>$comment.creator</td>
+ <td>$comment.commentText</td>
#set($index = $index + 1)
</tr>
#end
@@ -144,7 +146,8 @@
#if( $index < 5 )
<tr id="tr${sms.id}" >
<td>$format.formatDate($!sms.date)</td>
- <td> $programStageInstance.programStage.name</td>
+ <td>$programStageInstance.programStage.name</td>
+ <td>$sms.sender</td>
<td>$sms.message</td>
</tr>
#end
@@ -153,8 +156,9 @@
#if( $index >= 5 )
<tr id="comment_$comment.id" class='hidden'>
<td>$format.formatDate($comment.createdDate)</td>
- <td> $programStageInstance.programStage.name</td>
- <td>$comment.creator - $comment.commentText</td>
+ <td>$programStageInstance.programStage.name</td>
+ <td>$comment.creator</td>
+ <td>$comment.commentText</td>
</tr>
#end
#end
@@ -164,6 +168,7 @@
<tr id="tr${sms.id}" class='hidden' >
<td>$format.formatDate($!sms.date)</td>
<td>$programStageInstance.programStage.name</td>
+ <td>$sms.sender</td>
<td>$sms.message</td>
</tr>
#end
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.vm 2012-09-12 02:49:08 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.vm 2012-09-12 04:14:03 +0000
@@ -11,7 +11,7 @@
});
jQuery("#searchObjectId [value=prg]").remove();
- jQuery("#searchObjectId").prepend('<option value="">' + i18n_please_select_criteria + '</option>');
+ jQuery("#searchObjectId").prepend('<option value="-100">' + i18n_please_select_criteria + '</option>');
jQuery("#searchObjectId [value=]").attr("selected","selected");
hideById('addPatientBtn');
disable('advancedSearchBtn');