details:   https://code.openbravo.com/erp/devel/pi/rev/490f35995400
changeset: 14967:490f35995400
user:      VĂ­ctor Villar <victor.villar <at> openbravo.com>
date:      Wed Dec 28 17:32:25 2011 +0100
summary:   Fixed issue 18871: DAL admin mode in AddPaymentFromInvoice process

diffstat:

 
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddPaymentFromInvoice.java
 |  25 ++++++----
 1 files changed, 15 insertions(+), 10 deletions(-)

diffs (38 lines):

diff -r 05ba1ff75290 -r 490f35995400 
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddPaymentFromInvoice.java
--- 
a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddPaymentFromInvoice.java
  Wed Dec 28 21:54:06 2011 +0100
+++ 
b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddPaymentFromInvoice.java
  Wed Dec 28 17:32:25 2011 +0100
@@ -359,19 +359,24 @@
     } catch (Exception ex) {
       throw new ServletException(ex);
     }
+    try {
+      OBContext.setAdminMode(true);
 
-    final Currency financialAccountCurrency = dao
-        .getFinancialAccountCurrency(strFinancialAccountId);
-    if (financialAccountCurrency != null) {
-      xmlDocument.setParameter("financialAccountCurrencyId", 
financialAccountCurrency.getId());
-      xmlDocument.setParameter("financialAccountCurrencyPrecision", 
financialAccountCurrency
-          .getStandardPrecision().toString());
+      final Currency financialAccountCurrency = dao
+          .getFinancialAccountCurrency(strFinancialAccountId);
+      if (financialAccountCurrency != null) {
+        xmlDocument.setParameter("financialAccountCurrencyId", 
financialAccountCurrency.getId());
+        xmlDocument.setParameter("financialAccountCurrencyPrecision", 
financialAccountCurrency
+            .getStandardPrecision().toString());
+      }
+      String exchangeRate = findExchangeRate(paymentCurrency, 
financialAccountCurrency, new Date(),
+          OBDal.getInstance().get(Organization.class, strOrgId), 
conversionRatePrecision);
+      xmlDocument.setParameter("exchangeRate", exchangeRate);
+
+    } finally {
+      OBContext.restorePreviousMode();
     }
 
-    String exchangeRate = findExchangeRate(paymentCurrency, 
financialAccountCurrency, new Date(),
-        OBDal.getInstance().get(Organization.class, strOrgId), 
conversionRatePrecision);
-    xmlDocument.setParameter("exchangeRate", exchangeRate);
-
     boolean forcedFinancialAccountTransaction = false;
     forcedFinancialAccountTransaction = 
isForcedFinancialAccountTransaction(isReceipt,
         strFinancialAccountId, strPaymentMethodId);

------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to