details:   https://code.openbravo.com/erp/devel/pi/rev/e86c34bf3374
changeset: 30484:e86c34bf3374
user:      Atul Gaware <atul.gaware <at> openbravo.com>
date:      Wed Jul 29 13:00:37 2015 +0530
summary:   Fixes issue 30242: Description not copied to order in Manage 
Requisition

While creating order from requisition, requisition header information is
inserted in order header and requisition line descripion is added to
supplier notes as it was used previously to set as order line description.
Length of description in orderline can occupy both supplier notes and
description from requisition line.

details:   https://code.openbravo.com/erp/devel/pi/rev/227ef1f50901
changeset: 30485:227ef1f50901
user:      Atul Gaware <atul.gaware <at> openbravo.com>
date:      Fri Jul 31 13:38:35 2015 +0530
summary:   Fixes issue 29685: Create AP Expense Invoices process creates wrong 
line number

Getting line no is used similar that is used to set default value for line
column in Tables and Columns. For eg:- select coalesce(max(line), 0) + 10
Unnecessary variable int line is no more needed so removed.
While executing create AP Expense invoice process there was null pointer
exception raised from AccDefUtility class which is fixed.

diffstat:

 src-db/database/model/functions/M_REQUISITION_CREATEPO.xml        |  10 
++++++----
 src/org/openbravo/erpCommon/ad_process/ExpenseAPInvoice.java      |   8 
++------
 src/org/openbravo/erpCommon/ad_process/ExpenseAPInvoice_data.xsql |   4 ++--
 src/org/openbravo/erpCommon/utility/AccDefUtility.java            |   6 ++++--
 4 files changed, 14 insertions(+), 14 deletions(-)

diffs (124 lines):

diff -r df1b95da863f -r 227ef1f50901 
src-db/database/model/functions/M_REQUISITION_CREATEPO.xml
--- a/src-db/database/model/functions/M_REQUISITION_CREATEPO.xml        Mon Oct 
17 12:08:47 2016 +0200
+++ b/src-db/database/model/functions/M_REQUISITION_CREATEPO.xml        Fri Jul 
31 13:38:35 2015 +0530
@@ -128,7 +128,7 @@
            M_PRICELIST.ISTAXINCLUDED
        FROM (SELECT COALESCE(p_Vendor_ID, M_REQUISITIONLINE.C_BPARTNER_ID, 
M_REQUISITION.C_BPARTNER_ID, PRODUCT_PO.C_BPARTNER_ID) AS VENDOR_ID,
                  COALESCE(p_PriceList_ID, M_REQUISITIONLINE.M_PRICELIST_ID, 
M_REQUISITION.M_PRICELIST_ID) AS A_PRICELIST_ID,
-                 M_REQUISITIONLINE.*
+                 M_REQUISITIONLINE.*, M_REQUISITION.DESCRIPTION AS HEADERDESC
               FROM M_REQUISITION, M_REQUISITIONLINE LEFT JOIN (SELECT 
MAX(C_BPARTNER_ID) AS C_BPARTNER_ID, M_PRODUCT_ID
                                                                FROM 
M_PRODUCT_PO
                                                                WHERE 
ISCURRENTVENDOR = 'Y'
@@ -207,7 +207,8 @@
             DELIVERYRULE, FREIGHTCOSTRULE, DELIVERYVIARULE, PRIORITYRULE,
             TOTALLINES, GRANDTOTAL, M_WAREHOUSE_ID, M_PRICELIST_ID,
             ISTAXINCLUDED, POSTED, PROCESSING, BILLTO_ID,
-            AD_USER_ID, COPYFROM, DATEPROMISED
+            AD_USER_ID, COPYFROM, DATEPROMISED,
+            DESCRIPTION
         ) VALUES (
             v_C_Order_ID, v_CLIENT_ID, p_Org_ID, v_User_ID,now(),
             v_User_ID, now(), 'N', v_DocumentNo, 'DR',
@@ -217,7 +218,8 @@
             COALESCE(Cur_Lines.Deliveryrule, 'A'), 'I', 'D', '5',
             0, 0, p_WAREHOUSE_ID, Cur_Lines.PRICELIST_ID,
              'N', 'N', 'N', v_BillTo_ID,
-            v_sales_rep_ID, 'N', Cur_Lines.NEEDBYDATE
+            v_sales_rep_ID, 'N', Cur_Lines.NEEDBYDATE,
+            Cur_Lines.HEADERDESC
         );
       END IF;
 
@@ -288,7 +290,7 @@
           v_COrderLine_ID,v_Client_ID, p_Org_ID,'Y',
           now(), v_User_ID, now(), v_User_ID,
           v_C_Order_ID, v_Line, Cur_Lines.Vendor_ID, v_BPartner_Location_ID,
-          p_OrderDate, Cur_Lines.NEEDBYDATE, Cur_Lines.SUPPLIERNOTES, 
Cur_Lines.M_Product_ID,
+          p_OrderDate, Cur_Lines.NEEDBYDATE, 
COALESCE(Cur_Lines.DESCRIPTION,'')||' '||COALESCE(Cur_Lines.SUPPLIERNOTES,''), 
Cur_Lines.M_Product_ID,
           Cur_Lines.M_AttributeSetInstance_ID,
           p_Warehouse_ID, Cur_Lines.C_UOM_ID, Cur_Lines.QTY - 
Cur_Lines.ORDEREDQTY, v_Currency_ID,
           v_PriceList, v_PriceActual, v_PriceLimit,
diff -r df1b95da863f -r 227ef1f50901 
src/org/openbravo/erpCommon/ad_process/ExpenseAPInvoice.java
--- a/src/org/openbravo/erpCommon/ad_process/ExpenseAPInvoice.java      Mon Oct 
17 12:08:47 2016 +0200
+++ b/src/org/openbravo/erpCommon/ad_process/ExpenseAPInvoice.java      Fri Jul 
31 13:38:35 2015 +0530
@@ -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) 2001-2015 Openbravo SLU
+ * All portions are Copyright (C) 2001-2016 Openbravo SLU
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -89,7 +89,6 @@
       String strDatereportFrom, String strDatereportTo, String 
strDateInvoiced) {
     if (expenseAPInvoiceLog4j.isDebugEnabled())
       expenseAPInvoiceLog4j.debug("Save: Expense AP Invoice");
-    int line = 0;
 
     String strcInvoiceId = "";
     String strCCurrencyId = "";
@@ -311,9 +310,6 @@
           qty = new BigDecimal(data[i].qty);
           String strLine = 
ExpenseAPInvoiceData.selectLine(OBDal.getInstance().getConnection(),
               this, strcInvoiceId);
-          if (strLine.equals(""))
-            strLine = "10";
-          line += Integer.valueOf(strLine);
 
           if (expenseAPInvoiceLog4j.isDebugEnabled())
             expenseAPInvoiceLog4j.debug("*****************+client: "
@@ -337,7 +333,7 @@
           try {
             int stdPrecision = Integer.parseInt(strStdPrecision);
             
ExpenseAPInvoiceData.insertLine(OBDal.getInstance().getConnection(), this,
-                data[i].adClientId, data[i].adOrgId, strcInvoiceId, "", 
String.valueOf(line), "",
+                data[i].adClientId, data[i].adOrgId, strcInvoiceId, "", 
strLine, "",
                 data[i].mProductId, "", data[i].description, "", 
strmProductUomId, String
                     .valueOf(qty), data[i].cUomId, strPricestd, strPricelist, 
strcTaxID,
                 ((new BigDecimal(strPricestd).setScale(stdPrecision, 
BigDecimal.ROUND_HALF_UP))
diff -r df1b95da863f -r 227ef1f50901 
src/org/openbravo/erpCommon/ad_process/ExpenseAPInvoice_data.xsql
--- a/src/org/openbravo/erpCommon/ad_process/ExpenseAPInvoice_data.xsql Mon Oct 
17 12:08:47 2016 +0200
+++ b/src/org/openbravo/erpCommon/ad_process/ExpenseAPInvoice_data.xsql Fri Jul 
31 13:38:35 2015 +0530
@@ -12,7 +12,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) 2001-2012 Openbravo SLU
+ * All portions are Copyright (C) 2001-2016 Openbravo SLU
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -169,7 +169,7 @@
   <SqlMethod name="selectLine" type="preparedStatement" connection="true" 
return="String" default="10">
     <SqlMethodComment>Select for relation</SqlMethodComment>
     <Sql><![CDATA[
-      SELECT MAX(LINE) AS LINE
+      SELECT COALESCE(MAX(Line), 0) + 10 AS LINE
       FROM C_INVOICELINE
       WHERE C_INVOICE_ID = ?
       ]]></Sql>
diff -r df1b95da863f -r 227ef1f50901 
src/org/openbravo/erpCommon/utility/AccDefUtility.java
--- a/src/org/openbravo/erpCommon/utility/AccDefUtility.java    Mon Oct 17 
12:08:47 2016 +0200
+++ b/src/org/openbravo/erpCommon/utility/AccDefUtility.java    Fri Jul 31 
13:38:35 2015 +0530
@@ -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) 2012 Openbravo SLU
+ * All portions are Copyright (C) 2012-2016 Openbravo SLU
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -136,7 +136,9 @@
       Product product = OBDal.getInstance().get(Product.class, productId);
       final String CURRENT_MONTH = "C";
       final String NEXT_MONTH = "N";
-      isSOTRX = invoice.isSalesTransaction();
+      if (invoice != null) {
+        isSOTRX = invoice.isSalesTransaction();
+      }
       if (isSOTRX && product.isDeferredRevenue()) {
         if (CURRENT_MONTH.equals(product.getDefaultPeriod())) {
           startingPeriodId = 
AccDefUtility.getCurrentPeriod(invoice.getAccountingDate(),

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to