From: Greg Pazo Date: Fri, 11 Apr 2014 19:11:13 +0000 (-0400) Subject: Issue #23157:do not create supply order if stocked X-Git-Tag: v4.4.1~34^2 X-Git-Url: http://git.roojs.org/?a=commitdiff_plain;h=3a9793f84b2e560f4ba9bbe9d35434a59f0e415a;p=xtuple Issue #23157:do not create supply order if stocked --- diff --git a/foundation-database/api/functions/insertsalesline.sql b/foundation-database/api/functions/insertsalesline.sql index 5ac4fa702..ea31d1c93 100644 --- a/foundation-database/api/functions/insertsalesline.sql +++ b/foundation-database/api/functions/insertsalesline.sql @@ -1,5 +1,5 @@ CREATE OR REPLACE FUNCTION api.insertSalesLine(api.salesline) RETURNS boolean AS $$ --- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple. +-- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple. -- See www.xtuple.com/CPAL for the full text of the software license. DECLARE pNEW ALIAS FOR $1; @@ -86,14 +86,14 @@ BEGIN 0, pNEW.customer_pn, CASE - WHEN ((pNEW.create_order AND (_r.item_type = 'M')) OR - ((pNEW.create_order IS NULL) AND _r.itemsite_createwo)) THEN + WHEN ((pNEW.create_order AND (_r.item_type = 'M')) OR + ((pNEW.create_order IS NULL) AND _r.itemsite_createwo) AND (NOT _r.itemsite_stocked)) THEN 'W' - WHEN ((pNEW.create_order AND (_r.item_type = 'P')) OR - ((pNEW.create_order IS NULL) AND _r.itemsite_createsopr)) THEN + WHEN ((pNEW.create_order AND (_r.item_type = 'P')) OR + ((pNEW.create_order IS NULL) AND _r.itemsite_createsopr) AND (NOT _r.itemsite_stocked)) THEN 'R' - WHEN ((pNEW.create_order AND (_r.item_type = 'P') AND (_r.itemsite_createsopo)) OR - ((pNEW.create_order IS NULL) AND _r.itemsite_createsopo)) THEN + WHEN ((pNEW.create_order AND (_r.item_type = 'P') AND (_r.itemsite_createsopo)) OR + ((pNEW.create_order IS NULL) AND _r.itemsite_createsopo) AND (NOT _r.itemsite_stocked)) THEN 'P' END, getitemid(pNEW.substitute_for), @@ -106,4 +106,4 @@ BEGIN RETURN TRUE; END; -$$ LANGUAGE 'plpgsql'; +$$ LANGUAGE 'plpgsql'; \ No newline at end of file