Related to Issue 22673. Code Review feedback applied.
authorDavid Miguelez <david.miguelez@openbravo.com>
Fri, 11 Jan 2013 12:10:18 +0100
changeset 19214 a35862bd8305
parent 19213 6643d4586bf2
child 19215 90784c1f2600
Related to Issue 22673. Code Review feedback applied.
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddOrderOrInvoice.java
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddPaymentFromInvoice.java
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddPaymentFromTransaction.java
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java
src-db/database/model/functions/C_INVOICE_CREATE.xml
src-db/database/model/tables/C_BPARTNER.xml
src-db/database/sourcedata/AD_MESSAGE.xml
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddOrderOrInvoice.java	Thu Jan 10 20:30:34 2013 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddOrderOrInvoice.java	Fri Jan 11 12:10:18 2013 +0100
@@ -934,7 +934,7 @@
       out.println("objson = " + json);
       out.close();
     } catch (JSONException e) {
-      log4j.error(e);
+      log4j.error("AddOrderOrInvoice - Callback", e);
     }
   }
 
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddPaymentFromInvoice.java	Thu Jan 10 20:30:34 2013 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddPaymentFromInvoice.java	Fri Jan 11 12:10:18 2013 +0100
@@ -750,7 +750,7 @@
       out.println("objson = " + json);
       out.close();
     } catch (JSONException e) {
-      log4j.error(e);
+      log4j.error("AddPaymentFromInvoice - Callback", e);
     }
 
   }
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddPaymentFromTransaction.java	Thu Jan 10 20:30:34 2013 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddPaymentFromTransaction.java	Fri Jan 11 12:10:18 2013 +0100
@@ -181,7 +181,7 @@
         String strSelectedScheduledPaymentDetailIds = vars.getInStringParameter(
             "inpScheduledPaymentDetailId", "", null);
         if (!"".equals(strSelectedScheduledPaymentDetailIds)) {
-          OBContext.setAdminMode();
+          OBContext.setAdminMode(true);
           try {
             List<FIN_PaymentScheduleDetail> selectedPaymentDetails = FIN_Utility.getOBObjectList(
                 FIN_PaymentScheduleDetail.class, strSelectedScheduledPaymentDetailIds);
@@ -841,7 +841,7 @@
       out.println("objson = " + json);
       out.close();
     } catch (JSONException e) {
-      log4j.error(e);
+      log4j.error("AddPaymentFromTransaction - Callback", e);
     }
   }
 
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java	Thu Jan 10 20:30:34 2013 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java	Fri Jan 11 12:10:18 2013 +0100
@@ -1123,10 +1123,11 @@
    * Returns true if the Business Partner is blocked for the document type selected.
    * 
    * @param strBPartnerId
+   *          . Business Partner Id.
    * @param issotrx
+   *          . True if Sales, False if Purchase.
    * @param docType
    *          1: Order. 2: Goods Receipt / Shipment. 3: Invoice. 4: Payment.
-   * @return
    */
   public static boolean isBlockedBusinessPartner(String strBPartnerId, boolean issotrx, int docType) {
     try {
@@ -1157,6 +1158,7 @@
 
       }
       default:
+        log4j.error("Error in isBusinessPartnerBlocking: docType must be between 1 and 4");
         return false;
       }
     } finally {
--- a/src-db/database/model/functions/C_INVOICE_CREATE.xml	Thu Jan 10 20:30:34 2013 +0100
+++ b/src-db/database/model/functions/C_INVOICE_CREATE.xml	Fri Jan 11 12:10:18 2013 +0100
@@ -230,37 +230,34 @@
           -- For all Orders
           
           FOR Cur_Bpblocked IN(
-          SELECT   bp.customer_blocking ,  bp.so_invoice_blocking , bp.name , bp.c_bpartner_id
-          FROM C_ORDER o   -- Specific InProgress Order
-          JOIN m_pricelist pl ON pl.m_pricelist_id = o.m_pricelist_id
-          JOIN C_BPartner bp ON o.c_bpartner_id = bp.c_bpartner_id
-          WHERE (bp.customer_blocking='Y' AND bp.so_invoice_blocking='Y')
-          AND ((o.C_Order_ID=v_C_Order_ID 
-          AND v_Selection = 'N'
-          AND o.DocStatus IN('IP', 'CO')) -- OR all completed and closed orders
-          OR(v_C_Order_ID IS NULL AND v_Selection = 'N'
-          AND o.DocStatus IN('CO', 'CL')
-          AND o.IsSOTrx='Y'  -- not for InvoiceSchedule
-          AND o.InvoiceRule<>'S'  -- of all or a specific business partner / organization
-          AND(v_BPartner_ID IS NULL
-          OR o.C_BPartner_ID=v_BPartner_ID)
-          AND(v_InvoiceToDate IS NULL
-          OR o.DateOrdered<TRUNC(v_InvoiceToDate) +1)
-          AND(v_AD_Org_ID IS NULL
-          OR o.AD_Org_ID=v_AD_Org_ID)) -- where there is something to invoice
-          OR (v_Selection = 'Y'
-          AND o.ISSELECTED = 'Y'
-          AND o.DocStatus IN('CO', 'CL')
-          AND o.IsSOTrx='Y'  -- not for InvoiceSchedule
-          AND o.InvoiceRule NOT IN ('S','D')  -- of all or a specific business partner / organization
-              )
-          AND EXISTS
-              (SELECT *
-              FROM C_ORDERLINE l
-              WHERE o.C_Order_ID=l.C_Order_ID
-                AND l.QtyOrdered<>l.QtyInvoiced
-              ))
-          group by bp.c_bpartner_id,bp.customer_blocking ,  bp.so_invoice_blocking ,  bp.name
+            SELECT   bp.customer_blocking ,  bp.so_invoice_blocking , bp.name , bp.c_bpartner_id
+            FROM C_ORDER o   -- Specific InProgress Order
+              JOIN m_pricelist pl ON pl.m_pricelist_id = o.m_pricelist_id
+              JOIN C_BPartner bp ON o.c_bpartner_id = bp.c_bpartner_id
+            WHERE (bp.customer_blocking='Y' AND bp.so_invoice_blocking='Y')
+            AND ((o.C_Order_ID=v_C_Order_ID 
+                    AND v_Selection = 'N'
+                    AND o.DocStatus IN('IP', 'CO')) -- OR all completed and closed orders
+                OR(v_C_Order_ID IS NULL AND v_Selection = 'N'
+                    AND o.DocStatus IN('CO', 'CL')
+                    AND o.IsSOTrx='Y'  -- not for InvoiceSchedule
+                    AND o.InvoiceRule<>'S'  -- of all or a specific business partner / organization
+                    AND(v_BPartner_ID IS NULL OR o.C_BPartner_ID=v_BPartner_ID)
+                    AND(v_InvoiceToDate IS NULL
+                        OR o.DateOrdered<TRUNC(v_InvoiceToDate) +1)
+                    AND(v_AD_Org_ID IS NULL OR o.AD_Org_ID=v_AD_Org_ID)) -- where there is something to invoice
+                OR (v_Selection = 'Y'
+                    AND o.ISSELECTED = 'Y'
+                    AND o.DocStatus IN('CO', 'CL')
+                    AND o.IsSOTrx='Y'  -- not for InvoiceSchedule
+                    AND o.InvoiceRule NOT IN ('S','D'))  -- of all or a specific business partner / organization
+                AND EXISTS
+                    (SELECT *
+                     FROM C_ORDERLINE l
+                     WHERE o.C_Order_ID=l.C_Order_ID
+                     AND l.QtyOrdered<>l.QtyInvoiced)
+            )
+            group by bp.c_bpartner_id,bp.customer_blocking ,  bp.so_invoice_blocking ,  bp.name
           )
           LOOP    
             IF(v_Message NOT LIKE '%@ThebusinessPartner@%') THEN
--- a/src-db/database/model/tables/C_BPARTNER.xml	Thu Jan 10 20:30:34 2013 +0100
+++ b/src-db/database/model/tables/C_BPARTNER.xml	Fri Jan 11 12:10:18 2013 +0100
@@ -461,6 +461,7 @@
       <check name="C_BPARTNER_ISSUMMARY_CHK"><![CDATA[ISSUMMARY IN ('Y', 'N')]]></check>
       <check name="C_BPARTNER_ISTAXEXEMPT_CHK"><![CDATA[ISTAXEXEMPT IN ('Y', 'N')]]></check>
       <check name="C_BPARTNER_ISVENDOR_CHK"><![CDATA[ISVENDOR IN ('Y', 'N')]]></check>
+      <check name="C_BPARTNER_PGBLOCKING_CHK"><![CDATA[PO_GOODS_BLOCKING IN ('Y', 'N')]]></check>
       <check name="C_BPARTNER_PIBLOCKING_CHK"><![CDATA[PO_INVOICE_BLOCKING IN ('Y', 'N')]]></check>
       <check name="C_BPARTNER_POBLOCKING_CHK"><![CDATA[PO_ORDER_BLOCKING IN ('Y', 'N')]]></check>
       <check name="C_BPARTNER_PPBLOCKING_CHK"><![CDATA[PO_PAYMENT_BLOCKING IN ('Y', 'N')]]></check>
--- a/src-db/database/sourcedata/AD_MESSAGE.xml	Thu Jan 10 20:30:34 2013 +0100
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml	Fri Jan 11 12:10:18 2013 +0100
@@ -15776,7 +15776,7 @@
 <!--2AA326CA514F44E0B8E8A16934EDC586-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--2AA326CA514F44E0B8E8A16934EDC586-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--2AA326CA514F44E0B8E8A16934EDC586-->  <VALUE><![CDATA[BusinessPartnerBlocked3]]></VALUE>
-<!--2AA326CA514F44E0B8E8A16934EDC586-->  <MSGTEXT><![CDATA[is blocked therefore the shipments can not be created.]]></MSGTEXT>
+<!--2AA326CA514F44E0B8E8A16934EDC586-->  <MSGTEXT><![CDATA[is blocked therefore the shipments cannot be created.]]></MSGTEXT>
 <!--2AA326CA514F44E0B8E8A16934EDC586-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
 <!--2AA326CA514F44E0B8E8A16934EDC586-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--2AA326CA514F44E0B8E8A16934EDC586--></AD_MESSAGE>
@@ -16572,7 +16572,7 @@
 <!--436343FCF3FA4FBD821B45EC12935786-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--436343FCF3FA4FBD821B45EC12935786-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--436343FCF3FA4FBD821B45EC12935786-->  <VALUE><![CDATA[BusinessPartnerBlocked2]]></VALUE>
-<!--436343FCF3FA4FBD821B45EC12935786-->  <MSGTEXT><![CDATA[is blocked therefore the invoices can not be created.]]></MSGTEXT>
+<!--436343FCF3FA4FBD821B45EC12935786-->  <MSGTEXT><![CDATA[is blocked therefore the invoices cannot be created.]]></MSGTEXT>
 <!--436343FCF3FA4FBD821B45EC12935786-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
 <!--436343FCF3FA4FBD821B45EC12935786-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--436343FCF3FA4FBD821B45EC12935786--></AD_MESSAGE>