Merge development (717d3f6bb6a2) into zk7 branch

This commit is contained in:
Carlos Ruiz 2014-06-03 17:58:27 -05:00
commit 49d477c2d5
121 changed files with 5998 additions and 1169 deletions

View File

@ -26,8 +26,10 @@ AS
FROM M_PRODUCT_BOM b, M_PRODUCT p FROM M_PRODUCT_BOM b, M_PRODUCT p
WHERE b.M_ProductBOM_ID=p.M_Product_ID WHERE b.M_ProductBOM_ID=p.M_Product_ID
AND b.M_Product_ID=Product_ID AND b.M_Product_ID=Product_ID
AND b.M_ProductBOM_ID != Product_ID
AND p.IsBOM='Y' AND p.IsBOM='Y'
AND p.IsVerified='Y'; AND p.IsVerified='Y'
AND b.IsActive='Y';
-- --
BEGIN BEGIN
-- Try to get price from PriceList directly -- Try to get price from PriceList directly

View File

@ -26,8 +26,10 @@ AS
FROM M_PRODUCT_BOM b, M_PRODUCT p FROM M_PRODUCT_BOM b, M_PRODUCT p
WHERE b.M_ProductBOM_ID=p.M_Product_ID WHERE b.M_ProductBOM_ID=p.M_Product_ID
AND b.M_Product_ID=Product_ID AND b.M_Product_ID=Product_ID
AND b.M_ProductBOM_ID != Product_ID
AND p.IsBOM='Y' AND p.IsBOM='Y'
AND p.IsVerified='Y'; AND p.IsVerified='Y'
AND b.IsActive='Y';
-- --
BEGIN BEGIN
-- Try to get price from pricelist directly -- Try to get price from pricelist directly

View File

@ -26,8 +26,10 @@ AS
FROM M_PRODUCT_BOM b, M_PRODUCT p FROM M_PRODUCT_BOM b, M_PRODUCT p
WHERE b.M_ProductBOM_ID=p.M_Product_ID WHERE b.M_ProductBOM_ID=p.M_Product_ID
AND b.M_Product_ID=Product_ID AND b.M_Product_ID=Product_ID
AND b.M_ProductBOM_ID != Product_ID
AND p.IsBOM='Y' AND p.IsBOM='Y'
AND p.IsVerified='Y'; AND p.IsVerified='Y'
AND b.IsActive='Y';
-- --
BEGIN BEGIN
-- Try to get price from pricelist directly -- Try to get price from pricelist directly

View File

@ -27,8 +27,10 @@ AS
FROM M_PRODUCT_BOM b, M_PRODUCT p FROM M_PRODUCT_BOM b, M_PRODUCT p
WHERE b.M_ProductBOM_ID=p.M_Product_ID WHERE b.M_ProductBOM_ID=p.M_Product_ID
AND b.M_Product_ID=Product_ID AND b.M_Product_ID=Product_ID
AND b.M_ProductBOM_ID != Product_ID
AND p.IsBOM='Y' AND p.IsBOM='Y'
AND p.IsVerified='Y'; AND p.IsVerified='Y'
AND b.IsActive='Y';
-- --
BEGIN BEGIN
-- Check Parameters -- Check Parameters

View File

@ -27,8 +27,10 @@ AS
FROM M_PRODUCT_BOM b, M_PRODUCT p FROM M_PRODUCT_BOM b, M_PRODUCT p
WHERE b.M_ProductBOM_ID=p.M_Product_ID WHERE b.M_ProductBOM_ID=p.M_Product_ID
AND b.M_Product_ID=p_Product_ID AND b.M_Product_ID=p_Product_ID
AND b.M_ProductBOM_ID != p_Product_ID
AND p.IsBOM='Y' AND p.IsBOM='Y'
AND p.IsVerified='Y'; AND p.IsVerified='Y'
AND b.IsActive='Y';
-- --
BEGIN BEGIN
-- Check Parameters -- Check Parameters
@ -65,12 +67,13 @@ BEGIN
-- Stocked item -- Stocked item
ELSIF (v_IsStocked='Y') THEN ELSIF (v_IsStocked='Y') THEN
-- Get ProductQty -- Get ProductQty
SELECT NVL(SUM(QtyOrdered), 0) SELECT NVL(SUM(Qty), 0)
INTO v_ProductQty INTO v_ProductQty
FROM M_STORAGE s FROM M_StorageReservation
WHERE M_Product_ID=p_Product_ID WHERE M_Product_ID=p_Product_ID
AND EXISTS (SELECT * FROM M_LOCATOR l WHERE s.M_Locator_ID=l.M_Locator_ID AND M_Warehouse_ID=v_Warehouse_ID
AND l.M_Warehouse_ID=v_Warehouse_ID); AND IsSOTrx='N'
AND IsActive='Y';
-- --
RETURN v_ProductQty; RETURN v_ProductQty;
END IF; END IF;
@ -81,12 +84,13 @@ BEGIN
-- Stocked Items "leaf node" -- Stocked Items "leaf node"
IF (bom.ProductType = 'I' AND bom.IsStocked = 'Y') THEN IF (bom.ProductType = 'I' AND bom.IsStocked = 'Y') THEN
-- Get ProductQty -- Get ProductQty
SELECT NVL(SUM(QtyOrdered), 0) SELECT NVL(SUM(Qty), 0)
INTO v_ProductQty INTO v_ProductQty
FROM M_STORAGE s FROM M_StorageReservation
WHERE M_Product_ID=bom.M_ProductBOM_ID WHERE M_Product_ID=p_Product_ID
AND EXISTS (SELECT * FROM M_LOCATOR l WHERE s.M_Locator_ID=l.M_Locator_ID AND M_Warehouse_ID=v_Warehouse_ID
AND l.M_Warehouse_ID=v_Warehouse_ID); AND IsSOTrx='N'
AND IsActive='Y';
-- Get Rounding Precision -- Get Rounding Precision
SELECT NVL(MAX(u.StdPrecision), 0) SELECT NVL(MAX(u.StdPrecision), 0)
INTO v_StdPrecision INTO v_StdPrecision

View File

@ -27,8 +27,10 @@ AS
FROM M_PRODUCT_BOM b, M_PRODUCT p FROM M_PRODUCT_BOM b, M_PRODUCT p
WHERE b.M_ProductBOM_ID=p.M_Product_ID WHERE b.M_ProductBOM_ID=p.M_Product_ID
AND b.M_Product_ID=p_Product_ID AND b.M_Product_ID=p_Product_ID
AND b.M_ProductBOM_ID != p_Product_ID
AND p.IsBOM='Y' AND p.IsBOM='Y'
AND p.IsVerified='Y'; AND p.IsVerified='Y'
AND b.IsActive='Y';
-- --
BEGIN BEGIN
-- Check Parameters -- Check Parameters
@ -65,12 +67,13 @@ BEGIN
-- Stocked item -- Stocked item
ELSIF (v_IsStocked='Y') THEN ELSIF (v_IsStocked='Y') THEN
-- Get ProductQty -- Get ProductQty
SELECT NVL(SUM(QtyReserved), 0) SELECT NVL(SUM(Qty), 0)
INTO v_ProductQty INTO v_ProductQty
FROM M_STORAGE s FROM M_StorageReservation
WHERE M_Product_ID=p_Product_ID WHERE M_Product_ID=p_Product_ID
AND EXISTS (SELECT * FROM M_LOCATOR l WHERE s.M_Locator_ID=l.M_Locator_ID AND M_Warehouse_ID=v_Warehouse_ID
AND l.M_Warehouse_ID=v_Warehouse_ID); AND IsSOTrx='Y'
AND IsActive='Y';
-- --
RETURN v_ProductQty; RETURN v_ProductQty;
END IF; END IF;
@ -81,12 +84,13 @@ BEGIN
-- Stocked Items "leaf node" -- Stocked Items "leaf node"
IF (bom.ProductType = 'I' AND bom.IsStocked = 'Y') THEN IF (bom.ProductType = 'I' AND bom.IsStocked = 'Y') THEN
-- Get ProductQty -- Get ProductQty
SELECT NVL(SUM(QtyReserved), 0) SELECT NVL(SUM(Qty), 0)
INTO v_ProductQty INTO v_ProductQty
FROM M_STORAGE s FROM M_StorageReservation
WHERE M_Product_ID=bom.M_ProductBOM_ID 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 M_Warehouse_ID=v_Warehouse_ID
AND l.M_Warehouse_ID=v_Warehouse_ID); AND IsSOTrx='Y'
AND IsActive='Y';
-- Get Rounding Precision -- Get Rounding Precision
SELECT NVL(MAX(u.StdPrecision), 0) SELECT NVL(MAX(u.StdPrecision), 0)
INTO v_StdPrecision INTO v_StdPrecision

View File

@ -19,8 +19,10 @@ BEGIN
FROM M_Product_BOM b, M_Product p FROM M_Product_BOM b, M_Product p
WHERE b.M_ProductBOM_ID=p.M_Product_ID WHERE b.M_ProductBOM_ID=p.M_Product_ID
AND b.M_Product_ID=Product_ID AND b.M_Product_ID=Product_ID
AND b.M_ProductBOM_ID != Product_ID
AND p.IsBOM='Y' AND p.IsBOM='Y'
AND p.IsVerified='Y' AND p.IsVerified='Y'
AND b.IsActive='Y'
LOOP LOOP
v_ProductPrice := bomPriceLimit (bom.M_ProductBOM_ID, PriceList_Version_ID); v_ProductPrice := bomPriceLimit (bom.M_ProductBOM_ID, PriceList_Version_ID);
v_Price := v_Price + (bom.BOMQty * v_ProductPrice); v_Price := v_Price + (bom.BOMQty * v_ProductPrice);
@ -32,6 +34,6 @@ BEGIN
END; END;
$BODY$ $BODY$
LANGUAGE 'plpgsql' LANGUAGE 'plpgsql' STABLE
; ;

View File

@ -19,8 +19,10 @@ BEGIN
FROM M_Product_BOM b, M_Product p FROM M_Product_BOM b, M_Product p
WHERE b.M_ProductBOM_ID=p.M_Product_ID WHERE b.M_ProductBOM_ID=p.M_Product_ID
AND b.M_Product_ID=Product_ID AND b.M_Product_ID=Product_ID
AND b.M_ProductBOM_ID != Product_ID
AND p.IsBOM='Y' AND p.IsBOM='Y'
AND p.IsVerified='Y' AND p.IsVerified='Y'
AND b.IsActive='Y'
LOOP LOOP
v_ProductPrice := bomPriceList (bom.M_ProductBOM_ID, PriceList_Version_ID); v_ProductPrice := bomPriceList (bom.M_ProductBOM_ID, PriceList_Version_ID);
v_Price := v_Price + (bom.BOMQty * v_ProductPrice); v_Price := v_Price + (bom.BOMQty * v_ProductPrice);
@ -32,6 +34,6 @@ BEGIN
END; END;
$BODY$ $BODY$
LANGUAGE 'plpgsql' LANGUAGE 'plpgsql' STABLE
; ;

View File

@ -19,8 +19,10 @@ BEGIN
FROM M_Product_BOM b, M_Product p FROM M_Product_BOM b, M_Product p
WHERE b.M_ProductBOM_ID=p.M_Product_ID WHERE b.M_ProductBOM_ID=p.M_Product_ID
AND b.M_Product_ID=Product_ID AND b.M_Product_ID=Product_ID
AND b.M_ProductBOM_ID != Product_ID
AND p.IsBOM='Y' AND p.IsBOM='Y'
AND p.IsVerified='Y' AND p.IsVerified='Y'
AND b.IsActive='Y'
LOOP LOOP
v_ProductPrice := bomPriceStd (bom.M_ProductBOM_ID, PriceList_Version_ID); v_ProductPrice := bomPriceStd (bom.M_ProductBOM_ID, PriceList_Version_ID);
v_Price := v_Price + (bom.BOMQty * v_ProductPrice); v_Price := v_Price + (bom.BOMQty * v_ProductPrice);
@ -32,6 +34,6 @@ BEGIN
END; END;
$BODY$ $BODY$
LANGUAGE 'plpgsql' LANGUAGE 'plpgsql' STABLE
; ;

View File

@ -4,6 +4,6 @@ BEGIN
RETURN bomQtyOnHand(Product_ID, Warehouse_ID, Locator_ID) - bomQtyReserved(Product_ID, Warehouse_ID, Locator_ID); RETURN bomQtyOnHand(Product_ID, Warehouse_ID, Locator_ID) - bomQtyReserved(Product_ID, Warehouse_ID, Locator_ID);
END; END;
$BODY$ $BODY$
LANGUAGE 'plpgsql' LANGUAGE 'plpgsql' STABLE
; ;

View File

@ -25,7 +25,6 @@ BEGIN
IF (myWarehouse_ID IS NULL) THEN IF (myWarehouse_ID IS NULL) THEN
RETURN 0; RETURN 0;
END IF; END IF;
-- DBMS_OUTPUT.PUT_LINE(''Warehouse='' || myWarehouse_ID);
-- Check, if product exists and if it is stocked -- Check, if product exists and if it is stocked
BEGIN BEGIN
@ -51,19 +50,19 @@ BEGIN
AND EXISTS (SELECT * FROM M_LOCATOR l WHERE s.M_Locator_ID=l.M_Locator_ID AND EXISTS (SELECT * FROM M_LOCATOR l WHERE s.M_Locator_ID=l.M_Locator_ID
AND l.M_Warehouse_ID=myWarehouse_ID); AND l.M_Warehouse_ID=myWarehouse_ID);
-- --
-- DBMS_OUTPUT.PUT_LINE(''Qty='' || v_ProductQty);
RETURN v_ProductQty; RETURN v_ProductQty;
END IF; END IF;
-- Go though BOM -- Go though BOM
-- DBMS_OUTPUT.PUT_LINE(''BOM'');
FOR bom IN -- Get BOM Product info FOR bom IN -- Get BOM Product info
SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM, p.IsStocked, p.ProductType SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM, p.IsStocked, p.ProductType
FROM M_PRODUCT_BOM b, M_PRODUCT p FROM M_PRODUCT_BOM b, M_PRODUCT p
WHERE b.M_ProductBOM_ID=p.M_Product_ID WHERE b.M_ProductBOM_ID=p.M_Product_ID
AND b.M_Product_ID=product_ID AND b.M_Product_ID=product_ID
AND b.M_ProductBOM_ID != Product_ID
AND p.IsBOM='Y' AND p.IsBOM='Y'
AND p.IsVerified='Y' AND p.IsVerified='Y'
AND b.IsActive='Y'
LOOP LOOP
-- Stocked Items "leaf node" -- Stocked Items "leaf node"
IF (bom.ProductType = 'I' AND bom.IsStocked = 'Y') THEN IF (bom.ProductType = 'I' AND bom.IsStocked = 'Y') THEN
@ -107,6 +106,6 @@ BEGIN
RETURN 0; RETURN 0;
END; END;
$BODY$ $BODY$
LANGUAGE 'plpgsql' LANGUAGE 'plpgsql' STABLE
; ;

View File

@ -24,7 +24,6 @@ BEGIN
IF (v_Warehouse_ID IS NULL) THEN IF (v_Warehouse_ID IS NULL) THEN
RETURN 0; RETURN 0;
END IF; END IF;
-- DBMS_OUTPUT.PUT_LINE(''Warehouse='' || v_Warehouse_ID);
-- Check, if product exists and if it is stocked -- Check, if product exists and if it is stocked
BEGIN BEGIN
@ -44,36 +43,39 @@ BEGIN
-- Stocked item -- Stocked item
ELSIF (v_IsStocked='Y') THEN ELSIF (v_IsStocked='Y') THEN
-- Get ProductQty -- Get ProductQty
SELECT COALESCE(SUM(QtyOrdered), 0) SELECT COALESCE(SUM(Qty), 0)
INTO v_ProductQty INTO v_ProductQty
FROM M_STORAGE s FROM M_StorageReservation
WHERE M_Product_ID=p_Product_ID WHERE M_Product_ID=p_Product_ID
AND EXISTS (SELECT * FROM M_LOCATOR l WHERE s.M_Locator_ID=l.M_Locator_ID AND M_Warehouse_ID=v_Warehouse_ID
AND l.M_Warehouse_ID=v_Warehouse_ID); AND IsSOTrx='N'
AND IsActive='Y';
-- --
RETURN v_ProductQty; RETURN v_ProductQty;
END IF; END IF;
-- Go though BOM -- Go though BOM
-- DBMS_OUTPUT.PUT_LINE(''BOM'');
FOR bom IN FOR bom IN
-- Get BOM Product info -- Get BOM Product info
SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM, p.IsStocked, p.ProductType SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM, p.IsStocked, p.ProductType
FROM M_PRODUCT_BOM b, M_PRODUCT p FROM M_PRODUCT_BOM b, M_PRODUCT p
WHERE b.M_ProductBOM_ID=p.M_Product_ID WHERE b.M_ProductBOM_ID=p.M_Product_ID
AND b.M_Product_ID=p_Product_ID AND b.M_Product_ID=p_Product_ID
AND b.M_ProductBOM_ID != p_Product_ID
AND p.IsBOM='Y' AND p.IsBOM='Y'
AND p.IsVerified='Y' AND p.IsVerified='Y'
AND b.IsActive='Y'
LOOP LOOP
-- Stocked Items "leaf node" -- Stocked Items "leaf node"
IF (bom.ProductType = 'I' AND bom.IsStocked = 'Y') THEN IF (bom.ProductType = 'I' AND bom.IsStocked = 'Y') THEN
-- Get ProductQty -- Get ProductQty
SELECT COALESCE(SUM(QtyOrdered), 0) SELECT COALESCE(SUM(Qty), 0)
INTO v_ProductQty INTO v_ProductQty
FROM M_STORAGE s FROM M_StorageReservation
WHERE M_Product_ID=bom.M_ProductBOM_ID WHERE M_Product_ID=p_Product_ID
AND EXISTS (SELECT * FROM M_LOCATOR l WHERE s.M_Locator_ID=l.M_Locator_ID AND M_Warehouse_ID=v_Warehouse_ID
AND l.M_Warehouse_ID=v_Warehouse_ID); AND IsSOTrx='N'
AND IsActive='Y';
-- Get Rounding Precision -- Get Rounding Precision
SELECT COALESCE(MAX(u.StdPrecision), 0) SELECT COALESCE(MAX(u.StdPrecision), 0)
INTO v_StdPrecision INTO v_StdPrecision
@ -114,6 +116,5 @@ BEGIN
RETURN 0; RETURN 0;
END; END;
$BODY$ $BODY$
LANGUAGE 'plpgsql' LANGUAGE plpgsql STABLE;
;

View File

@ -24,7 +24,6 @@ BEGIN
IF (v_Warehouse_ID IS NULL) THEN IF (v_Warehouse_ID IS NULL) THEN
RETURN 0; RETURN 0;
END IF; END IF;
-- DBMS_OUTPUT.PUT_LINE(''Warehouse='' || v_Warehouse_ID);
-- Check, if product exists and if it is stocked -- Check, if product exists and if it is stocked
BEGIN BEGIN
@ -44,36 +43,39 @@ BEGIN
-- Stocked item -- Stocked item
ELSIF (v_IsStocked='Y') THEN ELSIF (v_IsStocked='Y') THEN
-- Get ProductQty -- Get ProductQty
SELECT COALESCE(SUM(QtyReserved), 0) SELECT COALESCE(SUM(Qty), 0)
INTO v_ProductQty INTO v_ProductQty
FROM M_STORAGE s FROM M_StorageReservation
WHERE M_Product_ID=p_Product_ID WHERE M_Product_ID=p_Product_ID
AND EXISTS (SELECT * FROM M_LOCATOR l WHERE s.M_Locator_ID=l.M_Locator_ID AND M_Warehouse_ID=v_Warehouse_ID
AND l.M_Warehouse_ID=v_Warehouse_ID); AND IsSOTrx='Y'
AND IsActive='Y';
-- --
RETURN v_ProductQty; RETURN v_ProductQty;
END IF; END IF;
-- Go though BOM -- Go though BOM
-- DBMS_OUTPUT.PUT_LINE(''BOM'');
FOR bom IN FOR bom IN
-- Get BOM Product info -- Get BOM Product info
SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM, p.IsStocked, p.ProductType SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM, p.IsStocked, p.ProductType
FROM M_PRODUCT_BOM b, M_PRODUCT p FROM M_PRODUCT_BOM b, M_PRODUCT p
WHERE b.M_ProductBOM_ID=p.M_Product_ID WHERE b.M_ProductBOM_ID=p.M_Product_ID
AND b.M_Product_ID=p_Product_ID AND b.M_Product_ID=p_Product_ID
AND b.M_ProductBOM_ID != p_Product_ID
AND p.IsBOM='Y' AND p.IsBOM='Y'
AND p.IsVerified='Y' AND p.IsVerified='Y'
AND b.IsActive='Y'
LOOP LOOP
-- Stocked Items "leaf node" -- Stocked Items "leaf node"
IF (bom.ProductType = 'I' AND bom.IsStocked = 'Y') THEN IF (bom.ProductType = 'I' AND bom.IsStocked = 'Y') THEN
-- Get ProductQty -- Get ProductQty
SELECT COALESCE(SUM(QtyReserved), 0) SELECT COALESCE(SUM(Qty), 0)
INTO v_ProductQty INTO v_ProductQty
FROM M_STORAGE s FROM M_StorageReservation
WHERE M_Product_ID=bom.M_ProductBOM_ID 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 M_Warehouse_ID =v_Warehouse_ID
AND l.M_Warehouse_ID=v_Warehouse_ID); AND IsSOTrx='Y'
AND IsActive='Y';
-- Get Rounding Precision -- Get Rounding Precision
SELECT COALESCE(MAX(u.StdPrecision), 0) SELECT COALESCE(MAX(u.StdPrecision), 0)
INTO v_StdPrecision INTO v_StdPrecision
@ -112,6 +114,6 @@ BEGIN
RETURN 0; RETURN 0;
END; END;
$BODY$ $BODY$
LANGUAGE 'plpgsql' LANGUAGE plpgsql STABLE;
;

View File

@ -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
;

View File

@ -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
;

View File

@ -0,0 +1,4 @@
-- just for postgresql
SELECT register_migration_script('201405021009_IDEMPIERE-709.sql') FROM dual
;

View File

@ -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
;

View File

@ -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
;

View File

@ -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
;

View File

@ -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
;

View File

@ -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
;

View File

@ -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
;

View File

@ -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
;

View File

@ -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
;

View File

@ -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
;

View File

@ -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
;

View File

@ -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.<br>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
;

View File

@ -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
;

View File

@ -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
;

View File

@ -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
;

View File

@ -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.<br>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
;

View File

@ -48,7 +48,7 @@ public class Callout_AD_Column extends CalloutEngine
column.setIsIdentifier(false); column.setIsIdentifier(false);
column.setIsUpdateable(false); column.setIsUpdateable(false);
column.setIsAlwaysUpdateable(false); column.setIsAlwaysUpdateable(false);
column.setIsKey(true); column.setIsKey(false);
} else if (column.getAD_Table().getTableName().concat("_ID").equals(column.getColumnName())) { } else if (column.getAD_Table().getTableName().concat("_ID").equals(column.getColumnName())) {
// ID key column // ID key column
column.setAD_Reference_ID(DisplayType.ID); column.setAD_Reference_ID(DisplayType.ID);
@ -61,6 +61,7 @@ public class Callout_AD_Column extends CalloutEngine
column.setIsIdentifier(false); column.setIsIdentifier(false);
column.setIsUpdateable(false); column.setIsUpdateable(false);
column.setIsAlwaysUpdateable(false); column.setIsAlwaysUpdateable(false);
column.setIsKey(true);
} else { } else {
// get defaults from most used case // get defaults from most used case
String sql = "" String sql = ""

View File

@ -228,7 +228,8 @@ public class AcctSchemaCopyAcct extends SvrProcess
M_Product_ID, C_BPartner_ID, AD_OrgTrx_ID, M_Product_ID, C_BPartner_ID, AD_OrgTrx_ID,
C_LocFrom_ID, C_LocTo_ID, C_SalesRegion_ID, C_LocFrom_ID, C_LocTo_ID, C_SalesRegion_ID,
C_Project_ID, C_Campaign_ID, C_Activity_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 } // createAccount

View File

@ -786,7 +786,8 @@ public class ImportGLJournal extends SvrProcess
imp.getM_Product_ID(), imp.getC_BPartner_ID(), imp.getAD_OrgTrx_ID(), 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_LocFrom_ID(), imp.getC_LocTo_ID(), imp.getC_SalesRegion_ID(),
imp.getC_Project_ID(), imp.getC_Campaign_ID(), imp.getC_Activity_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) if (acct != null && acct.get_ID() == 0)
acct.saveEx(); acct.saveEx();
if (acct == null || acct.get_ID() == 0) if (acct == null || acct.get_ID() == 0)

View File

@ -333,7 +333,8 @@ public class InvoiceNGL extends SvrProcess
base.getM_Product_ID(), base.getC_BPartner_ID(), base.getAD_OrgTrx_ID(), 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_LocFrom_ID(), base.getC_LocTo_ID(), base.getC_SalesRegion_ID(),
base.getC_Project_ID(), base.getC_Campaign_ID(), base.getC_Activity_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.setDescription(Msg.getElement(getCtx(), "UnrealizedGain_Acct"));
line.setC_ValidCombination_ID(acct.getC_ValidCombination_ID()); line.setC_ValidCombination_ID(acct.getC_ValidCombination_ID());
line.setAmtSourceCr (drTotal); 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.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_LocFrom_ID(), base.getC_LocTo_ID(), base.getC_SalesRegion_ID(),
base.getC_Project_ID(), base.getC_Campaign_ID(), base.getC_Activity_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.setDescription(Msg.getElement(getCtx(), "UnrealizedLoss_Acct"));
line.setC_ValidCombination_ID(acct.getC_ValidCombination_ID()); line.setC_ValidCombination_ID(acct.getC_ValidCombination_ID());
line.setAmtSourceDr (crTotal); line.setAmtSourceDr (crTotal);

View File

@ -92,7 +92,9 @@ public class TabCreateFields extends SvrProcess
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
int seqno = DB.getSQLValue(null, "SELECT MAX(SeqNo) FROM AD_Field WHERE AD_Tab_ID=?", tab.getAD_Tab_ID()); 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; seqno = seqno + 10;
seqnogrid = seqnogrid + 10;
try try
{ {
pstmt = DB.prepareStatement (sql, get_TrxName()); pstmt = DB.prepareStatement (sql, get_TrxName());
@ -125,8 +127,6 @@ public class TabCreateFields extends SvrProcess
} }
// Assign some default formatting // Assign some default formatting
field.setSeqNo(seqno);
seqno = seqno + 10;
if (column.getAD_Reference_ID() == DisplayType.Button || column.getAD_Reference_ID() == DisplayType.YesNo) { if (column.getAD_Reference_ID() == DisplayType.Button || column.getAD_Reference_ID() == DisplayType.YesNo) {
field.setXPosition(2); field.setXPosition(2);
} }
@ -156,6 +156,15 @@ public class TabCreateFields extends SvrProcess
field.setIsDisplayedGrid(false); 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 //set display logic for accounting dimensions
if (column.getColumnName().equalsIgnoreCase("AD_OrgTrx_ID")){ if (column.getColumnName().equalsIgnoreCase("AD_OrgTrx_ID")){

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry exported="true" kind="lib" path="barcode4j-2.1.jar"/>
<classpathentry exported="true" kind="lib" path="vt-dictionary-3.0.jar"> <classpathentry exported="true" kind="lib" path="vt-dictionary-3.0.jar">
<attributes> <attributes>
<attribute name="javadoc_location" value="http://vt-middleware.googlecode.com/svn/vt-dictionary/javadoc/vt-dictionary-3.0"/> <attribute name="javadoc_location" value="http://vt-middleware.googlecode.com/svn/vt-dictionary/javadoc/vt-dictionary-3.0"/>

View File

@ -19,6 +19,7 @@ Bundle-ClassPath: base.jar,
vt-dictionary-3.0.jar, vt-dictionary-3.0.jar,
vt-password-3.1.1.jar, vt-password-3.1.1.jar,
super-csv-2.0.0-beta-1.jar, super-csv-2.0.0-beta-1.jar,
barcode4j-2.1.jar,
bctsp-jdk14-1.38.jar, bctsp-jdk14-1.38.jar,
bcmail-jdk14-1.38.jar, bcmail-jdk14-1.38.jar,
bcprov-jdk14-1.38.jar bcprov-jdk14-1.38.jar
@ -325,6 +326,27 @@ Export-Package: bsh,
org.jfree.ui.action, org.jfree.ui.action,
org.jfree.ui.tabbedui, org.jfree.ui.tabbedui,
org.jfree.util, 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,
org.supercsv.cellprocessor.constraint, org.supercsv.cellprocessor.constraint,
org.supercsv.cellprocessor.ift, org.supercsv.cellprocessor.ift,

View File

@ -34,6 +34,7 @@ bin.includes = META-INF/,\
OSGI-INF/defaulttaxproviderfactory.xml,\ OSGI-INF/defaulttaxproviderfactory.xml,\
OSGI-INF/addressvalidationeventhandler.xml,\ OSGI-INF/addressvalidationeventhandler.xml,\
schema/,\ schema/,\
barcode4j-2.1.jar,\
bctsp-jdk14-1.38.jar,\ bctsp-jdk14-1.38.jar,\
bcmail-jdk14-1.38.jar,\ bcmail-jdk14-1.38.jar,\
bcprov-jdk14-1.38.jar bcprov-jdk14-1.38.jar

View File

@ -78,6 +78,8 @@ public interface IProcessUI {
*/ */
public void ask(String message, Callback<Boolean> callback); public void ask(String message, Callback<Boolean> callback);
public void askForInput(String message, Callback<String> callback);
/** /**
* add to list of file available for download after process end * add to list of file available for download after process end
* @param file * @param file

View File

@ -22,6 +22,8 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Savepoint; import java.sql.Savepoint;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level; import java.util.logging.Level;
import org.adempiere.exceptions.AverageCostingZeroQtyException; import org.adempiere.exceptions.AverageCostingZeroQtyException;
@ -826,6 +828,8 @@ public class Doc_Invoice extends Doc
for (int i = 0; i < lcas.length; i++) for (int i = 0; i < lcas.length; i++)
totalBase += lcas[i].getBase().doubleValue(); totalBase += lcas[i].getBase().doubleValue();
Map<String, BigDecimal> costDetailAmtMap = new HashMap<String, BigDecimal>();
// Create New // Create New
MInvoiceLine il = new MInvoiceLine (getCtx(), C_InvoiceLine_ID, getTrxName()); MInvoiceLine il = new MInvoiceLine (getCtx(), C_InvoiceLine_ID, getTrxName());
for (int i = 0; i < lcas.length; i++) for (int i = 0; i < lcas.length; i++)
@ -869,16 +873,20 @@ public class Doc_Invoice extends Doc
BigDecimal qty = allocation.getQty(); BigDecimal qty = allocation.getQty();
if (qty.compareTo(iol.getMovementQty()) != 0) 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); estimatedAmt = estimatedAmt.add(amt);
} }
} }
} }
if (estimatedAmt.scale() > as.getCostingPrecision())
{
estimatedAmt = estimatedAmt.setScale(as.getCostingPrecision(), BigDecimal.ROUND_HALF_UP);
}
BigDecimal costAdjustmentAmt = allocationAmt; BigDecimal costAdjustmentAmt = allocationAmt;
if (estimatedAmt.signum() > 0) if (estimatedAmt.signum() > 0)
{ {
//get other allocation amt //get other allocation amt
StringBuilder sql = new StringBuilder("SELECT Sum(Amt) FROM C_LandedCostAllocation WHERE M_InOutLine_ID=? ") StringBuilder sql = new StringBuilder("SELECT Sum(Amt) FROM C_LandedCostAllocation WHERE M_InOutLine_ID=? ")
.append("AND C_LandedCostAllocation_ID<>? ") .append("AND C_LandedCostAllocation_ID<>? ")
@ -896,7 +904,7 @@ public class Doc_Invoice extends Doc
} }
} }
if (estimatedAmt.signum() > 0) if (estimatedAmt.signum() > 0)
{ {
if (allocationAmt.signum() > 0) if (allocationAmt.signum() > 0)
costAdjustmentAmt = allocationAmt.subtract(estimatedAmt); costAdjustmentAmt = allocationAmt.subtract(estimatedAmt);
else if (allocationAmt.signum() < 0) else if (allocationAmt.signum() < 0)
@ -907,43 +915,52 @@ public class Doc_Invoice extends Doc
if (!dr) if (!dr)
costAdjustmentAmt = costAdjustmentAmt.negate(); costAdjustmentAmt = costAdjustmentAmt.negate();
Trx trx = Trx.get(getTrxName(), false);
Savepoint savepoint = null;
boolean zeroQty = false; boolean zeroQty = false;
try { if (costAdjustmentAmt.signum() != 0)
savepoint = trx.setSavepoint(null); {
BigDecimal costDetailAmt = costAdjustmentAmt; Trx trx = Trx.get(getTrxName(), false);
//convert to accounting schema currency Savepoint savepoint = null;
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;
try { try {
trx.rollback(savepoint); savepoint = trx.setSavepoint(null);
savepoint = null; BigDecimal costDetailAmt = costAdjustmentAmt;
} catch (SQLException e1) { //convert to accounting schema currency
throw new RuntimeException(e1.getLocalizedMessage(), e1); if (getC_Currency_ID() != as.getC_Currency_ID())
} costDetailAmt = MConversionRate.convert(getCtx(), costDetailAmt,
} finally { getC_Currency_ID(), as.getC_Currency_ID(),
if (savepoint != null) { 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 { try {
trx.releaseSavepoint(savepoint); trx.rollback(savepoint);
} catch (SQLException e) {} 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.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); int compare = allocationAmt.compareTo(estimatedAmt);
if (compare > 0) if (compare > 0)
{ {
@ -977,6 +1002,25 @@ public class Doc_Invoice extends Doc
fl.setQty(line.getQty()); fl.setQty(line.getQty());
} }
else if (compare < 0) 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); drAmt = dr ? (reversal ? null : allocationAmt) : (reversal ? allocationAmt : null);
crAmt = dr ? (reversal ? allocationAmt : null) : (reversal ? null : allocationAmt); crAmt = dr ? (reversal ? allocationAmt : null) : (reversal ? null : allocationAmt);

View File

@ -508,7 +508,7 @@ public class Doc_MatchInv extends Doc
{ {
BigDecimal totalAmt = allocation.getAmt(); BigDecimal totalAmt = allocation.getAmt();
BigDecimal totalQty = allocation.getQty(); 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()) if (orderLine.getC_Currency_ID() != as.getC_Currency_ID())
{ {
I_C_Order order = orderLine.getC_Order(); I_C_Order order = orderLine.getC_Order();

View File

@ -198,7 +198,7 @@ public class Doc_MatchPO extends Doc
{ {
BigDecimal totalAmt = allocation.getAmt(); BigDecimal totalAmt = allocation.getAmt();
BigDecimal totalQty = allocation.getQty(); 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()) if (m_oLine.getC_Currency_ID() != as.getC_Currency_ID())
{ {
MOrder order = m_oLine.getParent(); MOrder order = m_oLine.getParent();
@ -213,11 +213,11 @@ public class Doc_MatchPO extends Doc
return null; return null;
} }
amt = amt.multiply(rate); 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); 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(); int elementId = allocation.getC_OrderLandedCost().getM_CostElement_ID();
BigDecimal elementAmt = landedCostMap.get(elementId); BigDecimal elementAmt = landedCostMap.get(elementId);
if (elementAmt == null) if (elementAmt == null)
@ -442,6 +442,8 @@ public class Doc_MatchPO extends Doc
return error; 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 // Set Total Amount and Total Quantity from Matched PO
if (!MCostDetail.createOrder(as, m_oLine.getAD_Org_ID(), if (!MCostDetail.createOrder(as, m_oLine.getAD_Org_ID(),
getM_Product_ID(), mMatchPO.getM_AttributeSetInstance_ID(), getM_Product_ID(), mMatchPO.getM_AttributeSetInstance_ID(),
@ -471,6 +473,8 @@ public class Doc_MatchPO extends Doc
{ {
BigDecimal amt = landedCostMap.get(elementId); BigDecimal amt = landedCostMap.get(elementId);
amt = amt.multiply(tQty); 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(), if (!MCostDetail.createOrder(as, m_oLine.getAD_Org_ID(),
getM_Product_ID(), mMatchPO.getM_AttributeSetInstance_ID(), getM_Product_ID(), mMatchPO.getM_AttributeSetInstance_ID(),
m_oLine.getC_OrderLine_ID(), elementId, m_oLine.getC_OrderLine_ID(), elementId,

View File

@ -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, 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, 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, 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) if (revenue != null && revenue.get_ID() == 0)
revenue.saveEx(); revenue.saveEx();
if (revenue == null || revenue.get_ID() == 0) if (revenue == null || revenue.get_ID() == 0)

View File

@ -81,7 +81,7 @@ public class GridField
/** /**
* *
*/ */
private static final long serialVersionUID = -9086333125844297957L; private static final long serialVersionUID = -2699974883136279635L;
/** /**
* Field Constructor. * Field Constructor.
@ -551,9 +551,11 @@ public class GridField
// No defaults for these fields // No defaults for these fields
if (m_vo.IsKey || m_vo.displayType == DisplayType.RowID 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; return null;
// Set Parent to context if not explitly set // Set Parent to context if not explicitly set
if (isParentValue() if (isParentValue()
&& (m_vo.DefaultValue == null || m_vo.DefaultValue.length() == 0)) && (m_vo.DefaultValue == null || m_vo.DefaultValue.length() == 0))
{ {
@ -1347,6 +1349,19 @@ public class GridField
{ {
return m_vo.IsKey; 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 * Parent Column
* @return parent column * @return parent column

View File

@ -31,6 +31,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Properties; import java.util.Properties;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import java.util.UUID;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.logging.Level; 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); if (log.isLoggable(Level.FINE)) log.fine("#" + m_vo.TabNo);
selection.clear(); selection.clear();
/** @todo does not work with alpha key */
int keyNo = m_mTable.getKeyID(m_currentRow); 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); m_mTable.dataRefreshAll(fireEvent, retainedCurrentRow ? m_currentRow : -1);
// Should use RowID - not working for tables with multiple keys if (keyNo != -1 || uuid != null)
if (keyNo != -1)
{ {
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(); int size = getRowCount();
for (int i = 0; i < size; i++) 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; m_currentRow = i;
break; break;

View File

@ -39,6 +39,7 @@ import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Properties; import java.util.Properties;
import java.util.UUID;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit; 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"; public static final String DATA_REFRESH_MESSAGE = "Refreshed";
@ -212,6 +213,8 @@ public class GridTable extends AbstractTableModel
/** Index of Key Column */ /** Index of Key Column */
private int m_indexKeyColumn = -1; private int m_indexKeyColumn = -1;
/** Index of UUID Column */
private int m_indexUUIDColumn = -1;
/** Index of Color Column */ /** Index of Color Column */
private int m_indexColorColumn = -1; private int m_indexColorColumn = -1;
/** Index of Processed Column */ /** Index of Processed Column */
@ -441,6 +444,8 @@ public class GridTable extends AbstractTableModel
// Set Index for Key column // Set Index for Key column
if (field.isKey()) if (field.isKey())
m_indexKeyColumn = m_fields.size(); m_indexKeyColumn = m_fields.size();
else if (field.isUUID())
m_indexUUIDColumn = m_fields.size();
// Set Index of other standard columns // Set Index of other standard columns
if (field.getColumnName().equals("IsActive")) if (field.getColumnName().equals("IsActive"))
m_indexActiveColumn = m_fields.size(); m_indexActiveColumn = m_fields.size();
@ -994,6 +999,30 @@ public class GridTable extends AbstractTableModel
return -1; return -1;
} // getKeyID } // 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 * Get Key ColumnName
* @return key column name * @return key column name

View File

@ -458,7 +458,7 @@ public class GridWindow implements Serializable
if (getHelp().length() != 0) if (getHelp().length() != 0)
center.addElement(new p().addElement(getHelp())); 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 // List of all Tabs in current window
int size = getTabCount(); int size = getTabCount();
p p = new p(); p p = new p();
@ -502,7 +502,7 @@ public class GridWindow implements Serializable
td.addElement(new p().addElement(tab.getHelp())); td.addElement(new p().addElement(tab.getHelp()));
// Links to Fields // Links to Fields
td.addElement(new a().setName("Fields"+i)); 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(); p = new p();
if (!tab.isLoadComplete()) if (!tab.isLoadComplete())
this.initTab(i); this.initTab(i);

View File

@ -273,6 +273,19 @@ public interface I_AD_InfoWindow
*/ */
public boolean isValid(); 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 */ /** Column name Name */
public static final String COLUMNNAME_Name = "Name"; public static final String COLUMNNAME_Name = "Name";

View File

@ -174,6 +174,28 @@ public interface I_AD_PInstance
*/ */
public String getName(); 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 */ /** Column name Record_ID */
public static final String COLUMNNAME_Record_ID = "Record_ID"; public static final String COLUMNNAME_Record_ID = "Record_ID";

View File

@ -402,6 +402,19 @@ public interface I_AD_User
*/ */
public boolean isActive(); 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 */ /** Column name IsExpired */
public static final String COLUMNNAME_IsExpired = "IsExpired"; public static final String COLUMNNAME_IsExpired = "IsExpired";
@ -646,6 +659,17 @@ public interface I_AD_User
/** Get Process Now */ /** Get Process Now */
public boolean isProcessing(); 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 */ /** Column name SalesRep_ID */
public static final String COLUMNNAME_SalesRep_ID = "SalesRep_ID"; public static final String COLUMNNAME_SalesRep_ID = "SalesRep_ID";

View File

@ -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 * Get existing Account or create it
* @param ctx context * @param ctx context
@ -64,6 +84,7 @@ public class MAccount extends X_C_ValidCombination
* @param User2_ID * @param User2_ID
* @param UserElement1_ID * @param UserElement1_ID
* @param UserElement2_ID * @param UserElement2_ID
* @param trxName
* @return account or null * @return account or null
*/ */
public static MAccount get (Properties ctx, 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 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_LocFrom_ID, int C_LocTo_ID, int C_SalesRegion_ID,
int C_Project_ID, int C_Campaign_ID, int C_Activity_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(); StringBuilder info = new StringBuilder();
info.append("AD_Client_ID=").append(AD_Client_ID).append(",AD_Org_ID=").append(AD_Org_ID); 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"); // 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) .setParameters(params)
.setOnlyActiveRecords(true) .setOnlyActiveRecords(true)
.firstOnly(); .firstOnly();
@ -202,7 +224,7 @@ public class MAccount extends X_C_ValidCombination
return existingAccount; return existingAccount;
// New // New
MAccount newAccount = new MAccount (ctx, 0, null); MAccount newAccount = new MAccount (ctx, 0, trxName);
newAccount.setClientOrg(AD_Client_ID, AD_Org_ID); newAccount.setClientOrg(AD_Client_ID, AD_Org_ID);
newAccount.setC_AcctSchema_ID(C_AcctSchema_ID); newAccount.setC_AcctSchema_ID(C_AcctSchema_ID);
newAccount.setAccount_ID(Account_ID); newAccount.setAccount_ID(Account_ID);
@ -821,6 +843,6 @@ public class MAccount extends X_C_ValidCombination
System.out.println(acct2); System.out.println(acct2);
} // main } // main
} // Account } // Account

View File

@ -554,6 +554,56 @@ public class MClient extends X_AD_Client
} }
} // sendEMail } // 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<File> 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<File> 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 * Send EMail from Request User - no trace
* @param to recipient email address * @param to recipient email address

View File

@ -751,7 +751,7 @@ public class MColumn extends X_AD_Column
setIsIdentifier(false); setIsIdentifier(false);
setIsUpdateable(false); setIsUpdateable(false);
setIsAlwaysUpdateable(false); setIsAlwaysUpdateable(false);
setIsKey(true); setIsKey(false);
} else if (getAD_Table().getTableName().concat("_ID").equals(getColumnName())) { } else if (getAD_Table().getTableName().concat("_ID").equals(getColumnName())) {
// ID key column // ID key column
setAD_Reference_ID(DisplayType.ID); setAD_Reference_ID(DisplayType.ID);
@ -764,6 +764,7 @@ public class MColumn extends X_AD_Column
setIsIdentifier(false); setIsIdentifier(false);
setIsUpdateable(false); setIsUpdateable(false);
setIsAlwaysUpdateable(false); setIsAlwaysUpdateable(false);
setIsKey(true);
} else { } else {
// get defaults from most used case // get defaults from most used case
String sql = "" String sql = ""

View File

@ -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 throw new AverageCostingNegativeQtyException("Product(ID)="+getM_Product_ID()+", Current Qty="+getCurrentQty()+", Trx Qty="+qty
+", CostElement="+getM_CostElement().getName()+", Schema="+getC_AcctSchema().getName()); +", 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); BigDecimal sumQty = getCurrentQty().add(qty);
if (sumQty.signum() != 0) 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); setCurrentCostPrice(cost);
} }
// //

View File

@ -143,7 +143,8 @@ public class MDistributionLine extends X_GL_DistributionLine
isOverwriteUser1() ? getUser1_ID() : m_account.getUser1_ID(), isOverwriteUser1() ? getUser1_ID() : m_account.getUser1_ID(),
isOverwriteUser2() ? getUser2_ID() : m_account.getUser2_ID(), isOverwriteUser2() ? getUser2_ID() : m_account.getUser2_ID(),
m_account.getUserElement1_ID(), m_account.getUserElement1_ID(),
m_account.getUserElement2_ID()); m_account.getUserElement2_ID(),
get_TrxName());
return acct; return acct;
} // setAccount } // setAccount

View File

@ -129,7 +129,8 @@ public class MFactAcct extends X_Fact_Acct
getM_Product_ID(), getC_BPartner_ID(), getAD_OrgTrx_ID(), getM_Product_ID(), getC_BPartner_ID(), getAD_OrgTrx_ID(),
getC_LocFrom_ID(), getC_LocTo_ID(), getC_SalesRegion_ID(), getC_LocFrom_ID(), getC_LocTo_ID(), getC_SalesRegion_ID(),
getC_Project_ID(), getC_Campaign_ID(), getC_Activity_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) if (acct != null && acct.get_ID() == 0)
acct.saveEx(); acct.saveEx();
return acct; return acct;

View File

@ -51,6 +51,7 @@ public class MField extends X_AD_Field
setEntityType (ENTITYTYPE_UserMaintained); // U setEntityType (ENTITYTYPE_UserMaintained); // U
setIsCentrallyMaintained (true); // Y setIsCentrallyMaintained (true); // Y
setIsDisplayed (true); // Y setIsDisplayed (true); // Y
setIsDisplayedGrid (true); // Y
setIsEncrypted (false); setIsEncrypted (false);
setIsFieldOnly (false); setIsFieldOnly (false);
setIsHeading (false); setIsHeading (false);

View File

@ -1075,7 +1075,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
{ {
double result = getLineNetAmt().multiply(base).doubleValue(); double result = getLineNetAmt().multiply(base).doubleValue();
result /= total.doubleValue(); result /= total.doubleValue();
lca.setAmt(result, getPrecision()); lca.setAmt(result, getParent().getC_Currency().getCostingPrecision());
} }
if (!lca.save()){ if (!lca.save()){
msgreturn = new StringBuilder("Cannot save line Allocation = ").append(lca); 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()); MLandedCostAllocation lca = new MLandedCostAllocation (this, lc.getM_CostElement_ID());
lca.setM_Product_ID(lc.getM_Product_ID()); // No ASI lca.setM_Product_ID(lc.getM_Product_ID()); // No ASI
lca.setAmt(getLineNetAmt()); 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()) if (lca.save())
return ""; return "";
msgreturn = new StringBuilder("Cannot save Product Allocation = ").append(lc); 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(); double result = getLineNetAmt().multiply(base).doubleValue();
result /= total.doubleValue(); result /= total.doubleValue();
lca.setAmt(result, getPrecision()); lca.setAmt(result, getParent().getC_Currency().getCostingPrecision());
} }
if (!lca.save()){ if (!lca.save()){
msgreturn = new StringBuilder("Cannot save line Allocation = ").append(lca); msgreturn = new StringBuilder("Cannot save line Allocation = ").append(lca);

View File

@ -760,15 +760,29 @@ public class MJournal extends X_GL_Journal implements DocAction
reverse.setReversal_ID(getGL_Journal_ID()); reverse.setReversal_ID(getGL_Journal_ID());
if (!reverse.save()) if (!reverse.save())
return null; 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("<-)"); msgd = new StringBuilder("(").append(reverse.getDocumentNo()).append("<-)");
addDescription(msgd.toString()); addDescription(msgd.toString());
// Lines
reverse.copyLinesFrom(this, null, 'C');
// //
setProcessed(true); setProcessed(true);
//FR [ 1948157 ] //FR [ 1948157 ]
setReversal_ID(reverse.getGL_Journal_ID()); setReversal_ID(reverse.getGL_Journal_ID());
setDocStatus(DOCSTATUS_Reversed);
setDocAction(DOCACTION_None); setDocAction(DOCACTION_None);
return reverse; return reverse;
} // reverseCorrectionIt } // reverseCorrectionIt
@ -814,19 +828,31 @@ public class MJournal extends X_GL_Journal implements DocAction
reverse.set_ValueNoCheck ("C_Period_ID", null); // reset reverse.set_ValueNoCheck ("C_Period_ID", null); // reset
reverse.setDateAcct(reverse.getDateDoc()); reverse.setDateAcct(reverse.getDateDoc());
// Reverse indicator // Reverse indicator
StringBuilder description; StringBuilder msgd = new StringBuilder("(->").append(getDocumentNo()).append(")");
if (reverse.getDescription() == null) reverse.addDescription(msgd.toString());
description = new StringBuilder("** ").append(getDocumentNo()).append(" **"); reverse.setReversal_ID(getGL_Journal_ID());
else
description = new StringBuilder(reverse.getDescription()).append(" ** ").append(getDocumentNo()).append(" **");
reverse.setDescription(description.toString());
if (!reverse.save()) if (!reverse.save())
return null; return null;
// Lines // Lines
reverse.copyLinesFrom(this, reverse.getDateAcct(), 'R'); 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); setProcessed(true);
setReversal_ID(reverse.getGL_Journal_ID());
setDocStatus(DOCSTATUS_Reversed);
setDocAction(DOCACTION_None); setDocAction(DOCACTION_None);
return reverse; return reverse;
} // reverseAccrualIt } // reverseAccrualIt

View File

@ -628,16 +628,11 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
reverse.setC_Period_ID(getC_Period_ID()); reverse.setC_Period_ID(getC_Period_ID());
reverse.setDateAcct(getDateAcct()); reverse.setDateAcct(getDateAcct());
// Reverse indicator // Reverse indicator
StringBuilder description; StringBuilder msgd = new StringBuilder("(->").append(getDocumentNo()).append(")");
if (reverse.getDescription() == null) reverse.addDescription(msgd.toString());
description = new StringBuilder("** ").append(getDocumentNo()).append(" **");
else
description = new StringBuilder(reverse.getDescription()).append(" ** ").append(getDocumentNo()).append(" **");
reverse.setDescription(description.toString());
//[ 1948157 ] //[ 1948157 ]
reverse.setReversal_ID(getGL_JournalBatch_ID()); reverse.setReversal_ID(getGL_JournalBatch_ID());
reverse.saveEx(); reverse.saveEx();
//
// Reverse Journals // Reverse Journals
for (int i = 0; i < journals.length; i++) for (int i = 0; i < journals.length; i++)
@ -652,9 +647,26 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
} }
journal.saveEx(); 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 ] //[ 1948157 ]
setReversal_ID(reverse.getGL_JournalBatch_ID()); setReversal_ID(reverse.getGL_JournalBatch_ID());
setDocStatus(DOCSTATUS_Reversed);
setDocAction(DOCACTION_None);
saveEx(); saveEx();
// After reverseCorrect // After reverseCorrect
m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_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.setDateDoc(new Timestamp(System.currentTimeMillis()));
reverse.setDateAcct(reverse.getDateDoc()); reverse.setDateAcct(reverse.getDateDoc());
// Reverse indicator // Reverse indicator
StringBuilder description; StringBuilder msgd = new StringBuilder("(->").append(getDocumentNo()).append(")");
if (reverse.getDescription() == null) reverse.addDescription(msgd.toString());
description = new StringBuilder("** ").append(getDocumentNo()).append(" **"); reverse.setReversal_ID(getGL_JournalBatch_ID());
else
description = new StringBuilder(reverse.getDescription()).append(" ** ").append(getDocumentNo()).append(" **");
reverse.setDescription(description.toString());
reverse.saveEx(); reverse.saveEx();
// Reverse Journals // Reverse Journals
@ -720,6 +729,26 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
} }
journal.saveEx(); 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 // After reverseAccrual
m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSEACCRUAL); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSEACCRUAL);
if (m_processMsg != null) if (m_processMsg != null)
@ -872,4 +901,14 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
return getTotalDr(); return getTotalDr();
} // getApprovalAmt } // 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 } // MJournalBatch

View File

@ -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(), 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_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_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) if (acct != null)
{ {

View File

@ -146,8 +146,8 @@ public class MOrderLandedCost extends X_C_OrderLandedCost {
if (base.signum() != 0) if (base.signum() != 0)
{ {
BigDecimal result = getAmt().multiply(base); BigDecimal result = getAmt().multiply(base);
result = result.divide(total, orderLine.getParent().getC_Currency().getStdPrecision(), BigDecimal.ROUND_HALF_UP); result = result.divide(total, orderLine.getParent().getC_Currency().getCostingPrecision(), BigDecimal.ROUND_HALF_UP);
allocation.setAmt(result.doubleValue(), orderLine.getParent().getC_Currency().getStdPrecision()); allocation.setAmt(result.doubleValue(), orderLine.getParent().getC_Currency().getCostingPrecision());
} }
allocation.saveEx(); allocation.saveEx();
} }

View File

@ -21,14 +21,21 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Properties; import java.util.Properties;
import java.util.logging.Level; 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.CLogger;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.idempiere.distributed.IMessageService;
import org.idempiere.distributed.ITopic;
import org.osgi.service.event.Event;
/** /**
* Process Instance Model * 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); private static CLogger s_log = CLogger.getCLogger (MPInstance.class);
@ -353,6 +362,23 @@ public class MPInstance extends X_AD_PInstance
return ip; return ip;
} }
public static void publishChangedEvent(int AD_User_ID) {
IMessageService service = Service.locator().locate(IMessageService.class).getService();
if (service != null) {
ITopic<Integer> 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<String, Integer> properties = new HashMap<String, Integer>();
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<MPInstance> get(Properties ctx, int AD_Process_ID, int AD_User_ID) { public static List<MPInstance> get(Properties ctx, int AD_Process_ID, int AD_User_ID) {
List<MPInstance> list = new ArrayList<MPInstance>(); List<MPInstance> list = new ArrayList<MPInstance>();
List<String> paramsStrAdded = new ArrayList<String>(); List<String> paramsStrAdded = new ArrayList<String>();

View File

@ -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 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 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 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_SHOWINFOACCOUNT = "DPViews_ShowInfoAccount";
public static final String DPVIEWS_SHOWINFOSCHEDULE = "DPViews_ShowInfoSchedule"; public static final String DPVIEWS_SHOWINFOSCHEDULE = "DPViews_ShowInfoSchedule";

View File

@ -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 */ /** Standard Constructor */
public X_AD_InfoWindow (Properties ctx, int AD_InfoWindow_ID, String trxName) 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 // Y
setIsValid (false); setIsValid (false);
// N // N
setMaxQueryRecords (0);
// 0
setName (null); setName (null);
} */ } */
} }
@ -385,6 +387,26 @@ public class X_AD_InfoWindow extends PO implements I_AD_InfoWindow, I_Persistent
return false; 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. /** Set Name.
@param Name @param Name
Alphanumeric identifier of the entity Alphanumeric identifier of the entity

View File

@ -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 */ /** Standard Constructor */
public X_AD_PInstance (Properties ctx, int AD_PInstance_ID, String trxName) 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_PInstance_ID (0);
setAD_Process_ID (0); setAD_Process_ID (0);
setIsProcessing (false); setIsProcessing (false);
setIsRunAsJob (false);
// N
setRecord_ID (0); 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); 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. /** Set Record ID.
@param Record_ID @param Record_ID
Direct internal record ID Direct internal record ID

View File

@ -398,6 +398,8 @@ public class X_AD_PrintFormatItem extends PO implements I_AD_PrintFormatItem, I_
public static final String BARCODETYPE_Code39LinearWOChecksum = "c39"; public static final String BARCODETYPE_Code39LinearWOChecksum = "c39";
/** EAN 13 = E13 */ /** EAN 13 = E13 */
public static final String BARCODETYPE_EAN13 = "E13"; public static final String BARCODETYPE_EAN13 = "E13";
/** UPCA = UPCA*/
public static final String BARCODETYPE_UPCA = "UPA";
/** Set Barcode Type. /** Set Barcode Type.
@param BarcodeType @param BarcodeType
Type of barcode Type of barcode

View File

@ -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 */ /** Standard Constructor */
public X_AD_User (Properties ctx, int AD_User_ID, String trxName) 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); setAD_User_ID (0);
setFailedLoginCount (0); setFailedLoginCount (0);
// 0 // 0
setIsAddMailTextAutomatically (false);
// N
setIsExpired (false); setIsExpired (false);
// N // N
setIsFullBPAccess (true); 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); 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. /** Set Expired.
@param IsExpired Expired */ @param IsExpired Expired */
public void setIsExpired (boolean IsExpired) public void setIsExpired (boolean IsExpired)
@ -1021,6 +1047,31 @@ public class X_AD_User extends PO implements I_AD_User, I_Persistent
return false; 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 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) return (org.compiere.model.I_AD_User)MTable.get(getCtx(), org.compiere.model.I_AD_User.Table_Name)

View File

@ -13,6 +13,7 @@ import org.compiere.process.ProcessInfoParameter;
import org.compiere.process.ServerProcessCtl; import org.compiere.process.ServerProcessCtl;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Trx;
@ -28,6 +29,19 @@ public class ServerReportCtl {
/** Static Logger */ /** Static Logger */
private static CLogger s_log = CLogger.getCLogger (ServerReportCtl.class); 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. * Start Document Print for Type with specified printer.
* @param type document type in ReportEngine * @param type document type in ReportEngine
@ -35,9 +49,10 @@ public class ServerReportCtl {
* @param parent The window which invoked the printing * @param parent The window which invoked the printing
* @param WindowNo The windows number which invoked the printing * @param WindowNo The windows number which invoked the printing
* @param printerName Specified printer name * @param printerName Specified printer name
* @param pi
* @return true if success * @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); ReportEngine re = ReportEngine.get (Env.getCtx(), type, Record_ID);
if (re == null) if (re == null)
@ -59,21 +74,27 @@ public class ServerReportCtl {
// ============================== // ==============================
if(format.getJasperProcess_ID() > 0) if(format.getJasperProcess_ID() > 0)
{ {
boolean result = runJasperProcess(Record_ID, re, true, printerName); boolean result = runJasperProcess(Record_ID, re, true, printerName, pi);
return(result); return(result);
} }
else else
// Standard Print Format (Non-Jasper) // 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); ReportEngine.printConfirm (type, Record_ID);
} }
} }
return true; return true;
} // StartDocumentPrint } // StartDocumentPrint
/** /**
* Runs a Jasper process that prints the record * Runs a Jasper process that prints the record
* *
@ -85,10 +106,29 @@ public class ServerReportCtl {
* @return * @return
*/ */
public static boolean runJasperProcess(int Record_ID, ReportEngine re, boolean IsDirectPrint, String printerName) { 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(); MPrintFormat format = re.getPrintFormat();
ProcessInfo pi = new ProcessInfo ("", format.getJasperProcess_ID()); ProcessInfo jasperProcessInfo = new ProcessInfo ("", format.getJasperProcess_ID());
pi.setPrintPreview( !IsDirectPrint ); if (pi != null) {
pi.setRecord_ID ( Record_ID ); jasperProcessInfo.setPrintPreview(pi.isPrintPreview());
jasperProcessInfo.setIsBatch(pi.isBatch());
} else {
jasperProcessInfo.setPrintPreview( !IsDirectPrint );
}
jasperProcessInfo.setRecord_ID ( Record_ID );
ArrayList<ProcessInfoParameter> jasperPrintParams = new ArrayList<ProcessInfoParameter>(); ArrayList<ProcessInfoParameter> jasperPrintParams = new ArrayList<ProcessInfoParameter>();
ProcessInfoParameter pip; ProcessInfoParameter pip;
if (printerName!=null && printerName.trim().length()>0) { 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); pip = new ProcessInfoParameter(PARAM_PRINT_INFO, re.getPrintInfo(), null, null, null);
jasperPrintParams.add(pip); 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); return(result);
} }
@ -139,21 +183,21 @@ public class ServerReportCtl {
* Order Print * Order Print
*/ */
if (pi.getAD_Process_ID() == 110) // C_Order 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 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 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 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 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 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 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 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 else if (pi.getAD_Process_ID() == 202 // Financial Report
|| pi.getAD_Process_ID() == 204) // Financial Statement || pi.getAD_Process_ID() == 204) // Financial Statement
return startFinReport (pi); return startFinReport (pi);
@ -203,7 +247,14 @@ public class ServerReportCtl {
MQuery query = MQuery.get (ctx, pi.getAD_PInstance_ID(), TableName); MQuery query = MQuery.get (ctx, pi.getAD_PInstance_ID(), TableName);
PrintInfo info = new PrintInfo(pi); PrintInfo info = new PrintInfo(pi);
re = new ReportEngine(ctx, format, query, info); 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; 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; return true;
} // startStandardReport } // startStandardReport
@ -247,7 +305,14 @@ public class ServerReportCtl {
PrintInfo info = new PrintInfo(pi); PrintInfo info = new PrintInfo(pi);
ReportEngine re = new ReportEngine(Env.getCtx(), format, query, info); 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; return true;
} // startFinReport } // startFinReport

View File

@ -24,11 +24,16 @@ import java.util.Properties;
import net.sourceforge.barbecue.Barcode; import net.sourceforge.barbecue.Barcode;
import net.sourceforge.barbecue.BarcodeFactory; import net.sourceforge.barbecue.BarcodeFactory;
import net.sourceforge.barbecue.BarcodeImageHandler;
import net.sourceforge.barbecue.linear.ean.UCCEAN128Barcode; import net.sourceforge.barbecue.linear.ean.UCCEAN128Barcode;
import net.sourceforge.barbecue.output.OutputException;
import org.compiere.print.MPrintFont; import org.compiere.print.MPrintFont;
import org.compiere.print.MPrintFormatItem; 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 * Barcode Print Element
@ -60,7 +65,7 @@ public class BarcodeElement extends PrintElement
m_valid = false; m_valid = false;
createBarcode(code, item); createBarcode(code, item);
if (m_barcode == null) if (m_barcode == null && m_upc == null)
m_valid = false; m_valid = false;
m_allowOverflow = item.isHeightOneLine(); // teo_sarca, [ 1673590 ] m_allowOverflow = item.isHeightOneLine(); // teo_sarca, [ 1673590 ]
} // BarcodeElement } // BarcodeElement
@ -73,6 +78,9 @@ public class BarcodeElement extends PrintElement
private boolean m_allowOverflow = true; private boolean m_allowOverflow = true;
private float m_scaleFactor = 1; private float m_scaleFactor = 1;
private UPCABean m_upc = null;
private String m_code;
/** /**
* Create Barcode * Create Barcode
* @param code barcode data string * @param code barcode data string
@ -131,7 +139,12 @@ public class BarcodeElement extends PrintElement
m_barcode = BarcodeFactory.createUCC128(UCCEAN128Barcode.EAN128_AI, code); m_barcode = BarcodeFactory.createUCC128(UCCEAN128Barcode.EAN128_AI, code);
else if (type.equals(MPrintFormatItem.BARCODETYPE_EAN13)) //@Trifon else if (type.equals(MPrintFormatItem.BARCODETYPE_EAN13)) //@Trifon
m_barcode = BarcodeFactory.createEAN13(code); //@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 // http://www.usps.com/cpim/ftp/pubs/pub97/97apxs_006.html#_Toc481397331
else if (type.equals(MPrintFormatItem.BARCODETYPE_USPostalServiceUCCEAN128)) else if (type.equals(MPrintFormatItem.BARCODETYPE_USPostalServiceUCCEAN128))
{ {
@ -145,7 +158,7 @@ public class BarcodeElement extends PrintElement
{ {
log.warning(code + " - " + e.toString()); log.warning(code + " - " + e.toString());
m_valid = false; m_valid = false;
} }
if (m_valid && m_barcode != null) if (m_valid && m_barcode != null)
{ {
@ -158,15 +171,6 @@ public class BarcodeElement extends PrintElement
} }
} // createBarcode } // createBarcode
/**
* Get Barcode
* @return Barcode
*/
public Barcode getBarcode()
{
return m_barcode;
} // getBarcode
/** /**
* Is Barcode Valid * Is Barcode Valid
* @return true if valid * @return true if valid
@ -185,11 +189,31 @@ public class BarcodeElement extends PrintElement
{ {
p_width = 0; p_width = 0;
p_height = 0; p_height = 0;
if (m_barcode == null) if (m_barcode == null && m_upc == null)
return true; return true;
p_width = m_barcode.getWidth(); if (m_barcode != null)
p_height = m_barcode.getHeight(); {
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) if (p_width * p_height == 0)
return true; // don't bother scaling and prevent div by 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, public void paint (Graphics2D g2D, int pageNo, Point2D pageStart,
Properties ctx, boolean isView) Properties ctx, boolean isView)
{ {
if (!m_valid || m_barcode == null) if (!m_valid || (m_barcode == null && m_upc == null ))
return; return;
// Position // Position
@ -243,15 +267,28 @@ public class BarcodeElement extends PrintElement
x += (p_maxWidth - p_width) / 2; x += (p_maxWidth - p_width) / 2;
int y = (int)location.y; int y = (int)location.y;
paint(g2D, x, y);
} // paint
public void paint(Graphics2D g2D, int x, int y) {
try { try {
int w = m_barcode.getWidth(); BufferedImage image = null;
int h = m_barcode.getHeight();
// draw barcode to buffer if (m_barcode != null)
BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB); {
Graphics2D temp = (Graphics2D) image.getGraphics(); // draw barcode to buffer
m_barcode.draw(temp, 0, 0); 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 // scale barcode and paint
AffineTransform transform = new AffineTransform(); AffineTransform transform = new AffineTransform();
@ -259,9 +296,10 @@ public class BarcodeElement extends PrintElement
transform.scale(m_scaleFactor, m_scaleFactor); transform.scale(m_scaleFactor, m_scaleFactor);
g2D.drawImage(image, transform, this); g2D.drawImage(image, transform, this);
} catch (OutputException e) { } catch (Exception e) {
} e.printStackTrace();
} // paint }
}
/** /**
* String Representation * String Representation

View File

@ -29,7 +29,6 @@ import java.awt.font.TextAttribute;
import java.awt.font.TextLayout; import java.awt.font.TextLayout;
import java.awt.geom.AffineTransform; import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D; import java.awt.geom.Point2D;
import java.awt.image.BufferedImage;
import java.io.Serializable; import java.io.Serializable;
import java.text.AttributedCharacterIterator; import java.text.AttributedCharacterIterator;
import java.text.AttributedString; import java.text.AttributedString;
@ -41,9 +40,6 @@ import java.util.Properties;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import net.sourceforge.barbecue.Barcode;
import net.sourceforge.barbecue.output.OutputException;
import org.compiere.model.MQuery; import org.compiere.model.MQuery;
import org.compiere.print.MPrintFormatItem; import org.compiere.print.MPrintFormatItem;
import org.compiere.print.MPrintTableFormat; import org.compiere.print.MPrintTableFormat;
@ -314,6 +310,15 @@ public class TableElement extends PrintElement
for (int row = 0; row < rows; row++) for (int row = 0; row < rows; row++)
{ {
m_data.setRowIndex(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) if (dataSizes.getRowCount() <= row)
{ {
dataSizes.addRow(new ArrayList<Dimension2DImpl>()); dataSizes.addRow(new ArrayList<Dimension2DImpl>());
@ -331,7 +336,9 @@ public class TableElement extends PrintElement
if (dataItem == null) if (dataItem == null)
{ {
//ensure fixed column width respected even when data is 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 = " "; dataItem = " ";
} }
@ -1219,8 +1226,8 @@ public class TableElement extends PrintElement
int startX = (int)pageStart.getX(); int startX = (int)pageStart.getX();
int startY = (int)pageStart.getY(); int startY = (int)pageStart.getY();
// Table Start // Table Start
startX += pageXindex == 0 ? m_firstPage.x : m_nextPages.x; startX += pageIndex == 0 ? m_firstPage.x : m_nextPages.x;
startY += pageYindex == 0 ? m_firstPage.y : m_nextPages.y; startY += pageIndex == 0 ? m_firstPage.y : m_nextPages.y;
if (DEBUG_PRINT) if (DEBUG_PRINT)
if (log.isLoggable(Level.FINEST)) log.finest("PageStart=" + pageStart + ", StartTable x=" + startX + ", y=" + startY); 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) else if (printItems[index] instanceof BarcodeElement)
{ {
try { BarcodeElement barcodeElement = (BarcodeElement)printItems[index];
Barcode barcode = ((BarcodeElement)printItems[index]).getBarcode(); barcodeElement.paint(g2D, curX, (int)penY);
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) {
}
} }
else if (printItems[index] instanceof Boolean) else if (printItems[index] instanceof Boolean)
{ {

View File

@ -61,31 +61,38 @@ public class ServerProcessCtl implements Runnable {
if (log.isLoggable(Level.FINE)) log.fine("ServerProcess - " + pi); if (log.isLoggable(Level.FINE)) log.fine("ServerProcess - " + pi);
MPInstance instance = null; MPInstance instance = null;
try if (pi.getAD_PInstance_ID() <= 0)
{
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")); try
pi.setError (true); {
return null; 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 // execute
ServerProcessCtl worker = new ServerProcessCtl(pi, trx); ServerProcessCtl worker = new ServerProcessCtl(pi, trx);

View File

@ -941,7 +941,7 @@ public final class EMail implements Serializable
(new ByteArrayDataSource (m_messageHTML, charSetName, "text/html"))); (new ByteArrayDataSource (m_messageHTML, charSetName, "text/html")));
// Create Multipart and its parts to it // Create Multipart and its parts to it
Multipart mp = new MimeMultipart(); Multipart mp = new MimeMultipart("related");
mp.addBodyPart(mbp_1); mp.addBodyPart(mbp_1);
if (log.isLoggable(Level.FINE)) log.fine("(multi) " + getSubject() + " - " + 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.setDataHandler(new DataHandler(ds));
mbp_2.setFileName(ds.getName()); mbp_2.setFileName(ds.getName());
if (log.isLoggable(Level.FINE)) log.fine("Added Attachment " + ds.getName() + " - " + mbp_2); 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); mp.addBodyPart(mbp_2);
} }

View File

@ -503,7 +503,8 @@ public class GLJournalGenerate extends SvrProcess
AD_OrgTrx_ID, C_LocFrom_ID, C_LocTo_ID, AD_OrgTrx_ID, C_LocFrom_ID, C_LocTo_ID,
C_SalesRegion_ID, C_Project_ID, C_Campaign_ID, C_SalesRegion_ID, C_Project_ID, C_Campaign_ID,
C_Activity_ID, User1_ID, User2_ID, UserElement1_ID, C_Activity_ID, User1_ID, User2_ID, UserElement1_ID,
UserElement2_ID); UserElement2_ID,
get_TrxName());
if (combination == null) if (combination == null)
throw new AdempiereException("Could not create combination"); throw new AdempiereException("Could not create combination");
} }

View File

@ -229,6 +229,8 @@ public class PackOut
.append("-") .append("-")
.append(client.getName()); .append(client.getName());
atts.addAttribute("", "", "Client", "CDATA", sb.toString()); 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()); atts.addAttribute("", "", "AD_Client_UU", "CDATA", client.getAD_Client_UU());
packoutHandler.startElement("","","idempiere",atts); packoutHandler.startElement("","","idempiere",atts);

View File

@ -2,7 +2,6 @@
<classpath> <classpath>
<classpathentry exported="true" kind="lib" path="lib/xalan-2.7.1.jar"/> <classpathentry exported="true" kind="lib" path="lib/xalan-2.7.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jackson-core-2.0.5.jar"/> <classpathentry exported="true" kind="lib" path="lib/jackson-core-2.0.5.jar"/>
<classpathentry exported="true" kind="lib" path="lib/barcode4j-2.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jasperreports-fonts-5.1.2.jar"/> <classpathentry exported="true" kind="lib" path="lib/jasperreports-fonts-5.1.2.jar"/>
<classpathentry exported="true" kind="lib" path="lib/commons-beanutils-1.8.0.jar"/> <classpathentry exported="true" kind="lib" path="lib/commons-beanutils-1.8.0.jar"/>
<classpathentry exported="true" kind="lib" path="lib/commons-digester-2.1.jar"/> <classpathentry exported="true" kind="lib" path="lib/commons-digester-2.1.jar"/>

View File

@ -7,7 +7,6 @@ Bundle-ClassPath: lib/commons-beanutils-1.8.0.jar,
lib/commons-digester-2.1.jar, lib/commons-digester-2.1.jar,
lib/jasperreports-5.1.2.jar, lib/jasperreports-5.1.2.jar,
lib/jasperreports-fonts-5.1.2.jar, lib/jasperreports-fonts-5.1.2.jar,
lib/barcode4j-2.1.jar,
lib/jackson-core-2.0.5.jar, lib/jackson-core-2.0.5.jar,
lib/xalan-2.7.1.jar lib/xalan-2.7.1.jar
Export-Package: ., Export-Package: .,
@ -222,27 +221,6 @@ Export-Package: .,
org.apache.xpath.operations, org.apache.xpath.operations,
org.apache.xpath.patterns, org.apache.xpath.patterns,
org.apache.xpath.res, 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 org.w3c.tools.codec
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: com.lowagie.text, 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.problem,
org.eclipse.jdt.internal.compiler.tool, org.eclipse.jdt.internal.compiler.tool,
org.eclipse.jdt.internal.compiler.util, 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;version="1.3.0",
org.w3c.css.sac.helpers;version="1.3.0", org.w3c.css.sac.helpers;version="1.3.0",
org.w3c.dom;version="3.0.0", org.w3c.dom;version="3.0.0",

View File

@ -3,6 +3,5 @@ bin.includes = META-INF/,\
lib/commons-digester-2.1.jar,\ lib/commons-digester-2.1.jar,\
lib/jasperreports-5.1.2.jar,\ lib/jasperreports-5.1.2.jar,\
lib/jasperreports-fonts-5.1.2.jar,\ lib/jasperreports-fonts-5.1.2.jar,\
lib/barcode4j-2.1.jar,\
lib/jackson-core-2.0.5.jar,\ lib/jackson-core-2.0.5.jar,\
lib/xalan-2.7.1.jar lib/xalan-2.7.1.jar

View File

@ -626,7 +626,7 @@ public class ReportStarter implements ProcessCall, ClientProcess
if (!processInfo.isExport()) if (!processInfo.isExport())
{ {
if (reportData.isDirectPrint()) if (reportData.isDirectPrint() || processInfo.isBatch())
{ {
if (log.isLoggable(Level.INFO)) log.info( "ReportStarter.startProcess print report -" + jasperPrint.getName()); if (log.isLoggable(Level.INFO)) log.info( "ReportStarter.startProcess print report -" + jasperPrint.getName());
//RF 1906632 //RF 1906632
@ -666,8 +666,6 @@ public class ReportStarter implements ProcessCall, ClientProcess
} }
else else
{ {
// You can use JasperPrint to create PDF
// Used For the PH
try try
{ {
File PDF = File.createTempFile(makePrefix(jasperPrint.getName()), ".pdf"); 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()); log.severe("ReportStarter.startProcess: Can not make PDF File - "+ e.getMessage());
} }
} }
// You can use JasperPrint to create PDF
// JasperExportManager.exportReportToPdfFile(jasperPrint, "BasicReport.pdf");
} else { } else {
if (log.isLoggable(Level.INFO)) log.info( "ReportStarter.startProcess run report -"+jasperPrint.getName()); if (log.isLoggable(Level.INFO)) log.info( "ReportStarter.startProcess run report -"+jasperPrint.getName());
JRViewerProvider viewerLauncher = Service.locator().locate(JRViewerProvider.class).getService(); JRViewerProvider viewerLauncher = Service.locator().locate(JRViewerProvider.class).getService();

View File

@ -22,7 +22,11 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Properties; import java.util.Properties;
import java.util.logging.Level; import java.util.logging.Level;
@ -39,7 +43,6 @@ import org.compiere.model.MScheduler;
import org.compiere.model.MSchedulerLog; import org.compiere.model.MSchedulerLog;
import org.compiere.model.MSchedulerPara; import org.compiere.model.MSchedulerPara;
import org.compiere.model.MUser; import org.compiere.model.MUser;
import org.compiere.print.ReportEngine;
import org.compiere.process.ProcessInfo; import org.compiere.process.ProcessInfo;
import org.compiere.process.ProcessInfoUtil; import org.compiere.process.ProcessInfoUtil;
import org.compiere.process.ServerProcessCtl; import org.compiere.process.ServerProcessCtl;
@ -157,7 +160,8 @@ public class Scheduler extends AdempiereServer
{ {
if (log.isLoggable(Level.INFO)) log.info(process.toString()); 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 // Process (see also MWFActivity.performWork
int AD_Table_ID = m_model.getAD_Table_ID(); 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_User_ID(getAD_User_ID());
pi.setAD_Client_ID(m_model.getAD_Client_ID()); pi.setAD_Client_ID(m_model.getAD_Client_ID());
pi.setAD_PInstance_ID(pInstance.getAD_PInstance_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); 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 // notify supervisor if error
int supervisor = m_model.getSupervisor_ID(); int supervisor = m_model.getSupervisor_ID();
@ -188,16 +195,23 @@ public class Scheduler extends AdempiereServer
if (email) if (email)
{ {
MClient client = MClient.get(m_model.getCtx(), m_model.getAD_Client_ID()); 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) { if (notice) {
int AD_Message_ID = 442; // HARDCODED ProcessRunError int AD_Message_ID = 442; // HARDCODED ProcessRunError
MNote note = new MNote(getCtx(), AD_Message_ID, supervisor, null); MNote note = new MNote(getCtx(), AD_Message_ID, supervisor, null);
note.setClientOrg(m_model.getAD_Client_ID(), m_model.getAD_Org_ID()); note.setClientOrg(m_model.getAD_Client_ID(), m_model.getAD_Org_ID());
note.setTextMsg(pi.getSummary()); note.setTextMsg(schedulerName+"\n"+pi.getSummary());
//note.setDescription();
note.setRecord(MPInstance.Table_ID, pi.getAD_PInstance_ID()); note.setRecord(MPInstance.Table_ID, pi.getAD_PInstance_ID());
note.saveEx(); 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) if (userIDs.length > 0)
{ {
ProcessInfoUtil.setLogFromDB(pi); ProcessInfoUtil.setLogFromDB(pi);
List<File> fileList = new ArrayList<File>();
if (isReport) {
fileList.add(pi.getPDFReport());
}
if (pi.isExport() && pi.getExportFile() != null)
{
fileList.add(pi.getExportFile());
}
for (int i = 0; i < userIDs.length; i++) for (int i = 0; i < userIDs.length; i++)
{ {
MUser user = new MUser(getCtx(), userIDs[i].intValue(), null); MUser user = new MUser(getCtx(), userIDs[i].intValue(), null);
boolean email = user.isNotificationEMail(); boolean email = user.isNotificationEMail();
boolean notice = user.isNotificationNote(); 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) { if (notice) {
int AD_Message_ID = 441; // ProcessOK int AD_Message_ID = 441; // ProcessOK
if (isReport) if (isReport)
@ -246,33 +243,46 @@ public class Scheduler extends AdempiereServer
MNote note = new MNote(getCtx(), AD_Message_ID, userIDs[i].intValue(), null); MNote note = new MNote(getCtx(), AD_Message_ID, userIDs[i].intValue(), null);
note.setClientOrg(m_model.getAD_Client_ID(), m_model.getAD_Org_ID()); note.setClientOrg(m_model.getAD_Client_ID(), m_model.getAD_Org_ID());
if (isReport) { if (isReport) {
note.setTextMsg(m_model.getName()); note.setTextMsg(schedulerName);
note.setDescription(m_model.getDescription()); note.setDescription(m_model.getDescription());
note.setRecord(AD_Table_ID, Record_ID); note.setRecord(AD_Table_ID, Record_ID);
} else { } else {
note.setTextMsg(pi.getSummary()); note.setTextMsg(schedulerName + "\n" + pi.getSummary());
// note.setDescription();
note.setRecord(MPInstance.Table_ID, pi.getAD_PInstance_ID()); note.setRecord(MPInstance.Table_ID, pi.getAD_PInstance_ID());
} }
if (note.save()) { if (note.save()) {
if (isReport) { MAttachment attachment = null;
if (fileList != null && !fileList.isEmpty()) {
// Attachment // 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.setClientOrg(m_model.getAD_Client_ID(), m_model.getAD_Org_ID());
attachment.addEntry(report); attachment.setTextMsg(schedulerName);
attachment.setTextMsg(m_model.getName()); 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(); attachment.saveEx();
} }
if (attachment != null)
attachment.saveEx();
} }
} }
if (email) if (email)
{ {
MClient client = MClient.get(m_model.getCtx(), m_model.getAD_Client_ID()); MClient client = MClient.get(m_model.getCtx(), m_model.getAD_Client_ID());
if (isReport) { if (fileList != null && !fileList.isEmpty()) {
client.sendEMail(from, user, m_model.getName(), m_model.getDescription(), report); client.sendEMailAttachments(from, user, schedulerName, m_model.getDescription(), fileList);
} else { } 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()) if (DisplayType.isNumeric(sPara.getDisplayType())
|| DisplayType.isID(sPara.getDisplayType())) || DisplayType.isID(sPara.getDisplayType()))
{ {
DecimalFormat decimalFormat = DisplayType.getNumberFormat(sPara.getDisplayType());
BigDecimal bd = toBigDecimal(value); BigDecimal bd = toBigDecimal(value);
iPara.setP_Number(bd); iPara.setP_Number(bd);
if (toValue != null) if (toValue != null)
{ {
bd = toBigDecimal(toValue); bd = toBigDecimal(toValue);
iPara.setP_Number_To(bd); 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() if (log.isLoggable(Level.FINE)) log.fine(sPara.getColumnName()
+ " = " + variable + " (=" + bd + "=)"); + " = " + variable + " (=" + bd + "=)");
} }
else if (DisplayType.isDate(sPara.getDisplayType())) else if (DisplayType.isDate(sPara.getDisplayType()))
{ {
SimpleDateFormat dateFormat = DisplayType.getDateFormat(sPara.getDisplayType());
Timestamp ts = toTimestamp(value); Timestamp ts = toTimestamp(value);
iPara.setP_Date(ts); iPara.setP_Date(ts);
if (toValue != null) { if (toValue != null) {
ts = toTimestamp(toValue); ts = toTimestamp(toValue);
iPara.setP_Date_To(ts); 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() if (log.isLoggable(Level.FINE)) log.fine(sPara.getColumnName()
+ " = " + variable + " (=" + ts + "=)"); + " = " + variable + " (=" + ts + "=)");
} }
@ -362,6 +390,15 @@ public class Scheduler extends AdempiereServer
{ {
iPara.setP_String_To(toValue.toString()); 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() if (log.isLoggable(Level.FINE)) log.fine(sPara.getColumnName()
+ " = " + variable + " = " + variable
+ " (=" + value + "=) " + value.getClass().getName()); + " (=" + value + "=) " + value.getClass().getName());
@ -453,6 +490,7 @@ public class Scheduler extends AdempiereServer
+ " - cannot evaluate=" + variable); + " - cannot evaluate=" + variable);
return null; return null;
} }
String tail=index < (columnName.length()-1) ? columnName.substring(index+1) : null;
columnName = columnName.substring(0, index); columnName = columnName.substring(0, index);
// try Env // try Env
String env = Env.getContext(m_schedulerctx, columnName); String env = Env.getContext(m_schedulerctx, columnName);
@ -467,6 +505,47 @@ public class Scheduler extends AdempiereServer
} }
else else
value = env; 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@ } // @variable@
return value; return value;
} }

View File

@ -323,6 +323,40 @@ public final class ADialog
return ask (WindowNo, c, AD_Message, null); return ask (WindowNo, c, AD_Message, null);
} // ask } // 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 * Display parsed development info Message string

View File

@ -41,6 +41,7 @@ import org.compiere.swing.CDialog;
import org.compiere.swing.CLabel; import org.compiere.swing.CLabel;
import org.compiere.swing.CMenuItem; import org.compiere.swing.CMenuItem;
import org.compiere.swing.CPanel; import org.compiere.swing.CPanel;
import org.compiere.swing.CTextField;
import org.compiere.swing.CTextPane; import org.compiere.swing.CTextPane;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.Env; import org.compiere.util.Env;
@ -60,6 +61,7 @@ public final class ADialogDialog extends CDialog implements ActionListener
*/ */
private static final long serialVersionUID = 5670261006862936363L; private static final long serialVersionUID = 5670261006862936363L;
public static final int INPUT_MESSAGE = 4;
/** /**
* Create Dialog Window for Frame * Create Dialog Window for Frame
* *
@ -100,7 +102,7 @@ public final class ADialogDialog extends CDialog implements ActionListener
try try
{ {
setInfoMessage (message); setInfoMessage (message);
jbInit(); jbInit(messageType);
setInfoIcon (messageType); setInfoIcon (messageType);
} }
catch(Exception ex) catch(Exception ex)
@ -150,6 +152,7 @@ public final class ADialogDialog extends CDialog implements ActionListener
private CLabel iconLabel = new CLabel(); private CLabel iconLabel = new CLabel();
private GridBagLayout westLayout = new GridBagLayout(); private GridBagLayout westLayout = new GridBagLayout();
private CTextPane info = new CTextPane (); private CTextPane info = new CTextPane ();
private CTextField input = new CTextField();
private GridBagLayout infoLayout = new GridBagLayout(); private GridBagLayout infoLayout = new GridBagLayout();
private CPanel infoPanel = new CPanel(); private CPanel infoPanel = new CPanel();
@ -157,7 +160,7 @@ public final class ADialogDialog extends CDialog implements ActionListener
* Static Constructor * Static Constructor
* @throws Exception * @throws Exception
*/ */
private void jbInit() throws Exception private void jbInit(int messageType) throws Exception
{ {
this.setJMenuBar(menuBar); this.setJMenuBar(menuBar);
// //
@ -193,6 +196,9 @@ public final class ADialogDialog extends CDialog implements ActionListener
this.getContentPane().add(infoPanel, BorderLayout.CENTER); this.getContentPane().add(infoPanel, BorderLayout.CENTER);
infoPanel.add(info, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0 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)); ,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); menuBar.add(mFile);
mFile.add(mPrintScreen); mFile.add(mPrintScreen);
@ -279,7 +285,10 @@ public final class ADialogDialog extends CDialog implements ActionListener
case JOptionPane.WARNING_MESSAGE: case JOptionPane.WARNING_MESSAGE:
iconLabel.setIcon(i_warn); iconLabel.setIcon(i_warn);
break; break;
case ADialogDialog.INPUT_MESSAGE:
confirmPanel.getCancelButton().setVisible(false);
iconLabel.setIcon(i_question);
break;
case JOptionPane.PLAIN_MESSAGE: case JOptionPane.PLAIN_MESSAGE:
default: default:
break; break;
@ -340,4 +349,12 @@ public final class ADialogDialog extends CDialog implements ActionListener
PrintScreenPainter.printScreen(this); PrintScreenPainter.printScreen(this);
} // printScreen } // printScreen
/**
* Get entered message if dialog is a askForInput-Dialog
* @return
*/
public String getReturnMsg() {
return input.getText();
}
} // ADialogDialog } // ADialogDialog

View File

@ -3147,4 +3147,11 @@ public final class APanel extends CPanel
public void download(File file) { public void download(File file) {
} }
@Override
public void askForInput(String message, Callback<String> callback) {
String s = ADialog.askForInput(m_curWindowNo, this, message);
if(callback != null)
callback.onCallback(s);
}
} // APanel } // APanel

View File

@ -677,4 +677,11 @@ public class ProcessDialog extends CFrame
} }
@Override
public void askForInput(String message, Callback<String> callback) {
String s = ADialog.askForInput(m_WindowNo, this, message);
if(callback != null)
callback.onCallback(s);
}
} // ProcessDialog } // ProcessDialog

View File

@ -401,4 +401,11 @@ public class VGenPanel extends CPanel implements ActionListener, ChangeListener,
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
@Override
public void askForInput(String message, Callback<String> callback) {
String s = ADialog.askForInput(m_WindowNo, this, message);
if(callback != null)
callback.onCallback(s);
}
} }

View File

@ -460,4 +460,11 @@ public class VPaySelect extends PaySelect implements FormPanel, ActionListener,
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
@Override
public void askForInput(String message, Callback<String> callback) {
String s = ADialog.askForInput(m_WindowNo, null, message);
if(callback != null)
callback.onCallback(s);
}
} // VPaySelect } // VPaySelect

View File

@ -1044,7 +1044,7 @@ public final class VAccountDialog extends CDialog
M_Product_ID, C_BPartner_ID, AD_OrgTrx_ID, M_Product_ID, C_BPartner_ID, AD_OrgTrx_ID,
C_LocFrom_ID, C_LocTo_ID, C_SRegion_ID, C_LocFrom_ID, C_LocTo_ID, C_SRegion_ID,
C_Project_ID, C_Campaign_ID, C_Activity_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) if (acct != null && acct.get_ID() == 0)
acct.saveEx(); acct.saveEx();

View File

@ -923,4 +923,11 @@ public class VInOutInvoiceGen extends CPanel
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
@Override
public void askForInput(String message, Callback<String> callback) {
String s = ADialog.askForInput(m_WindowNo, this, message);
if(callback != null)
callback.onCallback(s);
}
} // VInOutGen } // VInOutGen

View File

@ -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<Event>
{
/**
*
*/
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<File> 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("<b>");
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("</b>");
s = rs.getString(3); // Help
if (!rs.wasNull())
m_messageText.append("<p>").append(s).append("</p>");
}
}
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<File>();
//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<Event>()
{
@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<Boolean> callback) {
Executions.schedule(getDesktop(), new EventListener<Event>() {
@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<File> 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<String> callback) {
Executions.schedule(getDesktop(), new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
FDialog.askForInput(m_WindowNo, null, message, callback);
}
}, new Event("onAskForInput"));
}
}

View File

@ -166,7 +166,7 @@ public class HelpWindow extends Window {
td.setClass("help-window-tabs"); td.setClass("help-window-tabs");
tr.addElement(td); tr.addElement(td);
td.addElement(new a().setName(winpref+"Tabs")); td.addElement(new a().setName(winpref+"Tabs"));
h4 h4 = new h4("Tabs"); h4 h4 = new h4(Msg.getMsg(Env.getCtx(), "Tabs"));
td.addElement(h4); td.addElement(h4);
tr = new tr(); tr = new tr();
@ -336,7 +336,7 @@ public class HelpWindow extends Window {
td td = new td(); td td = new td();
tr.addElement(td); tr.addElement(td);
td.addElement(new a().setName(winpref+"Fields"+tabIndex)); 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); td.addElement(h4);
tr = new tr(); tr = new tr();

View File

@ -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 * * Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 2007 Low Heng Sin * * 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., * * with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * * 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. * Dialog to Start process or report.
@ -113,21 +97,30 @@ import com.lowagie.text.pdf.PdfWriter;
* @author arboleda - globalqss * @author arboleda - globalqss
* - Implement ShowHelp option on processes and reports * - Implement ShowHelp option on processes and reports
*/ */
public class ProcessDialog extends Window implements EventListener<Event>, IProcessUI, IHelpContext public class ProcessDialog extends AbstractProcessDialog implements EventListener<Event>, 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;"; 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 Div messageDiv;
private Center center; private Center center;
private Table logMessageTable; private Table logMessageTable;
private North north; private North north;
private List<File> downloadFiles;
private int[] m_ids = null;
private Button bOK = null;
private boolean isParameterPage = true;
private Mask mask;
private boolean showLastRun = false; private boolean showLastRun = false;
private Grid southRowPanel = GridFactory.newGridLayout(); private Grid southRowPanel = GridFactory.newGridLayout();
@ -147,20 +140,19 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
public ProcessDialog (int AD_Process_ID, boolean isSOTrx) public ProcessDialog (int AD_Process_ID, boolean isSOTrx)
{ {
log.info("Process=" + AD_Process_ID ); log.info("Process=" + AD_Process_ID );
m_ctx = Env.getCtx(); int WindowNo = SessionManager.getAppDesktop().registerWindow(this);
m_WindowNo = SessionManager.getAppDesktop().registerWindow(this); this.setAttribute(IDesktop.WINDOWNO_ATTRIBUTE, WindowNo);
this.setAttribute(IDesktop.WINDOWNO_ATTRIBUTE, m_WindowNo); Env.setContext(Env.getCtx(), WindowNo, "IsSOTrx", isSOTrx ? "Y" : "N");
m_AD_Process_ID = AD_Process_ID;
Env.setContext(Env.getCtx(), m_WindowNo, "IsSOTrx", isSOTrx ? "Y" : "N");
try 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; int count = process.getParameters().length;
if (count > 0) if (count > 0)
showLastRun = true; showLastRun = true;
initComponents(); initComponents();
init(); init(Env.getCtx(), WindowNo, AD_Process_ID, null, "70%", false, false);
querySaved();
addEventListener(WindowContainer.ON_WINDOW_CONTAINER_SELECTION_CHANGED_EVENT, this); addEventListener(WindowContainer.ON_WINDOW_CONTAINER_SELECTION_CHANGED_EVENT, this);
} }
catch(Exception ex) catch(Exception ex)
@ -169,13 +161,26 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
} }
} // ProcessDialog } // 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() { private void initComponents() {
this.setStyle("position: absolute; width: 100%; height: 100%"); this.setStyle("position: absolute; width: 100%; height: 100%");
Borderlayout layout = new Borderlayout(); Borderlayout layout = new Borderlayout();
layout.setStyle("position: absolute; width: 100%; height: 100%; border: none;"); layout.setStyle("position: absolute; width: 100%; height: 100%; border: none;");
messageDiv = new Div(); messageDiv = new Div();
message = new Html(); messageDiv.appendChild(getMessage());
messageDiv.appendChild(message);
messageDiv.setStyle(MESSAGE_DIV_STYLE); messageDiv.setStyle(MESSAGE_DIV_STYLE);
messageDiv.setId("message"); messageDiv.setId("message");
@ -185,12 +190,11 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
north.setAutoscroll(true); north.setAutoscroll(true);
north.setStyle("border: none;"); north.setStyle("border: none;");
centerPanel = new Panel();
center = new Center(); center = new Center();
layout.appendChild(center); layout.appendChild(center);
center.appendChild(centerPanel); center.appendChild(getCenterPanel());
centerPanel.setHflex("1"); getCenterPanel().setHflex("1");
centerPanel.setVflex("1"); getCenterPanel().setVflex("1");
center.setAutoscroll(true); center.setAutoscroll(true);
center.setStyle("border: none"); center.setStyle("border: none");
@ -199,6 +203,7 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
Hbox hBox = new Hbox(); Hbox hBox = new Hbox();
lSaved = new Label(Msg.getMsg(Env.getCtx(), "SavedParameter"));
hBox.appendChild(lSaved); hBox.appendChild(lSaved);
fSavedName.addEventListener(Events.ON_CHANGE, this); fSavedName.addEventListener(Events.ON_CHANGE, this);
hBox.appendChild(fSavedName); hBox.appendChild(fSavedName);
@ -218,8 +223,6 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
Panel confParaPanel =new Panel(); Panel confParaPanel =new Panel();
confParaPanel.setAlign("right"); confParaPanel.setAlign("right");
@SuppressWarnings("unused")
String label = Msg.getMsg(Env.getCtx(), "Start");
// Invert - Unify OK/Cancel IDEMPIERE-77 // Invert - Unify OK/Cancel IDEMPIERE-77
bOK = ButtonFactory.createNamedButton(ConfirmPanel.A_OK, true, true); bOK = ButtonFactory.createNamedButton(ConfirmPanel.A_OK, true, true);
bOK.setId("Ok"); bOK.setId("Ok");
@ -239,45 +242,14 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
this.appendChild(layout); 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 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 //saved parameters
private Combobox fSavedName=new Combobox(); private Combobox fSavedName=new Combobox();
private Button bSave=ButtonFactory.createNamedButton("Save"); private Button bSave=ButtonFactory.createNamedButton("Save");
private Button bDelete=ButtonFactory.createNamedButton("Delete"); private Button bDelete=ButtonFactory.createNamedButton("Delete");
private List<MPInstance> savedParams; private List<MPInstance> savedParams;
private Label lSaved=new Label(Msg.getMsg(Env.getCtx(), "SavedParameter")); private Label lSaved;
/** /**
* Set Visible * Set Visible
@ -294,153 +266,9 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
*/ */
public void dispose() public void dispose()
{ {
SessionManager.getAppDesktop().closeWindow(m_WindowNo); super.dispose();
valid = false; SessionManager.getAppDesktop().closeWindow(getWindowNo());
}// dispose }// 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("<b>");
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("</b>");
s = rs.getString(3); // Help
if (!rs.wasNull())
m_messageText.append("<p>").append(s).append("</p>");
}
}
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<File>();
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) { public void onEvent(Event event) {
Component component = event.getTarget(); Component component = event.getTarget();
@ -457,15 +285,13 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
} else if (component instanceof Button) { } else if (component instanceof Button) {
Button element = (Button)component; Button element = (Button)component;
if ("Ok".equalsIgnoreCase(element.getId())) { if ("Ok".equalsIgnoreCase(element.getId())) {
if (isParameterPage) { if (isParameterPage)
if (!parameterPanel.validateParameters()) startProcess();
return;
this.startProcess();
}
else else
restart(); restart();
} else if ("Cancel".equalsIgnoreCase(element.getId())) { } else if ("Cancel".equalsIgnoreCase(element.getId())) {
this.dispose(); cancelProcess();
} else if (event.getTarget().equals(bSave) && fSavedName != null } else if (event.getTarget().equals(bSave) && fSavedName != null
&& !lastRun) { && !lastRun) {
@ -473,13 +299,13 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
if (fSavedName.getSelectedIndex() > -1 && savedParams != null) { if (fSavedName.getSelectedIndex() > -1 && savedParams != null) {
for (int i = 0; i < savedParams.size(); i++) { for (int i = 0; i < savedParams.size(); i++) {
if (savedParams.get(i).getName().equals(saveName)) { 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()); .getAD_PInstance_ID());
for (MPInstancePara para : savedParams.get(i) for (MPInstancePara para : savedParams.get(i)
.getParameters()) { .getParameters()) {
para.deleteEx(true); para.deleteEx(true);
} }
parameterPanel.saveParameters(); getParameterPanel().saveParameters();
} }
} }
} }
@ -488,13 +314,13 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
MPInstance instance = null; MPInstance instance = null;
try { try {
instance = new MPInstance(Env.getCtx(), 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.setName(saveName);
instance.saveEx(); instance.saveEx();
m_pi.setAD_PInstance_ID(instance.getAD_PInstance_ID()); getProcessInfo().setAD_PInstance_ID(instance.getAD_PInstance_ID());
// Get Parameters // Get Parameters
if (parameterPanel != null) { if (getParameterPanel() != null) {
if (!parameterPanel.saveParameters()) { if (!getParameterPanel().saveParameters()) {
throw new AdempiereSystemError(Msg.getMsg( throw new AdempiereSystemError(Msg.getMsg(
Env.getCtx(), "SaveParameterError")); Env.getCtx(), "SaveParameterError"));
} }
@ -520,12 +346,8 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
} }
querySaved(); 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)) { } 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)) { } else if (event.getTarget().equals(fSavedName)) {
if (savedParams != null && saveName != null) { if (savedParams != null && saveName != null) {
for (int i = 0; i < savedParams.size(); i++) { for (int i = 0; i < savedParams.size(); i++) {
@ -538,6 +360,8 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
bSave.setEnabled(enabled && !lastRun); bSave.setEnabled(enabled && !lastRun);
bDelete.setEnabled(enabled && fSavedName.getSelectedIndex() > -1 bDelete.setEnabled(enabled && fSavedName.getSelectedIndex() > -1
&& !lastRun); && !lastRun);
} else {
super.onEvent(event);
} }
} }
@ -555,7 +379,7 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
} }
private void loadSavedParams(MPInstance instance) { private void loadSavedParams(MPInstance instance) {
parameterPanel.loadParameters(instance); getParameterPanel().loadParameters(instance);
} }
private void doOnClick(A btn) { private void doOnClick(A btn) {
@ -575,19 +399,10 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
} }
} }
@Override
public void lockUI(ProcessInfo pi) { public void showBusyDialog() {
if (m_isLocked || Executions.getCurrent() == null) return; BusyDialog progressWindow = createBusyDialog();
m_isLocked = true;
showBusyDialog();
}
private void showBusyDialog() {
progressWindow = new BusyDialog();
progressWindow.setStyle("position: absolute;"); progressWindow.setStyle("position: absolute;");
this.appendChild(progressWindow);
showBusyMask(progressWindow); showBusyMask(progressWindow);
LayoutUtils.openOverlappedWindow(this, progressWindow, "middle_center"); LayoutUtils.openOverlappedWindow(this, progressWindow, "middle_center");
} }
@ -599,7 +414,7 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
return mask; return mask;
} }
public void showBusyMask(Window window) { private void showBusyMask(Window window) {
getParent().appendChild(getMask()); getParent().appendChild(getMask());
StringBuilder script = new StringBuilder("var w=zk.Widget.$('#"); StringBuilder script = new StringBuilder("var w=zk.Widget.$('#");
script.append(getParent().getUuid()).append("');"); script.append(getParent().getUuid()).append("');");
@ -610,16 +425,9 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
} }
Clients.response(new AuScript(script.toString())); Clients.response(new AuScript(script.toString()));
} }
public void unlockUI(ProcessInfo pi) {
if (!m_isLocked || Executions.getCurrent() == null) return;
m_isLocked = false; private void hideBusyMask()
hideBusyDialog(); {
updateUI(pi);
}
public void hideBusyMask() {
if (mask != null && mask.getParent() != null) { if (mask != null && mask.getParent() != null) {
mask.detach(); mask.detach();
StringBuilder script = new StringBuilder("var w=zk.Widget.$('#"); StringBuilder script = new StringBuilder("var w=zk.Widget.$('#");
@ -628,20 +436,21 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
} }
} }
private void hideBusyDialog() { @Override
public void hideBusyDialog()
{
hideBusyMask(); hideBusyMask();
if (progressWindow != null) { closeBusyDialog();
progressWindow.dispose();
progressWindow = null;
}
} }
private void updateUI(ProcessInfo pi) { @Override
public void updateUI() {
ProcessInfo pi = getProcessInfo();
ProcessInfoUtil.setLogFromDB(pi); ProcessInfoUtil.setLogFromDB(pi);
m_messageText.append("<p><font color=\"").append(pi.isError() ? "#FF0000" : "#0000FF").append("\">** ") getMessageText().append("<p><font color=\"").append(pi.isError() ? "#FF0000" : "#0000FF").append("\">** ")
.append(pi.getSummary()) .append(pi.getSummary())
.append("</font></p>"); .append("</font></p>");
message.setContent(m_messageText.toString()); getMessage().setContent(getMessageText().toString());
// Add Log info with zoom on record id // Add Log info with zoom on record id
appendRecordLogInfo(pi.getLogs()); appendRecordLogInfo(pi.getLogs());
@ -652,7 +461,7 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
m_ids = pi.getIDs(); m_ids = pi.getIDs();
//move message div to center to give more space to display potentially very long log info //move message div to center to give more space to display potentially very long log info
centerPanel.detach(); getCenterPanel().detach();
messageDiv.detach(); messageDiv.detach();
messageDiv.setStyle(""); messageDiv.setStyle("");
north.setVisible(false); north.setVisible(false);
@ -747,8 +556,8 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
} }
private void restart() { private void restart() {
m_messageText = new StringBuffer(initialMessage); setMessageText(new StringBuffer(getInitialMessage()));
message.setContent(initialMessage); getMessage().setContent(getInitialMessage());
north.setVisible(true); north.setVisible(true);
messageDiv.detach(); messageDiv.detach();
@ -758,7 +567,7 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
messageDiv.setStyle(MESSAGE_DIV_STYLE); messageDiv.setStyle(MESSAGE_DIV_STYLE);
north.appendChild(messageDiv); north.appendChild(messageDiv);
center.appendChild(centerPanel); center.appendChild(getCenterPanel());
isParameterPage = true; isParameterPage = true;
@ -766,10 +575,11 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
bOK.setImage(ThemeManager.getThemeResource("images/Ok16.png")); bOK.setImage(ThemeManager.getThemeResource("images/Ok16.png"));
//recreate process info //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_User_ID (Env.getAD_User_ID(Env.getCtx()));
m_pi.setAD_Client_ID(Env.getAD_Client_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; m_ids = null;
@ -781,7 +591,7 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
// //
if (!afterProcessTask()) { if (!afterProcessTask()) {
// If the process is a silent one and no errors occured, close the dialog // 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(); this.dispose();
} }
} }
@ -796,12 +606,12 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
{ {
log.config(""); log.config("");
// Print invoices // Print invoices
if (m_AD_Process_ID == PROCESS_C_INVOICE_GENERATE) if (getAD_Process_ID() == PROCESS_C_INVOICE_GENERATE)
{ {
printInvoices(); printInvoices();
return true; return true;
} }
else if (m_AD_Process_ID == PROCESS_M_INOUT_GENERATE) else if (getAD_Process_ID() == PROCESS_M_INOUT_GENERATE)
{ {
printShipments(); printShipments();
return true; return true;
@ -821,12 +631,12 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
{ {
if (m_ids == null) if (m_ids == null)
return; return;
FDialog.ask(m_WindowNo, this, "PrintShipments", new Callback<Boolean>() { FDialog.ask(getWindowNo(), this, "PrintShipments", new Callback<Boolean>() {
@Override @Override
public void onCallback(Boolean result) { public void onCallback(Boolean result) {
if (result) { if (result) {
m_messageText.append("<p>").append(Msg.getMsg(Env.getCtx(), "PrintShipments")).append("</p>"); getMessageText().append("<p>").append(Msg.getMsg(Env.getCtx(), "PrintShipments")).append("</p>");
message.setContent(m_messageText.toString()); getMessage().setContent(getMessageText().toString());
showBusyDialog(); showBusyDialog();
Clients.response(new AuEcho(ProcessDialog.this, "onPrintShipments", null)); Clients.response(new AuEcho(ProcessDialog.this, "onPrintShipments", null));
} }
@ -872,7 +682,7 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
document.close(); document.close();
hideBusyDialog(); 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"); SessionManager.getAppDesktop().showWindow(win, "center");
} catch (Exception e) { } catch (Exception e) {
log.log(Level.SEVERE, e.getLocalizedMessage(), e); log.log(Level.SEVERE, e.getLocalizedMessage(), e);
@ -883,7 +693,7 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
} else if (pdfList.size() > 0) { } else if (pdfList.size() > 0) {
hideBusyDialog(); hideBusyDialog();
try { 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"); SessionManager.getAppDesktop().showWindow(win, "center");
} catch (Exception e) } catch (Exception e)
{ {
@ -892,7 +702,7 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
} }
// If the process is a silent one and no errors occured, close the dialog // 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(); this.dispose();
} }
@ -903,14 +713,14 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
{ {
if (m_ids == null) if (m_ids == null)
return; return;
FDialog.ask(m_WindowNo, this, "PrintInvoices", new Callback<Boolean>() { FDialog.ask(getWindowNo(), this, "PrintInvoices", new Callback<Boolean>() {
@Override @Override
public void onCallback(Boolean result) public void onCallback(Boolean result)
{ {
if (result) if (result)
{ {
m_messageText.append("<p>").append(Msg.getMsg(Env.getCtx(), "PrintInvoices")).append("</p>"); getMessageText().append("<p>").append(Msg.getMsg(Env.getCtx(), "PrintInvoices")).append("</p>");
message.setContent(m_messageText.toString()); getMessage().setContent(getMessageText().toString());
showBusyDialog(); showBusyDialog();
Clients.response(new AuEcho(ProcessDialog.this, "onPrintInvoices", null)); Clients.response(new AuEcho(ProcessDialog.this, "onPrintInvoices", null));
} }
@ -954,7 +764,7 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
document.close(); document.close();
hideBusyDialog(); 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"); SessionManager.getAppDesktop().showWindow(win, "center");
} catch (Exception e) { } catch (Exception e) {
log.log(Level.SEVERE, e.getLocalizedMessage(), e); log.log(Level.SEVERE, e.getLocalizedMessage(), e);
@ -965,7 +775,7 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
} else if (pdfList.size() > 0) { } else if (pdfList.size() > 0) {
hideBusyDialog(); hideBusyDialog();
try { 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"); SessionManager.getAppDesktop().showWindow(win, "center");
} catch (Exception e) } catch (Exception e)
{ {
@ -974,52 +784,8 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
} }
// If the process is a silent one and no errors occured, close the dialog // 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(); 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<Boolean> callback) {
Executions.schedule(getDesktop(), new EventListener<Event>() {
@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 } // ProcessDialog

View File

@ -16,45 +16,24 @@
*****************************************************************************/ *****************************************************************************/
package org.adempiere.webui.apps; 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 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.LayoutUtils;
import org.adempiere.webui.component.Button; import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.ConfirmPanel; import org.adempiere.webui.component.ConfirmPanel;
import org.adempiere.webui.component.Panel;
import org.adempiere.webui.component.VerticalBox; import org.adempiere.webui.component.VerticalBox;
import org.adempiere.webui.component.Window; import org.adempiere.webui.component.Window;
import org.adempiere.webui.event.DialogEvents; import org.adempiere.webui.event.DialogEvents;
import org.adempiere.webui.factory.ButtonFactory; 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.process.ProcessInfo;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env; 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.Component;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Div; import org.zkoss.zul.Div;
import org.zkoss.zul.Hbox; import org.zkoss.zul.Hbox;
import org.zkoss.zul.Html;
import org.zkoss.zul.Vlayout; import org.zkoss.zul.Vlayout;
/** /**
@ -68,20 +47,18 @@ import org.zkoss.zul.Vlayout;
* @author arboleda - globalqss * @author arboleda - globalqss
* - Implement ShowHelp option on processes and reports * - Implement ShowHelp option on processes and reports
*/ */
public class ProcessModalDialog extends Window implements EventListener<Event>, IProcessUI, DialogEvents public class ProcessModalDialog extends AbstractProcessDialog implements EventListener<Event>, 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 VerticalBox dialogBody;
private List<File> downloadFiles; /** Logger */
private static CLogger log = CLogger.getCLogger(ProcessModalDialog.class);
//
/** /**
* @param aProcess * @param aProcess
@ -102,10 +79,7 @@ public class ProcessModalDialog extends Window implements EventListener<Event>,
*/ */
public ProcessModalDialog(EventListener<Event> listener, int WindowNo, ProcessInfo pi, boolean autoStart) public ProcessModalDialog(EventListener<Event> listener, int WindowNo, ProcessInfo pi, boolean autoStart)
{ {
m_ctx = Env.getCtx(); super();
m_WindowNo = WindowNo;
m_pi = pi;
m_autoStart = autoStart;
if (listener != null) if (listener != null)
{ {
@ -116,7 +90,7 @@ public class ProcessModalDialog extends Window implements EventListener<Event>,
try try
{ {
initComponents(); initComponents();
init(); init(Env.getCtx(), WindowNo, pi.getAD_Process_ID(), pi, "100%", autoStart, true);
} }
catch(Exception ex) catch(Exception ex)
{ {
@ -172,12 +146,10 @@ public class ProcessModalDialog extends Window implements EventListener<Event>,
dialogBody.appendChild(dialogContent); dialogBody.appendChild(dialogContent);
Div div = new Div(); Div div = new Div();
div.setId("message"); div.setId("message");
message = new Html(); div.appendChild(getMessage());
div.appendChild(message);
div.setStyle("max-height: 150pt; overflow: auto;"); div.setStyle("max-height: 150pt; overflow: auto;");
dialogContent.appendChild(div); dialogContent.appendChild(div);
centerPanel = new Panel(); dialogContent.appendChild(getCenterPanel());
dialogContent.appendChild(centerPanel);
Hbox hbox = new Hbox(); Hbox hbox = new Hbox();
hbox.setWidth("100%"); hbox.setWidth("100%");
hbox.setSclass("dialog-footer"); hbox.setSclass("dialog-footer");
@ -198,28 +170,6 @@ public class ProcessModalDialog extends Window implements EventListener<Event>,
} }
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 Visible
* (set focus to OK if visible) * (set focus to OK if visible)
@ -235,158 +185,39 @@ public class ProcessModalDialog extends Window implements EventListener<Event>,
*/ */
public void dispose() public void dispose()
{ {
parameterPanel.restoreContext(); super.dispose();
m_valid = false; getParameterPanel().restoreContext();
this.detach(); this.detach();
} // dispose } // dispose
/** @Override
* is dialog still valid public void autoStart()
* @return boolean
*/
public boolean isValid()
{ {
return m_valid; this.getFirstChild().setVisible(false);
super.autoStart();
} }
/** @Override
* @return true if user have press the cancel button to close the dialog public void showBusyDialog() {
*/
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("<b>");
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("</b>");
s = rs.getString(3); // Help
if (!rs.wasNull())
m_messageText.append("<p>").append(s).append("</p>");
}
}
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<File>();
//use echo, otherwise lock ui wouldn't work
Clients.response(new AuEcho(this, "runProcess", null));
}
private void showBusyDialog() {
this.setBorder("none"); this.setBorder("none");
this.setTitle(null); this.setTitle(null);
dialogBody.setVisible(false); dialogBody.setVisible(false);
progressWindow = new BusyDialog(); BusyDialog progressWindow = createBusyDialog();
this.appendChild(progressWindow);
if (this.getParent() != null) if (this.getParent() != null)
LayoutUtils.openOverlappedWindow(this.getParent(), progressWindow, "middle_center"); LayoutUtils.openOverlappedWindow(this.getParent(), progressWindow, "middle_center");
} }
/** @Override
* internal use, don't call this directly public void updateUI() {
*/
public void runProcess() {
processDialogRunnable = new ProcessDialogRunnable();
future = Adempiere.getThreadPoolExecutor().submit(new DesktopRunnable(processDialogRunnable, getDesktop()));
} }
private void hideBusyDialog() { @Override
if (progressWindow != null) { public void hideBusyDialog() {
progressWindow.dispose(); closeBusyDialog();
progressWindow = null;
}
} }
/** /**
* handle events * handle events
*/ */
@ -394,138 +225,12 @@ public class ProcessModalDialog extends Window implements EventListener<Event>,
Component component = event.getTarget(); Component component = event.getTarget();
if (component instanceof Button) { if (component instanceof Button) {
Button element = (Button)component; Button element = (Button)component;
if ("Ok".equalsIgnoreCase(element.getId())) { if ("Ok".equalsIgnoreCase(element.getId()))
onOK(); startProcess();
} else if ("Cancel".equalsIgnoreCase(element.getId())) { else if ("Cancel".equalsIgnoreCase(element.getId()))
onCancel(); cancelProcess();
} } else {
} else if (event.getName().equals(ON_STATUS_UPDATE)) { super.onEvent(event);
onStatusUpdate(event);
} else if (event.getName().equals(ON_COMPLETE)) {
onComplete();
} }
} }
} // ProcessModalDialog
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<Event>() {
@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<Boolean> callback) {
Executions.schedule(getDesktop(), new EventListener<Event>() {
@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

View File

@ -471,4 +471,14 @@ public class WPaySelect extends PaySelect
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
@Override
public void askForInput(final String message, final Callback<String> callback) {
Executions.schedule(form.getDesktop(), new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
FDialog.askForInput(m_WindowNo, null, message, callback);
}
}, new Event("onAskForInput"));
}
} // VPaySelect } // VPaySelect

View File

@ -35,6 +35,7 @@ import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Hbox; import org.zkoss.zul.Hbox;
import org.zkoss.zul.Image; import org.zkoss.zul.Image;
import org.zkoss.zul.Vbox;
/** /**
* Messagebox : Replaces ZK's Messagebox * Messagebox : Replaces ZK's Messagebox
@ -46,9 +47,10 @@ import org.zkoss.zul.Image;
public class Messagebox extends Window implements EventListener<Event> public class Messagebox extends Window implements EventListener<Event>
{ {
/** /**
* 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 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 msg = new String("");
private String imgSrc = new String(""); private String imgSrc = new String("");
@ -62,11 +64,14 @@ public class Messagebox extends Window implements EventListener<Event>
private Button btnAbort; private Button btnAbort;
private Button btnRetry; private Button btnRetry;
private Button btnIgnore; private Button btnIgnore;
private Textbox txtInput = new Textbox();;
private Image img = new Image(); private Image img = new Image();
private int returnValue; private int returnValue;
private Callback<Integer> callback; @SuppressWarnings("rawtypes")
private Callback callback;
private boolean isInput = false;
/** A OK button. */ /** A OK button. */
public static final int OK = 0x0001; public static final int OK = 0x0001;
@ -88,6 +93,9 @@ public class Messagebox extends Window implements EventListener<Event>
/** A IGNORE button. */ /** A IGNORE button. */
public static final int IGNORE = 0x0400; 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. */ /** A symbol consisting of a question mark in a circle. */
public static final String QUESTION = "~./zul/img/msgbox/question-btn.png"; public static final String QUESTION = "~./zul/img/msgbox/question-btn.png";
@ -155,6 +163,14 @@ public class Messagebox extends Window implements EventListener<Event>
pnlMessage.setStyle(MESSAGE_PANEL_STYLE); pnlMessage.setStyle(MESSAGE_PANEL_STYLE);
pnlMessage.appendChild(lblMsg); 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(); Hbox pnlImage = new Hbox();
img.setSrc(imgSrc); img.setSrc(imgSrc);
@ -168,7 +184,7 @@ public class Messagebox extends Window implements EventListener<Event>
north.setAlign("center"); north.setAlign("center");
this.appendChild(north); this.appendChild(north);
north.appendChild(pnlImage); north.appendChild(pnlImage);
north.appendChild(pnlMessage); north.appendChild(pnlText);
north.setSclass("dialog-content"); north.setSclass("dialog-content");
Hbox pnlButtons = new Hbox(); Hbox pnlButtons = new Hbox();
@ -201,7 +217,7 @@ public class Messagebox extends Window implements EventListener<Event>
return show(message, title, buttons, icon, callback, false); return show(message, title, buttons, icon, callback, false);
} }
public int show(String message, String title, int buttons, String icon, Callback<Integer> callback, boolean modal) public int show(String message, String title, int buttons, String icon, Callback<?> callback, boolean modal)
{ {
this.msg = message; this.msg = message;
this.imgSrc = icon; this.imgSrc = icon;
@ -216,6 +232,7 @@ public class Messagebox extends Window implements EventListener<Event>
btnRetry.setVisible(false); btnRetry.setVisible(false);
btnAbort.setVisible(false); btnAbort.setVisible(false);
btnIgnore.setVisible(false); btnIgnore.setVisible(false);
txtInput.setVisible(false);
if ((buttons & OK) != 0) if ((buttons & OK) != 0)
btnOk.setVisible(true); btnOk.setVisible(true);
@ -238,6 +255,11 @@ public class Messagebox extends Window implements EventListener<Event>
if ((buttons & IGNORE) != 0) if ((buttons & IGNORE) != 0)
btnIgnore.setVisible(true); btnIgnore.setVisible(true);
if ((buttons & INPUT) != 0) {
txtInput.setVisible(true);
isInput = true;
}
this.setTitle(title); this.setTitle(title);
this.setPosition("center"); this.setPosition("center");
this.setClosable(true); this.setClosable(true);
@ -274,7 +296,7 @@ public class Messagebox extends Window implements EventListener<Event>
return showDialog(message, title, buttons, icon, callback, false); return showDialog(message, title, buttons, icon, callback, false);
} }
public static int showDialog(String message, String title, int buttons, String icon, Callback<Integer> callback, boolean modal) public static int showDialog(String message, String title, int buttons, String icon, Callback<?> callback, boolean modal)
{ {
Messagebox msg = new Messagebox(); Messagebox msg = new Messagebox();
@ -318,12 +340,15 @@ public class Messagebox extends Window implements EventListener<Event>
this.detach(); this.detach();
} }
@SuppressWarnings("unchecked")
@Override @Override
public void onPageDetached(Page page) { public void onPageDetached(Page page) {
super.onPageDetached(page); super.onPageDetached(page);
if (callback != null) if (callback != null && !isInput)
{ {
callback.onCallback(returnValue); callback.onCallback(returnValue);
} else if (callback != null && isInput) {
callback.onCallback(txtInput.getText());
} }
} }
} }

View File

@ -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<Event>, 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> 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<Integer> 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<MPInstance> 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<MPInstance> getRunningJobForUser(Properties ctx, int AD_User_ID)
{
List<MPInstance> 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<Desktop>(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<Integer> {
@Override
public void onMessage(Integer message) {
MPInstance.postOnChangedEvent(message);
}
}
}

View File

@ -18,7 +18,7 @@ import java.util.List;
import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.ToolBarButton; import org.adempiere.webui.component.ToolBarButton;
import org.adempiere.webui.component.Window; 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.theme.ThemeManager;
import org.adempiere.webui.window.InfoSchedule; import org.adempiere.webui.window.InfoSchedule;
import org.compiere.model.MInfoWindow; import org.compiere.model.MInfoWindow;
@ -135,9 +135,8 @@ public class DPViews extends DashboardPanel implements EventListener<Event> {
if (infoWindowID<=0) if (infoWindowID<=0)
return; return;
String tableName = MTable.getTableName(Env.getCtx(), new MInfoWindow(Env.getCtx(), infoWindowID, null).getAD_Table_ID()); SessionManager.getAppDesktop().openInfo(infoWindowID);
InfoPanel.showPanel(tableName);
} }
} }
} }

View File

@ -107,6 +107,7 @@ public class InfoBPartnerWindow extends InfoWindow {
} }
} }
} }
dynamicDisplay(null);
} }
@Override @Override

View File

@ -67,5 +67,6 @@ public class InfoInOutWindow extends InfoWindow {
} }
} }
} }
dynamicDisplay(null);
} }
} }

View File

@ -78,6 +78,7 @@ public class InfoInvoiceWindow extends InfoWindow {
} }
} }
} }
dynamicDisplay(null);
} }
} }

Some files were not shown because too many files have changed in this diff Show More