Fixes issue 18048: Language not taken properly in process bundle
authorMikel Irurita <mikel.irurita@openbravo.com>
Thu, 21 Jul 2011 10:47:42 +0200
changeset 13223 08b15a140ffa
parent 13222 c2a5dc995660
child 13224 af0539a25f8c
Fixes issue 18048: Language not taken properly in process bundle
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/ExecutePendingPayments.java
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_BankStatementProcess.java
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProposalProcess.java
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_ReconciliationProcess.java
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_TransactionProcess.java
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/ExecutePendingPayments.java	Wed Jul 20 17:33:03 2011 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/ExecutePendingPayments.java	Thu Jul 21 10:47:42 2011 +0200
@@ -29,6 +29,7 @@
     PaymentExecutionProcess executionProcess = null;
     Organization organization = null;
     VariablesSecureApp vars = bundle.getContext().toVars();
+    final String language = bundle.getContext().getLanguage();
 
     OBContext.setAdminMode();
     try {
@@ -46,8 +47,8 @@
               executePayment.init("OTHER", executionProcess, payments, null,
                   pendingPayment.getOrganization());
               OBError result = executePayment.execute();
-              logger.logln(Utility.parseTranslation(bundle.getConnection(), vars,
-                  vars.getLanguage(), result.getMessage()));
+              logger.logln(Utility.parseTranslation(bundle.getConnection(), vars, language,
+                  result.getMessage()));
             }
             payments.clear();
           }
@@ -61,7 +62,7 @@
           FIN_ExecutePayment executePayment = new FIN_ExecutePayment();
           executePayment.init("APP", executionProcess, payments, null, organization);
           OBError result = executePayment.execute();
-          logger.logln(Utility.parseTranslation(bundle.getConnection(), vars, vars.getLanguage(),
+          logger.logln(Utility.parseTranslation(bundle.getConnection(), vars, language,
               result.getMessage()));
         }
 
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_BankStatementProcess.java	Wed Jul 20 17:33:03 2011 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_BankStatementProcess.java	Thu Jul 21 10:47:42 2011 +0200
@@ -37,6 +37,7 @@
           recordID);
       final VariablesSecureApp vars = bundle.getContext().toVars();
       final ConnectionProvider conProvider = bundle.getConnection();
+      final String language = bundle.getContext().getLanguage();
 
       bankStatement.setProcessNow(true);
       OBDal.getInstance().save(bankStatement);
@@ -76,9 +77,9 @@
         // Already Posted Document
         if ("Y".equals(bankStatement.getPosted())) {
           msg.setType("Error");
-          msg.setTitle(Utility.messageBD(conProvider, "Error", vars.getLanguage()));
-          msg.setMessage(Utility.parseTranslation(conProvider, vars, vars.getLanguage(),
-              "@PostedDocument@" + ": " + bankStatement.getIdentifier()));
+          msg.setTitle(Utility.messageBD(conProvider, "Error", language));
+          msg.setMessage(Utility.parseTranslation(conProvider, vars, language, "@PostedDocument@"
+              + ": " + bankStatement.getIdentifier()));
           bundle.setResult(msg);
           return;
         }
@@ -86,8 +87,8 @@
         for (FIN_BankStatementLine bsl : bankStatement.getFINBankStatementLineList()) {
           if (bsl.getFinancialAccountTransaction() != null) {
             msg.setType("Error");
-            msg.setTitle(Utility.messageBD(conProvider, "Error", vars.getLanguage()));
-            msg.setMessage(Utility.parseTranslation(conProvider, vars, vars.getLanguage(),
+            msg.setTitle(Utility.messageBD(conProvider, "Error", language));
+            msg.setMessage(Utility.parseTranslation(conProvider, vars, language,
                 "@APRM_BSLineReconciled@" + ": " + bsl.getLineNo().toString()));
             bundle.setResult(msg);
             return;
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProposalProcess.java	Wed Jul 20 17:33:03 2011 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProposalProcess.java	Thu Jul 21 10:47:42 2011 +0200
@@ -63,6 +63,7 @@
 
       final VariablesSecureApp vars = bundle.getContext().toVars();
       final ConnectionProvider conProvider = bundle.getConnection();
+      final String language = bundle.getContext().getLanguage();
       StringBuilder strMessageResult = new StringBuilder();
       String strMessageType = "Success";
 
@@ -75,8 +76,8 @@
           String strMessage = "@DocumentProcessed@" + paymentProposal.getDocumentNo();
           String strMsgType = "Error";
           msg.setType(strMsgType);
-          msg.setTitle(Utility.messageBD(conProvider, "Error", vars.getLanguage()));
-          msg.setMessage(Utility.parseTranslation(conProvider, vars, vars.getLanguage(), strMessage));
+          msg.setTitle(Utility.messageBD(conProvider, "Error", language));
+          msg.setMessage(Utility.parseTranslation(conProvider, vars, language, strMessage));
           bundle.setResult(msg);
           return;
         }
@@ -248,8 +249,8 @@
 
       final OBError msg = new OBError();
       msg.setType(strMessageType);
-      msg.setTitle(Utility.messageBD(conProvider, "Success", vars.getLanguage()));
-      msg.setMessage(Utility.parseTranslation(conProvider, vars, vars.getLanguage(),
+      msg.setTitle(Utility.messageBD(conProvider, "Success", language));
+      msg.setMessage(Utility.parseTranslation(conProvider, vars, language,
           strMessageResult.toString()));
       bundle.setResult(msg);
     } catch (OBException e) {
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_ReconciliationProcess.java	Wed Jul 20 17:33:03 2011 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_ReconciliationProcess.java	Thu Jul 21 10:47:42 2011 +0200
@@ -55,6 +55,8 @@
       final FIN_Reconciliation reconciliation = dao.getObject(FIN_Reconciliation.class, recordID);
       final VariablesSecureApp vars = bundle.getContext().toVars();
       final ConnectionProvider conProvider = bundle.getConnection();
+      final String language = bundle.getContext().getLanguage();
+
       reconciliation.setProcessNow(true);
       OBDal.getInstance().save(reconciliation);
       OBDal.getInstance().flush();
@@ -62,8 +64,8 @@
         // Check lines exist
         if (reconciliation.getFINReconciliationLineVList().size() == 0) {
           msg.setType("Error");
-          msg.setTitle(Utility.messageBD(conProvider, "Error", vars.getLanguage()));
-          msg.setMessage(Utility.parseTranslation(conProvider, vars, vars.getLanguage(),
+          msg.setTitle(Utility.messageBD(conProvider, "Error", language));
+          msg.setMessage(Utility.parseTranslation(conProvider, vars, language,
               "@APRM_ReconciliationNoLines@" + ": " + reconciliation.getDocumentNo()));
           bundle.setResult(msg);
           return;
@@ -81,17 +83,17 @@
         // Already Posted Document
         if ("Y".equals(reconciliation.getPosted())) {
           msg.setType("Error");
-          msg.setTitle(Utility.messageBD(conProvider, "Error", vars.getLanguage()));
-          msg.setMessage(Utility.parseTranslation(conProvider, vars, vars.getLanguage(),
-              "@PostedDocument@" + ": " + reconciliation.getDocumentNo()));
+          msg.setTitle(Utility.messageBD(conProvider, "Error", language));
+          msg.setMessage(Utility.parseTranslation(conProvider, vars, language, "@PostedDocument@"
+              + ": " + reconciliation.getDocumentNo()));
           bundle.setResult(msg);
           return;
         }
         // Transaction exists
         if (!isLastReconciliation(reconciliation)) {
           msg.setType("Error");
-          msg.setTitle(Utility.messageBD(conProvider, "Error", vars.getLanguage()));
-          msg.setMessage(Utility.parseTranslation(conProvider, vars, vars.getLanguage(),
+          msg.setTitle(Utility.messageBD(conProvider, "Error", language));
+          msg.setMessage(Utility.parseTranslation(conProvider, vars, language,
               "@APRM_FutureReconciliationExists@"));
           bundle.setResult(msg);
           return;
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_TransactionProcess.java	Wed Jul 20 17:33:03 2011 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_TransactionProcess.java	Thu Jul 21 10:47:42 2011 +0200
@@ -51,6 +51,8 @@
           .getObject(FIN_FinaccTransaction.class, recordID);
       final VariablesSecureApp vars = bundle.getContext().toVars();
       final ConnectionProvider conProvider = bundle.getConnection();
+      final String language = bundle.getContext().getLanguage();
+
       OBContext.setAdminMode();
       try {
         transaction.setProcessNow(true);
@@ -83,17 +85,17 @@
           // Already Posted Document
           if ("Y".equals(transaction.getPosted())) {
             msg.setType("Error");
-            msg.setTitle(Utility.messageBD(conProvider, "Error", vars.getLanguage()));
-            msg.setMessage(Utility.parseTranslation(conProvider, vars, vars.getLanguage(),
-                "@PostedDocument@" + ": " + transaction.getIdentifier()));
+            msg.setTitle(Utility.messageBD(conProvider, "Error", language));
+            msg.setMessage(Utility.parseTranslation(conProvider, vars, language, "@PostedDocument@"
+                + ": " + transaction.getIdentifier()));
             bundle.setResult(msg);
             return;
           }
           // Already Reconciled
           if (transaction.getReconciliation() != null || "RPPC".equals(transaction.getStatus())) {
             msg.setType("Error");
-            msg.setTitle(Utility.messageBD(conProvider, "Error", vars.getLanguage()));
-            msg.setMessage(Utility.parseTranslation(conProvider, vars, vars.getLanguage(),
+            msg.setTitle(Utility.messageBD(conProvider, "Error", language));
+            msg.setMessage(Utility.parseTranslation(conProvider, vars, language,
                 "@APRM_ReconciledDocument@" + ": " + transaction.getIdentifier()));
             bundle.setResult(msg);
             return;