← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4880: Added email subject prefix

 

------------------------------------------------------------
revno: 4880
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-10-07 13:55:51 +0200
message:
  Added email subject prefix
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/DefaultMessageService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/EmailMessageSender.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/RegisterCompleteDataSetAction.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-core/src/main/java/org/hisp/dhis/message/DefaultMessageService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/DefaultMessageService.java	2011-10-07 11:48:18 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/DefaultMessageService.java	2011-10-07 11:55:51 +0000
@@ -145,7 +145,7 @@
             //TODO i18n and string externalization            
             String subject = "Notification: Form registered as complete";
             String text = "The form " + registration.getDataSet() + " was registered as complete for period " + 
-                registration.getPeriod() + " and organisation unit " + registration.getSource();
+                registration.getPeriod().getName() + " and organisation unit " + registration.getSource();
             
             MessageConversation conversation = new MessageConversation( subject, sender );
             

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/EmailMessageSender.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/EmailMessageSender.java	2011-10-07 08:43:57 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/EmailMessageSender.java	2011-10-07 11:55:51 +0000
@@ -57,6 +57,7 @@
     
     private static final int SMTP_PORT = 587;
     private static final String FROM_ADDRESS = "noreply@xxxxxxxxx";
+    private static final String SUBJECT_PREFX = "[DHIS2] ";
 
     // -------------------------------------------------------------------------
     // Dependencies
@@ -105,7 +106,7 @@
                     String toAddress = StringUtils.trimToNull( user.getEmail() );
                     
                     Email email = getEmail( hostName, username, password );
-                    email.setSubject( subject );
+                    email.setSubject( SUBJECT_PREFX + subject );
                     email.setMsg( text );
                     email.addTo( toAddress );
                     email.send();

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/RegisterCompleteDataSetAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/RegisterCompleteDataSetAction.java	2011-10-07 11:48:18 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/RegisterCompleteDataSetAction.java	2011-10-07 11:55:51 +0000
@@ -35,6 +35,7 @@
 import org.hisp.dhis.dataset.CompleteDataSetRegistrationService;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.message.MessageService;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
@@ -82,6 +83,13 @@
     {
         this.messageService = messageService;
     }
+    
+    private I18nFormat format;
+
+    public void setFormat( I18nFormat format )
+    {
+        this.format = format;
+    }
 
     // -------------------------------------------------------------------------
     // Input
@@ -118,6 +126,7 @@
 
         DataSet dataSet = dataSetService.getDataSet( dataSetId );
         Period period = PeriodType.createPeriodExternalId( periodId );
+        period.setName( format.formatPeriod( period ) );
         OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
 
         if ( registrationService.getCompleteDataSetRegistration( dataSet, period, organisationUnit ) == null )