Fixes issue 32862: "Enable Stock Reservations" preference throws an error
authorDavid Miguelez <david.miguelez@openbravo.com>
Fri, 08 Jun 2018 13:56:01 +0200
changeset 34188 cd3262c908aa
parent 34187 e048d67b76d3
child 34189 30563bebf57c
Fixes issue 32862: "Enable Stock Reservations" preference throws an error
when a Sales Order is booked

If more than one "Enable Stock Reservations" preference is defined, and are specified
to specific users, C_ORDER_POST1 calls AD_GET_PREFERENCE_VALUE function without specify
the user, for this reason function throw an exception explaining that Preference can't be
found.

To fix that, user is specified when the AD_GET_PREFERENCE_VALUE is called.
src-db/database/model/functions/C_ORDER_POST1.xml
--- a/src-db/database/model/functions/C_ORDER_POST1.xml	Fri Jun 08 14:03:19 2018 +0200
+++ b/src-db/database/model/functions/C_ORDER_POST1.xml	Fri Jun 08 13:56:01 2018 +0200
@@ -676,7 +676,7 @@
         FROM ad_preference
         WHERE property = 'StockReservations';
         IF (v_count > 1) THEN
-          v_dummy := AD_GET_PREFERENCE_VALUE('StockReservations', 'Y', v_client_id, v_org_id, NULL, NULL, NULL);
+          v_dummy := AD_GET_PREFERENCE_VALUE('StockReservations', 'Y', v_client_id, v_org_id, v_User, NULL, NULL);
           DBMS_OUTPUT.PUT_LINE('StockReservations preference value: ' || v_dummy);
         ELSIF (v_count = 1) THEN
           UPDATE c_orderline
@@ -1308,7 +1308,7 @@
       WHERE property = 'StockReservations';
       IF (v_count > 0) THEN
         IF (v_count > 1) THEN
-          v_dummy := AD_GET_PREFERENCE_VALUE('StockReservations', 'Y', v_client_id, v_org_id, NULL, NULL, NULL);
+          v_dummy := AD_GET_PREFERENCE_VALUE('StockReservations', 'Y', v_client_id, v_org_id, v_User, NULL, NULL);
           DBMS_OUTPUT.PUT_LINE('StockReservations preference value: ' || v_dummy);
         END IF;
         DECLARE