details:   https://code.openbravo.com/erp/devel/pi/rev/12591b3385f8
changeset: 22266:12591b3385f8
user:      Sandra Huguet <sandra.huguet <at> openbravo.com>
date:      Tue Feb 25 17:16:57 2014 +0100
summary:   Fixes bug 23924 c_invoice_create takes long with big amount of data

diffstat:

 src-db/database/model/functions/C_INVOICE_CREATE.xml |  13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diffs (40 lines):

diff -r 20eb3426d990 -r 12591b3385f8 
src-db/database/model/functions/C_INVOICE_CREATE.xml
--- a/src-db/database/model/functions/C_INVOICE_CREATE.xml      Wed Feb 26 
15:15:03 2014 +0100
+++ b/src-db/database/model/functions/C_INVOICE_CREATE.xml      Tue Feb 25 
17:16:57 2014 +0100
@@ -73,6 +73,7 @@
     --
     v_LineNo NUMBER:=0;
     v_count NUMBER:=0;
+    v_isSchedule NUMBER:=0;
     
     v_isdeferredrevenue M_Product.IsDeferredRevenue%TYPE;
     v_revplantype M_Product.RevPlanType%TYPE;
@@ -233,7 +234,7 @@
         * Order Loop == all not completely invoiced orders == No Summary ==
         */
 
-          DBMS_OUTPUT.PUT_LINE('  C_Order_ID=' || v_C_Order_ID || ', 
BPartner_ID=' || v_BPartner_ID || ', AD_Org_ID=' || v_AD_Org_ID) ;
+          DBMS_OUTPUT.PUT_LINE('  C_Order_ID=' || coalesce(v_C_Order_ID, 
'null') || ', BPartner_ID=' || coalesce(v_BPartner_ID, 'null') || ', 
AD_Org_ID=' || coalesce(v_AD_Org_ID, 'null')) ;
           -- For all Orders
           
           FOR Cur_Bpblocked IN(
@@ -799,12 +800,16 @@
               Cur_InOutLine_ISOPEN:=false;
             END IF;
           END LOOP; -- Order Loop
-
+   
+          SELECT count(*) 
+          INTO v_isSchedule
+          FROM DUAL WHERE EXISTS (SELECT 1 FROM C_ORDER WHERE ISSELECTED = 'Y' 
AND INVOICERULE = 'S');
+       
         /**
         * Invoice Schedule 
======================================================
         */
-        IF(p_PInstance_ID IS NOT NULL AND v_C_Order_ID IS NULL) THEN -- Not 
when processing a single order
-          DECLARE
+        IF(p_PInstance_ID IS NOT NULL AND v_C_Order_ID IS NULL AND 
(v_isSchedule > 0 OR v_Selection = 'N')) THEN -- Not when processing a single 
order
+         DECLARE
             -- Invoice Schedule Lines
             Cur_InvoiceSchedule RECORD;
             v_Partner_ID VARCHAR2(32):='-1';

------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to