details:   https://code.openbravo.com/erp/devel/pi/rev/ab055e5f30e8
changeset: 22132:ab055e5f30e8
user:      Shankar Balachandran <shankar.balachandran <at> openbravo.com>
date:      Mon Feb 24 14:15:24 2014 +0530
summary:   Fixes Issue 0025512: Not possible to use different email definitions 
when sending multiple documents by email

Handled the following cases:
Case 1: When document types are different
1. Emails are sent using the default email configurations.
2. Subject and Message body are not editable

Case 2: When there are multiple email configurations for the same document type
1. Option to choose default email configuration.
2. Option to select other email configurations.
3. Subject and message body are editable.

diffstat:

 src/org/openbravo/erpCommon/utility/reporting/EmailDefinition_data.xsql     |  
  5 +-
 src/org/openbravo/erpCommon/utility/reporting/Report.java                   |  
 11 +-
 src/org/openbravo/erpCommon/utility/reporting/TemplateInfo.java             |  
 12 +-
 src/org/openbravo/erpCommon/utility/reporting/printing/EmailOptions.html    |  
778 +++++----
 src/org/openbravo/erpCommon/utility/reporting/printing/EmailOptions.xml     |  
103 +-
 src/org/openbravo/erpCommon/utility/reporting/printing/PrintController.java |  
127 +-
 6 files changed, 609 insertions(+), 427 deletions(-)

diffs (truncated from 1308 to 300 lines):

diff -r 153c4e0482b1 -r ab055e5f30e8 
src/org/openbravo/erpCommon/utility/reporting/EmailDefinition_data.xsql
--- a/src/org/openbravo/erpCommon/utility/reporting/EmailDefinition_data.xsql   
Sun Feb 23 20:59:06 2014 +0000
+++ b/src/org/openbravo/erpCommon/utility/reporting/EmailDefinition_data.xsql   
Mon Feb 24 14:15:24 2014 +0530
@@ -12,7 +12,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2001-2010 Openbravo SLU 
+ * All portions are Copyright (C) 2001-2014 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -35,7 +35,8 @@
                        emaildefinitions.ad_language as ad_language,
                        emaildefinitions.subject as subject,
                        emaildefinitions.body as body,
-                       emaildefinitions.isdefault as isdefault
+                       emaildefinitions.isdefault as isdefault,
+                       emaildefinitions.c_poc_emaildefinition_id as id
                from
                        c_poc_emaildefinition emaildefinitions
                where
diff -r 153c4e0482b1 -r ab055e5f30e8 
src/org/openbravo/erpCommon/utility/reporting/Report.java
--- a/src/org/openbravo/erpCommon/utility/reporting/Report.java Sun Feb 23 
20:59:06 2014 +0000
+++ b/src/org/openbravo/erpCommon/utility/reporting/Report.java Mon Feb 24 
14:15:24 2014 +0530
@@ -9,7 +9,7 @@
  * either express or implied. See the License for the specific language
  * governing rights and limitations under the License. The Original Code is
  * Openbravo ERP. The Initial Developer of the Original Code is Openbravo SLU 
All
- * portions are Copyright (C) 2001-2013 Openbravo SLU All Rights Reserved.
+ * portions are Copyright (C) 2001-2014 Openbravo SLU All Rights Reserved.
  * Contributor(s): ______________________________________.
  * ***********************************************************************
  */
@@ -18,6 +18,7 @@
 import java.io.File;
 import java.io.IOException;
 import java.util.Date;
+import java.util.Map;
 import java.util.UUID;
 import java.util.regex.Matcher;
 
@@ -200,6 +201,14 @@
     return templateInfo.getEmailDefinition(_BPartnerLanguage);
   }
 
+  public EmailDefinition getDefaultEmailDefinition() throws ReportingException 
{
+    return templateInfo.get_DefaultEmailDefinition();
+  }
+
+  public Map<String, EmailDefinition> getEmailDefinitions() throws 
ReportingException {
+    return templateInfo.getEmailDefinitions();
+  }
+
   public String getOurReference() {
     return _OurReference;
   }
diff -r 153c4e0482b1 -r ab055e5f30e8 
src/org/openbravo/erpCommon/utility/reporting/TemplateInfo.java
--- a/src/org/openbravo/erpCommon/utility/reporting/TemplateInfo.java   Sun Feb 
23 20:59:06 2014 +0000
+++ b/src/org/openbravo/erpCommon/utility/reporting/TemplateInfo.java   Mon Feb 
24 14:15:24 2014 +0530
@@ -9,7 +9,7 @@
  * either express or implied. See the License for the specific language
  * governing rights and limitations under the License. The Original Code is
  * Openbravo ERP. The Initial Developer of the Original Code is Openbravo SLU 
All
- * portions are Copyright (C) 2001-2010 Openbravo SLU All Rights Reserved.
+ * portions are Copyright (C) 2001-2014 Openbravo SLU All Rights Reserved.
  * Contributor(s): ______________________________________.
  * ***********************************************************************
  */
@@ -42,6 +42,7 @@
     private String _Body;
     private String _Language;
     private boolean _IsDefault;
+    private String _Id;
 
     public EmailDefinition(EmailDefinitionData emailDefinitionData) {
       _Subject = emailDefinitionData.getField("subject");
@@ -50,6 +51,7 @@
       if (emailDefinitionData.getField("isdefault") != null) {
         _IsDefault = emailDefinitionData.getField("isdefault") == "Y" ? true : 
false;
       }
+      _Id = emailDefinitionData.getField("id");
     }
 
     public String getSubject() {
@@ -67,6 +69,10 @@
     public boolean isDefault() {
       return _IsDefault;
     }
+
+    public String getId() {
+      return _Id;
+    }
   }
 
   public TemplateInfo(ConnectionProvider connectionProvider, String docTypeId, 
String orgId,
@@ -177,6 +183,10 @@
     return emailDefinition;
   }
 
+  Map<String, EmailDefinition> getEmailDefinitions() throws ReportingException 
{
+    return _EmailDefinitions;
+  }
+
   public EmailDefinition get_DefaultEmailDefinition() {
     return _DefaultEmailDefinition;
   }
diff -r 153c4e0482b1 -r ab055e5f30e8 
src/org/openbravo/erpCommon/utility/reporting/printing/EmailOptions.html
--- a/src/org/openbravo/erpCommon/utility/reporting/printing/EmailOptions.html  
Sun Feb 23 20:59:06 2014 +0000
+++ b/src/org/openbravo/erpCommon/utility/reporting/printing/EmailOptions.html  
Mon Feb 24 14:15:24 2014 +0530
@@ -44,136 +44,146 @@
       <script type="text/javascript">
         dojo.hostenv.writeIncludes(); //makes debugging in Venkman possible
       </script>
-       <SCRIPT language="JavaScript" type="text/javascript">
-               
-       function closeThisPage() {
-               closePage();
-               return true;
-       }
+    <SCRIPT language="JavaScript" type="text/javascript">
+        
+    function closeThisPage() {
+        closePage();
+        return true;
+    }
 
-       function submitThisPage(strCommand) {
-               submitCommandForm(strCommand, false, null, null);
-               return true;
-       }
-       
-       function actionSendEmail()
-       {
-                       submitThisPage('EMAIL');
-       }
+    function submitThisPage(strCommand) {
+        submitCommandForm(strCommand, false, null, null);
+        return true;
+    }
+    
+    function actionSendEmail()
+    {
+            submitThisPage('EMAIL');
+    }
 
-       function closePopUp()
-       {
-                       closePage();
-       }
+    function closePopUp()
+    {
+            closePage();
+    }
 
-       function addFile()
-       {
-                       submitThisPage('ADD');
-       }
+    function addFile()
+    {
+            submitThisPage('ADD');
+    }
   
-       
-       function resizeWindow()
-       {
-               popupResizeTo(750, 550);
-       }
+    
+    function resizeWindow()
+    {
+        popupResizeTo(750, 550);
+    }
 
-       function doDelete(myId)
-       {
-               document.getElementById("idToDelete").value=myId;
-               submitThisPage('DEL');
-               
-       }
+    function doDelete(myId)
+    {
+        document.getElementById("idToDelete").value=myId;
+        submitThisPage('DEL');
+        
+    }
 
-       var toEmailOrig;
-       var ccEmailOrig;
-       var bccEmailOrig;
-       var replyToEmailOrig;
+    var toEmailOrig;
+    var ccEmailOrig;
+    var bccEmailOrig;
+    var replyToEmailOrig;
 
-       function onLoadDo(){
+    function onLoadDo(){
     modifyInputFile('inpFile');
-               if (document.getElementById("paramArchive").value == "Y"){
-                       document.getElementById("paramcheck").checked=true
-               }
-               var isClosed = document.getElementById("closed").value;
-               if( isClosed == "yes")
-               {
-                       closeThisPage();
-               }
+        if (document.getElementById("paramArchive").value == "Y"){
+            document.getElementById("paramcheck").checked=true
+        }
+        var isClosed = document.getElementById("closed").value;
+        if( isClosed == "yes")
+        {
+            closeThisPage();
+        }
 
-               toEmailOrig = document.getElementById('toEmailOrig').value;
-               ccEmailOrig = document.getElementById('ccEmailOrig').value;
-               bccEmailOrig = document.getElementById('bccEmailOrig').value;
-               replyToEmailOrig = 
document.getElementById('replyToEmailOrig').value;
-               manageFieldValueChange('toEmail');
-               manageFieldValueChange('ccEmail');
-               manageFieldValueChange('bccEmail');
-               manageFieldValueChange('replyToEmail');
+        toEmailOrig = document.getElementById('toEmailOrig').value;
+        ccEmailOrig = document.getElementById('ccEmailOrig').value;
+        bccEmailOrig = document.getElementById('bccEmailOrig').value;
+        replyToEmailOrig = document.getElementById('replyToEmailOrig').value;
+        manageFieldValueChange('toEmail');
+        manageFieldValueChange('ccEmail');
+        manageFieldValueChange('bccEmail');
+        manageFieldValueChange('replyToEmail');
 
-               if (document.getElementById('ccEmail').value !== '') {
-                       document.getElementById('cc').style.display = '';
-                       
document.getElementById('cc_bottomMargin').style.display = '';
-               }
-               if (document.getElementById('bccEmail').value !== '') {
-                       document.getElementById('bcc').style.display = '';
-                       
document.getElementById('bcc_bottomMargin').style.display = '';
-               }
+        if (document.getElementById('ccEmail').value !== '') {
+            document.getElementById('cc').style.display = '';
+            document.getElementById('cc_bottomMargin').style.display = '';
+        }
+        if (document.getElementById('bccEmail').value !== '') {
+            document.getElementById('bcc').style.display = '';
+            document.getElementById('bcc_bottomMargin').style.display = '';
+        }
 
-               this.windowTables = new Array(
-                 new windowTableId('client')
-               );
-               setWindowTableParentElement();
-               enableShortcuts('popup');
-               setBrowserAutoComplete(false);
-               
-               var draftDocumentIds = 
document.getElementById("draftDocumentIds").value;
-               if( draftDocumentIds != "" )
-               {
-                       var documentIds = draftDocumentIds.split( "," );
-                       for( var index = 0; index < documentIds.length; index++ 
)
-                       {
-                               var documentId = documentIds[index];
-                       }
-               } 
-               setWindowElementFocus('firstElement');
+        this.windowTables = new Array(
+          new windowTableId('client')
+        );
+        setWindowTableParentElement();
+        enableShortcuts('popup');
+        setBrowserAutoComplete(false);
+        
+        var draftDocumentIds = 
document.getElementById("draftDocumentIds").value;
+        if( draftDocumentIds != "" )
+        {
+            var documentIds = draftDocumentIds.split( "," );
+            for( var index = 0; index < documentIds.length; index++ )
+            {
+                var documentId = documentIds[index];
+            }
+        } 
+        setWindowElementFocus('firstElement');
         resizeWindow();
-       }
+        if(document.getElementById('multiDocType').value=='Y'){
+          document.getElementById('emailConfigSelector').style.display = 
'none';
+          document.getElementById('emailConfigToUse').style.display = 'none';
+          document.getElementById('emailField03Subject').style.display = 
'none';
+          document.getElementById('emailField03Body').style.display = 'none';
+        }
+        if(document.getElementById('useDefault').value=='Y'){
+          document.getElementById('emailConfigSelector').style.display = 
'none';
+          document.getElementById('emailConfigToUse').style.display = 'none';
+        }
+    }
 
-       function onResizeDo(){

------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to