details:   /erp/devel/pi/rev/b5f915fde1b4
changeset: 7096:b5f915fde1b4
user:      Gorka Ion Damián <gorkaion.damian <at> openbravo.com>
date:      Tue Apr 20 10:44:30 2010 +0200
summary:   Related to issue 13048. Changed done to avoid api break on 
updateInvoice method.

diffstat:

 src/org/openbravo/erpCommon/ad_actionButton/InvoicePaymentMonitor.java |   6 
++-
 src/org/openbravo/erpCommon/ad_process/PaymentMonitor.java             |  16 
++++++---
 src/org/openbravo/erpCommon/ad_process/PaymentMonitorProcess.java      |   3 +-
 3 files changed, 16 insertions(+), 9 deletions(-)

diffs (58 lines):

diff -r 4940c63db907 -r b5f915fde1b4 
src/org/openbravo/erpCommon/ad_actionButton/InvoicePaymentMonitor.java
--- a/src/org/openbravo/erpCommon/ad_actionButton/InvoicePaymentMonitor.java    
Tue Apr 20 13:39:41 2010 +0530
+++ b/src/org/openbravo/erpCommon/ad_actionButton/InvoicePaymentMonitor.java    
Tue Apr 20 10:44:30 2010 +0200
@@ -84,9 +84,11 @@
     OBError myError = null;
     try {
       Invoice invoice = OBDal.getInstance().get(Invoice.class, strKey);
-      if (invoice.isProcessed()) {
+      // Extra check for PaymentMonitor-disabling switch, to build correct 
message for users
+      if (Utility.getPropertyValue("PaymentMonitor", vars.getClient(), 
invoice.getOrganization()
+          .getId()) == null
+          && invoice.isProcessed())
         PaymentMonitor.updateInvoice(invoice);
-      }
 
       myError = new OBError();
       myError.setType("Success");
diff -r 4940c63db907 -r b5f915fde1b4 
src/org/openbravo/erpCommon/ad_process/PaymentMonitor.java
--- a/src/org/openbravo/erpCommon/ad_process/PaymentMonitor.java        Tue Apr 
20 13:39:41 2010 +0530
+++ b/src/org/openbravo/erpCommon/ad_process/PaymentMonitor.java        Tue Apr 
20 10:44:30 2010 +0200
@@ -28,13 +28,19 @@
 
   /**
    * Updates payment monitor information
+   * 
+   * Users of this method should check for existence of the PaymentMonitor 
property (disabling it)
+   * to be able to provide the user with a relevant message.
    */
-  public static void updateInvoice(Invoice invoice) throws PropertyException {
-    // Don't update the payment monitor information if there is an installed 
extension module that
-    // manages it.
-    if (Utility.getPropertyValue("PaymentMonitor", 
invoice.getClient().getId(), invoice
-        .getOrganization().getId()) != null)
+  public static void updateInvoice(Invoice invoice) {
+    // Check for PaymentMonitor-disabling switch.
+    try {
+      if (Utility.getPropertyValue("PaymentMonitor", 
invoice.getClient().getId(), invoice
+          .getOrganization().getId()) != null)
+        return;
+    } catch (PropertyException e) {
       return;
+    }
     final boolean prevMode = 
OBContext.getOBContext().setInAdministratorMode(true);
     try {
       List<DebtPayment> payments = invoice.getFinancialMgmtDebtPaymentList();
diff -r 4940c63db907 -r b5f915fde1b4 
src/org/openbravo/erpCommon/ad_process/PaymentMonitorProcess.java
--- a/src/org/openbravo/erpCommon/ad_process/PaymentMonitorProcess.java Tue Apr 
20 13:39:41 2010 +0530
+++ b/src/org/openbravo/erpCommon/ad_process/PaymentMonitorProcess.java Tue Apr 
20 10:44:30 2010 +0200
@@ -21,8 +21,7 @@
   public void doExecute(ProcessBundle bundle) throws Exception {
 
     logger = bundle.getLogger();
-    // Don't update the payment monitor information if there is an installed 
extension module that
-    // manages it.
+    // Extra check for PaymentMonitor-disabling switch, to build correct 
message for users
     try {
       if (Utility.getPropertyValue("PaymentMonitor", 
bundle.getContext().getClient(), bundle
           .getContext().getOrganization()) != null) {

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to