diff --git a/db/ddlutils/oracle/functions/BOM_PriceLimit.sql b/db/ddlutils/oracle/functions/BOM_PriceLimit.sql index fa1996fd77..37733c93fe 100644 --- a/db/ddlutils/oracle/functions/BOM_PriceLimit.sql +++ b/db/ddlutils/oracle/functions/BOM_PriceLimit.sql @@ -26,8 +26,10 @@ AS FROM M_PRODUCT_BOM b, M_PRODUCT p WHERE b.M_ProductBOM_ID=p.M_Product_ID AND b.M_Product_ID=Product_ID + AND b.M_ProductBOM_ID != Product_ID AND p.IsBOM='Y' - AND p.IsVerified='Y'; + AND p.IsVerified='Y' + AND b.IsActive='Y'; -- BEGIN -- Try to get price from PriceList directly diff --git a/db/ddlutils/oracle/functions/BOM_PriceList.sql b/db/ddlutils/oracle/functions/BOM_PriceList.sql index 0be86221b8..da274c35d8 100644 --- a/db/ddlutils/oracle/functions/BOM_PriceList.sql +++ b/db/ddlutils/oracle/functions/BOM_PriceList.sql @@ -26,8 +26,10 @@ AS FROM M_PRODUCT_BOM b, M_PRODUCT p WHERE b.M_ProductBOM_ID=p.M_Product_ID AND b.M_Product_ID=Product_ID + AND b.M_ProductBOM_ID != Product_ID AND p.IsBOM='Y' - AND p.IsVerified='Y'; + AND p.IsVerified='Y' + AND b.IsActive='Y'; -- BEGIN -- Try to get price from pricelist directly diff --git a/db/ddlutils/oracle/functions/BOM_PriceStd.sql b/db/ddlutils/oracle/functions/BOM_PriceStd.sql index e946334252..eace5db30a 100644 --- a/db/ddlutils/oracle/functions/BOM_PriceStd.sql +++ b/db/ddlutils/oracle/functions/BOM_PriceStd.sql @@ -26,8 +26,10 @@ AS FROM M_PRODUCT_BOM b, M_PRODUCT p WHERE b.M_ProductBOM_ID=p.M_Product_ID AND b.M_Product_ID=Product_ID + AND b.M_ProductBOM_ID != Product_ID AND p.IsBOM='Y' - AND p.IsVerified='Y'; + AND p.IsVerified='Y' + AND b.IsActive='Y'; -- BEGIN -- Try to get price from pricelist directly diff --git a/db/ddlutils/oracle/functions/BOM_Qty_OnHand.sql b/db/ddlutils/oracle/functions/BOM_Qty_OnHand.sql index aee834d042..8234cad33d 100644 --- a/db/ddlutils/oracle/functions/BOM_Qty_OnHand.sql +++ b/db/ddlutils/oracle/functions/BOM_Qty_OnHand.sql @@ -27,8 +27,10 @@ AS FROM M_PRODUCT_BOM b, M_PRODUCT p WHERE b.M_ProductBOM_ID=p.M_Product_ID AND b.M_Product_ID=Product_ID + AND b.M_ProductBOM_ID != Product_ID AND p.IsBOM='Y' - AND p.IsVerified='Y'; + AND p.IsVerified='Y' + AND b.IsActive='Y'; -- BEGIN -- Check Parameters diff --git a/db/ddlutils/oracle/functions/BOM_Qty_Ordered.sql b/db/ddlutils/oracle/functions/BOM_Qty_Ordered.sql index c34b6434be..3fb7ec0651 100644 --- a/db/ddlutils/oracle/functions/BOM_Qty_Ordered.sql +++ b/db/ddlutils/oracle/functions/BOM_Qty_Ordered.sql @@ -27,8 +27,10 @@ AS FROM M_PRODUCT_BOM b, M_PRODUCT p WHERE b.M_ProductBOM_ID=p.M_Product_ID AND b.M_Product_ID=p_Product_ID + AND b.M_ProductBOM_ID != p_Product_ID AND p.IsBOM='Y' - AND p.IsVerified='Y'; + AND p.IsVerified='Y' + AND b.IsActive='Y'; -- BEGIN -- Check Parameters @@ -65,12 +67,13 @@ BEGIN -- Stocked item ELSIF (v_IsStocked='Y') THEN -- Get ProductQty - SELECT NVL(SUM(QtyOrdered), 0) + SELECT NVL(SUM(Qty), 0) INTO v_ProductQty - FROM M_STORAGE s - WHERE M_Product_ID=p_Product_ID - AND EXISTS (SELECT * FROM M_LOCATOR l WHERE s.M_Locator_ID=l.M_Locator_ID - AND l.M_Warehouse_ID=v_Warehouse_ID); + FROM M_StorageReservation + WHERE M_Product_ID=p_Product_ID + AND M_Warehouse_ID=v_Warehouse_ID + AND IsSOTrx='N' + AND IsActive='Y'; -- RETURN v_ProductQty; END IF; @@ -81,12 +84,13 @@ BEGIN -- Stocked Items "leaf node" IF (bom.ProductType = 'I' AND bom.IsStocked = 'Y') THEN -- Get ProductQty - SELECT NVL(SUM(QtyOrdered), 0) + SELECT NVL(SUM(Qty), 0) INTO v_ProductQty - FROM M_STORAGE s - WHERE M_Product_ID=bom.M_ProductBOM_ID - AND EXISTS (SELECT * FROM M_LOCATOR l WHERE s.M_Locator_ID=l.M_Locator_ID - AND l.M_Warehouse_ID=v_Warehouse_ID); + FROM M_StorageReservation + WHERE M_Product_ID=p_Product_ID + AND M_Warehouse_ID=v_Warehouse_ID + AND IsSOTrx='N' + AND IsActive='Y'; -- Get Rounding Precision SELECT NVL(MAX(u.StdPrecision), 0) INTO v_StdPrecision diff --git a/db/ddlutils/oracle/functions/BOM_Qty_Reserved.sql b/db/ddlutils/oracle/functions/BOM_Qty_Reserved.sql index 6921fc37ac..1d07949d8d 100644 --- a/db/ddlutils/oracle/functions/BOM_Qty_Reserved.sql +++ b/db/ddlutils/oracle/functions/BOM_Qty_Reserved.sql @@ -27,8 +27,10 @@ AS FROM M_PRODUCT_BOM b, M_PRODUCT p WHERE b.M_ProductBOM_ID=p.M_Product_ID AND b.M_Product_ID=p_Product_ID + AND b.M_ProductBOM_ID != p_Product_ID AND p.IsBOM='Y' - AND p.IsVerified='Y'; + AND p.IsVerified='Y' + AND b.IsActive='Y'; -- BEGIN -- Check Parameters @@ -65,12 +67,13 @@ BEGIN -- Stocked item ELSIF (v_IsStocked='Y') THEN -- Get ProductQty - SELECT NVL(SUM(QtyReserved), 0) + SELECT NVL(SUM(Qty), 0) INTO v_ProductQty - FROM M_STORAGE s + FROM M_StorageReservation WHERE M_Product_ID=p_Product_ID - AND EXISTS (SELECT * FROM M_LOCATOR l WHERE s.M_Locator_ID=l.M_Locator_ID - AND l.M_Warehouse_ID=v_Warehouse_ID); + AND M_Warehouse_ID=v_Warehouse_ID + AND IsSOTrx='Y' + AND IsActive='Y'; -- RETURN v_ProductQty; END IF; @@ -81,12 +84,13 @@ BEGIN -- Stocked Items "leaf node" IF (bom.ProductType = 'I' AND bom.IsStocked = 'Y') THEN -- Get ProductQty - SELECT NVL(SUM(QtyReserved), 0) + SELECT NVL(SUM(Qty), 0) INTO v_ProductQty - FROM M_STORAGE s - WHERE M_Product_ID=bom.M_ProductBOM_ID - AND EXISTS (SELECT * FROM M_LOCATOR l WHERE s.M_Locator_ID=l.M_Locator_ID - AND l.M_Warehouse_ID=v_Warehouse_ID); + FROM M_StorageReservation + WHERE M_Product_ID=bom.M_ProductBOM_ID + AND M_Warehouse_ID=v_Warehouse_ID + AND IsSOTrx='Y' + AND IsActive='Y'; -- Get Rounding Precision SELECT NVL(MAX(u.StdPrecision), 0) INTO v_StdPrecision diff --git a/db/ddlutils/postgresql/functions/BOM_PriceLimit.sql b/db/ddlutils/postgresql/functions/BOM_PriceLimit.sql index f32ba35945..f9c1b0b4b9 100644 --- a/db/ddlutils/postgresql/functions/BOM_PriceLimit.sql +++ b/db/ddlutils/postgresql/functions/BOM_PriceLimit.sql @@ -19,8 +19,10 @@ BEGIN FROM M_Product_BOM b, M_Product p WHERE b.M_ProductBOM_ID=p.M_Product_ID AND b.M_Product_ID=Product_ID + AND b.M_ProductBOM_ID != Product_ID AND p.IsBOM='Y' AND p.IsVerified='Y' + AND b.IsActive='Y' LOOP v_ProductPrice := bomPriceLimit (bom.M_ProductBOM_ID, PriceList_Version_ID); v_Price := v_Price + (bom.BOMQty * v_ProductPrice); @@ -32,6 +34,6 @@ BEGIN END; $BODY$ -LANGUAGE 'plpgsql' +LANGUAGE 'plpgsql' STABLE ; diff --git a/db/ddlutils/postgresql/functions/BOM_PriceList.sql b/db/ddlutils/postgresql/functions/BOM_PriceList.sql index 58aaef8ec6..8677da115c 100644 --- a/db/ddlutils/postgresql/functions/BOM_PriceList.sql +++ b/db/ddlutils/postgresql/functions/BOM_PriceList.sql @@ -19,8 +19,10 @@ BEGIN FROM M_Product_BOM b, M_Product p WHERE b.M_ProductBOM_ID=p.M_Product_ID AND b.M_Product_ID=Product_ID + AND b.M_ProductBOM_ID != Product_ID AND p.IsBOM='Y' AND p.IsVerified='Y' + AND b.IsActive='Y' LOOP v_ProductPrice := bomPriceList (bom.M_ProductBOM_ID, PriceList_Version_ID); v_Price := v_Price + (bom.BOMQty * v_ProductPrice); @@ -32,6 +34,6 @@ BEGIN END; $BODY$ -LANGUAGE 'plpgsql' +LANGUAGE 'plpgsql' STABLE ; diff --git a/db/ddlutils/postgresql/functions/BOM_PriceStd.sql b/db/ddlutils/postgresql/functions/BOM_PriceStd.sql index a259dccefc..96c3dabf00 100644 --- a/db/ddlutils/postgresql/functions/BOM_PriceStd.sql +++ b/db/ddlutils/postgresql/functions/BOM_PriceStd.sql @@ -19,8 +19,10 @@ BEGIN FROM M_Product_BOM b, M_Product p WHERE b.M_ProductBOM_ID=p.M_Product_ID AND b.M_Product_ID=Product_ID + AND b.M_ProductBOM_ID != Product_ID AND p.IsBOM='Y' AND p.IsVerified='Y' + AND b.IsActive='Y' LOOP v_ProductPrice := bomPriceStd (bom.M_ProductBOM_ID, PriceList_Version_ID); v_Price := v_Price + (bom.BOMQty * v_ProductPrice); @@ -32,6 +34,6 @@ BEGIN END; $BODY$ -LANGUAGE 'plpgsql' +LANGUAGE 'plpgsql' STABLE ; diff --git a/db/ddlutils/postgresql/functions/BOM_Qty_Available.sql b/db/ddlutils/postgresql/functions/BOM_Qty_Available.sql index 19662e14b2..40952ccf98 100644 --- a/db/ddlutils/postgresql/functions/BOM_Qty_Available.sql +++ b/db/ddlutils/postgresql/functions/BOM_Qty_Available.sql @@ -4,6 +4,6 @@ BEGIN RETURN bomQtyOnHand(Product_ID, Warehouse_ID, Locator_ID) - bomQtyReserved(Product_ID, Warehouse_ID, Locator_ID); END; $BODY$ -LANGUAGE 'plpgsql' +LANGUAGE 'plpgsql' STABLE ; diff --git a/db/ddlutils/postgresql/functions/BOM_Qty_OnHand.sql b/db/ddlutils/postgresql/functions/BOM_Qty_OnHand.sql index 9518f30ebe..adeff6ec6f 100644 --- a/db/ddlutils/postgresql/functions/BOM_Qty_OnHand.sql +++ b/db/ddlutils/postgresql/functions/BOM_Qty_OnHand.sql @@ -25,7 +25,6 @@ BEGIN IF (myWarehouse_ID IS NULL) THEN RETURN 0; END IF; --- DBMS_OUTPUT.PUT_LINE(''Warehouse='' || myWarehouse_ID); -- Check, if product exists and if it is stocked BEGIN @@ -51,19 +50,19 @@ BEGIN AND EXISTS (SELECT * FROM M_LOCATOR l WHERE s.M_Locator_ID=l.M_Locator_ID AND l.M_Warehouse_ID=myWarehouse_ID); -- - -- DBMS_OUTPUT.PUT_LINE(''Qty='' || v_ProductQty); RETURN v_ProductQty; END IF; -- Go though BOM --- DBMS_OUTPUT.PUT_LINE(''BOM''); FOR bom IN -- Get BOM Product info SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM, p.IsStocked, p.ProductType FROM M_PRODUCT_BOM b, M_PRODUCT p WHERE b.M_ProductBOM_ID=p.M_Product_ID AND b.M_Product_ID=product_ID + AND b.M_ProductBOM_ID != Product_ID AND p.IsBOM='Y' AND p.IsVerified='Y' + AND b.IsActive='Y' LOOP -- Stocked Items "leaf node" IF (bom.ProductType = 'I' AND bom.IsStocked = 'Y') THEN @@ -107,6 +106,6 @@ BEGIN RETURN 0; END; $BODY$ -LANGUAGE 'plpgsql' +LANGUAGE 'plpgsql' STABLE ; diff --git a/db/ddlutils/postgresql/functions/BOM_Qty_Ordered.sql b/db/ddlutils/postgresql/functions/BOM_Qty_Ordered.sql index d9f8fe49a2..79c0fda12e 100644 --- a/db/ddlutils/postgresql/functions/BOM_Qty_Ordered.sql +++ b/db/ddlutils/postgresql/functions/BOM_Qty_Ordered.sql @@ -24,7 +24,6 @@ BEGIN IF (v_Warehouse_ID IS NULL) THEN RETURN 0; END IF; --- DBMS_OUTPUT.PUT_LINE(''Warehouse='' || v_Warehouse_ID); -- Check, if product exists and if it is stocked BEGIN @@ -44,36 +43,39 @@ BEGIN -- Stocked item ELSIF (v_IsStocked='Y') THEN -- Get ProductQty - SELECT COALESCE(SUM(QtyOrdered), 0) + SELECT COALESCE(SUM(Qty), 0) INTO v_ProductQty - FROM M_STORAGE s - WHERE M_Product_ID=p_Product_ID - AND EXISTS (SELECT * FROM M_LOCATOR l WHERE s.M_Locator_ID=l.M_Locator_ID - AND l.M_Warehouse_ID=v_Warehouse_ID); + FROM M_StorageReservation + WHERE M_Product_ID=p_Product_ID + AND M_Warehouse_ID=v_Warehouse_ID + AND IsSOTrx='N' + AND IsActive='Y'; -- RETURN v_ProductQty; END IF; -- Go though BOM --- DBMS_OUTPUT.PUT_LINE(''BOM''); FOR bom IN -- Get BOM Product info SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM, p.IsStocked, p.ProductType FROM M_PRODUCT_BOM b, M_PRODUCT p WHERE b.M_ProductBOM_ID=p.M_Product_ID AND b.M_Product_ID=p_Product_ID + AND b.M_ProductBOM_ID != p_Product_ID AND p.IsBOM='Y' AND p.IsVerified='Y' + AND b.IsActive='Y' LOOP -- Stocked Items "leaf node" IF (bom.ProductType = 'I' AND bom.IsStocked = 'Y') THEN -- Get ProductQty - SELECT COALESCE(SUM(QtyOrdered), 0) + SELECT COALESCE(SUM(Qty), 0) INTO v_ProductQty - FROM M_STORAGE s - WHERE M_Product_ID=bom.M_ProductBOM_ID - AND EXISTS (SELECT * FROM M_LOCATOR l WHERE s.M_Locator_ID=l.M_Locator_ID - AND l.M_Warehouse_ID=v_Warehouse_ID); + FROM M_StorageReservation + WHERE M_Product_ID=p_Product_ID + AND M_Warehouse_ID=v_Warehouse_ID + AND IsSOTrx='N' + AND IsActive='Y'; -- Get Rounding Precision SELECT COALESCE(MAX(u.StdPrecision), 0) INTO v_StdPrecision @@ -114,6 +116,5 @@ BEGIN RETURN 0; END; $BODY$ -LANGUAGE 'plpgsql' -; + LANGUAGE plpgsql STABLE; diff --git a/db/ddlutils/postgresql/functions/BOM_Qty_Reserved.sql b/db/ddlutils/postgresql/functions/BOM_Qty_Reserved.sql index c4ea21df31..2f2b4f428a 100644 --- a/db/ddlutils/postgresql/functions/BOM_Qty_Reserved.sql +++ b/db/ddlutils/postgresql/functions/BOM_Qty_Reserved.sql @@ -24,7 +24,6 @@ BEGIN IF (v_Warehouse_ID IS NULL) THEN RETURN 0; END IF; --- DBMS_OUTPUT.PUT_LINE(''Warehouse='' || v_Warehouse_ID); -- Check, if product exists and if it is stocked BEGIN @@ -44,36 +43,39 @@ BEGIN -- Stocked item ELSIF (v_IsStocked='Y') THEN -- Get ProductQty - SELECT COALESCE(SUM(QtyReserved), 0) + SELECT COALESCE(SUM(Qty), 0) INTO v_ProductQty - FROM M_STORAGE s + FROM M_StorageReservation WHERE M_Product_ID=p_Product_ID - AND EXISTS (SELECT * FROM M_LOCATOR l WHERE s.M_Locator_ID=l.M_Locator_ID - AND l.M_Warehouse_ID=v_Warehouse_ID); + AND M_Warehouse_ID=v_Warehouse_ID + AND IsSOTrx='Y' + AND IsActive='Y'; -- RETURN v_ProductQty; END IF; -- Go though BOM --- DBMS_OUTPUT.PUT_LINE(''BOM''); FOR bom IN -- Get BOM Product info SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM, p.IsStocked, p.ProductType FROM M_PRODUCT_BOM b, M_PRODUCT p WHERE b.M_ProductBOM_ID=p.M_Product_ID AND b.M_Product_ID=p_Product_ID + AND b.M_ProductBOM_ID != p_Product_ID AND p.IsBOM='Y' AND p.IsVerified='Y' + AND b.IsActive='Y' LOOP -- Stocked Items "leaf node" IF (bom.ProductType = 'I' AND bom.IsStocked = 'Y') THEN -- Get ProductQty - SELECT COALESCE(SUM(QtyReserved), 0) + SELECT COALESCE(SUM(Qty), 0) INTO v_ProductQty - FROM M_STORAGE s + FROM M_StorageReservation WHERE M_Product_ID=bom.M_ProductBOM_ID - AND EXISTS (SELECT * FROM M_LOCATOR l WHERE s.M_Locator_ID=l.M_Locator_ID - AND l.M_Warehouse_ID=v_Warehouse_ID); + AND M_Warehouse_ID =v_Warehouse_ID + AND IsSOTrx='Y' + AND IsActive='Y'; -- Get Rounding Precision SELECT COALESCE(MAX(u.StdPrecision), 0) INTO v_StdPrecision @@ -112,6 +114,6 @@ BEGIN RETURN 0; END; $BODY$ -LANGUAGE 'plpgsql' -; + LANGUAGE plpgsql STABLE; + diff --git a/migration/i2.0/oracle/201404211431_IDEMPIERE-1843.sql b/migration/i2.0/oracle/201404211431_IDEMPIERE-1843.sql new file mode 100644 index 0000000000..eaa6b4b78d --- /dev/null +++ b/migration/i2.0/oracle/201404211431_IDEMPIERE-1843.sql @@ -0,0 +1,15 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Apr 21, 2014 2:30:56 PM CEST +-- IDEMPIERE-1843 +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200271,'8b9721fe-a51a-4d84-8b07-9eff0f3ce158',0,TO_DATE('2014-04-21 14:30:55','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Tabs','I',TO_DATE('2014-04-21 14:30:55','YYYY-MM-DD HH24:MI:SS'),100,'Tabs') +; + +-- Apr 21, 2014 2:31:03 PM CEST +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200272,'b835a2a6-2257-462c-abfb-bfa97e283306',0,TO_DATE('2014-04-21 14:31:02','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Fields','I',TO_DATE('2014-04-21 14:31:02','YYYY-MM-DD HH24:MI:SS'),100,'Fields') +; + + +SELECT register_migration_script('201404211431_IDEMPIERE-1843.sql') FROM dual +; \ No newline at end of file diff --git a/migration/i2.0/oracle/201404290949_Ticket_1003965.sql b/migration/i2.0/oracle/201404290949_Ticket_1003965.sql new file mode 100644 index 0000000000..bd45f413f4 --- /dev/null +++ b/migration/i2.0/oracle/201404290949_Ticket_1003965.sql @@ -0,0 +1,266 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +CREATE OR REPLACE FUNCTION BOMQTYRESERVED +( + p_Product_ID IN NUMBER, + p_Warehouse_ID IN NUMBER, + p_Locator_ID IN NUMBER -- Only used, if warehouse is null +) +RETURN NUMBER +/****************************************************************************** + * ** Compiere Product ** Copyright (c) 1999-2001 Accorto, Inc. USA + * Open Source Software Provided "AS IS" without warranty or liability + * When you use any parts (changed or unchanged), add "Powered by Compiere" to + * your product name; See license details http://www.compiere.org/license.html + ****************************************************************************** + * Return quantity reserved for BOM + */ +AS + v_Warehouse_ID NUMBER; + v_Quantity NUMBER := 99999; -- unlimited + v_IsBOM CHAR(1); + v_IsStocked CHAR(1); + v_ProductType CHAR(1); + v_ProductQty NUMBER; + v_StdPrecision NUMBER; + -- Get BOM Product info + CURSOR CUR_BOM IS + SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM, p.IsStocked, p.ProductType + FROM M_PRODUCT_BOM b, M_PRODUCT p + WHERE b.M_ProductBOM_ID=p.M_Product_ID + AND b.M_Product_ID=p_Product_ID + AND p.IsBOM='Y' + AND p.IsVerified='Y'; + -- +BEGIN + -- Check Parameters + v_Warehouse_ID := p_Warehouse_ID; + IF (v_Warehouse_ID IS NULL) THEN + IF (p_Locator_ID IS NULL) THEN + RETURN 0; + ELSE + SELECT MAX(M_Warehouse_ID) INTO v_Warehouse_ID + FROM M_LOCATOR + WHERE M_Locator_ID=p_Locator_ID; + END IF; + END IF; + IF (v_Warehouse_ID IS NULL) THEN + RETURN 0; + END IF; +-- DBMS_OUTPUT.PUT_LINE('Warehouse=' || v_Warehouse_ID); + + -- Check, if product exists and if it is stocked + BEGIN + SELECT IsBOM, ProductType, IsStocked + INTO v_IsBOM, v_ProductType, v_IsStocked + FROM M_PRODUCT + WHERE M_Product_ID=p_Product_ID; + -- + EXCEPTION -- not found + WHEN OTHERS THEN + RETURN 0; + END; + + -- No reservation for non-stocked + IF (v_IsBOM='N' AND (v_ProductType<>'I' OR v_IsStocked='N')) THEN + RETURN 0; + -- Stocked item + ELSIF (v_IsStocked='Y') THEN + -- Get ProductQty + SELECT NVL(SUM(Qty), 0) + INTO v_ProductQty + FROM M_StorageReservation + WHERE M_Product_ID=p_Product_ID + AND M_Warehouse_ID=v_Warehouse_ID + AND IsSOTrx='Y' + AND IsActive='Y'; + -- + RETURN v_ProductQty; + END IF; + + -- Go though BOM +-- DBMS_OUTPUT.PUT_LINE('BOM'); + FOR bom IN CUR_BOM LOOP + -- Stocked Items "leaf node" + IF (bom.ProductType = 'I' AND bom.IsStocked = 'Y') THEN + -- Get ProductQty + SELECT NVL(SUM(Qty), 0) + INTO v_ProductQty + FROM M_StorageReservation + WHERE M_Product_ID=bom.M_ProductBOM_ID + AND M_Warehouse_ID=v_Warehouse_ID + AND IsSOTrx='Y' + AND IsActive='Y'; + -- Get Rounding Precision + SELECT NVL(MAX(u.StdPrecision), 0) + INTO v_StdPrecision + FROM C_UOM u, M_PRODUCT p + WHERE u.C_UOM_ID=p.C_UOM_ID AND p.M_Product_ID=bom.M_ProductBOM_ID; + -- How much can we make with this product + v_ProductQty := ROUND (v_ProductQty/bom.BOMQty, v_StdPrecision); + -- How much can we make overall + IF (v_ProductQty < v_Quantity) THEN + v_Quantity := v_ProductQty; + END IF; + -- Another BOM + ELSIF (bom.IsBOM = 'Y') THEN + v_ProductQty := Bomqtyreserved (bom.M_ProductBOM_ID, v_Warehouse_ID, p_Locator_ID); + -- How much can we make overall + IF (v_ProductQty < v_Quantity) THEN + v_Quantity := v_ProductQty; + END IF; + END IF; + END LOOP; -- BOM + + -- Unlimited (e.g. only services) + IF (v_Quantity = 99999) THEN + RETURN 0; + END IF; + + IF (v_Quantity > 0) THEN + -- Get Rounding Precision for Product + SELECT NVL(MAX(u.StdPrecision), 0) + INTO v_StdPrecision + FROM C_UOM u, M_PRODUCT p + WHERE u.C_UOM_ID=p.C_UOM_ID AND p.M_Product_ID=p_Product_ID; + -- + RETURN ROUND (v_Quantity, v_StdPrecision); + END IF; + RETURN 0; +END Bomqtyreserved; + +CREATE OR REPLACE FUNCTION BOMQTYORDERED +( + p_Product_ID IN NUMBER, + p_Warehouse_ID IN NUMBER, + p_Locator_ID IN NUMBER -- Only used, if warehouse is null +) +RETURN NUMBER +/****************************************************************************** + * ** Compiere Product ** Copyright (c) 1999-2001 Accorto, Inc. USA + * Open Source Software Provided "AS IS" without warranty or liability + * When you use any parts (changed or unchanged), add "Powered by Compiere" to + * your product name; See license details http://www.compiere.org/license.html + ****************************************************************************** + * Return quantity ordered for BOM + */ +AS + v_Warehouse_ID NUMBER; + v_Quantity NUMBER := 99999; -- unlimited + v_IsBOM CHAR(1); + v_IsStocked CHAR(1); + v_ProductType CHAR(1); + v_ProductQty NUMBER; + v_StdPrecision NUMBER; + -- Get BOM Product info + CURSOR CUR_BOM IS + SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM, p.IsStocked, p.ProductType + FROM M_PRODUCT_BOM b, M_PRODUCT p + WHERE b.M_ProductBOM_ID=p.M_Product_ID + AND b.M_Product_ID=p_Product_ID + AND p.IsBOM='Y' + AND p.IsVerified='Y'; + -- +BEGIN + -- Check Parameters + v_Warehouse_ID := p_Warehouse_ID; + IF (v_Warehouse_ID IS NULL) THEN + IF (p_Locator_ID IS NULL) THEN + RETURN 0; + ELSE + SELECT MAX(M_Warehouse_ID) INTO v_Warehouse_ID + FROM M_LOCATOR + WHERE M_Locator_ID=p_Locator_ID; + END IF; + END IF; + IF (v_Warehouse_ID IS NULL) THEN + RETURN 0; + END IF; +-- DBMS_OUTPUT.PUT_LINE('Warehouse=' || v_Warehouse_ID); + + -- Check, if product exists and if it is stocked + BEGIN + SELECT IsBOM, ProductType, IsStocked + INTO v_IsBOM, v_ProductType, v_IsStocked + FROM M_PRODUCT + WHERE M_Product_ID=p_Product_ID; + -- + EXCEPTION -- not found + WHEN OTHERS THEN + RETURN 0; + END; + + -- No reservation for non-stocked + IF (v_IsBOM='N' AND (v_ProductType<>'I' OR v_IsStocked='N')) THEN + RETURN 0; + -- Stocked item + ELSIF (v_IsStocked='Y') THEN + -- Get ProductQty + SELECT NVL(SUM(Qty), 0) + INTO v_ProductQty + FROM M_StorageReservation + WHERE M_Product_ID=p_Product_ID + AND M_Warehouse_ID=v_Warehouse_ID + AND IsSOTrx='N' + AND IsActive='Y'; + -- + RETURN v_ProductQty; + END IF; + + -- Go though BOM +-- DBMS_OUTPUT.PUT_LINE('BOM'); + FOR bom IN CUR_BOM LOOP + -- Stocked Items "leaf node" + IF (bom.ProductType = 'I' AND bom.IsStocked = 'Y') THEN + -- Get ProductQty + SELECT NVL(SUM(Qty), 0) + INTO v_ProductQty + FROM M_StorageReservation + WHERE M_Product_ID=p_Product_ID + AND M_Warehouse_ID=v_Warehouse_ID + AND IsSOTrx='N' + AND IsActive='Y'; + -- Get Rounding Precision + SELECT NVL(MAX(u.StdPrecision), 0) + INTO v_StdPrecision + FROM C_UOM u, M_PRODUCT p + WHERE u.C_UOM_ID=p.C_UOM_ID AND p.M_Product_ID=bom.M_ProductBOM_ID; + -- How much can we make with this product + v_ProductQty := ROUND (v_ProductQty/bom.BOMQty, v_StdPrecision); + -- How much can we make overall + IF (v_ProductQty < v_Quantity) THEN + v_Quantity := v_ProductQty; + END IF; + -- Another BOM + ELSIF (bom.IsBOM = 'Y') THEN + v_ProductQty := Bomqtyordered (bom.M_ProductBOM_ID, v_Warehouse_ID, p_Locator_ID); + -- How much can we make overall + IF (v_ProductQty < v_Quantity) THEN + v_Quantity := v_ProductQty; + END IF; + END IF; + END LOOP; -- BOM + + -- Unlimited (e.g. only services) + IF (v_Quantity = 99999) THEN + RETURN 0; + END IF; + + IF (v_Quantity > 0) THEN + -- Get Rounding Precision for Product + SELECT NVL(MAX(u.StdPrecision), 0) + INTO v_StdPrecision + FROM C_UOM u, M_PRODUCT p + WHERE u.C_UOM_ID=p.C_UOM_ID AND p.M_Product_ID=p_Product_ID; + -- + RETURN ROUND (v_Quantity, v_StdPrecision); + END IF; + -- + RETURN 0; +END Bomqtyordered; +/ + +SELECT register_migration_script('201404290949_Ticket_1003965.sql') FROM dual +; + diff --git a/migration/i2.0/oracle/201405021009_IDEMPIERE-709.sql b/migration/i2.0/oracle/201405021009_IDEMPIERE-709.sql new file mode 100644 index 0000000000..a0c608b303 --- /dev/null +++ b/migration/i2.0/oracle/201405021009_IDEMPIERE-709.sql @@ -0,0 +1,4 @@ +-- just for postgresql + +SELECT register_migration_script('201405021009_IDEMPIERE-709.sql') FROM dual +; diff --git a/migration/i2.0/oracle/201405072159_IDEMPIERE-1898.sql b/migration/i2.0/oracle/201405072159_IDEMPIERE-1898.sql new file mode 100644 index 0000000000..9bfb4aa0a5 --- /dev/null +++ b/migration/i2.0/oracle/201405072159_IDEMPIERE-1898.sql @@ -0,0 +1,215 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- May 7, 2014 9:40:51 PM COT +-- IDEMPIERE-1898 create UUID fields +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',351,36,'N','N','Y',202883,'N','AD_Role_OrgAccess_UU','a88ba358-1488-44eb-8574-b70e053ab4b8','N','N',100,100,TO_DATE('2014-05-07 21:40:50','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60491,'D',0,TO_DATE('2014-05-07 21:40:50','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:41:06 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',120,36,'N','N','Y',202884,'N','AD_User_Roles_UU','21b33e6f-784d-427e-b111-e7c73d265b17','N','N',100,100,TO_DATE('2014-05-07 21:41:05','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60536,'D',0,TO_DATE('2014-05-07 21:41:05','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:41:12 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',304,36,'N','N','Y',202885,'N','AD_Window_Access_UU','0e891526-fa44-4f90-82ba-480720971b26','N','N',100,100,TO_DATE('2014-05-07 21:41:12','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60552,'D',0,TO_DATE('2014-05-07 21:41:12','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:41:20 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',305,36,'N','N','Y',202886,'N','AD_Process_Access_UU','66487022-11cc-4e18-97ec-7352fc3ee44c','N','N',100,100,TO_DATE('2014-05-07 21:41:19','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60469,'D',0,TO_DATE('2014-05-07 21:41:19','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:41:29 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',306,36,'N','N','Y',202887,'N','AD_Form_Access_UU','06512e4f-a8ea-4af1-9ea7-640e7f3497e8','N','N',100,100,TO_DATE('2014-05-07 21:41:28','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60415,'D',0,TO_DATE('2014-05-07 21:41:28','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:42:34 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',307,36,'N','N','Y',202888,'N','AD_Workflow_Access_UU','345d6423-bf73-47c9-a2e5-247d07c8ab17','N','N',100,100,TO_DATE('2014-05-07 21:42:33','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60558,'D',0,TO_DATE('2014-05-07 21:42:33','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:42:43 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',313,36,'N','N','Y',202889,'N','AD_Task_Access_UU','217ec930-1d2d-402f-97a7-b3ff8e1baa3d','N','N',100,100,TO_DATE('2014-05-07 21:42:43','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60511,'D',0,TO_DATE('2014-05-07 21:42:43','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:42:51 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',53013,36,'N','N','Y',202890,'N','AD_Document_Action_Access_UU','b53eff36-b689-4b00-8141-c570e05e5284','N','N',100,100,TO_DATE('2014-05-07 21:42:50','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60394,'D',0,TO_DATE('2014-05-07 21:42:50','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:43:06 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',53240,36,'N','N','Y',202891,'N','AD_Role_Included_UU','2119bea8-2cce-4976-ab35-a6cdebd11eb2','N','N',100,100,TO_DATE('2014-05-07 21:43:05','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60490,'D',0,TO_DATE('2014-05-07 21:43:05','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:43:31 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',482,36,'N','N','Y',202892,'N','AD_Table_Access_UU','22bf31a5-217e-4ac5-a85a-f285430e11ef','N','N',100,100,TO_DATE('2014-05-07 21:43:30','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60506,'D',0,TO_DATE('2014-05-07 21:43:30','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:43:39 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',484,36,'N','N','Y',202893,'N','AD_Column_Access_UU','6755c5b6-ba10-4e24-9191-8bc7e7452a62','N','N',100,100,TO_DATE('2014-05-07 21:43:38','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60389,'D',0,TO_DATE('2014-05-07 21:43:38','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:44:13 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',590,36,'N','N','Y',202894,'N','AD_Scheduler_Para_UU','9442e32f-7467-4131-9681-c962997dd95f','N','N',100,100,TO_DATE('2014-05-07 21:44:13','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60495,'D',0,TO_DATE('2014-05-07 21:44:13','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:45:41 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',439,36,'N','N','Y',202895,'N','R_ContactInterest_UU','a577780e-621b-4e34-bf53-d12648555ecc','N','N',100,100,TO_DATE('2014-05-07 21:45:40','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,61010,'D',0,TO_DATE('2014-05-07 21:45:40','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:45:59 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',53177,36,'N','N','Y',202896,'N','C_ChargeType_DocType_UU','2df4c394-fd4b-4cfb-952c-2e06f5d08783','N','N',100,100,TO_DATE('2014-05-07 21:45:59','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60630,'D',0,TO_DATE('2014-05-07 21:45:59','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:46:35 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',200001,36,'N','N','Y',202897,'N','AD_Sequence_No_UU','0c8e6cd9-c335-4a04-b61d-22faed1739bf','N','N',100,100,TO_DATE('2014-05-07 21:46:35','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60500,'D',0,TO_DATE('2014-05-07 21:46:35','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:47:02 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',309,36,'N','N','Y',202898,'N','AD_Form_Access_UU','606dafc8-f3d6-4aac-9601-b1c86088124b','N','N',100,100,TO_DATE('2014-05-07 21:47:01','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60415,'D',0,TO_DATE('2014-05-07 21:47:01','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:47:21 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',536,36,'N','N','Y',202899,'N','R_ContactInterest_UU','6ee6fd8a-ceba-403a-833c-219cfde22b35','N','N',100,100,TO_DATE('2014-05-07 21:47:20','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,61010,'D',0,TO_DATE('2014-05-07 21:47:20','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:47:42 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',192,36,'N','N','Y',202900,'N','M_ProductPrice_UU','ddb323b8-c728-40ac-969d-16deb8953f2d','N','N',100,100,TO_DATE('2014-05-07 21:47:42','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60934,'D',0,TO_DATE('2014-05-07 21:47:42','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:48:11 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',420,36,'N','N','Y',202901,'N','M_ProductPrice_UU','27f3011a-7f69-4d73-99cd-81355dde5794','N','N',100,100,TO_DATE('2014-05-07 21:48:11','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60934,'D',0,TO_DATE('2014-05-07 21:48:11','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:48:50 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',53161,36,'N','N','Y',202902,'N','A_Asset_Info_Oth_UU','a25bf366-a062-4c05-909f-c29cedb2061f','N','N',100,100,TO_DATE('2014-05-07 21:48:50','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60363,'D',0,TO_DATE('2014-05-07 21:48:50','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:49:19 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',467,36,'N','N','Y',202903,'N','M_AttributeUse_UU','9a347678-6e45-4e2e-bb3c-80f943984c2f','N','N',100,100,TO_DATE('2014-05-07 21:49:19','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60870,'D',0,TO_DATE('2014-05-07 21:49:19','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:49:40 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',820,36,'N','N','Y',202904,'N','CM_ChatTypeUpdate_UU','b4874c7e-9da5-417a-93e0-ba18381ee74f','N','N',100,100,TO_DATE('2014-05-07 21:49:40','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60689,'D',0,TO_DATE('2014-05-07 21:49:40','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:50:03 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',310,36,'N','N','Y',202905,'N','AD_Task_Access_UU','6482ccd1-0668-486e-b917-e427ecc909cc','N','N',100,100,TO_DATE('2014-05-07 21:50:03','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60511,'D',0,TO_DATE('2014-05-07 21:50:03','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:50:26 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',121,36,'N','N','Y',202906,'N','AD_User_Roles_UU','b667a771-b8c8-4e68-8246-5fbc4d770742','N','N',100,100,TO_DATE('2014-05-07 21:50:25','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60536,'D',0,TO_DATE('2014-05-07 21:50:25','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:50:40 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',696,36,'N','N','Y',202907,'N','AD_User_OrgAccess_UU','bcd9d0b3-5164-40e7-b0bf-9cac34e6575b','N','N',100,100,TO_DATE('2014-05-07 21:50:40','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60534,'D',0,TO_DATE('2014-05-07 21:50:40','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:51:06 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',311,36,'N','N','Y',202908,'N','AD_Window_Access_UU','e5f5cc54-3e86-485c-bd8d-2fae8ce889bb','N','N',100,100,TO_DATE('2014-05-07 21:51:06','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60552,'D',0,TO_DATE('2014-05-07 21:51:06','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:51:24 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',312,36,'N','N','Y',202909,'N','AD_Workflow_Access_UU','c12a082c-0e8a-48d4-a9cf-edd1d79c9783','N','N',100,100,TO_DATE('2014-05-07 21:51:24','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60558,'D',0,TO_DATE('2014-05-07 21:51:24','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:51:45 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',53191,36,'N','N','Y',202910,'N','WS_WebServiceTypeAccess_UU','120bdf05-45e4-4107-aa8b-e8c905a3ad1d','N','N',100,100,TO_DATE('2014-05-07 21:51:45','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,202050,'D',0,TO_DATE('2014-05-07 21:51:45','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:52:05 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,SeqNoGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',747,1,'N','N',100,'Y',202911,'N','The Locator indicates where in a Warehouse a product is located.','Warehouse Locator','Locator','727a2b7a-2e3e-474c-98df-2a8c562daa5e','Y','N',100,100,TO_DATE('2014-05-07 21:52:04','YYYY-MM-DD HH24:MI:SS'),'Y','Y',100,0,2,56518,'D',0,TO_DATE('2014-05-07 21:52:04','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:52:05 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',747,36,'N','N','Y',202912,'N','M_Replenish_UU','622b3637-6fbf-4fb7-9f45-3c30bd099d98','N','N',100,100,TO_DATE('2014-05-07 21:52:05','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60945,'D',0,TO_DATE('2014-05-07 21:52:05','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:52:05 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,SeqNoGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',747,10,'N','N',110,'Y',202913,'N','Qty Batch Size','d6530947-c64a-4a36-bf30-dffa5409c792','Y','N',100,100,TO_DATE('2014-05-07 21:52:05','YYYY-MM-DD HH24:MI:SS'),'Y','Y',110,0,2,200241,'D',0,TO_DATE('2014-05-07 21:52:05','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:52:18 PM COT +UPDATE AD_Field SET SeqNo=0,IsDisplayed='N' WHERE AD_Field_ID=202913 +; + +-- May 7, 2014 9:52:47 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',823,36,'N','N','Y',202914,'N','CM_ChatUpdate_UU','080bcda6-6be6-46d4-a36c-2955f7c74ff3','N','N',100,100,TO_DATE('2014-05-07 21:52:46','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60690,'D',0,TO_DATE('2014-05-07 21:52:46','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:53:07 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',718,36,'N','N','Y',202915,'N','R_RequestTypeUpdates_UU','0f9acbf6-9bbd-45bb-8f0b-f65edf9d632c','N','N',100,100,TO_DATE('2014-05-07 21:53:07','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,61028,'D',0,TO_DATE('2014-05-07 21:53:07','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:53:22 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',421,36,'N','N','Y',202916,'N','M_ProductPrice_UU','ac3db1cd-1b19-4283-822f-936d3acb0c4e','N','N',100,100,TO_DATE('2014-05-07 21:53:22','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60934,'D',0,TO_DATE('2014-05-07 21:53:22','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:53:41 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',716,36,'N','N','Y',202917,'N','R_GroupUpdates_UU','565fe768-df71-489d-b3f5-af364e6b0a58','N','N',100,100,TO_DATE('2014-05-07 21:53:40','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,61012,'D',0,TO_DATE('2014-05-07 21:53:40','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:53:58 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',715,36,'N','N','Y',202918,'N','R_CategoryUpdates_UU','abe8450b-1aca-4123-bc79-67e7ef8c2dcd','N','N',100,100,TO_DATE('2014-05-07 21:53:58','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,61009,'D',0,TO_DATE('2014-05-07 21:53:58','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:54:18 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',714,36,'N','N','Y',202919,'N','R_RequestUpdates_UU','42a4abeb-c012-4070-a902-600e47256b6e','N','N',100,100,TO_DATE('2014-05-07 21:54:17','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,61030,'D',0,TO_DATE('2014-05-07 21:54:17','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:54:29 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',719,36,'N','N','Y',202920,'N','R_RequestUpdates_UU','956d8096-6d8e-44eb-a771-f23382cfb822','N','N',100,100,TO_DATE('2014-05-07 21:54:29','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,61030,'D',0,TO_DATE('2014-05-07 21:54:29','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:54:55 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',308,36,'N','N','Y',202921,'N','AD_Process_Access_UU','502ccb34-91ca-4c98-be9d-adea66d983d4','N','N',100,100,TO_DATE('2014-05-07 21:54:55','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60469,'D',0,TO_DATE('2014-05-07 21:54:55','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:55:17 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',278,36,'N','N','Y',202922,'N','M_Product_PO_UU','d78530d4-efeb-4bb9-99d5-c11b5b528472','N','N',100,100,TO_DATE('2014-05-07 21:55:17','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60933,'D',0,TO_DATE('2014-05-07 21:55:17','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:55:44 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',359,36,'N','N','Y',202923,'N','C_CyclePhase_UU','1f501721-cc63-4c61-a371-9e16e593654e','N','N',100,100,TO_DATE('2014-05-07 21:55:43','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60645,'D',0,TO_DATE('2014-05-07 21:55:43','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:56:08 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',701,36,'N','N','Y',202924,'N','M_Cost_UU','7bca81aa-335f-43fa-aa4e-5c1023ef1bc0','N','N',100,100,TO_DATE('2014-05-07 21:56:07','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60877,'D',0,TO_DATE('2014-05-07 21:56:07','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:56:28 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',585,36,'N','N','Y',202925,'N','A_RegistrationValue_UU','1aaa5a63-10df-47dd-85f5-407f772a4a2e','N','N',100,100,TO_DATE('2014-05-07 21:56:28','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60565,'D',0,TO_DATE('2014-05-07 21:56:28','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:56:43 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',650,36,'N','N','Y',202926,'N','A_RegistrationProduct_UU','8281b68c-9b65-4df8-8b1e-f4efb0b5146f','N','N',100,100,TO_DATE('2014-05-07 21:56:42','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60564,'D',0,TO_DATE('2014-05-07 21:56:42','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:57:08 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',181,36,'N','N','Y',202927,'N','M_Substitute_UU','e45630f8-1dba-4a22-8e0b-b30a151fac02','N','N',100,100,TO_DATE('2014-05-07 21:57:08','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60955,'D',0,TO_DATE('2014-05-07 21:57:08','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:57:18 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',630,36,'N','N','Y',202928,'N','M_RelatedProduct_UU','957cd9ae-3c2c-427b-bcae-d23b38d3f302','N','N',100,100,TO_DATE('2014-05-07 21:57:18','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60944,'D',0,TO_DATE('2014-05-07 21:57:18','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:57:27 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',182,36,'N','N','Y',202929,'N','M_Replenish_UU','67b14545-5e7a-4fc7-84da-cd041e905ac3','N','N',100,100,TO_DATE('2014-05-07 21:57:26','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60945,'D',0,TO_DATE('2014-05-07 21:57:26','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:57:36 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',239,36,'N','N','Y',202930,'N','M_Product_PO_UU','eab74338-7655-4e9d-a0e4-a103c4b14d20','N','N',100,100,TO_DATE('2014-05-07 21:57:35','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60933,'D',0,TO_DATE('2014-05-07 21:57:35','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:57:45 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',562,36,'N','N','Y',202931,'N','C_BPartner_Product_UU','fa25d761-b2b3-4892-aa33-9c2a31b31fa8','N','N',100,100,TO_DATE('2014-05-07 21:57:44','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60607,'D',0,TO_DATE('2014-05-07 21:57:44','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:57:53 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',183,36,'N','N','Y',202932,'N','M_ProductPrice_UU','5dd20e74-c9be-4759-8755-7d9688a83a7a','N','N',100,100,TO_DATE('2014-05-07 21:57:53','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60934,'D',0,TO_DATE('2014-05-07 21:57:53','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:58:16 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',53289,36,'N','N','Y',202933,'N','M_Cost_UU','54e5c4c4-c0b0-4233-8bc9-53dc475f8225','N','N',100,100,TO_DATE('2014-05-07 21:58:16','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60877,'D',0,TO_DATE('2014-05-07 21:58:16','YYYY-MM-DD HH24:MI:SS')) +; + +SELECT register_migration_script('201405072159_IDEMPIERE-1898.sql') FROM dual +; + diff --git a/migration/i2.0/oracle/201405160521_IDEMPIERE-1953.sql b/migration/i2.0/oracle/201405160521_IDEMPIERE-1953.sql new file mode 100644 index 0000000000..1611acbf7a --- /dev/null +++ b/migration/i2.0/oracle/201405160521_IDEMPIERE-1953.sql @@ -0,0 +1,556 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +CREATE OR REPLACE FUNCTION BOMPRICELIMIT +( + Product_ID IN NUMBER, + PriceList_Version_ID IN NUMBER +) +RETURN NUMBER +/************************************************************************* + * The contents of this file are subject to the Compiere License. You may + * obtain a copy of the License at http://www.compiere.org/license.html + * Software is on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either + * express or implied. See the License for details. Code: Compiere ERP+CRM + * Copyright (C) 1999-2002 Jorg Janke, ComPiere, Inc. All Rights Reserved. + ************************************************************************* + * $Id: BOM_PriceLimit.sql,v 1.1 2006/04/21 17:51:58 jjanke Exp $ + *** + * Title: Return Limit Price of Product/BOM + * Description: + * if not found: 0 + ************************************************************************/ +AS + v_Price NUMBER; + v_ProductPrice NUMBER; + -- Get BOM Product info + CURSOR CUR_BOM IS + SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM + FROM M_PRODUCT_BOM b, M_PRODUCT p + WHERE b.M_ProductBOM_ID=p.M_Product_ID + AND b.M_Product_ID=Product_ID + AND b.M_ProductBOM_ID != Product_ID + AND p.IsBOM='Y' + AND p.IsVerified='Y' + AND b.IsActive='Y'; + -- +BEGIN + -- Try to get price from PriceList directly + SELECT COALESCE (SUM(PriceLimit), 0) + INTO v_Price + FROM M_PRODUCTPRICE + WHERE M_PriceList_Version_ID=PriceList_Version_ID AND M_Product_ID=Product_ID; +-- DBMS_OUTPUT.PUT_LINE('Price=' || v_Price); + + -- No Price - Check if BOM + IF (v_Price = 0) THEN + FOR bom IN CUR_BOM LOOP + v_ProductPrice := Bompricelimit (bom.M_ProductBOM_ID, PriceList_Version_ID); + v_Price := v_Price + (bom.BOMQty * v_ProductPrice); + END LOOP; + END IF; + -- + RETURN v_Price; +END Bompricelimit; +/ + +CREATE OR REPLACE FUNCTION BOMPRICELIST +( + Product_ID IN NUMBER, + PriceList_Version_ID IN NUMBER +) +RETURN NUMBER +/************************************************************************* + * The contents of this file are subject to the Compiere License. You may + * obtain a copy of the License at http://www.compiere.org/license.html + * Software is on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either + * express or implied. See the License for details. Code: Compiere ERP+CRM + * Copyright (C) 1999-2002 Jorg Janke, ComPiere, Inc. All Rights Reserved. + ************************************************************************* + * $Id: BOM_PriceList.sql,v 1.1 2006/04/21 17:51:58 jjanke Exp $ + *** + * Title: Return List Price of Product/BOM + * Description: + * if not found: 0 + ************************************************************************/ +AS + v_Price NUMBER; + v_ProductPrice NUMBER; + -- Get BOM Product info + CURSOR CUR_BOM IS + SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM + FROM M_PRODUCT_BOM b, M_PRODUCT p + WHERE b.M_ProductBOM_ID=p.M_Product_ID + AND b.M_Product_ID=Product_ID + AND b.M_ProductBOM_ID != Product_ID + AND p.IsBOM='Y' + AND p.IsVerified='Y' + AND b.IsActive='Y'; + -- +BEGIN + -- Try to get price from pricelist directly + SELECT COALESCE (SUM(PriceList), 0) + INTO v_Price + FROM M_PRODUCTPRICE + WHERE M_PriceList_Version_ID=PriceList_Version_ID AND M_Product_ID=Product_ID; +-- DBMS_OUTPUT.PUT_LINE('Price=' || Price); + + -- No Price - Check if BOM + IF (v_Price = 0) THEN + FOR bom IN CUR_BOM LOOP + v_ProductPrice := Bompricelist (bom.M_ProductBOM_ID, PriceList_Version_ID); + v_Price := v_Price + (bom.BOMQty * v_ProductPrice); + -- DBMS_OUTPUT.PUT_LINE('Qry=' || bom.BOMQty || ' @ ' || v_ProductPrice || ', Price=' || v_Price); + END LOOP; -- BOM + END IF; + -- + RETURN v_Price; +END Bompricelist; +/ + +CREATE OR REPLACE FUNCTION BOMPRICESTD +( + Product_ID IN NUMBER, + PriceList_Version_ID IN NUMBER +) +RETURN NUMBER +/************************************************************************* + * The contents of this file are subject to the Compiere License. You may + * obtain a copy of the License at http://www.compiere.org/license.html + * Software is on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either + * express or implied. See the License for details. Code: Compiere ERP+CRM + * Copyright (C) 1999-2002 Jorg Janke, ComPiere, Inc. All Rights Reserved. + ************************************************************************* + * $Id: BOM_PriceStd.sql,v 1.1 2006/04/21 17:51:58 jjanke Exp $ + *** + * Title: Return Standard Price of Product/BOM + * Description: + * if not found: 0 + ************************************************************************/ +AS + v_Price NUMBER; + v_ProductPrice NUMBER; + -- Get BOM Product info + CURSOR CUR_BOM IS + SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM + FROM M_PRODUCT_BOM b, M_PRODUCT p + WHERE b.M_ProductBOM_ID=p.M_Product_ID + AND b.M_Product_ID=Product_ID + AND b.M_ProductBOM_ID != Product_ID + AND p.IsBOM='Y' + AND p.IsVerified='Y' + AND b.IsActive='Y'; + -- +BEGIN + -- Try to get price from pricelist directly + SELECT COALESCE(SUM(PriceStd), 0) + INTO v_Price + FROM M_PRODUCTPRICE + WHERE M_PriceList_Version_ID=PriceList_Version_ID AND M_Product_ID=Product_ID; +-- DBMS_OUTPUT.PUT_LINE('Price=' || v_Price); + + -- No Price - Check if BOM + IF (v_Price = 0) THEN + FOR bom IN CUR_BOM LOOP + v_ProductPrice := Bompricestd (bom.M_ProductBOM_ID, PriceList_Version_ID); + v_Price := v_Price + (bom.BOMQty * v_ProductPrice); + -- DBMS_OUTPUT.PUT_LINE('Price=' || v_Price); + END LOOP; -- BOM + END IF; + -- + RETURN v_Price; +END Bompricestd; +/ + +CREATE OR REPLACE FUNCTION BOMQTYONHAND +( + Product_ID IN NUMBER, + Warehouse_ID IN NUMBER, + Locator_ID IN NUMBER -- Only used, if warehouse is null +) +RETURN NUMBER +/****************************************************************************** + * ** Compiere Product ** Copyright (c) 1999-2001 Accorto, Inc. USA + * Open Source Software Provided "AS IS" without warranty or liability + * When you use any parts (changed or unchanged), add "Powered by Compiere" to + * your product name; See license details http://www.compiere.org/license.html + ****************************************************************************** + * Return quantity on hand for BOM + */ +AS + myWarehouse_ID NUMBER; + Quantity NUMBER := 99999; -- unlimited + IsBOM CHAR(1); + IsStocked CHAR(1); + ProductType CHAR(1); + ProductQty NUMBER; + StdPrecision NUMBER; + -- Get BOM Product info + CURSOR CUR_BOM IS + SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM, p.IsStocked, p.ProductType + FROM M_PRODUCT_BOM b, M_PRODUCT p + WHERE b.M_ProductBOM_ID=p.M_Product_ID + AND b.M_Product_ID=Product_ID + AND b.M_ProductBOM_ID != Product_ID + AND p.IsBOM='Y' + AND p.IsVerified='Y' + AND b.IsActive='Y'; + -- +BEGIN + -- Check Parameters + myWarehouse_ID := Warehouse_ID; + IF (myWarehouse_ID IS NULL) THEN + IF (Locator_ID IS NULL) THEN + RETURN 0; + ELSE + SELECT SUM(M_Warehouse_ID) INTO myWarehouse_ID + FROM M_LOCATOR + WHERE M_Locator_ID=Locator_ID; + END IF; + END IF; + IF (myWarehouse_ID IS NULL) THEN + RETURN 0; + END IF; +-- DBMS_OUTPUT.PUT_LINE('Warehouse=' || myWarehouse_ID); + + -- Check, if product exists and if it is stocked + BEGIN + SELECT IsBOM, ProductType, IsStocked + INTO IsBOM, ProductType, IsStocked + FROM M_PRODUCT + WHERE M_Product_ID=Product_ID; + -- + EXCEPTION -- not found + WHEN OTHERS THEN + RETURN 0; + END; + -- Unimited capacity if no item + IF (IsBOM='N' AND (ProductType<>'I' OR IsStocked='N')) THEN + RETURN Quantity; + -- Stocked item + ELSIF (IsStocked='Y') THEN + -- Get ProductQty + SELECT NVL(SUM(QtyOnHand), 0) + INTO ProductQty + FROM M_STORAGE s + WHERE M_Product_ID=Product_ID + AND EXISTS (SELECT * FROM M_LOCATOR l WHERE s.M_Locator_ID=l.M_Locator_ID + AND l.M_Warehouse_ID=myWarehouse_ID); + -- + -- DBMS_OUTPUT.PUT_LINE('Qty=' || ProductQty); + RETURN ProductQty; + END IF; + + -- Go though BOM +-- DBMS_OUTPUT.PUT_LINE('BOM'); + FOR bom IN CUR_BOM LOOP + -- Stocked Items "leaf node" + IF (bom.ProductType = 'I' AND bom.IsStocked = 'Y') THEN + -- Get ProductQty + SELECT NVL(SUM(QtyOnHand), 0) + INTO ProductQty + FROM M_STORAGE s + WHERE M_Product_ID=bom.M_ProductBOM_ID + AND EXISTS (SELECT * FROM M_LOCATOR l WHERE s.M_Locator_ID=l.M_Locator_ID + AND l.M_Warehouse_ID=myWarehouse_ID); + -- Get Rounding Precision + SELECT NVL(MAX(u.StdPrecision), 0) + INTO StdPrecision + FROM C_UOM u, M_PRODUCT p + WHERE u.C_UOM_ID=p.C_UOM_ID AND p.M_Product_ID=bom.M_ProductBOM_ID; + -- How much can we make with this product + ProductQty := ROUND (ProductQty/bom.BOMQty, StdPrecision); + -- How much can we make overall + IF (ProductQty < Quantity) THEN + Quantity := ProductQty; + END IF; + -- Another BOM + ELSIF (bom.IsBOM = 'Y') THEN + ProductQty := Bomqtyonhand (bom.M_ProductBOM_ID, myWarehouse_ID, Locator_ID); + -- How much can we make overall + IF (ProductQty < Quantity) THEN + Quantity := ProductQty; + END IF; + END IF; + END LOOP; -- BOM + + IF (Quantity > 0) THEN + -- Get Rounding Precision for Product + SELECT NVL(MAX(u.StdPrecision), 0) + INTO StdPrecision + FROM C_UOM u, M_PRODUCT p + WHERE u.C_UOM_ID=p.C_UOM_ID AND p.M_Product_ID=Product_ID; + -- + RETURN ROUND (Quantity, StdPrecision); + END IF; + RETURN 0; +END Bomqtyonhand; +/ + +CREATE OR REPLACE FUNCTION BOMQTYORDERED +( + p_Product_ID IN NUMBER, + p_Warehouse_ID IN NUMBER, + p_Locator_ID IN NUMBER -- Only used, if warehouse is null +) +RETURN NUMBER +/****************************************************************************** + * ** Compiere Product ** Copyright (c) 1999-2001 Accorto, Inc. USA + * Open Source Software Provided "AS IS" without warranty or liability + * When you use any parts (changed or unchanged), add "Powered by Compiere" to + * your product name; See license details http://www.compiere.org/license.html + ****************************************************************************** + * Return quantity ordered for BOM + */ +AS + v_Warehouse_ID NUMBER; + v_Quantity NUMBER := 99999; -- unlimited + v_IsBOM CHAR(1); + v_IsStocked CHAR(1); + v_ProductType CHAR(1); + v_ProductQty NUMBER; + v_StdPrecision NUMBER; + -- Get BOM Product info + CURSOR CUR_BOM IS + SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM, p.IsStocked, p.ProductType + FROM M_PRODUCT_BOM b, M_PRODUCT p + WHERE b.M_ProductBOM_ID=p.M_Product_ID + AND b.M_Product_ID=p_Product_ID + AND b.M_ProductBOM_ID != p_Product_ID + AND p.IsBOM='Y' + AND p.IsVerified='Y' + AND b.IsActive='Y'; + -- +BEGIN + -- Check Parameters + v_Warehouse_ID := p_Warehouse_ID; + IF (v_Warehouse_ID IS NULL) THEN + IF (p_Locator_ID IS NULL) THEN + RETURN 0; + ELSE + SELECT MAX(M_Warehouse_ID) INTO v_Warehouse_ID + FROM M_LOCATOR + WHERE M_Locator_ID=p_Locator_ID; + END IF; + END IF; + IF (v_Warehouse_ID IS NULL) THEN + RETURN 0; + END IF; +-- DBMS_OUTPUT.PUT_LINE('Warehouse=' || v_Warehouse_ID); + + -- Check, if product exists and if it is stocked + BEGIN + SELECT IsBOM, ProductType, IsStocked + INTO v_IsBOM, v_ProductType, v_IsStocked + FROM M_PRODUCT + WHERE M_Product_ID=p_Product_ID; + -- + EXCEPTION -- not found + WHEN OTHERS THEN + RETURN 0; + END; + + -- No reservation for non-stocked + IF (v_IsBOM='N' AND (v_ProductType<>'I' OR v_IsStocked='N')) THEN + RETURN 0; + -- Stocked item + ELSIF (v_IsStocked='Y') THEN + -- Get ProductQty + SELECT NVL(SUM(Qty), 0) + INTO v_ProductQty + FROM M_StorageReservation + WHERE M_Product_ID=p_Product_ID + AND M_Warehouse_ID=v_Warehouse_ID + AND IsSOTrx='N' + AND IsActive='Y'; + -- + RETURN v_ProductQty; + END IF; + + -- Go though BOM +-- DBMS_OUTPUT.PUT_LINE('BOM'); + FOR bom IN CUR_BOM LOOP + -- Stocked Items "leaf node" + IF (bom.ProductType = 'I' AND bom.IsStocked = 'Y') THEN + -- Get ProductQty + SELECT NVL(SUM(Qty), 0) + INTO v_ProductQty + FROM M_StorageReservation + WHERE M_Product_ID=p_Product_ID + AND M_Warehouse_ID=v_Warehouse_ID + AND IsSOTrx='N' + AND IsActive='Y'; + -- Get Rounding Precision + SELECT NVL(MAX(u.StdPrecision), 0) + INTO v_StdPrecision + FROM C_UOM u, M_PRODUCT p + WHERE u.C_UOM_ID=p.C_UOM_ID AND p.M_Product_ID=bom.M_ProductBOM_ID; + -- How much can we make with this product + v_ProductQty := ROUND (v_ProductQty/bom.BOMQty, v_StdPrecision); + -- How much can we make overall + IF (v_ProductQty < v_Quantity) THEN + v_Quantity := v_ProductQty; + END IF; + -- Another BOM + ELSIF (bom.IsBOM = 'Y') THEN + v_ProductQty := Bomqtyordered (bom.M_ProductBOM_ID, v_Warehouse_ID, p_Locator_ID); + -- How much can we make overall + IF (v_ProductQty < v_Quantity) THEN + v_Quantity := v_ProductQty; + END IF; + END IF; + END LOOP; -- BOM + + -- Unlimited (e.g. only services) + IF (v_Quantity = 99999) THEN + RETURN 0; + END IF; + + IF (v_Quantity > 0) THEN + -- Get Rounding Precision for Product + SELECT NVL(MAX(u.StdPrecision), 0) + INTO v_StdPrecision + FROM C_UOM u, M_PRODUCT p + WHERE u.C_UOM_ID=p.C_UOM_ID AND p.M_Product_ID=p_Product_ID; + -- + RETURN ROUND (v_Quantity, v_StdPrecision); + END IF; + -- + RETURN 0; +END Bomqtyordered; +/ + +CREATE OR REPLACE FUNCTION BOMQTYRESERVED +( + p_Product_ID IN NUMBER, + p_Warehouse_ID IN NUMBER, + p_Locator_ID IN NUMBER -- Only used, if warehouse is null +) +RETURN NUMBER +/****************************************************************************** + * ** Compiere Product ** Copyright (c) 1999-2001 Accorto, Inc. USA + * Open Source Software Provided "AS IS" without warranty or liability + * When you use any parts (changed or unchanged), add "Powered by Compiere" to + * your product name; See license details http://www.compiere.org/license.html + ****************************************************************************** + * Return quantity reserved for BOM + */ +AS + v_Warehouse_ID NUMBER; + v_Quantity NUMBER := 99999; -- unlimited + v_IsBOM CHAR(1); + v_IsStocked CHAR(1); + v_ProductType CHAR(1); + v_ProductQty NUMBER; + v_StdPrecision NUMBER; + -- Get BOM Product info + CURSOR CUR_BOM IS + SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM, p.IsStocked, p.ProductType + FROM M_PRODUCT_BOM b, M_PRODUCT p + WHERE b.M_ProductBOM_ID=p.M_Product_ID + AND b.M_Product_ID=p_Product_ID + AND b.M_ProductBOM_ID != p_Product_ID + AND p.IsBOM='Y' + AND p.IsVerified='Y' + AND b.IsActive='Y'; + -- +BEGIN + -- Check Parameters + v_Warehouse_ID := p_Warehouse_ID; + IF (v_Warehouse_ID IS NULL) THEN + IF (p_Locator_ID IS NULL) THEN + RETURN 0; + ELSE + SELECT MAX(M_Warehouse_ID) INTO v_Warehouse_ID + FROM M_LOCATOR + WHERE M_Locator_ID=p_Locator_ID; + END IF; + END IF; + IF (v_Warehouse_ID IS NULL) THEN + RETURN 0; + END IF; +-- DBMS_OUTPUT.PUT_LINE('Warehouse=' || v_Warehouse_ID); + + -- Check, if product exists and if it is stocked + BEGIN + SELECT IsBOM, ProductType, IsStocked + INTO v_IsBOM, v_ProductType, v_IsStocked + FROM M_PRODUCT + WHERE M_Product_ID=p_Product_ID; + -- + EXCEPTION -- not found + WHEN OTHERS THEN + RETURN 0; + END; + + -- No reservation for non-stocked + IF (v_IsBOM='N' AND (v_ProductType<>'I' OR v_IsStocked='N')) THEN + RETURN 0; + -- Stocked item + ELSIF (v_IsStocked='Y') THEN + -- Get ProductQty + SELECT NVL(SUM(Qty), 0) + INTO v_ProductQty + FROM M_StorageReservation + WHERE M_Product_ID=p_Product_ID + AND M_Warehouse_ID=v_Warehouse_ID + AND IsSOTrx='Y' + AND IsActive='Y'; + -- + RETURN v_ProductQty; + END IF; + + -- Go though BOM +-- DBMS_OUTPUT.PUT_LINE('BOM'); + FOR bom IN CUR_BOM LOOP + -- Stocked Items "leaf node" + IF (bom.ProductType = 'I' AND bom.IsStocked = 'Y') THEN + -- Get ProductQty + SELECT NVL(SUM(Qty), 0) + INTO v_ProductQty + FROM M_StorageReservation + WHERE M_Product_ID=bom.M_ProductBOM_ID + AND M_Warehouse_ID=v_Warehouse_ID + AND IsSOTrx='Y' + AND IsActive='Y'; + -- Get Rounding Precision + SELECT NVL(MAX(u.StdPrecision), 0) + INTO v_StdPrecision + FROM C_UOM u, M_PRODUCT p + WHERE u.C_UOM_ID=p.C_UOM_ID AND p.M_Product_ID=bom.M_ProductBOM_ID; + -- How much can we make with this product + v_ProductQty := ROUND (v_ProductQty/bom.BOMQty, v_StdPrecision); + -- How much can we make overall + IF (v_ProductQty < v_Quantity) THEN + v_Quantity := v_ProductQty; + END IF; + -- Another BOM + ELSIF (bom.IsBOM = 'Y') THEN + v_ProductQty := Bomqtyreserved (bom.M_ProductBOM_ID, v_Warehouse_ID, p_Locator_ID); + -- How much can we make overall + IF (v_ProductQty < v_Quantity) THEN + v_Quantity := v_ProductQty; + END IF; + END IF; + END LOOP; -- BOM + + -- Unlimited (e.g. only services) + IF (v_Quantity = 99999) THEN + RETURN 0; + END IF; + + IF (v_Quantity > 0) THEN + -- Get Rounding Precision for Product + SELECT NVL(MAX(u.StdPrecision), 0) + INTO v_StdPrecision + FROM C_UOM u, M_PRODUCT p + WHERE u.C_UOM_ID=p.C_UOM_ID AND p.M_Product_ID=p_Product_ID; + -- + RETURN ROUND (v_Quantity, v_StdPrecision); + END IF; + RETURN 0; +END Bomqtyreserved; +/ + +SELECT register_migration_script('201405160521_IDEMPIERE-1953.sql') FROM dual +; diff --git a/migration/i2.0/postgresql/201404211431_IDEMPIERE-1843.sql b/migration/i2.0/postgresql/201404211431_IDEMPIERE-1843.sql new file mode 100644 index 0000000000..b8451eb0d2 --- /dev/null +++ b/migration/i2.0/postgresql/201404211431_IDEMPIERE-1843.sql @@ -0,0 +1,12 @@ +-- Apr 21, 2014 2:30:56 PM CEST +-- IDEMPIERE-1843 +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200271,'8b9721fe-a51a-4d84-8b07-9eff0f3ce158',0,TO_TIMESTAMP('2014-04-21 14:30:55','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Tabs','I',TO_TIMESTAMP('2014-04-21 14:30:55','YYYY-MM-DD HH24:MI:SS'),100,'Tabs') +; + +-- Apr 21, 2014 2:31:03 PM CEST +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200272,'b835a2a6-2257-462c-abfb-bfa97e283306',0,TO_TIMESTAMP('2014-04-21 14:31:02','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Fields','I',TO_TIMESTAMP('2014-04-21 14:31:02','YYYY-MM-DD HH24:MI:SS'),100,'Fields') +; + + +SELECT register_migration_script('201404211431_IDEMPIERE-1843.sql') FROM dual +; \ No newline at end of file diff --git a/migration/i2.0/postgresql/201404290949_Ticket_1003965.sql b/migration/i2.0/postgresql/201404290949_Ticket_1003965.sql new file mode 100644 index 0000000000..8da5fceaad --- /dev/null +++ b/migration/i2.0/postgresql/201404290949_Ticket_1003965.sql @@ -0,0 +1,237 @@ +CREATE OR REPLACE FUNCTION bomqtyreserved (in p_product_id numeric, in p_warehouse_id numeric, in p_locator_id numeric) RETURNS numeric AS +$BODY$ +DECLARE + v_Warehouse_ID numeric; + v_Quantity numeric := 99999; -- unlimited + v_IsBOM CHAR(1); + v_IsStocked CHAR(1); + v_ProductType CHAR(1); + v_ProductQty numeric; + v_StdPrecision int; + bom record; +BEGIN + -- Check Parameters + v_Warehouse_ID := p_Warehouse_ID; + IF (v_Warehouse_ID IS NULL) THEN + IF (p_Locator_ID IS NULL) THEN + RETURN 0; + ELSE + SELECT MAX(M_Warehouse_ID) INTO v_Warehouse_ID + FROM M_LOCATOR + WHERE M_Locator_ID=p_Locator_ID; + END IF; + END IF; + IF (v_Warehouse_ID IS NULL) THEN + RETURN 0; + END IF; + + -- Check, if product exists and if it is stocked + BEGIN + SELECT IsBOM, ProductType, IsStocked + INTO v_IsBOM, v_ProductType, v_IsStocked + FROM M_PRODUCT + WHERE M_Product_ID=p_Product_ID; + -- + EXCEPTION -- not found + WHEN OTHERS THEN + RETURN 0; + END; + + -- No reservation for non-stocked + IF (v_IsBOM='N' AND (v_ProductType<>'I' OR v_IsStocked='N')) THEN + RETURN 0; + -- Stocked item + ELSIF (v_IsStocked='Y') THEN + -- Get ProductQty + SELECT COALESCE(SUM(Qty), 0) + INTO v_ProductQty + FROM M_StorageReservation + WHERE M_Product_ID=p_Product_ID + AND M_Warehouse_ID=v_Warehouse_ID + AND IsSOTrx='Y' + AND IsActive='Y'; + -- + RETURN v_ProductQty; + END IF; + + -- Go though BOM + FOR bom IN + -- Get BOM Product info + SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM, p.IsStocked, p.ProductType + FROM M_PRODUCT_BOM b, M_PRODUCT p + WHERE b.M_ProductBOM_ID=p.M_Product_ID + AND b.M_Product_ID=p_Product_ID + AND p.IsBOM='Y' + AND p.IsVerified='Y' + LOOP + -- Stocked Items "leaf node" + IF (bom.ProductType = 'I' AND bom.IsStocked = 'Y') THEN + -- Get ProductQty + SELECT COALESCE(SUM(Qty), 0) + INTO v_ProductQty + FROM M_StorageReservation + WHERE M_Product_ID=bom.M_ProductBOM_ID + AND M_Warehouse_ID =v_Warehouse_ID + AND IsSOTrx='Y' + AND IsActive='Y'; + -- Get Rounding Precision + SELECT COALESCE(MAX(u.StdPrecision), 0) + INTO v_StdPrecision + FROM C_UOM u, M_PRODUCT p + WHERE u.C_UOM_ID=p.C_UOM_ID AND p.M_Product_ID=bom.M_ProductBOM_ID; + -- How much can we make with this product + v_ProductQty := ROUND (v_ProductQty/bom.BOMQty, v_StdPrecision); + -- How much can we make overall + IF (v_ProductQty < v_Quantity) THEN + v_Quantity := v_ProductQty; + END IF; + -- Another BOM + ELSIF (bom.IsBOM = 'Y') THEN + v_ProductQty := Bomqtyreserved (bom.M_ProductBOM_ID, v_Warehouse_ID, p_Locator_ID); + -- How much can we make overall + IF (v_ProductQty < v_Quantity) THEN + v_Quantity := v_ProductQty; + END IF; + END IF; + END LOOP; -- BOM + + -- Unlimited (e.g. only services) + IF (v_Quantity = 99999) THEN + RETURN 0; + END IF; + + IF (v_Quantity > 0) THEN + -- Get Rounding Precision for Product + SELECT COALESCE(MAX(u.StdPrecision), 0) + INTO v_StdPrecision + FROM C_UOM u, M_PRODUCT p + WHERE u.C_UOM_ID=p.C_UOM_ID AND p.M_Product_ID=p_Product_ID; + -- + RETURN ROUND (v_Quantity, v_StdPrecision); + END IF; + RETURN 0; +END; +$BODY$ + LANGUAGE plpgsql VOLATILE; + +CREATE OR REPLACE FUNCTION bomqtyordered (in p_product_id numeric, in p_warehouse_id numeric, in p_locator_id numeric) RETURNS numeric AS +$BODY$ +DECLARE + v_Warehouse_ID numeric; + v_Quantity numeric := 99999; -- unlimited + v_IsBOM CHAR(1); + v_IsStocked CHAR(1); + v_ProductType CHAR(1); + v_ProductQty numeric; + v_StdPrecision int; + bom record; +BEGIN + -- Check Parameters + v_Warehouse_ID := p_Warehouse_ID; + IF (v_Warehouse_ID IS NULL) THEN + IF (p_Locator_ID IS NULL) THEN + RETURN 0; + ELSE + SELECT MAX(M_Warehouse_ID) INTO v_Warehouse_ID + FROM M_LOCATOR + WHERE M_Locator_ID=p_Locator_ID; + END IF; + END IF; + IF (v_Warehouse_ID IS NULL) THEN + RETURN 0; + END IF; + + -- Check, if product exists and if it is stocked + BEGIN + SELECT IsBOM, ProductType, IsStocked + INTO v_IsBOM, v_ProductType, v_IsStocked + FROM M_PRODUCT + WHERE M_Product_ID=p_Product_ID; + -- + EXCEPTION -- not found + WHEN OTHERS THEN + RETURN 0; + END; + + -- No reservation for non-stocked + IF (v_IsBOM='N' AND (v_ProductType<>'I' OR v_IsStocked='N')) THEN + RETURN 0; + -- Stocked item + ELSIF (v_IsStocked='Y') THEN + -- Get ProductQty + SELECT COALESCE(SUM(Qty), 0) + INTO v_ProductQty + FROM M_StorageReservation + WHERE M_Product_ID=p_Product_ID + AND M_Warehouse_ID=v_Warehouse_ID + AND IsSOTrx='N' + AND IsActive='Y'; + -- + RETURN v_ProductQty; + END IF; + + -- Go though BOM + FOR bom IN + -- Get BOM Product info + SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM, p.IsStocked, p.ProductType + FROM M_PRODUCT_BOM b, M_PRODUCT p + WHERE b.M_ProductBOM_ID=p.M_Product_ID + AND b.M_Product_ID=p_Product_ID + AND p.IsBOM='Y' + AND p.IsVerified='Y' + LOOP + -- Stocked Items "leaf node" + IF (bom.ProductType = 'I' AND bom.IsStocked = 'Y') THEN + -- Get ProductQty + SELECT COALESCE(SUM(Qty), 0) + INTO v_ProductQty + FROM M_StorageReservation + WHERE M_Product_ID=p_Product_ID + AND M_Warehouse_ID=v_Warehouse_ID + AND IsSOTrx='N' + AND IsActive='Y'; + -- Get Rounding Precision + SELECT COALESCE(MAX(u.StdPrecision), 0) + INTO v_StdPrecision + FROM C_UOM u, M_PRODUCT p + WHERE u.C_UOM_ID=p.C_UOM_ID AND p.M_Product_ID=bom.M_ProductBOM_ID; + -- How much can we make with this product + v_ProductQty := ROUND (v_ProductQty/bom.BOMQty, v_StdPrecision ); + + -- How much can we make overall + IF (v_ProductQty < v_Quantity) THEN + v_Quantity := v_ProductQty; + END IF; + -- Another BOM + ELSIF (bom.IsBOM = 'Y') THEN + v_ProductQty := Bomqtyordered (bom.M_ProductBOM_ID, v_Warehouse_ID, p_Locator_ID); + -- How much can we make overall + IF (v_ProductQty < v_Quantity) THEN + v_Quantity := v_ProductQty; + END IF; + END IF; + END LOOP; -- BOM + + -- Unlimited (e.g. only services) + IF (v_Quantity = 99999) THEN + RETURN 0; + END IF; + + IF (v_Quantity > 0) THEN + -- Get Rounding Precision for Product + SELECT COALESCE(MAX(u.StdPrecision), 0) + INTO v_StdPrecision + FROM C_UOM u, M_PRODUCT p + WHERE u.C_UOM_ID=p.C_UOM_ID AND p.M_Product_ID=p_Product_ID; + -- + RETURN ROUND (v_Quantity, v_StdPrecision ); + END IF; + -- + RETURN 0; +END; +$BODY$ + LANGUAGE plpgsql VOLATILE; + +SELECT register_migration_script('201404290949_Ticket_1003965.sql') FROM dual +; + diff --git a/migration/i2.0/postgresql/201405021009_IDEMPIERE-709.sql b/migration/i2.0/postgresql/201405021009_IDEMPIERE-709.sql new file mode 100644 index 0000000000..12908fc677 --- /dev/null +++ b/migration/i2.0/postgresql/201405021009_IDEMPIERE-709.sql @@ -0,0 +1,458 @@ +ALTER TABLE a_asset_acct ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_acct ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_addition ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_addition ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_change ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_change ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_class ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_class ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_disposed ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_disposed ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_group_acct ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_group_acct ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_info_fin ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_info_fin ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_info_ins ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_info_ins ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_info_lic ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_info_lic ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_info_oth ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_info_oth ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_info_tax ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_info_tax ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_product ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_product ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_reval ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_reval ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_reval_entry ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_reval_entry ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_reval_index ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_reval_index ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_split ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_split ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_spread ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_spread ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_transfer ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_transfer ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_type ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_type ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_use ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE a_asset_use ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE a_depreciation ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE a_depreciation ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE a_depreciation_build ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE a_depreciation_build ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE a_depreciation_convention ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE a_depreciation_convention ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE a_depreciation_entry ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE a_depreciation_entry ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE a_depreciation_exp ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE a_depreciation_exp ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE a_depreciation_forecast ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE a_depreciation_forecast ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE a_depreciation_method ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE a_depreciation_method ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE a_depreciation_table_detail ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE a_depreciation_table_detail ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE a_depreciation_table_header ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE a_depreciation_table_header ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE a_depreciation_workfile ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE a_depreciation_workfile ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE a_fundingmode ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE a_fundingmode ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE a_fundingmode_acct ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE a_fundingmode_acct ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ad_chart ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ad_chart ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ad_chartdatasource ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ad_chartdatasource ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ad_ctxhelp ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ad_ctxhelp ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ad_ctxhelpmsg ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ad_ctxhelpmsg ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ad_element ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ad_housekeeping ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ad_housekeeping ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ad_indexcolumn ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ad_indexcolumn ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ad_infowindow_access ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ad_infowindow_access ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ad_migrationscript ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ad_migrationscript ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ad_modelvalidator ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ad_modelvalidator ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ad_package_imp_inst ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ad_package_imp_inst ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ad_package_uuid_map ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ad_package_uuid_map ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ad_passwordrule ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ad_passwordrule ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ad_pinstance ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ad_pinstance_para ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ad_pinstance_para ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ad_recentitem ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ad_recentitem ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ad_relationtype ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ad_relationtype ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ad_replicationdocument ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ad_replicationdocument ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ad_role_included ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ad_role_included ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ad_rule ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ad_rule ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ad_schedule ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ad_schedule ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ad_searchdefinition ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ad_searchdefinition ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ad_storageprovider ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ad_storageprovider ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ad_sysconfig ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ad_sysconfig ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ad_tab_customization ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ad_tab_customization ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ad_table_scriptvalidator ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ad_table_scriptvalidator ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ad_tableindex ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ad_tableindex ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ad_toolbarbutton ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ad_toolbarbutton ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ad_toolbarbuttonrestrict ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ad_toolbarbuttonrestrict ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ad_viewcolumn ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ad_viewcolumn ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ad_viewcomponent ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ad_viewcomponent ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ad_wizardprocess ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ad_wizardprocess ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ad_zoomcondition ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ad_zoomcondition ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE asp_clientexception ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE asp_clientexception ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE asp_clientlevel ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE asp_clientlevel ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE asp_field ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE asp_field ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE asp_form ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE asp_form ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE asp_level ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE asp_level ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE asp_module ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE asp_module ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE asp_process ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE asp_process ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE asp_process_para ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE asp_process_para ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE asp_ref_list ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE asp_ref_list ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE asp_tab ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE asp_tab ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE asp_task ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE asp_task ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE asp_window ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE asp_window ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE asp_workflow ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE asp_workflow ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE c_1099box ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE c_1099box ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE c_addresstransaction ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE c_addresstransaction ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE c_addressvalidation ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE c_addressvalidation ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE c_addressvalidationcfg ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE c_addressvalidationcfg ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE c_bankaccount_processor ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE c_bankaccount_processor ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE c_bp_shippingacct ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE c_bp_shippingacct ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE c_cashplan ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE c_cashplan ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE c_cashplanline ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE c_cashplanline ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE c_chargetype ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE c_chargetype ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE c_chargetype_doctype ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE c_chargetype_doctype ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE c_contactactivity ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE c_contactactivity ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE c_depositbatch ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE c_depositbatch ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE c_depositbatchline ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE c_depositbatchline ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE c_onlinetrxhistory ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE c_onlinetrxhistory ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE c_opportunity ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE c_opportunity ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE c_orderlandedcost ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE c_orderlandedcost ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE c_orderlandedcostallocation ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE c_orderlandedcostallocation ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE c_orderpayschedule ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE c_orderpayschedule ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE c_paymenttransaction ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE c_paymenttransaction ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE c_pospayment ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE c_pospayment ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE c_postendertype ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE c_postendertype ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE c_salesstage ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE c_salesstage ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE c_taxbase ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE c_taxbase ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE c_taxdefinition ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE c_taxdefinition ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE c_taxgroup ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE c_taxgroup ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE c_taxprovider ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE c_taxprovider ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE c_taxprovidercfg ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE c_taxprovidercfg ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE c_taxtype ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE c_taxtype ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE dd_networkdistribution ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE dd_networkdistribution ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE dd_networkdistributionline ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE dd_networkdistributionline ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE dd_order ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE dd_order ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE dd_orderline ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE dd_orderline ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE exp_format ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE exp_format ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE exp_formatline ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE exp_formatline ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE exp_processor ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE exp_processor ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE exp_processor_type ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE exp_processor_type ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE exp_processorparameter ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE exp_processorparameter ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE fact_acct_summary ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE fact_acct_summary ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE fact_reconciliation ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE fact_reconciliation ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE gl_journalgenerator ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE gl_journalgenerator ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE gl_journalgeneratorline ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE gl_journalgeneratorline ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE gl_journalgeneratorsource ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE gl_journalgeneratorsource ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE hr_attribute ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE hr_attribute ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE hr_concept ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE hr_concept ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE hr_concept_acct ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE hr_concept_acct ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE hr_concept_category ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE hr_concept_category ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE hr_contract ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE hr_contract ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE hr_department ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE hr_department ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE hr_employee ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE hr_employee ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE hr_job ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE hr_job ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE hr_list ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE hr_list ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE hr_listline ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE hr_listline ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE hr_listtype ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE hr_listtype ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE hr_listversion ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE hr_listversion ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE hr_movement ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE hr_movement ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE hr_payroll ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE hr_payroll ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE hr_payrollconcept ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE hr_payrollconcept ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE hr_period ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE hr_period ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE hr_process ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE hr_process ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE hr_year ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE hr_year ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE i_asset ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE i_asset ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE i_bankstatement ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE i_bankstatement ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE i_bpartner ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE i_bpartner ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE i_conversion_rate ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE i_conversion_rate ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE i_elementvalue ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE i_elementvalue ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE i_fajournal ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE i_fajournal ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE i_fixedasset ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE i_fixedasset ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE i_gljournal ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE i_gljournal ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE i_hr_movement ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE i_hr_movement ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE i_inventory ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE i_inventory ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE i_invoice ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE i_invoice ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE i_movement ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE i_movement ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE i_order ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE i_order ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE i_payment ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE i_payment ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE i_pricelist ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE i_pricelist ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE i_product ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE i_product ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE i_productplanning ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE i_productplanning ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE i_reportline ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE i_reportline ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE imp_processor ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE imp_processor ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE imp_processor_type ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE imp_processor_type ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE imp_processorlog ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE imp_processorlog ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE imp_processorparameter ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE imp_processorparameter ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE m_bp_price ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE m_bp_price ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE m_commodityshipment ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE m_commodityshipment ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE m_costhistory ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE m_costhistory ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE m_packagemps ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE m_packagemps ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE m_parttype ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE m_parttype ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE m_product_qualitytest ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE m_product_qualitytest ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE m_productpricevendorbreak ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE m_productpricevendorbreak ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE m_promotion ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE m_promotion ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE m_promotiondistribution ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE m_promotiondistribution ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE m_promotiongroup ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE m_promotiongroup ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE m_promotiongroupline ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE m_promotiongroupline ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE m_promotionline ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE m_promotionline ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE m_promotionprecondition ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE m_promotionprecondition ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE m_promotionreward ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE m_promotionreward ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE m_qualitytest ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE m_qualitytest ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE m_qualitytestresult ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE m_qualitytestresult ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE m_rmatax ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE m_rmatax ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE m_shippercfg ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE m_shippercfg ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE m_shipperlabels ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE m_shipperlabels ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE m_shipperlabelscfg ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE m_shipperlabelscfg ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE m_shipperpackaging ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE m_shipperpackaging ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE m_shipperpackagingcfg ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE m_shipperpackagingcfg ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE m_shipperpickuptypes ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE m_shipperpickuptypes ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE m_shipperpickuptypescfg ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE m_shipperpickuptypescfg ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE m_shippingprocessor ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE m_shippingprocessor ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE m_shippingprocessorcfg ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE m_shippingprocessorcfg ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE m_shippingtransaction ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE m_shippingtransaction ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE m_shippingtransactionline ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE m_shippingtransactionline ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE m_storageonhand ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE m_storageonhand ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE m_storagereservation ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE m_storagereservation ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE pa_dashboardcontent ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE pa_dashboardcontent ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE pa_dashboardcontent_access ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE pa_dashboardcontent_access ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE pa_dashboardpreference ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE pa_dashboardpreference ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE pa_reportcube ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE pa_reportcube ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE pp_cost_collector ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE pp_cost_collector ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE pp_cost_collectorma ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE pp_cost_collectorma ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE pp_mrp ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE pp_mrp ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE pp_order ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE pp_order ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE pp_order_bom ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE pp_order_bom ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE pp_order_bomline ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE pp_order_bomline ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE pp_order_cost ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE pp_order_cost ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE pp_order_node ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE pp_order_node ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE pp_order_node_asset ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE pp_order_node_asset ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE pp_order_node_product ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE pp_order_node_product ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE pp_order_nodenext ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE pp_order_nodenext ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE pp_order_workflow ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE pp_order_workflow ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE pp_product_bom ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE pp_product_bom ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE pp_product_bomline ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE pp_product_bomline ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE pp_product_planning ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE pp_product_planning ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE pp_wf_node_asset ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE pp_wf_node_asset ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE pp_wf_node_product ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE pp_wf_node_product ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE qm_specification ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE qm_specification ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE qm_specificationline ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE qm_specificationline ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE t_1099extract ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE t_1099extract ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE t_bom_indented ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE t_bom_indented ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE t_bomline ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE t_bomline ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE t_cashflow ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE t_cashflow ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE t_mrp_crp ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE t_mrp_crp ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE t_reconciliation ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE t_reconciliation ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE t_replenish ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE t_trialbalance ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE t_trialbalance ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE u_posterminal ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE u_posterminal ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ws_webservice ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ws_webservice ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ws_webservice_para ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ws_webservice_para ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ws_webservicefieldinput ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ws_webservicefieldinput ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ws_webservicefieldoutput ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ws_webservicefieldoutput ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ws_webservicemethod ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ws_webservicemethod ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ws_webservicetype ALTER COLUMN updated SET DEFAULT statement_timestamp(); +ALTER TABLE ws_webservicetype ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ws_webservicetypeaccess ALTER COLUMN created SET DEFAULT statement_timestamp(); +ALTER TABLE ws_webservicetypeaccess ALTER COLUMN updated SET DEFAULT statement_timestamp(); + +SELECT register_migration_script('201405021009_IDEMPIERE-709.sql') FROM dual +; diff --git a/migration/i2.0/postgresql/201405072159_IDEMPIERE-1898.sql b/migration/i2.0/postgresql/201405072159_IDEMPIERE-1898.sql new file mode 100644 index 0000000000..02b0dcbb95 --- /dev/null +++ b/migration/i2.0/postgresql/201405072159_IDEMPIERE-1898.sql @@ -0,0 +1,212 @@ +-- May 7, 2014 9:40:51 PM COT +-- IDEMPIERE-1898 create UUID fields +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',351,36,'N','N','Y',202883,'N','AD_Role_OrgAccess_UU','a88ba358-1488-44eb-8574-b70e053ab4b8','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:40:50','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60491,'D',0,TO_TIMESTAMP('2014-05-07 21:40:50','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:41:06 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',120,36,'N','N','Y',202884,'N','AD_User_Roles_UU','21b33e6f-784d-427e-b111-e7c73d265b17','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:41:05','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60536,'D',0,TO_TIMESTAMP('2014-05-07 21:41:05','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:41:12 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',304,36,'N','N','Y',202885,'N','AD_Window_Access_UU','0e891526-fa44-4f90-82ba-480720971b26','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:41:12','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60552,'D',0,TO_TIMESTAMP('2014-05-07 21:41:12','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:41:20 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',305,36,'N','N','Y',202886,'N','AD_Process_Access_UU','66487022-11cc-4e18-97ec-7352fc3ee44c','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:41:19','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60469,'D',0,TO_TIMESTAMP('2014-05-07 21:41:19','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:41:29 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',306,36,'N','N','Y',202887,'N','AD_Form_Access_UU','06512e4f-a8ea-4af1-9ea7-640e7f3497e8','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:41:28','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60415,'D',0,TO_TIMESTAMP('2014-05-07 21:41:28','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:42:34 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',307,36,'N','N','Y',202888,'N','AD_Workflow_Access_UU','345d6423-bf73-47c9-a2e5-247d07c8ab17','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:42:33','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60558,'D',0,TO_TIMESTAMP('2014-05-07 21:42:33','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:42:43 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',313,36,'N','N','Y',202889,'N','AD_Task_Access_UU','217ec930-1d2d-402f-97a7-b3ff8e1baa3d','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:42:43','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60511,'D',0,TO_TIMESTAMP('2014-05-07 21:42:43','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:42:51 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',53013,36,'N','N','Y',202890,'N','AD_Document_Action_Access_UU','b53eff36-b689-4b00-8141-c570e05e5284','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:42:50','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60394,'D',0,TO_TIMESTAMP('2014-05-07 21:42:50','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:43:06 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',53240,36,'N','N','Y',202891,'N','AD_Role_Included_UU','2119bea8-2cce-4976-ab35-a6cdebd11eb2','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:43:05','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60490,'D',0,TO_TIMESTAMP('2014-05-07 21:43:05','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:43:31 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',482,36,'N','N','Y',202892,'N','AD_Table_Access_UU','22bf31a5-217e-4ac5-a85a-f285430e11ef','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:43:30','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60506,'D',0,TO_TIMESTAMP('2014-05-07 21:43:30','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:43:39 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',484,36,'N','N','Y',202893,'N','AD_Column_Access_UU','6755c5b6-ba10-4e24-9191-8bc7e7452a62','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:43:38','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60389,'D',0,TO_TIMESTAMP('2014-05-07 21:43:38','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:44:13 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',590,36,'N','N','Y',202894,'N','AD_Scheduler_Para_UU','9442e32f-7467-4131-9681-c962997dd95f','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:44:13','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60495,'D',0,TO_TIMESTAMP('2014-05-07 21:44:13','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:45:41 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',439,36,'N','N','Y',202895,'N','R_ContactInterest_UU','a577780e-621b-4e34-bf53-d12648555ecc','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:45:40','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,61010,'D',0,TO_TIMESTAMP('2014-05-07 21:45:40','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:45:59 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',53177,36,'N','N','Y',202896,'N','C_ChargeType_DocType_UU','2df4c394-fd4b-4cfb-952c-2e06f5d08783','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:45:59','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60630,'D',0,TO_TIMESTAMP('2014-05-07 21:45:59','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:46:35 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',200001,36,'N','N','Y',202897,'N','AD_Sequence_No_UU','0c8e6cd9-c335-4a04-b61d-22faed1739bf','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:46:35','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60500,'D',0,TO_TIMESTAMP('2014-05-07 21:46:35','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:47:02 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',309,36,'N','N','Y',202898,'N','AD_Form_Access_UU','606dafc8-f3d6-4aac-9601-b1c86088124b','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:47:01','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60415,'D',0,TO_TIMESTAMP('2014-05-07 21:47:01','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:47:21 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',536,36,'N','N','Y',202899,'N','R_ContactInterest_UU','6ee6fd8a-ceba-403a-833c-219cfde22b35','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:47:20','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,61010,'D',0,TO_TIMESTAMP('2014-05-07 21:47:20','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:47:42 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',192,36,'N','N','Y',202900,'N','M_ProductPrice_UU','ddb323b8-c728-40ac-969d-16deb8953f2d','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:47:42','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60934,'D',0,TO_TIMESTAMP('2014-05-07 21:47:42','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:48:11 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',420,36,'N','N','Y',202901,'N','M_ProductPrice_UU','27f3011a-7f69-4d73-99cd-81355dde5794','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:48:11','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60934,'D',0,TO_TIMESTAMP('2014-05-07 21:48:11','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:48:50 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',53161,36,'N','N','Y',202902,'N','A_Asset_Info_Oth_UU','a25bf366-a062-4c05-909f-c29cedb2061f','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:48:50','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60363,'D',0,TO_TIMESTAMP('2014-05-07 21:48:50','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:49:19 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',467,36,'N','N','Y',202903,'N','M_AttributeUse_UU','9a347678-6e45-4e2e-bb3c-80f943984c2f','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:49:19','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60870,'D',0,TO_TIMESTAMP('2014-05-07 21:49:19','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:49:40 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',820,36,'N','N','Y',202904,'N','CM_ChatTypeUpdate_UU','b4874c7e-9da5-417a-93e0-ba18381ee74f','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:49:40','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60689,'D',0,TO_TIMESTAMP('2014-05-07 21:49:40','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:50:03 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',310,36,'N','N','Y',202905,'N','AD_Task_Access_UU','6482ccd1-0668-486e-b917-e427ecc909cc','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:50:03','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60511,'D',0,TO_TIMESTAMP('2014-05-07 21:50:03','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:50:26 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',121,36,'N','N','Y',202906,'N','AD_User_Roles_UU','b667a771-b8c8-4e68-8246-5fbc4d770742','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:50:25','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60536,'D',0,TO_TIMESTAMP('2014-05-07 21:50:25','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:50:40 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',696,36,'N','N','Y',202907,'N','AD_User_OrgAccess_UU','bcd9d0b3-5164-40e7-b0bf-9cac34e6575b','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:50:40','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60534,'D',0,TO_TIMESTAMP('2014-05-07 21:50:40','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:51:06 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',311,36,'N','N','Y',202908,'N','AD_Window_Access_UU','e5f5cc54-3e86-485c-bd8d-2fae8ce889bb','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:51:06','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60552,'D',0,TO_TIMESTAMP('2014-05-07 21:51:06','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:51:24 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',312,36,'N','N','Y',202909,'N','AD_Workflow_Access_UU','c12a082c-0e8a-48d4-a9cf-edd1d79c9783','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:51:24','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60558,'D',0,TO_TIMESTAMP('2014-05-07 21:51:24','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:51:45 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',53191,36,'N','N','Y',202910,'N','WS_WebServiceTypeAccess_UU','120bdf05-45e4-4107-aa8b-e8c905a3ad1d','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:51:45','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,202050,'D',0,TO_TIMESTAMP('2014-05-07 21:51:45','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:52:05 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,SeqNoGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',747,1,'N','N',100,'Y',202911,'N','The Locator indicates where in a Warehouse a product is located.','Warehouse Locator','Locator','727a2b7a-2e3e-474c-98df-2a8c562daa5e','Y','N',100,100,TO_TIMESTAMP('2014-05-07 21:52:04','YYYY-MM-DD HH24:MI:SS'),'Y','Y',100,0,2,56518,'D',0,TO_TIMESTAMP('2014-05-07 21:52:04','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:52:05 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',747,36,'N','N','Y',202912,'N','M_Replenish_UU','622b3637-6fbf-4fb7-9f45-3c30bd099d98','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:52:05','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60945,'D',0,TO_TIMESTAMP('2014-05-07 21:52:05','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:52:05 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,SeqNoGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',747,10,'N','N',110,'Y',202913,'N','Qty Batch Size','d6530947-c64a-4a36-bf30-dffa5409c792','Y','N',100,100,TO_TIMESTAMP('2014-05-07 21:52:05','YYYY-MM-DD HH24:MI:SS'),'Y','Y',110,0,2,200241,'D',0,TO_TIMESTAMP('2014-05-07 21:52:05','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:52:18 PM COT +UPDATE AD_Field SET SeqNo=0,IsDisplayed='N' WHERE AD_Field_ID=202913 +; + +-- May 7, 2014 9:52:47 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',823,36,'N','N','Y',202914,'N','CM_ChatUpdate_UU','080bcda6-6be6-46d4-a36c-2955f7c74ff3','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:52:46','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60690,'D',0,TO_TIMESTAMP('2014-05-07 21:52:46','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:53:07 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',718,36,'N','N','Y',202915,'N','R_RequestTypeUpdates_UU','0f9acbf6-9bbd-45bb-8f0b-f65edf9d632c','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:53:07','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,61028,'D',0,TO_TIMESTAMP('2014-05-07 21:53:07','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:53:22 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',421,36,'N','N','Y',202916,'N','M_ProductPrice_UU','ac3db1cd-1b19-4283-822f-936d3acb0c4e','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:53:22','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60934,'D',0,TO_TIMESTAMP('2014-05-07 21:53:22','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:53:41 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',716,36,'N','N','Y',202917,'N','R_GroupUpdates_UU','565fe768-df71-489d-b3f5-af364e6b0a58','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:53:40','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,61012,'D',0,TO_TIMESTAMP('2014-05-07 21:53:40','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:53:58 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',715,36,'N','N','Y',202918,'N','R_CategoryUpdates_UU','abe8450b-1aca-4123-bc79-67e7ef8c2dcd','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:53:58','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,61009,'D',0,TO_TIMESTAMP('2014-05-07 21:53:58','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:54:18 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',714,36,'N','N','Y',202919,'N','R_RequestUpdates_UU','42a4abeb-c012-4070-a902-600e47256b6e','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:54:17','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,61030,'D',0,TO_TIMESTAMP('2014-05-07 21:54:17','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:54:29 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',719,36,'N','N','Y',202920,'N','R_RequestUpdates_UU','956d8096-6d8e-44eb-a771-f23382cfb822','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:54:29','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,61030,'D',0,TO_TIMESTAMP('2014-05-07 21:54:29','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:54:55 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',308,36,'N','N','Y',202921,'N','AD_Process_Access_UU','502ccb34-91ca-4c98-be9d-adea66d983d4','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:54:55','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60469,'D',0,TO_TIMESTAMP('2014-05-07 21:54:55','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:55:17 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',278,36,'N','N','Y',202922,'N','M_Product_PO_UU','d78530d4-efeb-4bb9-99d5-c11b5b528472','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:55:17','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60933,'D',0,TO_TIMESTAMP('2014-05-07 21:55:17','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:55:44 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',359,36,'N','N','Y',202923,'N','C_CyclePhase_UU','1f501721-cc63-4c61-a371-9e16e593654e','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:55:43','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60645,'D',0,TO_TIMESTAMP('2014-05-07 21:55:43','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:56:08 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',701,36,'N','N','Y',202924,'N','M_Cost_UU','7bca81aa-335f-43fa-aa4e-5c1023ef1bc0','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:56:07','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60877,'D',0,TO_TIMESTAMP('2014-05-07 21:56:07','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:56:28 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',585,36,'N','N','Y',202925,'N','A_RegistrationValue_UU','1aaa5a63-10df-47dd-85f5-407f772a4a2e','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:56:28','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60565,'D',0,TO_TIMESTAMP('2014-05-07 21:56:28','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:56:43 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',650,36,'N','N','Y',202926,'N','A_RegistrationProduct_UU','8281b68c-9b65-4df8-8b1e-f4efb0b5146f','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:56:42','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60564,'D',0,TO_TIMESTAMP('2014-05-07 21:56:42','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:57:08 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',181,36,'N','N','Y',202927,'N','M_Substitute_UU','e45630f8-1dba-4a22-8e0b-b30a151fac02','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:57:08','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60955,'D',0,TO_TIMESTAMP('2014-05-07 21:57:08','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:57:18 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',630,36,'N','N','Y',202928,'N','M_RelatedProduct_UU','957cd9ae-3c2c-427b-bcae-d23b38d3f302','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:57:18','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60944,'D',0,TO_TIMESTAMP('2014-05-07 21:57:18','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:57:27 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',182,36,'N','N','Y',202929,'N','M_Replenish_UU','67b14545-5e7a-4fc7-84da-cd041e905ac3','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:57:26','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60945,'D',0,TO_TIMESTAMP('2014-05-07 21:57:26','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:57:36 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',239,36,'N','N','Y',202930,'N','M_Product_PO_UU','eab74338-7655-4e9d-a0e4-a103c4b14d20','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:57:35','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60933,'D',0,TO_TIMESTAMP('2014-05-07 21:57:35','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:57:45 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',562,36,'N','N','Y',202931,'N','C_BPartner_Product_UU','fa25d761-b2b3-4892-aa33-9c2a31b31fa8','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:57:44','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60607,'D',0,TO_TIMESTAMP('2014-05-07 21:57:44','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:57:53 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',183,36,'N','N','Y',202932,'N','M_ProductPrice_UU','5dd20e74-c9be-4759-8755-7d9688a83a7a','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:57:53','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60934,'D',0,TO_TIMESTAMP('2014-05-07 21:57:53','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 7, 2014 9:58:16 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',53289,36,'N','N','Y',202933,'N','M_Cost_UU','54e5c4c4-c0b0-4233-8bc9-53dc475f8225','N','N',100,100,TO_TIMESTAMP('2014-05-07 21:58:16','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60877,'D',0,TO_TIMESTAMP('2014-05-07 21:58:16','YYYY-MM-DD HH24:MI:SS')) +; + +SELECT register_migration_script('201405072159_IDEMPIERE-1898.sql') FROM dual +; + diff --git a/migration/i2.0/postgresql/201405160521_IDEMPIERE-1953.sql b/migration/i2.0/postgresql/201405160521_IDEMPIERE-1953.sql new file mode 100644 index 0000000000..3fbf47afdd --- /dev/null +++ b/migration/i2.0/postgresql/201405160521_IDEMPIERE-1953.sql @@ -0,0 +1,478 @@ +CREATE OR REPLACE FUNCTION bompricelimit (in product_id numeric, in pricelist_version_id numeric) RETURNS numeric AS +$BODY$ +DECLARE + v_Price NUMERIC; + v_ProductPrice NUMERIC; + bom RECORD; + +BEGIN + -- Try to get price from PriceList directly + SELECT COALESCE (SUM(PriceLimit), 0) + INTO v_Price + FROM M_ProductPrice + WHERE M_PriceList_Version_ID=PriceList_Version_ID AND M_Product_ID=Product_ID; + + -- No Price - Check if BOM + IF (v_Price = 0) THEN + FOR bom IN + SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM + FROM M_Product_BOM b, M_Product p + WHERE b.M_ProductBOM_ID=p.M_Product_ID + AND b.M_Product_ID=Product_ID + AND b.M_ProductBOM_ID != Product_ID + AND p.IsBOM='Y' + AND p.IsVerified='Y' + AND b.IsActive='Y' + LOOP + v_ProductPrice := bomPriceLimit (bom.M_ProductBOM_ID, PriceList_Version_ID); + v_Price := v_Price + (bom.BOMQty * v_ProductPrice); + END LOOP; + END IF; + -- + RETURN v_Price; + +END; + +$BODY$ +LANGUAGE 'plpgsql' STABLE +; + +CREATE OR REPLACE FUNCTION bompricelist (in product_id numeric, in pricelist_version_id numeric) RETURNS numeric AS +$BODY$ +DECLARE + v_Price NUMERIC; + v_ProductPrice NUMERIC; + bom RECORD; + +BEGIN + -- Try to get price from pricelist directly + SELECT COALESCE (SUM(PriceList), 0) + INTO v_Price + FROM M_ProductPrice + WHERE M_PriceList_Version_ID=PriceList_Version_ID AND M_Product_ID=Product_ID; + + -- No Price - Check if BOM + IF (v_Price = 0) THEN + FOR bom IN + SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM + FROM M_Product_BOM b, M_Product p + WHERE b.M_ProductBOM_ID=p.M_Product_ID + AND b.M_Product_ID=Product_ID + AND b.M_ProductBOM_ID != Product_ID + AND p.IsBOM='Y' + AND p.IsVerified='Y' + AND b.IsActive='Y' + LOOP + v_ProductPrice := bomPriceList (bom.M_ProductBOM_ID, PriceList_Version_ID); + v_Price := v_Price + (bom.BOMQty * v_ProductPrice); + END LOOP; + END IF; + -- + RETURN v_Price; + +END; + +$BODY$ +LANGUAGE 'plpgsql' STABLE +; + +CREATE OR REPLACE FUNCTION bompricestd (in product_id numeric, in pricelist_version_id numeric) RETURNS numeric AS +$BODY$ +DECLARE + v_Price NUMERIC; + v_ProductPrice NUMERIC; + bom RECORD; + +BEGIN + -- Try to get price from PriceList directly + SELECT COALESCE(SUM(PriceStd), 0) + INTO v_Price + FROM M_ProductPrice + WHERE M_PriceList_Version_ID=PriceList_Version_ID AND M_Product_ID=Product_ID; + + -- No Price - Check if BOM + IF (v_Price = 0) THEN + FOR bom IN + SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM + FROM M_Product_BOM b, M_Product p + WHERE b.M_ProductBOM_ID=p.M_Product_ID + AND b.M_Product_ID=Product_ID + AND b.M_ProductBOM_ID != Product_ID + AND p.IsBOM='Y' + AND p.IsVerified='Y' + AND b.IsActive='Y' + LOOP + v_ProductPrice := bomPriceStd (bom.M_ProductBOM_ID, PriceList_Version_ID); + v_Price := v_Price + (bom.BOMQty * v_ProductPrice); + END LOOP; + END IF; + -- + RETURN v_Price; + +END; + +$BODY$ +LANGUAGE 'plpgsql' STABLE +; + +CREATE OR REPLACE FUNCTION bomqtyavailable (in product_id numeric, in warehouse_id numeric, in locator_id numeric) RETURNS numeric AS +$BODY$ +BEGIN + RETURN bomQtyOnHand(Product_ID, Warehouse_ID, Locator_ID) - bomQtyReserved(Product_ID, Warehouse_ID, Locator_ID); +END; +$BODY$ +LANGUAGE 'plpgsql' STABLE +; + +CREATE OR REPLACE FUNCTION bomqtyonhand (in product_id numeric, in warehouse_id numeric, in locator_id numeric) RETURNS numeric AS +$BODY$ +DECLARE + myWarehouse_ID numeric; + v_Quantity numeric := 99999; -- unlimited + v_IsBOM CHAR(1); + v_IsStocked CHAR(1); + v_ProductType CHAR(1); + v_ProductQty numeric; + v_StdPrecision int; + bom record; + +BEGIN + -- Check Parameters + myWarehouse_ID := Warehouse_ID; + IF (myWarehouse_ID IS NULL) THEN + IF (Locator_ID IS NULL) THEN + RETURN 0; + ELSE + SELECT SUM(M_Warehouse_ID) INTO myWarehouse_ID + FROM M_LOCATOR + WHERE M_Locator_ID=Locator_ID; + END IF; + END IF; + IF (myWarehouse_ID IS NULL) THEN + RETURN 0; + END IF; + + -- Check, if product exists and if it is stocked + BEGIN + SELECT IsBOM, ProductType, IsStocked + INTO v_IsBOM, v_ProductType, v_IsStocked + FROM M_PRODUCT + WHERE M_Product_ID=Product_ID; + -- + EXCEPTION -- not found + WHEN OTHERS THEN + RETURN 0; + END; + -- Unimited capacity if no item + IF (v_IsBOM='N' AND (v_ProductType<>'I' OR v_IsStocked='N')) THEN + RETURN v_Quantity; + -- Stocked item + ELSIF (v_IsStocked='Y') THEN + -- Get ProductQty + SELECT COALESCE(SUM(QtyOnHand), 0) + INTO v_ProductQty + FROM M_STORAGE s + WHERE M_Product_ID=Product_ID + AND EXISTS (SELECT * FROM M_LOCATOR l WHERE s.M_Locator_ID=l.M_Locator_ID + AND l.M_Warehouse_ID=myWarehouse_ID); + -- + RETURN v_ProductQty; + END IF; + + -- Go though BOM + FOR bom IN -- Get BOM Product info + SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM, p.IsStocked, p.ProductType + FROM M_PRODUCT_BOM b, M_PRODUCT p + WHERE b.M_ProductBOM_ID=p.M_Product_ID + AND b.M_Product_ID=product_ID + AND b.M_ProductBOM_ID != Product_ID + AND p.IsBOM='Y' + AND p.IsVerified='Y' + AND b.IsActive='Y' + LOOP + -- Stocked Items "leaf node" + IF (bom.ProductType = 'I' AND bom.IsStocked = 'Y') THEN + -- Get v_ProductQty + SELECT COALESCE(SUM(QtyOnHand), 0) + INTO v_ProductQty + FROM M_STORAGE s + WHERE M_Product_ID=bom.M_ProductBOM_ID + AND EXISTS (SELECT * FROM M_LOCATOR l WHERE s.M_Locator_ID=l.M_Locator_ID + AND l.M_Warehouse_ID=myWarehouse_ID); + -- Get Rounding Precision + SELECT COALESCE(MAX(u.StdPrecision), 0) + INTO v_StdPrecision + FROM C_UOM u, M_PRODUCT p + WHERE u.C_UOM_ID=p.C_UOM_ID AND p.M_Product_ID=bom.M_ProductBOM_ID; + -- How much can we make with this product + v_ProductQty := ROUND (v_ProductQty/bom.BOMQty, v_StdPrecision); + -- How much can we make overall + IF (v_ProductQty < v_Quantity) THEN + v_Quantity := v_ProductQty; + END IF; + -- Another BOM + ELSIF (bom.IsBOM = 'Y') THEN + v_ProductQty := Bomqtyonhand (bom.M_ProductBOM_ID, myWarehouse_ID, Locator_ID); + -- How much can we make overall + IF (v_ProductQty < v_Quantity) THEN + v_Quantity := v_ProductQty; + END IF; + END IF; + END LOOP; -- BOM + + IF (v_Quantity > 0) THEN + -- Get Rounding Precision for Product + SELECT COALESCE(MAX(u.StdPrecision), 0) + INTO v_StdPrecision + FROM C_UOM u, M_PRODUCT p + WHERE u.C_UOM_ID=p.C_UOM_ID AND p.M_Product_ID=Product_ID; + -- + RETURN ROUND (v_Quantity, v_StdPrecision); + END IF; + RETURN 0; +END; +$BODY$ +LANGUAGE 'plpgsql' STABLE +; + +CREATE OR REPLACE FUNCTION bomqtyordered (in p_product_id numeric, in p_warehouse_id numeric, in p_locator_id numeric) RETURNS numeric AS +$BODY$ +DECLARE + v_Warehouse_ID numeric; + v_Quantity numeric := 99999; -- unlimited + v_IsBOM CHAR(1); + v_IsStocked CHAR(1); + v_ProductType CHAR(1); + v_ProductQty numeric; + v_StdPrecision int; + bom record; +BEGIN + -- Check Parameters + v_Warehouse_ID := p_Warehouse_ID; + IF (v_Warehouse_ID IS NULL) THEN + IF (p_Locator_ID IS NULL) THEN + RETURN 0; + ELSE + SELECT MAX(M_Warehouse_ID) INTO v_Warehouse_ID + FROM M_LOCATOR + WHERE M_Locator_ID=p_Locator_ID; + END IF; + END IF; + IF (v_Warehouse_ID IS NULL) THEN + RETURN 0; + END IF; + + -- Check, if product exists and if it is stocked + BEGIN + SELECT IsBOM, ProductType, IsStocked + INTO v_IsBOM, v_ProductType, v_IsStocked + FROM M_PRODUCT + WHERE M_Product_ID=p_Product_ID; + -- + EXCEPTION -- not found + WHEN OTHERS THEN + RETURN 0; + END; + + -- No reservation for non-stocked + IF (v_IsBOM='N' AND (v_ProductType<>'I' OR v_IsStocked='N')) THEN + RETURN 0; + -- Stocked item + ELSIF (v_IsStocked='Y') THEN + -- Get ProductQty + SELECT COALESCE(SUM(Qty), 0) + INTO v_ProductQty + FROM M_StorageReservation + WHERE M_Product_ID=p_Product_ID + AND M_Warehouse_ID=v_Warehouse_ID + AND IsSOTrx='N' + AND IsActive='Y'; + -- + RETURN v_ProductQty; + END IF; + + -- Go though BOM + FOR bom IN + -- Get BOM Product info + SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM, p.IsStocked, p.ProductType + FROM M_PRODUCT_BOM b, M_PRODUCT p + WHERE b.M_ProductBOM_ID=p.M_Product_ID + AND b.M_Product_ID=p_Product_ID + AND b.M_ProductBOM_ID != p_Product_ID + AND p.IsBOM='Y' + AND p.IsVerified='Y' + AND b.IsActive='Y' + LOOP + -- Stocked Items "leaf node" + IF (bom.ProductType = 'I' AND bom.IsStocked = 'Y') THEN + -- Get ProductQty + SELECT COALESCE(SUM(Qty), 0) + INTO v_ProductQty + FROM M_StorageReservation + WHERE M_Product_ID=p_Product_ID + AND M_Warehouse_ID=v_Warehouse_ID + AND IsSOTrx='N' + AND IsActive='Y'; + -- Get Rounding Precision + SELECT COALESCE(MAX(u.StdPrecision), 0) + INTO v_StdPrecision + FROM C_UOM u, M_PRODUCT p + WHERE u.C_UOM_ID=p.C_UOM_ID AND p.M_Product_ID=bom.M_ProductBOM_ID; + -- How much can we make with this product + v_ProductQty := ROUND (v_ProductQty/bom.BOMQty, v_StdPrecision ); + + -- How much can we make overall + IF (v_ProductQty < v_Quantity) THEN + v_Quantity := v_ProductQty; + END IF; + -- Another BOM + ELSIF (bom.IsBOM = 'Y') THEN + v_ProductQty := Bomqtyordered (bom.M_ProductBOM_ID, v_Warehouse_ID, p_Locator_ID); + -- How much can we make overall + IF (v_ProductQty < v_Quantity) THEN + v_Quantity := v_ProductQty; + END IF; + END IF; + END LOOP; -- BOM + + -- Unlimited (e.g. only services) + IF (v_Quantity = 99999) THEN + RETURN 0; + END IF; + + IF (v_Quantity > 0) THEN + -- Get Rounding Precision for Product + SELECT COALESCE(MAX(u.StdPrecision), 0) + INTO v_StdPrecision + FROM C_UOM u, M_PRODUCT p + WHERE u.C_UOM_ID=p.C_UOM_ID AND p.M_Product_ID=p_Product_ID; + -- + RETURN ROUND (v_Quantity, v_StdPrecision ); + END IF; + -- + RETURN 0; +END; +$BODY$ + LANGUAGE plpgsql STABLE; + +CREATE OR REPLACE FUNCTION bomqtyreserved (in p_product_id numeric, in p_warehouse_id numeric, in p_locator_id numeric) RETURNS numeric AS +$BODY$ +DECLARE + v_Warehouse_ID numeric; + v_Quantity numeric := 99999; -- unlimited + v_IsBOM CHAR(1); + v_IsStocked CHAR(1); + v_ProductType CHAR(1); + v_ProductQty numeric; + v_StdPrecision int; + bom record; +BEGIN + -- Check Parameters + v_Warehouse_ID := p_Warehouse_ID; + IF (v_Warehouse_ID IS NULL) THEN + IF (p_Locator_ID IS NULL) THEN + RETURN 0; + ELSE + SELECT MAX(M_Warehouse_ID) INTO v_Warehouse_ID + FROM M_LOCATOR + WHERE M_Locator_ID=p_Locator_ID; + END IF; + END IF; + IF (v_Warehouse_ID IS NULL) THEN + RETURN 0; + END IF; + + -- Check, if product exists and if it is stocked + BEGIN + SELECT IsBOM, ProductType, IsStocked + INTO v_IsBOM, v_ProductType, v_IsStocked + FROM M_PRODUCT + WHERE M_Product_ID=p_Product_ID; + -- + EXCEPTION -- not found + WHEN OTHERS THEN + RETURN 0; + END; + + -- No reservation for non-stocked + IF (v_IsBOM='N' AND (v_ProductType<>'I' OR v_IsStocked='N')) THEN + RETURN 0; + -- Stocked item + ELSIF (v_IsStocked='Y') THEN + -- Get ProductQty + SELECT COALESCE(SUM(Qty), 0) + INTO v_ProductQty + FROM M_StorageReservation + WHERE M_Product_ID=p_Product_ID + AND M_Warehouse_ID=v_Warehouse_ID + AND IsSOTrx='Y' + AND IsActive='Y'; + -- + RETURN v_ProductQty; + END IF; + + -- Go though BOM + FOR bom IN + -- Get BOM Product info + SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM, p.IsStocked, p.ProductType + FROM M_PRODUCT_BOM b, M_PRODUCT p + WHERE b.M_ProductBOM_ID=p.M_Product_ID + AND b.M_Product_ID=p_Product_ID + AND b.M_ProductBOM_ID != p_Product_ID + AND p.IsBOM='Y' + AND p.IsVerified='Y' + AND b.IsActive='Y' + LOOP + -- Stocked Items "leaf node" + IF (bom.ProductType = 'I' AND bom.IsStocked = 'Y') THEN + -- Get ProductQty + SELECT COALESCE(SUM(Qty), 0) + INTO v_ProductQty + FROM M_StorageReservation + WHERE M_Product_ID=bom.M_ProductBOM_ID + AND M_Warehouse_ID =v_Warehouse_ID + AND IsSOTrx='Y' + AND IsActive='Y'; + -- Get Rounding Precision + SELECT COALESCE(MAX(u.StdPrecision), 0) + INTO v_StdPrecision + FROM C_UOM u, M_PRODUCT p + WHERE u.C_UOM_ID=p.C_UOM_ID AND p.M_Product_ID=bom.M_ProductBOM_ID; + -- How much can we make with this product + v_ProductQty := ROUND (v_ProductQty/bom.BOMQty, v_StdPrecision); + -- How much can we make overall + IF (v_ProductQty < v_Quantity) THEN + v_Quantity := v_ProductQty; + END IF; + -- Another BOM + ELSIF (bom.IsBOM = 'Y') THEN + v_ProductQty := Bomqtyreserved (bom.M_ProductBOM_ID, v_Warehouse_ID, p_Locator_ID); + -- How much can we make overall + IF (v_ProductQty < v_Quantity) THEN + v_Quantity := v_ProductQty; + END IF; + END IF; + END LOOP; -- BOM + + -- Unlimited (e.g. only services) + IF (v_Quantity = 99999) THEN + RETURN 0; + END IF; + + IF (v_Quantity > 0) THEN + -- Get Rounding Precision for Product + SELECT COALESCE(MAX(u.StdPrecision), 0) + INTO v_StdPrecision + FROM C_UOM u, M_PRODUCT p + WHERE u.C_UOM_ID=p.C_UOM_ID AND p.M_Product_ID=p_Product_ID; + -- + RETURN ROUND (v_Quantity, v_StdPrecision); + END IF; + RETURN 0; +END; +$BODY$ + LANGUAGE plpgsql STABLE; + + +SELECT register_migration_script('201405160521_IDEMPIERE-1953.sql') FROM dual +; \ No newline at end of file diff --git a/migration/i2.0z/oracle/201403311258_Ticket_1003856.sql b/migration/i2.0z/oracle/201403311258_Ticket_1003856.sql new file mode 100644 index 0000000000..776c441fce --- /dev/null +++ b/migration/i2.0z/oracle/201403311258_Ticket_1003856.sql @@ -0,0 +1,184 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Mar 28, 2014 6:34:26 PM SGT +-- Ticket #1003856: Run report as a background job +INSERT INTO AD_Element (ColumnName,AD_Element_ID,Name,PrintName,AD_Element_UU,Created,Updated,AD_Org_ID,CreatedBy,UpdatedBy,IsActive,AD_Client_ID,EntityType) VALUES ('IsRunAsJob',202694,'Run as Job','Run as Job','c52c9e5a-da3e-401d-8f52-e58f557a56f2',TO_DATE('2014-03-28 18:34:24','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2014-03-28 18:34:24','YYYY-MM-DD HH24:MI:SS'),0,100,100,'Y',0,'D') +; + +-- Mar 28, 2014 6:35:05 PM SGT +INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,DefaultValue,Name,IsAllowCopy,Updated,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,IsEncrypted,IsSecure,FKConstraintType,AD_Element_ID,AD_Reference_ID,AD_Table_ID,EntityType) VALUES (0,'N',0,211199,'Y','N','N',0,'N',1,'N','N','N','Y','e67be641-2f1b-4c6b-9c8a-a6788940a686','Y','IsRunAsJob','N','Run as Job','Y',TO_DATE('2014-03-28 18:35:03','YYYY-MM-DD HH24:MI:SS'),100,0,'Y',TO_DATE('2014-03-28 18:35:03','YYYY-MM-DD HH24:MI:SS'),100,'N','N',0,'N','N','N',202694,20,282,'D') +; + +-- Mar 28, 2014 6:38:03 PM SGT +INSERT INTO AD_Element (ColumnName,AD_Element_ID,Name,PrintName,AD_Element_UU,Created,Updated,AD_Org_ID,CreatedBy,UpdatedBy,IsActive,AD_Client_ID,EntityType) VALUES ('IsJobProcessing',202695,'Job Processing','Job Processing','54265662-ebe2-4521-ba7e-8a9f9a96bcab',TO_DATE('2014-03-28 18:38:02','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2014-03-28 18:38:02','YYYY-MM-DD HH24:MI:SS'),0,100,100,'Y',0,'D') +; + +-- Mar 28, 2014 6:38:22 PM SGT +INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,DefaultValue,Name,IsAllowCopy,Updated,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,IsEncrypted,IsSecure,FKConstraintType,AD_Element_ID,AD_Reference_ID,AD_Table_ID,EntityType) VALUES (0,'N',0,211200,'Y','N','N',0,'N',1,'N','N','N','Y','922b7724-599a-49c8-a053-0f8f4b8e2156','Y','IsJobProcessing','N','Job Processing','Y',TO_DATE('2014-03-28 18:38:21','YYYY-MM-DD HH24:MI:SS'),100,0,'Y',TO_DATE('2014-03-28 18:38:21','YYYY-MM-DD HH24:MI:SS'),100,'N','N',0,'N','N','N',202695,20,282,'D') +; + +-- Mar 28, 2014 6:38:42 PM SGT +INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,Description,Help,Name,IsAllowCopy,Updated,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,IsEncrypted,IsSecure,AD_Element_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,EntityType) VALUES (0,'N',0,211201,'N','N','N',0,'N',2,'N','N','N','Y','5c07ac2d-8342-4e86-ae06-5109f872a16b','Y','NotificationType','Type of Notifications','Emails or Notification sent out for Request Updates, etc.','Notification Type','Y',TO_DATE('2014-03-28 18:38:41','YYYY-MM-DD HH24:MI:SS'),100,0,'Y',TO_DATE('2014-03-28 18:38:41','YYYY-MM-DD HH24:MI:SS'),100,'N','N',0,'N','N',2755,17,200026,282,'D') +; + +-- Mar 28, 2014 6:43:27 PM SGT +ALTER TABLE AD_PInstance ADD IsRunAsJob CHAR(1) DEFAULT 'N' +; + +-- Mar 28, 2014 6:43:44 PM SGT +ALTER TABLE AD_PInstance ADD IsJobProcessing CHAR(1) DEFAULT 'N' +; + +-- Mar 28, 2014 6:43:51 PM SGT +ALTER TABLE AD_PInstance ADD NotificationType VARCHAR2(2) DEFAULT NULL +; + +-- Mar 28, 2014 6:44:35 PM SGT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,EntityType,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID) VALUES ('N',663,36,'N','N',110,'Y',202844,'N','D','AD_PInstance_UU','3540b3cc-efe6-4509-bafc-a15c59c9d7f8','N','N',100,0,TO_DATE('2014-03-28 18:44:34','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2014-03-28 18:44:34','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60451) +; + +-- Mar 28, 2014 6:44:36 PM SGT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,EntityType,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,CreatedBy,Updated,IsActive,XPosition,AD_Client_ID,ColumnSpan,AD_Column_ID) VALUES ('N',663,1,'N','N',120,'Y',202845,'N','D','Run as Job','72ecc44d-a61b-44b9-a94a-14bd270dbf22','Y','N',100,0,TO_DATE('2014-03-28 18:44:35','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2014-03-28 18:44:35','YYYY-MM-DD HH24:MI:SS'),'Y',2,0,2,211199) +; + +-- Mar 28, 2014 6:44:37 PM SGT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,EntityType,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,CreatedBy,Updated,IsActive,XPosition,AD_Client_ID,ColumnSpan,AD_Column_ID) VALUES ('N',663,1,'N','N',130,'Y',202846,'N','D','Job Processing','96118891-6592-4f41-8ba0-05057e17d60e','Y','N',100,0,TO_DATE('2014-03-28 18:44:36','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2014-03-28 18:44:36','YYYY-MM-DD HH24:MI:SS'),'Y',2,0,2,211200) +; + +-- Mar 28, 2014 6:44:38 PM SGT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,EntityType,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,CreatedBy,Updated,IsActive,AD_Client_ID,ColumnSpan,AD_Column_ID) VALUES ('N',663,2,'N','N',140,'Y',202847,'N','Emails or Notification sent out for Request Updates, etc.','D','Type of Notifications','Notification Type','d76699c8-2abe-4f62-9e10-6e10fd5dba20','Y','N',100,0,TO_DATE('2014-03-28 18:44:37','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2014-03-28 18:44:37','YYYY-MM-DD HH24:MI:SS'),'Y',0,2,211201) +; + +-- Mar 28, 2014 6:45:04 PM SGT +UPDATE AD_Field SET SeqNo=0,IsDisplayed='N' WHERE AD_Field_ID=202844 +; + +-- Mar 28, 2014 6:45:04 PM SGT +UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y' WHERE AD_Field_ID=202845 +; + +-- Mar 28, 2014 6:45:04 PM SGT +UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y' WHERE AD_Field_ID=202847 +; + +-- Mar 28, 2014 6:45:11 PM SGT +UPDATE AD_Field SET SeqNoGrid=110,IsDisplayedGrid='Y' WHERE AD_Field_ID=202845 +; + +-- Mar 28, 2014 6:45:11 PM SGT +UPDATE AD_Field SET SeqNoGrid=120,IsDisplayedGrid='Y' WHERE AD_Field_ID=202847 +; + +-- Mar 28, 2014 6:45:11 PM SGT +UPDATE AD_Field SET SeqNoGrid=130,IsDisplayedGrid='Y' WHERE AD_Field_ID=202846 +; + +-- Mar 28, 2014 6:46:01 PM SGT +INSERT INTO AD_FieldGroup (FieldGroupType,EntityType,IsCollapsedByDefault,Name,AD_FieldGroup_UU,AD_FieldGroup_ID,Created,CreatedBy,Updated,AD_Org_ID,UpdatedBy,IsActive,AD_Client_ID) VALUES ('C','D','N','Background Job','3be13370-89e4-42b3-8220-370ce497466a',200018,TO_DATE('2014-03-28 18:46:00','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2014-03-28 18:46:00','YYYY-MM-DD HH24:MI:SS'),0,100,'Y',0) +; + +-- Mar 28, 2014 6:46:18 PM SGT +UPDATE AD_Field SET AD_FieldGroup_ID=200018,Updated=TO_DATE('2014-03-28 18:46:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202847 +; + +-- Mar 28, 2014 6:46:22 PM SGT +UPDATE AD_Field SET AD_FieldGroup_ID=200018,Updated=TO_DATE('2014-03-28 18:46:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202845 +; + +-- Mar 28, 2014 6:46:28 PM SGT +UPDATE AD_Field SET AD_FieldGroup_ID=200018,Updated=TO_DATE('2014-03-28 18:46:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202846 +; + +-- Mar 28, 2014 6:46:44 PM SGT +UPDATE AD_Field SET IsSameLine='Y', XPosition=4,Updated=TO_DATE('2014-03-28 18:46:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202847 +; + +-- Mar 28, 2014 6:49:07 PM SGT +INSERT INTO AD_SysConfig (AD_SysConfig_ID,ConfigurationLevel,Value,AD_SysConfig_UU,Updated,Created,AD_Org_ID,CreatedBy,IsActive,UpdatedBy,Name,AD_Client_ID,EntityType) VALUES (200047,'C','Y','feb88039-2fe8-47e5-a7be-c3a634674f0b',TO_DATE('2014-03-28 18:49:06','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2014-03-28 18:49:06','YYYY-MM-DD HH24:MI:SS'),0,100,'Y',100,'BACKGROUND_JOB_ALLOWED',0,'D') +; + +-- Mar 28, 2014 6:49:31 PM SGT +INSERT INTO AD_SysConfig (AD_SysConfig_ID,ConfigurationLevel,Value,AD_SysConfig_UU,Updated,Created,AD_Org_ID,CreatedBy,IsActive,UpdatedBy,Name,AD_Client_ID,EntityType) VALUES (200048,'C','N','f2fd6f9b-d8bb-4ade-9857-78ba68951776',TO_DATE('2014-03-28 18:49:30','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2014-03-28 18:49:30','YYYY-MM-DD HH24:MI:SS'),0,100,'Y',100,'BACKGROUND_JOB_BY_DEFAULT',0,'D') +; + +-- Mar 28, 2014 6:50:36 PM SGT +INSERT INTO AD_SysConfig (AD_SysConfig_ID,ConfigurationLevel,Value,AD_SysConfig_UU,Updated,Created,AD_Org_ID,CreatedBy,IsActive,UpdatedBy,Name,AD_Client_ID,EntityType) VALUES (200049,'S','20','0a24332e-a83a-465a-903f-6f3d7caea306',TO_DATE('2014-03-28 18:50:35','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2014-03-28 18:50:35','YYYY-MM-DD HH24:MI:SS'),0,100,'Y',100,'BACKGROUND_JOB_MAX_IN_SYSTEM',0,'D') +; + +-- Mar 28, 2014 6:51:09 PM SGT +INSERT INTO AD_SysConfig (AD_SysConfig_ID,ConfigurationLevel,Value,AD_SysConfig_UU,Updated,Created,AD_Org_ID,CreatedBy,IsActive,UpdatedBy,Name,AD_Client_ID,EntityType) VALUES (200050,'C','10','d2d149e8-e642-4691-8ed3-8a875ee9b1ed',TO_DATE('2014-03-28 18:51:08','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2014-03-28 18:51:08','YYYY-MM-DD HH24:MI:SS'),0,100,'Y',100,'BACKGROUND_JOB_MAX_PER_CLIENT',0,'D') +; + +-- Mar 28, 2014 6:52:26 PM SGT +INSERT INTO AD_SysConfig (AD_SysConfig_ID,ConfigurationLevel,Value,AD_SysConfig_UU,Updated,Created,AD_Org_ID,CreatedBy,IsActive,UpdatedBy,Name,AD_Client_ID,EntityType) VALUES (200051,'C','10','b0697150-68d7-4cfe-b103-f626db07793a',TO_DATE('2014-03-28 18:52:25','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2014-03-28 18:52:25','YYYY-MM-DD HH24:MI:SS'),0,100,'Y',100,'BACKGROUND_JOB_MAX_PER_USER',0,'D') +; + +-- Mar 28, 2014 6:53:28 PM SGT +UPDATE AD_SysConfig SET Value='5',Updated=TO_DATE('2014-03-28 18:53:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_SysConfig_ID=200051 +; + +-- Mar 28, 2014 6:54:11 PM SGT +UPDATE AD_SysConfig SET ConfigurationLevel='S',Updated=TO_DATE('2014-03-28 18:54:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_SysConfig_ID=200050 +; + +-- Mar 28, 2014 6:58:22 PM SGT +INSERT INTO PA_DashboardContent (Line,PA_DashboardContent_ID,ColumnNo,IsCollapsible,GoalDisplay,Description,Name,PA_DashboardContent_UU,IsShowInDashboard,AD_Org_ID,Created,CreatedBy,Updated,AD_Client_ID,UpdatedBy,IsActive,IsEmbedReportContent,IsCollapsedByDefault,AD_Role_ID,IsShowinLogin,ZulFilePath,AD_User_ID) VALUES (3.000000000000,200002,0,'Y','T','Running Jobs','Running Jobs','e3fb872e-ce14-4029-830b-2d21a556fc60','Y',0,TO_DATE('2014-03-28 18:58:20','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2014-03-28 18:58:20','YYYY-MM-DD HH24:MI:SS'),0,100,'Y','N','N',0,'Y','/zul/runningJobs.zul',0) +; + +-- Mar 28, 2014 7:57:19 PM SGT +-- Ticket #1003856: Run report as a background job +UPDATE AD_Column SET AD_Reference_Value_ID=344,Updated=TO_DATE('2014-03-28 19:57:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=211201 +; + +-- Mar 28, 2014 7:58:52 PM SGT +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,Created,EntityType,AD_Client_ID,AD_Org_ID) VALUES ('E','Exceed maximum number of running jobs allowed per user',200263,'82593e5f-86c6-45c5-bc38-4d9d5b2c8609','BackgroundJobExceedMaxPerUser','Y',TO_DATE('2014-03-28 19:58:49','YYYY-MM-DD HH24:MI:SS'),100,100,TO_DATE('2014-03-28 19:58:49','YYYY-MM-DD HH24:MI:SS'),'D',0,0) +; + +-- Mar 28, 2014 7:59:12 PM SGT +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,Created,EntityType,AD_Client_ID,AD_Org_ID) VALUES ('E','Exceed maximum number of running jobs allowed per client',200264,'fcebfad5-8283-498e-a835-b42bf0a0219a','BackgroundJobExceedMaxPerClient','Y',TO_DATE('2014-03-28 19:59:11','YYYY-MM-DD HH24:MI:SS'),100,100,TO_DATE('2014-03-28 19:59:11','YYYY-MM-DD HH24:MI:SS'),'D',0,0) +; + +-- Mar 28, 2014 7:59:51 PM SGT +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,Created,EntityType,AD_Client_ID,AD_Org_ID) VALUES ('E','Exceed maximum number of running jobs allowed in the system',200265,'405ea4c2-5a19-42fa-a5ff-f22601453f7f','BackgroundJobExceedMaxInSystem','Y',TO_DATE('2014-03-28 19:59:50','YYYY-MM-DD HH24:MI:SS'),100,100,TO_DATE('2014-03-28 19:59:50','YYYY-MM-DD HH24:MI:SS'),'D',0,0) +; + +-- Mar 28, 2014 8:00:19 PM SGT +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,Created,EntityType,AD_Client_ID,AD_Org_ID) VALUES ('I','The process has been scheduled as job. The status of the process will be sent as notification to owner of the process.',200266,'dc68fd3b-0ce8-416c-a286-37f192a90f7d','BackgroundJobScheduled','Y',TO_DATE('2014-03-28 20:00:18','YYYY-MM-DD HH24:MI:SS'),100,100,TO_DATE('2014-03-28 20:00:18','YYYY-MM-DD HH24:MI:SS'),'D',0,0) +; + +-- Mar 28, 2014 9:03:01 PM SGT +-- Ticket #1003856: Run report as a background job +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,Created,EntityType,AD_Client_ID,AD_Org_ID) VALUES ('I','Background Job',200267,'530545f2-f32c-4072-8bd1-d9ca65f31f65','BackgroundJob','Y',TO_DATE('2014-03-28 21:02:59','YYYY-MM-DD HH24:MI:SS'),100,100,TO_DATE('2014-03-28 21:02:59','YYYY-MM-DD HH24:MI:SS'),'D',0,0) +; + +-- Mar 31, 2014 5:54:16 PM SGT +-- Ticket #1003856: Run report as a background job +DELETE FROM AD_Field_Trl WHERE AD_Field_ID=202846 +; + +-- Mar 31, 2014 5:54:16 PM SGT +DELETE FROM AD_Field WHERE AD_Field_ID=202846 +; + +-- Mar 31, 2014 5:54:49 PM SGT +DELETE FROM AD_Column_Trl WHERE AD_Column_ID=211200 +; + +-- Mar 31, 2014 5:54:49 PM SGT +DELETE FROM AD_Column WHERE AD_Column_ID=211200 +; + +-- Mar 31, 2014 5:54:56 PM SGT +DELETE FROM AD_Element_Trl WHERE AD_Element_ID=202695 +; + +-- Mar 31, 2014 5:54:56 PM SGT +DELETE FROM AD_Element WHERE AD_Element_ID=202695 +; + +ALTER TABLE AD_PInstance DROP COLUMN IsJobProcessing +; + +SELECT register_migration_script('201403311258_Ticket_1003856.sql') FROM dual +; \ No newline at end of file diff --git a/migration/i2.0z/oracle/201404020400_Ticket_1003862.sql b/migration/i2.0z/oracle/201404020400_Ticket_1003862.sql new file mode 100644 index 0000000000..4ea3710de1 --- /dev/null +++ b/migration/i2.0z/oracle/201404020400_Ticket_1003862.sql @@ -0,0 +1,7 @@ +-- Apr 2, 2014 3:38:01 PM COT +-- 1003862-Barcode type UPC A is needed for print formats going to Amazon +INSERT INTO AD_Ref_List (AD_Client_ID,AD_Org_ID,AD_Reference_ID,AD_Ref_List_ID,AD_Ref_List_UU,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,Value) VALUES (0,0,377,200176,'79d36566-b888-4fc1-931d-c0b1612c709b',TO_DATE('2014-04-02 15:53:38','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','UPC-A',TO_DATE('2014-04-02 15:53:38','YYYY-MM-DD HH24:MI:SS'),100,'UPA') +; + +SELECT register_migration_script('201404020400_Ticket_1003862.sql') FROM dual +; diff --git a/migration/i2.0z/oracle/201405021000_IDEMPIERE-1899.sql b/migration/i2.0z/oracle/201405021000_IDEMPIERE-1899.sql new file mode 100644 index 0000000000..d6921f37c6 --- /dev/null +++ b/migration/i2.0z/oracle/201405021000_IDEMPIERE-1899.sql @@ -0,0 +1,219 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- May 2, 2014 9:15:14 AM CEST +-- IDEMPIERE-1899 +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Element_UU,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,202698,'644f9b63-6ded-406e-abec-44d87375820a',0,'R_DefaultMailText_ID',TO_DATE('2014-05-02 09:15:13','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Default mail template','Default mail template',TO_DATE('2014-05-02 09:15:13','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- May 2, 2014 9:15:31 AM CEST +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Element_UU,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,202699,'05f5cb33-9346-4d6d-81c0-26c599af9b5a',0,'IsAddMailTextAutomatically',TO_DATE('2014-05-02 09:15:30','YYYY-MM-DD HH24:MI:SS'),100,'The selected mail template will be automatically inserted when creating an email','D','Y','Add Mail Text Automatically','Add Mail Text Automatically',TO_DATE('2014-05-02 09:15:30','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- May 2, 2014 9:15:50 AM CEST +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Column_UU,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FKConstraintType,FieldLength,IsActive,IsAllowCopy,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSecure,IsSelectionColumn,IsSyncDatabase,IsToolbarButton,IsTranslated,IsUpdateable,Name,SeqNo,SeqNoSelection,Updated,UpdatedBy,Version) VALUES (0,211208,'9cc67589-fb40-4206-9f03-4057670ed430',202699,0,20,114,'IsAddMailTextAutomatically',TO_DATE('2014-05-02 09:15:49','YYYY-MM-DD HH24:MI:SS'),100,'N','The selected mail template will be automatically inserted when creating an email','D','N',1,'Y','Y','Y','N','N','N','N','N','Y','N','N','N','N','N','N','Y','Add Mail Text Automatically',0,0,TO_DATE('2014-05-02 09:15:49','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- May 2, 2014 9:15:54 AM CEST +ALTER TABLE AD_User ADD IsAddMailTextAutomatically CHAR(1) DEFAULT 'N' CHECK (IsAddMailTextAutomatically IN ('Y','N')) NOT NULL +; + +-- May 2, 2014 9:16:15 AM CEST +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Column_UU,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FKConstraintType,FieldLength,IsActive,IsAllowCopy,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSecure,IsSelectionColumn,IsSyncDatabase,IsToolbarButton,IsTranslated,IsUpdateable,Name,SeqNo,SeqNoSelection,Updated,UpdatedBy,Version) VALUES (0,211209,'2ecd8ac6-61d1-4062-85d9-2968e5a8f74c',202698,0,18,274,114,'R_DefaultMailText_ID',TO_DATE('2014-05-02 09:16:14','YYYY-MM-DD HH24:MI:SS'),100,'D','N',10,'Y','Y','Y','N','N','N','N','N','N','N','N','N','N','N','N','Y','Default mail template',0,0,TO_DATE('2014-05-02 09:16:14','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- May 2, 2014 9:16:15 AM CEST +UPDATE AD_Column SET FKConstraintName='RDEFAULTMAILTEXT_ADUSER', FKConstraintType='N',Updated=TO_DATE('2014-05-02 09:16:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=211209 +; + +-- May 14, 2014 10:24:01 AM COT +ALTER TABLE AD_User ADD R_DefaultMailText_ID NUMBER(10) DEFAULT NULL +; + +-- May 14, 2014 10:24:02 AM COT +ALTER TABLE AD_User ADD CONSTRAINT RDefaultMailText_ADUser FOREIGN KEY (R_DefaultMailText_ID) REFERENCES r_mailtext(r_mailtext_id) DEFERRABLE INITIALLY DEFERRED +; + +-- May 2, 2014 9:16:27 AM CEST +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Field_UU,AD_Org_ID,AD_Tab_ID,ColumnSpan,Created,CreatedBy,Description,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,Updated,UpdatedBy,XPosition) VALUES (0,211208,202875,'b020eaab-a12c-4b5a-80ba-8c12f2cba674',0,118,2,TO_DATE('2014-05-02 09:16:27','YYYY-MM-DD HH24:MI:SS'),100,'The selected mail template will be automatically inserted when creating an email',1,'D','Y','Y','Y','N','N','N','N','N','Add Mail Text Automatically',520,TO_DATE('2014-05-02 09:16:27','YYYY-MM-DD HH24:MI:SS'),100,2) +; + +-- May 2, 2014 9:16:28 AM CEST +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Field_UU,AD_Org_ID,AD_Tab_ID,ColumnSpan,Created,CreatedBy,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,Updated,UpdatedBy) VALUES (0,211209,202876,'ef99b478-48c3-4f2f-b276-7ae8695ab14a',0,118,2,TO_DATE('2014-05-02 09:16:27','YYYY-MM-DD HH24:MI:SS'),100,10,'D','Y','Y','Y','N','N','N','N','N','Default mail template',530,TO_DATE('2014-05-02 09:16:27','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- May 2, 2014 9:17:07 AM CEST +UPDATE AD_Field SET SeqNo=0,IsDisplayed='N' WHERE AD_Field_ID=12640 +; + +-- May 2, 2014 9:17:07 AM CEST +UPDATE AD_Field SET SeqNo=260,IsDisplayed='Y' WHERE AD_Field_ID=200072 +; + +-- May 2, 2014 9:17:07 AM CEST +UPDATE AD_Field SET SeqNo=270,IsDisplayed='Y' WHERE AD_Field_ID=202876 +; + +-- May 2, 2014 9:17:07 AM CEST +UPDATE AD_Field SET SeqNo=280,IsDisplayed='Y' WHERE AD_Field_ID=202875 +; + +-- May 2, 2014 9:17:07 AM CEST +UPDATE AD_Field SET SeqNo=290,IsDisplayed='Y' WHERE AD_Field_ID=6513 +; + +-- May 2, 2014 9:17:07 AM CEST +UPDATE AD_Field SET SeqNo=300,IsDisplayed='Y' WHERE AD_Field_ID=11525 +; + +-- May 2, 2014 9:17:07 AM CEST +UPDATE AD_Field SET SeqNo=310,IsDisplayed='Y' WHERE AD_Field_ID=6520 +; + +-- May 2, 2014 9:17:07 AM CEST +UPDATE AD_Field SET SeqNo=320,IsDisplayed='Y' WHERE AD_Field_ID=8342 +; + +-- May 2, 2014 9:17:07 AM CEST +UPDATE AD_Field SET SeqNo=330,IsDisplayed='Y' WHERE AD_Field_ID=6519 +; + +-- May 2, 2014 9:17:07 AM CEST +UPDATE AD_Field SET SeqNo=340,IsDisplayed='Y' WHERE AD_Field_ID=200405 +; + +-- May 2, 2014 9:17:07 AM CEST +UPDATE AD_Field SET SeqNo=350,IsDisplayed='Y' WHERE AD_Field_ID=200400 +; + +-- May 2, 2014 9:17:07 AM CEST +UPDATE AD_Field SET SeqNo=360,IsDisplayed='Y' WHERE AD_Field_ID=200403 +; + +-- May 2, 2014 9:17:07 AM CEST +UPDATE AD_Field SET SeqNo=370,IsDisplayed='Y' WHERE AD_Field_ID=200401 +; + +-- May 2, 2014 9:17:08 AM CEST +UPDATE AD_Field SET SeqNo=380,IsDisplayed='Y' WHERE AD_Field_ID=200406 +; + +-- May 2, 2014 9:17:08 AM CEST +UPDATE AD_Field SET SeqNo=390,IsDisplayed='Y' WHERE AD_Field_ID=200402 +; + +-- May 2, 2014 9:17:08 AM CEST +UPDATE AD_Field SET SeqNo=400,IsDisplayed='Y' WHERE AD_Field_ID=200474 +; + +-- May 2, 2014 9:17:08 AM CEST +UPDATE AD_Field SET SeqNo=410,IsDisplayed='Y' WHERE AD_Field_ID=200475 +; + +-- May 2, 2014 9:17:08 AM CEST +UPDATE AD_Field SET SeqNo=420,IsDisplayed='Y' WHERE AD_Field_ID=200473 +; + +-- May 2, 2014 9:17:18 AM CEST +UPDATE AD_Field SET IsSameLine='Y',Updated=TO_DATE('2014-05-02 09:17:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202875 +; + +-- May 2, 2014 9:19:54 AM CEST +-- IDEMPIERE-1899 +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=280, XPosition=5,Updated=TO_DATE('2014-05-02 09:19:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=202875 +; + +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- May 2, 2014 9:37:13 AM CEST +-- IDEMPIERE-1899 +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200273,'43ee6fb2-59e7-4af2-bf73-b5baf5af5a3a',0,TO_DATE('2014-05-02 09:37:13','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Add default mail text content','I',TO_DATE('2014-05-02 09:37:13','YYYY-MM-DD HH24:MI:SS'),100,'AddDefaultMailTextContent') +; + +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- May 2, 2014 9:38:51 AM CEST +-- IDEMPIERE-1899 +UPDATE AD_Column SET EntityType='D',Updated=TO_DATE('2014-05-02 09:38:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=211208 +; + +-- May 2, 2014 9:38:58 AM CEST +UPDATE AD_Column SET EntityType='D',Updated=TO_DATE('2014-05-02 09:38:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=211209 +; + +-- May 2, 2014 9:39:11 AM CEST +UPDATE AD_Field SET EntityType='D',Updated=TO_DATE('2014-05-02 09:39:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202876 +; + +-- May 2, 2014 9:39:13 AM CEST +UPDATE AD_Field SET EntityType='D',Updated=TO_DATE('2014-05-02 09:39:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202875 +; + +-- May 14, 2014 10:54:07 AM COT +UPDATE AD_Field SET SeqNoGrid=280,IsDisplayedGrid='Y' WHERE AD_Field_ID=202876 +; + +-- May 14, 2014 10:54:07 AM COT +UPDATE AD_Field SET SeqNoGrid=290,IsDisplayedGrid='Y' WHERE AD_Field_ID=202875 +; + +-- May 14, 2014 10:54:07 AM COT +UPDATE AD_Field SET SeqNoGrid=300,IsDisplayedGrid='Y' WHERE AD_Field_ID=6513 +; + +-- May 14, 2014 10:54:07 AM COT +UPDATE AD_Field SET SeqNoGrid=310,IsDisplayedGrid='Y' WHERE AD_Field_ID=11525 +; + +-- May 14, 2014 10:54:07 AM COT +UPDATE AD_Field SET SeqNoGrid=320,IsDisplayedGrid='Y' WHERE AD_Field_ID=6520 +; + +-- May 14, 2014 10:54:07 AM COT +UPDATE AD_Field SET SeqNoGrid=330,IsDisplayedGrid='Y' WHERE AD_Field_ID=8342 +; + +-- May 14, 2014 10:54:07 AM COT +UPDATE AD_Field SET SeqNoGrid=340,IsDisplayedGrid='Y' WHERE AD_Field_ID=6519 +; + +-- May 14, 2014 10:54:07 AM COT +UPDATE AD_Field SET SeqNoGrid=350,IsDisplayedGrid='Y' WHERE AD_Field_ID=200405 +; + +-- May 14, 2014 10:54:07 AM COT +UPDATE AD_Field SET SeqNoGrid=360,IsDisplayedGrid='Y' WHERE AD_Field_ID=200400 +; + +-- May 14, 2014 10:54:07 AM COT +UPDATE AD_Field SET SeqNoGrid=370,IsDisplayedGrid='Y' WHERE AD_Field_ID=200403 +; + +-- May 14, 2014 10:54:07 AM COT +UPDATE AD_Field SET SeqNoGrid=380,IsDisplayedGrid='Y' WHERE AD_Field_ID=200401 +; + +-- May 14, 2014 10:54:07 AM COT +UPDATE AD_Field SET SeqNoGrid=390,IsDisplayedGrid='Y' WHERE AD_Field_ID=200406 +; + +-- May 14, 2014 10:54:07 AM COT +UPDATE AD_Field SET SeqNoGrid=400,IsDisplayedGrid='Y' WHERE AD_Field_ID=200402 +; + +-- May 14, 2014 10:54:07 AM COT +UPDATE AD_Field SET SeqNoGrid=410,IsDisplayedGrid='Y' WHERE AD_Field_ID=200474 +; + +-- May 14, 2014 10:54:07 AM COT +UPDATE AD_Field SET SeqNoGrid=420,IsDisplayedGrid='Y' WHERE AD_Field_ID=200475 +; + +-- May 14, 2014 10:54:07 AM COT +UPDATE AD_Field SET SeqNoGrid=430,IsDisplayedGrid='Y' WHERE AD_Field_ID=200473 +; + +SELECT register_migration_script('201405021000_IDEMPIERE-1899.sql') FROM dual +; diff --git a/migration/i2.0z/oracle/201405160715_IDEMPIERE-1954.sql b/migration/i2.0z/oracle/201405160715_IDEMPIERE-1954.sql new file mode 100644 index 0000000000..f44003d217 --- /dev/null +++ b/migration/i2.0z/oracle/201405160715_IDEMPIERE-1954.sql @@ -0,0 +1,29 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- May 16, 2014 1:53:34 PM MYT +-- IDEMPIERE-1954 Implement MaxQueryRecords for AD_InfoWindow +INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,Description,DefaultValue,Help,Name,IsAllowCopy,Updated,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,EntityType,IsEncrypted,IsSecure,AD_Element_ID,AD_Table_ID) VALUES (0,'N',1,211240,'Y','N','N',0,'N',10,'N',11,'N','N','Y','8266be38-9b40-4d93-99cb-81cbe10035b5','Y','MaxQueryRecords','If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records','0','Enter the number of records a user will be able to query to avoid unnecessary system load. If 0, no restrictions are imposed.','Max Query Records','Y',TO_DATE('2014-05-16 13:53:33','YYYY-MM-DD HH24:MI:SS'),100,0,'Y',TO_DATE('2014-05-16 13:53:33','YYYY-MM-DD HH24:MI:SS'),100,'N','N',0,'D','N','N',2854,895) +; + +-- May 16, 2014 1:54:51 PM MYT +INSERT INTO AD_Field (SortNo,IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,CreatedBy,Updated,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,IsQuickEntry,AD_Client_ID,ColumnSpan,NumLines,IsAdvancedField,IsDefaultFocus,EntityType,Created) VALUES (0,'N',842,0,'N','N',211240,180,'Y',203024,'N','Enter the number of records a user will be able to query to avoid unnecessary system load. If 0, no restrictions are imposed.','If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records','Max Query Records','ad1bced3-2965-45be-8982-fd64639b6863','Y','N',100,0,100,TO_DATE('2014-05-16 13:54:50','YYYY-MM-DD HH24:MI:SS'),'Y','Y',100,2,'N',0,2,1,'N','N','D',TO_DATE('2014-05-16 13:54:50','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 16, 2014 1:55:27 PM MYT +UPDATE AD_Field SET XPosition=1,Updated=TO_DATE('2014-05-16 13:55:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203024 +; + +-- May 16, 2014 2:16:23 PM MYT +-- IDEMPIERE-1954 Implement MaxQueryRecords for AD_InfoWindow +ALTER TABLE AD_InfoWindow ADD MaxQueryRecords NUMBER(10) DEFAULT 0 NOT NULL +; + +-- May 16, 2014 3:01:57 PM MYT +-- IDEMPIERE-1954 Implement MaxQueryRecords for AD_InfoWindow +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Your search returned more than the maximum number of results allowed.
Please narrow down your search criteria and try your search again.',200274,'D','62341bf3-576c-4c9a-9cd3-4cb88b9bb989','InfoFindOverMax','Y',TO_DATE('2014-05-16 15:01:56','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2014-05-16 15:01:56','YYYY-MM-DD HH24:MI:SS')) +; + +SELECT register_migration_script('201405160715_IDEMPIERE-1954.sql') FROM dual +; + diff --git a/migration/i2.0z/postgresql/201403311258_Ticket_1003856.sql b/migration/i2.0z/postgresql/201403311258_Ticket_1003856.sql new file mode 100644 index 0000000000..7e512469fa --- /dev/null +++ b/migration/i2.0z/postgresql/201403311258_Ticket_1003856.sql @@ -0,0 +1,181 @@ +-- Mar 28, 2014 6:34:26 PM SGT +-- Ticket #1003856: Run report as a background job +INSERT INTO AD_Element (ColumnName,AD_Element_ID,Name,PrintName,AD_Element_UU,Created,Updated,AD_Org_ID,CreatedBy,UpdatedBy,IsActive,AD_Client_ID,EntityType) VALUES ('IsRunAsJob',202694,'Run as Job','Run as Job','c52c9e5a-da3e-401d-8f52-e58f557a56f2',TO_TIMESTAMP('2014-03-28 18:34:24','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2014-03-28 18:34:24','YYYY-MM-DD HH24:MI:SS'),0,100,100,'Y',0,'D') +; + +-- Mar 28, 2014 6:35:05 PM SGT +INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,DefaultValue,Name,IsAllowCopy,Updated,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,IsEncrypted,IsSecure,FKConstraintType,AD_Element_ID,AD_Reference_ID,AD_Table_ID,EntityType) VALUES (0,'N',0,211199,'Y','N','N',0,'N',1,'N','N','N','Y','e67be641-2f1b-4c6b-9c8a-a6788940a686','Y','IsRunAsJob','N','Run as Job','Y',TO_TIMESTAMP('2014-03-28 18:35:03','YYYY-MM-DD HH24:MI:SS'),100,0,'Y',TO_TIMESTAMP('2014-03-28 18:35:03','YYYY-MM-DD HH24:MI:SS'),100,'N','N',0,'N','N','N',202694,20,282,'D') +; + +-- Mar 28, 2014 6:38:03 PM SGT +INSERT INTO AD_Element (ColumnName,AD_Element_ID,Name,PrintName,AD_Element_UU,Created,Updated,AD_Org_ID,CreatedBy,UpdatedBy,IsActive,AD_Client_ID,EntityType) VALUES ('IsJobProcessing',202695,'Job Processing','Job Processing','54265662-ebe2-4521-ba7e-8a9f9a96bcab',TO_TIMESTAMP('2014-03-28 18:38:02','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2014-03-28 18:38:02','YYYY-MM-DD HH24:MI:SS'),0,100,100,'Y',0,'D') +; + +-- Mar 28, 2014 6:38:22 PM SGT +INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,DefaultValue,Name,IsAllowCopy,Updated,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,IsEncrypted,IsSecure,FKConstraintType,AD_Element_ID,AD_Reference_ID,AD_Table_ID,EntityType) VALUES (0,'N',0,211200,'Y','N','N',0,'N',1,'N','N','N','Y','922b7724-599a-49c8-a053-0f8f4b8e2156','Y','IsJobProcessing','N','Job Processing','Y',TO_TIMESTAMP('2014-03-28 18:38:21','YYYY-MM-DD HH24:MI:SS'),100,0,'Y',TO_TIMESTAMP('2014-03-28 18:38:21','YYYY-MM-DD HH24:MI:SS'),100,'N','N',0,'N','N','N',202695,20,282,'D') +; + +-- Mar 28, 2014 6:38:42 PM SGT +INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,Description,Help,Name,IsAllowCopy,Updated,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,IsEncrypted,IsSecure,AD_Element_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,EntityType) VALUES (0,'N',0,211201,'N','N','N',0,'N',2,'N','N','N','Y','5c07ac2d-8342-4e86-ae06-5109f872a16b','Y','NotificationType','Type of Notifications','Emails or Notification sent out for Request Updates, etc.','Notification Type','Y',TO_TIMESTAMP('2014-03-28 18:38:41','YYYY-MM-DD HH24:MI:SS'),100,0,'Y',TO_TIMESTAMP('2014-03-28 18:38:41','YYYY-MM-DD HH24:MI:SS'),100,'N','N',0,'N','N',2755,17,200026,282,'D') +; + +-- Mar 28, 2014 6:43:27 PM SGT +ALTER TABLE AD_PInstance ADD COLUMN IsRunAsJob CHAR(1) DEFAULT 'N' +; + +-- Mar 28, 2014 6:43:44 PM SGT +ALTER TABLE AD_PInstance ADD COLUMN IsJobProcessing CHAR(1) DEFAULT 'N' +; + +-- Mar 28, 2014 6:43:51 PM SGT +ALTER TABLE AD_PInstance ADD COLUMN NotificationType VARCHAR(2) DEFAULT NULL +; + +-- Mar 28, 2014 6:44:35 PM SGT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,EntityType,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan,AD_Column_ID) VALUES ('N',663,36,'N','N',110,'Y',202844,'N','D','AD_PInstance_UU','3540b3cc-efe6-4509-bafc-a15c59c9d7f8','N','N',100,0,TO_TIMESTAMP('2014-03-28 18:44:34','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2014-03-28 18:44:34','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2,60451) +; + +-- Mar 28, 2014 6:44:36 PM SGT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,EntityType,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,CreatedBy,Updated,IsActive,XPosition,AD_Client_ID,ColumnSpan,AD_Column_ID) VALUES ('N',663,1,'N','N',120,'Y',202845,'N','D','Run as Job','72ecc44d-a61b-44b9-a94a-14bd270dbf22','Y','N',100,0,TO_TIMESTAMP('2014-03-28 18:44:35','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2014-03-28 18:44:35','YYYY-MM-DD HH24:MI:SS'),'Y',2,0,2,211199) +; + +-- Mar 28, 2014 6:44:37 PM SGT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,EntityType,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,CreatedBy,Updated,IsActive,XPosition,AD_Client_ID,ColumnSpan,AD_Column_ID) VALUES ('N',663,1,'N','N',130,'Y',202846,'N','D','Job Processing','96118891-6592-4f41-8ba0-05057e17d60e','Y','N',100,0,TO_TIMESTAMP('2014-03-28 18:44:36','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2014-03-28 18:44:36','YYYY-MM-DD HH24:MI:SS'),'Y',2,0,2,211200) +; + +-- Mar 28, 2014 6:44:38 PM SGT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,EntityType,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,CreatedBy,Updated,IsActive,AD_Client_ID,ColumnSpan,AD_Column_ID) VALUES ('N',663,2,'N','N',140,'Y',202847,'N','Emails or Notification sent out for Request Updates, etc.','D','Type of Notifications','Notification Type','d76699c8-2abe-4f62-9e10-6e10fd5dba20','Y','N',100,0,TO_TIMESTAMP('2014-03-28 18:44:37','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2014-03-28 18:44:37','YYYY-MM-DD HH24:MI:SS'),'Y',0,2,211201) +; + +-- Mar 28, 2014 6:45:04 PM SGT +UPDATE AD_Field SET SeqNo=0,IsDisplayed='N' WHERE AD_Field_ID=202844 +; + +-- Mar 28, 2014 6:45:04 PM SGT +UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y' WHERE AD_Field_ID=202845 +; + +-- Mar 28, 2014 6:45:04 PM SGT +UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y' WHERE AD_Field_ID=202847 +; + +-- Mar 28, 2014 6:45:11 PM SGT +UPDATE AD_Field SET SeqNoGrid=110,IsDisplayedGrid='Y' WHERE AD_Field_ID=202845 +; + +-- Mar 28, 2014 6:45:11 PM SGT +UPDATE AD_Field SET SeqNoGrid=120,IsDisplayedGrid='Y' WHERE AD_Field_ID=202847 +; + +-- Mar 28, 2014 6:45:11 PM SGT +UPDATE AD_Field SET SeqNoGrid=130,IsDisplayedGrid='Y' WHERE AD_Field_ID=202846 +; + +-- Mar 28, 2014 6:46:01 PM SGT +INSERT INTO AD_FieldGroup (FieldGroupType,EntityType,IsCollapsedByDefault,Name,AD_FieldGroup_UU,AD_FieldGroup_ID,Created,CreatedBy,Updated,AD_Org_ID,UpdatedBy,IsActive,AD_Client_ID) VALUES ('C','D','N','Background Job','3be13370-89e4-42b3-8220-370ce497466a',200018,TO_TIMESTAMP('2014-03-28 18:46:00','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2014-03-28 18:46:00','YYYY-MM-DD HH24:MI:SS'),0,100,'Y',0) +; + +-- Mar 28, 2014 6:46:18 PM SGT +UPDATE AD_Field SET AD_FieldGroup_ID=200018,Updated=TO_TIMESTAMP('2014-03-28 18:46:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202847 +; + +-- Mar 28, 2014 6:46:22 PM SGT +UPDATE AD_Field SET AD_FieldGroup_ID=200018,Updated=TO_TIMESTAMP('2014-03-28 18:46:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202845 +; + +-- Mar 28, 2014 6:46:28 PM SGT +UPDATE AD_Field SET AD_FieldGroup_ID=200018,Updated=TO_TIMESTAMP('2014-03-28 18:46:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202846 +; + +-- Mar 28, 2014 6:46:44 PM SGT +UPDATE AD_Field SET IsSameLine='Y', XPosition=4,Updated=TO_TIMESTAMP('2014-03-28 18:46:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202847 +; + +-- Mar 28, 2014 6:49:07 PM SGT +INSERT INTO AD_SysConfig (AD_SysConfig_ID,ConfigurationLevel,Value,AD_SysConfig_UU,Updated,Created,AD_Org_ID,CreatedBy,IsActive,UpdatedBy,Name,AD_Client_ID,EntityType) VALUES (200047,'C','Y','feb88039-2fe8-47e5-a7be-c3a634674f0b',TO_TIMESTAMP('2014-03-28 18:49:06','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2014-03-28 18:49:06','YYYY-MM-DD HH24:MI:SS'),0,100,'Y',100,'BACKGROUND_JOB_ALLOWED',0,'D') +; + +-- Mar 28, 2014 6:49:31 PM SGT +INSERT INTO AD_SysConfig (AD_SysConfig_ID,ConfigurationLevel,Value,AD_SysConfig_UU,Updated,Created,AD_Org_ID,CreatedBy,IsActive,UpdatedBy,Name,AD_Client_ID,EntityType) VALUES (200048,'C','N','f2fd6f9b-d8bb-4ade-9857-78ba68951776',TO_TIMESTAMP('2014-03-28 18:49:30','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2014-03-28 18:49:30','YYYY-MM-DD HH24:MI:SS'),0,100,'Y',100,'BACKGROUND_JOB_BY_DEFAULT',0,'D') +; + +-- Mar 28, 2014 6:50:36 PM SGT +INSERT INTO AD_SysConfig (AD_SysConfig_ID,ConfigurationLevel,Value,AD_SysConfig_UU,Updated,Created,AD_Org_ID,CreatedBy,IsActive,UpdatedBy,Name,AD_Client_ID,EntityType) VALUES (200049,'S','20','0a24332e-a83a-465a-903f-6f3d7caea306',TO_TIMESTAMP('2014-03-28 18:50:35','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2014-03-28 18:50:35','YYYY-MM-DD HH24:MI:SS'),0,100,'Y',100,'BACKGROUND_JOB_MAX_IN_SYSTEM',0,'D') +; + +-- Mar 28, 2014 6:51:09 PM SGT +INSERT INTO AD_SysConfig (AD_SysConfig_ID,ConfigurationLevel,Value,AD_SysConfig_UU,Updated,Created,AD_Org_ID,CreatedBy,IsActive,UpdatedBy,Name,AD_Client_ID,EntityType) VALUES (200050,'C','10','d2d149e8-e642-4691-8ed3-8a875ee9b1ed',TO_TIMESTAMP('2014-03-28 18:51:08','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2014-03-28 18:51:08','YYYY-MM-DD HH24:MI:SS'),0,100,'Y',100,'BACKGROUND_JOB_MAX_PER_CLIENT',0,'D') +; + +-- Mar 28, 2014 6:52:26 PM SGT +INSERT INTO AD_SysConfig (AD_SysConfig_ID,ConfigurationLevel,Value,AD_SysConfig_UU,Updated,Created,AD_Org_ID,CreatedBy,IsActive,UpdatedBy,Name,AD_Client_ID,EntityType) VALUES (200051,'C','10','b0697150-68d7-4cfe-b103-f626db07793a',TO_TIMESTAMP('2014-03-28 18:52:25','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2014-03-28 18:52:25','YYYY-MM-DD HH24:MI:SS'),0,100,'Y',100,'BACKGROUND_JOB_MAX_PER_USER',0,'D') +; + +-- Mar 28, 2014 6:53:28 PM SGT +UPDATE AD_SysConfig SET Value='5',Updated=TO_TIMESTAMP('2014-03-28 18:53:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_SysConfig_ID=200051 +; + +-- Mar 28, 2014 6:54:11 PM SGT +UPDATE AD_SysConfig SET ConfigurationLevel='S',Updated=TO_TIMESTAMP('2014-03-28 18:54:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_SysConfig_ID=200050 +; + +-- Mar 28, 2014 6:58:22 PM SGT +INSERT INTO PA_DashboardContent (Line,PA_DashboardContent_ID,ColumnNo,IsCollapsible,GoalDisplay,Description,Name,PA_DashboardContent_UU,IsShowInDashboard,AD_Org_ID,Created,CreatedBy,Updated,AD_Client_ID,UpdatedBy,IsActive,IsEmbedReportContent,IsCollapsedByDefault,AD_Role_ID,IsShowinLogin,ZulFilePath,AD_User_ID) VALUES (3.000000000000,200002,0,'Y','T','Running Jobs','Running Jobs','e3fb872e-ce14-4029-830b-2d21a556fc60','Y',0,TO_TIMESTAMP('2014-03-28 18:58:20','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2014-03-28 18:58:20','YYYY-MM-DD HH24:MI:SS'),0,100,'Y','N','N',0,'Y','/zul/runningJobs.zul',0) +; + +-- Mar 28, 2014 7:57:19 PM SGT +-- Ticket #1003856: Run report as a background job +UPDATE AD_Column SET AD_Reference_Value_ID=344,Updated=TO_TIMESTAMP('2014-03-28 19:57:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=211201 +; + +-- Mar 28, 2014 7:58:52 PM SGT +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,Created,EntityType,AD_Client_ID,AD_Org_ID) VALUES ('E','Exceed maximum number of running jobs allowed per user',200263,'82593e5f-86c6-45c5-bc38-4d9d5b2c8609','BackgroundJobExceedMaxPerUser','Y',TO_TIMESTAMP('2014-03-28 19:58:49','YYYY-MM-DD HH24:MI:SS'),100,100,TO_TIMESTAMP('2014-03-28 19:58:49','YYYY-MM-DD HH24:MI:SS'),'D',0,0) +; + +-- Mar 28, 2014 7:59:12 PM SGT +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,Created,EntityType,AD_Client_ID,AD_Org_ID) VALUES ('E','Exceed maximum number of running jobs allowed per client',200264,'fcebfad5-8283-498e-a835-b42bf0a0219a','BackgroundJobExceedMaxPerClient','Y',TO_TIMESTAMP('2014-03-28 19:59:11','YYYY-MM-DD HH24:MI:SS'),100,100,TO_TIMESTAMP('2014-03-28 19:59:11','YYYY-MM-DD HH24:MI:SS'),'D',0,0) +; + +-- Mar 28, 2014 7:59:51 PM SGT +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,Created,EntityType,AD_Client_ID,AD_Org_ID) VALUES ('E','Exceed maximum number of running jobs allowed in the system',200265,'405ea4c2-5a19-42fa-a5ff-f22601453f7f','BackgroundJobExceedMaxInSystem','Y',TO_TIMESTAMP('2014-03-28 19:59:50','YYYY-MM-DD HH24:MI:SS'),100,100,TO_TIMESTAMP('2014-03-28 19:59:50','YYYY-MM-DD HH24:MI:SS'),'D',0,0) +; + +-- Mar 28, 2014 8:00:19 PM SGT +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,Created,EntityType,AD_Client_ID,AD_Org_ID) VALUES ('I','The process has been scheduled as job. The status of the process will be sent as notification to owner of the process.',200266,'dc68fd3b-0ce8-416c-a286-37f192a90f7d','BackgroundJobScheduled','Y',TO_TIMESTAMP('2014-03-28 20:00:18','YYYY-MM-DD HH24:MI:SS'),100,100,TO_TIMESTAMP('2014-03-28 20:00:18','YYYY-MM-DD HH24:MI:SS'),'D',0,0) +; + +-- Mar 28, 2014 9:03:01 PM SGT +-- Ticket #1003856: Run report as a background job +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,Created,EntityType,AD_Client_ID,AD_Org_ID) VALUES ('I','Background Job',200267,'530545f2-f32c-4072-8bd1-d9ca65f31f65','BackgroundJob','Y',TO_TIMESTAMP('2014-03-28 21:02:59','YYYY-MM-DD HH24:MI:SS'),100,100,TO_TIMESTAMP('2014-03-28 21:02:59','YYYY-MM-DD HH24:MI:SS'),'D',0,0) +; + +-- Mar 31, 2014 5:54:16 PM SGT +-- Ticket #1003856: Run report as a background job +DELETE FROM AD_Field_Trl WHERE AD_Field_ID=202846 +; + +-- Mar 31, 2014 5:54:16 PM SGT +DELETE FROM AD_Field WHERE AD_Field_ID=202846 +; + +-- Mar 31, 2014 5:54:49 PM SGT +DELETE FROM AD_Column_Trl WHERE AD_Column_ID=211200 +; + +-- Mar 31, 2014 5:54:49 PM SGT +DELETE FROM AD_Column WHERE AD_Column_ID=211200 +; + +-- Mar 31, 2014 5:54:56 PM SGT +DELETE FROM AD_Element_Trl WHERE AD_Element_ID=202695 +; + +-- Mar 31, 2014 5:54:56 PM SGT +DELETE FROM AD_Element WHERE AD_Element_ID=202695 +; + +ALTER TABLE AD_PInstance DROP COLUMN IsJobProcessing +; + +SELECT register_migration_script('201403311258_Ticket_1003856.sql') FROM dual +; \ No newline at end of file diff --git a/migration/i2.0z/postgresql/201404020400_Ticket_1003862.sql b/migration/i2.0z/postgresql/201404020400_Ticket_1003862.sql new file mode 100644 index 0000000000..22ffb913ac --- /dev/null +++ b/migration/i2.0z/postgresql/201404020400_Ticket_1003862.sql @@ -0,0 +1,7 @@ +-- Apr 2, 2014 3:38:01 PM COT +-- 1003862-Barcode type UPC A is needed for print formats going to Amazon +INSERT INTO AD_Ref_List (AD_Client_ID,AD_Org_ID,AD_Reference_ID,AD_Ref_List_ID,AD_Ref_List_UU,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,Value) VALUES (0,0,377,200176,'79d36566-b888-4fc1-931d-c0b1612c709b',TO_TIMESTAMP('2014-04-02 15:53:38','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','UPC-A',TO_TIMESTAMP('2014-04-02 15:53:38','YYYY-MM-DD HH24:MI:SS'),100,'UPA') +; + +SELECT register_migration_script('201404020400_Ticket_1003862.sql') FROM dual +; diff --git a/migration/i2.0z/postgresql/201405021000_IDEMPIERE-1899.sql b/migration/i2.0z/postgresql/201405021000_IDEMPIERE-1899.sql new file mode 100644 index 0000000000..b2f134c7b6 --- /dev/null +++ b/migration/i2.0z/postgresql/201405021000_IDEMPIERE-1899.sql @@ -0,0 +1,210 @@ +-- May 2, 2014 9:15:14 AM CEST +-- IDEMPIERE-1899 +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Element_UU,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,202698,'644f9b63-6ded-406e-abec-44d87375820a',0,'R_DefaultMailText_ID',TO_TIMESTAMP('2014-05-02 09:15:13','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Default mail template','Default mail template',TO_TIMESTAMP('2014-05-02 09:15:13','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- May 2, 2014 9:15:31 AM CEST +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Element_UU,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,202699,'05f5cb33-9346-4d6d-81c0-26c599af9b5a',0,'IsAddMailTextAutomatically',TO_TIMESTAMP('2014-05-02 09:15:30','YYYY-MM-DD HH24:MI:SS'),100,'The selected mail template will be automatically inserted when creating an email','D','Y','Add Mail Text Automatically','Add Mail Text Automatically',TO_TIMESTAMP('2014-05-02 09:15:30','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- May 2, 2014 9:15:50 AM CEST +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Column_UU,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FKConstraintType,FieldLength,IsActive,IsAllowCopy,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSecure,IsSelectionColumn,IsSyncDatabase,IsToolbarButton,IsTranslated,IsUpdateable,Name,SeqNo,SeqNoSelection,Updated,UpdatedBy,Version) VALUES (0,211208,'9cc67589-fb40-4206-9f03-4057670ed430',202699,0,20,114,'IsAddMailTextAutomatically',TO_TIMESTAMP('2014-05-02 09:15:49','YYYY-MM-DD HH24:MI:SS'),100,'N','The selected mail template will be automatically inserted when creating an email','D','N',1,'Y','Y','Y','N','N','N','N','N','Y','N','N','N','N','N','N','Y','Add Mail Text Automatically',0,0,TO_TIMESTAMP('2014-05-02 09:15:49','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- May 2, 2014 9:15:54 AM CEST +ALTER TABLE AD_User ADD COLUMN IsAddMailTextAutomatically CHAR(1) DEFAULT 'N' CHECK (IsAddMailTextAutomatically IN ('Y','N')) NOT NULL +; + +-- May 2, 2014 9:16:15 AM CEST +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Column_UU,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FKConstraintType,FieldLength,IsActive,IsAllowCopy,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSecure,IsSelectionColumn,IsSyncDatabase,IsToolbarButton,IsTranslated,IsUpdateable,Name,SeqNo,SeqNoSelection,Updated,UpdatedBy,Version) VALUES (0,211209,'2ecd8ac6-61d1-4062-85d9-2968e5a8f74c',202698,0,18,274,114,'R_DefaultMailText_ID',TO_TIMESTAMP('2014-05-02 09:16:14','YYYY-MM-DD HH24:MI:SS'),100,'D','N',10,'Y','Y','Y','N','N','N','N','N','N','N','N','N','N','N','N','Y','Default mail template',0,0,TO_TIMESTAMP('2014-05-02 09:16:14','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- May 2, 2014 9:16:15 AM CEST +UPDATE AD_Column SET FKConstraintName='RDEFAULTMAILTEXT_ADUSER', FKConstraintType='N',Updated=TO_TIMESTAMP('2014-05-02 09:16:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=211209 +; + +-- May 14, 2014 10:24:01 AM COT +ALTER TABLE AD_User ADD COLUMN R_DefaultMailText_ID NUMERIC(10) DEFAULT NULL +; + +-- May 14, 2014 10:24:02 AM COT +ALTER TABLE AD_User ADD CONSTRAINT RDefaultMailText_ADUser FOREIGN KEY (R_DefaultMailText_ID) REFERENCES r_mailtext(r_mailtext_id) DEFERRABLE INITIALLY DEFERRED +; + +-- May 2, 2014 9:16:27 AM CEST +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Field_UU,AD_Org_ID,AD_Tab_ID,ColumnSpan,Created,CreatedBy,Description,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,Updated,UpdatedBy,XPosition) VALUES (0,211208,202875,'b020eaab-a12c-4b5a-80ba-8c12f2cba674',0,118,2,TO_TIMESTAMP('2014-05-02 09:16:27','YYYY-MM-DD HH24:MI:SS'),100,'The selected mail template will be automatically inserted when creating an email',1,'D','Y','Y','Y','N','N','N','N','N','Add Mail Text Automatically',520,TO_TIMESTAMP('2014-05-02 09:16:27','YYYY-MM-DD HH24:MI:SS'),100,2) +; + +-- May 2, 2014 9:16:28 AM CEST +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Field_UU,AD_Org_ID,AD_Tab_ID,ColumnSpan,Created,CreatedBy,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,Updated,UpdatedBy) VALUES (0,211209,202876,'ef99b478-48c3-4f2f-b276-7ae8695ab14a',0,118,2,TO_TIMESTAMP('2014-05-02 09:16:27','YYYY-MM-DD HH24:MI:SS'),100,10,'D','Y','Y','Y','N','N','N','N','N','Default mail template',530,TO_TIMESTAMP('2014-05-02 09:16:27','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- May 2, 2014 9:17:07 AM CEST +UPDATE AD_Field SET SeqNo=0,IsDisplayed='N' WHERE AD_Field_ID=12640 +; + +-- May 2, 2014 9:17:07 AM CEST +UPDATE AD_Field SET SeqNo=260,IsDisplayed='Y' WHERE AD_Field_ID=200072 +; + +-- May 2, 2014 9:17:07 AM CEST +UPDATE AD_Field SET SeqNo=270,IsDisplayed='Y' WHERE AD_Field_ID=202876 +; + +-- May 2, 2014 9:17:07 AM CEST +UPDATE AD_Field SET SeqNo=280,IsDisplayed='Y' WHERE AD_Field_ID=202875 +; + +-- May 2, 2014 9:17:07 AM CEST +UPDATE AD_Field SET SeqNo=290,IsDisplayed='Y' WHERE AD_Field_ID=6513 +; + +-- May 2, 2014 9:17:07 AM CEST +UPDATE AD_Field SET SeqNo=300,IsDisplayed='Y' WHERE AD_Field_ID=11525 +; + +-- May 2, 2014 9:17:07 AM CEST +UPDATE AD_Field SET SeqNo=310,IsDisplayed='Y' WHERE AD_Field_ID=6520 +; + +-- May 2, 2014 9:17:07 AM CEST +UPDATE AD_Field SET SeqNo=320,IsDisplayed='Y' WHERE AD_Field_ID=8342 +; + +-- May 2, 2014 9:17:07 AM CEST +UPDATE AD_Field SET SeqNo=330,IsDisplayed='Y' WHERE AD_Field_ID=6519 +; + +-- May 2, 2014 9:17:07 AM CEST +UPDATE AD_Field SET SeqNo=340,IsDisplayed='Y' WHERE AD_Field_ID=200405 +; + +-- May 2, 2014 9:17:07 AM CEST +UPDATE AD_Field SET SeqNo=350,IsDisplayed='Y' WHERE AD_Field_ID=200400 +; + +-- May 2, 2014 9:17:07 AM CEST +UPDATE AD_Field SET SeqNo=360,IsDisplayed='Y' WHERE AD_Field_ID=200403 +; + +-- May 2, 2014 9:17:07 AM CEST +UPDATE AD_Field SET SeqNo=370,IsDisplayed='Y' WHERE AD_Field_ID=200401 +; + +-- May 2, 2014 9:17:08 AM CEST +UPDATE AD_Field SET SeqNo=380,IsDisplayed='Y' WHERE AD_Field_ID=200406 +; + +-- May 2, 2014 9:17:08 AM CEST +UPDATE AD_Field SET SeqNo=390,IsDisplayed='Y' WHERE AD_Field_ID=200402 +; + +-- May 2, 2014 9:17:08 AM CEST +UPDATE AD_Field SET SeqNo=400,IsDisplayed='Y' WHERE AD_Field_ID=200474 +; + +-- May 2, 2014 9:17:08 AM CEST +UPDATE AD_Field SET SeqNo=410,IsDisplayed='Y' WHERE AD_Field_ID=200475 +; + +-- May 2, 2014 9:17:08 AM CEST +UPDATE AD_Field SET SeqNo=420,IsDisplayed='Y' WHERE AD_Field_ID=200473 +; + +-- May 2, 2014 9:17:18 AM CEST +UPDATE AD_Field SET IsSameLine='Y',Updated=TO_TIMESTAMP('2014-05-02 09:17:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202875 +; + +-- May 2, 2014 9:19:54 AM CEST +-- IDEMPIERE-1899 +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=280, XPosition=5,Updated=TO_TIMESTAMP('2014-05-02 09:19:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=202875 +; + +-- May 2, 2014 9:37:14 AM CEST +-- IDEMPIERE-1899 +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200273,'43ee6fb2-59e7-4af2-bf73-b5baf5af5a3a',0,TO_TIMESTAMP('2014-05-02 09:37:13','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Add default mail text content','I',TO_TIMESTAMP('2014-05-02 09:37:13','YYYY-MM-DD HH24:MI:SS'),100,'AddDefaultMailTextContent') +; + +-- May 2, 2014 9:38:51 AM CEST +-- IDEMPIERE-1899 +UPDATE AD_Column SET EntityType='D',Updated=TO_TIMESTAMP('2014-05-02 09:38:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=211208 +; + +-- May 2, 2014 9:38:58 AM CEST +UPDATE AD_Column SET EntityType='D',Updated=TO_TIMESTAMP('2014-05-02 09:38:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=211209 +; + +-- May 2, 2014 9:39:11 AM CEST +UPDATE AD_Field SET EntityType='D',Updated=TO_TIMESTAMP('2014-05-02 09:39:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202876 +; + +-- May 2, 2014 9:39:13 AM CEST +UPDATE AD_Field SET EntityType='D',Updated=TO_TIMESTAMP('2014-05-02 09:39:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202875 +; + +-- May 14, 2014 10:54:07 AM COT +UPDATE AD_Field SET SeqNoGrid=280,IsDisplayedGrid='Y' WHERE AD_Field_ID=202876 +; + +-- May 14, 2014 10:54:07 AM COT +UPDATE AD_Field SET SeqNoGrid=290,IsDisplayedGrid='Y' WHERE AD_Field_ID=202875 +; + +-- May 14, 2014 10:54:07 AM COT +UPDATE AD_Field SET SeqNoGrid=300,IsDisplayedGrid='Y' WHERE AD_Field_ID=6513 +; + +-- May 14, 2014 10:54:07 AM COT +UPDATE AD_Field SET SeqNoGrid=310,IsDisplayedGrid='Y' WHERE AD_Field_ID=11525 +; + +-- May 14, 2014 10:54:07 AM COT +UPDATE AD_Field SET SeqNoGrid=320,IsDisplayedGrid='Y' WHERE AD_Field_ID=6520 +; + +-- May 14, 2014 10:54:07 AM COT +UPDATE AD_Field SET SeqNoGrid=330,IsDisplayedGrid='Y' WHERE AD_Field_ID=8342 +; + +-- May 14, 2014 10:54:07 AM COT +UPDATE AD_Field SET SeqNoGrid=340,IsDisplayedGrid='Y' WHERE AD_Field_ID=6519 +; + +-- May 14, 2014 10:54:07 AM COT +UPDATE AD_Field SET SeqNoGrid=350,IsDisplayedGrid='Y' WHERE AD_Field_ID=200405 +; + +-- May 14, 2014 10:54:07 AM COT +UPDATE AD_Field SET SeqNoGrid=360,IsDisplayedGrid='Y' WHERE AD_Field_ID=200400 +; + +-- May 14, 2014 10:54:07 AM COT +UPDATE AD_Field SET SeqNoGrid=370,IsDisplayedGrid='Y' WHERE AD_Field_ID=200403 +; + +-- May 14, 2014 10:54:07 AM COT +UPDATE AD_Field SET SeqNoGrid=380,IsDisplayedGrid='Y' WHERE AD_Field_ID=200401 +; + +-- May 14, 2014 10:54:07 AM COT +UPDATE AD_Field SET SeqNoGrid=390,IsDisplayedGrid='Y' WHERE AD_Field_ID=200406 +; + +-- May 14, 2014 10:54:07 AM COT +UPDATE AD_Field SET SeqNoGrid=400,IsDisplayedGrid='Y' WHERE AD_Field_ID=200402 +; + +-- May 14, 2014 10:54:07 AM COT +UPDATE AD_Field SET SeqNoGrid=410,IsDisplayedGrid='Y' WHERE AD_Field_ID=200474 +; + +-- May 14, 2014 10:54:07 AM COT +UPDATE AD_Field SET SeqNoGrid=420,IsDisplayedGrid='Y' WHERE AD_Field_ID=200475 +; + +-- May 14, 2014 10:54:07 AM COT +UPDATE AD_Field SET SeqNoGrid=430,IsDisplayedGrid='Y' WHERE AD_Field_ID=200473 +; + +SELECT register_migration_script('201405021000_IDEMPIERE-1899.sql') FROM dual +; diff --git a/migration/i2.0z/postgresql/201405160715_IDEMPIERE-1954.sql b/migration/i2.0z/postgresql/201405160715_IDEMPIERE-1954.sql new file mode 100644 index 0000000000..0377dfa66f --- /dev/null +++ b/migration/i2.0z/postgresql/201405160715_IDEMPIERE-1954.sql @@ -0,0 +1,26 @@ +-- May 16, 2014 1:53:34 PM MYT +-- IDEMPIERE-1954 Implement MaxQueryRecords for AD_InfoWindow +INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,Description,DefaultValue,Help,Name,IsAllowCopy,Updated,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,EntityType,IsEncrypted,IsSecure,AD_Element_ID,AD_Table_ID) VALUES (0,'N',1,211240,'Y','N','N',0,'N',10,'N',11,'N','N','Y','8266be38-9b40-4d93-99cb-81cbe10035b5','Y','MaxQueryRecords','If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records','0','Enter the number of records a user will be able to query to avoid unnecessary system load. If 0, no restrictions are imposed.','Max Query Records','Y',TO_TIMESTAMP('2014-05-16 13:53:33','YYYY-MM-DD HH24:MI:SS'),100,0,'Y',TO_TIMESTAMP('2014-05-16 13:53:33','YYYY-MM-DD HH24:MI:SS'),100,'N','N',0,'D','N','N',2854,895) +; + +-- May 16, 2014 1:54:51 PM MYT +INSERT INTO AD_Field (SortNo,IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,CreatedBy,Updated,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,IsQuickEntry,AD_Client_ID,ColumnSpan,NumLines,IsAdvancedField,IsDefaultFocus,EntityType,Created) VALUES (0,'N',842,0,'N','N',211240,180,'Y',203024,'N','Enter the number of records a user will be able to query to avoid unnecessary system load. If 0, no restrictions are imposed.','If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records','Max Query Records','ad1bced3-2965-45be-8982-fd64639b6863','Y','N',100,0,100,TO_TIMESTAMP('2014-05-16 13:54:50','YYYY-MM-DD HH24:MI:SS'),'Y','Y',100,2,'N',0,2,1,'N','N','D',TO_TIMESTAMP('2014-05-16 13:54:50','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 16, 2014 1:55:27 PM MYT +UPDATE AD_Field SET XPosition=1,Updated=TO_TIMESTAMP('2014-05-16 13:55:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203024 +; + +-- May 16, 2014 2:16:23 PM MYT +-- IDEMPIERE-1954 Implement MaxQueryRecords for AD_InfoWindow +ALTER TABLE AD_InfoWindow ADD COLUMN MaxQueryRecords NUMERIC(10) DEFAULT '0' NOT NULL +; + +-- May 16, 2014 3:01:57 PM MYT +-- IDEMPIERE-1954 Implement MaxQueryRecords for AD_InfoWindow +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Your search returned more than the maximum number of results allowed.
Please narrow down your search criteria and try your search again.',200274,'D','62341bf3-576c-4c9a-9cd3-4cb88b9bb989','InfoFindOverMax','Y',TO_TIMESTAMP('2014-05-16 15:01:56','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2014-05-16 15:01:56','YYYY-MM-DD HH24:MI:SS')) +; + +SELECT register_migration_script('201405160715_IDEMPIERE-1954.sql') FROM dual +; + diff --git a/org.adempiere.base.callout/src/org/compiere/model/Callout_AD_Column.java b/org.adempiere.base.callout/src/org/compiere/model/Callout_AD_Column.java index 6729c1eb54..4053344f79 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/Callout_AD_Column.java +++ b/org.adempiere.base.callout/src/org/compiere/model/Callout_AD_Column.java @@ -48,7 +48,7 @@ public class Callout_AD_Column extends CalloutEngine column.setIsIdentifier(false); column.setIsUpdateable(false); column.setIsAlwaysUpdateable(false); - column.setIsKey(true); + column.setIsKey(false); } else if (column.getAD_Table().getTableName().concat("_ID").equals(column.getColumnName())) { // ID key column column.setAD_Reference_ID(DisplayType.ID); @@ -61,6 +61,7 @@ public class Callout_AD_Column extends CalloutEngine column.setIsIdentifier(false); column.setIsUpdateable(false); column.setIsAlwaysUpdateable(false); + column.setIsKey(true); } else { // get defaults from most used case String sql = "" diff --git a/org.adempiere.base.process/src/org/compiere/process/AcctSchemaCopyAcct.java b/org.adempiere.base.process/src/org/compiere/process/AcctSchemaCopyAcct.java index 96d595f3ac..8d4fd4d1af 100644 --- a/org.adempiere.base.process/src/org/compiere/process/AcctSchemaCopyAcct.java +++ b/org.adempiere.base.process/src/org/compiere/process/AcctSchemaCopyAcct.java @@ -228,7 +228,8 @@ public class AcctSchemaCopyAcct extends SvrProcess M_Product_ID, C_BPartner_ID, AD_OrgTrx_ID, C_LocFrom_ID, C_LocTo_ID, C_SalesRegion_ID, C_Project_ID, C_Campaign_ID, C_Activity_ID, - User1_ID, User2_ID, UserElement1_ID, UserElement2_ID); + User1_ID, User2_ID, UserElement1_ID, UserElement2_ID, + get_TrxName()); } // createAccount diff --git a/org.adempiere.base.process/src/org/compiere/process/ImportGLJournal.java b/org.adempiere.base.process/src/org/compiere/process/ImportGLJournal.java index b4a2b0b1d5..ed6523d9ba 100644 --- a/org.adempiere.base.process/src/org/compiere/process/ImportGLJournal.java +++ b/org.adempiere.base.process/src/org/compiere/process/ImportGLJournal.java @@ -786,7 +786,8 @@ public class ImportGLJournal extends SvrProcess imp.getM_Product_ID(), imp.getC_BPartner_ID(), imp.getAD_OrgTrx_ID(), imp.getC_LocFrom_ID(), imp.getC_LocTo_ID(), imp.getC_SalesRegion_ID(), imp.getC_Project_ID(), imp.getC_Campaign_ID(), imp.getC_Activity_ID(), - imp.getUser1_ID(), imp.getUser2_ID(), 0, 0); + imp.getUser1_ID(), imp.getUser2_ID(), 0, 0, + get_TrxName()); if (acct != null && acct.get_ID() == 0) acct.saveEx(); if (acct == null || acct.get_ID() == 0) diff --git a/org.adempiere.base.process/src/org/compiere/process/InvoiceNGL.java b/org.adempiere.base.process/src/org/compiere/process/InvoiceNGL.java index 5258e14872..2c69f479e4 100644 --- a/org.adempiere.base.process/src/org/compiere/process/InvoiceNGL.java +++ b/org.adempiere.base.process/src/org/compiere/process/InvoiceNGL.java @@ -333,7 +333,8 @@ public class InvoiceNGL extends SvrProcess base.getM_Product_ID(), base.getC_BPartner_ID(), base.getAD_OrgTrx_ID(), base.getC_LocFrom_ID(), base.getC_LocTo_ID(), base.getC_SalesRegion_ID(), base.getC_Project_ID(), base.getC_Campaign_ID(), base.getC_Activity_ID(), - base.getUser1_ID(), base.getUser2_ID(), base.getUserElement1_ID(), base.getUserElement2_ID()); + base.getUser1_ID(), base.getUser2_ID(), base.getUserElement1_ID(), base.getUserElement2_ID(), + get_TrxName()); line.setDescription(Msg.getElement(getCtx(), "UnrealizedGain_Acct")); line.setC_ValidCombination_ID(acct.getC_ValidCombination_ID()); line.setAmtSourceCr (drTotal); @@ -351,7 +352,8 @@ public class InvoiceNGL extends SvrProcess base.getM_Product_ID(), base.getC_BPartner_ID(), base.getAD_OrgTrx_ID(), base.getC_LocFrom_ID(), base.getC_LocTo_ID(), base.getC_SalesRegion_ID(), base.getC_Project_ID(), base.getC_Campaign_ID(), base.getC_Activity_ID(), - base.getUser1_ID(), base.getUser2_ID(), base.getUserElement1_ID(), base.getUserElement2_ID()); + base.getUser1_ID(), base.getUser2_ID(), base.getUserElement1_ID(), base.getUserElement2_ID(), + get_TrxName()); line.setDescription(Msg.getElement(getCtx(), "UnrealizedLoss_Acct")); line.setC_ValidCombination_ID(acct.getC_ValidCombination_ID()); line.setAmtSourceDr (crTotal); diff --git a/org.adempiere.base.process/src/org/compiere/process/TabCreateFields.java b/org.adempiere.base.process/src/org/compiere/process/TabCreateFields.java index d35053f1e2..e5bc1ff033 100644 --- a/org.adempiere.base.process/src/org/compiere/process/TabCreateFields.java +++ b/org.adempiere.base.process/src/org/compiere/process/TabCreateFields.java @@ -92,7 +92,9 @@ public class TabCreateFields extends SvrProcess PreparedStatement pstmt = null; ResultSet rs = null; int seqno = DB.getSQLValue(null, "SELECT MAX(SeqNo) FROM AD_Field WHERE AD_Tab_ID=?", tab.getAD_Tab_ID()); + int seqnogrid = DB.getSQLValue(null, "SELECT MAX(SeqNoGrid) FROM AD_Field WHERE AD_Tab_ID=?", tab.getAD_Tab_ID()); seqno = seqno + 10; + seqnogrid = seqnogrid + 10; try { pstmt = DB.prepareStatement (sql, get_TrxName()); @@ -125,8 +127,6 @@ public class TabCreateFields extends SvrProcess } // Assign some default formatting - field.setSeqNo(seqno); - seqno = seqno + 10; if (column.getAD_Reference_ID() == DisplayType.Button || column.getAD_Reference_ID() == DisplayType.YesNo) { field.setXPosition(2); } @@ -156,6 +156,15 @@ public class TabCreateFields extends SvrProcess field.setIsDisplayedGrid(false); } } + if (field.isDisplayed()) { + field.setSeqNo(seqno); + seqno = seqno + 10; + } + + if (field.isDisplayedGrid()) { + field.setSeqNoGrid(seqnogrid); + seqnogrid = seqnogrid + 10; + } //set display logic for accounting dimensions if (column.getColumnName().equalsIgnoreCase("AD_OrgTrx_ID")){ diff --git a/org.adempiere.base/.classpath b/org.adempiere.base/.classpath index 1a65aeab56..717cd5e42f 100644 --- a/org.adempiere.base/.classpath +++ b/org.adempiere.base/.classpath @@ -1,5 +1,6 @@ + diff --git a/org.adempiere.base/META-INF/MANIFEST.MF b/org.adempiere.base/META-INF/MANIFEST.MF index 24b7702e6e..540f952f35 100644 --- a/org.adempiere.base/META-INF/MANIFEST.MF +++ b/org.adempiere.base/META-INF/MANIFEST.MF @@ -19,6 +19,7 @@ Bundle-ClassPath: base.jar, vt-dictionary-3.0.jar, vt-password-3.1.1.jar, super-csv-2.0.0-beta-1.jar, + barcode4j-2.1.jar, bctsp-jdk14-1.38.jar, bcmail-jdk14-1.38.jar, bcprov-jdk14-1.38.jar @@ -325,6 +326,27 @@ Export-Package: bsh, org.jfree.ui.action, org.jfree.ui.tabbedui, org.jfree.util, + org.krysalis.barcode4j, + org.krysalis.barcode4j.ant, + org.krysalis.barcode4j.cli, + org.krysalis.barcode4j.impl, + org.krysalis.barcode4j.impl.codabar, + org.krysalis.barcode4j.impl.code128, + org.krysalis.barcode4j.impl.code39, + org.krysalis.barcode4j.impl.datamatrix, + org.krysalis.barcode4j.impl.fourstate, + org.krysalis.barcode4j.impl.int2of5, + org.krysalis.barcode4j.impl.pdf417, + org.krysalis.barcode4j.impl.postnet, + org.krysalis.barcode4j.impl.upcean, + org.krysalis.barcode4j.output, + org.krysalis.barcode4j.output.bitmap, + org.krysalis.barcode4j.output.eps, + org.krysalis.barcode4j.output.java2d, + org.krysalis.barcode4j.output.svg, + org.krysalis.barcode4j.servlet, + org.krysalis.barcode4j.tools, + org.krysalis.barcode4j.xalan, org.supercsv.cellprocessor, org.supercsv.cellprocessor.constraint, org.supercsv.cellprocessor.ift, diff --git a/org.adempiere.base/build.properties b/org.adempiere.base/build.properties index 61b17bc235..0a1f9f2783 100644 --- a/org.adempiere.base/build.properties +++ b/org.adempiere.base/build.properties @@ -34,6 +34,7 @@ bin.includes = META-INF/,\ OSGI-INF/defaulttaxproviderfactory.xml,\ OSGI-INF/addressvalidationeventhandler.xml,\ schema/,\ + barcode4j-2.1.jar,\ bctsp-jdk14-1.38.jar,\ bcmail-jdk14-1.38.jar,\ bcprov-jdk14-1.38.jar diff --git a/org.adempiere.base/src/org/adempiere/util/IProcessUI.java b/org.adempiere.base/src/org/adempiere/util/IProcessUI.java index 7d8e64cec4..fea1472316 100644 --- a/org.adempiere.base/src/org/adempiere/util/IProcessUI.java +++ b/org.adempiere.base/src/org/adempiere/util/IProcessUI.java @@ -78,6 +78,8 @@ public interface IProcessUI { */ public void ask(String message, Callback callback); + public void askForInput(String message, Callback callback); + /** * add to list of file available for download after process end * @param file diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_Invoice.java b/org.adempiere.base/src/org/compiere/acct/Doc_Invoice.java index ef2e6076ed..61f3dd94f6 100644 --- a/org.adempiere.base/src/org/compiere/acct/Doc_Invoice.java +++ b/org.adempiere.base/src/org/compiere/acct/Doc_Invoice.java @@ -22,6 +22,8 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Savepoint; import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; import java.util.logging.Level; import org.adempiere.exceptions.AverageCostingZeroQtyException; @@ -826,6 +828,8 @@ public class Doc_Invoice extends Doc for (int i = 0; i < lcas.length; i++) totalBase += lcas[i].getBase().doubleValue(); + Map costDetailAmtMap = new HashMap(); + // Create New MInvoiceLine il = new MInvoiceLine (getCtx(), C_InvoiceLine_ID, getTrxName()); for (int i = 0; i < lcas.length; i++) @@ -869,16 +873,20 @@ public class Doc_Invoice extends Doc BigDecimal qty = allocation.getQty(); if (qty.compareTo(iol.getMovementQty()) != 0) { - amt = amt.multiply(iol.getMovementQty()).divide(qty, BigDecimal.ROUND_HALF_UP); + amt = amt.multiply(iol.getMovementQty()).divide(qty, 12, BigDecimal.ROUND_HALF_UP); } estimatedAmt = estimatedAmt.add(amt); } } } + if (estimatedAmt.scale() > as.getCostingPrecision()) + { + estimatedAmt = estimatedAmt.setScale(as.getCostingPrecision(), BigDecimal.ROUND_HALF_UP); + } BigDecimal costAdjustmentAmt = allocationAmt; if (estimatedAmt.signum() > 0) - { + { //get other allocation amt StringBuilder sql = new StringBuilder("SELECT Sum(Amt) FROM C_LandedCostAllocation WHERE M_InOutLine_ID=? ") .append("AND C_LandedCostAllocation_ID<>? ") @@ -896,7 +904,7 @@ public class Doc_Invoice extends Doc } } if (estimatedAmt.signum() > 0) - { + { if (allocationAmt.signum() > 0) costAdjustmentAmt = allocationAmt.subtract(estimatedAmt); else if (allocationAmt.signum() < 0) @@ -907,43 +915,52 @@ public class Doc_Invoice extends Doc if (!dr) costAdjustmentAmt = costAdjustmentAmt.negate(); - Trx trx = Trx.get(getTrxName(), false); - Savepoint savepoint = null; boolean zeroQty = false; - try { - savepoint = trx.setSavepoint(null); - BigDecimal costDetailAmt = costAdjustmentAmt; - //convert to accounting schema currency - if (getC_Currency_ID() != as.getC_Currency_ID()) - costDetailAmt = MConversionRate.convert(getCtx(), costDetailAmt, - getC_Currency_ID(), as.getC_Currency_ID(), - getDateAcct(), getC_ConversionType_ID(), - getAD_Client_ID(), getAD_Org_ID()); - if (costDetailAmt.scale() > as.getCostingPrecision()) - costDetailAmt = costDetailAmt.setScale(as.getCostingPrecision(), BigDecimal.ROUND_HALF_UP); - - if (!MCostDetail.createInvoice(as, lca.getAD_Org_ID(), - lca.getM_Product_ID(), lca.getM_AttributeSetInstance_ID(), - C_InvoiceLine_ID, lca.getM_CostElement_ID(), - costDetailAmt, lca.getQty(), - desc, getTrxName())) { - throw new RuntimeException("Failed to create cost detail record."); - } - } catch (SQLException e) { - throw new RuntimeException(e.getLocalizedMessage(), e); - } catch (AverageCostingZeroQtyException e) { - zeroQty = true; + if (costAdjustmentAmt.signum() != 0) + { + Trx trx = Trx.get(getTrxName(), false); + Savepoint savepoint = null; try { - trx.rollback(savepoint); - savepoint = null; - } catch (SQLException e1) { - throw new RuntimeException(e1.getLocalizedMessage(), e1); - } - } finally { - if (savepoint != null) { + savepoint = trx.setSavepoint(null); + BigDecimal costDetailAmt = costAdjustmentAmt; + //convert to accounting schema currency + if (getC_Currency_ID() != as.getC_Currency_ID()) + costDetailAmt = MConversionRate.convert(getCtx(), costDetailAmt, + getC_Currency_ID(), as.getC_Currency_ID(), + getDateAcct(), getC_ConversionType_ID(), + getAD_Client_ID(), getAD_Org_ID()); + if (costDetailAmt.scale() > as.getCostingPrecision()) + costDetailAmt = costDetailAmt.setScale(as.getCostingPrecision(), BigDecimal.ROUND_HALF_UP); + + String key = lca.getM_Product_ID()+"_"+lca.getM_AttributeSetInstance_ID(); + BigDecimal prevAmt = costDetailAmtMap.remove(key); + if (prevAmt != null) { + costDetailAmt = costDetailAmt.add(prevAmt); + } + costDetailAmtMap.put(key, costDetailAmt); + if (!MCostDetail.createInvoice(as, lca.getAD_Org_ID(), + lca.getM_Product_ID(), lca.getM_AttributeSetInstance_ID(), + C_InvoiceLine_ID, lca.getM_CostElement_ID(), + costDetailAmt, lca.getQty(), + desc, getTrxName())) { + throw new RuntimeException("Failed to create cost detail record."); + } + } catch (SQLException e) { + throw new RuntimeException(e.getLocalizedMessage(), e); + } catch (AverageCostingZeroQtyException e) { + zeroQty = true; try { - trx.releaseSavepoint(savepoint); - } catch (SQLException e) {} + trx.rollback(savepoint); + savepoint = null; + } catch (SQLException e1) { + throw new RuntimeException(e1.getLocalizedMessage(), e1); + } + } finally { + if (savepoint != null) { + try { + trx.releaseSavepoint(savepoint); + } catch (SQLException e) {} + } } } @@ -956,6 +973,14 @@ public class Doc_Invoice extends Doc if (allocationAmt.signum() > 0) { + if (allocationAmt.scale() > as.getStdPrecision()) + { + allocationAmt = allocationAmt.setScale(as.getStdPrecision(), BigDecimal.ROUND_HALF_UP); + } + if (estimatedAmt.scale() > as.getStdPrecision()) + { + estimatedAmt = estimatedAmt.setScale(as.getStdPrecision(), BigDecimal.ROUND_HALF_UP); + } int compare = allocationAmt.compareTo(estimatedAmt); if (compare > 0) { @@ -977,6 +1002,25 @@ public class Doc_Invoice extends Doc fl.setQty(line.getQty()); } else if (compare < 0) + { + drAmt = dr ? (reversal ? null : estimatedAmt) : (reversal ? estimatedAmt : null); + crAmt = dr ? (reversal ? estimatedAmt : null) : (reversal ? null : estimatedAmt); + account = pc.getAccount(ProductCost.ACCTTYPE_P_LandedCostClearing, as); + FactLine fl = fact.createLine (line, account, getC_Currency_ID(), drAmt, crAmt); + fl.setDescription(desc); + fl.setM_Product_ID(lca.getM_Product_ID()); + fl.setQty(line.getQty()); + + BigDecimal underAmt = estimatedAmt.subtract(allocationAmt); + drAmt = dr ? (reversal ? underAmt : null) : (reversal ? null : underAmt); + crAmt = dr ? (reversal ? null : underAmt) : (reversal ? underAmt : null); + account = zeroQty ? pc.getAccount(ProductCost.ACCTTYPE_P_AverageCostVariance, as) : pc.getAccount(ProductCost.ACCTTYPE_P_Asset, as); + fl = fact.createLine (line, account, getC_Currency_ID(), drAmt, crAmt); + fl.setDescription(desc); + fl.setM_Product_ID(lca.getM_Product_ID()); + fl.setQty(line.getQty()); + } + else { drAmt = dr ? (reversal ? null : allocationAmt) : (reversal ? allocationAmt : null); crAmt = dr ? (reversal ? allocationAmt : null) : (reversal ? null : allocationAmt); diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_MatchInv.java b/org.adempiere.base/src/org/compiere/acct/Doc_MatchInv.java index 632b18bccf..18907d884a 100644 --- a/org.adempiere.base/src/org/compiere/acct/Doc_MatchInv.java +++ b/org.adempiere.base/src/org/compiere/acct/Doc_MatchInv.java @@ -508,7 +508,7 @@ public class Doc_MatchInv extends Doc { BigDecimal totalAmt = allocation.getAmt(); BigDecimal totalQty = allocation.getQty(); - BigDecimal amt = totalAmt.multiply(tQty).divide(totalQty, BigDecimal.ROUND_HALF_UP); + BigDecimal amt = totalAmt.multiply(tQty).divide(totalQty, 12, BigDecimal.ROUND_HALF_UP); if (orderLine.getC_Currency_ID() != as.getC_Currency_ID()) { I_C_Order order = orderLine.getC_Order(); diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_MatchPO.java b/org.adempiere.base/src/org/compiere/acct/Doc_MatchPO.java index 419fe010b1..eafa8c67e2 100644 --- a/org.adempiere.base/src/org/compiere/acct/Doc_MatchPO.java +++ b/org.adempiere.base/src/org/compiere/acct/Doc_MatchPO.java @@ -198,7 +198,7 @@ public class Doc_MatchPO extends Doc { BigDecimal totalAmt = allocation.getAmt(); BigDecimal totalQty = allocation.getQty(); - BigDecimal amt = totalAmt.multiply(m_ioLine.getMovementQty()).divide(totalQty, as.getCostingPrecision(), RoundingMode.HALF_UP); + BigDecimal amt = totalAmt.multiply(m_ioLine.getMovementQty()).divide(totalQty, 12, RoundingMode.HALF_UP); if (m_oLine.getC_Currency_ID() != as.getC_Currency_ID()) { MOrder order = m_oLine.getParent(); @@ -213,11 +213,11 @@ public class Doc_MatchPO extends Doc return null; } amt = amt.multiply(rate); - if (amt.scale() > as.getCostingPrecision()) - amt = amt.setScale(as.getCostingPrecision(), BigDecimal.ROUND_HALF_UP); } - amt = amt.divide(getQty(), as.getCostingPrecision(), RoundingMode.HALF_UP); + amt = amt.divide(getQty(), 12, RoundingMode.HALF_UP); landedCost = landedCost.add(amt); + if (landedCost.scale() > as.getCostingPrecision()) + landedCost = landedCost.setScale(as.getCostingPrecision(), BigDecimal.ROUND_HALF_UP); int elementId = allocation.getC_OrderLandedCost().getM_CostElement_ID(); BigDecimal elementAmt = landedCostMap.get(elementId); if (elementAmt == null) @@ -442,6 +442,8 @@ public class Doc_MatchPO extends Doc return error; } + if (tAmt.scale() > as.getCostingPrecision()) + tAmt = tAmt.setScale(as.getCostingPrecision(), BigDecimal.ROUND_HALF_UP); // Set Total Amount and Total Quantity from Matched PO if (!MCostDetail.createOrder(as, m_oLine.getAD_Org_ID(), getM_Product_ID(), mMatchPO.getM_AttributeSetInstance_ID(), @@ -471,6 +473,8 @@ public class Doc_MatchPO extends Doc { BigDecimal amt = landedCostMap.get(elementId); amt = amt.multiply(tQty); + if (amt.scale() > as.getCostingPrecision()) + amt = amt.setScale(as.getCostingPrecision(), BigDecimal.ROUND_HALF_UP); if (!MCostDetail.createOrder(as, m_oLine.getAD_Org_ID(), getM_Product_ID(), mMatchPO.getM_AttributeSetInstance_ID(), m_oLine.getC_OrderLine_ID(), elementId, diff --git a/org.adempiere.base/src/org/compiere/acct/FactLine.java b/org.adempiere.base/src/org/compiere/acct/FactLine.java index a836c02a04..eaac877758 100644 --- a/org.adempiere.base/src/org/compiere/acct/FactLine.java +++ b/org.adempiere.base/src/org/compiere/acct/FactLine.java @@ -991,7 +991,8 @@ public final class FactLine extends X_Fact_Acct AD_Client_ID, AD_Org_ID, getC_AcctSchema_ID(), Account_ID, C_SubAcct_ID, M_Product_ID, C_BPartner_ID, AD_OrgTrx_ID, C_LocFrom_ID, C_LocTo_ID, C_SRegion_ID, C_Project_ID, C_Campaign_ID, C_Activity_ID, - User1_ID, User2_ID, UserElement1_ID, UserElement2_ID); + User1_ID, User2_ID, UserElement1_ID, UserElement2_ID, + get_TrxName()); if (revenue != null && revenue.get_ID() == 0) revenue.saveEx(); if (revenue == null || revenue.get_ID() == 0) diff --git a/org.adempiere.base/src/org/compiere/model/GridField.java b/org.adempiere.base/src/org/compiere/model/GridField.java index 064e712e26..8d4f328fdd 100644 --- a/org.adempiere.base/src/org/compiere/model/GridField.java +++ b/org.adempiere.base/src/org/compiere/model/GridField.java @@ -81,7 +81,7 @@ public class GridField /** * */ - private static final long serialVersionUID = -9086333125844297957L; + private static final long serialVersionUID = -2699974883136279635L; /** * Field Constructor. @@ -551,9 +551,11 @@ public class GridField // No defaults for these fields if (m_vo.IsKey || m_vo.displayType == DisplayType.RowID - || DisplayType.isLOB(m_vo.displayType)) + || DisplayType.isLOB(m_vo.displayType) + || "Created".equals(m_vo.ColumnName) // for Created/Updated default is managed on PO, and direct inserts on DB + || "Updated".equals(m_vo.ColumnName)) return null; - // Set Parent to context if not explitly set + // Set Parent to context if not explicitly set if (isParentValue() && (m_vo.DefaultValue == null || m_vo.DefaultValue.length() == 0)) { @@ -1347,6 +1349,19 @@ public class GridField { return m_vo.IsKey; } + /** + * UUID + * @return is UUID + */ + public boolean isUUID() + { + if (getGridTab() != null) { + if (m_vo.ColumnName.equals(PO.getUUIDColumnName(getGridTab().getTableName()))) { + return true; + } + } + return false; + } /** * Parent Column * @return parent column diff --git a/org.adempiere.base/src/org/compiere/model/GridTab.java b/org.adempiere.base/src/org/compiere/model/GridTab.java index f2eb169707..5e7f045c29 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTab.java +++ b/org.adempiere.base/src/org/compiere/model/GridTab.java @@ -31,6 +31,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Properties; import java.util.StringTokenizer; +import java.util.UUID; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.logging.Level; @@ -946,18 +947,22 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable { if (log.isLoggable(Level.FINE)) log.fine("#" + m_vo.TabNo); selection.clear(); - /** @todo does not work with alpha key */ int keyNo = m_mTable.getKeyID(m_currentRow); + UUID uuid = null; + if (keyNo == -1) { + uuid = m_mTable.getUUID(m_currentRow); + } m_mTable.dataRefreshAll(fireEvent, retainedCurrentRow ? m_currentRow : -1); - // Should use RowID - not working for tables with multiple keys - if (keyNo != -1) + if (keyNo != -1 || uuid != null) { - if (keyNo != m_mTable.getKeyID(m_currentRow)) // something changed + if ( ( keyNo != -1 && keyNo != m_mTable.getKeyID(m_currentRow) ) + || ( uuid != null && uuid.compareTo(m_mTable.getUUID(m_currentRow)) != 0) ) // something changed { int size = getRowCount(); for (int i = 0; i < size; i++) { - if (keyNo == m_mTable.getKeyID(i)) + if ( ( keyNo != -1 && keyNo == m_mTable.getKeyID(i) ) + || ( uuid != null && uuid.compareTo(m_mTable.getUUID(i)) == 0) ) { m_currentRow = i; break; diff --git a/org.adempiere.base/src/org/compiere/model/GridTable.java b/org.adempiere.base/src/org/compiere/model/GridTable.java index 6edf5aca40..5c7de4c65d 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTable.java +++ b/org.adempiere.base/src/org/compiere/model/GridTable.java @@ -39,6 +39,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Properties; +import java.util.UUID; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; @@ -101,7 +102,7 @@ public class GridTable extends AbstractTableModel /** * */ - private static final long serialVersionUID = 4223765688790104180L; + private static final long serialVersionUID = -4440415447489133947L; public static final String DATA_REFRESH_MESSAGE = "Refreshed"; @@ -212,6 +213,8 @@ public class GridTable extends AbstractTableModel /** Index of Key Column */ private int m_indexKeyColumn = -1; + /** Index of UUID Column */ + private int m_indexUUIDColumn = -1; /** Index of Color Column */ private int m_indexColorColumn = -1; /** Index of Processed Column */ @@ -441,6 +444,8 @@ public class GridTable extends AbstractTableModel // Set Index for Key column if (field.isKey()) m_indexKeyColumn = m_fields.size(); + else if (field.isUUID()) + m_indexUUIDColumn = m_fields.size(); // Set Index of other standard columns if (field.getColumnName().equals("IsActive")) m_indexActiveColumn = m_fields.size(); @@ -994,6 +999,30 @@ public class GridTable extends AbstractTableModel return -1; } // getKeyID + /** + * Get UUID or null of none + * @param row row + * @return UUID or null + */ + public UUID getUUID (int row) + { + if (m_indexUUIDColumn != -1) + { + try + { + String ii = (String)getValueAt(row, m_indexUUIDColumn); + if (ii == null) + return null; + return UUID.fromString(ii); + } + catch (Exception e) + { + return null; + } + } + return null; + } // getKeyID + /** * Get Key ColumnName * @return key column name diff --git a/org.adempiere.base/src/org/compiere/model/GridWindow.java b/org.adempiere.base/src/org/compiere/model/GridWindow.java index af60c55880..2c569a8702 100644 --- a/org.adempiere.base/src/org/compiere/model/GridWindow.java +++ b/org.adempiere.base/src/org/compiere/model/GridWindow.java @@ -458,7 +458,7 @@ public class GridWindow implements Serializable if (getHelp().length() != 0) center.addElement(new p().addElement(getHelp())); - center.addElement(new a().setName("Tabs")).addElement(new h3("Tabs").addAttribute("ALIGN", "left")); + center.addElement(new a().setName("Tabs")).addElement(new h3(Msg.getMsg(Env.getCtx(), "Tabs")).addAttribute("ALIGN", "left")); // List of all Tabs in current window int size = getTabCount(); p p = new p(); @@ -502,7 +502,7 @@ public class GridWindow implements Serializable td.addElement(new p().addElement(tab.getHelp())); // Links to Fields td.addElement(new a().setName("Fields"+i)); - td.addElement(new h4("Fields").addAttribute("ALIGN", "left")); + td.addElement(new h4(Msg.getMsg(Env.getCtx(), "Fields")).addAttribute("ALIGN", "left")); p = new p(); if (!tab.isLoadComplete()) this.initTab(i); diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_InfoWindow.java b/org.adempiere.base/src/org/compiere/model/I_AD_InfoWindow.java index bea37accce..164a063eec 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_InfoWindow.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_InfoWindow.java @@ -273,6 +273,19 @@ public interface I_AD_InfoWindow */ public boolean isValid(); + /** Column name MaxQueryRecords */ + public static final String COLUMNNAME_MaxQueryRecords = "MaxQueryRecords"; + + /** Set Max Query Records. + * If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records + */ + public void setMaxQueryRecords (int MaxQueryRecords); + + /** Get Max Query Records. + * If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records + */ + public int getMaxQueryRecords(); + /** Column name Name */ public static final String COLUMNNAME_Name = "Name"; diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_PInstance.java b/org.adempiere.base/src/org/compiere/model/I_AD_PInstance.java index dd041cd8de..02306a6a52 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_PInstance.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_PInstance.java @@ -174,6 +174,28 @@ public interface I_AD_PInstance */ public String getName(); + /** Column name IsRunAsJob */ + public static final String COLUMNNAME_IsRunAsJob = "IsRunAsJob"; + + /** Set Run as Job */ + public void setIsRunAsJob (boolean IsRunAsJob); + + /** Get Run as Job */ + public boolean isRunAsJob(); + + /** Column name NotificationType */ + public static final String COLUMNNAME_NotificationType = "NotificationType"; + + /** Set Notification Type. + * Type of Notifications + */ + public void setNotificationType (String NotificationType); + + /** Get Notification Type. + * Type of Notifications + */ + public String getNotificationType(); + /** Column name Record_ID */ public static final String COLUMNNAME_Record_ID = "Record_ID"; diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_User.java b/org.adempiere.base/src/org/compiere/model/I_AD_User.java index 34685d8422..7ca235d71d 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_User.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_User.java @@ -402,6 +402,19 @@ public interface I_AD_User */ public boolean isActive(); + /** Column name IsAddMailTextAutomatically */ + public static final String COLUMNNAME_IsAddMailTextAutomatically = "IsAddMailTextAutomatically"; + + /** Set Add Mail Text Automatically. + * The selected mail template will be automatically inserted when creating an email + */ + public void setIsAddMailTextAutomatically (boolean IsAddMailTextAutomatically); + + /** Get Add Mail Text Automatically. + * The selected mail template will be automatically inserted when creating an email + */ + public boolean isAddMailTextAutomatically(); + /** Column name IsExpired */ public static final String COLUMNNAME_IsExpired = "IsExpired"; @@ -646,6 +659,17 @@ public interface I_AD_User /** Get Process Now */ public boolean isProcessing(); + /** Column name R_DefaultMailText_ID */ + public static final String COLUMNNAME_R_DefaultMailText_ID = "R_DefaultMailText_ID"; + + /** Set Default mail template */ + public void setR_DefaultMailText_ID (int R_DefaultMailText_ID); + + /** Get Default mail template */ + public int getR_DefaultMailText_ID(); + + public org.compiere.model.I_R_MailText getR_DefaultMailText() throws RuntimeException; + /** Column name SalesRep_ID */ public static final String COLUMNNAME_SalesRep_ID = "SalesRep_ID"; diff --git a/org.adempiere.base/src/org/compiere/model/MAccount.java b/org.adempiere.base/src/org/compiere/model/MAccount.java index e032863f3c..e2f21f252d 100644 --- a/org.adempiere.base/src/org/compiere/model/MAccount.java +++ b/org.adempiere.base/src/org/compiere/model/MAccount.java @@ -41,8 +41,28 @@ public class MAccount extends X_C_ValidCombination /** * */ - private static final long serialVersionUID = -1936396369349550834L; + private static final long serialVersionUID = 7980515458720808532L; + /* + * Deprecated - use the same method with trxName instead + */ + @Deprecated + public static MAccount get(Properties ctx, int ad_Client_ID, int ad_Org_ID, + int c_AcctSchema_ID, int new_account_id, int c_SubAcct_ID, + int m_Product_ID, int c_BPartner_ID, int ad_OrgTrx_ID, + int c_LocFrom_ID, int c_LocTo_ID, int c_SalesRegion_ID, + int c_Project_ID, int c_Campaign_ID, int c_Activity_ID, + int user1_ID, int user2_ID, int userElement1_ID, + int userElement2_ID) { + return get(ctx, ad_Client_ID, ad_Org_ID, + c_AcctSchema_ID, new_account_id, c_SubAcct_ID, + m_Product_ID, c_BPartner_ID, ad_OrgTrx_ID, + c_LocFrom_ID, c_LocTo_ID, c_SalesRegion_ID, + c_Project_ID, c_Campaign_ID, c_Activity_ID, + user1_ID, user2_ID, userElement1_ID, + userElement2_ID, null); + } + /** * Get existing Account or create it * @param ctx context @@ -64,6 +84,7 @@ public class MAccount extends X_C_ValidCombination * @param User2_ID * @param UserElement1_ID * @param UserElement2_ID + * @param trxName * @return account or null */ public static MAccount get (Properties ctx, @@ -72,7 +93,8 @@ public class MAccount extends X_C_ValidCombination int M_Product_ID, int C_BPartner_ID, int AD_OrgTrx_ID, int C_LocFrom_ID, int C_LocTo_ID, int C_SalesRegion_ID, int C_Project_ID, int C_Campaign_ID, int C_Activity_ID, - int User1_ID, int User2_ID, int UserElement1_ID, int UserElement2_ID) + int User1_ID, int User2_ID, int UserElement1_ID, int UserElement2_ID, + String trxName) { StringBuilder info = new StringBuilder(); info.append("AD_Client_ID=").append(AD_Client_ID).append(",AD_Org_ID=").append(AD_Org_ID); @@ -192,7 +214,7 @@ public class MAccount extends X_C_ValidCombination } // whereClause.append(" ORDER BY IsFullyQualified DESC"); - MAccount existingAccount = new Query(ctx, MAccount.Table_Name, whereClause.toString(), null) + MAccount existingAccount = new Query(ctx, MAccount.Table_Name, whereClause.toString(), trxName) .setParameters(params) .setOnlyActiveRecords(true) .firstOnly(); @@ -202,7 +224,7 @@ public class MAccount extends X_C_ValidCombination return existingAccount; // New - MAccount newAccount = new MAccount (ctx, 0, null); + MAccount newAccount = new MAccount (ctx, 0, trxName); newAccount.setClientOrg(AD_Client_ID, AD_Org_ID); newAccount.setC_AcctSchema_ID(C_AcctSchema_ID); newAccount.setAccount_ID(Account_ID); @@ -821,6 +843,6 @@ public class MAccount extends X_C_ValidCombination System.out.println(acct2); } // main - + } // Account diff --git a/org.adempiere.base/src/org/compiere/model/MClient.java b/org.adempiere.base/src/org/compiere/model/MClient.java index 2fb39a3175..aa2067c268 100644 --- a/org.adempiere.base/src/org/compiere/model/MClient.java +++ b/org.adempiere.base/src/org/compiere/model/MClient.java @@ -554,6 +554,56 @@ public class MClient extends X_AD_Client } } // sendEMail + /** + * Send EMail from User + * @param from sender + * @param to recipient + * @param subject subject + * @param message message + * @param attachment optional attachment + * @return true if sent + */ + public boolean sendEMailAttachments (MUser from, MUser to, + String subject, String message, List attachments) + { + return sendEMailAttachments(from, to, subject, message, attachments, false); + } + + /** + * Send EMail from User + * @param from sender + * @param to recipient + * @param subject subject + * @param message message + * @param attachment optional attachment + * @param isHtml + * @return true if sent + */ + public boolean sendEMailAttachments (MUser from, MUser to, + String subject, String message, List attachments, boolean isHtml) + { + EMail email = createEMail(from, to, subject, message, isHtml); + if (email == null) + return false; + + if (attachments != null && !attachments.isEmpty()) + { + for (File attachment : attachments) + email.addAttachment(attachment); + } + InternetAddress emailFrom = email.getFrom(); + try + { + return sendEmailNow(from, to, email); + } + catch (Exception ex) + { + log.severe(getName() + " - from " + emailFrom + + " to " + to + ": " + ex.getLocalizedMessage()); + return false; + } + } // sendEMail + /** * Send EMail from Request User - no trace * @param to recipient email address diff --git a/org.adempiere.base/src/org/compiere/model/MColumn.java b/org.adempiere.base/src/org/compiere/model/MColumn.java index d3a9cc6cd6..55d8a2ec0a 100644 --- a/org.adempiere.base/src/org/compiere/model/MColumn.java +++ b/org.adempiere.base/src/org/compiere/model/MColumn.java @@ -751,7 +751,7 @@ public class MColumn extends X_AD_Column setIsIdentifier(false); setIsUpdateable(false); setIsAlwaysUpdateable(false); - setIsKey(true); + setIsKey(false); } else if (getAD_Table().getTableName().concat("_ID").equals(getColumnName())) { // ID key column setAD_Reference_ID(DisplayType.ID); @@ -764,6 +764,7 @@ public class MColumn extends X_AD_Column setIsIdentifier(false); setIsUpdateable(false); setIsAlwaysUpdateable(false); + setIsKey(true); } else { // get defaults from most used case String sql = "" diff --git a/org.adempiere.base/src/org/compiere/model/MCost.java b/org.adempiere.base/src/org/compiere/model/MCost.java index b67fcbe2b0..b9dd42fe44 100644 --- a/org.adempiere.base/src/org/compiere/model/MCost.java +++ b/org.adempiere.base/src/org/compiere/model/MCost.java @@ -1500,14 +1500,18 @@ public class MCost extends X_M_Cost throw new AverageCostingNegativeQtyException("Product(ID)="+getM_Product_ID()+", Current Qty="+getCurrentQty()+", Trx Qty="+qty +", CostElement="+getM_CostElement().getName()+", Schema="+getC_AcctSchema().getName()); } - - BigDecimal oldSum = getCurrentCostPrice().multiply(getCurrentQty()); - BigDecimal newSum = amt; // is total already - BigDecimal sumAmt = oldSum.add(newSum); + BigDecimal sumQty = getCurrentQty().add(qty); if (sumQty.signum() != 0) { - BigDecimal cost = sumAmt.divide(sumQty, getPrecision(), BigDecimal.ROUND_HALF_UP); + BigDecimal oldSum = getCurrentCostPrice().multiply(getCurrentQty()); + BigDecimal oldCost = oldSum.divide(sumQty, 12, BigDecimal.ROUND_HALF_UP); + BigDecimal newCost = amt.divide(sumQty, 12, BigDecimal.ROUND_HALF_UP); //amt is total already + BigDecimal cost = oldCost.add(newCost); + if (cost.scale() > (getPrecision()*2)) + { + cost = cost.setScale((getPrecision()*2), BigDecimal.ROUND_HALF_UP); + } setCurrentCostPrice(cost); } // diff --git a/org.adempiere.base/src/org/compiere/model/MDistributionLine.java b/org.adempiere.base/src/org/compiere/model/MDistributionLine.java index a620e32bb4..637fe98f16 100644 --- a/org.adempiere.base/src/org/compiere/model/MDistributionLine.java +++ b/org.adempiere.base/src/org/compiere/model/MDistributionLine.java @@ -143,7 +143,8 @@ public class MDistributionLine extends X_GL_DistributionLine isOverwriteUser1() ? getUser1_ID() : m_account.getUser1_ID(), isOverwriteUser2() ? getUser2_ID() : m_account.getUser2_ID(), m_account.getUserElement1_ID(), - m_account.getUserElement2_ID()); + m_account.getUserElement2_ID(), + get_TrxName()); return acct; } // setAccount diff --git a/org.adempiere.base/src/org/compiere/model/MFactAcct.java b/org.adempiere.base/src/org/compiere/model/MFactAcct.java index 7bb0bccd06..42b0988b0c 100644 --- a/org.adempiere.base/src/org/compiere/model/MFactAcct.java +++ b/org.adempiere.base/src/org/compiere/model/MFactAcct.java @@ -129,7 +129,8 @@ public class MFactAcct extends X_Fact_Acct getM_Product_ID(), getC_BPartner_ID(), getAD_OrgTrx_ID(), getC_LocFrom_ID(), getC_LocTo_ID(), getC_SalesRegion_ID(), getC_Project_ID(), getC_Campaign_ID(), getC_Activity_ID(), - getUser1_ID(), getUser2_ID(), getUserElement1_ID(), getUserElement2_ID()); + getUser1_ID(), getUser2_ID(), getUserElement1_ID(), getUserElement2_ID(), + get_TrxName()); if (acct != null && acct.get_ID() == 0) acct.saveEx(); return acct; diff --git a/org.adempiere.base/src/org/compiere/model/MField.java b/org.adempiere.base/src/org/compiere/model/MField.java index 2d96f83065..1f2ae8964d 100644 --- a/org.adempiere.base/src/org/compiere/model/MField.java +++ b/org.adempiere.base/src/org/compiere/model/MField.java @@ -51,6 +51,7 @@ public class MField extends X_AD_Field setEntityType (ENTITYTYPE_UserMaintained); // U setIsCentrallyMaintained (true); // Y setIsDisplayed (true); // Y + setIsDisplayedGrid (true); // Y setIsEncrypted (false); setIsFieldOnly (false); setIsHeading (false); diff --git a/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java b/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java index fc636f457d..efea41e29e 100644 --- a/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java +++ b/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java @@ -1075,7 +1075,7 @@ public class MInvoiceLine extends X_C_InvoiceLine { double result = getLineNetAmt().multiply(base).doubleValue(); result /= total.doubleValue(); - lca.setAmt(result, getPrecision()); + lca.setAmt(result, getParent().getC_Currency().getCostingPrecision()); } if (!lca.save()){ msgreturn = new StringBuilder("Cannot save line Allocation = ").append(lca); @@ -1119,6 +1119,16 @@ public class MInvoiceLine extends X_C_InvoiceLine MLandedCostAllocation lca = new MLandedCostAllocation (this, lc.getM_CostElement_ID()); lca.setM_Product_ID(lc.getM_Product_ID()); // No ASI lca.setAmt(getLineNetAmt()); + if (lc.getLandedCostDistribution().equals(MLandedCost.LANDEDCOSTDISTRIBUTION_Costs)) + { + lca.setBase(getLineNetAmt()); + lca.setQty(getLineNetAmt()); + } + else + { + lca.setBase(getQtyInvoiced()); + lca.setQty(getQtyInvoiced()); + } if (lca.save()) return ""; msgreturn = new StringBuilder("Cannot save Product Allocation = ").append(lc); @@ -1200,7 +1210,7 @@ public class MInvoiceLine extends X_C_InvoiceLine { double result = getLineNetAmt().multiply(base).doubleValue(); result /= total.doubleValue(); - lca.setAmt(result, getPrecision()); + lca.setAmt(result, getParent().getC_Currency().getCostingPrecision()); } if (!lca.save()){ msgreturn = new StringBuilder("Cannot save line Allocation = ").append(lca); diff --git a/org.adempiere.base/src/org/compiere/model/MJournal.java b/org.adempiere.base/src/org/compiere/model/MJournal.java index 6ae875d6f8..add27fd13b 100644 --- a/org.adempiere.base/src/org/compiere/model/MJournal.java +++ b/org.adempiere.base/src/org/compiere/model/MJournal.java @@ -760,15 +760,29 @@ public class MJournal extends X_GL_Journal implements DocAction reverse.setReversal_ID(getGL_Journal_ID()); if (!reverse.save()) return null; + + // Lines + reverse.copyLinesFrom(this, null, 'C'); + // + if (!reverse.processIt(DocAction.ACTION_Complete)) + { + m_processMsg = "Reversal ERROR: " + reverse.getProcessMsg(); + return null; + } + reverse.closeIt(); + reverse.setProcessing(false); + reverse.setDocStatus(DOCSTATUS_Reversed); + reverse.setDocAction(DOCACTION_None); + reverse.saveEx(get_TrxName()); + // msgd = new StringBuilder("(").append(reverse.getDocumentNo()).append("<-)"); addDescription(msgd.toString()); - // Lines - reverse.copyLinesFrom(this, null, 'C'); // setProcessed(true); //FR [ 1948157 ] setReversal_ID(reverse.getGL_Journal_ID()); + setDocStatus(DOCSTATUS_Reversed); setDocAction(DOCACTION_None); return reverse; } // reverseCorrectionIt @@ -814,19 +828,31 @@ public class MJournal extends X_GL_Journal implements DocAction reverse.set_ValueNoCheck ("C_Period_ID", null); // reset reverse.setDateAcct(reverse.getDateDoc()); // Reverse indicator - StringBuilder description; - if (reverse.getDescription() == null) - description = new StringBuilder("** ").append(getDocumentNo()).append(" **"); - else - description = new StringBuilder(reverse.getDescription()).append(" ** ").append(getDocumentNo()).append(" **"); - reverse.setDescription(description.toString()); + StringBuilder msgd = new StringBuilder("(->").append(getDocumentNo()).append(")"); + reverse.addDescription(msgd.toString()); + reverse.setReversal_ID(getGL_Journal_ID()); if (!reverse.save()) return null; - // Lines reverse.copyLinesFrom(this, reverse.getDateAcct(), 'R'); // + if (!reverse.processIt(DocAction.ACTION_Complete)) + { + m_processMsg = "Reversal ERROR: " + reverse.getProcessMsg(); + return null; + } + reverse.closeIt(); + reverse.setProcessing(false); + reverse.setDocStatus(DOCSTATUS_Reversed); + reverse.setDocAction(DOCACTION_None); + reverse.saveEx(get_TrxName()); + // + msgd = new StringBuilder("(").append(reverse.getDocumentNo()).append("<-)"); + addDescription(msgd.toString()); + setProcessed(true); + setReversal_ID(reverse.getGL_Journal_ID()); + setDocStatus(DOCSTATUS_Reversed); setDocAction(DOCACTION_None); return reverse; } // reverseAccrualIt diff --git a/org.adempiere.base/src/org/compiere/model/MJournalBatch.java b/org.adempiere.base/src/org/compiere/model/MJournalBatch.java index 336cbc25f8..ec67283ab7 100644 --- a/org.adempiere.base/src/org/compiere/model/MJournalBatch.java +++ b/org.adempiere.base/src/org/compiere/model/MJournalBatch.java @@ -628,16 +628,11 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction reverse.setC_Period_ID(getC_Period_ID()); reverse.setDateAcct(getDateAcct()); // Reverse indicator - StringBuilder description; - if (reverse.getDescription() == null) - description = new StringBuilder("** ").append(getDocumentNo()).append(" **"); - else - description = new StringBuilder(reverse.getDescription()).append(" ** ").append(getDocumentNo()).append(" **"); - reverse.setDescription(description.toString()); + StringBuilder msgd = new StringBuilder("(->").append(getDocumentNo()).append(")"); + reverse.addDescription(msgd.toString()); //[ 1948157 ] reverse.setReversal_ID(getGL_JournalBatch_ID()); reverse.saveEx(); - // // Reverse Journals for (int i = 0; i < journals.length; i++) @@ -652,9 +647,26 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction } journal.saveEx(); } - + // + if (!reverse.processIt(DocAction.ACTION_Complete)) + { + m_processMsg = "Reversal ERROR: " + reverse.getProcessMsg(); + return false; + } + reverse.closeIt(); + reverse.setProcessing(false); + reverse.setDocStatus(DOCSTATUS_Reversed); + reverse.setDocAction(DOCACTION_None); + reverse.saveEx(get_TrxName()); + // + msgd = new StringBuilder("(").append(reverse.getDocumentNo()).append("<-)"); + addDescription(msgd.toString()); + + setProcessed(true); //[ 1948157 ] setReversal_ID(reverse.getGL_JournalBatch_ID()); + setDocStatus(DOCSTATUS_Reversed); + setDocAction(DOCACTION_None); saveEx(); // After reverseCorrect m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSECORRECT); @@ -699,12 +711,9 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction reverse.setDateDoc(new Timestamp(System.currentTimeMillis())); reverse.setDateAcct(reverse.getDateDoc()); // Reverse indicator - StringBuilder description; - if (reverse.getDescription() == null) - description = new StringBuilder("** ").append(getDocumentNo()).append(" **"); - else - description = new StringBuilder(reverse.getDescription()).append(" ** ").append(getDocumentNo()).append(" **"); - reverse.setDescription(description.toString()); + StringBuilder msgd = new StringBuilder("(->").append(getDocumentNo()).append(")"); + reverse.addDescription(msgd.toString()); + reverse.setReversal_ID(getGL_JournalBatch_ID()); reverse.saveEx(); // Reverse Journals @@ -720,6 +729,26 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction } journal.saveEx(); } + // + if (!reverse.processIt(DocAction.ACTION_Complete)) + { + m_processMsg = "Reversal ERROR: " + reverse.getProcessMsg(); + return false; + } + reverse.closeIt(); + reverse.setProcessing(false); + reverse.setDocStatus(DOCSTATUS_Reversed); + reverse.setDocAction(DOCACTION_None); + reverse.saveEx(get_TrxName()); + // + msgd = new StringBuilder("(").append(reverse.getDocumentNo()).append("<-)"); + addDescription(msgd.toString()); + + setProcessed(true); + setReversal_ID(reverse.getGL_JournalBatch_ID()); + setDocStatus(DOCSTATUS_Reversed); + setDocAction(DOCACTION_None); + saveEx(); // After reverseAccrual m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSEACCRUAL); if (m_processMsg != null) @@ -872,4 +901,14 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction return getTotalDr(); } // getApprovalAmt + public void addDescription (String description) + { + String desc = getDescription(); + if (desc == null) + setDescription(description); + else{ + StringBuilder msgd = new StringBuilder(desc).append(" | ").append(description); + setDescription(msgd.toString()); + } + } } // MJournalBatch diff --git a/org.adempiere.base/src/org/compiere/model/MJournalLine.java b/org.adempiere.base/src/org/compiere/model/MJournalLine.java index 10352f3f92..d56f6f0269 100644 --- a/org.adempiere.base/src/org/compiere/model/MJournalLine.java +++ b/org.adempiere.base/src/org/compiere/model/MJournalLine.java @@ -441,7 +441,8 @@ public class MJournalLine extends X_GL_JournalLine MAccount acct = MAccount.get(getCtx(), getAD_Client_ID(), getAD_Org_ID(), gl.getC_AcctSchema_ID(), getAccount_ID(), getC_SubAcct_ID(), getM_Product_ID(), getC_BPartner_ID(), getAD_OrgTrx_ID(), getC_LocFrom_ID(), getC_LocTo_ID(), getC_SalesRegion_ID(), getC_Project_ID(), getC_Campaign_ID(), - getC_Activity_ID(), getUser1_ID(), getUser2_ID(), 0, 0); + getC_Activity_ID(), getUser1_ID(), getUser2_ID(), 0, 0, + get_TrxName()); if (acct != null) { diff --git a/org.adempiere.base/src/org/compiere/model/MOrderLandedCost.java b/org.adempiere.base/src/org/compiere/model/MOrderLandedCost.java index 15daceb800..adb1b17bdd 100644 --- a/org.adempiere.base/src/org/compiere/model/MOrderLandedCost.java +++ b/org.adempiere.base/src/org/compiere/model/MOrderLandedCost.java @@ -146,8 +146,8 @@ public class MOrderLandedCost extends X_C_OrderLandedCost { if (base.signum() != 0) { BigDecimal result = getAmt().multiply(base); - result = result.divide(total, orderLine.getParent().getC_Currency().getStdPrecision(), BigDecimal.ROUND_HALF_UP); - allocation.setAmt(result.doubleValue(), orderLine.getParent().getC_Currency().getStdPrecision()); + result = result.divide(total, orderLine.getParent().getC_Currency().getCostingPrecision(), BigDecimal.ROUND_HALF_UP); + allocation.setAmt(result.doubleValue(), orderLine.getParent().getC_Currency().getCostingPrecision()); } allocation.saveEx(); } diff --git a/org.adempiere.base/src/org/compiere/model/MPInstance.java b/org.adempiere.base/src/org/compiere/model/MPInstance.java index 7619823d30..26855eab54 100644 --- a/org.adempiere.base/src/org/compiere/model/MPInstance.java +++ b/org.adempiere.base/src/org/compiere/model/MPInstance.java @@ -21,14 +21,21 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.Timestamp; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Properties; import java.util.logging.Level; +import org.adempiere.base.Service; +import org.adempiere.base.event.EventManager; import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.Msg; +import org.idempiere.distributed.IMessageService; +import org.idempiere.distributed.ITopic; +import org.osgi.service.event.Event; /** * Process Instance Model @@ -45,7 +52,9 @@ public class MPInstance extends X_AD_PInstance /** * */ - private static final long serialVersionUID = -3952972645135787655L; + private static final long serialVersionUID = -4047766735041088419L; + + public static final String ON_RUNNING_JOB_CHANGED_TOPIC = "onRunningJobChanged"; private static CLogger s_log = CLogger.getCLogger (MPInstance.class); @@ -353,6 +362,23 @@ public class MPInstance extends X_AD_PInstance return ip; } + public static void publishChangedEvent(int AD_User_ID) { + IMessageService service = Service.locator().locate(IMessageService.class).getService(); + if (service != null) { + ITopic topic = service.getTopic(ON_RUNNING_JOB_CHANGED_TOPIC); + topic.publish(AD_User_ID); + } else { + postOnChangedEvent(AD_User_ID); + } + } + + public static void postOnChangedEvent(int AD_User_ID) { + Map properties = new HashMap(); + properties.put("AD_User_ID", AD_User_ID); + Event event = new Event(ON_RUNNING_JOB_CHANGED_TOPIC, properties); + EventManager.getInstance().postEvent(event); + } + public static List get(Properties ctx, int AD_Process_ID, int AD_User_ID) { List list = new ArrayList(); List paramsStrAdded = new ArrayList(); diff --git a/org.adempiere.base/src/org/compiere/model/MSysConfig.java b/org.adempiere.base/src/org/compiere/model/MSysConfig.java index 67479184e6..0e11db4059 100644 --- a/org.adempiere.base/src/org/compiere/model/MSysConfig.java +++ b/org.adempiere.base/src/org/compiere/model/MSysConfig.java @@ -122,6 +122,12 @@ public class MSysConfig extends X_AD_SysConfig public static final String TAX_SAVE_REQUEST_RESPONSE_LOG = "TAX_SAVE_REQUEST_RESPONSE_LOG"; public static final String ADDRESS_SAVE_REQUEST_RESPONSE_LOG = "ADDRESS_SAVE_REQUEST_RESPONSE_LOG"; public static final String VALIDATE_MATCHING_TO_ORDERED_QTY = "VALIDATE_MATCHING_TO_ORDERED_QTY"; + + public static final String BACKGROUND_JOB_ALLOWED = "BACKGROUND_JOB_ALLOWED"; + public static final String BACKGROUND_JOB_BY_DEFAULT = "BACKGROUND_JOB_BY_DEFAULT"; + public static final String BACKGROUND_JOB_MAX_IN_SYSTEM = "BACKGROUND_JOB_MAX_IN_SYSTEM"; + public static final String BACKGROUND_JOB_MAX_PER_CLIENT = "BACKGROUND_JOB_MAX_PER_CLIENT"; + public static final String BACKGROUND_JOB_MAX_PER_USER = "BACKGROUND_JOB_MAX_PER_USER"; public static final String DPVIEWS_SHOWINFOACCOUNT = "DPViews_ShowInfoAccount"; public static final String DPVIEWS_SHOWINFOSCHEDULE = "DPViews_ShowInfoSchedule"; diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_InfoWindow.java b/org.adempiere.base/src/org/compiere/model/X_AD_InfoWindow.java index 2aeace3f2a..0a9ec8c814 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_InfoWindow.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_InfoWindow.java @@ -30,7 +30,7 @@ public class X_AD_InfoWindow extends PO implements I_AD_InfoWindow, I_Persistent /** * */ - private static final long serialVersionUID = 20140124L; + private static final long serialVersionUID = 20140516L; /** Standard Constructor */ public X_AD_InfoWindow (Properties ctx, int AD_InfoWindow_ID, String trxName) @@ -51,6 +51,8 @@ public class X_AD_InfoWindow extends PO implements I_AD_InfoWindow, I_Persistent // Y setIsValid (false); // N + setMaxQueryRecords (0); +// 0 setName (null); } */ } @@ -385,6 +387,26 @@ public class X_AD_InfoWindow extends PO implements I_AD_InfoWindow, I_Persistent return false; } + /** Set Max Query Records. + @param MaxQueryRecords + If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records + */ + public void setMaxQueryRecords (int MaxQueryRecords) + { + set_Value (COLUMNNAME_MaxQueryRecords, Integer.valueOf(MaxQueryRecords)); + } + + /** Get Max Query Records. + @return If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records + */ + public int getMaxQueryRecords () + { + Integer ii = (Integer)get_Value(COLUMNNAME_MaxQueryRecords); + if (ii == null) + return 0; + return ii.intValue(); + } + /** Set Name. @param Name Alphanumeric identifier of the entity diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_PInstance.java b/org.adempiere.base/src/org/compiere/model/X_AD_PInstance.java index 1dd50b1e0b..4b73e5acd1 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_PInstance.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_PInstance.java @@ -30,7 +30,7 @@ public class X_AD_PInstance extends PO implements I_AD_PInstance, I_Persistent /** * */ - private static final long serialVersionUID = 20140404L; + private static final long serialVersionUID = 20140331L; /** Standard Constructor */ public X_AD_PInstance (Properties ctx, int AD_PInstance_ID, String trxName) @@ -41,6 +41,8 @@ public class X_AD_PInstance extends PO implements I_AD_PInstance, I_Persistent setAD_PInstance_ID (0); setAD_Process_ID (0); setIsProcessing (false); + setIsRunAsJob (false); +// N setRecord_ID (0); } */ } @@ -226,6 +228,55 @@ public class X_AD_PInstance extends PO implements I_AD_PInstance, I_Persistent return (String)get_Value(COLUMNNAME_Name); } + /** Set Run as Job. + @param IsRunAsJob Run as Job */ + public void setIsRunAsJob (boolean IsRunAsJob) + { + set_Value (COLUMNNAME_IsRunAsJob, Boolean.valueOf(IsRunAsJob)); + } + + /** Get Run as Job. + @return Run as Job */ + public boolean isRunAsJob () + { + Object oo = get_Value(COLUMNNAME_IsRunAsJob); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** NotificationType AD_Reference_ID=344 */ + public static final int NOTIFICATIONTYPE_AD_Reference_ID=344; + /** EMail = E */ + public static final String NOTIFICATIONTYPE_EMail = "E"; + /** Notice = N */ + public static final String NOTIFICATIONTYPE_Notice = "N"; + /** None = X */ + public static final String NOTIFICATIONTYPE_None = "X"; + /** EMail+Notice = B */ + public static final String NOTIFICATIONTYPE_EMailPlusNotice = "B"; + /** Set Notification Type. + @param NotificationType + Type of Notifications + */ + public void setNotificationType (String NotificationType) + { + + set_Value (COLUMNNAME_NotificationType, NotificationType); + } + + /** Get Notification Type. + @return Type of Notifications + */ + public String getNotificationType () + { + return (String)get_Value(COLUMNNAME_NotificationType); + } + /** Set Record ID. @param Record_ID Direct internal record ID diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_PrintFormatItem.java b/org.adempiere.base/src/org/compiere/model/X_AD_PrintFormatItem.java index ead7455dd2..14433df311 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_PrintFormatItem.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_PrintFormatItem.java @@ -398,6 +398,8 @@ public class X_AD_PrintFormatItem extends PO implements I_AD_PrintFormatItem, I_ public static final String BARCODETYPE_Code39LinearWOChecksum = "c39"; /** EAN 13 = E13 */ public static final String BARCODETYPE_EAN13 = "E13"; + /** UPCA = UPCA*/ + public static final String BARCODETYPE_UPCA = "UPA"; /** Set Barcode Type. @param BarcodeType Type of barcode diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_User.java b/org.adempiere.base/src/org/compiere/model/X_AD_User.java index 257adc030c..c14ee13be8 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_User.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_User.java @@ -31,7 +31,7 @@ public class X_AD_User extends PO implements I_AD_User, I_Persistent /** * */ - private static final long serialVersionUID = 20131031L; + private static final long serialVersionUID = 20140502L; /** Standard Constructor */ public X_AD_User (Properties ctx, int AD_User_ID, String trxName) @@ -42,6 +42,8 @@ public class X_AD_User extends PO implements I_AD_User, I_Persistent setAD_User_ID (0); setFailedLoginCount (0); // 0 + setIsAddMailTextAutomatically (false); +// N setIsExpired (false); // N setIsFullBPAccess (true); @@ -584,6 +586,30 @@ public class X_AD_User extends PO implements I_AD_User, I_Persistent return (String)get_Value(COLUMNNAME_Fax); } + /** Set Add Mail Text Automatically. + @param IsAddMailTextAutomatically + The selected mail template will be automatically inserted when creating an email + */ + public void setIsAddMailTextAutomatically (boolean IsAddMailTextAutomatically) + { + set_Value (COLUMNNAME_IsAddMailTextAutomatically, Boolean.valueOf(IsAddMailTextAutomatically)); + } + + /** Get Add Mail Text Automatically. + @return The selected mail template will be automatically inserted when creating an email + */ + public boolean isAddMailTextAutomatically () + { + Object oo = get_Value(COLUMNNAME_IsAddMailTextAutomatically); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + /** Set Expired. @param IsExpired Expired */ public void setIsExpired (boolean IsExpired) @@ -1021,6 +1047,31 @@ public class X_AD_User extends PO implements I_AD_User, I_Persistent return false; } + public org.compiere.model.I_R_MailText getR_DefaultMailText() throws RuntimeException + { + return (org.compiere.model.I_R_MailText)MTable.get(getCtx(), org.compiere.model.I_R_MailText.Table_Name) + .getPO(getR_DefaultMailText_ID(), get_TrxName()); } + + /** Set Default mail template. + @param R_DefaultMailText_ID Default mail template */ + public void setR_DefaultMailText_ID (int R_DefaultMailText_ID) + { + if (R_DefaultMailText_ID < 1) + set_Value (COLUMNNAME_R_DefaultMailText_ID, null); + else + set_Value (COLUMNNAME_R_DefaultMailText_ID, Integer.valueOf(R_DefaultMailText_ID)); + } + + /** Get Default mail template. + @return Default mail template */ + public int getR_DefaultMailText_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_R_DefaultMailText_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + public org.compiere.model.I_AD_User getSalesRep() throws RuntimeException { return (org.compiere.model.I_AD_User)MTable.get(getCtx(), org.compiere.model.I_AD_User.Table_Name) diff --git a/org.adempiere.base/src/org/compiere/print/ServerReportCtl.java b/org.adempiere.base/src/org/compiere/print/ServerReportCtl.java index fee6150cbc..048f883255 100644 --- a/org.adempiere.base/src/org/compiere/print/ServerReportCtl.java +++ b/org.adempiere.base/src/org/compiere/print/ServerReportCtl.java @@ -13,6 +13,7 @@ import org.compiere.process.ProcessInfoParameter; import org.compiere.process.ServerProcessCtl; import org.compiere.util.CLogger; import org.compiere.util.Env; +import org.compiere.util.Trx; @@ -28,6 +29,19 @@ public class ServerReportCtl { /** Static Logger */ private static CLogger s_log = CLogger.getCLogger (ServerReportCtl.class); + /** + * Start Document Print for Type with specified printer. + * @param type + * @param customPrintFormat + * @param Record_ID + * @param printerName + * @return + */ + public static boolean startDocumentPrint (int type, MPrintFormat customPrintFormat, int Record_ID, String printerName) + { + return startDocumentPrint(type, customPrintFormat, Record_ID, printerName, null); + } + /** * Start Document Print for Type with specified printer. * @param type document type in ReportEngine @@ -35,9 +49,10 @@ public class ServerReportCtl { * @param parent The window which invoked the printing * @param WindowNo The windows number which invoked the printing * @param printerName Specified printer name + * @param pi * @return true if success */ - public static boolean startDocumentPrint (int type, MPrintFormat customPrintFormat, int Record_ID, String printerName) + public static boolean startDocumentPrint (int type, MPrintFormat customPrintFormat, int Record_ID, String printerName, ProcessInfo pi) { ReportEngine re = ReportEngine.get (Env.getCtx(), type, Record_ID); if (re == null) @@ -59,21 +74,27 @@ public class ServerReportCtl { // ============================== if(format.getJasperProcess_ID() > 0) { - boolean result = runJasperProcess(Record_ID, re, true, printerName); + boolean result = runJasperProcess(Record_ID, re, true, printerName, pi); return(result); } else // Standard Print Format (Non-Jasper) // ================================== { - createOutput(re, printerName); + if (pi != null && pi.isBatch() && pi.isPrintPreview()) + { + pi.setPDFReport(re.getPDF()); + } + else + { + createOutput(re, printerName); + } ReportEngine.printConfirm (type, Record_ID); } } return true; } // StartDocumentPrint - /** * Runs a Jasper process that prints the record * @@ -85,10 +106,29 @@ public class ServerReportCtl { * @return */ public static boolean runJasperProcess(int Record_ID, ReportEngine re, boolean IsDirectPrint, String printerName) { + return runJasperProcess(Record_ID, re, IsDirectPrint, printerName, null); + } + + /** + * Runs a Jasper process that prints the record + * + * @param format + * @param Record_ID + * @param re + * @param IsDirectPrint + * @param printerName + * @return + */ + public static boolean runJasperProcess(int Record_ID, ReportEngine re, boolean IsDirectPrint, String printerName, ProcessInfo pi) { MPrintFormat format = re.getPrintFormat(); - ProcessInfo pi = new ProcessInfo ("", format.getJasperProcess_ID()); - pi.setPrintPreview( !IsDirectPrint ); - pi.setRecord_ID ( Record_ID ); + ProcessInfo jasperProcessInfo = new ProcessInfo ("", format.getJasperProcess_ID()); + if (pi != null) { + jasperProcessInfo.setPrintPreview(pi.isPrintPreview()); + jasperProcessInfo.setIsBatch(pi.isBatch()); + } else { + jasperProcessInfo.setPrintPreview( !IsDirectPrint ); + } + jasperProcessInfo.setRecord_ID ( Record_ID ); ArrayList jasperPrintParams = new ArrayList(); ProcessInfoParameter pip; if (printerName!=null && printerName.trim().length()>0) { @@ -101,11 +141,15 @@ public class ServerReportCtl { pip = new ProcessInfoParameter(PARAM_PRINT_INFO, re.getPrintInfo(), null, null, null); jasperPrintParams.add(pip); - pi.setParameter(jasperPrintParams.toArray(new ProcessInfoParameter[]{})); + jasperProcessInfo.setParameter(jasperPrintParams.toArray(new ProcessInfoParameter[]{})); - ServerProcessCtl.process(pi, null); + ServerProcessCtl.process(jasperProcessInfo, pi != null ? Trx.get(pi.getTransactionName(),false) : null); - boolean result = true; + boolean result = !jasperProcessInfo.isError(); + if (result && pi != null && pi.isBatch()) + { + pi.setPDFReport(jasperProcessInfo.getPDFReport()); + } return(result); } @@ -139,21 +183,21 @@ public class ServerReportCtl { * Order Print */ if (pi.getAD_Process_ID() == 110) // C_Order - return startDocumentPrint(ReportEngine.ORDER, null, pi.getRecord_ID(), null); + return startDocumentPrint(ReportEngine.ORDER, null, pi.getRecord_ID(), null, pi); if (pi.getAD_Process_ID() == MProcess.getProcess_ID("Rpt PP_Order", null)) // C_Order - return startDocumentPrint(ReportEngine.MANUFACTURING_ORDER, null, pi.getRecord_ID(), null); + return startDocumentPrint(ReportEngine.MANUFACTURING_ORDER, null, pi.getRecord_ID(), null, pi); if (pi.getAD_Process_ID() == MProcess.getProcess_ID("Rpt DD_Order", null)) // C_Order - return startDocumentPrint(ReportEngine.DISTRIBUTION_ORDER, null, pi.getRecord_ID(), null); + return startDocumentPrint(ReportEngine.DISTRIBUTION_ORDER, null, pi.getRecord_ID(), null, pi); else if (pi.getAD_Process_ID() == 116) // C_Invoice - return startDocumentPrint(ReportEngine.INVOICE, null, pi.getRecord_ID(), null); + return startDocumentPrint(ReportEngine.INVOICE, null, pi.getRecord_ID(), null, pi); else if (pi.getAD_Process_ID() == 117) // M_InOut - return startDocumentPrint(ReportEngine.SHIPMENT, null, pi.getRecord_ID(), null); + return startDocumentPrint(ReportEngine.SHIPMENT, null, pi.getRecord_ID(), null, pi); else if (pi.getAD_Process_ID() == 217) // C_Project - return startDocumentPrint(ReportEngine.PROJECT, null, pi.getRecord_ID(), null); + return startDocumentPrint(ReportEngine.PROJECT, null, pi.getRecord_ID(), null, pi); else if (pi.getAD_Process_ID() == 276) // C_RfQResponse - return startDocumentPrint(ReportEngine.RFQ, null, pi.getRecord_ID(), null); + return startDocumentPrint(ReportEngine.RFQ, null, pi.getRecord_ID(), null, pi); else if (pi.getAD_Process_ID() == 159) // Dunning - return startDocumentPrint(ReportEngine.DUNNING, null, pi.getRecord_ID(), null); + return startDocumentPrint(ReportEngine.DUNNING, null, pi.getRecord_ID(), null, pi); else if (pi.getAD_Process_ID() == 202 // Financial Report || pi.getAD_Process_ID() == 204) // Financial Statement return startFinReport (pi); @@ -203,7 +247,14 @@ public class ServerReportCtl { MQuery query = MQuery.get (ctx, pi.getAD_PInstance_ID(), TableName); PrintInfo info = new PrintInfo(pi); re = new ReportEngine(ctx, format, query, info); - createOutput(re, null); + if (pi.isPrintPreview() && pi.isBatch()) + { + pi.setPDFReport(re.getPDF()); + } + else + { + createOutput(re, null); + } return true; } // @@ -217,7 +268,14 @@ public class ServerReportCtl { } } - createOutput(re, null); + if (pi.isPrintPreview() && pi.isBatch()) + { + pi.setPDFReport(re.getPDF()); + } + else + { + createOutput(re, null); + } return true; } // startStandardReport @@ -247,7 +305,14 @@ public class ServerReportCtl { PrintInfo info = new PrintInfo(pi); ReportEngine re = new ReportEngine(Env.getCtx(), format, query, info); - createOutput(re, null); + if (pi.isPrintPreview() && pi.isBatch()) + { + pi.setPDFReport(re.getPDF()); + } + else + { + createOutput(re, null); + } return true; } // startFinReport diff --git a/org.adempiere.base/src/org/compiere/print/layout/BarcodeElement.java b/org.adempiere.base/src/org/compiere/print/layout/BarcodeElement.java index f39c41efe3..8f4d45c5bc 100644 --- a/org.adempiere.base/src/org/compiere/print/layout/BarcodeElement.java +++ b/org.adempiere.base/src/org/compiere/print/layout/BarcodeElement.java @@ -24,11 +24,16 @@ import java.util.Properties; import net.sourceforge.barbecue.Barcode; import net.sourceforge.barbecue.BarcodeFactory; +import net.sourceforge.barbecue.BarcodeImageHandler; import net.sourceforge.barbecue.linear.ean.UCCEAN128Barcode; -import net.sourceforge.barbecue.output.OutputException; import org.compiere.print.MPrintFont; import org.compiere.print.MPrintFormatItem; +import org.krysalis.barcode4j.BarcodeDimension; +import org.krysalis.barcode4j.ChecksumMode; +import org.krysalis.barcode4j.HumanReadablePlacement; +import org.krysalis.barcode4j.impl.upcean.UPCABean; +import org.krysalis.barcode4j.output.bitmap.BitmapCanvasProvider; /** * Barcode Print Element @@ -60,7 +65,7 @@ public class BarcodeElement extends PrintElement m_valid = false; createBarcode(code, item); - if (m_barcode == null) + if (m_barcode == null && m_upc == null) m_valid = false; m_allowOverflow = item.isHeightOneLine(); // teo_sarca, [ 1673590 ] } // BarcodeElement @@ -73,6 +78,9 @@ public class BarcodeElement extends PrintElement private boolean m_allowOverflow = true; private float m_scaleFactor = 1; + private UPCABean m_upc = null; + private String m_code; + /** * Create Barcode * @param code barcode data string @@ -131,7 +139,12 @@ public class BarcodeElement extends PrintElement m_barcode = BarcodeFactory.createUCC128(UCCEAN128Barcode.EAN128_AI, code); else if (type.equals(MPrintFormatItem.BARCODETYPE_EAN13)) //@Trifon m_barcode = BarcodeFactory.createEAN13(code); //@Trifon - + else if (type.equals(MPrintFormatItem.BARCODETYPE_UPCA )) { + m_upc = new UPCABean(); + m_upc.setChecksumMode(ChecksumMode.CP_AUTO); + m_upc.setMsgPosition(HumanReadablePlacement.HRP_BOTTOM); + m_code = code; + } // http://www.usps.com/cpim/ftp/pubs/pub97/97apxs_006.html#_Toc481397331 else if (type.equals(MPrintFormatItem.BARCODETYPE_USPostalServiceUCCEAN128)) { @@ -145,7 +158,7 @@ public class BarcodeElement extends PrintElement { log.warning(code + " - " + e.toString()); m_valid = false; - } + } if (m_valid && m_barcode != null) { @@ -158,15 +171,6 @@ public class BarcodeElement extends PrintElement } } // createBarcode - /** - * Get Barcode - * @return Barcode - */ - public Barcode getBarcode() - { - return m_barcode; - } // getBarcode - /** * Is Barcode Valid * @return true if valid @@ -185,11 +189,31 @@ public class BarcodeElement extends PrintElement { p_width = 0; p_height = 0; - if (m_barcode == null) + if (m_barcode == null && m_upc == null) return true; - p_width = m_barcode.getWidth(); - p_height = m_barcode.getHeight(); + if (m_barcode != null) + { + p_width = m_barcode.getWidth(); + p_height = m_barcode.getHeight(); + + //convert from pixel to point/inch + if (p_width > 0) + p_width = p_width * 3f / 4f; + if (p_height > 0) + p_height = p_height * 3f / 4f; + } + else + { + BarcodeDimension t = m_upc.calcDimensions(m_code); + //convert from mm to point/inch + p_width = (float) (t.getWidthPlusQuiet() / 25.4f * 72f); + p_height = (float) (t.getHeight() / 25.4f * 72f); + + // * 3 for resolution of 216 dpi ( 72 * 3 ) + p_width *= 3f; + p_height *=3f; + } if (p_width * p_height == 0) return true; // don't bother scaling and prevent div by 0 @@ -231,7 +255,7 @@ public class BarcodeElement extends PrintElement public void paint (Graphics2D g2D, int pageNo, Point2D pageStart, Properties ctx, boolean isView) { - if (!m_valid || m_barcode == null) + if (!m_valid || (m_barcode == null && m_upc == null )) return; // Position @@ -243,15 +267,28 @@ public class BarcodeElement extends PrintElement x += (p_maxWidth - p_width) / 2; int y = (int)location.y; + paint(g2D, x, y); + } // paint + + public void paint(Graphics2D g2D, int x, int y) { try { - int w = m_barcode.getWidth(); - int h = m_barcode.getHeight(); + BufferedImage image = null; - // draw barcode to buffer - BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB); - Graphics2D temp = (Graphics2D) image.getGraphics(); - m_barcode.draw(temp, 0, 0); + if (m_barcode != null) + { + // draw barcode to buffer + image = BarcodeImageHandler.getImage(m_barcode); + + } + else + { + //use resolution of 216 dpi (72 * 3) for better output + BitmapCanvasProvider provider = new BitmapCanvasProvider(72*3, BufferedImage.TYPE_INT_ARGB, true, 0); + m_upc.generateBarcode(provider, m_code); + provider.finish(); + image = provider.getBufferedImage(); + } // scale barcode and paint AffineTransform transform = new AffineTransform(); @@ -259,9 +296,10 @@ public class BarcodeElement extends PrintElement transform.scale(m_scaleFactor, m_scaleFactor); g2D.drawImage(image, transform, this); - } catch (OutputException e) { - } - } // paint + } catch (Exception e) { + e.printStackTrace(); + } + } /** * String Representation diff --git a/org.adempiere.base/src/org/compiere/print/layout/TableElement.java b/org.adempiere.base/src/org/compiere/print/layout/TableElement.java index 97e91d8ee2..92ac9f3c2b 100644 --- a/org.adempiere.base/src/org/compiere/print/layout/TableElement.java +++ b/org.adempiere.base/src/org/compiere/print/layout/TableElement.java @@ -29,7 +29,6 @@ import java.awt.font.TextAttribute; import java.awt.font.TextLayout; import java.awt.geom.AffineTransform; import java.awt.geom.Point2D; -import java.awt.image.BufferedImage; import java.io.Serializable; import java.text.AttributedCharacterIterator; import java.text.AttributedString; @@ -41,9 +40,6 @@ import java.util.Properties; import java.util.logging.Level; import java.util.regex.Pattern; -import net.sourceforge.barbecue.Barcode; -import net.sourceforge.barbecue.output.OutputException; - import org.compiere.model.MQuery; import org.compiere.print.MPrintFormatItem; import org.compiere.print.MPrintTableFormat; @@ -314,6 +310,15 @@ public class TableElement extends PrintElement for (int row = 0; row < rows; row++) { m_data.setRowIndex(row); + // define if all the row is null + boolean isNullRow = true; + for (Serializable element : m_data.getRowData()) { + if (element != null) { + isNullRow = false; + break; + } + } + // if (dataSizes.getRowCount() <= row) { dataSizes.addRow(new ArrayList()); @@ -331,7 +336,9 @@ public class TableElement extends PrintElement if (dataItem == null) { //ensure fixed column width respected even when data is null - if (m_columnMaxWidth[col] != 0 && m_columnMaxWidth[col] != -1 && m_fixedWidth[col]) + if ( m_columnMaxWidth[dataCol] >= 0 // the data column is not suppress null + && m_fixedWidth[col] // the print column (below column) has fixed width + && !isNullRow) { dataItem = " "; } @@ -1219,8 +1226,8 @@ public class TableElement extends PrintElement int startX = (int)pageStart.getX(); int startY = (int)pageStart.getY(); // Table Start - startX += pageXindex == 0 ? m_firstPage.x : m_nextPages.x; - startY += pageYindex == 0 ? m_firstPage.y : m_nextPages.y; + startX += pageIndex == 0 ? m_firstPage.x : m_nextPages.x; + startY += pageIndex == 0 ? m_firstPage.y : m_nextPages.y; if (DEBUG_PRINT) if (log.isLoggable(Level.FINEST)) log.finest("PageStart=" + pageStart + ", StartTable x=" + startX + ", y=" + startY); @@ -1466,34 +1473,8 @@ public class TableElement extends PrintElement } else if (printItems[index] instanceof BarcodeElement) { - try { - Barcode barcode = ((BarcodeElement)printItems[index]).getBarcode(); - if ( barcode != null ) - { - double scale = ((BarcodeElement)printItems[index]).getScaleFactor(); - if ( scale != 1.0 ) - { - int w = barcode.getWidth(); - int h = barcode.getHeight(); - - // draw barcode to buffer - BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB); - Graphics2D temp = (Graphics2D) image.getGraphics(); - barcode.draw(temp, 0, 0); - - // scale barcode and paint - AffineTransform transform = new AffineTransform(); - transform.translate(curX,penY); - transform.scale(scale, scale); - g2D.drawImage(image, transform, this); - } - else - { - barcode.draw(g2D, curX, (int)penY); - } - } - } catch (OutputException e) { - } + BarcodeElement barcodeElement = (BarcodeElement)printItems[index]; + barcodeElement.paint(g2D, curX, (int)penY); } else if (printItems[index] instanceof Boolean) { diff --git a/org.adempiere.base/src/org/compiere/process/ServerProcessCtl.java b/org.adempiere.base/src/org/compiere/process/ServerProcessCtl.java index 1d098e7405..3e9caa739f 100644 --- a/org.adempiere.base/src/org/compiere/process/ServerProcessCtl.java +++ b/org.adempiere.base/src/org/compiere/process/ServerProcessCtl.java @@ -61,31 +61,38 @@ public class ServerProcessCtl implements Runnable { if (log.isLoggable(Level.FINE)) log.fine("ServerProcess - " + pi); MPInstance instance = null; - try - { - instance = new MPInstance(Env.getCtx(), pi.getAD_Process_ID(), pi.getRecord_ID()); - } - catch (Exception e) - { - pi.setSummary (e.getLocalizedMessage()); - pi.setError (true); - log.warning(pi.toString()); - return null; - } - catch (Error e) - { - pi.setSummary (e.getLocalizedMessage()); - pi.setError (true); - log.warning(pi.toString()); - return null; - } - if (!instance.save()) + if (pi.getAD_PInstance_ID() <= 0) { - pi.setSummary (Msg.getMsg(Env.getCtx(), "ProcessNoInstance")); - pi.setError (true); - return null; + try + { + instance = new MPInstance(Env.getCtx(), pi.getAD_Process_ID(), pi.getRecord_ID()); + } + catch (Exception e) + { + pi.setSummary (e.getLocalizedMessage()); + pi.setError (true); + log.warning(pi.toString()); + return null; + } + catch (Error e) + { + pi.setSummary (e.getLocalizedMessage()); + pi.setError (true); + log.warning(pi.toString()); + return null; + } + if (!instance.save()) + { + pi.setSummary (Msg.getMsg(Env.getCtx(), "ProcessNoInstance")); + pi.setError (true); + return null; + } + pi.setAD_PInstance_ID (instance.getAD_PInstance_ID()); + } + else + { + instance = new MPInstance(Env.getCtx(), pi.getAD_PInstance_ID(), null); } - pi.setAD_PInstance_ID (instance.getAD_PInstance_ID()); // execute ServerProcessCtl worker = new ServerProcessCtl(pi, trx); diff --git a/org.adempiere.base/src/org/compiere/util/EMail.java b/org.adempiere.base/src/org/compiere/util/EMail.java index 069e7a2f34..0f4e61ffda 100644 --- a/org.adempiere.base/src/org/compiere/util/EMail.java +++ b/org.adempiere.base/src/org/compiere/util/EMail.java @@ -941,7 +941,7 @@ public final class EMail implements Serializable (new ByteArrayDataSource (m_messageHTML, charSetName, "text/html"))); // Create Multipart and its parts to it - Multipart mp = new MimeMultipart(); + Multipart mp = new MimeMultipart("related"); mp.addBodyPart(mbp_1); if (log.isLoggable(Level.FINE)) log.fine("(multi) " + getSubject() + " - " + mbp_1); @@ -978,6 +978,11 @@ public final class EMail implements Serializable mbp_2.setDataHandler(new DataHandler(ds)); mbp_2.setFileName(ds.getName()); if (log.isLoggable(Level.FINE)) log.fine("Added Attachment " + ds.getName() + " - " + mbp_2); + + if (m_messageHTML != null && m_messageHTML.contains("cid:"+ds.getName())) { + mbp_2.setContentID("<" + ds.getName() + ">"); + mbp_2.setDisposition(MimeBodyPart.INLINE); + } mp.addBodyPart(mbp_2); } diff --git a/org.adempiere.base/src/org/globalqss/process/GLJournalGenerate.java b/org.adempiere.base/src/org/globalqss/process/GLJournalGenerate.java index baabd9f0d3..696d2b224d 100644 --- a/org.adempiere.base/src/org/globalqss/process/GLJournalGenerate.java +++ b/org.adempiere.base/src/org/globalqss/process/GLJournalGenerate.java @@ -503,7 +503,8 @@ public class GLJournalGenerate extends SvrProcess AD_OrgTrx_ID, C_LocFrom_ID, C_LocTo_ID, C_SalesRegion_ID, C_Project_ID, C_Campaign_ID, C_Activity_ID, User1_ID, User2_ID, UserElement1_ID, - UserElement2_ID); + UserElement2_ID, + get_TrxName()); if (combination == null) throw new AdempiereException("Could not create combination"); } diff --git a/org.adempiere.pipo/src/org/adempiere/pipo2/PackOut.java b/org.adempiere.pipo/src/org/adempiere/pipo2/PackOut.java index fba147e04e..4161c57663 100644 --- a/org.adempiere.pipo/src/org/adempiere/pipo2/PackOut.java +++ b/org.adempiere.pipo/src/org/adempiere/pipo2/PackOut.java @@ -229,6 +229,8 @@ public class PackOut .append("-") .append(client.getName()); atts.addAttribute("", "", "Client", "CDATA", sb.toString()); + if (client.getAD_Client_UU() == null) + throw new IllegalStateException("2Pack requires UUID on AD_Client"); atts.addAttribute("", "", "AD_Client_UU", "CDATA", client.getAD_Client_UU()); packoutHandler.startElement("","","idempiere",atts); diff --git a/org.adempiere.report.jasper.library/.classpath b/org.adempiere.report.jasper.library/.classpath index 4127efacdc..bf4c774983 100644 --- a/org.adempiere.report.jasper.library/.classpath +++ b/org.adempiere.report.jasper.library/.classpath @@ -2,7 +2,6 @@ - diff --git a/org.adempiere.report.jasper.library/META-INF/MANIFEST.MF b/org.adempiere.report.jasper.library/META-INF/MANIFEST.MF index 27dd9a000e..69989f5a23 100644 --- a/org.adempiere.report.jasper.library/META-INF/MANIFEST.MF +++ b/org.adempiere.report.jasper.library/META-INF/MANIFEST.MF @@ -7,7 +7,6 @@ Bundle-ClassPath: lib/commons-beanutils-1.8.0.jar, lib/commons-digester-2.1.jar, lib/jasperreports-5.1.2.jar, lib/jasperreports-fonts-5.1.2.jar, - lib/barcode4j-2.1.jar, lib/jackson-core-2.0.5.jar, lib/xalan-2.7.1.jar Export-Package: ., @@ -222,27 +221,6 @@ Export-Package: ., org.apache.xpath.operations, org.apache.xpath.patterns, org.apache.xpath.res, - org.krysalis.barcode4j, - org.krysalis.barcode4j.ant, - org.krysalis.barcode4j.cli, - org.krysalis.barcode4j.impl, - org.krysalis.barcode4j.impl.codabar, - org.krysalis.barcode4j.impl.code128, - org.krysalis.barcode4j.impl.code39, - org.krysalis.barcode4j.impl.datamatrix, - org.krysalis.barcode4j.impl.fourstate, - org.krysalis.barcode4j.impl.int2of5, - org.krysalis.barcode4j.impl.pdf417, - org.krysalis.barcode4j.impl.postnet, - org.krysalis.barcode4j.impl.upcean, - org.krysalis.barcode4j.output, - org.krysalis.barcode4j.output.bitmap, - org.krysalis.barcode4j.output.eps, - org.krysalis.barcode4j.output.java2d, - org.krysalis.barcode4j.output.svg, - org.krysalis.barcode4j.servlet, - org.krysalis.barcode4j.tools, - org.krysalis.barcode4j.xalan, org.w3c.tools.codec Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Import-Package: com.lowagie.text, @@ -456,6 +434,27 @@ Import-Package: com.lowagie.text, org.eclipse.jdt.internal.compiler.problem, org.eclipse.jdt.internal.compiler.tool, org.eclipse.jdt.internal.compiler.util, + org.krysalis.barcode4j, + org.krysalis.barcode4j.ant, + org.krysalis.barcode4j.cli, + org.krysalis.barcode4j.impl, + org.krysalis.barcode4j.impl.codabar, + org.krysalis.barcode4j.impl.code128, + org.krysalis.barcode4j.impl.code39, + org.krysalis.barcode4j.impl.datamatrix, + org.krysalis.barcode4j.impl.fourstate, + org.krysalis.barcode4j.impl.int2of5, + org.krysalis.barcode4j.impl.pdf417, + org.krysalis.barcode4j.impl.postnet, + org.krysalis.barcode4j.impl.upcean, + org.krysalis.barcode4j.output, + org.krysalis.barcode4j.output.bitmap, + org.krysalis.barcode4j.output.eps, + org.krysalis.barcode4j.output.java2d, + org.krysalis.barcode4j.output.svg, + org.krysalis.barcode4j.servlet, + org.krysalis.barcode4j.tools, + org.krysalis.barcode4j.xalan, org.w3c.css.sac;version="1.3.0", org.w3c.css.sac.helpers;version="1.3.0", org.w3c.dom;version="3.0.0", diff --git a/org.adempiere.report.jasper.library/build.properties b/org.adempiere.report.jasper.library/build.properties index 18d6345eae..5d3a0d0db3 100644 --- a/org.adempiere.report.jasper.library/build.properties +++ b/org.adempiere.report.jasper.library/build.properties @@ -3,6 +3,5 @@ bin.includes = META-INF/,\ lib/commons-digester-2.1.jar,\ lib/jasperreports-5.1.2.jar,\ lib/jasperreports-fonts-5.1.2.jar,\ - lib/barcode4j-2.1.jar,\ lib/jackson-core-2.0.5.jar,\ lib/xalan-2.7.1.jar diff --git a/org.adempiere.report.jasper/src/org/compiere/report/ReportStarter.java b/org.adempiere.report.jasper/src/org/compiere/report/ReportStarter.java index 6ddb441dcb..d4af2c36c3 100644 --- a/org.adempiere.report.jasper/src/org/compiere/report/ReportStarter.java +++ b/org.adempiere.report.jasper/src/org/compiere/report/ReportStarter.java @@ -626,7 +626,7 @@ public class ReportStarter implements ProcessCall, ClientProcess if (!processInfo.isExport()) { - if (reportData.isDirectPrint()) + if (reportData.isDirectPrint() || processInfo.isBatch()) { if (log.isLoggable(Level.INFO)) log.info( "ReportStarter.startProcess print report -" + jasperPrint.getName()); //RF 1906632 @@ -666,8 +666,6 @@ public class ReportStarter implements ProcessCall, ClientProcess } else { - // You can use JasperPrint to create PDF - // Used For the PH try { File PDF = File.createTempFile(makePrefix(jasperPrint.getName()), ".pdf"); @@ -684,10 +682,7 @@ public class ReportStarter implements ProcessCall, ClientProcess { log.severe("ReportStarter.startProcess: Can not make PDF File - "+ e.getMessage()); } - } - - // You can use JasperPrint to create PDF - // JasperExportManager.exportReportToPdfFile(jasperPrint, "BasicReport.pdf"); + } } else { if (log.isLoggable(Level.INFO)) log.info( "ReportStarter.startProcess run report -"+jasperPrint.getName()); JRViewerProvider viewerLauncher = Service.locator().locate(JRViewerProvider.class).getService(); diff --git a/org.adempiere.server/src/main/server/org/compiere/server/Scheduler.java b/org.adempiere.server/src/main/server/org/compiere/server/Scheduler.java index 6c35cf1039..38a91b3cc7 100644 --- a/org.adempiere.server/src/main/server/org/compiere/server/Scheduler.java +++ b/org.adempiere.server/src/main/server/org/compiere/server/Scheduler.java @@ -22,7 +22,11 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Timestamp; +import java.text.DecimalFormat; import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; import java.util.Properties; import java.util.logging.Level; @@ -39,7 +43,6 @@ import org.compiere.model.MScheduler; import org.compiere.model.MSchedulerLog; import org.compiere.model.MSchedulerPara; import org.compiere.model.MUser; -import org.compiere.print.ReportEngine; import org.compiere.process.ProcessInfo; import org.compiere.process.ProcessInfoUtil; import org.compiere.process.ServerProcessCtl; @@ -157,7 +160,8 @@ public class Scheduler extends AdempiereServer { if (log.isLoggable(Level.INFO)) log.info(process.toString()); - boolean isReport = (process.isReport() || process.getAD_ReportView_ID() > 0); + boolean isReport = (process.isReport() || process.getAD_ReportView_ID() > 0 || process.getJasperReport() != null || process.getAD_PrintFormat_ID() > 0); + String schedulerName = Env.parseContext(m_schedulerctx, -1, m_model.getName(), false, true); // Process (see also MWFActivity.performWork int AD_Table_ID = m_model.getAD_Table_ID(); @@ -170,9 +174,12 @@ public class Scheduler extends AdempiereServer pi.setAD_User_ID(getAD_User_ID()); pi.setAD_Client_ID(m_model.getAD_Client_ID()); pi.setAD_PInstance_ID(pInstance.getAD_PInstance_ID()); + pi.setIsBatch(true); + pi.setPrintPreview(true); MUser from = new MUser(getCtx(), pi.getAD_User_ID(), null); - if ( !process.processIt(pi, m_trx) ) // note, this call close the transaction, don't use m_trx below + ServerProcessCtl.process(pi, m_trx); + if ( pi.isError() ) // note, this call close the transaction, don't use m_trx below { // notify supervisor if error int supervisor = m_model.getSupervisor_ID(); @@ -188,16 +195,23 @@ public class Scheduler extends AdempiereServer if (email) { MClient client = MClient.get(m_model.getCtx(), m_model.getAD_Client_ID()); - client.sendEMail(from, user, process.getName(), pi.getSummary() + " " + pi.getLogInfo(), null); + client.sendEMail(from, user, schedulerName, pi.getSummary() + " " + pi.getLogInfo(), null); } if (notice) { int AD_Message_ID = 442; // HARDCODED ProcessRunError MNote note = new MNote(getCtx(), AD_Message_ID, supervisor, null); note.setClientOrg(m_model.getAD_Client_ID(), m_model.getAD_Org_ID()); - note.setTextMsg(pi.getSummary()); - //note.setDescription(); + note.setTextMsg(schedulerName+"\n"+pi.getSummary()); note.setRecord(MPInstance.Table_ID, pi.getAD_PInstance_ID()); note.saveEx(); + String log = pi.getLogInfo(true); + if (log != null && log.trim().length() > 0) { + MAttachment attachment = new MAttachment (getCtx(), MNote.Table_ID, note.getAD_Note_ID(), null); + attachment.setClientOrg(m_model.getAD_Client_ID(), m_model.getAD_Org_ID()); + attachment.setTextMsg(schedulerName); + attachment.addEntry("ProcessLog.html", log.getBytes("UTF-8")); + attachment.saveEx(); + } } } } @@ -207,38 +221,21 @@ public class Scheduler extends AdempiereServer if (userIDs.length > 0) { ProcessInfoUtil.setLogFromDB(pi); + List fileList = new ArrayList(); + if (isReport) { + fileList.add(pi.getPDFReport()); + } + if (pi.isExport() && pi.getExportFile() != null) + { + fileList.add(pi.getExportFile()); + } + for (int i = 0; i < userIDs.length; i++) { MUser user = new MUser(getCtx(), userIDs[i].intValue(), null); boolean email = user.isNotificationEMail(); boolean notice = user.isNotificationNote(); - - File report = null; - if (isReport) { - // Report - ReportEngine re = ReportEngine.get(m_schedulerctx, pi); - - if(process.getJasperReport() != null - || (re != null && re.getPrintFormat().getJasperProcess_ID() > 0)) - { - // We have a Jasper Print Format - // ============================== - ProcessInfo jasperpi = new ProcessInfo ("", process.getAD_Process_ID()); - jasperpi.setIsBatch(true); - ServerProcessCtl.process(jasperpi, null); - report = jasperpi.getPDFReport(); - } - else - { - // Standard Print Format (Non-Jasper) - // ================================== - if (re == null) - return "Cannot create Report AD_Process_ID=" + process.getAD_Process_ID() - + " - " + process.getName(); - report = re.getPDF(); - } - } - + if (notice) { int AD_Message_ID = 441; // ProcessOK if (isReport) @@ -246,33 +243,46 @@ public class Scheduler extends AdempiereServer MNote note = new MNote(getCtx(), AD_Message_ID, userIDs[i].intValue(), null); note.setClientOrg(m_model.getAD_Client_ID(), m_model.getAD_Org_ID()); if (isReport) { - note.setTextMsg(m_model.getName()); + note.setTextMsg(schedulerName); note.setDescription(m_model.getDescription()); note.setRecord(AD_Table_ID, Record_ID); } else { - note.setTextMsg(pi.getSummary()); - // note.setDescription(); + note.setTextMsg(schedulerName + "\n" + pi.getSummary()); note.setRecord(MPInstance.Table_ID, pi.getAD_PInstance_ID()); } if (note.save()) { - if (isReport) { + MAttachment attachment = null; + if (fileList != null && !fileList.isEmpty()) { // Attachment - MAttachment attachment = new MAttachment (getCtx(), MNote.Table_ID, note.getAD_Note_ID(), null); + attachment = new MAttachment (getCtx(), MNote.Table_ID, note.getAD_Note_ID(), null); attachment.setClientOrg(m_model.getAD_Client_ID(), m_model.getAD_Org_ID()); - attachment.addEntry(report); - attachment.setTextMsg(m_model.getName()); + attachment.setTextMsg(schedulerName); + for (File entry : fileList) + attachment.addEntry(entry); + + } + String log = pi.getLogInfo(true); + if (log != null && log.trim().length() > 0) { + if (attachment == null) { + attachment = new MAttachment (getCtx(), MNote.Table_ID, note.getAD_Note_ID(), null); + attachment.setClientOrg(m_model.getAD_Client_ID(), m_model.getAD_Org_ID()); + attachment.setTextMsg(schedulerName); + } + attachment.addEntry("ProcessLog.html", log.getBytes("UTF-8")); attachment.saveEx(); } + if (attachment != null) + attachment.saveEx(); } } if (email) { MClient client = MClient.get(m_model.getCtx(), m_model.getAD_Client_ID()); - if (isReport) { - client.sendEMail(from, user, m_model.getName(), m_model.getDescription(), report); + if (fileList != null && !fileList.isEmpty()) { + client.sendEMailAttachments(from, user, schedulerName, m_model.getDescription(), fileList); } else { - client.sendEMail(from, user, process.getName(), pi.getSummary() + " " + pi.getLogInfo(), null); + client.sendEMail(from, user, schedulerName, pi.getSummary() + " " + pi.getLogInfo(), null); } } @@ -334,24 +344,42 @@ public class Scheduler extends AdempiereServer if (DisplayType.isNumeric(sPara.getDisplayType()) || DisplayType.isID(sPara.getDisplayType())) { + DecimalFormat decimalFormat = DisplayType.getNumberFormat(sPara.getDisplayType()); BigDecimal bd = toBigDecimal(value); - iPara.setP_Number(bd); + iPara.setP_Number(bd); if (toValue != null) { bd = toBigDecimal(toValue); iPara.setP_Number_To(bd); } + if (Util.isEmpty(paraDesc)) + { + String info = decimalFormat.format(iPara.getP_Number()); + if (iPara.getP_Number_To() != null) + info = info + " - " + decimalFormat.format(iPara.getP_Number_To()); + iPara.setInfo(info); + } if (log.isLoggable(Level.FINE)) log.fine(sPara.getColumnName() + " = " + variable + " (=" + bd + "=)"); } else if (DisplayType.isDate(sPara.getDisplayType())) { + SimpleDateFormat dateFormat = DisplayType.getDateFormat(sPara.getDisplayType()); Timestamp ts = toTimestamp(value); iPara.setP_Date(ts); if (toValue != null) { ts = toTimestamp(toValue); iPara.setP_Date_To(ts); } + if (Util.isEmpty(paraDesc)) + { + String info = dateFormat.format(iPara.getP_Date()); + if (iPara.getP_Date_To() != null) + { + info = info + " - " + dateFormat.format(iPara.getP_Date_To()); + } + iPara.setInfo(info); + } if (log.isLoggable(Level.FINE)) log.fine(sPara.getColumnName() + " = " + variable + " (=" + ts + "=)"); } @@ -362,6 +390,15 @@ public class Scheduler extends AdempiereServer { iPara.setP_String_To(toValue.toString()); } + if (Util.isEmpty(paraDesc)) + { + String info = iPara.getP_String(); + if (iPara.getP_String_To() != null) + { + info = info + " - " + iPara.getP_String_To(); + } + iPara.setInfo(info); + } if (log.isLoggable(Level.FINE)) log.fine(sPara.getColumnName() + " = " + variable + " (=" + value + "=) " + value.getClass().getName()); @@ -453,6 +490,7 @@ public class Scheduler extends AdempiereServer + " - cannot evaluate=" + variable); return null; } + String tail=index < (columnName.length()-1) ? columnName.substring(index+1) : null; columnName = columnName.substring(0, index); // try Env String env = Env.getContext(m_schedulerctx, columnName); @@ -467,6 +505,47 @@ public class Scheduler extends AdempiereServer } else value = env; + + if (tail != null && columnName.equals("#Date")) + { + tail = tail.trim(); + if (tail.startsWith("-") || tail.startsWith("+")) + { + boolean negate = tail.startsWith("-"); + int type = Calendar.DATE; + tail = tail.substring(1); + if (tail.endsWith("d")) + { + tail = tail.substring(0, tail.length()-1); + } + else if (tail.endsWith("m")) + { + type = Calendar.MONTH; + tail = tail.substring(0, tail.length()-1); + } + else if (tail.endsWith("y")) + { + type = Calendar.YEAR; + tail = tail.substring(0, tail.length()-1); + } + + int toApply = 0; + try + { + toApply = Integer.parseInt(tail); + } catch(Exception e){} + if (toApply > 0) + { + if (negate) toApply = toApply * -1; + Timestamp ts = toTimestamp(value); + Calendar cal = Calendar.getInstance(); + cal.setTimeInMillis(ts.getTime()); + cal.add(type, toApply); + value = new Timestamp(cal.getTimeInMillis()); + } + } + + } } // @variable@ return value; } diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/ADialog.java b/org.adempiere.ui.swing/src/org/compiere/apps/ADialog.java index 0922c396d5..fc5a7356a9 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/ADialog.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/ADialog.java @@ -323,6 +323,40 @@ public final class ADialog return ask (WindowNo, c, AD_Message, null); } // ask + public static String askForInput(int WindowNo, Container c, String AD_Message) { + if (log.isLoggable(Level.INFO)) log.info(AD_Message); + Properties ctx = Env.getCtx(); + StringBuilder out = new StringBuilder(); + if (AD_Message != null && !AD_Message.equals("")) + out.append(Msg.getMsg(ctx, AD_Message)); + + // + Window parent = Env.getParent(c); + if (parent == null) + parent = AEnv.getWindow(WindowNo); + + String retValue = null; + if (parent != null) + { + if (parent instanceof JFrame) + { + ADialogDialog d = new ADialogDialog ((JFrame)parent, + Env.getHeader(ctx, WindowNo), + out.toString(), + ADialogDialog.INPUT_MESSAGE); + retValue = d.getReturnMsg(); + } + else + { + ADialogDialog d = new ADialogDialog ((JDialog)parent, + Env.getHeader(ctx, WindowNo), + out.toString(), + ADialogDialog.INPUT_MESSAGE); + retValue = d.getReturnMsg(); + } + } + return retValue; + } /************************************************************************** * Display parsed development info Message string diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/ADialogDialog.java b/org.adempiere.ui.swing/src/org/compiere/apps/ADialogDialog.java index 270d91a575..45e4f64844 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/ADialogDialog.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/ADialogDialog.java @@ -41,6 +41,7 @@ import org.compiere.swing.CDialog; import org.compiere.swing.CLabel; import org.compiere.swing.CMenuItem; import org.compiere.swing.CPanel; +import org.compiere.swing.CTextField; import org.compiere.swing.CTextPane; import org.compiere.util.CLogger; import org.compiere.util.Env; @@ -60,6 +61,7 @@ public final class ADialogDialog extends CDialog implements ActionListener */ private static final long serialVersionUID = 5670261006862936363L; + public static final int INPUT_MESSAGE = 4; /** * Create Dialog Window for Frame * @@ -100,7 +102,7 @@ public final class ADialogDialog extends CDialog implements ActionListener try { setInfoMessage (message); - jbInit(); + jbInit(messageType); setInfoIcon (messageType); } catch(Exception ex) @@ -150,6 +152,7 @@ public final class ADialogDialog extends CDialog implements ActionListener private CLabel iconLabel = new CLabel(); private GridBagLayout westLayout = new GridBagLayout(); private CTextPane info = new CTextPane (); + private CTextField input = new CTextField(); private GridBagLayout infoLayout = new GridBagLayout(); private CPanel infoPanel = new CPanel(); @@ -157,7 +160,7 @@ public final class ADialogDialog extends CDialog implements ActionListener * Static Constructor * @throws Exception */ - private void jbInit() throws Exception + private void jbInit(int messageType) throws Exception { this.setJMenuBar(menuBar); // @@ -193,6 +196,9 @@ public final class ADialogDialog extends CDialog implements ActionListener this.getContentPane().add(infoPanel, BorderLayout.CENTER); infoPanel.add(info, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0 ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(10, 10, 10, 10), 0, 0)); + if(messageType == ADialogDialog.INPUT_MESSAGE) + infoPanel.add(input, new GridBagConstraints(0, 2, 1, 1, 1.0, 1.0 + ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(10, 10, 10, 10), 0, 0)); // menuBar.add(mFile); mFile.add(mPrintScreen); @@ -279,7 +285,10 @@ public final class ADialogDialog extends CDialog implements ActionListener case JOptionPane.WARNING_MESSAGE: iconLabel.setIcon(i_warn); break; - + case ADialogDialog.INPUT_MESSAGE: + confirmPanel.getCancelButton().setVisible(false); + iconLabel.setIcon(i_question); + break; case JOptionPane.PLAIN_MESSAGE: default: break; @@ -340,4 +349,12 @@ public final class ADialogDialog extends CDialog implements ActionListener PrintScreenPainter.printScreen(this); } // printScreen + /** + * Get entered message if dialog is a askForInput-Dialog + * @return + */ + public String getReturnMsg() { + return input.getText(); + } + } // ADialogDialog diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/APanel.java b/org.adempiere.ui.swing/src/org/compiere/apps/APanel.java index 959e755389..43d9727607 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/APanel.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/APanel.java @@ -3147,4 +3147,11 @@ public final class APanel extends CPanel public void download(File file) { } + @Override + public void askForInput(String message, Callback callback) { + String s = ADialog.askForInput(m_curWindowNo, this, message); + if(callback != null) + callback.onCallback(s); + } + } // APanel diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/ProcessDialog.java b/org.adempiere.ui.swing/src/org/compiere/apps/ProcessDialog.java index 86798c21bd..dd4cbe151d 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/ProcessDialog.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/ProcessDialog.java @@ -677,4 +677,11 @@ public class ProcessDialog extends CFrame } + @Override + public void askForInput(String message, Callback callback) { + String s = ADialog.askForInput(m_WindowNo, this, message); + if(callback != null) + callback.onCallback(s); + } + } // ProcessDialog diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/form/VGenPanel.java b/org.adempiere.ui.swing/src/org/compiere/apps/form/VGenPanel.java index 2932f93a22..281a7789c4 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/form/VGenPanel.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/form/VGenPanel.java @@ -401,4 +401,11 @@ public class VGenPanel extends CPanel implements ActionListener, ChangeListener, // TODO Auto-generated method stub } + + @Override + public void askForInput(String message, Callback callback) { + String s = ADialog.askForInput(m_WindowNo, this, message); + if(callback != null) + callback.onCallback(s); + } } \ No newline at end of file diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/form/VPaySelect.java b/org.adempiere.ui.swing/src/org/compiere/apps/form/VPaySelect.java index 80456e717a..c0e9f6a1d3 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/form/VPaySelect.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/form/VPaySelect.java @@ -460,4 +460,11 @@ public class VPaySelect extends PaySelect implements FormPanel, ActionListener, // TODO Auto-generated method stub } + + @Override + public void askForInput(String message, Callback callback) { + String s = ADialog.askForInput(m_WindowNo, null, message); + if(callback != null) + callback.onCallback(s); + } } // VPaySelect diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/ed/VAccountDialog.java b/org.adempiere.ui.swing/src/org/compiere/grid/ed/VAccountDialog.java index 5b965b8b33..eb4a1ccdff 100644 --- a/org.adempiere.ui.swing/src/org/compiere/grid/ed/VAccountDialog.java +++ b/org.adempiere.ui.swing/src/org/compiere/grid/ed/VAccountDialog.java @@ -1044,7 +1044,7 @@ public final class VAccountDialog extends CDialog M_Product_ID, C_BPartner_ID, AD_OrgTrx_ID, C_LocFrom_ID, C_LocTo_ID, C_SRegion_ID, C_Project_ID, C_Campaign_ID, C_Activity_ID, - User1_ID, User2_ID, 0, 0); + User1_ID, User2_ID, 0, 0, null); if (acct != null && acct.get_ID() == 0) acct.saveEx(); diff --git a/org.adempiere.ui.swing/src/org/eevolution/form/VInOutInvoiceGen.java b/org.adempiere.ui.swing/src/org/eevolution/form/VInOutInvoiceGen.java index 74e12370de..a652320835 100755 --- a/org.adempiere.ui.swing/src/org/eevolution/form/VInOutInvoiceGen.java +++ b/org.adempiere.ui.swing/src/org/eevolution/form/VInOutInvoiceGen.java @@ -923,4 +923,11 @@ public class VInOutInvoiceGen extends CPanel // TODO Auto-generated method stub } + + @Override + public void askForInput(String message, Callback callback) { + String s = ADialog.askForInput(m_WindowNo, this, message); + if(callback != null) + callback.onCallback(s); + } } // VInOutGen diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AbstractProcessDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AbstractProcessDialog.java new file mode 100644 index 0000000000..1553b03b8d --- /dev/null +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AbstractProcessDialog.java @@ -0,0 +1,747 @@ +/****************************************************************************** + * Copyright (C) 2014 Elaine Tan * + * Copyright (C) 2014 Trek Global + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ + +package org.adempiere.webui.apps; + +import java.io.File; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.logging.Level; + +import org.adempiere.util.Callback; +import org.adempiere.util.ContextRunnable; +import org.adempiere.util.IProcessUI; +import org.adempiere.util.ServerContext; +import org.adempiere.webui.component.Checkbox; +import org.adempiere.webui.component.Column; +import org.adempiere.webui.component.Columns; +import org.adempiere.webui.component.ComboItem; +import org.adempiere.webui.component.Combobox; +import org.adempiere.webui.component.Grid; +import org.adempiere.webui.component.GridFactory; +import org.adempiere.webui.component.Label; +import org.adempiere.webui.component.Panel; +import org.adempiere.webui.component.Row; +import org.adempiere.webui.component.Rows; +import org.adempiere.webui.component.Window; +import org.adempiere.webui.editor.WTableDirEditor; +import org.adempiere.webui.process.WProcessInfo; +import org.adempiere.webui.window.FDialog; +import org.adempiere.webui.window.MultiFileDownloadDialog; +import org.compiere.Adempiere; +import org.compiere.model.MAttachment; +import org.compiere.model.MClient; +import org.compiere.model.MLookup; +import org.compiere.model.MLookupFactory; +import org.compiere.model.MLookupInfo; +import org.compiere.model.MNote; +import org.compiere.model.MPInstance; +import org.compiere.model.MProcess; +import org.compiere.model.MSysConfig; +import org.compiere.model.MUser; +import org.compiere.model.Query; +import org.compiere.process.ProcessInfo; +import org.compiere.process.ProcessInfoUtil; +import org.compiere.process.ServerProcessCtl; +import org.compiere.util.CLogger; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.util.Msg; +import org.compiere.util.Trx; +import org.zkoss.zk.au.out.AuEcho; +import org.zkoss.zk.ui.Component; +import org.zkoss.zk.ui.Desktop; +import org.zkoss.zk.ui.Executions; +import org.zkoss.zk.ui.event.Event; +import org.zkoss.zk.ui.event.EventListener; +import org.zkoss.zk.ui.event.Events; +import org.zkoss.zk.ui.util.Clients; +import org.zkoss.zul.Div; +import org.zkoss.zul.Html; +import org.zkoss.zul.Space; + +public abstract class AbstractProcessDialog extends Window implements IProcessUI, EventListener +{ + /** + * + */ + private static final long serialVersionUID = 2190456247109646320L; + + private static final String ON_COMPLETE = "onComplete"; + private static final String ON_STATUS_UPDATE = "onStatusUpdate"; + + private static CLogger log = CLogger.getCLogger(AbstractProcessDialog.class); + + private int m_WindowNo; + private Properties m_ctx; + private int m_AD_Process_ID; + private ProcessInfo m_pi = null; + private boolean m_disposeOnComplete; + + private Html message = null; + private Panel centerPanel = null; + + private ProcessParameterPanel parameterPanel = null; + private Checkbox runAsJobField = null; + private WTableDirEditor notificationTypeField = null; + + private BusyDialog progressWindow; + + private String m_Name = null; + private StringBuffer m_messageText = new StringBuffer(); + private String m_ShowHelp = null; // Determine if a Help Process Window is shown + private String initialMessage; + + private boolean m_valid = true; + private boolean m_cancel = false; + + private Future future; + private List downloadFiles; + private boolean m_locked = false; + + protected AbstractProcessDialog() + { + super(); + message = new Html(); + centerPanel = new Panel(); + } + + protected boolean init(Properties ctx, int WindowNo, int AD_Process_ID, ProcessInfo pi, String innerWidth, boolean autoStart, boolean isDisposeOnComplete) + { + m_ctx = ctx; + m_WindowNo = WindowNo; + m_AD_Process_ID = AD_Process_ID; + setProcessInfo(pi); + m_disposeOnComplete = isDisposeOnComplete; + + log.config(""); + // + boolean trl = !Env.isBaseLanguage(m_ctx, "AD_Process"); + String sql = "SELECT Name, Description, Help, IsReport, ShowHelp " + + "FROM AD_Process " + + "WHERE AD_Process_ID=?"; + if (trl) + sql = "SELECT t.Name, t.Description, t.Help, p.IsReport, p.ShowHelp " + + "FROM AD_Process p, AD_Process_Trl t " + + "WHERE p.AD_Process_ID=t.AD_Process_ID" + + " AND p.AD_Process_ID=? AND t.AD_Language=?"; + + PreparedStatement pstmt = null; + ResultSet rs = null; + try + { + pstmt = DB.prepareStatement(sql, null); + pstmt.setInt(1, AD_Process_ID); + if (trl) + pstmt.setString(2, Env.getAD_Language(m_ctx)); + rs = pstmt.executeQuery(); + if (rs.next()) + { + m_Name = rs.getString(1); + m_ShowHelp = rs.getString(5); + // + m_messageText.append(""); + String s = rs.getString(2); // Description + if (rs.wasNull()) + m_messageText.append(Msg.getMsg(m_ctx, "StartProcess?")); + else + m_messageText.append(s); + m_messageText.append(""); + + s = rs.getString(3); // Help + if (!rs.wasNull()) + m_messageText.append("

").append(s).append("

"); + } + } + catch (SQLException e) + { + log.log(Level.SEVERE, sql, e); + return false; + } + finally + { + DB.close(rs, pstmt); + } + + if (m_Name == null) + return false; + // + this.setTitle(m_Name); + initialMessage = m_messageText.toString(); + message.setContent(initialMessage); + + // Move from APanel.actionButton + if (m_pi == null) + m_pi = new WProcessInfo(m_Name, AD_Process_ID); + m_pi.setAD_User_ID (Env.getAD_User_ID(Env.getCtx())); + m_pi.setAD_Client_ID(Env.getAD_Client_ID(Env.getCtx())); + m_pi.setTitle(m_Name); + parameterPanel = new ProcessParameterPanel(m_WindowNo, m_pi, innerWidth); + centerPanel.getChildren().clear(); + if ( parameterPanel.init() ) { + centerPanel.appendChild(parameterPanel); + } else { + if (m_ShowHelp != null && m_ShowHelp.equals("N")) + autoStart = true; + + if (autoStart) + { + autoStart(); + return true; + } + } + + // Check if the process is a silent one + if (isValid() && m_ShowHelp != null && m_ShowHelp.equals("S")) + { + autoStart(); + return true; + } + + MProcess process = new MProcess(m_ctx, m_AD_Process_ID, null); + boolean isReport = (process.isReport() || process.getAD_ReportView_ID() > 0); + if (isReport && MSysConfig.getBooleanValue(MSysConfig.BACKGROUND_JOB_ALLOWED, false)) + { + Grid grid = GridFactory.newGridLayout(); + centerPanel.appendChild(grid); + grid.setInnerWidth(innerWidth); + + Columns columns = new Columns(); + grid.appendChild(columns); + Column col = new Column(); + col.setWidth("30%"); + columns.appendChild(col); + col = new Column(); + col.setWidth("70%"); + columns.appendChild(col); + + Rows rows = new Rows(); + grid.appendChild(rows); + + Row row = new Row(); + rows.appendChild(row); + + row.appendChild(new Space()); + runAsJobField = new Checkbox(); + runAsJobField.setLabel(Msg.getElement(m_ctx, MPInstance.COLUMNNAME_IsRunAsJob)); + row.appendChild(runAsJobField); + runAsJobField.addEventListener(Events.ON_CHECK, this); + + row = new Row(); + rows.appendChild(row); + + Div div = new Div(); + div.setStyle("text-align: right;"); + div.appendChild(new Label(Msg.getElement(m_ctx, MPInstance.COLUMNNAME_NotificationType))); + row.appendChild(div); + + MLookupInfo info = MLookupFactory.getLookup_List(Env.getLanguage(m_ctx), MPInstance.NOTIFICATIONTYPE_AD_Reference_ID); + notificationTypeField = new WTableDirEditor(MPInstance.COLUMNNAME_NotificationType, true, false, true, new MLookup(info, 0)); + Combobox combobox = notificationTypeField.getComponent(); + List items = combobox.getItems(); + for (int i = 0; i < items.size(); i++) { + ComboItem item = (ComboItem)items.get(i); + if (MPInstance.NOTIFICATIONTYPE_None.equals(item.getValue())) + combobox.removeItemAt(i); + } + + MUser user = MUser.get(m_ctx); + String notificationType = user.getNotificationType(); + if (!MPInstance.NOTIFICATIONTYPE_None.equals(notificationType)) + notificationTypeField.setValue(notificationType); + + row.appendChild(notificationTypeField.getComponent()); + runAsJobField.setChecked(MSysConfig.getBooleanValue(MSysConfig.BACKGROUND_JOB_BY_DEFAULT, false)); + notificationTypeField.getComponent().getParent().setVisible(runAsJobField.isChecked()); + } + + return true; + } + + protected void autoStart() + { + startProcess0(); + } + + public void onEvent(Event event) + { + Component component = event.getTarget(); + if (component == runAsJobField && event.getName().equals(Events.ON_CHECK)) + notificationTypeField.getComponent().getParent().setVisible(runAsJobField.isChecked()); + else if (event.getName().equals(ON_COMPLETE)) + onComplete(); + else if (event.getName().equals(ON_STATUS_UPDATE)) + onStatusUpdate(event); + } + + protected void startProcess() + { + if (!parameterPanel.validateParameters()) + return; + + startProcess0(); + } + + protected void cancelProcess() + { + m_cancel = true; + this.dispose(); + } + + protected BusyDialog createBusyDialog() + { + progressWindow = new BusyDialog(); + this.appendChild(progressWindow); + return progressWindow; + } + + protected void closeBusyDialog() + { + if (progressWindow != null) { + progressWindow.dispose(); + progressWindow = null; + } + } + + @Override + public void dispose() + { + m_valid = false; + } // dispose + + private void startProcess0() + { + if (!isBackgroundJob()) + getProcessInfo().setPrintPreview(true); + + lockUI(getProcessInfo()); + + downloadFiles = new ArrayList(); + + //use echo, otherwise lock ui wouldn't work + Clients.response(new AuEcho(this, isBackgroundJob() ? "runBackgroundJob" : "runProcess", this)); + } + + public void runProcess() + { + future = Adempiere.getThreadPoolExecutor().submit(new DesktopRunnable(new ProcessDialogRunnable(null), getDesktop())); + } + + public void runBackgroundJob() + { + Properties m_ctx = getCtx(); + ProcessInfo m_pi = getProcessInfo(); + MPInstance instance = null; + + try + { + int AD_Client_ID = Env.getAD_Client_ID(m_ctx); + int AD_User_ID = Env.getAD_User_ID(m_ctx); + + int count = new Query(m_ctx, MPInstance.Table_Name, "Coalesce(AD_User_ID,0)=? AND IsProcessing='Y' AND IsRunAsJob='Y' ", null) + .setOnlyActiveRecords(true) + .setClient_ID() + .setParameters(AD_User_ID) + .count(); + if (count >= MSysConfig.getIntValue(MSysConfig.BACKGROUND_JOB_MAX_PER_USER, 5, AD_Client_ID)) + throw new IllegalStateException(Msg.getMsg(m_ctx, "BackgroundJobExceedMaxPerUser")); + + count = new Query(m_ctx, MPInstance.Table_Name, "IsProcessing='Y' AND IsRunAsJob='Y' ", null) + .setOnlyActiveRecords(true) + .setClient_ID() + .count(); + if (count >= MSysConfig.getIntValue(MSysConfig.BACKGROUND_JOB_MAX_PER_CLIENT, 10, AD_Client_ID)) + throw new IllegalStateException(Msg.getMsg(m_ctx, "BackgroundJobExceedMaxPerClient")); + + count = new Query(m_ctx, MPInstance.Table_Name, "IsProcessing='Y' AND IsRunAsJob='Y' ", null) + .setOnlyActiveRecords(true) + .count(); + if (count >= MSysConfig.getIntValue(MSysConfig.BACKGROUND_JOB_MAX_IN_SYSTEM, 20)) + throw new IllegalStateException(Msg.getMsg(m_ctx, "BackgroundJobExceedMaxInSystem")); + + instance = new MPInstance(m_ctx, m_pi.getAD_Process_ID(), m_pi.getRecord_ID()); + instance.setIsRunAsJob(true); + instance.setIsProcessing(true); + instance.setNotificationType(getNotificationType()); + instance.saveEx(); + + m_pi.setAD_PInstance_ID(instance.getAD_PInstance_ID()); + getParameterPanel().saveParameters(); + + MPInstance.publishChangedEvent(AD_User_ID); + Adempiere.getThreadPoolExecutor().schedule(new BackgroundJobRunnable(getCtx()), 1000, TimeUnit.MILLISECONDS); + + m_pi.setSummary(Msg.getMsg(m_ctx, "BackgroundJobScheduled")); + } catch (Exception e) { + m_pi.setSummary(e.getLocalizedMessage()); + m_pi.setError(true); + + if (instance != null) + { + instance.setIsProcessing(false); + instance.saveEx(); + } + } + finally { + unlockUI(m_pi); + + if (m_disposeOnComplete) + dispose(); + } + } + + private void onComplete() + { + ProcessInfo m_pi = getProcessInfo(); + + if (future != null) { + try { + future.get(); + } catch (Exception e) { + log.log(Level.SEVERE, e.getLocalizedMessage(), e); + if (!m_pi.isError()) { + m_pi.setSummary(e.getLocalizedMessage(), true); + } + } + } + future = null; + unlockUI(m_pi); + if (downloadFiles.size() > 0) { + MultiFileDownloadDialog downloadDialog = new MultiFileDownloadDialog(downloadFiles.toArray(new File[0])); + downloadDialog.setPage(getPage()); + downloadDialog.setTitle(m_pi.getTitle()); + Events.postEvent(downloadDialog, new Event(MultiFileDownloadDialog.ON_SHOW)); + } + + if (m_disposeOnComplete) + dispose(); + } + + private void onStatusUpdate(Event event) + { + String message = (String) event.getData(); + if (progressWindow != null) + progressWindow.statusUpdate(message); + } + + @Override + public void lockUI(ProcessInfo pi) { + if (m_locked || Executions.getCurrent() == null) + return; + m_locked = true; + showBusyDialog(); + } + + public abstract void showBusyDialog(); + + @Override + public void unlockUI(ProcessInfo pi) { + if (!m_locked) + return; + m_locked = false; + + if (Executions.getCurrent() == null) + { + Executions.schedule(getDesktop(), new EventListener() + { + @Override + public void onEvent(Event event) throws Exception { + doUnlockUI(); + } + }, new Event("onUnLockUI")); + } else { + doUnlockUI(); + } + } + + private void doUnlockUI() + { + hideBusyDialog(); + updateUI(); + } + + public abstract void hideBusyDialog(); + + public abstract void updateUI(); + + @Override + public boolean isUILocked() { + return m_locked; + } + + @Override + public void statusUpdate(String message) { + Desktop desktop = getDesktop(); + if (desktop != null && desktop.isAlive()) + Executions.schedule(desktop, this, new Event(ON_STATUS_UPDATE, this, message)); + } + + @Override + public void ask(final String message, final Callback callback) { + Executions.schedule(getDesktop(), new EventListener() { + @Override + public void onEvent(Event event) throws Exception { + FDialog.ask(getWindowNo(), null, message, callback); + } + }, new Event("onAsk")); + } + + @Override + public void download(File file) { + downloadFiles.add(file); + } + + /** + * + * @return ProcessInfo + */ + public ProcessInfo getProcessInfo() { + return m_pi; + } + + public void setProcessInfo(ProcessInfo pi) { + m_pi = pi; + } + + /** + * is dialog still valid + * @return boolean + */ + public boolean isValid() + { + return m_valid; + } + + /** + * @return true if user have press the cancel button to close the dialog + */ + public boolean isCancel() + { + return m_cancel; + } + + public Properties getCtx() + { + return m_ctx; + } + + public int getWindowNo() + { + return m_WindowNo; + } + + public int getAD_Process_ID() + { + return m_AD_Process_ID; + } + + public Html getMessage() + { + return message; + } + + public Panel getCenterPanel() + { + return centerPanel; + } + + public ProcessParameterPanel getParameterPanel() + { + return parameterPanel; + } + + public String getName() + { + return m_Name; + } + + public StringBuffer getMessageText() + { + return m_messageText; + } + + public void setMessageText(StringBuffer messageText) + { + this.m_messageText = messageText; + } + + public String getShowHelp() + { + return m_ShowHelp; + } + + public String getInitialMessage() + { + return initialMessage; + } + + public boolean isBackgroundJob() + { + return runAsJobField != null && runAsJobField.isChecked(); + } + + public String getNotificationType() + { + return (String) notificationTypeField.getValue(); + } + + public List getDownloadFiles() + { + return downloadFiles; + } + + private class ProcessDialogRunnable extends ContextRunnable + { + private Trx m_trx; + + private ProcessDialogRunnable(Trx trx) + { + super(); + m_trx = trx; + } + + protected void doRun() + { + ProcessInfo m_pi = getProcessInfo(); + try { + if (log.isLoggable(Level.INFO)) + log.log(Level.INFO, "Process Info=" + m_pi + " AD_Client_ID="+ Env.getAD_Client_ID(Env.getCtx())); + WProcessCtl.process(AbstractProcessDialog.this, getWindowNo(), getParameterPanel(), m_pi, m_trx); + } catch (Exception ex) { + m_pi.setError(true); + m_pi.setSummary(ex.getLocalizedMessage()); + log.log(Level.SEVERE, ex.getLocalizedMessage(), ex); + } finally { + Executions.schedule(getDesktop(), AbstractProcessDialog.this, new Event(ON_COMPLETE, AbstractProcessDialog.this, null)); + } + } + } + + private class BackgroundJobRunnable implements Runnable + { + private Properties m_ctx; + + private BackgroundJobRunnable(Properties ctx) + { + super(); + + m_ctx = new Properties(); + Env.setContext(m_ctx, "#AD_Client_ID", ctx.getProperty("#AD_Client_ID")); + Env.setContext(m_ctx, "#AD_Org_ID", ctx.getProperty("#AD_Org_ID")); + Env.setContext(m_ctx, "#AD_Role_ID", ctx.getProperty("#AD_Role_ID")); + Env.setContext(m_ctx, "#M_Warehouse_ID", ctx.getProperty("#M_Warehouse_ID")); + Env.setContext(m_ctx, "#AD_Language", ctx.getProperty("#AD_Language")); + Env.setContext(m_ctx, "#AD_User_ID", ctx.getProperty("#AD_User_ID")); + Env.setContext(m_ctx, "#Date", ctx.getProperty("#Date")); + } + + @Override + public void run() { + try { + ServerContext.setCurrentInstance(m_ctx); + doRun(); + } finally { + ServerContext.dispose(); + } + } + + private void doRun() + { + ProcessInfo m_pi = getProcessInfo(); + m_pi.setIsBatch(true); + m_pi.setPrintPreview(true); + + MPInstance instance = new MPInstance(m_ctx, m_pi.getAD_PInstance_ID(), null); + String notificationType = instance.getNotificationType(); + boolean sendEmail = notificationType.equals(MPInstance.NOTIFICATIONTYPE_EMail) || notificationType.equals(MPInstance.NOTIFICATIONTYPE_EMailPlusNotice); + boolean createNotice = notificationType.equals(MPInstance.NOTIFICATIONTYPE_Notice) || notificationType.equals(MPInstance.NOTIFICATIONTYPE_EMailPlusNotice); + + int AD_Client_ID = Env.getAD_Client_ID(m_ctx); + int AD_User_ID = Env.getAD_User_ID(m_ctx); + + try { + m_pi.setSummary(""); // reset summary + + MProcess process = new MProcess(m_ctx, m_pi.getAD_Process_ID(), null); + ServerProcessCtl.process(m_pi, null); + ProcessInfoUtil.setLogFromDB(m_pi); + if (!m_pi.isError()) + { + boolean isReport = (process.isReport() || process.getAD_ReportView_ID() > 0 || process.getJasperReport() != null || process.getAD_PrintFormat_ID() > 0); + if (isReport) + { + download(m_pi.getPDFReport()); + } + + if (m_pi.isExport() && m_pi.getExportFile() != null) + download(m_pi.getExportFile()); + } + + if (sendEmail) + { + MClient client = MClient.get(m_ctx, AD_Client_ID); + client.sendEMailAttachments(AD_User_ID, process.getName(), m_pi.getSummary() + " " + m_pi.getLogInfo(), getDownloadFiles()); + } + + if (createNotice) + { + MNote note = new MNote(m_ctx, "BackgroundJob", AD_User_ID, null); + note.setTextMsg(process.getName() + "\n" + m_pi.getSummary()); + note.setRecord(MPInstance.Table_ID, m_pi.getAD_PInstance_ID()); + note.saveEx(); + + MAttachment attachment = null; + if (getDownloadFiles().size() > 0) + { + attachment = note.createAttachment(); + for (File downloadFile : getDownloadFiles()) + attachment.addEntry(downloadFile); + } + String log = m_pi.getLogInfo(true); + if (log != null && log.trim().length() > 0) { + if (attachment == null) + attachment = note.createAttachment(); + attachment.addEntry("ProcessLog.html", log.getBytes("UTF-8")); + } + if (attachment != null) + attachment.saveEx(); + } + } catch (Exception e) { + log.log(Level.SEVERE, e.getLocalizedMessage()); + } finally { + instance.setIsProcessing(false); + instance.saveEx(); + + MPInstance.publishChangedEvent(AD_User_ID); + } + } + } + + @Override + public void askForInput(final String message, final Callback callback) { + Executions.schedule(getDesktop(), new EventListener() { + @Override + public void onEvent(Event event) throws Exception { + FDialog.askForInput(m_WindowNo, null, message, callback); + } + }, new Event("onAskForInput")); + } + +} \ No newline at end of file diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/HelpWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/HelpWindow.java index 155727da6c..5ce3f3fe79 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/HelpWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/HelpWindow.java @@ -166,7 +166,7 @@ public class HelpWindow extends Window { td.setClass("help-window-tabs"); tr.addElement(td); td.addElement(new a().setName(winpref+"Tabs")); - h4 h4 = new h4("Tabs"); + h4 h4 = new h4(Msg.getMsg(Env.getCtx(), "Tabs")); td.addElement(h4); tr = new tr(); @@ -336,7 +336,7 @@ public class HelpWindow extends Window { td td = new td(); tr.addElement(td); td.addElement(new a().setName(winpref+"Fields"+tabIndex)); - h4 h4 = new h4("Fields"); + h4 h4 = new h4(Msg.getMsg(Env.getCtx(), "Fields")); td.addElement(h4); tr = new tr(); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessDialog.java index 33a7b4fb16..3f25b8b06a 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessDialog.java @@ -1,91 +1,3 @@ -package org.adempiere.webui.apps; - -import static org.compiere.model.SystemIDs.PROCESS_C_INVOICE_GENERATE; -import static org.compiere.model.SystemIDs.PROCESS_M_INOUT_GENERATE; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.List; -import java.util.Properties; -import java.util.concurrent.Future; -import java.util.logging.Level; - -import org.adempiere.util.Callback; -import org.adempiere.util.ContextRunnable; -import org.adempiere.util.IProcessUI; -import org.adempiere.webui.LayoutUtils; -import org.adempiere.webui.component.Button; -import org.adempiere.webui.component.Combobox; -import org.adempiere.webui.component.ConfirmPanel; -import org.adempiere.webui.component.Grid; -import org.adempiere.webui.component.GridFactory; -import org.adempiere.webui.component.Label; -import org.adempiere.webui.component.Mask; -import org.adempiere.webui.component.Panel; -import org.adempiere.webui.component.Rows; -import org.adempiere.webui.component.Window; -import org.adempiere.webui.desktop.IDesktop; -import org.adempiere.webui.factory.ButtonFactory; -import org.adempiere.webui.panel.IHelpContext; -import org.adempiere.webui.part.WindowContainer; -import org.adempiere.webui.process.WProcessInfo; -import org.adempiere.webui.session.SessionManager; -import org.adempiere.webui.theme.ThemeManager; -import org.adempiere.webui.window.FDialog; -import org.adempiere.webui.window.MultiFileDownloadDialog; -import org.adempiere.webui.window.SimplePDFViewer; -import org.compiere.Adempiere; -import org.compiere.model.MPInstance; -import org.compiere.model.MPInstancePara; -import org.compiere.model.MProcess; -import org.compiere.model.X_AD_CtxHelp; -import org.compiere.print.ReportEngine; -import org.compiere.process.ProcessInfo; -import org.compiere.process.ProcessInfoLog; -import org.compiere.process.ProcessInfoUtil; -import org.compiere.util.AdempiereSystemError; -import org.compiere.util.CLogger; -import org.compiere.util.DB; -import org.compiere.util.DisplayType; -import org.compiere.util.Env; -import org.compiere.util.Msg; -import org.compiere.util.Util; -import org.zkoss.zhtml.Table; -import org.zkoss.zhtml.Td; -import org.zkoss.zhtml.Text; -import org.zkoss.zhtml.Tr; -import org.zkoss.zk.au.out.AuEcho; -import org.zkoss.zk.au.out.AuScript; -import org.zkoss.zk.ui.Component; -import org.zkoss.zk.ui.Desktop; -import org.zkoss.zk.ui.Executions; -import org.zkoss.zk.ui.event.Event; -import org.zkoss.zk.ui.event.EventListener; -import org.zkoss.zk.ui.event.Events; -import org.zkoss.zk.ui.util.Clients; -import org.zkoss.zul.A; -import org.zkoss.zul.Borderlayout; -import org.zkoss.zul.Center; -import org.zkoss.zul.Comboitem; -import org.zkoss.zul.Div; -import org.zkoss.zul.Hbox; -import org.zkoss.zul.Html; -import org.zkoss.zul.North; -import org.zkoss.zul.Row; -import org.zkoss.zul.South; - -import com.lowagie.text.Document; -import com.lowagie.text.pdf.PdfContentByte; -import com.lowagie.text.pdf.PdfImportedPage; -import com.lowagie.text.pdf.PdfReader; -import com.lowagie.text.pdf.PdfWriter; - /****************************************************************************** * Product: Adempiere ERP & CRM Smart Business Solution * * Copyright (C) 2007 Low Heng Sin * @@ -100,8 +12,80 @@ import com.lowagie.text.pdf.PdfWriter; * with this program; if not, write to the Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * *****************************************************************************/ +package org.adempiere.webui.apps; +import static org.compiere.model.SystemIDs.PROCESS_C_INVOICE_GENERATE; +import static org.compiere.model.SystemIDs.PROCESS_M_INOUT_GENERATE; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Level; + +import org.adempiere.util.Callback; +import org.adempiere.webui.LayoutUtils; +import org.adempiere.webui.component.Button; +import org.adempiere.webui.component.Combobox; +import org.adempiere.webui.component.ConfirmPanel; +import org.adempiere.webui.component.Grid; +import org.adempiere.webui.component.GridFactory; +import org.adempiere.webui.component.Mask; +import org.adempiere.webui.component.Panel; +import org.adempiere.webui.component.Row; +import org.adempiere.webui.component.Rows; +import org.adempiere.webui.component.Window; +import org.adempiere.webui.desktop.IDesktop; +import org.adempiere.webui.factory.ButtonFactory; +import org.adempiere.webui.panel.IHelpContext; +import org.adempiere.webui.part.WindowContainer; +import org.adempiere.webui.process.WProcessInfo; +import org.adempiere.webui.session.SessionManager; +import org.adempiere.webui.theme.ThemeManager; +import org.adempiere.webui.window.FDialog; +import org.adempiere.webui.window.SimplePDFViewer; +import org.compiere.model.MPInstance; +import org.compiere.model.MPInstancePara; +import org.compiere.model.MProcess; +import org.compiere.model.X_AD_CtxHelp; +import org.compiere.print.ReportEngine; +import org.compiere.process.ProcessInfo; +import org.compiere.process.ProcessInfoLog; +import org.compiere.process.ProcessInfoUtil; +import org.compiere.util.AdempiereSystemError; +import org.compiere.util.CLogger; +import org.compiere.util.DisplayType; +import org.compiere.util.Env; +import org.compiere.util.Msg; +import org.compiere.util.Util; +import org.zkoss.zhtml.Table; +import org.zkoss.zhtml.Td; +import org.zkoss.zhtml.Text; +import org.zkoss.zhtml.Tr; +import org.zkoss.zk.au.out.AuEcho; +import org.zkoss.zk.au.out.AuScript; +import org.zkoss.zk.ui.Component; +import org.zkoss.zk.ui.event.Event; +import org.zkoss.zk.ui.event.EventListener; +import org.zkoss.zk.ui.event.Events; +import org.zkoss.zk.ui.util.Clients; +import org.zkoss.zul.A; +import org.zkoss.zul.Borderlayout; +import org.zkoss.zul.Center; +import org.zkoss.zul.Comboitem; +import org.zkoss.zul.Div; +import org.zkoss.zul.Hbox; +import org.zkoss.zul.Label; +import org.zkoss.zul.North; +import org.zkoss.zul.South; + +import com.lowagie.text.Document; +import com.lowagie.text.pdf.PdfContentByte; +import com.lowagie.text.pdf.PdfImportedPage; +import com.lowagie.text.pdf.PdfReader; +import com.lowagie.text.pdf.PdfWriter; /** * Dialog to Start process or report. @@ -113,21 +97,30 @@ import com.lowagie.text.pdf.PdfWriter; * @author arboleda - globalqss * - Implement ShowHelp option on processes and reports */ -public class ProcessDialog extends Window implements EventListener, IProcessUI, IHelpContext +public class ProcessDialog extends AbstractProcessDialog implements EventListener, IHelpContext { /** - * + * generate serial version ID */ - private static final long serialVersionUID = -899849696748614034L; - + private static final long serialVersionUID = 3329046204196602797L; + private static final String MESSAGE_DIV_STYLE = "max-height: 150pt; overflow: auto; margin: 10px;"; + + /** Logger */ + private static CLogger log = CLogger.getCLogger(ProcessDialog.class); + // + private Div messageDiv; private Center center; private Table logMessageTable; private North north; - - private List downloadFiles; + private int[] m_ids = null; + private Button bOK = null; + + private boolean isParameterPage = true; + private Mask mask; + private boolean showLastRun = false; private Grid southRowPanel = GridFactory.newGridLayout(); @@ -147,20 +140,19 @@ public class ProcessDialog extends Window implements EventListener, IProc public ProcessDialog (int AD_Process_ID, boolean isSOTrx) { log.info("Process=" + AD_Process_ID ); - m_ctx = Env.getCtx(); - m_WindowNo = SessionManager.getAppDesktop().registerWindow(this); - this.setAttribute(IDesktop.WINDOWNO_ATTRIBUTE, m_WindowNo); - m_AD_Process_ID = AD_Process_ID; - Env.setContext(Env.getCtx(), m_WindowNo, "IsSOTrx", isSOTrx ? "Y" : "N"); + int WindowNo = SessionManager.getAppDesktop().registerWindow(this); + this.setAttribute(IDesktop.WINDOWNO_ATTRIBUTE, WindowNo); + Env.setContext(Env.getCtx(), WindowNo, "IsSOTrx", isSOTrx ? "Y" : "N"); try { - MProcess process = new MProcess(m_ctx, m_AD_Process_ID, null); + MProcess process = MProcess.get(Env.getCtx(), AD_Process_ID); int count = process.getParameters().length; if (count > 0) showLastRun = true; initComponents(); - init(); + init(Env.getCtx(), WindowNo, AD_Process_ID, null, "70%", false, false); + querySaved(); addEventListener(WindowContainer.ON_WINDOW_CONTAINER_SELECTION_CHANGED_EVENT, this); } catch(Exception ex) @@ -169,13 +161,26 @@ public class ProcessDialog extends Window implements EventListener, IProc } } // ProcessDialog + private void querySaved() + { + //user query + savedParams = MPInstance.get(Env.getCtx(), getAD_Process_ID(), Env.getContextAsInt(Env.getCtx(), "#AD_User_ID")); + fSavedName.removeAllItems(); + for (MPInstance instance : savedParams) + { + String queries = instance.get_ValueAsString("Name"); + fSavedName.appendItem(queries); + } + + fSavedName.setValue(""); + } + private void initComponents() { this.setStyle("position: absolute; width: 100%; height: 100%"); Borderlayout layout = new Borderlayout(); layout.setStyle("position: absolute; width: 100%; height: 100%; border: none;"); messageDiv = new Div(); - message = new Html(); - messageDiv.appendChild(message); + messageDiv.appendChild(getMessage()); messageDiv.setStyle(MESSAGE_DIV_STYLE); messageDiv.setId("message"); @@ -185,12 +190,11 @@ public class ProcessDialog extends Window implements EventListener, IProc north.setAutoscroll(true); north.setStyle("border: none;"); - centerPanel = new Panel(); center = new Center(); layout.appendChild(center); - center.appendChild(centerPanel); - centerPanel.setHflex("1"); - centerPanel.setVflex("1"); + center.appendChild(getCenterPanel()); + getCenterPanel().setHflex("1"); + getCenterPanel().setVflex("1"); center.setAutoscroll(true); center.setStyle("border: none"); @@ -199,6 +203,7 @@ public class ProcessDialog extends Window implements EventListener, IProc Hbox hBox = new Hbox(); + lSaved = new Label(Msg.getMsg(Env.getCtx(), "SavedParameter")); hBox.appendChild(lSaved); fSavedName.addEventListener(Events.ON_CHANGE, this); hBox.appendChild(fSavedName); @@ -218,8 +223,6 @@ public class ProcessDialog extends Window implements EventListener, IProc Panel confParaPanel =new Panel(); confParaPanel.setAlign("right"); - @SuppressWarnings("unused") - String label = Msg.getMsg(Env.getCtx(), "Start"); // Invert - Unify OK/Cancel IDEMPIERE-77 bOK = ButtonFactory.createNamedButton(ConfirmPanel.A_OK, true, true); bOK.setId("Ok"); @@ -239,45 +242,14 @@ public class ProcessDialog extends Window implements EventListener, IProc this.appendChild(layout); } - private int m_WindowNo; - private Properties m_ctx; - private int m_AD_Process_ID; - private String m_Name = null; - - private int[] m_ids = null; - private StringBuffer m_messageText = new StringBuffer(); - private String m_ShowHelp = null; // Determine if a Help Process Window is shown - - private Panel centerPanel = null; - private Html message = null; - private Button bOK = null; private Button bCancel = null; - - private boolean valid = true; - - /** Logger */ - private static CLogger log = CLogger.getCLogger(ProcessDialog.class); - // - private ProcessParameterPanel parameterPanel = null; - - private ProcessInfo m_pi = null; - private boolean m_isLocked = false; - private boolean isParameterPage = true; - private String initialMessage; - private BusyDialog progressWindow; - private Future future; - private ProcessDialogRunnable processDialogRunnable; - private Mask mask; - private static final String ON_STATUS_UPDATE = "onStatusUpdate"; - private static final String ON_COMPLETE = "onComplete"; - //saved parameters private Combobox fSavedName=new Combobox(); private Button bSave=ButtonFactory.createNamedButton("Save"); private Button bDelete=ButtonFactory.createNamedButton("Delete"); private List savedParams; - private Label lSaved=new Label(Msg.getMsg(Env.getCtx(), "SavedParameter")); + private Label lSaved; /** * Set Visible @@ -294,153 +266,9 @@ public class ProcessDialog extends Window implements EventListener, IProc */ public void dispose() { - SessionManager.getAppDesktop().closeWindow(m_WindowNo); - valid = false; + super.dispose(); + SessionManager.getAppDesktop().closeWindow(getWindowNo()); }// dispose - - /** - * Dynamic Init - * @return true, if there is something to process (start from menu) - */ - public boolean init() - { - log.config(""); - // - boolean trl = !Env.isBaseLanguage(m_ctx, "AD_Process"); - String sql = "SELECT Name, Description, Help, IsReport, ShowHelp " - + "FROM AD_Process " - + "WHERE AD_Process_ID=?"; - if (trl) - sql = "SELECT t.Name, t.Description, t.Help, p.IsReport, p.ShowHelp " - + "FROM AD_Process p, AD_Process_Trl t " - + "WHERE p.AD_Process_ID=t.AD_Process_ID" - + " AND p.AD_Process_ID=? AND t.AD_Language=?"; - - PreparedStatement pstmt = null; - ResultSet rs = null; - try - { - pstmt = DB.prepareStatement(sql, null); - pstmt.setInt(1, m_AD_Process_ID); - if (trl) - pstmt.setString(2, Env.getAD_Language(m_ctx)); - rs = pstmt.executeQuery(); - if (rs.next()) - { - m_Name = rs.getString(1); - m_ShowHelp = rs.getString(5); - // - m_messageText.append(""); - String s = rs.getString(2); // Description - if (rs.wasNull()) - m_messageText.append(Msg.getMsg(m_ctx, "StartProcess?")); - else - m_messageText.append(s); - m_messageText.append(""); - - s = rs.getString(3); // Help - if (!rs.wasNull()) - m_messageText.append("

").append(s).append("

"); - } - } - catch (SQLException e) - { - log.log(Level.SEVERE, sql, e); - return false; - } - finally - { - DB.close(rs, pstmt); - } - - if (m_Name == null) - return false; - // - this.setTitle(m_Name); - initialMessage = m_messageText.toString(); - message.setContent(initialMessage); - bOK.setLabel(Msg.getMsg(Env.getCtx(), "Start")); - - // Move from APanel.actionButton - m_pi = new WProcessInfo(m_Name, m_AD_Process_ID); - m_pi.setAD_User_ID (Env.getAD_User_ID(Env.getCtx())); - m_pi.setAD_Client_ID(Env.getAD_Client_ID(Env.getCtx())); - parameterPanel = new ProcessParameterPanel(m_WindowNo, m_pi, "70%"); - centerPanel.getChildren().clear(); - if ( parameterPanel.init() ) { - centerPanel.appendChild(parameterPanel); - } else { - if (m_ShowHelp != null && m_ShowHelp.equals("N")) { - startProcess(); - } - } - - // Check if the process is a silent one - if(m_ShowHelp != null && m_ShowHelp.equals("S")) - { - startProcess(); - } - querySaved(); - return true; - } // init - - private void querySaved() - { - //user query - savedParams = MPInstance.get(Env.getCtx(), m_AD_Process_ID, Env.getContextAsInt(Env.getCtx(), "#AD_User_ID")); - fSavedName.removeAllItems(); - for (MPInstance instance : savedParams) - { - String queries = instance.get_ValueAsString("Name"); - fSavedName.appendItem(queries); - } - - fSavedName.setValue(""); - } - - public void startProcess() - { - m_pi.setPrintPreview(true); - - this.lockUI(m_pi); - - downloadFiles = new ArrayList(); - - Clients.response(new AuEcho(this, "runProcess", null)); - } - - public void runProcess() { - processDialogRunnable = new ProcessDialogRunnable(); - future = Adempiere.getThreadPoolExecutor().submit(new DesktopRunnable(processDialogRunnable, getDesktop())); - } - - private void onComplete() { - if (future != null) { - try { - future.get(); - } catch (Exception e) { - log.log(Level.SEVERE, e.getLocalizedMessage(), e); - if (!m_pi.isError()) { - m_pi.setSummary(e.getLocalizedMessage(), true); - } - } - } - future = null; - processDialogRunnable = null; - unlockUI(m_pi); - if (downloadFiles.size() > 0) { - MultiFileDownloadDialog downloadDialog = new MultiFileDownloadDialog(downloadFiles.toArray(new File[0])); - downloadDialog.setPage(this.getPage()); - downloadDialog.setTitle(m_pi.getTitle()); - Events.postEvent(downloadDialog, new Event(MultiFileDownloadDialog.ON_SHOW)); - } - } - - private void onStatusUpdate(Event event) { - String message = (String) event.getData(); - if (progressWindow != null) - progressWindow.statusUpdate(message); - } public void onEvent(Event event) { Component component = event.getTarget(); @@ -457,15 +285,13 @@ public class ProcessDialog extends Window implements EventListener, IProc } else if (component instanceof Button) { Button element = (Button)component; if ("Ok".equalsIgnoreCase(element.getId())) { - if (isParameterPage) { - if (!parameterPanel.validateParameters()) - return; - this.startProcess(); - } + if (isParameterPage) + startProcess(); else restart(); } else if ("Cancel".equalsIgnoreCase(element.getId())) { - this.dispose(); + cancelProcess(); + } else if (event.getTarget().equals(bSave) && fSavedName != null && !lastRun) { @@ -473,13 +299,13 @@ public class ProcessDialog extends Window implements EventListener, IProc if (fSavedName.getSelectedIndex() > -1 && savedParams != null) { for (int i = 0; i < savedParams.size(); i++) { if (savedParams.get(i).getName().equals(saveName)) { - m_pi.setAD_PInstance_ID(savedParams.get(i) + getProcessInfo().setAD_PInstance_ID(savedParams.get(i) .getAD_PInstance_ID()); for (MPInstancePara para : savedParams.get(i) .getParameters()) { para.deleteEx(true); } - parameterPanel.saveParameters(); + getParameterPanel().saveParameters(); } } } @@ -488,13 +314,13 @@ public class ProcessDialog extends Window implements EventListener, IProc MPInstance instance = null; try { instance = new MPInstance(Env.getCtx(), - m_pi.getAD_Process_ID(), m_pi.getRecord_ID()); + getProcessInfo().getAD_Process_ID(), getProcessInfo().getRecord_ID()); instance.setName(saveName); instance.saveEx(); - m_pi.setAD_PInstance_ID(instance.getAD_PInstance_ID()); + getProcessInfo().setAD_PInstance_ID(instance.getAD_PInstance_ID()); // Get Parameters - if (parameterPanel != null) { - if (!parameterPanel.saveParameters()) { + if (getParameterPanel() != null) { + if (!getParameterPanel().saveParameters()) { throw new AdempiereSystemError(Msg.getMsg( Env.getCtx(), "SaveParameterError")); } @@ -520,12 +346,8 @@ public class ProcessDialog extends Window implements EventListener, IProc } querySaved(); } - } else if (event.getName().equals(ON_STATUS_UPDATE)) { - onStatusUpdate(event); - } else if (event.getName().equals(ON_COMPLETE)) { - onComplete(); } else if (event.getName().equals(WindowContainer.ON_WINDOW_CONTAINER_SELECTION_CHANGED_EVENT)) { - SessionManager.getAppDesktop().updateHelpContext(X_AD_CtxHelp.CTXTYPE_Process, m_AD_Process_ID); + SessionManager.getAppDesktop().updateHelpContext(X_AD_CtxHelp.CTXTYPE_Process, getAD_Process_ID()); } else if (event.getTarget().equals(fSavedName)) { if (savedParams != null && saveName != null) { for (int i = 0; i < savedParams.size(); i++) { @@ -538,6 +360,8 @@ public class ProcessDialog extends Window implements EventListener, IProc bSave.setEnabled(enabled && !lastRun); bDelete.setEnabled(enabled && fSavedName.getSelectedIndex() > -1 && !lastRun); + } else { + super.onEvent(event); } } @@ -555,7 +379,7 @@ public class ProcessDialog extends Window implements EventListener, IProc } private void loadSavedParams(MPInstance instance) { - parameterPanel.loadParameters(instance); + getParameterPanel().loadParameters(instance); } private void doOnClick(A btn) { @@ -575,19 +399,10 @@ public class ProcessDialog extends Window implements EventListener, IProc } } - - public void lockUI(ProcessInfo pi) { - if (m_isLocked || Executions.getCurrent() == null) return; - - m_isLocked = true; - - showBusyDialog(); - } - - private void showBusyDialog() { - progressWindow = new BusyDialog(); + @Override + public void showBusyDialog() { + BusyDialog progressWindow = createBusyDialog(); progressWindow.setStyle("position: absolute;"); - this.appendChild(progressWindow); showBusyMask(progressWindow); LayoutUtils.openOverlappedWindow(this, progressWindow, "middle_center"); } @@ -599,7 +414,7 @@ public class ProcessDialog extends Window implements EventListener, IProc return mask; } - public void showBusyMask(Window window) { + private void showBusyMask(Window window) { getParent().appendChild(getMask()); StringBuilder script = new StringBuilder("var w=zk.Widget.$('#"); script.append(getParent().getUuid()).append("');"); @@ -610,16 +425,9 @@ public class ProcessDialog extends Window implements EventListener, IProc } Clients.response(new AuScript(script.toString())); } - - public void unlockUI(ProcessInfo pi) { - if (!m_isLocked || Executions.getCurrent() == null) return; - m_isLocked = false; - hideBusyDialog(); - updateUI(pi); - } - - public void hideBusyMask() { + private void hideBusyMask() + { if (mask != null && mask.getParent() != null) { mask.detach(); StringBuilder script = new StringBuilder("var w=zk.Widget.$('#"); @@ -628,20 +436,21 @@ public class ProcessDialog extends Window implements EventListener, IProc } } - private void hideBusyDialog() { + @Override + public void hideBusyDialog() + { hideBusyMask(); - if (progressWindow != null) { - progressWindow.dispose(); - progressWindow = null; - } + closeBusyDialog(); } - private void updateUI(ProcessInfo pi) { + @Override + public void updateUI() { + ProcessInfo pi = getProcessInfo(); ProcessInfoUtil.setLogFromDB(pi); - m_messageText.append("

** ") + getMessageText().append("

** ") .append(pi.getSummary()) .append("

"); - message.setContent(m_messageText.toString()); + getMessage().setContent(getMessageText().toString()); // Add Log info with zoom on record id appendRecordLogInfo(pi.getLogs()); @@ -652,7 +461,7 @@ public class ProcessDialog extends Window implements EventListener, IProc m_ids = pi.getIDs(); //move message div to center to give more space to display potentially very long log info - centerPanel.detach(); + getCenterPanel().detach(); messageDiv.detach(); messageDiv.setStyle(""); north.setVisible(false); @@ -747,8 +556,8 @@ public class ProcessDialog extends Window implements EventListener, IProc } private void restart() { - m_messageText = new StringBuffer(initialMessage); - message.setContent(initialMessage); + setMessageText(new StringBuffer(getInitialMessage())); + getMessage().setContent(getInitialMessage()); north.setVisible(true); messageDiv.detach(); @@ -758,7 +567,7 @@ public class ProcessDialog extends Window implements EventListener, IProc messageDiv.setStyle(MESSAGE_DIV_STYLE); north.appendChild(messageDiv); - center.appendChild(centerPanel); + center.appendChild(getCenterPanel()); isParameterPage = true; @@ -766,10 +575,11 @@ public class ProcessDialog extends Window implements EventListener, IProc bOK.setImage(ThemeManager.getThemeResource("images/Ok16.png")); //recreate process info - m_pi = new WProcessInfo(m_Name, m_AD_Process_ID); + ProcessInfo m_pi = new WProcessInfo(getName(), getAD_Process_ID()); m_pi.setAD_User_ID (Env.getAD_User_ID(Env.getCtx())); m_pi.setAD_Client_ID(Env.getAD_Client_ID(Env.getCtx())); - parameterPanel.setProcessInfo(m_pi); + setProcessInfo(m_pi); + getParameterPanel().setProcessInfo(m_pi); m_ids = null; @@ -781,7 +591,7 @@ public class ProcessDialog extends Window implements EventListener, IProc // if (!afterProcessTask()) { // If the process is a silent one and no errors occured, close the dialog - if(m_ShowHelp != null && m_ShowHelp.equals("S")) + if(getShowHelp() != null && getShowHelp().equals("S")) this.dispose(); } } @@ -796,12 +606,12 @@ public class ProcessDialog extends Window implements EventListener, IProc { log.config(""); // Print invoices - if (m_AD_Process_ID == PROCESS_C_INVOICE_GENERATE) + if (getAD_Process_ID() == PROCESS_C_INVOICE_GENERATE) { printInvoices(); return true; } - else if (m_AD_Process_ID == PROCESS_M_INOUT_GENERATE) + else if (getAD_Process_ID() == PROCESS_M_INOUT_GENERATE) { printShipments(); return true; @@ -821,12 +631,12 @@ public class ProcessDialog extends Window implements EventListener, IProc { if (m_ids == null) return; - FDialog.ask(m_WindowNo, this, "PrintShipments", new Callback() { + FDialog.ask(getWindowNo(), this, "PrintShipments", new Callback() { @Override public void onCallback(Boolean result) { if (result) { - m_messageText.append("

").append(Msg.getMsg(Env.getCtx(), "PrintShipments")).append("

"); - message.setContent(m_messageText.toString()); + getMessageText().append("

").append(Msg.getMsg(Env.getCtx(), "PrintShipments")).append("

"); + getMessage().setContent(getMessageText().toString()); showBusyDialog(); Clients.response(new AuEcho(ProcessDialog.this, "onPrintShipments", null)); } @@ -872,7 +682,7 @@ public class ProcessDialog extends Window implements EventListener, IProc document.close(); hideBusyDialog(); - Window win = new SimplePDFViewer(m_pi.getTitle(), new FileInputStream(outFile)); + Window win = new SimplePDFViewer(getProcessInfo().getTitle(), new FileInputStream(outFile)); SessionManager.getAppDesktop().showWindow(win, "center"); } catch (Exception e) { log.log(Level.SEVERE, e.getLocalizedMessage(), e); @@ -883,7 +693,7 @@ public class ProcessDialog extends Window implements EventListener, IProc } else if (pdfList.size() > 0) { hideBusyDialog(); try { - Window win = new SimplePDFViewer(m_pi.getTitle(), new FileInputStream(pdfList.get(0))); + Window win = new SimplePDFViewer(getProcessInfo().getTitle(), new FileInputStream(pdfList.get(0))); SessionManager.getAppDesktop().showWindow(win, "center"); } catch (Exception e) { @@ -892,7 +702,7 @@ public class ProcessDialog extends Window implements EventListener, IProc } // If the process is a silent one and no errors occured, close the dialog - if(m_ShowHelp != null && m_ShowHelp.equals("S")) + if(getShowHelp() != null && getShowHelp().equals("S")) this.dispose(); } @@ -903,14 +713,14 @@ public class ProcessDialog extends Window implements EventListener, IProc { if (m_ids == null) return; - FDialog.ask(m_WindowNo, this, "PrintInvoices", new Callback() { + FDialog.ask(getWindowNo(), this, "PrintInvoices", new Callback() { @Override public void onCallback(Boolean result) { if (result) { - m_messageText.append("

").append(Msg.getMsg(Env.getCtx(), "PrintInvoices")).append("

"); - message.setContent(m_messageText.toString()); + getMessageText().append("

").append(Msg.getMsg(Env.getCtx(), "PrintInvoices")).append("

"); + getMessage().setContent(getMessageText().toString()); showBusyDialog(); Clients.response(new AuEcho(ProcessDialog.this, "onPrintInvoices", null)); } @@ -954,7 +764,7 @@ public class ProcessDialog extends Window implements EventListener, IProc document.close(); hideBusyDialog(); - Window win = new SimplePDFViewer(m_pi.getTitle(), new FileInputStream(outFile)); + Window win = new SimplePDFViewer(getProcessInfo().getTitle(), new FileInputStream(outFile)); SessionManager.getAppDesktop().showWindow(win, "center"); } catch (Exception e) { log.log(Level.SEVERE, e.getLocalizedMessage(), e); @@ -965,7 +775,7 @@ public class ProcessDialog extends Window implements EventListener, IProc } else if (pdfList.size() > 0) { hideBusyDialog(); try { - Window win = new SimplePDFViewer(m_pi.getTitle(), new FileInputStream(pdfList.get(0))); + Window win = new SimplePDFViewer(getProcessInfo().getTitle(), new FileInputStream(pdfList.get(0))); SessionManager.getAppDesktop().showWindow(win, "center"); } catch (Exception e) { @@ -974,52 +784,8 @@ public class ProcessDialog extends Window implements EventListener, IProc } // If the process is a silent one and no errors occured, close the dialog - if(m_ShowHelp != null && m_ShowHelp.equals("S")) + if(getShowHelp() != null && getShowHelp().equals("S")) this.dispose(); } - - public boolean isValid() { - return valid; - } - - public boolean isUILocked() { - return m_isLocked; - } - class ProcessDialogRunnable extends ContextRunnable { - ProcessDialogRunnable() { - super(); - } - - protected void doRun() { - try { - if (log.isLoggable(Level.INFO))log.log(Level.INFO, "Process Info="+m_pi+" AD_Client_ID="+Env.getAD_Client_ID(Env.getCtx())); - WProcessCtl.process(ProcessDialog.this, m_WindowNo, parameterPanel, m_pi, null); - } finally { - Executions.schedule(getDesktop(), ProcessDialog.this, new Event(ON_COMPLETE, ProcessDialog.this, null)); - } - } - } - - @Override - public void statusUpdate(String message) { - Desktop desktop = getDesktop(); - if (desktop != null && desktop.isAlive()) - Executions.schedule(desktop, this, new Event(ON_STATUS_UPDATE, this, message)); - } - - @Override - public void ask(final String message, final Callback callback) { - Executions.schedule(getDesktop(), new EventListener() { - @Override - public void onEvent(Event event) throws Exception { - FDialog.ask(m_WindowNo, null, message, callback); - } - }, new Event("onAsk")); - } - - @Override - public void download(File file) { - downloadFiles.add(file); - } } // ProcessDialog diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessModalDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessModalDialog.java index d6fb4c02af..a8e1fb0d69 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessModalDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessModalDialog.java @@ -16,45 +16,24 @@ *****************************************************************************/ package org.adempiere.webui.apps; -import java.io.File; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; -import java.util.Properties; -import java.util.concurrent.Future; import java.util.logging.Level; -import org.adempiere.util.Callback; -import org.adempiere.util.ContextRunnable; -import org.adempiere.util.IProcessUI; import org.adempiere.webui.LayoutUtils; import org.adempiere.webui.component.Button; import org.adempiere.webui.component.ConfirmPanel; -import org.adempiere.webui.component.Panel; import org.adempiere.webui.component.VerticalBox; import org.adempiere.webui.component.Window; import org.adempiere.webui.event.DialogEvents; import org.adempiere.webui.factory.ButtonFactory; -import org.adempiere.webui.window.FDialog; -import org.adempiere.webui.window.MultiFileDownloadDialog; -import org.compiere.Adempiere; import org.compiere.process.ProcessInfo; import org.compiere.util.CLogger; -import org.compiere.util.DB; import org.compiere.util.Env; -import org.compiere.util.Msg; -import org.zkoss.zk.au.out.AuEcho; import org.zkoss.zk.ui.Component; -import org.zkoss.zk.ui.Executions; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; -import org.zkoss.zk.ui.util.Clients; import org.zkoss.zul.Div; import org.zkoss.zul.Hbox; -import org.zkoss.zul.Html; import org.zkoss.zul.Vlayout; /** @@ -68,20 +47,18 @@ import org.zkoss.zul.Vlayout; * @author arboleda - globalqss * - Implement ShowHelp option on processes and reports */ -public class ProcessModalDialog extends Window implements EventListener, IProcessUI, DialogEvents +public class ProcessModalDialog extends AbstractProcessDialog implements EventListener, DialogEvents { /** * */ - private static final long serialVersionUID = -3708004619583382450L; + private static final long serialVersionUID = -3260639688339379279L; - private static final String ON_STATUS_UPDATE = "onStatusUpdate"; - private static final String ON_COMPLETE = "onComplete"; - - private boolean m_autoStart; private VerticalBox dialogBody; - - private List downloadFiles; + + /** Logger */ + private static CLogger log = CLogger.getCLogger(ProcessModalDialog.class); + // /** * @param aProcess @@ -102,10 +79,7 @@ public class ProcessModalDialog extends Window implements EventListener, */ public ProcessModalDialog(EventListener listener, int WindowNo, ProcessInfo pi, boolean autoStart) { - m_ctx = Env.getCtx(); - m_WindowNo = WindowNo; - m_pi = pi; - m_autoStart = autoStart; + super(); if (listener != null) { @@ -116,7 +90,7 @@ public class ProcessModalDialog extends Window implements EventListener, try { initComponents(); - init(); + init(Env.getCtx(), WindowNo, pi.getAD_Process_ID(), pi, "100%", autoStart, true); } catch(Exception ex) { @@ -172,12 +146,10 @@ public class ProcessModalDialog extends Window implements EventListener, dialogBody.appendChild(dialogContent); Div div = new Div(); div.setId("message"); - message = new Html(); - div.appendChild(message); + div.appendChild(getMessage()); div.setStyle("max-height: 150pt; overflow: auto;"); dialogContent.appendChild(div); - centerPanel = new Panel(); - dialogContent.appendChild(centerPanel); + dialogContent.appendChild(getCenterPanel()); Hbox hbox = new Hbox(); hbox.setWidth("100%"); hbox.setSclass("dialog-footer"); @@ -198,28 +170,6 @@ public class ProcessModalDialog extends Window implements EventListener, } - private int m_WindowNo; - private Properties m_ctx; - private String m_Name = null; - private StringBuffer m_messageText = new StringBuffer(); - private String m_ShowHelp = null; // Determine if a Help Process Window is shown - private boolean m_valid = true; - private boolean m_cancel = false; - - private Panel centerPanel = null; - private Html message = null; - - /** Logger */ - private static CLogger log = CLogger.getCLogger(ProcessModalDialog.class); - // - private ProcessParameterPanel parameterPanel = null; - - private ProcessInfo m_pi = null; - private BusyDialog progressWindow; - private boolean isLocked = false; - private org.adempiere.webui.apps.ProcessModalDialog.ProcessDialogRunnable processDialogRunnable; - private Future future; - /** * Set Visible * (set focus to OK if visible) @@ -235,158 +185,39 @@ public class ProcessModalDialog extends Window implements EventListener, */ public void dispose() { - parameterPanel.restoreContext(); - m_valid = false; + super.dispose(); + getParameterPanel().restoreContext(); this.detach(); } // dispose - /** - * is dialog still valid - * @return boolean - */ - public boolean isValid() + @Override + public void autoStart() { - return m_valid; + this.getFirstChild().setVisible(false); + super.autoStart(); } - /** - * @return true if user have press the cancel button to close the dialog - */ - public boolean isCancel() - { - return m_cancel; - } - - /** - * Dynamic Init - * @return true, if there is something to process (start from menu) - */ - public boolean init() - { - log.config(""); - // - boolean trl = !Env.isBaseLanguage(m_ctx, "AD_Process"); - String sql = "SELECT Name, Description, Help, IsReport, ShowHelp " - + "FROM AD_Process " - + "WHERE AD_Process_ID=?"; - if (trl) - sql = "SELECT t.Name, t.Description, t.Help, p.IsReport, p.ShowHelp " - + "FROM AD_Process p, AD_Process_Trl t " - + "WHERE p.AD_Process_ID=t.AD_Process_ID" - + " AND p.AD_Process_ID=? AND t.AD_Language=?"; - - PreparedStatement pstmt = null; - ResultSet rs = null; - try - { - pstmt = DB.prepareStatement(sql, null); - pstmt.setInt(1, m_pi.getAD_Process_ID()); - if (trl) - pstmt.setString(2, Env.getAD_Language(m_ctx)); - rs = pstmt.executeQuery(); - if (rs.next()) - { - m_Name = rs.getString(1); - m_ShowHelp = rs.getString(5); - // - m_messageText.append(""); - String s = rs.getString(2); // Description - if (rs.wasNull()) - m_messageText.append(Msg.getMsg(m_ctx, "StartProcess?")); - else - m_messageText.append(s); - m_messageText.append(""); - - s = rs.getString(3); // Help - if (!rs.wasNull()) - m_messageText.append("

").append(s).append("

"); - } - } - catch (SQLException e) - { - log.log(Level.SEVERE, sql, e); - return false; - } - finally - { - DB.close(rs, pstmt); - } - - if (m_Name == null) - return false; - // - this.setTitle(m_Name); - message.setContent(m_messageText.toString()); - - // Move from APanel.actionButton - m_pi.setAD_User_ID (Env.getAD_User_ID(Env.getCtx())); - m_pi.setAD_Client_ID(Env.getAD_Client_ID(Env.getCtx())); - m_pi.setTitle(m_Name); - parameterPanel = new ProcessParameterPanel(m_WindowNo, m_pi); - centerPanel.getChildren().clear(); - if ( parameterPanel.init() ) { - centerPanel.appendChild(parameterPanel); - } else { - if (m_ShowHelp != null && m_ShowHelp.equals("N")) { - m_autoStart = true; - } - if (m_autoStart) { - this.getFirstChild().setVisible(false); - startProcess(); - return true; - } - } - - // Check if the process is a silent one - if(isValid() && m_ShowHelp != null && m_ShowHelp.equals("S")) - { - this.getFirstChild().setVisible(false); - startProcess(); - } - return true; - } // init - - /** - * launch process - */ - private void startProcess() - { - m_pi.setPrintPreview(true); - - lockUI(m_pi); - - downloadFiles = new ArrayList(); - - //use echo, otherwise lock ui wouldn't work - Clients.response(new AuEcho(this, "runProcess", null)); - } - - private void showBusyDialog() { + @Override + public void showBusyDialog() { this.setBorder("none"); this.setTitle(null); dialogBody.setVisible(false); - progressWindow = new BusyDialog(); - this.appendChild(progressWindow); + BusyDialog progressWindow = createBusyDialog(); if (this.getParent() != null) LayoutUtils.openOverlappedWindow(this.getParent(), progressWindow, "middle_center"); } - - /** - * internal use, don't call this directly - */ - public void runProcess() { - processDialogRunnable = new ProcessDialogRunnable(); - future = Adempiere.getThreadPoolExecutor().submit(new DesktopRunnable(processDialogRunnable, getDesktop())); + + @Override + public void updateUI() { + } - private void hideBusyDialog() { - if (progressWindow != null) { - progressWindow.dispose(); - progressWindow = null; - } + @Override + public void hideBusyDialog() { + closeBusyDialog(); } - + /** * handle events */ @@ -394,138 +225,12 @@ public class ProcessModalDialog extends Window implements EventListener, Component component = event.getTarget(); if (component instanceof Button) { Button element = (Button)component; - if ("Ok".equalsIgnoreCase(element.getId())) { - onOK(); - } else if ("Cancel".equalsIgnoreCase(element.getId())) { - onCancel(); - } - } else if (event.getName().equals(ON_STATUS_UPDATE)) { - onStatusUpdate(event); - } else if (event.getName().equals(ON_COMPLETE)) { - onComplete(); + if ("Ok".equalsIgnoreCase(element.getId())) + startProcess(); + else if ("Cancel".equalsIgnoreCase(element.getId())) + cancelProcess(); + } else { + super.onEvent(event); } - } - - private void onOK() { - if (!parameterPanel.validateParameters()) - return; - this.startProcess(); - } - - private void onCancel() { - m_cancel = true; - this.dispose(); - } - - private void onStatusUpdate(Event event) { - String message = (String) event.getData(); - if (progressWindow != null) - progressWindow.statusUpdate(message); - } - - private void onComplete() { - if (future != null) { - try { - future.get(); - } catch (Exception e) { - log.log(Level.SEVERE, e.getLocalizedMessage(), e); - if (!m_pi.isError()) { - m_pi.setSummary(e.getLocalizedMessage(), true); - } - } - } - future = null; - processDialogRunnable = null; - unlockUI(m_pi); - if (downloadFiles.size() > 0) { - MultiFileDownloadDialog downloadDialog = new MultiFileDownloadDialog(downloadFiles.toArray(new File[0])); - downloadDialog.setPage(this.getPage()); - downloadDialog.setTitle(m_pi.getTitle()); - Events.postEvent(downloadDialog, new Event(MultiFileDownloadDialog.ON_SHOW)); - } - dispose(); - } - - @Override - public void lockUI(ProcessInfo pi) { - if (isLocked || Executions.getCurrent() == null) - return; - - showBusyDialog(); - isLocked = true; - } - - @Override - public void unlockUI(ProcessInfo pi) { - if (!isLocked) - return; - - if (Executions.getCurrent() == null) { - Executions.schedule(getDesktop(), new EventListener() { - @Override - public void onEvent(Event event) throws Exception { - doUnlockUI(); - } - }, new Event("onUnLockUI")); - } else { - doUnlockUI(); - } - } - - private void doUnlockUI() { - hideBusyDialog(); - isLocked = false; - } - - @Override - public boolean isUILocked() { - return isLocked; - } - - @Override - public void statusUpdate(String message) { - Executions.schedule(getDesktop(), this, new Event(ON_STATUS_UPDATE, this, message)); - } - - /** - * - * @return ProcessInfo - */ - public ProcessInfo getProcessInfo() { - return m_pi; - } - - class ProcessDialogRunnable extends ContextRunnable{ - ProcessDialogRunnable() { - super(); - } - - protected void doRun() { - try { - if (log.isLoggable(Level.INFO))log.log(Level.INFO, "Process Info="+m_pi+" AD_Client_ID="+Env.getAD_Client_ID(Env.getCtx())); - WProcessCtl.process(ProcessModalDialog.this, m_WindowNo, parameterPanel, m_pi, null); - } catch (Exception ex) { - m_pi.setError(true); - m_pi.setSummary(ex.getLocalizedMessage()); - log.log(Level.SEVERE, ex.getLocalizedMessage(), ex); - } finally { - Executions.schedule(getDesktop(), ProcessModalDialog.this, new Event(ON_COMPLETE, ProcessModalDialog.this, null)); - } - } - } - - @Override - public void ask(final String message, final Callback callback) { - Executions.schedule(getDesktop(), new EventListener() { - @Override - public void onEvent(Event event) throws Exception { - FDialog.ask(m_WindowNo, null, message, callback); - } - }, new Event("onAsk")); - } - - @Override - public void download(File file) { - downloadFiles.add(file); - } -} // ProcessDialog + } +} // ProcessModalDialog diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPaySelect.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPaySelect.java index c35deb6da9..5fe683d99e 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPaySelect.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPaySelect.java @@ -471,4 +471,14 @@ public class WPaySelect extends PaySelect // TODO Auto-generated method stub } + + @Override + public void askForInput(final String message, final Callback callback) { + Executions.schedule(form.getDesktop(), new EventListener() { + @Override + public void onEvent(Event event) throws Exception { + FDialog.askForInput(m_WindowNo, null, message, callback); + } + }, new Event("onAskForInput")); + } } // VPaySelect diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Messagebox.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Messagebox.java index b81cdbfc93..5a98f40b43 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Messagebox.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Messagebox.java @@ -35,6 +35,7 @@ import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; import org.zkoss.zul.Hbox; import org.zkoss.zul.Image; +import org.zkoss.zul.Vbox; /** * Messagebox : Replaces ZK's Messagebox @@ -46,9 +47,10 @@ import org.zkoss.zul.Image; public class Messagebox extends Window implements EventListener { /** - * generated serial version ID + * */ - private static final long serialVersionUID = -4957498533838144942L; + private static final long serialVersionUID = 8928526331932742124L; + private static final String MESSAGE_PANEL_STYLE = "text-align:left; word-break: break-all; overflow: auto; max-height: 350pt; min-width: 230pt; max-width: 450pt;"; private String msg = new String(""); private String imgSrc = new String(""); @@ -62,11 +64,14 @@ public class Messagebox extends Window implements EventListener private Button btnAbort; private Button btnRetry; private Button btnIgnore; + private Textbox txtInput = new Textbox();; private Image img = new Image(); private int returnValue; - private Callback callback; + @SuppressWarnings("rawtypes") + private Callback callback; + private boolean isInput = false; /** A OK button. */ public static final int OK = 0x0001; @@ -88,6 +93,9 @@ public class Messagebox extends Window implements EventListener /** A IGNORE button. */ public static final int IGNORE = 0x0400; + + /** A INPUT Textfield*/ + public static final int INPUT = 0x0800; /** A symbol consisting of a question mark in a circle. */ public static final String QUESTION = "~./zul/img/msgbox/question-btn.png"; @@ -155,6 +163,14 @@ public class Messagebox extends Window implements EventListener pnlMessage.setStyle(MESSAGE_PANEL_STYLE); pnlMessage.appendChild(lblMsg); + Panel pnlInput= new Panel(); + pnlInput.setStyle(MESSAGE_PANEL_STYLE); + pnlInput.appendChild(txtInput); + + Vbox pnlText = new Vbox(); + pnlText.appendChild(pnlMessage); + pnlText.appendChild(pnlInput); + Hbox pnlImage = new Hbox(); img.setSrc(imgSrc); @@ -168,7 +184,7 @@ public class Messagebox extends Window implements EventListener north.setAlign("center"); this.appendChild(north); north.appendChild(pnlImage); - north.appendChild(pnlMessage); + north.appendChild(pnlText); north.setSclass("dialog-content"); Hbox pnlButtons = new Hbox(); @@ -201,7 +217,7 @@ public class Messagebox extends Window implements EventListener return show(message, title, buttons, icon, callback, false); } - public int show(String message, String title, int buttons, String icon, Callback callback, boolean modal) + public int show(String message, String title, int buttons, String icon, Callback callback, boolean modal) { this.msg = message; this.imgSrc = icon; @@ -216,6 +232,7 @@ public class Messagebox extends Window implements EventListener btnRetry.setVisible(false); btnAbort.setVisible(false); btnIgnore.setVisible(false); + txtInput.setVisible(false); if ((buttons & OK) != 0) btnOk.setVisible(true); @@ -238,6 +255,11 @@ public class Messagebox extends Window implements EventListener if ((buttons & IGNORE) != 0) btnIgnore.setVisible(true); + if ((buttons & INPUT) != 0) { + txtInput.setVisible(true); + isInput = true; + } + this.setTitle(title); this.setPosition("center"); this.setClosable(true); @@ -274,7 +296,7 @@ public class Messagebox extends Window implements EventListener return showDialog(message, title, buttons, icon, callback, false); } - public static int showDialog(String message, String title, int buttons, String icon, Callback callback, boolean modal) + public static int showDialog(String message, String title, int buttons, String icon, Callback callback, boolean modal) { Messagebox msg = new Messagebox(); @@ -318,12 +340,15 @@ public class Messagebox extends Window implements EventListener this.detach(); } + @SuppressWarnings("unchecked") @Override public void onPageDetached(Page page) { super.onPageDetached(page); - if (callback != null) + if (callback != null && !isInput) { callback.onCallback(returnValue); + } else if (callback != null && isInput) { + callback.onCallback(txtInput.getText()); } } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPRunningJobs.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPRunningJobs.java new file mode 100644 index 0000000000..83e220b5e7 --- /dev/null +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPRunningJobs.java @@ -0,0 +1,282 @@ +/****************************************************************************** + * Copyright (C) 2014 Elaine Tan * + * Copyright (C) 2014 Trek Global + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ + +package org.adempiere.webui.dashboard; + +import java.lang.ref.WeakReference; +import java.util.List; +import java.util.Properties; + +import org.adempiere.base.Service; +import org.adempiere.base.event.EventManager; +import org.adempiere.webui.apps.AEnv; +import org.adempiere.webui.theme.ThemeManager; +import org.adempiere.webui.util.ServerPushTemplate; +import org.compiere.model.MPInstance; +import org.compiere.model.MProcess; +import org.compiere.model.Query; +import org.compiere.util.Env; +import org.compiere.util.Msg; +import org.compiere.util.Util; +import org.idempiere.distributed.IMessageService; +import org.idempiere.distributed.ITopic; +import org.idempiere.distributed.ITopicSubscriber; +import org.osgi.service.event.EventHandler; +import org.zkoss.zk.ui.Component; +import org.zkoss.zk.ui.Desktop; +import org.zkoss.zk.ui.Page; +import org.zkoss.zk.ui.event.Event; +import org.zkoss.zk.ui.event.EventListener; +import org.zkoss.zk.ui.event.Events; +import org.zkoss.zk.ui.util.DesktopCleanup; +import org.zkoss.zul.A; +import org.zkoss.zul.Box; +import org.zkoss.zul.Image; +import org.zkoss.zul.Panel; +import org.zkoss.zul.Panelchildren; +import org.zkoss.zul.Toolbar; +import org.zkoss.zul.Vbox; + +public class DPRunningJobs extends DashboardPanel implements EventListener, EventHandler { + + /** + * + */ + private static final long serialVersionUID = 1946438226234068194L; + + private static final String AD_PINSTANCE_ID_ATTR = "AD_PInstance_ID"; + + private static TopicSubscriber topicSubscriber; + + private Box bxJobs; + + private int AD_User_ID; + + private Properties ctx; + + private WeakReference desktop; + + private DesktopCleanup listener; + + public DPRunningJobs() + { + super(); + + ctx = new Properties(); + ctx.putAll(Env.getCtx()); + AD_User_ID = Env.getAD_User_ID(ctx); + + Panel panel = new Panel(); + this.appendChild(panel); + + Panelchildren jobsContent = new Panelchildren(); + panel.appendChild(jobsContent); + bxJobs = new Vbox(); + bxJobs.setHflex("1"); + this.setSclass("recentitems-box"); + jobsContent.appendChild(bxJobs); + createJobsPanel(); + + Toolbar jobsToolbar = new Toolbar(); + this.appendChild(jobsToolbar); + + Image imgr = new Image(ThemeManager.getThemeResource("images/Refresh24.png")); + jobsToolbar.appendChild(imgr); + imgr.setStyle("text-align: right; cursor: pointer; width:24px; height:24px;"); + imgr.setTooltiptext(Util.cleanAmp(Msg.getMsg(ctx, "Refresh"))); + imgr.addEventListener(Events.ON_CLICK, this); + + createTopicSubscriber(); + + listener = new DesktopCleanup() { + @Override + public void cleanup(Desktop desktop) throws Exception { + DPRunningJobs.this.cleanup(); + } + }; + } + + protected void cleanup() + { + EventManager.getInstance().unregister(this); + desktop = null; + } + + private static synchronized void createTopicSubscriber() + { + if (topicSubscriber == null) { + topicSubscriber = new TopicSubscriber(); + IMessageService service = Service.locator().locate(IMessageService.class).getService(); + if (service != null) { + ITopic topic = service.getTopic(MPInstance.ON_RUNNING_JOB_CHANGED_TOPIC); + topic.subscribe(topicSubscriber); + } + } + } + + private void createJobsPanel() + { + refresh(); + } + + @Override + public void onEvent(Event event) throws Exception + { + Component comp = event.getTarget(); + String eventName = event.getName(); + + if (eventName.equals(Events.ON_CLICK)) + doOnClick(comp); + } + + private void doOnClick(Component comp) + { + if (comp instanceof A) + { + A btn = (A) comp; + + int AD_PInstance_ID = 0; + try + { + AD_PInstance_ID = Integer.valueOf((String)btn.getAttribute(AD_PINSTANCE_ID_ATTR)); + } + catch (Exception e) { + } + + if (AD_PInstance_ID > 0) + AEnv.zoom(MPInstance.Table_ID, AD_PInstance_ID); + } + + if (comp instanceof Image) // Refresh button + { + refresh(); + } + } + + private synchronized void refresh() + { + // Please review here - is throwing NPE in some cases when user push repeatedly the refresh button + List childs = bxJobs.getChildren(); + int childCount = childs.size(); + for (int c = childCount - 1; c >=0; c--) { + Component comp = (Component) childs.get(c); + if (comp instanceof A) { + comp.removeEventListener(Events.ON_CLICK, this); + } + bxJobs.removeChild(comp); + } + + List pis = getRunningJobForUser(ctx, AD_User_ID); + for (MPInstance pi : pis) { + MProcess process = new MProcess(pi.getCtx(), pi.getAD_Process_ID(), pi.get_TrxName()); + String label = process.getName() + " [" + Msg.getElement(pi.getCtx(), "Created") + " = " + pi.getCreated() + "]"; + A btnJob = new A(); + btnJob.setAttribute(AD_PINSTANCE_ID_ATTR, String.valueOf(pi.getAD_PInstance_ID())); + bxJobs.appendChild(btnJob); + btnJob.setLabel(label); + btnJob.setImage(ThemeManager.getThemeResource(getIconFile())); + btnJob.addEventListener(Events.ON_CLICK, this); + btnJob.setSclass("menu-href"); + btnJob.setHflex("1"); + } + } + + public static List getRunningJobForUser(Properties ctx, int AD_User_ID) + { + List pis = new Query(ctx, MPInstance.Table_Name, "Coalesce(AD_User_ID,0)=? AND IsProcessing='Y' AND IsRunAsJob='Y'", null) + .setOnlyActiveRecords(true) + .setClient_ID() + .setParameters(AD_User_ID) + .setOrderBy("Updated DESC") + .list(); + return pis; + } + + private String getIconFile() + { + return "images/mWindow.png"; + } + + @Override + public void refresh(ServerPushTemplate template) + { + template.executeAsync(this); + } + + @Override + public void updateUI() + { + refresh(); + bxJobs.invalidate(); + updateDesktopReference(); + } + + /** + * + */ + protected void updateDesktopReference() + { + if ((desktop == null || desktop.get() == null) || (desktop.get() != null && desktop.get() != getDesktop())) { + if (desktop != null && desktop.get() != null) + desktop.get().removeListener(listener); + + desktop = new WeakReference(getDesktop()); + desktop.get().addListener(listener); + } + } + + @Override + public void handleEvent(org.osgi.service.event.Event event) + { + if (event.getTopic().equals(MPInstance.ON_RUNNING_JOB_CHANGED_TOPIC) && event.getProperty("AD_User_ID") != null) { + Object property = event.getProperty("AD_User_ID"); + if (property instanceof Number) { + int id = ((Number)property).intValue(); + if (id == AD_User_ID) { + try { + if (desktop != null && desktop.get() != null && desktop.get().isAlive()) { + ServerPushTemplate template = new ServerPushTemplate(desktop.get()); + refresh(template); + } + } catch (Exception e) { + EventManager.getInstance().unregister(this); + } + } + } + } + } + + @Override + public void onPageAttached(Page newpage, Page oldpage) + { + super.onPageAttached(newpage, oldpage); + if (newpage != null) { + EventManager.getInstance().register(MPInstance.ON_RUNNING_JOB_CHANGED_TOPIC, this); + updateDesktopReference(); + } + } + + @Override + public void onPageDetached(Page page) { + super.onPageDetached(page); + cleanup(); + } + + static class TopicSubscriber implements ITopicSubscriber { + @Override + public void onMessage(Integer message) { + MPInstance.postOnChangedEvent(message); + } + } +} \ No newline at end of file diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPViews.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPViews.java index be2727d850..b9188cb3b4 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPViews.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPViews.java @@ -18,7 +18,7 @@ import java.util.List; import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.component.ToolBarButton; import org.adempiere.webui.component.Window; -import org.adempiere.webui.panel.InfoPanel; +import org.adempiere.webui.session.SessionManager; import org.adempiere.webui.theme.ThemeManager; import org.adempiere.webui.window.InfoSchedule; import org.compiere.model.MInfoWindow; @@ -135,9 +135,8 @@ public class DPViews extends DashboardPanel implements EventListener { if (infoWindowID<=0) return; - - String tableName = MTable.getTableName(Env.getCtx(), new MInfoWindow(Env.getCtx(), infoWindowID, null).getAD_Table_ID()); - InfoPanel.showPanel(tableName); + + SessionManager.getAppDesktop().openInfo(infoWindowID); } } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoBPartnerWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoBPartnerWindow.java index adff6a9a4c..7a4b15ea14 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoBPartnerWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoBPartnerWindow.java @@ -107,6 +107,7 @@ public class InfoBPartnerWindow extends InfoWindow { } } } + dynamicDisplay(null); } @Override diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoInOutWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoInOutWindow.java index 63d9b9c7c5..8636d9ac4b 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoInOutWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoInOutWindow.java @@ -67,5 +67,6 @@ public class InfoInOutWindow extends InfoWindow { } } } + dynamicDisplay(null); } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoInvoiceWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoInvoiceWindow.java index e64a9daa47..705e06dc6d 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoInvoiceWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoInvoiceWindow.java @@ -78,6 +78,7 @@ public class InfoInvoiceWindow extends InfoWindow { } } } + dynamicDisplay(null); } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoOrderWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoOrderWindow.java index 17355170e3..e54f176f81 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoOrderWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoOrderWindow.java @@ -78,5 +78,6 @@ public class InfoOrderWindow extends InfoWindow { } } } + dynamicDisplay(null); } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoPaymentWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoPaymentWindow.java index a4520f92d6..1e44708fa7 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoPaymentWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoPaymentWindow.java @@ -67,5 +67,6 @@ public class InfoPaymentWindow extends InfoWindow { } } } + dynamicDisplay(null); } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoProductWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoProductWindow.java index 42345f04d7..60306ea4e2 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoProductWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoProductWindow.java @@ -130,6 +130,7 @@ public class InfoProductWindow extends InfoWindow { protected void createParameterPanel() { super.createParameterPanel(); initParameters(); + dynamicDisplay(null); } @Override diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java index 8c4ab4631d..1b91924ae0 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java @@ -40,6 +40,7 @@ import org.adempiere.webui.event.ValueChangeEvent; import org.adempiere.webui.event.ValueChangeListener; import org.adempiere.webui.panel.InfoPanel; import org.adempiere.webui.session.SessionManager; +import org.adempiere.webui.window.FDialog; import org.compiere.minigrid.ColumnInfo; import org.compiere.minigrid.EmbedWinInfo; import org.compiere.minigrid.IDColumn; @@ -185,7 +186,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL for (int i = 0; i < identifiers.size(); i++) { WEditor editor = identifiers.get(i); editor.setValue(queryValue); - testCount(); + testCount(false); if (m_count > 0) { break; } else { @@ -202,7 +203,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL WEditor editor = identifiers.get(i); editor.setValue(values[i]); } - testCount(); + testCount(false); } } @@ -270,7 +271,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL StringBuilder builder = new StringBuilder(p_whereClause != null ? p_whereClause.trim() : ""); String infoWhereClause = infoWindow.getWhereClause(); if (infoWhereClause != null && infoWhereClause.indexOf("@") >= 0) { - infoWhereClause = Env.parseContext(Env.getCtx(), p_WindowNo, infoWhereClause, false, false); + infoWhereClause = Env.parseContext(Env.getCtx(), p_WindowNo, infoWhereClause, true, false); if (infoWhereClause.length() == 0) log.log(Level.SEVERE, "Cannot parse context= " + infoWindow.getWhereClause()); } @@ -471,6 +472,9 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL } int count = 0; for(WEditor editor : editors) { + if (!editor.isVisible()) + continue; + if (editor instanceof IWhereClauseEditor) { String whereClause = ((IWhereClauseEditor) editor).getWhereClause(); if (whereClause != null && whereClause.trim().length() > 0) { @@ -518,7 +522,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL if (mInfoColumn.getQueryFunction() != null && mInfoColumn.getQueryFunction().trim().length() > 0) { String function = mInfoColumn.getQueryFunction(); if (function.indexOf("@") >= 0) { - String s = Env.parseContext(infoContext, p_WindowNo, function, false, false); + String s = Env.parseContext(infoContext, p_WindowNo, function, true, false); if (s.length() == 0) { log.log(Level.SEVERE, "Failed to parse query function. " + function); } else { @@ -542,7 +546,11 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL if (count > 0 && !checkAND.isChecked()) { builder.append(" ) "); } - return builder.toString(); + String sql = builder.toString(); + if (sql.indexOf("@") >= 0) { + sql = Env.parseContext(infoContext, p_WindowNo, sql, true, true); + } + return sql; } private MInfoColumn findInfoColumn(GridField gridField) { @@ -561,7 +569,10 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL protected void setParameters(PreparedStatement pstmt, boolean forCount) throws SQLException { int parameterIndex = 0; - for(WEditor editor : editors) { + for(WEditor editor : editors) { + if (!editor.isVisible()) + continue; + if (editor.getGridField() != null && editor.getValue() != null && editor.getValue().toString().trim().length() > 0) { MInfoColumn mInfoColumn = findInfoColumn(editor.getGridField()); if (mInfoColumn == null || mInfoColumn.getSelectClause().equals("0")) { @@ -608,7 +619,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL } if (m_sqlOrder != null && m_sqlOrder.indexOf("@") >= 0) { - String sql = Env.parseContext(infoContext, p_WindowNo, m_sqlOrder, false, false); + String sql = Env.parseContext(infoContext, p_WindowNo, m_sqlOrder, true, false); if (sql == null || sql.length() == 0) { log.severe("Failed to parsed sql. sql=" + m_sqlOrder); } else { @@ -966,7 +977,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL if (infoWindow.getOtherClause() != null && infoWindow.getOtherClause().trim().length() > 0) { String otherClause = infoWindow.getOtherClause(); if (otherClause.indexOf("@") >= 0) { - String s = Env.parseContext(infoContext, p_WindowNo, otherClause, false, false); + String s = Env.parseContext(infoContext, p_WindowNo, otherClause, true, false); if (s.length() == 0) { log.severe("Failed to parse other clause. " + otherClause); } else { @@ -1008,8 +1019,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL public void valueChange(ValueChangeEvent evt) { if (evt != null && evt.getSource() instanceof WEditor) { - WEditor editor = (WEditor)evt.getSource(); - boolean asiChanged = false; + WEditor editor = (WEditor)evt.getSource(); if (evt.getNewValue() == null) { Env.setContext(infoContext, p_WindowNo, editor.getColumnName(), ""); Env.setContext(infoContext, p_WindowNo, Env.TAB_INFO, editor.getColumnName(), ""); @@ -1023,24 +1033,29 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL Env.setContext(infoContext, p_WindowNo, editor.getColumnName(), evt.getNewValue().toString()); Env.setContext(infoContext, p_WindowNo, Env.TAB_INFO, editor.getColumnName(), evt.getNewValue().toString()); } - // if attribute set changed (from any value to any value) clear the attribute set instance m_pAttributeWhere - if (editor instanceof WTableDirEditor && editor.getColumnName().equals("M_AttributeSet_ID")) - asiChanged = true; - - for(WEditor otherEditor : editors) - { - if (otherEditor == editor) - continue; - if (asiChanged && otherEditor instanceof WInfoPAttributeEditor) - ((WInfoPAttributeEditor)otherEditor).clearWhereClause(); - - otherEditor.dynamicDisplay(); - } - - evalDisplayLogic(); + dynamicDisplay(editor); } } + + protected void dynamicDisplay(WEditor editor) { + // if attribute set changed (from any value to any value) clear the attribute set instance m_pAttributeWhere + boolean asiChanged = false; + if (editor != null && editor instanceof WTableDirEditor && editor.getColumnName().equals("M_AttributeSet_ID")) + asiChanged = true; + + for(WEditor otherEditor : editors) + { + if (otherEditor == editor) + continue; + if (asiChanged && otherEditor instanceof WInfoPAttributeEditor) + ((WInfoPAttributeEditor)otherEditor).clearWhereClause(); + + otherEditor.dynamicDisplay(); + } + + evalDisplayLogic(); + } public void onEvent(Event event) { @@ -1076,6 +1091,15 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL * @return true if display */ protected boolean testCount() + { + return testCount(true); + } + + /** + * Test Row Count + * @return true if display + */ + private boolean testCount(boolean promptError) { long start = System.currentTimeMillis(); String dynWhere = getSQLWhere(); @@ -1122,6 +1146,16 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL if (log.isLoggable(Level.FINE)) log.fine("#" + m_count + " - " + (System.currentTimeMillis()-start) + "ms"); + + if (infoWindow.getMaxQueryRecords() > 0 && m_count > infoWindow.getMaxQueryRecords()) + { + if (promptError) + { + FDialog.error(getWindowNo(), this, "InfoFindOverMax", + m_count + " > " + infoWindow.getMaxQueryRecords()); + } + m_count = 0; + } return true; } // testCount diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ChangePasswordPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ChangePasswordPanel.java index 2a582fe788..f3ce537df4 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ChangePasswordPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ChangePasswordPanel.java @@ -45,6 +45,7 @@ import org.zkoss.zhtml.Td; import org.zkoss.zhtml.Tr; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; +import org.zkoss.zk.ui.util.Clients; import org.zkoss.zul.Image; /** @@ -274,6 +275,7 @@ public class ChangePasswordPanel extends Window implements EventListener public void validateChangePassword() { + Clients.clearBusy(); String oldPassword = txtOldPassword.getValue(); String newPassword = txtNewPassword.getValue(); String retypeNewPassword = txtRetypeNewPassword.getValue(); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/HelpController.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/HelpController.java index 71fbc785c3..7ab457a29c 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/HelpController.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/HelpController.java @@ -139,30 +139,73 @@ public class HelpController renderQuickInfo(null); } + /** + * Make tooltip content for a field + * @param field + */ public void renderToolTip(GridField field) - { - StringBuilder sb = new StringBuilder(); - sb.append("\n\n
\n"); + { + String hdr = null; + String desc = null; + String help = null; + String otherContent = null; if (field != null) { - String hdr = field.getHeader(); + hdr = field.getHeader(); if (hdr != null && hdr.length() > 0) - { - sb.append("" + hdr + ""); - + { if (field.getDescription().length() != 0) - sb.append("

\n" + field.getDescription() + ""); + desc = field.getDescription(); if (field.getHelp().length() != 0) - sb.append("

\n" + field.getHelp()); + help = field.getHelp(); } } else { - sb.append("(" + Msg.getMsg(Env.getCtx(), "PlaceCursorIntoField") + ")"); + otherContent = Msg.getMsg(Env.getCtx(), "PlaceCursorIntoField"); } + renderToolTip(hdr, desc, help, otherContent); + } + + /** + * Make tooltip content, when hdr == null, show otherContent + * @param hdr + * @param desc + * @param help + * @param otherContent + */ + public void renderToolTip(String hdr, String desc, String help, String otherContent) + { + StringBuilder sb = new StringBuilder(); + sb.append("\n\n
\n"); + + if (hdr == null || hdr.trim().length() == 0){ + if (otherContent != null){ + sb.append("("); + sb.append (otherContent); + sb.append (")"); + } + }else{ + sb.append(""); + sb.append(hdr); + sb.append(""); + + if (desc != null && desc.trim().length() > 0){ + sb.append("

\n"); + sb.append(desc); + sb.append(""); + } + + if (help != null && help.trim().length() > 0){ + sb.append("

\n"); + sb.append(help); + } + + } + sb.append("
\n\n"); htmlToolTip.setContent(sb.toString()); } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java index 50c422959e..7b273e0a23 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java @@ -337,7 +337,7 @@ public abstract class InfoPanel extends Window implements EventListener, // m_sqlOrder = ""; // m_sqlUserOrder = ""; - if (orderBy != null && orderBy.length() > 0) + if (orderBy != null && orderBy.trim().length() > 0) m_sqlOrder = " ORDER BY " + orderBy; } // prepareTable @@ -352,14 +352,17 @@ public abstract class InfoPanel extends Window implements EventListener, cacheEnd = -1; testCount(); - m_useDatabasePaging = (m_count > 1000); - if (m_useDatabasePaging) + if (m_count > 0) { - return ; - } - else - { - readLine(0, -1); + m_useDatabasePaging = (m_count > 1000); + if (m_useDatabasePaging) + { + return ; + } + else + { + readLine(0, -1); + } } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ResetPasswordPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ResetPasswordPanel.java index d7cfdc1c9b..20399406c6 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ResetPasswordPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ResetPasswordPanel.java @@ -53,6 +53,7 @@ import org.zkoss.zhtml.Td; import org.zkoss.zhtml.Tr; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; +import org.zkoss.zk.ui.util.Clients; import org.zkoss.zul.Image; /** @@ -314,10 +315,7 @@ public class ResetPasswordPanel extends Window implements EventListener { if (event.getTarget().getId().equals(ConfirmPanel.A_OK)) { - if (txtAnswer != null && txtAnswer.isReadonly()) - validateEmail(); - else - validateResetPassword(); + validate (); } else if (event.getTarget().getId().equals(ConfirmPanel.A_CANCEL)) { @@ -326,6 +324,15 @@ public class ResetPasswordPanel extends Window implements EventListener } } + public void validate (){ + Clients.clearBusy(); + + if (txtAnswer != null && txtAnswer.isReadonly()) + validateEmail(); + else + validateResetPassword(); + } + protected void validateEmail() { String email = txtEmail.getValue(); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WAttachment.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WAttachment.java index 8c5c29e092..1fdd418db6 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WAttachment.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WAttachment.java @@ -122,6 +122,7 @@ public class WAttachment extends Window implements EventListener autoPreviewList.add("image/gif"); autoPreviewList.add("text/plain"); autoPreviewList.add("application/pdf"); + autoPreviewList.add("text/html"); } /** diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FDialog.java index cf84a2cdd2..d58acdac2b 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FDialog.java @@ -330,7 +330,24 @@ public class FDialog return ask(AEnv.getDialogHeader(Env.getCtx(), windowNo), windowNo, comp, adMessage, callback); } - /************************************************************************** + public static void askForInput(int windowNo, Component comp, String adMessage, final Callback callback) + { + Callback msgCallback = null; + if (callback != null) + { + msgCallback = new Callback() { + @Override + public void onCallback(String result) { + callback.onCallback(result); + } + }; + } + String s = Msg.getMsg(Env.getCtx(), adMessage).replace("\n", "
"); + Messagebox.showDialog(s, AEnv.getDialogHeader(Env.getCtx(), windowNo), + Messagebox.OK | Messagebox.INPUT, Messagebox.QUESTION, msgCallback, (msgCallback == null)); + } + + /************************************************************************** * Ask Question with question icon and (OK) (Cancel) buttons * * @param WindowNo Number of Window diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java index 6508cb4b3e..d66c90b8c4 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java @@ -2004,8 +2004,8 @@ public class FindWindow extends Window implements EventListener, ValueCha if (null!=selectedHistoryItem && selectedHistoryItem.toString().length() > 0 && getHistoryDays(selectedHistoryValue) > 0) { - StringBuilder where = new StringBuilder(); - where.append("Created >= "); + StringBuilder where = new StringBuilder(m_tableName); + where.append(".Created >= "); where.append("SysDate-").append(getHistoryDays(selectedHistoryValue)); m_query.addRestriction(where.toString()); } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/LoginWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/LoginWindow.java index f0c8270586..dbd925db7b 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/LoginWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/LoginWindow.java @@ -153,14 +153,26 @@ public class LoginWindow extends FWindow implements EventListener if (rolePanel != null) { rolePanel.validateRoles(); + return; } - else + + LoginPanel loginPanel = (LoginPanel)this.getFellowIfAny("loginPanel"); + if (loginPanel != null) { - LoginPanel loginPanel = (LoginPanel)this.getFellowIfAny("loginPanel"); - if (loginPanel != null) - { - loginPanel.validateLogin(); - } + loginPanel.validateLogin(); + return; + } + + ChangePasswordPanel changePasswordPanel = (ChangePasswordPanel)this.getFellowIfAny("changePasswordPanel"); + if (changePasswordPanel != null){ + changePasswordPanel.validateChangePassword(); + return; + } + + ResetPasswordPanel resetPasswordPanel = (ResetPasswordPanel)this.getFellowIfAny("resetPasswordPanel"); + if (resetPasswordPanel != null){ + resetPasswordPanel.validate(); + return; } } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WAccountDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WAccountDialog.java index 96bf0d696d..9eaaa3bc2f 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WAccountDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WAccountDialog.java @@ -1037,7 +1037,7 @@ public final class WAccountDialog extends Window M_Product_ID, C_BPartner_ID, AD_OrgTrx_ID, C_LocFrom_ID, C_LocTo_ID, C_SRegion_ID, C_Project_ID, C_Campaign_ID, C_Activity_ID, - User1_ID, User2_ID, 0, 0); + User1_ID, User2_ID, 0, 0, null); if (acct != null && acct.get_ID() == 0) acct.saveEx(); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WEMailDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WEMailDialog.java index 70b0506e19..b78f0e1a32 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WEMailDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WEMailDialog.java @@ -45,8 +45,11 @@ import org.adempiere.webui.event.ValueChangeEvent; import org.adempiere.webui.event.ValueChangeListener; import org.adempiere.webui.theme.ThemeManager; import org.compiere.model.Lookup; +import org.compiere.model.MAttachment; +import org.compiere.model.MAttachmentEntry; import org.compiere.model.MClient; import org.compiere.model.MLookupFactory; +import org.compiere.model.MMailText; import org.compiere.model.MUser; import org.compiere.model.MUserMail; import org.compiere.util.ByteArrayDataSource; @@ -56,6 +59,7 @@ import org.compiere.util.EMail; import org.compiere.util.Env; import org.compiere.util.Msg; import org.compiere.util.Util; +import org.zkforge.ckez.CKeditor; import org.zkoss.util.media.Media; import org.zkoss.zk.ui.Page; import org.zkoss.zk.ui.event.Event; @@ -68,7 +72,6 @@ import org.zkoss.zul.Cell; import org.zkoss.zul.Center; import org.zkoss.zul.Div; import org.zkoss.zul.South; -import org.zkoss.zul.Space; /** * EMail Dialog @@ -108,10 +111,16 @@ public class WEMailDialog extends Window implements EventListener, ValueC this.setSclass("popup-dialog"); this.setClosable(true); this.setBorder("normal"); - this.setWidth("550px"); + this.setWidth("80%"); + this.setHeight("80%"); this.setShadow(true); this.setMaximizable(true); + this.setSizable(true); + fMessage = new CKeditor(); + fMessage.setCustomConfigurationsPath("/js/ckeditor/config.js"); + fMessage.setToolbar("MyToolbar"); + commonInit(from, to, subject, message, attachment); } // EmailDialog @@ -183,9 +192,9 @@ public class WEMailDialog extends Window implements EventListener, ValueC private Label lCc = new Label(); private Label lSubject = new Label(); private Label lAttachment = new Label(); - private Textbox fMessage = new Textbox(); + private CKeditor fMessage; private ConfirmPanel confirmPanel = new ConfirmPanel(true); - + private Button bAddDefaultMailText; private Div attachmentBox; @Override @@ -195,6 +204,10 @@ public class WEMailDialog extends Window implements EventListener, ValueC render(); } catch (Exception e) { } + + if (MUser.get(Env.getCtx()).isAddMailTextAutomatically()) { + addMailText(); + } } /** @@ -301,11 +314,9 @@ public class WEMailDialog extends Window implements EventListener, ValueC row = new Row(); rows.appendChild(row); - row.appendChild(new Space()); - row.appendChild(fMessage); - fMessage.setHflex("1"); - fMessage.setHeight("100%"); - fMessage.setRows(10); + row.appendCellChild(fMessage, 2); + fMessage.setHflex("2"); + fMessage.setHeight("350px"); confirmPanel.addActionListener(this); @@ -315,20 +326,25 @@ public class WEMailDialog extends Window implements EventListener, ValueC btn.addEventListener(Events.ON_UPLOAD, this); btn.setTooltiptext(Msg.getMsg(Env.getCtx(), "Attachment")); confirmPanel.addComponentsLeft(btn); + + bAddDefaultMailText = new Button(); + bAddDefaultMailText.setImage(ThemeManager.getThemeResource("images/DefaultMailText.png")); + bAddDefaultMailText.addEventListener(Events.ON_CLICK, this); + bAddDefaultMailText.setTooltiptext(Msg.getMsg(Env.getCtx(), "AddDefaultMailTextContent")); + if (new MUser(Env.getCtx(), Env.getAD_User_ID(Env.getCtx()), null).getR_DefaultMailText_ID() > 0) + confirmPanel.addComponentsLeft(bAddDefaultMailText); + confirmPanel.getButton(ConfirmPanel.A_OK).setWidgetListener("onClick", "zAu.cmd0.showBusy(null)"); Borderlayout borderlayout = new Borderlayout(); this.appendChild(borderlayout); borderlayout.setHflex("1"); - borderlayout.setVflex("min"); Center centerPane = new Center(); centerPane.setSclass("dialog-content"); centerPane.setAutoscroll(true); borderlayout.appendChild(centerPane); centerPane.appendChild(grid); - grid.setVflex("1"); - grid.setHflex("1"); South southPane = new South(); southPane.setSclass("dialog-footer"); @@ -432,7 +448,7 @@ public class WEMailDialog extends Window implements EventListener, ValueC public void setMessage(String newMessage) { m_message = newMessage; - fMessage.setText(m_message); + fMessage.setValue(m_message); // fMessage.setCaretPosition(0); } // setMessage @@ -441,7 +457,7 @@ public class WEMailDialog extends Window implements EventListener, ValueC */ public String getMessage() { - m_message = fMessage.getText(); + m_message = fMessage.getValue(); return m_message; } // getMessage @@ -481,7 +497,7 @@ public class WEMailDialog extends Window implements EventListener, ValueC StringTokenizer st = new StringTokenizer(getTo(), " ,;", false); String to = st.nextToken(); - EMail email = m_client.createEMail(getFrom(), to, getSubject(), getMessage()); + EMail email = m_client.createEMail(getFrom(), to, getSubject(), getMessage(), true); String status = "Check Setup"; if (email != null) { @@ -528,6 +544,8 @@ public class WEMailDialog extends Window implements EventListener, ValueC addAttachment(dataSource, true); } } + else if (event.getTarget() == bAddDefaultMailText) // Insert the mail text at cursor (light side) ? or at the end (dark side) :D + addMailText(); } /** @@ -652,4 +670,30 @@ public class WEMailDialog extends Window implements EventListener, ValueC fCc.setValue(email); } } -} // VEMailDialog \ No newline at end of file + + private void addMailText() + { + MMailText mt = (MMailText) MUser.get(Env.getCtx()).getR_DefaultMailText(); + if (mt.get_ID() > 0) { + mt.setPO(MUser.get(Env.getCtx())); + fMessage.setValue(getMessage() + "\n" + mt.getMailText(true)); + MAttachment attachment = MAttachment.get(Env.getCtx(), MMailText.Table_ID, mt.get_ID()); + if (attachment != null) { + MAttachmentEntry[] entries = attachment.getEntries(); + for (MAttachmentEntry entry : entries) { + boolean alreadyAdded = false; + for (DataSource attach : attachments) + if (attach.getName().equals(entry.getName())) + alreadyAdded = true; + if (alreadyAdded) + continue; + byte[] data = entry.getData(); + ByteArrayDataSource dataSource = new ByteArrayDataSource(data, entry.getContentType()); + dataSource.setName(entry.getName()); + addAttachment(dataSource, true); + } + } + } + } + +} // WEMailDialog \ No newline at end of file diff --git a/org.adempiere.ui.zk/theme/default/images/DefaultMailText.png b/org.adempiere.ui.zk/theme/default/images/DefaultMailText.png new file mode 100644 index 0000000000..5fcf5ba227 Binary files /dev/null and b/org.adempiere.ui.zk/theme/default/images/DefaultMailText.png differ diff --git a/org.adempiere.ui.zk/theme/default/zul/dashboard/runningJobs.zul b/org.adempiere.ui.zk/theme/default/zul/dashboard/runningJobs.zul new file mode 100644 index 0000000000..981e9fee23 --- /dev/null +++ b/org.adempiere.ui.zk/theme/default/zul/dashboard/runningJobs.zul @@ -0,0 +1,2 @@ + + diff --git a/org.adempiere.ui.zk/zul/runningJobs.zul b/org.adempiere.ui.zk/zul/runningJobs.zul new file mode 100644 index 0000000000..27906a7b1e --- /dev/null +++ b/org.adempiere.ui.zk/zul/runningJobs.zul @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file diff --git a/org.adempiere.ui/src/org/compiere/apps/form/Charge.java b/org.adempiere.ui/src/org/compiere/apps/form/Charge.java index ca37b6a854..f035cf204d 100644 --- a/org.adempiere.ui/src/org/compiere/apps/form/Charge.java +++ b/org.adempiere.ui/src/org/compiere/apps/form/Charge.java @@ -362,7 +362,8 @@ public class Charge defaultAccount.getUser1_ID(), defaultAccount.getUser2_ID(), defaultAccount.getUserElement1_ID(), - defaultAccount.getUserElement2_ID()); + defaultAccount.getUserElement2_ID(), + null); return account; } diff --git a/org.compiere.db.postgresql.provider/src/org/compiere/dbPort/Convert_PostgreSQL.java b/org.compiere.db.postgresql.provider/src/org/compiere/dbPort/Convert_PostgreSQL.java index fdd327f8dc..c85bb77d7f 100644 --- a/org.compiere.db.postgresql.provider/src/org/compiere/dbPort/Convert_PostgreSQL.java +++ b/org.compiere.db.postgresql.provider/src/org/compiere/dbPort/Convert_PostgreSQL.java @@ -1013,7 +1013,7 @@ public class Convert_PostgreSQL extends Convert_SQL92 { } else { rest = ""; } - if (defaultvalue.equalsIgnoreCase("NULL")) { + if (defaultvalue.equalsIgnoreCase("NULL") || defaultvalue.equalsIgnoreCase("statement_timestamp()")) { DDL = sqlStatement.substring(0, begin_col - action.length()) + " ADD COLUMN " diff --git a/org.compiere.db.postgresql.provider/src/org/compiere/dbPort/Convert_PostgreSQLTest.java b/org.compiere.db.postgresql.provider/src/org/compiere/dbPort/Convert_PostgreSQLTest.java index cd92da9147..c7ccd085de 100644 --- a/org.compiere.db.postgresql.provider/src/org/compiere/dbPort/Convert_PostgreSQLTest.java +++ b/org.compiere.db.postgresql.provider/src/org/compiere/dbPort/Convert_PostgreSQLTest.java @@ -140,6 +140,11 @@ public final class Convert_PostgreSQLTest extends TestCase{ sqe = "INSERT INTO t_alter_column values('pp_order_nodenext','PP_Order_NodeNext_ID',null,'NULL',null)"; r = convert.convert(sql); assertEquals(sqe, r[0].trim()); + + sql = "ALTER TABLE C_InvoiceTax ADD Created DATE DEFAULT SYSDATE NOT NULL"; + sqe = "ALTER TABLE C_InvoiceTax ADD COLUMN Created TIMESTAMP DEFAULT statement_timestamp() NOT NULL"; + r = convert.convert(sql); + assertEquals(sqe, r[0].trim()); } // Convert.recoverQuotedStrings() error on strings with "<-->" - teo_sarca [ 1705768 ] diff --git a/org.idempiere.hazelcast.service.config/bin/.hgignore b/org.idempiere.hazelcast.service.config/bin/.hgignore new file mode 100644 index 0000000000..e69de29bb2