fixed issue 22958: m_reserve_stock_manual
authorNaiara Martinez <naiara.martinez@openbravo.com>
Mon, 04 Feb 2013 10:04:41 +0100
changeset 462 65a7b82781da
parent 461 45236b3ac37c
child 463 a587b351afed
fixed issue 22958: m_reserve_stock_manual
java/reference/java.japi.gz
model/src-db/database/model/functions/M_RESERVE_STOCK_MANUAL.xml
Binary file java/reference/java.japi.gz has changed
--- a/model/src-db/database/model/functions/M_RESERVE_STOCK_MANUAL.xml	Tue Jan 29 12:29:22 2013 +0100
+++ b/model/src-db/database/model/functions/M_RESERVE_STOCK_MANUAL.xml	Mon Feb 04 10:04:41 2013 +0100
@@ -16,6 +16,9 @@
       <parameter name="p_user_id" type="VARCHAR" mode="in">
         <default/>
       </parameter>
+      <parameter name="p_allocated" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
       <parameter name="p_reservation_stock_id" type="VARCHAR" mode="out">
         <default/>
       </parameter>
@@ -76,15 +79,15 @@
     FROM m_reservation_stock
     WHERE m_reservation_id = p_reservation_id
       AND m_locator_id = v_locator_id
-      AND m_attributesetinstance_id = v_asi_id
-      AND isallocated = 'N';
+      AND COALESCE(m_attributesetinstance_id, '0') = COALESCE(v_asi_id, '0')
+      AND isallocated = p_allocated;
   ELSIF (p_type_id = 'PO') THEN
     v_poline_id := p_stock_id;
     SELECT max(m_reservation_stock_id) INTO v_aux_rs_id
     FROM m_reservation_stock
     WHERE m_reservation_id = p_reservation_id
       AND c_orderline_id = v_poline_id
-      AND isallocated = 'N';
+      AND isallocated = p_allocated;
   ELSE
     RAISE_APPLICATION_ERROR(-20000, '@UnsupportedReservationType@');
   END IF;
@@ -105,7 +108,7 @@
     v_reservation_stock_id, v_client_id, v_org_id, 'Y',
     now(), p_user_id, now(), p_user_id,
     p_reservation_id, v_asi_id, v_locator_id, v_poline_id,
-    p_qty, 0, 'N'
+    p_qty, 0, p_allocated
   );
 
   p_reservation_stock_id := v_reservation_stock_id;