← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9779: Quick hack for Uganda

 

------------------------------------------------------------
revno: 9779
committer: Magnus Korvald <korvald@xxxxxxxxxxx>
branch nick: trunk
timestamp: Sat 2013-02-09 20:13:30 +0300
message:
  Quick hack for Uganda
modified:
  dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/DefaultParserManager.java


--
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/parse/DefaultParserManager.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/DefaultParserManager.java	2013-02-05 12:21:54 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/DefaultParserManager.java	2013-02-09 17:13:30 +0000
@@ -73,7 +73,13 @@
     {
         try
         {
-            parse( sms.getOriginator(), sms.getText() );
+            /* Temporarily hack for Uganda.. will need to configure this at the gateway */
+            String text = sms.getText();
+            if(sms.getText() != null && sms.getText().startsWith( "dhis" )){
+                text = sms.getText().substring( 5 );
+            }
+            
+            parse( sms.getOriginator(), text );
         }
         catch ( SMSParserException e )
         {
@@ -354,7 +360,9 @@
 
         String value = parsedMessage.get( upperCaseCode );
 
-        if ( value != null )
+
+        
+        if ( value != null)
         {
             if ( "Y".equals( value.toUpperCase() ) || "YES".equals( value.toUpperCase() ) )
             {
@@ -407,7 +415,6 @@
             CalendarPeriodType cpt = (CalendarPeriodType) period.getPeriodType();
             period = cpt.getPreviousPeriod( period );
 
-            
             if ( date != null )
             {
                 period = cpt.createPeriod( date );
@@ -429,10 +436,10 @@
             storedBy = "[unknown] from [" + sender + "]";
         }
 
-        // if new values are submitted re-register as complete 
+        // if new values are submitted re-register as complete
         deregisterCompleteDataSet( command.getDataset(), period, orgunit );
         registerCompleteDataSet( command.getDataset(), period, orgunit, storedBy );
-        
+
     }
 
     private boolean completeForm( SMSCommand command, Map<String, String> parsedMessage )