details:   https://code.openbravo.com/erp/devel/pi/rev/f2a7875273c1
changeset: 20023:f2a7875273c1
user:      Mikel Irurita <mikel.irurita <at> openbravo.com>
date:      Tue Mar 12 17:19:32 2013 +0100
summary:   Fixes issue 23288: Payment proposal: ability to generate single 
payment for all the purchase orders/invoices

details:   https://code.openbravo.com/erp/devel/pi/rev/8a755239b390
changeset: 20024:8a755239b390
user:      Sandra Huguet <sandra.huguet <at> openbravo.com>
date:      Wed Mar 27 16:16:22 2013 +0100
summary:   Related to issue 23288 update Copyright

diffstat:

 
modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_REF_LIST.xml 
                                  |  15 +++++
 
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ProcessPaymentProposal.java
 |   5 +-
 
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProposalProcess.java
     |  28 ++++++---
 3 files changed, 36 insertions(+), 12 deletions(-)

diffs (147 lines):

diff -r 0e144d68eb28 -r 8a755239b390 
modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_REF_LIST.xml
--- 
a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_REF_LIST.xml
   Wed Mar 27 16:15:38 2013 +0100
+++ 
b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_REF_LIST.xml
   Wed Mar 27 16:16:22 2013 +0100
@@ -25,6 +25,18 @@
 <!--2C29C3C687FC403A802A15DEAF9E0D26-->  <SEQNO><![CDATA[10]]></SEQNO>
 <!--2C29C3C687FC403A802A15DEAF9E0D26--></AD_REF_LIST>
 
+<!--3F087596A0A14DE5BAECAD211AB393BA--><AD_REF_LIST>
+<!--3F087596A0A14DE5BAECAD211AB393BA-->  
<AD_REF_LIST_ID><![CDATA[3F087596A0A14DE5BAECAD211AB393BA]]></AD_REF_LIST_ID>
+<!--3F087596A0A14DE5BAECAD211AB393BA-->  
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--3F087596A0A14DE5BAECAD211AB393BA-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--3F087596A0A14DE5BAECAD211AB393BA-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--3F087596A0A14DE5BAECAD211AB393BA-->  <VALUE><![CDATA[GONEP]]></VALUE>
+<!--3F087596A0A14DE5BAECAD211AB393BA-->  <NAME><![CDATA[Group all 
orders/invoices into one payment]]></NAME>
+<!--3F087596A0A14DE5BAECAD211AB393BA-->  
<AD_REFERENCE_ID><![CDATA[79FDE7805FC84C2BB251EE57E96C0AEE]]></AD_REFERENCE_ID>
+<!--3F087596A0A14DE5BAECAD211AB393BA-->  
<AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--3F087596A0A14DE5BAECAD211AB393BA-->  <SEQNO><![CDATA[40]]></SEQNO>
+<!--3F087596A0A14DE5BAECAD211AB393BA--></AD_REF_LIST>
+
 <!--432DB5DD63B449ACB9DEFF26D21B219F--><AD_REF_LIST>
 <!--432DB5DD63B449ACB9DEFF26D21B219F-->  
<AD_REF_LIST_ID><![CDATA[432DB5DD63B449ACB9DEFF26D21B219F]]></AD_REF_LIST_ID>
 <!--432DB5DD63B449ACB9DEFF26D21B219F-->  
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -34,6 +46,7 @@
 <!--432DB5DD63B449ACB9DEFF26D21B219F-->  <NAME><![CDATA[Generate 
Payments]]></NAME>
 <!--432DB5DD63B449ACB9DEFF26D21B219F-->  
<AD_REFERENCE_ID><![CDATA[79FDE7805FC84C2BB251EE57E96C0AEE]]></AD_REFERENCE_ID>
 <!--432DB5DD63B449ACB9DEFF26D21B219F-->  
<AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--432DB5DD63B449ACB9DEFF26D21B219F-->  <SEQNO><![CDATA[10]]></SEQNO>
 <!--432DB5DD63B449ACB9DEFF26D21B219F--></AD_REF_LIST>
 
 <!--4A633A692495425FA27BEF840905D29E--><AD_REF_LIST>
@@ -45,6 +58,7 @@
 <!--4A633A692495425FA27BEF840905D29E-->  <NAME><![CDATA[Reactivate]]></NAME>
 <!--4A633A692495425FA27BEF840905D29E-->  
<AD_REFERENCE_ID><![CDATA[79FDE7805FC84C2BB251EE57E96C0AEE]]></AD_REFERENCE_ID>
 <!--4A633A692495425FA27BEF840905D29E-->  
<AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--4A633A692495425FA27BEF840905D29E-->  <SEQNO><![CDATA[20]]></SEQNO>
 <!--4A633A692495425FA27BEF840905D29E--></AD_REF_LIST>
 
 <!--4A647396E4CE4E8B90D58E9FE4C12BBA--><AD_REF_LIST>
@@ -210,6 +224,7 @@
 <!--C5D1596D065545B49156C1F9426C9E14-->  <NAME><![CDATA[Group separate 
payments for the same vendor into one payment]]></NAME>
 <!--C5D1596D065545B49156C1F9426C9E14-->  
<AD_REFERENCE_ID><![CDATA[79FDE7805FC84C2BB251EE57E96C0AEE]]></AD_REFERENCE_ID>
 <!--C5D1596D065545B49156C1F9426C9E14-->  
<AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--C5D1596D065545B49156C1F9426C9E14-->  <SEQNO><![CDATA[30]]></SEQNO>
 <!--C5D1596D065545B49156C1F9426C9E14--></AD_REF_LIST>
 
 <!--E047F81FACD0440EACB0EE63EB18A4EE--><AD_REF_LIST>
diff -r 0e144d68eb28 -r 8a755239b390 
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ProcessPaymentProposal.java
--- 
a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ProcessPaymentProposal.java
 Wed Mar 27 16:15:38 2013 +0100
+++ 
b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ProcessPaymentProposal.java
 Wed Mar 27 16:16:22 2013 +0100
@@ -11,7 +11,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) 2010-2012 Openbravo SLU
+ * All portions are Copyright (C) 2010-2013 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -65,7 +65,7 @@
       OBContext.setAdminMode();
       try {
 
-        if (strProcessProposalAction.equals("GSP")) {
+        if (strProcessProposalAction.equals("GSP") || 
strProcessProposalAction.equals("GONEP")) {
           try {
             List<FIN_PaymentPropDetail> ppd = new 
AdvPaymentMngtDao().getObject(
                 FIN_PaymentProposal.class, 
strFinPaymentProposalId).getFINPaymentPropDetailList();
@@ -139,6 +139,7 @@
       discard[0] = "displayCheckBox";
       filterActions.put(fpp.getAPRMProcessProposal(), 
fpp.getAPRMProcessProposal());
     } else {
+      filterActions.put("GONEP", "GONEP");
       filterActions.put("GSP", "GSP");
     }
     XmlDocument xmlDocument = xmlEngine.readXmlTemplate(
diff -r 0e144d68eb28 -r 8a755239b390 
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProposalProcess.java
--- 
a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProposalProcess.java
     Wed Mar 27 16:15:38 2013 +0100
+++ 
b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProposalProcess.java
     Wed Mar 27 16:16:22 2013 +0100
@@ -11,7 +11,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) 2010-2011 Openbravo SLU
+ * All portions are Copyright (C) 2010-2013 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -70,7 +70,8 @@
       final FIN_PaymentProposal paymentProposal = dao
           .getObject(FIN_PaymentProposal.class, recordID);
 
-      if (strAction.equals("GSP")) {
+      if (strAction.equals("GSP") || strAction.equals("GONEP")) {
+        boolean groupByVendor = strAction.equals("GSP");
         if (paymentProposal.isProcessed()) {
           OBError msg = new OBError();
           String strMessage = "@DocumentProcessed@" + 
paymentProposal.getDocumentNo();
@@ -121,7 +122,7 @@
                   
.getOrderPaymentSchedule().getOrder().getBusinessPartner().getId();
             }
 
-            if (!strBusinessPartner_old.equals(strBusinessPartner)
+            if (groupByVendor && 
!strBusinessPartner_old.equals(strBusinessPartner)
                 && !strBusinessPartner_old.equals("-1")) {
 
               // String strPaymentDocumentNo = 
Utility.getDocumentNo(conProvider, vars,
@@ -177,12 +178,14 @@
           long faPrecision = financialAccountCurrency.getStandardPrecision();
           finAccTxnAmount = finAccTxnAmount.setScale((int) faPrecision, 
RoundingMode.HALF_UP);
 
+          BusinessPartner businessPartner = groupByVendor ? 
dao.getObject(BusinessPartner.class,
+              strBusinessPartner) : null;
+
           FIN_Payment payment = FIN_AddPayment.savePayment(null, isReceipt,
               dao.getObject(DocumentType.class, strDocTypeId), 
strPaymentDocumentNo,
-              dao.getObject(BusinessPartner.class, strBusinessPartner), 
paymentMethodId,
-              financialAccountId, paymentTotal.toString(), paymentDate, orgId, 
null,
-              selectedPaymentDetails, selectedPaymentDetailsAmounts, 
isWriteOff, isRefund,
-              paymentCurrency, exchangeRate, finAccTxnAmount);
+              businessPartner, paymentMethodId, financialAccountId, 
paymentTotal.toString(),
+              paymentDate, orgId, null, selectedPaymentDetails, 
selectedPaymentDetailsAmounts,
+              isWriteOff, isRefund, paymentCurrency, exchangeRate, 
finAccTxnAmount);
           paymentProposal.setStatus(isReceipt ? "RPR" : "PPM");
           // process payment
           message = FIN_AddPayment.processPayment(vars, conProvider, "P", 
payment);
@@ -192,13 +195,18 @@
             OBDal.getInstance().flush();
           }
           if (message.getType().equals("Error")) {
-            String exceptionMessage = payment.getBusinessPartner().getName();
+            String exceptionMessage = payment.getBusinessPartner() != null ? 
payment
+                .getBusinessPartner().getName() : payment.getDocumentNo();
             exceptionMessage += ": " + message.getMessage();
             throw new OBException(exceptionMessage);
-          } else if (message.getType().equals("Warning"))
+          } else if (message.getType().equals("Warning")) {
             strMessageType = message.getType();
+          }
           strMessageResult.append("@Payment@ 
").append(payment.getDocumentNo());
-          strMessageResult.append(" 
(").append(payment.getBusinessPartner().getName()).append(")");
+          if (payment.getBusinessPartner() != null) {
+            strMessageResult.append(" 
(").append(payment.getBusinessPartner().getName())
+                .append(")");
+          }
           if (!"".equals(message.getMessage()))
             strMessageResult.append(": ").append(message.getMessage());
           strMessageResult.append("<br>");

------------------------------------------------------------------------------
Own the Future-Intel&reg; Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game 
on Steam. $5K grand prize plus 10 genre and skill prizes. 
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to