details: https://code.openbravo.com/erp/devel/main/rev/176ca49cad72 changeset: 13681:176ca49cad72 user: Iván Perdomo <ivan.perdomo <at> openbravo.com> date: Wed Sep 07 17:28:54 2011 +0200 summary: Fixes issue 18456: Flag the dataSource as shared Flag the dataSource to not get destroyed upon creation
details: https://code.openbravo.com/erp/devel/main/rev/6a6951c29fef changeset: 13682:6a6951c29fef user: Gorka Ion Damián <gorkaion.damian <at> openbravo.com> date: Wed Sep 07 18:20:50 2011 +0200 summary: Fixed issue 18452.Properly manage partially invoiced orders. details: https://code.openbravo.com/erp/devel/main/rev/5aa80e898e21 changeset: 13683:5aa80e898e21 user: Antonio Moreno <antonio.moreno <at> openbravo.com> date: Mon Sep 12 08:52:38 2011 +0200 summary: Fixed issue 18493. All records (not just active ones) will be exported to CSV diffstat: modules/org.openbravo.advpaymentmngt/src-db/database/model/functions/APRM_GEN_PAYMENTSCHEDULE_INV.xml | 40 +++++---- modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DataSourceServlet.java | 2 + modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-widget.js | 4 + 3 files changed, 29 insertions(+), 17 deletions(-) diffs (115 lines): diff -r 38c6ee9ebe71 -r 5aa80e898e21 modules/org.openbravo.advpaymentmngt/src-db/database/model/functions/APRM_GEN_PAYMENTSCHEDULE_INV.xml --- a/modules/org.openbravo.advpaymentmngt/src-db/database/model/functions/APRM_GEN_PAYMENTSCHEDULE_INV.xml Tue Sep 13 11:06:25 2011 +0000 +++ b/modules/org.openbravo.advpaymentmngt/src-db/database/model/functions/APRM_GEN_PAYMENTSCHEDULE_INV.xml Mon Sep 12 08:52:38 2011 +0200 @@ -175,7 +175,6 @@ v_invoicedamount NUMBER; v_notassignedamount NUMBER; v_assignedamount NUMBER; - v_pendingAmountFromOrder NUMBER:=0; v_scheduledetailamount NUMBER; v_oldorder VARCHAR2(32) := '-1'; v_payment_schedule_invoice VARCHAR2(32); @@ -185,6 +184,7 @@ v_ConsumedGranTotal NUMBER:= 0; v_paymentCount NUMBER:= 0; v_negativePS NUMBER:= 1; + v_psdbreakbypartialpayment BOOLEAN:=TRUE; CURSOR cur_order_schdet (invoice_id VARCHAR) IS SELECT DISTINCT c_orderline.c_order_id AS order_id, fin_payment_scheduledetail.amount + COALESCE(fin_payment_scheduledetail.writeoffamt,0) AS amount, @@ -383,27 +383,31 @@ END IF; IF (NOT next_order) THEN v_differenceamount := 0; - --1st condition: split order's payment schedule detail in case that not all the amount has been invoiced. - --2nd condition: invoiced amount is higher than the scheduled amount, calculate the difference and split - --the payment schedule detail of the order. - IF ((v_notassignedamount * v_negativeps <= v_scheduledamount * v_negativePS)) THEN - v_differenceamount := COALESCE(v_scheduledetailamount,0) - COALESCE(v_notassignedamount,0); - ELSIF ((v_scheduledamount * v_negativeps < v_notassignedamount * v_negativePS)) THEN - v_differenceamount := COALESCE(v_scheduledetailamount,0) - COALESCE(v_scheduledamount,0); - END IF; - -- The order is completely invoiced and it is the last payment schedule. All the pending amount of the - -- order has to be assigned to this invoice, a regulation psd only related to this invoice will be - -- generated later to match the difference. + --1st condition: The order is completely invoiced and it is the last payment schedule. All the pending amount of the + -- order has to be assigned to this invoice, a regulation psd only related to this invoice will be + -- generated later to match the difference. + --2st condition: invoiced amount is higher than the scheduled amount, calculate the difference and split + -- the payment schedule detail of the order. + --3rd condition: split order's payment schedule detail in case that not all the amount has been invoiced. + -- In this case difference amount would not be zero. IF(v_Count = 0 AND v_paymentcount = 0) THEN v_differenceamount:= 0; + ELSIF (v_notassignedamount * v_negativePS > v_scheduledamount * v_negativeps ) THEN + v_differenceamount := COALESCE(v_scheduledetailamount,0) - COALESCE(v_scheduledamount,0); + IF (v_paymentcount > 0) THEN + v_psdbreakbypartialpayment := true; + ELSE + v_psdbreakbypartialpayment := false; + END IF; + ELSE + v_differenceamount := COALESCE(v_scheduledetailamount,0) - COALESCE(v_notassignedamount,0); + v_psdbreakbypartialpayment := false; END IF; --When difference amount is not 0 the payment schedule detail of the order has to be split. The difference --amount is the amount of the new psd that is not related to any invoice. IF (v_differenceamount <> 0) THEN - -- continue with the same payment schedule detail - fetch_next_order_item := false; v_new_scheduledetailid := get_uuid(); INSERT INTO fin_payment_scheduledetail ( @@ -431,9 +435,12 @@ WHERE fin_payment_scheduledetail_id = v_scheduledetailid; v_scheduledetailamount := v_scheduledetailamount - v_differenceamount; + END IF; + IF (v_differenceamount = 0 OR (v_count <> 0 AND NOT v_psdbreakbypartialpayment)) THEN + fetch_next_order_item := true; ELSE - fetch_next_order_item := true; + fetch_next_order_item := false; END IF; -- link current current payment schedule detail to the invoice @@ -481,9 +488,8 @@ null, v_payment_schedule_invoice, null, - v_scheduledamount - v_pendingAmountFromOrder + v_scheduledamount ); - v_pendingAmountFromOrder:=0; END IF; END LOOP; diff -r 38c6ee9ebe71 -r 5aa80e898e21 modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DataSourceServlet.java --- a/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DataSourceServlet.java Tue Sep 13 11:06:25 2011 +0000 +++ b/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DataSourceServlet.java Mon Sep 12 08:52:38 2011 +0200 @@ -217,6 +217,8 @@ if (getDataSource(request) instanceof DefaultDataSourceService) { QueryJSONWriterToCSV writer = new QueryJSONWriterToCSV(request, response, parameters, getDataSource(request).getEntity()); + // when exporting a OB grid, the isActive filter should not be set + parameters.put(JsonConstants.NO_ACTIVE_FILTER, "true"); ((DefaultDataSourceService) getDataSource(request)).fetch(parameters, writer); } else { String result = getDataSource(request).fetch(parameters); diff -r 38c6ee9ebe71 -r 5aa80e898e21 modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-widget.js --- a/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-widget.js Tue Sep 13 11:06:25 2011 +0000 +++ b/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-widget.js Mon Sep 12 08:52:38 2011 +0200 @@ -567,6 +567,10 @@ var baseTestRegistryName = 'org.openbravo.userinterface.selector.' + this.openbravoField + '.'; + // Do not destroy dataSource after creation + // https://issues.openbravo.com/view.php?id=18456 + this.dataSource.potentiallyShared = true; + if (this.numCols > 0 && this.numCols <= isc.OBSelectorWidget.styling.widthDefinition.length) { this.width = isc.OBSelectorWidget.styling.widthDefinition[this.numCols - 1]; ------------------------------------------------------------------------------ BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA Learn about the latest advances in developing for the BlackBerry® mobile platform with sessions, labs & more. See new tools and technologies. Register for BlackBerry® DevCon today! http://p.sf.net/sfu/rim-devcon-copy1 _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits