details:   https://code.openbravo.com/erp/devel/pi/rev/303f6522150c
changeset: 22010:303f6522150c
user:      Sandra Huguet <sandra.huguet <at> openbravo.com>
date:      Thu Feb 13 13:30:22 2014 +0100
summary:   Fixed bug 25723 Is impossible to reconcile a transaction that it 
doesn't have a payment

diffstat:

 
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_ReconciliationProcess.java
 |  61 +++++----
 
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java
               |   3 +
 2 files changed, 35 insertions(+), 29 deletions(-)

diffs (96 lines):

diff -r b6dad5dc6d68 -r 303f6522150c 
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_ReconciliationProcess.java
--- 
a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_ReconciliationProcess.java
      Mon Feb 10 18:40:25 2014 +0530
+++ 
b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_ReconciliationProcess.java
      Thu Feb 13 13:30:22 2014 +0100
@@ -110,25 +110,26 @@
 
         Boolean invoicePaidold = false;
         for (FIN_FinaccTransaction finacctransaction : 
reconciliation.getFINFinaccTransactionList()) {
-          for (FIN_PaymentDetail pd : 
finacctransaction.getFinPayment().getFINPaymentDetailList()) {
-            for (FIN_PaymentScheduleDetail psd : 
pd.getFINPaymentScheduleDetailList()) {
-              invoicePaidold = psd.isInvoicePaid();
-              if (!invoicePaidold) {
-                if 
((FIN_Utility.invoicePaymentStatus(finacctransaction.getFinPayment()
-                    .getPaymentMethod(), reconciliation.getAccount(), 
finacctransaction
-                    
.getFinPayment().isReceipt()).equals(finacctransaction.getFinPayment()
-                    .getStatus()))) {
-                  psd.setInvoicePaid(true);
-                }
-                if (psd.isInvoicePaid()) {
-                  FIN_Utility.updatePaymentAmounts(psd);
+          if (finacctransaction.getFinPayment() != null) {
+            for (FIN_PaymentDetail pd : 
finacctransaction.getFinPayment().getFINPaymentDetailList()) {
+              for (FIN_PaymentScheduleDetail psd : 
pd.getFINPaymentScheduleDetailList()) {
+                invoicePaidold = psd.isInvoicePaid();
+                if (!invoicePaidold) {
+                  if 
((FIN_Utility.invoicePaymentStatus(finacctransaction.getFinPayment()
+                      .getPaymentMethod(), reconciliation.getAccount(), 
finacctransaction
+                      
.getFinPayment().isReceipt()).equals(finacctransaction.getFinPayment()
+                      .getStatus()))) {
+                    psd.setInvoicePaid(true);
+                  }
+                  if (psd.isInvoicePaid()) {
+                    FIN_Utility.updatePaymentAmounts(psd);
+                  }
                 }
               }
             }
+            
FIN_Utility.updateBusinessPartnerCredit(finacctransaction.getFinPayment());
           }
-          
FIN_Utility.updateBusinessPartnerCredit(finacctransaction.getFinPayment());
         }
-
         // ***********************
         // Reactivate Reconciliation
         // ***********************
@@ -162,21 +163,23 @@
         Boolean invoicePaidold = false;
 
         for (FIN_FinaccTransaction finacctransaction : 
reconciliation.getFINFinaccTransactionList()) {
-          for (FIN_PaymentDetail pd : 
finacctransaction.getFinPayment().getFINPaymentDetailList()) {
-            for (FIN_PaymentScheduleDetail psd : 
pd.getFINPaymentScheduleDetailList()) {
-              invoicePaidold = psd.isInvoicePaid();
-              if (invoicePaidold) {
-                if (FIN_Utility.invoicePaymentStatus(
-                    finacctransaction.getFinPayment().getPaymentMethod(),
-                    reconciliation.getAccount(), 
finacctransaction.getFinPayment().isReceipt())
-                    .equals(finacctransaction.getFinPayment().getStatus())) {
-                  boolean restore = 
(FIN_Utility.seqnumberpaymentstatus(finacctransaction
-                      .getFinPayment().getStatus())) <= (FIN_Utility
-                      
.seqnumberpaymentstatus(FIN_Utility.invoicePaymentStatus(finacctransaction
-                          .getFinPayment().getPaymentMethod(), 
reconciliation.getAccount(),
-                          finacctransaction.getFinPayment().isReceipt())));
-                  if (restore) {
-                    FIN_Utility.restorePaidAmounts(psd);
+          if (finacctransaction.getFinPayment() != null) {
+            for (FIN_PaymentDetail pd : 
finacctransaction.getFinPayment().getFINPaymentDetailList()) {
+              for (FIN_PaymentScheduleDetail psd : 
pd.getFINPaymentScheduleDetailList()) {
+                invoicePaidold = psd.isInvoicePaid();
+                if (invoicePaidold) {
+                  if (FIN_Utility.invoicePaymentStatus(
+                      finacctransaction.getFinPayment().getPaymentMethod(),
+                      reconciliation.getAccount(), 
finacctransaction.getFinPayment().isReceipt())
+                      .equals(finacctransaction.getFinPayment().getStatus())) {
+                    boolean restore = 
(FIN_Utility.seqnumberpaymentstatus(finacctransaction
+                        .getFinPayment().getStatus())) <= (FIN_Utility
+                        
.seqnumberpaymentstatus(FIN_Utility.invoicePaymentStatus(finacctransaction
+                            .getFinPayment().getPaymentMethod(), 
reconciliation.getAccount(),
+                            finacctransaction.getFinPayment().isReceipt())));
+                    if (restore) {
+                      FIN_Utility.restorePaidAmounts(psd);
+                    }
                   }
                 }
               }
diff -r b6dad5dc6d68 -r 303f6522150c 
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java
--- 
a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java
    Mon Feb 10 18:40:25 2014 +0530
+++ 
b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java
    Thu Feb 13 13:30:22 2014 +0100
@@ -1382,6 +1382,9 @@
   }
 
   public static void updateBusinessPartnerCredit(FIN_Payment payment) {
+    if (payment == null) {
+      return;
+    }
     // When credit is used (consumed) we compensate so_creditused as this 
amount is already
     // included in the payment details. Credit consumed should not affect to 
so_creditused
     if (payment.getGeneratedCredit().compareTo(BigDecimal.ZERO) == 0

------------------------------------------------------------------------------
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to