dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #16773
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6465: (mobile) Fixed bug send SMS by orgunit tree from web page.
------------------------------------------------------------
revno: 6465
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-04-03 10:17:19 +0700
message:
(mobile) Fixed bug send SMS by orgunit tree from web page.
modified:
dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/SmsMessageSender.java
dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/smslib/SmsLibService.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ProcessingSendSMSAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/gateway.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/sendSMS.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/sendSMSPage.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-sms/src/main/java/org/hisp/dhis/sms/outbound/SmsMessageSender.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/SmsMessageSender.java 2012-03-26 04:42:44 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/SmsMessageSender.java 2012-04-03 03:17:19 +0000
@@ -102,7 +102,7 @@
}
else
{
- message = "not_sending_message_to_any_recipient";
+ message = "no_recipient";
}
return message;
=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/smslib/SmsLibService.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/smslib/SmsLibService.java 2012-03-26 04:42:44 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/smslib/SmsLibService.java 2012-04-03 03:17:19 +0000
@@ -111,7 +111,7 @@
{
log.warn( "Trying to send sms without recipients: " + sms );
- return message = "there_is_no_recipient_cannot_send_sms";
+ return message = "no_recipient";
}
else if ( recipients.size() == 1 )
{
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ProcessingSendSMSAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ProcessingSendSMSAction.java 2012-03-26 04:42:44 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ProcessingSendSMSAction.java 2012-04-03 03:17:19 +0000
@@ -93,7 +93,7 @@
this.recipients = recipients;
}
- private String message;
+ private String message = "success";
public String getMessage()
{
@@ -126,38 +126,6 @@
if ( smsMessage != null && !smsMessage.isEmpty() )
{
- Collection<OrganisationUnit> units = selectionTreeManager.getReloadedSelectedOrganisationUnits();
-
- if ( units != null && !units.isEmpty() )
- {
- Set<User> users = new HashSet<User>();
-
- for ( OrganisationUnit unit : units )
- {
- if ( unit.getUsers() == null || unit.getUsers().isEmpty() )
- {
- if ( unit.getPhoneNumber() != null && !unit.getPhoneNumber().isEmpty() )
- {
- recipients.add( unit.getPhoneNumber() );
- }
- }
- else
- {
- users.addAll( unit.getUsers() );
- }
- }
-
- message = messageSender.sendMessage( smsSubject, smsMessage, currentUserService.getCurrentUser(),
- false, users, gatewayId );
-
- if ( message != null && !message.equals( "success" ) )
- {
- message = i18n.getString( message );
-
- return ERROR;
- }
- }
-
if ( recipients != null && !recipients.isEmpty() )
{
message = messageSender.sendMessage( smsSubject, smsMessage, currentUserService.getCurrentUser(), true,
@@ -170,6 +138,53 @@
return ERROR;
}
}
+ else
+ {
+ Collection<OrganisationUnit> units = selectionTreeManager.getReloadedSelectedOrganisationUnits();
+
+ if ( units != null && !units.isEmpty() )
+ {
+ recipients.clear();
+ Set<User> users = new HashSet<User>();
+
+ for ( OrganisationUnit unit : units )
+ {
+ if ( unit.getUsers() == null || unit.getUsers().isEmpty() )
+ {
+ if ( unit.getPhoneNumber() != null && !unit.getPhoneNumber().isEmpty() )
+ {
+ recipients.add( unit.getPhoneNumber() );
+ }
+ }
+ else
+ {
+ users.addAll( unit.getUsers() );
+ }
+ }
+
+ message = messageSender.sendMessage( smsSubject, smsMessage, currentUserService.getCurrentUser(),
+ true, recipients, gatewayId );
+
+ if ( message != null && (message.equals( "no_recipient" ) || message.equals( "success" )) )
+ {
+ message = messageSender.sendMessage( smsSubject, smsMessage, currentUserService
+ .getCurrentUser(), false, users, gatewayId );
+
+ if ( message != null && !message.equals( "success" ) )
+ {
+ message = i18n.getString( message );
+
+ return ERROR;
+ }
+ }
+ else
+ {
+ message = i18n.getString( message );
+
+ return ERROR;
+ }
+ }
+ }
}
return SUCCESS;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module.properties 2012-03-26 04:42:44 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module.properties 2012-04-03 03:17:19 +0000
@@ -62,10 +62,9 @@
message_not_sent=Message not sent
please_select_a_gateway_type_to_send_sms=Please specify a gateway to send SMS
service_stopped_cannot_send_sms=Service is stopped, can't send SMS
-there_is_no_recipient_cannot_send_sms=There is no any recipient, can't send SMS
please_verify_phone=Please verify phone number(s). Separate them by the semicolon (;)
please_select_orgunit=Please select one or many organisation unit
-not_sending_message_to_any_recipient=Not sending message to any of the recipients
+no_recipient=There is no any recipient, can't send SMS.\nNotes: Make sure that "Message sms notification" Setting is activated.
unable_load_gateway=Unable to load gateway
unable_start_smslib_service=Unable to start smsLib service
unable_stop_smslib_service=Unable to stop smsLib service
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/gateway.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/gateway.js 2012-03-26 04:42:44 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/gateway.js 2012-04-03 03:17:19 +0000
@@ -125,6 +125,6 @@
if ( json.response == "success" ) {
showSuccessMessage( i18n_add_update_success );
} else {
- showErrorMessage( json.message );
+ showErrorMessage( json.message, 7000 );
}
}
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/sendSMS.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/sendSMS.js 2012-03-26 04:49:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/sendSMS.js 2012-04-03 03:17:19 +0000
@@ -1,7 +1,7 @@
var isChecked = false;
var isOrgunitSelected = false;
-function selectedOrganisationUnit( unitIds )
+function selectedOrganisationUnitSendSMS( unitIds )
{
isOrgunitSelected = (unitIds && unitIds.length > 0);
}
@@ -9,6 +9,9 @@
function toggleSMSGUI( checked )
{
if ( checked ) {
+ selectionTree.clearSelectedOrganisationUnits();
+ selectionTree.buildSelectionTree();
+
hideById( 'phoneType' );
showById( 'orgunitType' );
} else {
@@ -64,7 +67,7 @@
showSuccessMessage( json.message );
}
else {
- showErrorMessage( json.message );
+ showErrorMessage( json.message, 7000 );
}
} );
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/sendSMSPage.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/sendSMSPage.vm 2012-03-26 04:42:44 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/sendSMSPage.vm 2012-04-03 03:17:19 +0000
@@ -2,8 +2,9 @@
jQuery(document).ready( function() {
validation( "sendSMSForm", function( form ) { sendSMSMessage( form ); } );
- selectionTreeSelection.setListenerFunction( selectedOrganisationUnit );
+ selectionTreeSelection.setListenerFunction( selectedOrganisationUnitSendSMS );
+ uncheck( "sendTypeCB" );
toggleSMSGUI( false );
});