Related to issue 29982: code review improvements
authorVíctor Martínez Romanos <victor.martinez@openbravo.com>
Wed, 03 Jun 2015 14:24:14 +0200
changeset 26874 6f5bd72a9789
parent 26873 9660c62a65e2
child 26876 167206608f8c
Related to issue 29982: code review improvements

Avoid useless join to M_PRICELIST table to improve performance
Use generic error message
src-db/database/model/functions/C_CHANGEPROJECTSTATUSTOORDER.xml
src-db/database/model/functions/C_GENERATESOFROMPROJECTPHASE.xml
--- a/src-db/database/model/functions/C_CHANGEPROJECTSTATUSTOORDER.xml	Fri May 29 18:13:33 2015 +0530
+++ b/src-db/database/model/functions/C_CHANGEPROJECTSTATUSTOORDER.xml	Wed Jun 03 14:24:14 2015 +0200
@@ -119,7 +119,7 @@
           ELSIF Cur_SO.SALESREP_ID IS NULL THEN
             RAISE_APPLICATION_ERROR(-20000, '@ProjectSalesRepNotFound@');
           ELSIF Cur_SO.M_PRICELIST_ID IS NULL AND Cur_SO.PROJECTCATEGORY='S' THEN
-              RAISE_APPLICATION_ERROR(-20000, '@ThebusinessPartner@'||' '||' @PricelistNotdefined@');
+            RAISE_APPLICATION_ERROR(-20000, '@NoDefaultPriceList@');
           END IF;
           /*Added in order to work with Multiphase Project*/
           IF (Cur_SO.PROJECTCATEGORY is null OR Cur_SO.PROJECTCATEGORY<>'S') THEN
--- a/src-db/database/model/functions/C_GENERATESOFROMPROJECTPHASE.xml	Fri May 29 18:13:33 2015 +0530
+++ b/src-db/database/model/functions/C_GENERATESOFROMPROJECTPHASE.xml	Wed Jun 03 14:24:14 2015 +0200
@@ -75,12 +75,12 @@
       v_ResultStr:='StartLoop';
       FOR Cur_SO IN
         (
-        SELECT P.C_BPARTNER_ID, P.C_BPARTNER_LOCATION_ID, P.M_PRICELIST_ID, PL.NAME AS PRICE_LIST_NAME,
+        SELECT P.C_BPARTNER_ID, P.C_BPARTNER_LOCATION_ID, P.M_PRICELIST_ID,
           P.C_CURRENCY_ID, P.PAYMENTRULE, P.C_PAYMENTTERM_ID, P.M_WAREHOUSE_ID, P.SALESREP_ID,
           P.BILLTO_ID, P.C_CAMPAIGN_ID, P.C_PROJECT_ID, P.AD_USER_ID, P.DESCRIPTION, P.PROJECTSTATUS,
           PP.NAME AS PHASE_NAME, PP.AD_CLIENT_ID, PP.AD_ORG_ID, OI.C_LOCATION_ID AS ORGLOCATIONID,
           P.FIN_PAYMENTMETHOD_ID, P.POREFERENCE
-        FROM C_PROJECT P LEFT JOIN M_PRICELIST PL ON P.M_PRICELIST_ID = PL.M_PRICELIST_ID,
+        FROM C_PROJECT P,
           C_PROJECTPHASE PP,
           AD_ORGINFO OI
         WHERE P.C_PROJECT_ID=PP.C_PROJECT_ID
@@ -100,7 +100,7 @@
         ELSIF Cur_SO.C_PAYMENTTERM_ID IS NULL THEN
           RAISE_APPLICATION_ERROR(-20000, '@ThebusinessPartner@'||' '||' @PaymenttermNotdefined@'||'.');
         ELSIF Cur_SO.M_PRICELIST_ID IS NULL THEN
-          RAISE_APPLICATION_ERROR(-20000, '@ThebusinessPartner@'||' '||' @PricelistNotdefined@'||'.');
+          RAISE_APPLICATION_ERROR(-20000, '@NoDefaultPriceList@');
         ELSIF Cur_SO.C_CURRENCY_ID IS NULL THEN
           RAISE_APPLICATION_ERROR(-20000, '@ProjectCurrencyNotFound@'||'.');
         ELSIF Cur_SO.M_WAREHOUSE_ID IS NULL THEN