hg merge release-4.1 (merge release4.1 into development)
This commit is contained in:
commit
80d851ed8e
|
@ -0,0 +1,17 @@
|
||||||
|
SET SQLBLANKLINES ON
|
||||||
|
SET DEFINE OFF
|
||||||
|
|
||||||
|
-- Jun 19, 2017 8:54:41 PM CEST
|
||||||
|
-- 2Pack Semaphore
|
||||||
|
INSERT INTO AD_SysConfig (AD_SysConfig_ID,EntityType,ConfigurationLevel,Updated,Value,AD_SysConfig_UU,IsActive,Name,Created,AD_Org_ID,CreatedBy,UpdatedBy,AD_Client_ID) VALUES (200098,'D','S',TO_DATE('2017-06-19 20:54:40','YYYY-MM-DD HH24:MI:SS'),'AUTOMATIC_PACKIN_PROCESSING','cba425fc-4e0e-4a45-bc14-281a98a52c81','Y','AUTOMATIC_PACKIN_PROCESSING',TO_DATE('2017-06-19 20:54:40','YYYY-MM-DD HH24:MI:SS'),0,100,100,0)
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jun 19, 2017 8:55:06 PM CEST
|
||||||
|
INSERT INTO AD_SysConfig (AD_SysConfig_ID,EntityType,ConfigurationLevel,Updated,Value,AD_SysConfig_UU,IsActive,Name,Created,AD_Org_ID,CreatedBy,UpdatedBy,AD_Client_ID) VALUES (200099,'D','S',TO_DATE('2017-06-19 20:55:05','YYYY-MM-DD HH24:MI:SS'),'120','2dd1b89a-936e-47aa-b7e6-3b66649ed224','Y','AUTOMATIC_PACKIN_TIMEOUT',TO_DATE('2017-06-19 20:55:05','YYYY-MM-DD HH24:MI:SS'),0,100,100,0)
|
||||||
|
;
|
||||||
|
|
||||||
|
INSERT INTO AD_SysConfig (AD_SysConfig_ID,EntityType,ConfigurationLevel,Updated,Value,AD_SysConfig_UU,IsActive,Name,Created,AD_Org_ID,CreatedBy,UpdatedBy,AD_Client_ID) VALUES (200100,'D','S',TO_DATE('2017-06-20 12:12:07','YYYY-MM-DD HH24:MI:SS'),'5','49244d58-3306-4a38-9458-7fa8616214c2','Y','AUTOMATIC_PACKIN_RETRIES',TO_DATE('2017-06-20 12:12:07','YYYY-MM-DD HH24:MI:SS'),0,100,100,0)
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('201706192054_Ticket_1008086.sql') FROM dual
|
||||||
|
;
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,8 @@
|
||||||
|
-- IDEMPIERE-794 Ticket #1001025 - Expand the views to provide more information / fix a reference that was wrongly defined
|
||||||
|
-- Jun 21, 2017 7:07:04 PM COT
|
||||||
|
UPDATE AD_Ref_Table SET AD_Table_ID=560, AD_Key=8490, AD_Display=8489,Updated=TO_DATE('2017-06-21 19:07:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=200055
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('201706220209_IDEMPIERE-794.sql') FROM dual
|
||||||
|
;
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
SET SQLBLANKLINES ON
|
||||||
|
SET DEFINE OFF
|
||||||
|
|
||||||
|
-- IDEMPIERE-3409
|
||||||
|
-- Jun 24, 2017 6:06:16 PM CEST
|
||||||
|
INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200103,0,0,TO_DATE('2017-06-24 18:06:16','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2017-06-24 18:06:16','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','IDENTIFIER_SEPARATOR','_','Separator for the fields that compose an identifier on lookup boxes','D','C','3139dada-425f-42ea-8840-3080e88aa5e2')
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('201706241808_IDEMPIERE-3409.sql') FROM dual
|
||||||
|
;
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
SET SQLBLANKLINES ON
|
||||||
|
SET DEFINE OFF
|
||||||
|
|
||||||
|
-- IDEMPIERE-3401 Orderline Discount Context issue
|
||||||
|
-- Jun 24, 2017 6:44:50 PM CEST
|
||||||
|
UPDATE AD_Column SET Callout='org.compiere.model.CalloutOrder.navigateOrderLine', IsUpdateable='N',Updated=TO_DATE('2017-06-24 18:44:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2205
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jun 24, 2017 6:45:45 PM CEST
|
||||||
|
UPDATE AD_Column SET Callout='org.compiere.model.CalloutInvoice.navigateInvoiceLine', IsUpdateable='N',Updated=TO_DATE('2017-06-24 18:45:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3828
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('201706241900_IDEMPIERE-3401.sql') FROM dual
|
||||||
|
;
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
SET SQLBLANKLINES ON
|
||||||
|
SET DEFINE OFF
|
||||||
|
|
||||||
|
-- IDEMPIERE-3405
|
||||||
|
-- Jun 24, 2017 11:48:25 PM CEST
|
||||||
|
UPDATE AD_Val_Rule SET Name='C_DocTypeTarget PO or SO',Updated=TO_DATE('2017-06-24 23:48:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=133
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jun 24, 2017 11:48:48 PM CEST
|
||||||
|
UPDATE AD_Val_Rule SET Description='Document Type for orders',Updated=TO_DATE('2017-06-24 23:48:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=133
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jun 24, 2017 11:49:44 PM CEST
|
||||||
|
INSERT INTO AD_Val_Rule (AD_Val_Rule_ID,Name,Description,Type,Code,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Val_Rule_UU) VALUES (200096,'C_DocType PO or SO','Document Type for orders','S','(C_DocType.DocBaseType IN (''SOO'', ''POO'') AND C_DocType.IsSOTrx=''@IsSOTrx@'' AND COALESCE(C_DocType.DocSubTypeSO,'' '')<>''RM'' AND C_DocType.AD_Client_ID=@#AD_Client_ID@) OR C_DocType_ID=0',0,0,'Y',TO_DATE('2017-06-24 23:49:43','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-06-24 23:49:43','YYYY-MM-DD HH24:MI:SS'),100,'D','7f54de3d-a0cb-4649-aeff-6c8dfa5bd991')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jun 24, 2017 11:50:01 PM CEST
|
||||||
|
UPDATE AD_Val_Rule SET Description='Target Document Type for orders',Updated=TO_DATE('2017-06-24 23:50:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=133
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jun 24, 2017 11:50:13 PM CEST
|
||||||
|
UPDATE AD_Val_Rule SET Name='C_DocTypeTarget AR/AP Invoices and Credit Memos', Description='Target Document Type AR/AP Invoice and Credit Memos',Updated=TO_DATE('2017-06-24 23:50:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=124
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jun 24, 2017 11:50:29 PM CEST
|
||||||
|
INSERT INTO AD_Val_Rule (AD_Val_Rule_ID,Name,Description,Type,Code,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Val_Rule_UU) VALUES (200097,'C_DocTypeTarget AR/AP Invoices and Credit Memos','Target Document Type AR/AP Invoice and Credit Memos','S','(C_DocType.DocBaseType IN (''ARI'', ''API'',''ARC'',''APC'') AND C_DocType.IsSOTrx=''@IsSOTrx@'' AND C_DocType.AD_Client_ID=@#AD_Client_ID@) OR C_DocType_ID=0',0,0,'Y',TO_DATE('2017-06-24 23:50:29','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-06-24 23:50:29','YYYY-MM-DD HH24:MI:SS'),100,'D','62aa64dd-3808-4871-954a-783b60943758')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jun 24, 2017 11:50:59 PM CEST
|
||||||
|
UPDATE AD_Column SET AD_Val_Rule_ID=200096,Updated=TO_DATE('2017-06-24 23:50:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2172
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jun 24, 2017 11:52:31 PM CEST
|
||||||
|
UPDATE AD_Val_Rule SET Name='C_DocType AR/AP Invoices and Credit Memos', Description='Document Type AR/AP Invoice and Credit Memos',Updated=TO_DATE('2017-06-24 23:52:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=200097
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jun 24, 2017 11:52:43 PM CEST
|
||||||
|
UPDATE AD_Column SET AD_Val_Rule_ID=200097,Updated=TO_DATE('2017-06-24 23:52:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3493
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('201706242353_IDEMPIERE-3405.sql') FROM dual
|
||||||
|
;
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
SET SQLBLANKLINES ON
|
||||||
|
SET DEFINE OFF
|
||||||
|
|
||||||
|
-- IDEMPIERE-3405
|
||||||
|
-- Jun 25, 2017 2:58:01 PM CEST
|
||||||
|
UPDATE AD_Val_Rule SET Code='(C_DocType.DocBaseType IN (''ARI'', ''API'',''ARC'',''APC'') AND C_DocType.IsSOTrx=''@IsSOTrx@'' AND C_DocType.AD_Client_ID=@#AD_Client_ID@) OR C_DocType.C_DocType_ID=0',Updated=TO_DATE('2017-06-25 14:58:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=200097
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jun 25, 2017 2:58:15 PM CEST
|
||||||
|
UPDATE AD_Val_Rule SET Code='(C_DocType.DocBaseType IN (''SOO'', ''POO'') AND C_DocType.IsSOTrx=''@IsSOTrx@'' AND COALESCE(C_DocType.DocSubTypeSO,'' '')<>''RM'' AND C_DocType.AD_Client_ID=@#AD_Client_ID@) OR C_DocType.C_DocType_ID=0',Updated=TO_DATE('2017-06-25 14:58:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=200096
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('201706251458_IDEMPIERE-3405.sql') FROM dual
|
||||||
|
;
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
-- Jun 19, 2017 8:54:41 PM CEST
|
||||||
|
-- 2Pack Semaphore
|
||||||
|
INSERT INTO AD_SysConfig (AD_SysConfig_ID,EntityType,ConfigurationLevel,Updated,Value,AD_SysConfig_UU,IsActive,Name,Created,AD_Org_ID,CreatedBy,UpdatedBy,AD_Client_ID) VALUES (200098,'D','S',TO_TIMESTAMP('2017-06-19 20:54:40','YYYY-MM-DD HH24:MI:SS'),'AUTOMATIC_PACKIN_PROCESSING','cba425fc-4e0e-4a45-bc14-281a98a52c81','Y','AUTOMATIC_PACKIN_PROCESSING',TO_TIMESTAMP('2017-06-19 20:54:40','YYYY-MM-DD HH24:MI:SS'),0,100,100,0)
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jun 19, 2017 8:55:06 PM CEST
|
||||||
|
INSERT INTO AD_SysConfig (AD_SysConfig_ID,EntityType,ConfigurationLevel,Updated,Value,AD_SysConfig_UU,IsActive,Name,Created,AD_Org_ID,CreatedBy,UpdatedBy,AD_Client_ID) VALUES (200099,'D','S',TO_TIMESTAMP('2017-06-19 20:55:05','YYYY-MM-DD HH24:MI:SS'),'120','2dd1b89a-936e-47aa-b7e6-3b66649ed224','Y','AUTOMATIC_PACKIN_TIMEOUT',TO_TIMESTAMP('2017-06-19 20:55:05','YYYY-MM-DD HH24:MI:SS'),0,100,100,0)
|
||||||
|
;
|
||||||
|
|
||||||
|
INSERT INTO AD_SysConfig (AD_SysConfig_ID,EntityType,ConfigurationLevel,Updated,Value,AD_SysConfig_UU,IsActive,Name,Created,AD_Org_ID,CreatedBy,UpdatedBy,AD_Client_ID) VALUES (200100,'D','S',TO_TIMESTAMP('2017-06-20 12:12:07','YYYY-MM-DD HH24:MI:SS'),'5','49244d58-3306-4a38-9458-7fa8616214c2','Y','AUTOMATIC_PACKIN_RETRIES',TO_TIMESTAMP('2017-06-20 12:12:07','YYYY-MM-DD HH24:MI:SS'),0,100,100,0)
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('201706192054_Ticket_1008086.sql') FROM dual
|
||||||
|
;
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,8 @@
|
||||||
|
-- IDEMPIERE-794 Ticket #1001025 - Expand the views to provide more information / fix a reference that was wrongly defined
|
||||||
|
-- Jun 21, 2017 7:07:04 PM COT
|
||||||
|
UPDATE AD_Ref_Table SET AD_Table_ID=560, AD_Key=8490, AD_Display=8489,Updated=TO_TIMESTAMP('2017-06-21 19:07:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=200055
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('201706220209_IDEMPIERE-794.sql') FROM dual
|
||||||
|
;
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
-- IDEMPIERE-3409
|
||||||
|
-- Jun 24, 2017 6:06:16 PM CEST
|
||||||
|
INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200103,0,0,TO_TIMESTAMP('2017-06-24 18:06:16','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2017-06-24 18:06:16','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','IDENTIFIER_SEPARATOR','_','Separator for the fields that compose an identifier on lookup boxes','D','C','3139dada-425f-42ea-8840-3080e88aa5e2')
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('201706241808_IDEMPIERE-3409.sql') FROM dual
|
||||||
|
;
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
-- IDEMPIERE-3401 Orderline Discount Context issue
|
||||||
|
-- Jun 24, 2017 6:44:50 PM CEST
|
||||||
|
UPDATE AD_Column SET Callout='org.compiere.model.CalloutOrder.navigateOrderLine', IsUpdateable='N',Updated=TO_TIMESTAMP('2017-06-24 18:44:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2205
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jun 24, 2017 6:45:45 PM CEST
|
||||||
|
UPDATE AD_Column SET Callout='org.compiere.model.CalloutInvoice.navigateInvoiceLine', IsUpdateable='N',Updated=TO_TIMESTAMP('2017-06-24 18:45:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3828
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('201706241900_IDEMPIERE-3401.sql') FROM dual
|
||||||
|
;
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
-- IDEMPIERE-3405
|
||||||
|
-- Jun 24, 2017 11:48:25 PM CEST
|
||||||
|
UPDATE AD_Val_Rule SET Name='C_DocTypeTarget PO or SO',Updated=TO_TIMESTAMP('2017-06-24 23:48:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=133
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jun 24, 2017 11:48:48 PM CEST
|
||||||
|
UPDATE AD_Val_Rule SET Description='Document Type for orders',Updated=TO_TIMESTAMP('2017-06-24 23:48:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=133
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jun 24, 2017 11:49:44 PM CEST
|
||||||
|
INSERT INTO AD_Val_Rule (AD_Val_Rule_ID,Name,Description,Type,Code,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Val_Rule_UU) VALUES (200096,'C_DocType PO or SO','Document Type for orders','S','(C_DocType.DocBaseType IN (''SOO'', ''POO'') AND C_DocType.IsSOTrx=''@IsSOTrx@'' AND COALESCE(C_DocType.DocSubTypeSO,'' '')<>''RM'' AND C_DocType.AD_Client_ID=@#AD_Client_ID@) OR C_DocType_ID=0',0,0,'Y',TO_TIMESTAMP('2017-06-24 23:49:43','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-06-24 23:49:43','YYYY-MM-DD HH24:MI:SS'),100,'D','7f54de3d-a0cb-4649-aeff-6c8dfa5bd991')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jun 24, 2017 11:50:01 PM CEST
|
||||||
|
UPDATE AD_Val_Rule SET Description='Target Document Type for orders',Updated=TO_TIMESTAMP('2017-06-24 23:50:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=133
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jun 24, 2017 11:50:13 PM CEST
|
||||||
|
UPDATE AD_Val_Rule SET Name='C_DocTypeTarget AR/AP Invoices and Credit Memos', Description='Target Document Type AR/AP Invoice and Credit Memos',Updated=TO_TIMESTAMP('2017-06-24 23:50:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=124
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jun 24, 2017 11:50:29 PM CEST
|
||||||
|
INSERT INTO AD_Val_Rule (AD_Val_Rule_ID,Name,Description,Type,Code,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Val_Rule_UU) VALUES (200097,'C_DocTypeTarget AR/AP Invoices and Credit Memos','Target Document Type AR/AP Invoice and Credit Memos','S','(C_DocType.DocBaseType IN (''ARI'', ''API'',''ARC'',''APC'') AND C_DocType.IsSOTrx=''@IsSOTrx@'' AND C_DocType.AD_Client_ID=@#AD_Client_ID@) OR C_DocType_ID=0',0,0,'Y',TO_TIMESTAMP('2017-06-24 23:50:29','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-06-24 23:50:29','YYYY-MM-DD HH24:MI:SS'),100,'D','62aa64dd-3808-4871-954a-783b60943758')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jun 24, 2017 11:50:59 PM CEST
|
||||||
|
UPDATE AD_Column SET AD_Val_Rule_ID=200096,Updated=TO_TIMESTAMP('2017-06-24 23:50:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2172
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jun 24, 2017 11:52:31 PM CEST
|
||||||
|
UPDATE AD_Val_Rule SET Name='C_DocType AR/AP Invoices and Credit Memos', Description='Document Type AR/AP Invoice and Credit Memos',Updated=TO_TIMESTAMP('2017-06-24 23:52:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=200097
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jun 24, 2017 11:52:43 PM CEST
|
||||||
|
UPDATE AD_Column SET AD_Val_Rule_ID=200097,Updated=TO_TIMESTAMP('2017-06-24 23:52:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3493
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('201706242353_IDEMPIERE-3405.sql') FROM dual
|
||||||
|
;
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
-- IDEMPIERE-3405
|
||||||
|
-- Jun 25, 2017 2:58:01 PM CEST
|
||||||
|
UPDATE AD_Val_Rule SET Code='(C_DocType.DocBaseType IN (''ARI'', ''API'',''ARC'',''APC'') AND C_DocType.IsSOTrx=''@IsSOTrx@'' AND C_DocType.AD_Client_ID=@#AD_Client_ID@) OR C_DocType.C_DocType_ID=0',Updated=TO_TIMESTAMP('2017-06-25 14:58:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=200097
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jun 25, 2017 2:58:15 PM CEST
|
||||||
|
UPDATE AD_Val_Rule SET Code='(C_DocType.DocBaseType IN (''SOO'', ''POO'') AND C_DocType.IsSOTrx=''@IsSOTrx@'' AND COALESCE(C_DocType.DocSubTypeSO,'' '')<>''RM'' AND C_DocType.AD_Client_ID=@#AD_Client_ID@) OR C_DocType.C_DocType_ID=0',Updated=TO_TIMESTAMP('2017-06-25 14:58:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=200096
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('201706251458_IDEMPIERE-3405.sql') FROM dual
|
||||||
|
;
|
||||||
|
|
|
@ -833,5 +833,44 @@ public class CalloutInvoice extends CalloutEngine
|
||||||
return "";
|
return "";
|
||||||
} // qty
|
} // qty
|
||||||
|
|
||||||
|
public String navigateInvoiceLine(Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value) {
|
||||||
|
Integer M_Product_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "M_Product_ID");
|
||||||
|
if (M_Product_ID == null || M_Product_ID.intValue() == 0) {
|
||||||
|
Env.setContext(ctx, WindowNo, "DiscountSchema", "N");
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** Price Calculation see also qty ****/
|
||||||
|
int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID");
|
||||||
|
BigDecimal Qty = (BigDecimal)mTab.getValue("QtyOrdered");
|
||||||
|
boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y");
|
||||||
|
MProductPricing pp = new MProductPricing (M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx);
|
||||||
|
//
|
||||||
|
int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID");
|
||||||
|
pp.setM_PriceList_ID(M_PriceList_ID);
|
||||||
|
Timestamp orderDate = (Timestamp)mTab.getValue("DateOrdered");
|
||||||
|
/** PLV is only accurate if PL selected in header */
|
||||||
|
int M_PriceList_Version_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_Version_ID");
|
||||||
|
if ( M_PriceList_Version_ID == 0 && M_PriceList_ID > 0)
|
||||||
|
{
|
||||||
|
String sql = "SELECT plv.M_PriceList_Version_ID "
|
||||||
|
+ "FROM M_PriceList_Version plv "
|
||||||
|
+ "WHERE plv.M_PriceList_ID=? " // 1
|
||||||
|
+ " AND plv.ValidFrom <= ? "
|
||||||
|
+ "ORDER BY plv.ValidFrom DESC";
|
||||||
|
// Use newest price list - may not be future
|
||||||
|
|
||||||
|
M_PriceList_Version_ID = DB.getSQLValueEx(null, sql, M_PriceList_ID, orderDate);
|
||||||
|
if ( M_PriceList_Version_ID > 0 )
|
||||||
|
Env.setContext(ctx, WindowNo, "M_PriceList_Version_ID", M_PriceList_Version_ID );
|
||||||
|
}
|
||||||
|
pp.setM_PriceList_Version_ID(M_PriceList_Version_ID);
|
||||||
|
pp.setPriceDate(orderDate);
|
||||||
|
//
|
||||||
|
Env.setContext(ctx, WindowNo, "EnforcePriceLimit", pp.isEnforcePriceLimit() ? "Y" : "N");
|
||||||
|
Env.setContext(ctx, WindowNo, "DiscountSchema", pp.isDiscountSchema() ? "Y" : "N");
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
} // CalloutInvoice
|
} // CalloutInvoice
|
||||||
|
|
|
@ -1411,5 +1411,46 @@ public class CalloutOrder extends CalloutEngine
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String navigateOrderLine(Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value) {
|
||||||
|
Integer M_Product_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "M_Product_ID");
|
||||||
|
if (M_Product_ID == null || M_Product_ID.intValue() == 0) {
|
||||||
|
Env.setContext(ctx, WindowNo, "DiscountSchema", "N");
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** Price Calculation see also qty ****/
|
||||||
|
int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID");
|
||||||
|
BigDecimal Qty = (BigDecimal)mTab.getValue("QtyOrdered");
|
||||||
|
boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y");
|
||||||
|
MProductPricing pp = new MProductPricing (M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx);
|
||||||
|
//
|
||||||
|
int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID");
|
||||||
|
pp.setM_PriceList_ID(M_PriceList_ID);
|
||||||
|
Timestamp orderDate = (Timestamp)mTab.getValue("DateOrdered");
|
||||||
|
/** PLV is only accurate if PL selected in header */
|
||||||
|
int M_PriceList_Version_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_Version_ID");
|
||||||
|
if ( M_PriceList_Version_ID == 0 && M_PriceList_ID > 0)
|
||||||
|
{
|
||||||
|
String sql = "SELECT plv.M_PriceList_Version_ID "
|
||||||
|
+ "FROM M_PriceList_Version plv "
|
||||||
|
+ "WHERE plv.M_PriceList_ID=? " // 1
|
||||||
|
+ " AND plv.ValidFrom <= ? "
|
||||||
|
+ "ORDER BY plv.ValidFrom DESC";
|
||||||
|
// Use newest price list - may not be future
|
||||||
|
|
||||||
|
M_PriceList_Version_ID = DB.getSQLValueEx(null, sql, M_PriceList_ID, orderDate);
|
||||||
|
if ( M_PriceList_Version_ID > 0 )
|
||||||
|
Env.setContext(ctx, WindowNo, "M_PriceList_Version_ID", M_PriceList_Version_ID );
|
||||||
|
}
|
||||||
|
pp.setM_PriceList_Version_ID(M_PriceList_Version_ID);
|
||||||
|
pp.setPriceDate(orderDate);
|
||||||
|
//
|
||||||
|
Env.setContext(ctx, WindowNo, "EnforcePriceLimit", pp.isEnforcePriceLimit() ? "Y" : "N");
|
||||||
|
Env.setContext(ctx, WindowNo, "DiscountSchema", pp.isDiscountSchema() ? "Y" : "N");
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
} // CalloutOrder
|
} // CalloutOrder
|
||||||
|
|
||||||
|
|
|
@ -221,6 +221,7 @@ public class ClientAcctProcessor extends SvrProcess
|
||||||
// Run every posting document in own transaction
|
// Run every posting document in own transaction
|
||||||
String innerTrxName = Trx.createTrxName("CAP");
|
String innerTrxName = Trx.createTrxName("CAP");
|
||||||
Trx innerTrx = Trx.get(innerTrxName, true);
|
Trx innerTrx = Trx.get(innerTrxName, true);
|
||||||
|
innerTrx.setDisplayName(getClass().getName()+"_postSession");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -104,6 +104,7 @@ public class AllocationReset extends SvrProcess
|
||||||
throw new AdempiereUserError(Msg.parseTranslation(getCtx(), "@Mandatory@: @C_AllocationHdr_ID@"));
|
throw new AdempiereUserError(Msg.parseTranslation(getCtx(), "@Mandatory@: @C_AllocationHdr_ID@"));
|
||||||
|
|
||||||
m_trx = Trx.get(Trx.createTrxName("AllocReset"), true);
|
m_trx = Trx.get(Trx.createTrxName("AllocReset"), true);
|
||||||
|
m_trx.setDisplayName(getClass().getName()+"_doIt");
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
if (p_C_AllocationHdr_ID != 0)
|
if (p_C_AllocationHdr_ID != 0)
|
||||||
|
|
|
@ -209,6 +209,7 @@ public class RequestEMailProcessor extends SvrProcess implements ProcessEmailHan
|
||||||
Trx trxRequest = null;
|
Trx trxRequest = null;
|
||||||
try {
|
try {
|
||||||
trxRequest = Trx.get(Trx.createTrxName("SvrProcess-makerequest"), true);
|
trxRequest = Trx.get(Trx.createTrxName("SvrProcess-makerequest"), true);
|
||||||
|
trxRequest.setDisplayName(getClass().getName()+"_processEmailContent");
|
||||||
trxRequest.start();
|
trxRequest.start();
|
||||||
|
|
||||||
createRequest(emailHeader, trxRequest.getTrxName());
|
createRequest(emailHeader, trxRequest.getTrxName());
|
||||||
|
|
|
@ -208,6 +208,7 @@ public class UUIDGenerator extends SvrProcess {
|
||||||
Trx trx = trxName != null ? Trx.get(trxName, false) : null;
|
Trx trx = trxName != null ? Trx.get(trxName, false) : null;
|
||||||
if (trx == null) {
|
if (trx == null) {
|
||||||
trx = Trx.get(Trx.createTrxName(), true);
|
trx = Trx.get(Trx.createTrxName(), true);
|
||||||
|
trx.setDisplayName(UUIDGenerator.class.getName()+"_updateUUID");
|
||||||
localTrx = true;
|
localTrx = true;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -225,8 +225,10 @@ public final class ProcessUtil {
|
||||||
MRule.setContext(engine, ctx, 0); // no window
|
MRule.setContext(engine, ctx, 0); // no window
|
||||||
// now add the method arguments to the engine
|
// now add the method arguments to the engine
|
||||||
engine.put(MRule.ARGUMENTS_PREFIX + "Ctx", ctx);
|
engine.put(MRule.ARGUMENTS_PREFIX + "Ctx", ctx);
|
||||||
if (trx == null)
|
if (trx == null) {
|
||||||
trx = Trx.get(Trx.createTrxName(pi.getTitle()+"_"+pi.getAD_PInstance_ID()), true);
|
trx = Trx.get(Trx.createTrxName(pi.getTitle()+"_"+pi.getAD_PInstance_ID()), true);
|
||||||
|
trx.setDisplayName(ProcessUtil.class.getName()+"_startScriptProcess");
|
||||||
|
}
|
||||||
engine.put(MRule.ARGUMENTS_PREFIX + "Trx", trx);
|
engine.put(MRule.ARGUMENTS_PREFIX + "Trx", trx);
|
||||||
engine.put(MRule.ARGUMENTS_PREFIX + "TrxName", trx.getTrxName());
|
engine.put(MRule.ARGUMENTS_PREFIX + "TrxName", trx.getTrxName());
|
||||||
engine.put(MRule.ARGUMENTS_PREFIX + "Record_ID", pi.getRecord_ID());
|
engine.put(MRule.ARGUMENTS_PREFIX + "Record_ID", pi.getRecord_ID());
|
||||||
|
|
|
@ -258,10 +258,28 @@ public abstract class Doc
|
||||||
String error = null;
|
String error = null;
|
||||||
MAcctSchema[] ass = MAcctSchema.getClientAcctSchema(Env.getCtx(), AD_Client_ID);
|
MAcctSchema[] ass = MAcctSchema.getClientAcctSchema(Env.getCtx(), AD_Client_ID);
|
||||||
Trx trx = Trx.get(Trx.createTrxName("ManulPosting"), true);
|
Trx trx = Trx.get(Trx.createTrxName("ManulPosting"), true);
|
||||||
|
trx.setDisplayName(Doc.class.getName()+"_manualPosting");
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
//Costing: Post MatchPO before MR
|
||||||
|
if (AD_Table_ID == MInOut.Table_ID)
|
||||||
|
{
|
||||||
|
MMatchPO[] matchPos = MMatchPO.getInOut(Env.getCtx(), Record_ID, trx.getTrxName());
|
||||||
|
for (MMatchPO matchPo : matchPos)
|
||||||
|
{
|
||||||
|
if (!matchPo.isPosted())
|
||||||
|
{
|
||||||
|
error = postImmediate(ass, matchPo.get_Table_ID(), matchPo.get_ID(), force, matchPo.get_TrxName());
|
||||||
|
if (!Util.isEmpty(error))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Util.isEmpty(error))
|
||||||
{
|
{
|
||||||
error = postImmediate(ass, AD_Table_ID, Record_ID, force, trx.getTrxName());
|
error = postImmediate(ass, AD_Table_ID, Record_ID, force, trx.getTrxName());
|
||||||
//Average Costing: Post MatchPO and MatchInv together with MR and Invoice
|
}
|
||||||
|
//Costing: Post MatchInv after Invoice
|
||||||
if (Util.isEmpty(error))
|
if (Util.isEmpty(error))
|
||||||
{
|
{
|
||||||
if (AD_Table_ID == MInvoice.Table_ID)
|
if (AD_Table_ID == MInvoice.Table_ID)
|
||||||
|
@ -276,20 +294,6 @@ public abstract class Doc
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
else if (AD_Table_ID == MInOut.Table_ID)
|
|
||||||
{
|
|
||||||
MMatchPO[] matchPos = MMatchPO.getInOut(Env.getCtx(), Record_ID, trx.getTrxName());
|
|
||||||
for (MMatchPO matchPo : matchPos)
|
|
||||||
{
|
|
||||||
if (!matchPo.isPosted())
|
|
||||||
{
|
|
||||||
error = postImmediate(ass, matchPo.get_Table_ID(), matchPo.get_ID(), force, matchPo.get_TrxName());
|
|
||||||
if (!Util.isEmpty(error))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Util.isEmpty(error))
|
if (Util.isEmpty(error))
|
||||||
|
|
|
@ -286,32 +286,45 @@ public class DocManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
Trx trx = Trx.get(trxName, true);
|
Trx trx = Trx.get(trxName, true);
|
||||||
|
if (localTrxName != null)
|
||||||
|
trx.setDisplayName(DocManager.class.getName()+"_postDocument");
|
||||||
String error = null;
|
String error = null;
|
||||||
|
Savepoint savepoint = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
savepoint = localTrxName == null ? trx.setSavepoint(null) : null;
|
||||||
String status = "";
|
String status = "";
|
||||||
for(MAcctSchema as : ass)
|
for(MAcctSchema as : ass)
|
||||||
{
|
{
|
||||||
Doc doc = Doc.get (as, AD_Table_ID, rs, trxName);
|
Doc doc = Doc.get (as, AD_Table_ID, rs, trxName);
|
||||||
if (doc != null)
|
if (doc != null)
|
||||||
{
|
{
|
||||||
Savepoint savepoint = trx.setSavepoint(null);
|
|
||||||
error = doc.post (force, repost); // repost
|
error = doc.post (force, repost); // repost
|
||||||
status = doc.getPostStatus();
|
status = doc.getPostStatus();
|
||||||
if (error != null && error.trim().length() > 0)
|
if (error != null && error.trim().length() > 0)
|
||||||
|
{
|
||||||
|
if (savepoint != null)
|
||||||
{
|
{
|
||||||
trx.rollback(savepoint);
|
trx.rollback(savepoint);
|
||||||
|
savepoint = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
trx.rollback();
|
||||||
|
s_log.info("Error Posting " + doc + " to " + as + " Error: " + error);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
trx.releaseSavepoint(savepoint);
|
|
||||||
} catch (Exception e) {}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (savepoint != null)
|
||||||
|
{
|
||||||
|
trx.rollback(savepoint);
|
||||||
|
savepoint = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
trx.rollback();
|
||||||
|
|
||||||
|
s_log.info("Error Posting " + doc + " to " + as + " Error: NoDoc");
|
||||||
return "NoDoc";
|
return "NoDoc";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -326,22 +339,38 @@ public class DocManager {
|
||||||
if (localTrxName != null) {
|
if (localTrxName != null) {
|
||||||
if (trx != null)
|
if (trx != null)
|
||||||
trx.rollback();
|
trx.rollback();
|
||||||
|
} else if (trx != null && savepoint != null) {
|
||||||
|
trx.rollback(savepoint);
|
||||||
|
savepoint = null;
|
||||||
}
|
}
|
||||||
if (dbError != null)
|
if (dbError != null)
|
||||||
error = dbError.getValue();
|
error = dbError.getValue();
|
||||||
else
|
else
|
||||||
error = "SaveError";
|
error = "SaveError";
|
||||||
}
|
}
|
||||||
if (localTrxName != null) {
|
if (savepoint != null)
|
||||||
if (trx != null)
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
trx.releaseSavepoint(savepoint);
|
||||||
|
} catch (SQLException e1) {}
|
||||||
|
savepoint = null;
|
||||||
|
}
|
||||||
|
if (localTrxName != null && error == null) {
|
||||||
|
if (trx != null) {
|
||||||
trx.commit();
|
trx.commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
if (localTrxName != null) {
|
if (localTrxName != null) {
|
||||||
if (trx != null)
|
if (trx != null)
|
||||||
trx.rollback();
|
trx.rollback();
|
||||||
|
} else if (trx != null && savepoint != null) {
|
||||||
|
try {
|
||||||
|
trx.rollback(savepoint);
|
||||||
|
} catch (SQLException e1) {}
|
||||||
}
|
}
|
||||||
if (e instanceof RuntimeException)
|
if (e instanceof RuntimeException)
|
||||||
throw (RuntimeException) e;
|
throw (RuntimeException) e;
|
||||||
|
|
|
@ -187,9 +187,6 @@ public class Doc_MatchPO extends Doc
|
||||||
MInOut inOut = receiptLine.getParent();
|
MInOut inOut = receiptLine.getParent();
|
||||||
boolean isReturnTrx = inOut.getMovementType().equals(X_M_InOut.MOVEMENTTYPE_VendorReturns);
|
boolean isReturnTrx = inOut.getMovementType().equals(X_M_InOut.MOVEMENTTYPE_VendorReturns);
|
||||||
|
|
||||||
// calculate po cost
|
|
||||||
BigDecimal deliveredCost = poCost.multiply(getQty()); // Delivered so far
|
|
||||||
|
|
||||||
Map<Integer, BigDecimal> landedCostMap = new LinkedHashMap<Integer, BigDecimal>();
|
Map<Integer, BigDecimal> landedCostMap = new LinkedHashMap<Integer, BigDecimal>();
|
||||||
BigDecimal landedCost = BigDecimal.ZERO;
|
BigDecimal landedCost = BigDecimal.ZERO;
|
||||||
int C_OrderLine_ID = m_oLine.getC_OrderLine_ID();
|
int C_OrderLine_ID = m_oLine.getC_OrderLine_ID();
|
||||||
|
@ -230,7 +227,6 @@ public class Doc_MatchPO extends Doc
|
||||||
}
|
}
|
||||||
landedCostMap.put(elementId, elementAmt);
|
landedCostMap.put(elementId, elementAmt);
|
||||||
}
|
}
|
||||||
BigDecimal totalCost = deliveredCost.add(landedCost);
|
|
||||||
|
|
||||||
// Different currency
|
// Different currency
|
||||||
if (m_oLine.getC_Currency_ID() != as.getC_Currency_ID())
|
if (m_oLine.getC_Currency_ID() != as.getC_Currency_ID())
|
||||||
|
@ -258,6 +254,10 @@ public class Doc_MatchPO extends Doc
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// calculate po cost
|
||||||
|
BigDecimal deliveredCost = poCost.multiply(getQty()); // Delivered so far
|
||||||
|
BigDecimal totalCost = deliveredCost.add(landedCost);
|
||||||
|
|
||||||
// Calculate PPV for standard costing
|
// Calculate PPV for standard costing
|
||||||
MProduct product = MProduct.get(getCtx(), getM_Product_ID());
|
MProduct product = MProduct.get(getCtx(), getM_Product_ID());
|
||||||
String costingMethod = product.getCostingMethod(as);
|
String costingMethod = product.getCostingMethod(as);
|
||||||
|
|
|
@ -80,11 +80,10 @@ import org.idempiere.util.ParseSeq;
|
||||||
public class GridField
|
public class GridField
|
||||||
implements Serializable, Evaluatee, Cloneable
|
implements Serializable, Evaluatee, Cloneable
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -7739433012288022819L;
|
private static final long serialVersionUID = 2703129833179761682L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Field Constructor.
|
* Field Constructor.
|
||||||
|
@ -1069,6 +1068,7 @@ public class GridField
|
||||||
*/
|
*/
|
||||||
public boolean validateValueNoDirect()
|
public boolean validateValueNoDirect()
|
||||||
{
|
{
|
||||||
|
refreshLookup();
|
||||||
// null
|
// null
|
||||||
if (m_value == null || m_value.toString().length() == 0)
|
if (m_value == null || m_value.toString().length() == 0)
|
||||||
{
|
{
|
||||||
|
@ -1118,12 +1118,13 @@ public class GridField
|
||||||
setValue(null, m_inserting);
|
setValue(null, m_inserting);
|
||||||
m_error = true;
|
m_error = true;
|
||||||
return false;
|
return false;
|
||||||
} // validateValue
|
} // validateValueNoDirect
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate initial Field Value. Push direct value if it doesn't exist
|
* Validate initial Field Value. Push direct value if it doesn't exist
|
||||||
* Called from GridTab.setCurrentRow when inserting
|
* Called from GridTab.setCurrentRow when inserting
|
||||||
* @return true if valid
|
* @return true if valid
|
||||||
|
* @deprecated use validateValueNoDirect instead
|
||||||
*/
|
*/
|
||||||
public boolean validateValue()
|
public boolean validateValue()
|
||||||
{
|
{
|
||||||
|
@ -1166,7 +1167,7 @@ public class GridField
|
||||||
setValue(null, m_inserting);
|
setValue(null, m_inserting);
|
||||||
m_error = true;
|
m_error = true;
|
||||||
return false;
|
return false;
|
||||||
} // validateValuePushDirect
|
} // validateValue
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Is the Column Visible ?
|
* Is the Column Visible ?
|
||||||
|
|
|
@ -1180,11 +1180,6 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
return retValue;
|
return retValue;
|
||||||
setCurrentRow(m_currentRow + 1, true);
|
setCurrentRow(m_currentRow + 1, true);
|
||||||
|
|
||||||
// check validity of defaults
|
|
||||||
for (GridField field : getFields()) {
|
|
||||||
field.refreshLookup();
|
|
||||||
field.validateValueNoDirect();
|
|
||||||
}
|
|
||||||
// process all Callouts (no dependency check - assumed that settings are valid)
|
// process all Callouts (no dependency check - assumed that settings are valid)
|
||||||
for (int i = 0; i < getFieldCount(); i++)
|
for (int i = 0; i < getFieldCount(); i++)
|
||||||
processCallout(getField(i));
|
processCallout(getField(i));
|
||||||
|
@ -2585,8 +2580,6 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
{
|
{
|
||||||
Object value = m_mTable.getValueAt(m_currentRow, i);
|
Object value = m_mTable.getValueAt(m_currentRow, i);
|
||||||
mField.setValue(value, m_mTable.isInserting());
|
mField.setValue(value, m_mTable.isInserting());
|
||||||
if (m_mTable.isInserting()) // set invalid values to null
|
|
||||||
mField.validateValue();
|
|
||||||
if (mField.isKey())
|
if (mField.isKey())
|
||||||
keyCalloutDelayed = mField;
|
keyCalloutDelayed = mField;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2618,11 +2618,17 @@ public class GridTable extends AbstractTableModel
|
||||||
|| (hasDocTypeTargetField && field.getColumnName().equals("C_DocType_ID"))
|
|| (hasDocTypeTargetField && field.getColumnName().equals("C_DocType_ID"))
|
||||||
|| ! field.isAllowCopy())
|
|| ! field.isAllowCopy())
|
||||||
{
|
{
|
||||||
rowData[i] = field.getDefault();
|
Object value = field.getDefault();
|
||||||
field.setValue(rowData[i], m_inserting);
|
field.setValue(value, m_inserting);
|
||||||
|
field.validateValueNoDirect();
|
||||||
|
rowData[i] = field.getValue();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Object value = origData[i];
|
||||||
|
field.setValue(value, m_inserting);
|
||||||
|
field.validateValueNoDirect();
|
||||||
|
rowData[i] = field.getValue();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
rowData[i] = origData[i];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // new
|
else // new
|
||||||
|
@ -2630,8 +2636,10 @@ public class GridTable extends AbstractTableModel
|
||||||
for (int i = 0; i < size; i++)
|
for (int i = 0; i < size; i++)
|
||||||
{
|
{
|
||||||
GridField field = (GridField)m_fields.get(i);
|
GridField field = (GridField)m_fields.get(i);
|
||||||
rowData[i] = field.getDefault();
|
Object value = field.getDefault();
|
||||||
field.setValue(rowData[i], m_inserting);
|
field.setValue(value, m_inserting);
|
||||||
|
field.validateValueNoDirect();
|
||||||
|
rowData[i] = field.getValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3563,6 +3571,8 @@ public class GridTable extends AbstractTableModel
|
||||||
//https://jdbc.postgresql.org/documentation/head/query.html#query-with-cursor
|
//https://jdbc.postgresql.org/documentation/head/query.html#query-with-cursor
|
||||||
String trxName = m_virtual ? Trx.createTrxName("Loader") : null;
|
String trxName = m_virtual ? Trx.createTrxName("Loader") : null;
|
||||||
trx = trxName != null ? Trx.get(trxName, true) : null;
|
trx = trxName != null ? Trx.get(trxName, true) : null;
|
||||||
|
if (trx != null)
|
||||||
|
trx.setDisplayName(getClass().getName()+"_openResultSet");
|
||||||
// open Statement (closed by Loader.close)
|
// open Statement (closed by Loader.close)
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -454,6 +454,7 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
|
||||||
MFactAcct.deleteEx(Table_ID, getC_BankStatement_ID(), get_TrxName());
|
MFactAcct.deleteEx(Table_ID, getC_BankStatement_ID(), get_TrxName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isProcessed()) {
|
||||||
//Added Lines by AZ Goodwill
|
//Added Lines by AZ Goodwill
|
||||||
//Restore Bank Account Balance
|
//Restore Bank Account Balance
|
||||||
MBankAccount ba = getBankAccount();
|
MBankAccount ba = getBankAccount();
|
||||||
|
@ -461,6 +462,7 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
|
||||||
ba.setCurrentBalance(ba.getCurrentBalance().subtract(getStatementDifference()));
|
ba.setCurrentBalance(ba.getCurrentBalance().subtract(getStatementDifference()));
|
||||||
ba.saveEx();
|
ba.saveEx();
|
||||||
//End of Added Lines
|
//End of Added Lines
|
||||||
|
}
|
||||||
|
|
||||||
// Set lines to 0
|
// Set lines to 0
|
||||||
MBankStatementLine[] lines = getLines(true);
|
MBankStatementLine[] lines = getLines(true);
|
||||||
|
|
|
@ -163,6 +163,7 @@ public class MConversionRate extends X_C_Conversion_Rate
|
||||||
|
|
||||||
String trxName = Trx.createTrxName();
|
String trxName = Trx.createTrxName();
|
||||||
Trx trx = Trx.get(trxName, true);
|
Trx trx = Trx.get(trxName, true);
|
||||||
|
trx.setDisplayName(MConversionRate.class.getName()+"_setRate");
|
||||||
Properties ctx = Env.getCtx();
|
Properties ctx = Env.getCtx();
|
||||||
MCurrency curFrom = MCurrency.get(ctx, CurFrom_ISO);
|
MCurrency curFrom = MCurrency.get(ctx, CurFrom_ISO);
|
||||||
if (curFrom==null) throw new Exception("Invalid currency " + CurFrom_ISO);
|
if (curFrom==null) throw new Exception("Invalid currency " + CurFrom_ISO);
|
||||||
|
|
|
@ -638,6 +638,7 @@ public class MCost extends X_M_Cost
|
||||||
{
|
{
|
||||||
trxNameUsed = Trx.createTrxName("Cost");
|
trxNameUsed = Trx.createTrxName("Cost");
|
||||||
trx = Trx.get(trxNameUsed, true);
|
trx = Trx.get(trxNameUsed, true);
|
||||||
|
trx.setDisplayName(MCost.class.getName()+"_create");
|
||||||
}
|
}
|
||||||
boolean success = true;
|
boolean success = true;
|
||||||
// For all Products
|
// For all Products
|
||||||
|
|
|
@ -1263,10 +1263,11 @@ public class MCostDetail extends X_M_CostDetail
|
||||||
}
|
}
|
||||||
else if (addition)
|
else if (addition)
|
||||||
{
|
{
|
||||||
if (getM_ProductionLine().getM_Production().getReversal_ID() < 0)
|
MProductionLine productionLine = getM_ProductionLine_ID() > 0 ? new MProductionLine(getCtx(), getM_ProductionLine_ID(), get_TrxName()) : null;
|
||||||
cost.add(amt, qty);
|
if (productionLine != null && productionLine.getProductionReversalId() > 0)
|
||||||
else
|
|
||||||
cost.setCurrentQty(cost.getCurrentQty().add(qty));
|
cost.setCurrentQty(cost.getCurrentQty().add(qty));
|
||||||
|
else
|
||||||
|
cost.add(amt, qty);
|
||||||
|
|
||||||
// Initial
|
// Initial
|
||||||
if (cost.getCurrentCostPrice().signum() == 0
|
if (cost.getCurrentCostPrice().signum() == 0
|
||||||
|
|
|
@ -1428,20 +1428,10 @@ public class MInOut extends X_M_InOut implements DocAction
|
||||||
if (mtrx == null)
|
if (mtrx == null)
|
||||||
{
|
{
|
||||||
Timestamp dateMPolicy= null;
|
Timestamp dateMPolicy= null;
|
||||||
MStorageOnHand[] storages = null;
|
MStorageOnHand[] storages = MStorageOnHand.getWarehouse(getCtx(), 0,
|
||||||
if (sLine.getMovementQty().compareTo(Env.ZERO) > 0) {
|
|
||||||
// Find Date Material Policy bases on ASI
|
|
||||||
storages = MStorageOnHand.getWarehouse(getCtx(), 0,
|
|
||||||
sLine.getM_Product_ID(), sLine.getM_AttributeSetInstance_ID(), null,
|
sLine.getM_Product_ID(), sLine.getM_AttributeSetInstance_ID(), null,
|
||||||
MClient.MMPOLICY_FiFo.equals(product.getMMPolicy()), false,
|
MClient.MMPOLICY_FiFo.equals(product.getMMPolicy()), false,
|
||||||
sLine.getM_Locator_ID(), get_TrxName());
|
sLine.getM_Locator_ID(), get_TrxName());
|
||||||
} else {
|
|
||||||
//Case of reversal
|
|
||||||
storages = MStorageOnHand.getWarehouse(getCtx(), 0,
|
|
||||||
sLine.getM_Product_ID(), sLine.getM_AttributeSetInstance_ID(), null,
|
|
||||||
MClient.MMPOLICY_FiFo.equals(product.getMMPolicy()), false,
|
|
||||||
sLine.getM_Locator_ID(), get_TrxName());
|
|
||||||
}
|
|
||||||
for (MStorageOnHand storage : storages) {
|
for (MStorageOnHand storage : storages) {
|
||||||
if (storage.getQtyOnHand().compareTo(sLine.getMovementQty()) >= 0) {
|
if (storage.getQtyOnHand().compareTo(sLine.getMovementQty()) >= 0) {
|
||||||
dateMPolicy = storage.getDateMaterialPolicy();
|
dateMPolicy = storage.getDateMaterialPolicy();
|
||||||
|
|
|
@ -778,6 +778,7 @@ public class MLocation extends X_C_Location implements Comparator<Object>
|
||||||
setErrorMessage(null);
|
setErrorMessage(null);
|
||||||
|
|
||||||
Trx trx = Trx.get(Trx.createTrxName("avt-"), true);
|
Trx trx = Trx.get(Trx.createTrxName("avt-"), true);
|
||||||
|
trx.setDisplayName(getClass().getName()+"_processOnline");
|
||||||
boolean ok = false;
|
boolean ok = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -854,7 +854,11 @@ public class MLookupFactory
|
||||||
for (int i = 0; i < size; i++)
|
for (int i = 0; i < size; i++)
|
||||||
{
|
{
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
displayColumn.append(" ||'_'|| " );
|
{
|
||||||
|
displayColumn.append(" ||'")
|
||||||
|
.append(MSysConfig.getValue(MSysConfig.IDENTIFIER_SEPARATOR, "_", Env.getAD_Client_ID(Env.getCtx())))
|
||||||
|
.append("'|| " );
|
||||||
|
}
|
||||||
LookupDisplayColumn ldc = (LookupDisplayColumn)list.get(i);
|
LookupDisplayColumn ldc = (LookupDisplayColumn)list.get(i);
|
||||||
StringBuilder msg = new StringBuilder().append(TableName).append(".").append(ldc.ColumnName);
|
StringBuilder msg = new StringBuilder().append(TableName).append(".").append(ldc.ColumnName);
|
||||||
String columnSQL = ldc.IsVirtual ? ldc.ColumnSQL : msg.toString();
|
String columnSQL = ldc.IsVirtual ? ldc.ColumnSQL : msg.toString();
|
||||||
|
|
|
@ -456,8 +456,11 @@ public class MMatchPO extends X_M_MatchPO
|
||||||
}
|
}
|
||||||
if (iLine != null)
|
if (iLine != null)
|
||||||
mpo.setC_InvoiceLine_ID(iLine);
|
mpo.setC_InvoiceLine_ID(iLine);
|
||||||
if (sLine != null)
|
if (sLine != null){
|
||||||
mpo.setM_InOutLine_ID(sLine.getM_InOutLine_ID());
|
mpo.setM_InOutLine_ID(sLine.getM_InOutLine_ID());
|
||||||
|
if (!mpo.isPosted())
|
||||||
|
mpo.setDateAcct(sLine.getParent().getDateAcct());
|
||||||
|
}
|
||||||
|
|
||||||
if (!mpo.save())
|
if (!mpo.save())
|
||||||
{
|
{
|
||||||
|
|
|
@ -283,6 +283,7 @@ public class MPackage extends X_M_Package
|
||||||
setErrorMessage(null);
|
setErrorMessage(null);
|
||||||
|
|
||||||
Trx trx = Trx.get(Trx.createTrxName("spt-"), true);
|
Trx trx = Trx.get(Trx.createTrxName("spt-"), true);
|
||||||
|
trx.setDisplayName(getClass().getName()+"_processOnline");
|
||||||
boolean ok = false;
|
boolean ok = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -279,6 +279,7 @@ public class MPaySelectionCheck extends X_C_PaySelectionCheck
|
||||||
localTrx = true;
|
localTrx = true;
|
||||||
trxName = Trx.createTrxName("ConfirmPrintSingle");
|
trxName = Trx.createTrxName("ConfirmPrintSingle");
|
||||||
trx = Trx.get(trxName, true);
|
trx = Trx.get(trxName, true);
|
||||||
|
trx.setDisplayName(MPaySelectionCheck.class.getName()+"_confirmPrint");
|
||||||
check.set_TrxName(trxName);
|
check.set_TrxName(trxName);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -397,6 +398,7 @@ public class MPaySelectionCheck extends X_C_PaySelectionCheck
|
||||||
localTrx = true;
|
localTrx = true;
|
||||||
trxName = Trx.createTrxName("ConfirmPrintMulti");
|
trxName = Trx.createTrxName("ConfirmPrintMulti");
|
||||||
trx = Trx.get(trxName, true);
|
trx = Trx.get(trxName, true);
|
||||||
|
trx.setDisplayName(MPaySelectionCheck.class.getName()+"_confirmPrints");
|
||||||
}
|
}
|
||||||
int lastDocumentNo = 0;
|
int lastDocumentNo = 0;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -565,6 +565,7 @@ public class MPayment extends X_C_Payment
|
||||||
setIsApproved(approved);
|
setIsApproved(approved);
|
||||||
|
|
||||||
Trx trx = Trx.get(Trx.createTrxName("ppt-"), true);
|
Trx trx = Trx.get(Trx.createTrxName("ppt-"), true);
|
||||||
|
trx.setDisplayName(getClass().getName()+"_processOnline");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -296,7 +296,7 @@ public class MPeriod extends X_C_Period
|
||||||
idxdate = po.get_ColumnIndex("DateAcct");
|
idxdate = po.get_ColumnIndex("DateAcct");
|
||||||
}
|
}
|
||||||
if (idxdate < 0) {
|
if (idxdate < 0) {
|
||||||
s_log.warning("Could not find DateAcct for " + table.getTableName());
|
if (s_log.isLoggable(Level.INFO)) s_log.info("Could not find DateAcct for " + table.getTableName());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Timestamp dateAcct = null;
|
Timestamp dateAcct = null;
|
||||||
|
|
|
@ -104,14 +104,13 @@ public class MProduction extends X_M_Production implements DocAction {
|
||||||
StringBuilder errors = new StringBuilder();
|
StringBuilder errors = new StringBuilder();
|
||||||
int processed = 0;
|
int processed = 0;
|
||||||
|
|
||||||
|
if (!isUseProductionPlan()) {
|
||||||
|
MProductionLine[] lines = getLines();
|
||||||
//IDEMPIERE-3107 Check if End Product in Production Lines exist
|
//IDEMPIERE-3107 Check if End Product in Production Lines exist
|
||||||
if(!isHaveEndProduct(getLines())) {
|
if(!isHaveEndProduct(lines)) {
|
||||||
m_processMsg = "Production does not contain End Product";
|
m_processMsg = "Production does not contain End Product";
|
||||||
return DocAction.STATUS_Invalid;
|
return DocAction.STATUS_Invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isUseProductionPlan()) {
|
|
||||||
MProductionLine[] lines = getLines();
|
|
||||||
errors.append(processLines(lines));
|
errors.append(processLines(lines));
|
||||||
if (errors.length() > 0) {
|
if (errors.length() > 0) {
|
||||||
m_processMsg = errors.toString();
|
m_processMsg = errors.toString();
|
||||||
|
@ -123,6 +122,13 @@ public class MProduction extends X_M_Production implements DocAction {
|
||||||
List<MProductionPlan> plans = planQuery.setParameters(getM_Production_ID()).list();
|
List<MProductionPlan> plans = planQuery.setParameters(getM_Production_ID()).list();
|
||||||
for(MProductionPlan plan : plans) {
|
for(MProductionPlan plan : plans) {
|
||||||
MProductionLine[] lines = plan.getLines();
|
MProductionLine[] lines = plan.getLines();
|
||||||
|
|
||||||
|
//IDEMPIERE-3107 Check if End Product in Production Lines exist
|
||||||
|
if(!isHaveEndProduct(lines)) {
|
||||||
|
m_processMsg = String.format("Production plan (line %1$d id %2$d) does not contain End Product", plan.getLine(), plan.get_ID());
|
||||||
|
return DocAction.STATUS_Invalid;
|
||||||
|
}
|
||||||
|
|
||||||
if (lines.length > 0) {
|
if (lines.length > 0) {
|
||||||
errors.append(processLines(lines));
|
errors.append(processLines(lines));
|
||||||
if (errors.length() > 0) {
|
if (errors.length() > 0) {
|
||||||
|
|
|
@ -78,7 +78,8 @@ public class MProductionLine extends X_M_ProductionLine {
|
||||||
* @return "" for success, error string if failed
|
* @return "" for success, error string if failed
|
||||||
*/
|
*/
|
||||||
public String createTransactions(Timestamp date, boolean mustBeStocked) {
|
public String createTransactions(Timestamp date, boolean mustBeStocked) {
|
||||||
if (getParent().getReversal_ID() <= 0 )
|
int reversalId = getProductionReversalId ();
|
||||||
|
if (reversalId <= 0 )
|
||||||
{
|
{
|
||||||
// delete existing ASI records
|
// delete existing ASI records
|
||||||
int deleted = deleteMA();
|
int deleted = deleteMA();
|
||||||
|
@ -106,7 +107,7 @@ public class MProductionLine extends X_M_ProductionLine {
|
||||||
if (log.isLoggable(Level.FINEST)) log.log(Level.FINEST, "asi Description is: " + asiString);
|
if (log.isLoggable(Level.FINEST)) log.log(Level.FINEST, "asi Description is: " + asiString);
|
||||||
// create transactions for finished goods
|
// create transactions for finished goods
|
||||||
if ( getM_Product_ID() == getEndProduct_ID()) {
|
if ( getM_Product_ID() == getEndProduct_ID()) {
|
||||||
if (getParent().getReversal_ID() <= 0 && isAutoGenerateLot && getM_AttributeSetInstance_ID() == 0)
|
if (reversalId <= 0 && isAutoGenerateLot && getM_AttributeSetInstance_ID() == 0)
|
||||||
{
|
{
|
||||||
asi = MAttributeSetInstance.generateLot(getCtx(), (MProduct)getM_Product(), get_TrxName());
|
asi = MAttributeSetInstance.generateLot(getCtx(), (MProduct)getM_Product(), get_TrxName());
|
||||||
setM_AttributeSetInstance_ID(asi.getM_AttributeSetInstance_ID());
|
setM_AttributeSetInstance_ID(asi.getM_AttributeSetInstance_ID());
|
||||||
|
@ -394,16 +395,16 @@ public class MProductionLine extends X_M_ProductionLine {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Parent
|
* Get Reversal_ID of parent production
|
||||||
* @return parent
|
* @return Reversal_ID
|
||||||
*/
|
*/
|
||||||
public MProduction getParent() {
|
public int getProductionReversalId() {
|
||||||
if (productionParent == null)
|
if (getM_Production_ID() > 0)
|
||||||
productionParent = new MProduction (getCtx(), getM_Production_ID(), get_TrxName());
|
return DB.getSQLValueEx(get_TrxName(), "SELECT Reversal_ID FROM M_Production WHERE M_Production_ID=?", getM_Production_ID());
|
||||||
return productionParent;
|
else
|
||||||
} // getParent
|
return DB.getSQLValueEx(get_TrxName(), "SELECT p.Reversal_ID FROM M_ProductionPlan pp INNER JOIN M_Production p ON (pp.M_Production_ID = p.M_Production_ID) WHERE pp.M_ProductionPlan_ID=?", getM_ProductionPlan_ID());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -116,6 +116,7 @@ public final class MSetup
|
||||||
String adminEmail, String userEmail, boolean isSetInitialPassword)
|
String adminEmail, String userEmail, boolean isSetInitialPassword)
|
||||||
{
|
{
|
||||||
log.info(clientName);
|
log.info(clientName);
|
||||||
|
m_trx.setDisplayName(getClass().getName()+"_createClient");
|
||||||
m_trx.start();
|
m_trx.start();
|
||||||
|
|
||||||
// info header
|
// info header
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class MSysConfig extends X_AD_SysConfig
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -3599797130058840418L;
|
private static final long serialVersionUID = -5006794875155447942L;
|
||||||
|
|
||||||
public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION";
|
public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION";
|
||||||
public static final String ALERT_SEND_ATTACHMENT_AS_XLS = "ALERT_SEND_ATTACHMENT_AS_XLS";
|
public static final String ALERT_SEND_ATTACHMENT_AS_XLS = "ALERT_SEND_ATTACHMENT_AS_XLS";
|
||||||
|
@ -59,6 +59,9 @@ public class MSysConfig extends X_AD_SysConfig
|
||||||
public static final String APPLICATION_MAIN_VERSION = "APPLICATION_MAIN_VERSION";
|
public static final String APPLICATION_MAIN_VERSION = "APPLICATION_MAIN_VERSION";
|
||||||
public static final String APPLICATION_MAIN_VERSION_SHOWN = "APPLICATION_MAIN_VERSION_SHOWN";
|
public static final String APPLICATION_MAIN_VERSION_SHOWN = "APPLICATION_MAIN_VERSION_SHOWN";
|
||||||
public static final String APPLICATION_OS_INFO_SHOWN = "APPLICATION_OS_INFO_SHOWN";
|
public static final String APPLICATION_OS_INFO_SHOWN = "APPLICATION_OS_INFO_SHOWN";
|
||||||
|
public static final String AUTOMATIC_PACKIN_PROCESSING = "AUTOMATIC_PACKIN_PROCESSING";
|
||||||
|
public static final String AUTOMATIC_PACKIN_TIMEOUT = "AUTOMATIC_PACKIN_TIMEOUT";
|
||||||
|
public static final String AUTOMATIC_PACKIN_RETRIES = "AUTOMATIC_PACKIN_RETRIES";
|
||||||
public static final String ATTACH_EMBEDDED_2PACK = "ATTACH_EMBEDDED_2PACK";
|
public static final String ATTACH_EMBEDDED_2PACK = "ATTACH_EMBEDDED_2PACK";
|
||||||
public static final String BACKGROUND_JOB_ALLOWED = "BACKGROUND_JOB_ALLOWED";
|
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_BY_DEFAULT = "BACKGROUND_JOB_BY_DEFAULT";
|
||||||
|
@ -85,6 +88,7 @@ public class MSysConfig extends X_AD_SysConfig
|
||||||
public static final String GRIDTABLE_LOAD_TIMEOUT_IN_SECONDS = "GRIDTABLE_LOAD_TIMEOUT_IN_SECONDS";
|
public static final String GRIDTABLE_LOAD_TIMEOUT_IN_SECONDS = "GRIDTABLE_LOAD_TIMEOUT_IN_SECONDS";
|
||||||
public static final String HTML_REPORT_THEME = "HTML_REPORT_THEME";
|
public static final String HTML_REPORT_THEME = "HTML_REPORT_THEME";
|
||||||
public static final String IBAN_VALIDATION = "IBAN_VALIDATION" ;
|
public static final String IBAN_VALIDATION = "IBAN_VALIDATION" ;
|
||||||
|
public static final String IDENTIFIER_SEPARATOR = "IDENTIFIER_SEPARATOR" ;
|
||||||
public static final String Invoice_ReverseUseNewNumber = "Invoice_ReverseUseNewNumber";
|
public static final String Invoice_ReverseUseNewNumber = "Invoice_ReverseUseNewNumber";
|
||||||
public static final String JASPER_SWAP_MAX_PAGES = "JASPER_SWAP_MAX_PAGES";
|
public static final String JASPER_SWAP_MAX_PAGES = "JASPER_SWAP_MAX_PAGES";
|
||||||
public static final String LASTRUN_RECORD_COUNT = "LASTRUN_RECORD_COUNT";
|
public static final String LASTRUN_RECORD_COUNT = "LASTRUN_RECORD_COUNT";
|
||||||
|
@ -132,6 +136,7 @@ public class MSysConfig extends X_AD_SysConfig
|
||||||
public static final String SYSTEM_IN_MAINTENANCE_MODE = "SYSTEM_IN_MAINTENANCE_MODE";
|
public static final String SYSTEM_IN_MAINTENANCE_MODE = "SYSTEM_IN_MAINTENANCE_MODE";
|
||||||
public static final String SYSTEM_INSERT_CHANGELOG = "SYSTEM_INSERT_CHANGELOG";
|
public static final String SYSTEM_INSERT_CHANGELOG = "SYSTEM_INSERT_CHANGELOG";
|
||||||
public static final String SYSTEM_NATIVE_SEQUENCE = "SYSTEM_NATIVE_SEQUENCE";
|
public static final String SYSTEM_NATIVE_SEQUENCE = "SYSTEM_NATIVE_SEQUENCE";
|
||||||
|
public static final String TRACE_ALL_TRX_CONNECTION_GET = "TRACE_ALL_TRX_CONNECTION_GET";
|
||||||
public static final String TWOPACK_COMMIT_DDL = "2PACK_COMMIT_DDL";
|
public static final String TWOPACK_COMMIT_DDL = "2PACK_COMMIT_DDL";
|
||||||
public static final String TWOPACK_HANDLE_TRANSLATIONS = "2PACK_HANDLE_TRANSLATIONS";
|
public static final String TWOPACK_HANDLE_TRANSLATIONS = "2PACK_HANDLE_TRANSLATIONS";
|
||||||
public static final String USE_EMAIL_FOR_LOGIN = "USE_EMAIL_FOR_LOGIN";
|
public static final String USE_EMAIL_FOR_LOGIN = "USE_EMAIL_FOR_LOGIN";
|
||||||
|
|
|
@ -89,6 +89,8 @@ public class Obscure extends Object
|
||||||
public static final String OBSCURETYPE_ObscureAlphaNumericButFirstLast4 = "A44";
|
public static final String OBSCURETYPE_ObscureAlphaNumericButFirstLast4 = "A44";
|
||||||
/** Obscure AlphaNumeric but last 4 = A04 */
|
/** Obscure AlphaNumeric but last 4 = A04 */
|
||||||
public static final String OBSCURETYPE_ObscureAlphaNumericButLast4 = "A04";
|
public static final String OBSCURETYPE_ObscureAlphaNumericButLast4 = "A04";
|
||||||
|
/** Obscure by max 10 asterisk characters, use for EncryptedField - internal, not in the list of obscure type field */
|
||||||
|
public static final String OBSCURETYPE_ObscureMaskMax10Asterisk = "AA";
|
||||||
|
|
||||||
/** Obscure Type */
|
/** Obscure Type */
|
||||||
private String m_type = OBSCURETYPE_ObscureDigitsButLast4;
|
private String m_type = OBSCURETYPE_ObscureDigitsButLast4;
|
||||||
|
@ -103,13 +105,18 @@ public class Obscure extends Object
|
||||||
*/
|
*/
|
||||||
public void setType (String obscureType)
|
public void setType (String obscureType)
|
||||||
{
|
{
|
||||||
if (obscureType == null || obscureType.equals("904") || obscureType.equals("944") || obscureType.equals("A44") || obscureType.equals("A04"))
|
if ( obscureType == null
|
||||||
|
|| OBSCURETYPE_ObscureDigitsButLast4.equals(obscureType)
|
||||||
|
|| OBSCURETYPE_ObscureDigitsButFirstLast4.equals(obscureType)
|
||||||
|
|| OBSCURETYPE_ObscureAlphaNumericButFirstLast4.equals(obscureType)
|
||||||
|
|| OBSCURETYPE_ObscureAlphaNumericButLast4.equals(obscureType)
|
||||||
|
|| OBSCURETYPE_ObscureMaskMax10Asterisk.equals(obscureType))
|
||||||
{
|
{
|
||||||
m_type = obscureType;
|
m_type = obscureType;
|
||||||
m_obscuredValue = null;
|
m_obscuredValue = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
throw new IllegalArgumentException ("ObscureType Invalid value - Reference_ID=291 - 904 - 944 - A44 - A04");
|
throw new IllegalArgumentException ("ObscureType Invalid value - Reference_ID=291 - 904 - 944 - A44 - A04 - AA");
|
||||||
} // setType
|
} // setType
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -140,6 +147,17 @@ public class Obscure extends Object
|
||||||
m_obscuredValue = null;
|
m_obscuredValue = null;
|
||||||
} // setClearValue
|
} // setClearValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Obscured Value
|
||||||
|
* @param clearValue The clearValue to set.
|
||||||
|
* @param maxlength maximum length of the obscured value
|
||||||
|
* @return Returns the obscuredValue.
|
||||||
|
*/
|
||||||
|
public String getObscuredValue(String clearValue, int maxlength) {
|
||||||
|
setClearValue(clearValue);
|
||||||
|
return getObscuredValue(maxlength);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Obscured Value
|
* Get Obscured Value
|
||||||
* @param clearValue The clearValue to set.
|
* @param clearValue The clearValue to set.
|
||||||
|
@ -151,6 +169,19 @@ public class Obscure extends Object
|
||||||
return getObscuredValue();
|
return getObscuredValue();
|
||||||
} // getObscuredValue
|
} // getObscuredValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Obscured Value with a max length
|
||||||
|
* @param maxlength maximum length of the obscured value
|
||||||
|
* @return Returns the obscuredValue.
|
||||||
|
*/
|
||||||
|
public String getObscuredValue(int maxlength) {
|
||||||
|
String obs = getObscuredValue();
|
||||||
|
if (maxlength > 0 && obs.length() > maxlength) {
|
||||||
|
obs = obs.substring(0, maxlength);
|
||||||
|
}
|
||||||
|
return obs;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Obscured Value
|
* Get Obscured Value
|
||||||
* @return Returns the obscuredValue.
|
* @return Returns the obscuredValue.
|
||||||
|
@ -161,6 +192,11 @@ public class Obscure extends Object
|
||||||
return m_obscuredValue;
|
return m_obscuredValue;
|
||||||
if (m_clearValue == null || m_clearValue.length() == 0)
|
if (m_clearValue == null || m_clearValue.length() == 0)
|
||||||
return m_clearValue;
|
return m_clearValue;
|
||||||
|
|
||||||
|
if (OBSCURETYPE_ObscureMaskMax10Asterisk.equals(m_type)){
|
||||||
|
return "**********";
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
boolean alpha = m_type.charAt(0) == 'A';
|
boolean alpha = m_type.charAt(0) == 'A';
|
||||||
int clearStart = Integer.parseInt(m_type.substring(1,2));
|
int clearStart = Integer.parseInt(m_type.substring(1,2));
|
||||||
|
@ -198,5 +234,4 @@ public class Obscure extends Object
|
||||||
System.out.println (Obscure.obscure("1a2b3c4d5e6f7g8h9"));
|
System.out.println (Obscure.obscure("1a2b3c4d5e6f7g8h9"));
|
||||||
} // main
|
} // main
|
||||||
|
|
||||||
|
} // Obscure
|
||||||
} // Obscrure
|
|
||||||
|
|
|
@ -2047,6 +2047,8 @@ public abstract class PO
|
||||||
l_trxname.setLength(23);
|
l_trxname.setLength(23);
|
||||||
m_trxName = Trx.createTrxName(l_trxname.toString());
|
m_trxName = Trx.createTrxName(l_trxname.toString());
|
||||||
localTrx = Trx.get(m_trxName, true);
|
localTrx = Trx.get(m_trxName, true);
|
||||||
|
localTrx.setDisplayName(getClass().getName()+"_save");
|
||||||
|
localTrx.getConnection();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -3171,6 +3173,8 @@ public abstract class PO
|
||||||
{
|
{
|
||||||
localTrxName = Trx.createTrxName("POdel");
|
localTrxName = Trx.createTrxName("POdel");
|
||||||
localTrx = Trx.get(localTrxName, true);
|
localTrx = Trx.get(localTrxName, true);
|
||||||
|
localTrx.setDisplayName(getClass().getName()+"_delete");
|
||||||
|
localTrx.getConnection();
|
||||||
m_trxName = localTrxName;
|
m_trxName = localTrxName;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -264,6 +264,7 @@ public class CreateForeignKey extends SvrProcess {
|
||||||
Trx trx = null;
|
Trx trx = null;
|
||||||
try {
|
try {
|
||||||
trx = Trx.get(Trx.createTrxName("CreateForeignKey"), true);
|
trx = Trx.get(Trx.createTrxName("CreateForeignKey"), true);
|
||||||
|
trx.setDisplayName(getClass().getName()+"_process_dropConstraint");
|
||||||
int rvalue = DB.executeUpdate(sql.toString(), (Object[]) null, true, trx.getTrxName());
|
int rvalue = DB.executeUpdate(sql.toString(), (Object[]) null, true, trx.getTrxName());
|
||||||
addLog(0, null, new BigDecimal(rvalue), sql.toString());
|
addLog(0, null, new BigDecimal(rvalue), sql.toString());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -302,6 +303,7 @@ public class CreateForeignKey extends SvrProcess {
|
||||||
Trx trx = null;
|
Trx trx = null;
|
||||||
try {
|
try {
|
||||||
trx = Trx.get(Trx.createTrxName("CreateForeignKey"), true);
|
trx = Trx.get(Trx.createTrxName("CreateForeignKey"), true);
|
||||||
|
trx.setDisplayName(getClass().getName()+"_process_addConstraint");
|
||||||
int rvalue = DB.executeUpdate(sql.toString(), (Object[]) null, true, trx.getTrxName());
|
int rvalue = DB.executeUpdate(sql.toString(), (Object[]) null, true, trx.getTrxName());
|
||||||
addLog(0, null, new BigDecimal(rvalue), sql.toString());
|
addLog(0, null, new BigDecimal(rvalue), sql.toString());
|
||||||
if (rvalue == -1)
|
if (rvalue == -1)
|
||||||
|
|
|
@ -192,6 +192,7 @@ public class CreateTableIndex extends SvrProcess {
|
||||||
addLog(Msg.getMsg(getCtx(), "CreateTableIndexCreateTableIndex") + dbTableIndex.indexName);
|
addLog(Msg.getMsg(getCtx(), "CreateTableIndexCreateTableIndex") + dbTableIndex.indexName);
|
||||||
|
|
||||||
Trx trx = Trx.get(Trx.createTrxName("CreateTableIndex"), true);
|
Trx trx = Trx.get(Trx.createTrxName("CreateTableIndex"), true);
|
||||||
|
trx.setDisplayName(getClass().getName()+"_process_createMTableIndex");
|
||||||
try {
|
try {
|
||||||
MTableIndex tableIndex = new MTableIndex(getCtx(), 0, get_TrxName());
|
MTableIndex tableIndex = new MTableIndex(getCtx(), 0, get_TrxName());
|
||||||
tableIndex.setAD_Table_ID(table.getAD_Table_ID());
|
tableIndex.setAD_Table_ID(table.getAD_Table_ID());
|
||||||
|
@ -244,6 +245,7 @@ public class CreateTableIndex extends SvrProcess {
|
||||||
addLog(Msg.getMsg(getCtx(), "CreateTableIndexValidateTableIndex") + tableIndex.getName());
|
addLog(Msg.getMsg(getCtx(), "CreateTableIndexValidateTableIndex") + tableIndex.getName());
|
||||||
addLog(tableIndex.getAD_TableIndex_ID(), null, null, tableIndex.toString(), tableIndex.get_Table_ID(), tableIndex.getAD_TableIndex_ID());
|
addLog(tableIndex.getAD_TableIndex_ID(), null, null, tableIndex.toString(), tableIndex.get_Table_ID(), tableIndex.getAD_TableIndex_ID());
|
||||||
Trx trx = Trx.get(Trx.createTrxName("ValidateTableIndex"), true);
|
Trx trx = Trx.get(Trx.createTrxName("ValidateTableIndex"), true);
|
||||||
|
trx.setDisplayName(getClass().getName()+"_process_validateTableIndex");
|
||||||
try {
|
try {
|
||||||
String result = TableIndexValidate.validateTableIndex(getCtx(), tableIndex, trx.getTrxName(), getProcessInfo());
|
String result = TableIndexValidate.validateTableIndex(getCtx(), tableIndex, trx.getTrxName(), getProcessInfo());
|
||||||
addLog(result);
|
addLog(result);
|
||||||
|
|
|
@ -124,7 +124,10 @@ public abstract class SvrProcess implements ProcessCall
|
||||||
//*** Trx
|
//*** Trx
|
||||||
boolean localTrx = m_trx == null;
|
boolean localTrx = m_trx == null;
|
||||||
if (localTrx)
|
if (localTrx)
|
||||||
|
{
|
||||||
m_trx = Trx.get(Trx.createTrxName("SvrProcess"), true);
|
m_trx = Trx.get(Trx.createTrxName("SvrProcess"), true);
|
||||||
|
m_trx.setDisplayName(getClass().getName()+"_startProcess");
|
||||||
|
}
|
||||||
//
|
//
|
||||||
ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
|
ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
|
||||||
ClassLoader processLoader = getClass().getClassLoader();
|
ClassLoader processLoader = getClass().getClassLoader();
|
||||||
|
|
|
@ -1444,7 +1444,7 @@ public class Login
|
||||||
user.setFailedLoginCount(0);
|
user.setFailedLoginCount(0);
|
||||||
user.setDateLastLogin(new Timestamp(now));
|
user.setDateLastLogin(new Timestamp(now));
|
||||||
if (!user.save())
|
if (!user.save())
|
||||||
log.severe("Failed to update user record with date last login");
|
log.severe("Failed to update user record with date last login (" + user.getName() + " / clientID = " + user.getAD_Client_ID() + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (validButLocked)
|
else if (validButLocked)
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.util;
|
package org.compiere.util;
|
||||||
|
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.io.StringWriter;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Savepoint;
|
import java.sql.Savepoint;
|
||||||
|
@ -32,6 +34,7 @@ import java.util.logging.Level;
|
||||||
import org.adempiere.exceptions.AdempiereException;
|
import org.adempiere.exceptions.AdempiereException;
|
||||||
import org.adempiere.exceptions.DBException;
|
import org.adempiere.exceptions.DBException;
|
||||||
import org.compiere.Adempiere;
|
import org.compiere.Adempiere;
|
||||||
|
import org.compiere.model.MSysConfig;
|
||||||
import org.compiere.model.PO;
|
import org.compiere.model.PO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -85,6 +88,10 @@ public class Trx
|
||||||
|
|
||||||
private List<TrxEventListener> listeners = new ArrayList<TrxEventListener>();
|
private List<TrxEventListener> listeners = new ArrayList<TrxEventListener>();
|
||||||
|
|
||||||
|
protected Exception trace;
|
||||||
|
|
||||||
|
private String m_displayName;
|
||||||
|
|
||||||
public static void startTrxMonitor()
|
public static void startTrxMonitor()
|
||||||
{
|
{
|
||||||
Adempiere.getThreadPoolExecutor().scheduleWithFixedDelay(s_monitor, 5, 5, TimeUnit.MINUTES);
|
Adempiere.getThreadPoolExecutor().scheduleWithFixedDelay(s_monitor, 5, 5, TimeUnit.MINUTES);
|
||||||
|
@ -187,6 +194,8 @@ public class Trx
|
||||||
}
|
}
|
||||||
if (!isActive())
|
if (!isActive())
|
||||||
start();
|
start();
|
||||||
|
if (MSysConfig.getBooleanValue(MSysConfig.TRACE_ALL_TRX_CONNECTION_GET, false))
|
||||||
|
trace = new Exception();
|
||||||
return m_connection;
|
return m_connection;
|
||||||
} // getConnection
|
} // getConnection
|
||||||
|
|
||||||
|
@ -208,6 +217,7 @@ public class Trx
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, "connection", e);
|
log.log(Level.SEVERE, "connection", e);
|
||||||
}
|
}
|
||||||
|
trace = new Exception();
|
||||||
} // setConnection
|
} // setConnection
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -470,6 +480,7 @@ public class Trx
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_connection = null;
|
m_connection = null;
|
||||||
|
trace = null;
|
||||||
m_active = false;
|
m_active = false;
|
||||||
fireAfterCloseEvent();
|
fireAfterCloseEvent();
|
||||||
log.config(m_trxName);
|
log.config(m_trxName);
|
||||||
|
@ -538,7 +549,7 @@ public class Trx
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder("Trx[");
|
StringBuilder sb = new StringBuilder("Trx[");
|
||||||
sb.append(getTrxName())
|
sb.append(getDisplayName())
|
||||||
.append(",Active=").append(isActive())
|
.append(",Active=").append(isActive())
|
||||||
.append("]");
|
.append("]");
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
|
@ -664,6 +675,31 @@ public class Trx
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getStrackTrace()
|
||||||
|
{
|
||||||
|
if (trace != null)
|
||||||
|
{
|
||||||
|
StringWriter stringWriter = new StringWriter();
|
||||||
|
PrintWriter printWriter = new PrintWriter(stringWriter);
|
||||||
|
trace.printStackTrace(printWriter);
|
||||||
|
return stringWriter.getBuffer().toString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDisplayName()
|
||||||
|
{
|
||||||
|
return m_displayName != null ? m_displayName : m_trxName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDisplayName(String displayName)
|
||||||
|
{
|
||||||
|
m_displayName = displayName;
|
||||||
|
}
|
||||||
|
|
||||||
static class TrxMonitor implements Runnable
|
static class TrxMonitor implements Runnable
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -681,6 +717,10 @@ public class Trx
|
||||||
if (since > trxs[i].getTimeout() * 1000)
|
if (since > trxs[i].getTimeout() * 1000)
|
||||||
{
|
{
|
||||||
trxs[i].log.log(Level.WARNING, "Transaction timeout. Name="+trxs[i].getTrxName() + ", timeout(sec)="+(since / 1000));
|
trxs[i].log.log(Level.WARNING, "Transaction timeout. Name="+trxs[i].getTrxName() + ", timeout(sec)="+(since / 1000));
|
||||||
|
if (trxs[i].trace != null)
|
||||||
|
{
|
||||||
|
trxs[i].log.log(Level.WARNING, "Transaction timeout. Trace:\n" + trxs[i].getStrackTrace());
|
||||||
|
}
|
||||||
trxs[i].rollbackAndCloseOnTimeout();
|
trxs[i].rollbackAndCloseOnTimeout();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -695,4 +735,21 @@ public class Trx
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void finalize() throws Throwable {
|
||||||
|
if (m_connection != null && trace != null) {
|
||||||
|
final Trx me = this;
|
||||||
|
Adempiere.getThreadPoolExecutor().schedule(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (me.m_connection != null && me.trace != null) {
|
||||||
|
log.log(Level.WARNING, "Trx Not Close: " + me.getStrackTrace());
|
||||||
|
me.trace = null;
|
||||||
|
me.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 2, TimeUnit.SECONDS);
|
||||||
|
}
|
||||||
|
super.finalize();
|
||||||
|
}
|
||||||
} // Trx
|
} // Trx
|
||||||
|
|
|
@ -844,6 +844,8 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable
|
||||||
}
|
}
|
||||||
|
|
||||||
trx = Trx.get(get_TrxName(), true);
|
trx = Trx.get(get_TrxName(), true);
|
||||||
|
if (localTrx)
|
||||||
|
trx.setDisplayName(getClass().getName()+"_run");
|
||||||
|
|
||||||
Savepoint savepoint = null;
|
Savepoint savepoint = null;
|
||||||
|
|
||||||
|
|
|
@ -678,7 +678,10 @@ public class MWorkflow extends X_AD_Workflow
|
||||||
MWFProcess retValue = null;
|
MWFProcess retValue = null;
|
||||||
Trx localTrx = null;
|
Trx localTrx = null;
|
||||||
if (trxName == null)
|
if (trxName == null)
|
||||||
|
{
|
||||||
localTrx = Trx.get(Trx.createTrxName("WFP"), true);
|
localTrx = Trx.get(Trx.createTrxName("WFP"), true);
|
||||||
|
localTrx.setDisplayName(getClass().getName()+"_start");
|
||||||
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
retValue = new MWFProcess (this, pi, trxName != null ? trxName : localTrx.getTrxName());
|
retValue = new MWFProcess (this, pi, trxName != null ? trxName : localTrx.getTrxName());
|
||||||
|
|
|
@ -77,6 +77,7 @@ public class OrderTest implements Runnable
|
||||||
for (int i = 0; i < m_numberOrders; i++)
|
for (int i = 0; i < m_numberOrders; i++)
|
||||||
{
|
{
|
||||||
Trx trx = Trx.get(Trx.createTrxName("Test" + m_no + "_" + i),true);
|
Trx trx = Trx.get(Trx.createTrxName("Test" + m_no + "_" + i),true);
|
||||||
|
trx.setDisplayName(getClass().getName()+"_run");
|
||||||
trx.start();
|
trx.start();
|
||||||
//
|
//
|
||||||
MOrder order = new MOrder(Env.getCtx(),0,trx.getTrxName());
|
MOrder order = new MOrder(Env.getCtx(),0,trx.getTrxName());
|
||||||
|
|
|
@ -13,8 +13,6 @@ package org.adempiere.pipo.srv;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.util.concurrent.Semaphore;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.adempiere.base.IDictionaryService;
|
import org.adempiere.base.IDictionaryService;
|
||||||
|
@ -32,11 +30,8 @@ public class PipoDictionaryService implements IDictionaryService {
|
||||||
|
|
||||||
CLogger logger = CLogger.getCLogger(PipoDictionaryService.class.getName());
|
CLogger logger = CLogger.getCLogger(PipoDictionaryService.class.getName());
|
||||||
|
|
||||||
private final Semaphore semaphore;
|
|
||||||
|
|
||||||
public PipoDictionaryService() {
|
public PipoDictionaryService() {
|
||||||
super();
|
super();
|
||||||
semaphore = new Semaphore(1, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -49,13 +44,8 @@ public class PipoDictionaryService implements IDictionaryService {
|
||||||
X_AD_Package_Imp_Proc adPackageImp = null;
|
X_AD_Package_Imp_Proc adPackageImp = null;
|
||||||
PackIn packIn = null;
|
PackIn packIn = null;
|
||||||
try {
|
try {
|
||||||
try {
|
|
||||||
semaphore.tryAcquire(120, TimeUnit.SECONDS);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
semaphore.release();
|
|
||||||
semaphore.acquire();
|
|
||||||
}
|
|
||||||
trxName = Trx.createTrxName("PipoDS");
|
trxName = Trx.createTrxName("PipoDS");
|
||||||
|
Trx.get(trxName, true).setDisplayName(getClass().getName()+"_merge");
|
||||||
packIn = new PackIn();
|
packIn = new PackIn();
|
||||||
packIn.setPackageName(context.getBundle().getSymbolicName());
|
packIn.setPackageName(context.getBundle().getSymbolicName());
|
||||||
|
|
||||||
|
@ -65,11 +55,11 @@ public class PipoDictionaryService implements IDictionaryService {
|
||||||
//get package version from file name suffix or bundle header
|
//get package version from file name suffix or bundle header
|
||||||
String packageVersion = null;
|
String packageVersion = null;
|
||||||
String fileName = packageFile.getName();
|
String fileName = packageFile.getName();
|
||||||
int versionSeparatorPos = fileName.lastIndexOf("_");
|
int versionSeparatorPos = fileName.lastIndexOf("2Pack_");
|
||||||
if (versionSeparatorPos > 0) {
|
if (versionSeparatorPos > 0) {
|
||||||
int dotPos = fileName.lastIndexOf(".");
|
int dotPos = fileName.lastIndexOf(".");
|
||||||
if (dotPos > 0 && dotPos > versionSeparatorPos) {
|
if (dotPos > 0 && dotPos > versionSeparatorPos) {
|
||||||
String version = fileName.substring(versionSeparatorPos+1, dotPos);
|
String version = fileName.substring(versionSeparatorPos+"2Pack_".length(), dotPos);
|
||||||
if (version.split("[.]").length == 3) {
|
if (version.split("[.]").length == 3) {
|
||||||
packageVersion = version;
|
packageVersion = version;
|
||||||
}
|
}
|
||||||
|
@ -105,7 +95,7 @@ public class PipoDictionaryService implements IDictionaryService {
|
||||||
adPackageImp.setDateProcessed(new Timestamp(System.currentTimeMillis()));
|
adPackageImp.setDateProcessed(new Timestamp(System.currentTimeMillis()));
|
||||||
adPackageImp.setP_Msg(msg);
|
adPackageImp.setP_Msg(msg);
|
||||||
|
|
||||||
Trx.get(trxName, false).commit();
|
Trx.get(trxName, false).commit(true);
|
||||||
if (logger.isLoggable(Level.INFO)) logger.info("commit " + trxName);
|
if (logger.isLoggable(Level.INFO)) logger.info("commit " + trxName);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
adPackageImp.setP_Msg(e.getLocalizedMessage());
|
adPackageImp.setP_Msg(e.getLocalizedMessage());
|
||||||
|
@ -116,7 +106,6 @@ public class PipoDictionaryService implements IDictionaryService {
|
||||||
try {
|
try {
|
||||||
Trx.get(trxName, false).close();
|
Trx.get(trxName, false).close();
|
||||||
} catch (Exception e) {}
|
} catch (Exception e) {}
|
||||||
semaphore.release();
|
|
||||||
adPackageImp.save(); // ignoring exceptions
|
adPackageImp.save(); // ignoring exceptions
|
||||||
|
|
||||||
if (adPackageImp != null && packIn != null) {
|
if (adPackageImp != null && packIn != null) {
|
||||||
|
|
|
@ -312,8 +312,8 @@ public class PackInHandler extends DefaultHandler {
|
||||||
}
|
}
|
||||||
packIn.getNotifier().addStatusLine(packageStatus);
|
packIn.getNotifier().addStatusLine(packageStatus);
|
||||||
|
|
||||||
updPackageImpNoTrx();
|
updPackageImp(m_ctx.trx.getTrxName()); // do not set success until commit on PackInProcess, still can fail
|
||||||
updPackageImpInstNoTrx();
|
updPackageImpInst(m_ctx.trx.getTrxName());
|
||||||
|
|
||||||
//reset
|
//reset
|
||||||
setupHandlers();
|
setupHandlers();
|
||||||
|
@ -326,31 +326,31 @@ public class PackInHandler extends DefaultHandler {
|
||||||
} catch (RuntimeException re) {
|
} catch (RuntimeException re) {
|
||||||
packageStatus = "Import Failed";
|
packageStatus = "Import Failed";
|
||||||
packIn.getNotifier().addStatusLine(packageStatus);
|
packIn.getNotifier().addStatusLine(packageStatus);
|
||||||
updPackageImpNoTrx();
|
updPackageImp(null);
|
||||||
throw re;
|
throw re;
|
||||||
} catch (SAXException se) {
|
} catch (SAXException se) {
|
||||||
packageStatus = "Import Failed";
|
packageStatus = "Import Failed";
|
||||||
packIn.getNotifier().addStatusLine(packageStatus);
|
packIn.getNotifier().addStatusLine(packageStatus);
|
||||||
updPackageImpNoTrx();
|
updPackageImp(null);
|
||||||
throw se;
|
throw se;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // endElement
|
} // endElement
|
||||||
|
|
||||||
private void updPackageImpNoTrx() {
|
private void updPackageImp(String trxName) {
|
||||||
// NOTE: Updating out of model to avoid change log insert that can cause locks
|
// NOTE: Updating out of model to avoid change log insert that can cause locks
|
||||||
//Update package history log with package status
|
//Update package history log with package status
|
||||||
DB.executeUpdateEx("UPDATE AD_Package_Imp SET Processed=?, PK_Status=?, UpdatedBy=?, Updated=SYSDATE WHERE AD_Package_Imp_ID=?",
|
DB.executeUpdateEx("UPDATE AD_Package_Imp SET Processed=?, PK_Status=?, UpdatedBy=?, Updated=SYSDATE WHERE AD_Package_Imp_ID=?",
|
||||||
new Object[] {"Y", packageStatus, Env.getAD_User_ID(m_ctx.ctx), AD_Package_Imp_ID},
|
new Object[] {"Y", packageStatus, Env.getAD_User_ID(m_ctx.ctx), AD_Package_Imp_ID},
|
||||||
null);
|
trxName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updPackageImpInstNoTrx() {
|
private void updPackageImpInst(String trxName) {
|
||||||
// NOTE: Updating out of model to avoid change log insert that can cause locks
|
// NOTE: Updating out of model to avoid change log insert that can cause locks
|
||||||
DB.executeUpdateEx("UPDATE AD_Package_Imp_Inst SET PK_Status=?, UpdatedBy=?, Updated=SYSDATE WHERE AD_Package_Imp_Inst_ID=?",
|
DB.executeUpdateEx("UPDATE AD_Package_Imp_Inst SET PK_Status=?, UpdatedBy=?, Updated=SYSDATE WHERE AD_Package_Imp_Inst_ID=?",
|
||||||
new Object[] {packageStatus, Env.getAD_User_ID(m_ctx.ctx), AD_Package_Imp_Inst_ID},
|
new Object[] {packageStatus, Env.getAD_User_ID(m_ctx.ctx), AD_Package_Imp_Inst_ID},
|
||||||
null);
|
trxName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processDeferElements() throws SAXException {
|
private void processDeferElements() throws SAXException {
|
||||||
|
|
|
@ -41,6 +41,7 @@ Import-Package: org.adempiere.base,
|
||||||
org.apache.xerces.xs.datatypes;version="2.9.0",
|
org.apache.xerces.xs.datatypes;version="2.9.0",
|
||||||
org.apache.xml.serialize;version="2.9.0",
|
org.apache.xml.serialize;version="2.9.0",
|
||||||
org.compiere,
|
org.compiere,
|
||||||
|
org.compiere.db,
|
||||||
org.compiere.model,
|
org.compiere.model,
|
||||||
org.compiere.util,
|
org.compiere.util,
|
||||||
org.osgi.framework;version="1.5.0",
|
org.osgi.framework;version="1.5.0",
|
||||||
|
|
|
@ -0,0 +1,108 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Copyright (C) 2017 Diego Ruiz *
|
||||||
|
* Copyright (C) 2017 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.plugin.utils;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.adempiere.base.IDictionaryService;
|
||||||
|
import org.compiere.model.MSysConfig;
|
||||||
|
import org.compiere.model.PO;
|
||||||
|
import org.compiere.model.Query;
|
||||||
|
import org.compiere.model.X_AD_Package_Imp;
|
||||||
|
import org.compiere.util.AdempiereSystemError;
|
||||||
|
import org.compiere.util.CLogger;
|
||||||
|
import org.compiere.util.DB;
|
||||||
|
import org.compiere.util.Env;
|
||||||
|
import org.compiere.util.Trx;
|
||||||
|
import org.osgi.framework.BundleActivator;
|
||||||
|
import org.osgi.framework.BundleContext;
|
||||||
|
import org.osgi.util.tracker.ServiceTracker;
|
||||||
|
import org.osgi.util.tracker.ServiceTrackerCustomizer;
|
||||||
|
|
||||||
|
public abstract class AbstractActivator implements BundleActivator, ServiceTrackerCustomizer<IDictionaryService, IDictionaryService> {
|
||||||
|
|
||||||
|
protected final static CLogger logger = CLogger.getCLogger(AbstractActivator.class.getName());
|
||||||
|
protected BundleContext context;
|
||||||
|
protected ServiceTracker<IDictionaryService, IDictionaryService> serviceTracker;
|
||||||
|
protected IDictionaryService service;
|
||||||
|
private String trxName = "";
|
||||||
|
|
||||||
|
protected boolean merge(File zipfile, String version) throws Exception {
|
||||||
|
boolean success = false;
|
||||||
|
|
||||||
|
if (!installedPackage(version)) {
|
||||||
|
service.merge(context, zipfile);
|
||||||
|
success = true;
|
||||||
|
} else {
|
||||||
|
logger.log(Level.SEVERE, "The file was already installed: " + zipfile.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean installedPackage(String version) {
|
||||||
|
StringBuilder where = new StringBuilder("Name=? AND PK_Status = 'Completed successfully'");
|
||||||
|
Object[] params;
|
||||||
|
if (version != null) {
|
||||||
|
where.append(" AND PK_Version LIKE ?");
|
||||||
|
params = new Object[] { getName(), version + "%" };
|
||||||
|
} else {
|
||||||
|
params = new Object[] {getName()};
|
||||||
|
}
|
||||||
|
Query q = new Query(Env.getCtx(), X_AD_Package_Imp.Table_Name,
|
||||||
|
where.toString(), null);
|
||||||
|
q.setParameters(params);
|
||||||
|
return q.first() != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract String getName();
|
||||||
|
|
||||||
|
public boolean getDBLock() throws AdempiereSystemError {
|
||||||
|
int timeout = MSysConfig.getIntValue(MSysConfig.AUTOMATIC_PACKIN_TIMEOUT, 120);
|
||||||
|
int maxAttempts = MSysConfig.getIntValue(MSysConfig.AUTOMATIC_PACKIN_RETRIES, 5);
|
||||||
|
boolean lockAcquired = false;
|
||||||
|
|
||||||
|
while(maxAttempts > 0 && !lockAcquired) {
|
||||||
|
maxAttempts --;
|
||||||
|
if (getDBLock(timeout))
|
||||||
|
lockAcquired = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return lockAcquired;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void releaseLock() {
|
||||||
|
Trx.get(trxName, false).close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean getDBLock(int timeout) throws AdempiereSystemError {
|
||||||
|
return DB.getDatabase().forUpdate(getLockPO(), timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
private PO getLockPO() throws AdempiereSystemError {
|
||||||
|
MSysConfig sysconfig = new Query(Env.getCtx(), MSysConfig.Table_Name,
|
||||||
|
"Name=? AND AD_Client_ID=0", null)
|
||||||
|
.setParameters(MSysConfig.AUTOMATIC_PACKIN_PROCESSING)
|
||||||
|
.firstOnly();
|
||||||
|
if (sysconfig == null) {
|
||||||
|
throw new AdempiereSystemError(MSysConfig.AUTOMATIC_PACKIN_PROCESSING + " SysConfig does not exist");
|
||||||
|
}
|
||||||
|
|
||||||
|
trxName = Trx.createTrxName("ActSysTrx");
|
||||||
|
Trx.get(trxName, true).setDisplayName(getClass().getName()+"_getLockPO");
|
||||||
|
sysconfig.set_TrxName(trxName);
|
||||||
|
return sysconfig;
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,20 +14,16 @@ import org.compiere.model.Query;
|
||||||
import org.compiere.model.ServerStateChangeEvent;
|
import org.compiere.model.ServerStateChangeEvent;
|
||||||
import org.compiere.model.ServerStateChangeListener;
|
import org.compiere.model.ServerStateChangeListener;
|
||||||
import org.compiere.model.X_AD_Package_Imp;
|
import org.compiere.model.X_AD_Package_Imp;
|
||||||
|
import org.compiere.util.AdempiereSystemError;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.osgi.framework.BundleActivator;
|
|
||||||
import org.osgi.framework.BundleContext;
|
import org.osgi.framework.BundleContext;
|
||||||
import org.osgi.framework.ServiceReference;
|
import org.osgi.framework.ServiceReference;
|
||||||
import org.osgi.util.tracker.ServiceTracker;
|
import org.osgi.util.tracker.ServiceTracker;
|
||||||
import org.osgi.util.tracker.ServiceTrackerCustomizer;
|
|
||||||
|
|
||||||
public class AdempiereActivator implements BundleActivator, ServiceTrackerCustomizer<IDictionaryService, IDictionaryService> {
|
public class AdempiereActivator extends AbstractActivator {
|
||||||
|
|
||||||
protected final static CLogger logger = CLogger.getCLogger(AdempiereActivator.class.getName());
|
protected final static CLogger logger = CLogger.getCLogger(AdempiereActivator.class.getName());
|
||||||
private BundleContext context;
|
|
||||||
private ServiceTracker<IDictionaryService, IDictionaryService> serviceTracker;
|
|
||||||
private IDictionaryService service;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start(BundleContext context) throws Exception {
|
public void start(BundleContext context) throws Exception {
|
||||||
|
@ -53,6 +49,34 @@ public class AdempiereActivator implements BundleActivator, ServiceTrackerCustom
|
||||||
|
|
||||||
private void installPackage() {
|
private void installPackage() {
|
||||||
// e.g. 1.0.0.qualifier, check only the "1.0.0" part
|
// e.g. 1.0.0.qualifier, check only the "1.0.0" part
|
||||||
|
String version = getPKVersion();
|
||||||
|
|
||||||
|
String where = "Name=? AND PK_Version LIKE ?";
|
||||||
|
Query q = new Query(Env.getCtx(), X_AD_Package_Imp.Table_Name,
|
||||||
|
where.toString(), null);
|
||||||
|
q.setParameters(new Object[] { getName(), version + "%" });
|
||||||
|
X_AD_Package_Imp pkg = q.first();
|
||||||
|
if (pkg == null) {
|
||||||
|
try {
|
||||||
|
if (getDBLock()) {
|
||||||
|
System.out.println("Installing " + getName() + " " + version + " ...");
|
||||||
|
packIn();
|
||||||
|
install();
|
||||||
|
releaseLock();
|
||||||
|
System.out.println(getName() + " " + version + " installed.");
|
||||||
|
} else {
|
||||||
|
logger.log(Level.SEVERE, "Could not acquire the DB lock to install:" + getName());
|
||||||
|
}
|
||||||
|
} catch (AdempiereSystemError e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (logger.isLoggable(Level.INFO)) logger.info(getName() + " " + version + " was installed: "
|
||||||
|
+ pkg.getCreated());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getPKVersion() {
|
||||||
String version = getVersion();
|
String version = getVersion();
|
||||||
if (version != null)
|
if (version != null)
|
||||||
{
|
{
|
||||||
|
@ -74,21 +98,7 @@ public class AdempiereActivator implements BundleActivator, ServiceTrackerCustom
|
||||||
index = version.length();
|
index = version.length();
|
||||||
version = version.substring(0, index);
|
version = version.substring(0, index);
|
||||||
}
|
}
|
||||||
|
return version;
|
||||||
String where = "Name=? AND PK_Version LIKE ?";
|
|
||||||
Query q = new Query(Env.getCtx(), X_AD_Package_Imp.Table_Name,
|
|
||||||
where.toString(), null);
|
|
||||||
q.setParameters(new Object[] { getName(), version + "%" });
|
|
||||||
X_AD_Package_Imp pkg = q.first();
|
|
||||||
if (pkg == null) {
|
|
||||||
System.out.println("Installing " + getName() + " " + version + " ...");
|
|
||||||
packIn();
|
|
||||||
install();
|
|
||||||
System.out.println(getName() + " " + version + " installed.");
|
|
||||||
} else {
|
|
||||||
if (logger.isLoggable(Level.INFO)) logger.info(getName() + " " + version + " was installed: "
|
|
||||||
+ pkg.getCreated());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void packIn() {
|
protected void packIn() {
|
||||||
|
@ -106,7 +116,7 @@ public class AdempiereActivator implements BundleActivator, ServiceTrackerCustom
|
||||||
zipstream.write(buffer, 0, read);
|
zipstream.write(buffer, 0, read);
|
||||||
}
|
}
|
||||||
// call 2pack
|
// call 2pack
|
||||||
service.merge(context, zipfile);
|
merge(zipfile, getPKVersion());
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.log(Level.SEVERE, "Pack in failed.", e);
|
logger.log(Level.SEVERE, "Pack in failed.", e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,26 +32,22 @@ import org.compiere.model.Query;
|
||||||
import org.compiere.model.ServerStateChangeEvent;
|
import org.compiere.model.ServerStateChangeEvent;
|
||||||
import org.compiere.model.ServerStateChangeListener;
|
import org.compiere.model.ServerStateChangeListener;
|
||||||
import org.compiere.model.X_AD_Package_Imp;
|
import org.compiere.model.X_AD_Package_Imp;
|
||||||
|
import org.compiere.util.AdempiereSystemError;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Util;
|
import org.compiere.util.Trx;
|
||||||
import org.osgi.framework.BundleActivator;
|
|
||||||
import org.osgi.framework.BundleContext;
|
import org.osgi.framework.BundleContext;
|
||||||
import org.osgi.framework.ServiceReference;
|
import org.osgi.framework.ServiceReference;
|
||||||
import org.osgi.util.tracker.ServiceTracker;
|
import org.osgi.util.tracker.ServiceTracker;
|
||||||
import org.osgi.util.tracker.ServiceTrackerCustomizer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class Incremental2PackActivator implements BundleActivator, ServiceTrackerCustomizer<IDictionaryService, IDictionaryService> {
|
public class Incremental2PackActivator extends AbstractActivator {
|
||||||
|
|
||||||
protected final static CLogger logger = CLogger.getCLogger(Incremental2PackActivator.class.getName());
|
protected final static CLogger logger = CLogger.getCLogger(Incremental2PackActivator.class.getName());
|
||||||
private BundleContext context;
|
|
||||||
private ServiceTracker<IDictionaryService, IDictionaryService> serviceTracker;
|
|
||||||
private IDictionaryService service;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start(BundleContext context) throws Exception {
|
public void start(BundleContext context) throws Exception {
|
||||||
|
@ -87,37 +83,23 @@ public class Incremental2PackActivator implements BundleActivator, ServiceTracke
|
||||||
}
|
}
|
||||||
|
|
||||||
private void installPackage() {
|
private void installPackage() {
|
||||||
// e.g. 1.0.0.qualifier, check only the "1.0.0" part
|
|
||||||
String bundleVersionPart = getVersion();
|
|
||||||
String installedVersionPart = null;
|
|
||||||
String where = "Name=? AND PK_Status = 'Completed successfully'";
|
String where = "Name=? AND PK_Status = 'Completed successfully'";
|
||||||
Query q = new Query(Env.getCtx(), X_AD_Package_Imp.Table_Name,
|
Query q = new Query(Env.getCtx(), X_AD_Package_Imp.Table_Name,
|
||||||
where.toString(), null);
|
where.toString(), null);
|
||||||
q.setParameters(new Object[] { getName() });
|
q.setParameters(new Object[] { getName() });
|
||||||
List<X_AD_Package_Imp> pkgs = q.list();
|
List<X_AD_Package_Imp> pkgs = q.list();
|
||||||
|
List<String> installedVersions = new ArrayList<String>();
|
||||||
if (pkgs != null && !pkgs.isEmpty()) {
|
if (pkgs != null && !pkgs.isEmpty()) {
|
||||||
for(X_AD_Package_Imp pkg : pkgs) {
|
for(X_AD_Package_Imp pkg : pkgs) {
|
||||||
String packageVersionPart = pkg.getPK_Version();
|
String packageVersionPart = pkg.getPK_Version();
|
||||||
String[] part = packageVersionPart.split("[.]");
|
String[] part = packageVersionPart.split("[.]");
|
||||||
if (installedVersionPart == null) {
|
if (part.length > 3 && (packageVersionPart.indexOf(".v") > 0 || packageVersionPart.indexOf(".qualifier") > 0)) {
|
||||||
if (part.length > 3) {
|
|
||||||
installedVersionPart = part[0]+"."+part[1]+"."+part[2];
|
|
||||||
} else {
|
|
||||||
installedVersionPart = packageVersionPart;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Version installedVersion = new Version(installedVersionPart);
|
|
||||||
if (part.length > 3) {
|
|
||||||
packageVersionPart = part[0]+"."+part[1]+"."+part[2];
|
packageVersionPart = part[0]+"."+part[1]+"."+part[2];
|
||||||
}
|
}
|
||||||
Version packageVersion = new Version(packageVersionPart);
|
installedVersions.add(packageVersionPart);
|
||||||
if (packageVersion.compareTo(installedVersion) > 0) {
|
|
||||||
installedVersionPart = packageVersionPart;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
packIn(installedVersions);
|
||||||
}
|
|
||||||
packIn(installedVersionPart, bundleVersionPart);
|
|
||||||
afterPackIn();
|
afterPackIn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,31 +112,73 @@ public class Incremental2PackActivator implements BundleActivator, ServiceTracke
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void packIn(String installedVersionPart, String bundleVersionPart) {
|
protected void packIn(List<String> installedVersions) {
|
||||||
List<TwoPackEntry> list = new ArrayList<TwoPackEntry>();
|
List<TwoPackEntry> list = new ArrayList<TwoPackEntry>();
|
||||||
|
|
||||||
//2Pack_1.0.0.zip, 2Pack_1.0.1.zip, etc
|
//2Pack_1.0.0.zip, 2Pack_1.0.1.zip, etc
|
||||||
Enumeration<URL> urls = context.getBundle().findEntries("/META-INF", "2Pack_*.zip", false);
|
Enumeration<URL> urls = context.getBundle().findEntries("/META-INF", "2Pack_*.zip", false);
|
||||||
Version bundleVersion = new Version(bundleVersionPart);
|
|
||||||
if (!Util.isEmpty(installedVersionPart)) {
|
|
||||||
Version installedVersion = new Version(installedVersionPart);
|
|
||||||
while(urls.hasMoreElements()) {
|
while(urls.hasMoreElements()) {
|
||||||
URL u = urls.nextElement();
|
URL u = urls.nextElement();
|
||||||
String version = extractVersionString(u);
|
String version = extractVersionString(u);
|
||||||
Version packageVersion = new Version(version);
|
|
||||||
if (packageVersion.compareTo(bundleVersion) <= 0 && packageVersion.compareTo(installedVersion) > 0)
|
|
||||||
list.add(new TwoPackEntry(u, version));
|
list.add(new TwoPackEntry(u, version));
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
while(urls.hasMoreElements()) {
|
|
||||||
URL u = urls.nextElement();
|
|
||||||
String version = extractVersionString(u);
|
|
||||||
Version packageVersion = new Version(version);
|
|
||||||
if (packageVersion.compareTo(bundleVersion) <= 0)
|
|
||||||
list.add(new TwoPackEntry(u, version));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
X_AD_Package_Imp firstImp = new Query(Env.getCtx(), X_AD_Package_Imp.Table_Name, "Name=? AND PK_Version=? AND PK_Status=?", null)
|
||||||
|
.setParameters(getName(), "0.0.0", "Completed successfully")
|
||||||
|
.setClient_ID()
|
||||||
|
.first();
|
||||||
|
if (firstImp == null) {
|
||||||
|
Trx trx = Trx.get(Trx.createTrxName(), true);
|
||||||
|
trx.setDisplayName(getClass().getName()+"_packIn");
|
||||||
|
try {
|
||||||
|
Env.getCtx().put("#AD_Client_ID", 0);
|
||||||
|
|
||||||
|
firstImp = new X_AD_Package_Imp(Env.getCtx(), 0, trx.getTrxName());
|
||||||
|
firstImp.setName(getName());
|
||||||
|
firstImp.setPK_Version("0.0.0");
|
||||||
|
firstImp.setPK_Status("Completed successfully");
|
||||||
|
firstImp.setProcessed(true);
|
||||||
|
firstImp.saveEx();
|
||||||
|
|
||||||
|
if (list.size() > 0 && installedVersions.size() > 0) {
|
||||||
|
List<TwoPackEntry> newList = new ArrayList<TwoPackEntry>();
|
||||||
|
for(TwoPackEntry entry : list) {
|
||||||
|
boolean patch = false;
|
||||||
|
for(String v : installedVersions) {
|
||||||
|
Version v1 = new Version(entry.version);
|
||||||
|
Version v2 = new Version(v);
|
||||||
|
int c = v2.compareTo(v1);
|
||||||
|
if (c == 0) {
|
||||||
|
patch = false;
|
||||||
|
break;
|
||||||
|
} else if (c > 0) {
|
||||||
|
patch = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (patch) {
|
||||||
|
System.out.println("Patch Meta Data for " + getName() + " " + entry.version + " ...");
|
||||||
|
|
||||||
|
X_AD_Package_Imp pi = new X_AD_Package_Imp(Env.getCtx(), 0, trx.getTrxName());
|
||||||
|
pi.setName(getName());
|
||||||
|
pi.setPK_Version(entry.version);
|
||||||
|
pi.setPK_Status("Completed successfully");
|
||||||
|
pi.setProcessed(true);
|
||||||
|
pi.saveEx();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
newList.add(entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
list = newList;
|
||||||
|
}
|
||||||
|
trx.commit(true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
trx.rollback();
|
||||||
|
logger.log(Level.SEVERE, e.getLocalizedMessage(), e);
|
||||||
|
} finally {
|
||||||
|
trx.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
Collections.sort(list, new Comparator<TwoPackEntry>() {
|
Collections.sort(list, new Comparator<TwoPackEntry>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(TwoPackEntry o1, TwoPackEntry o2) {
|
public int compare(TwoPackEntry o1, TwoPackEntry o2) {
|
||||||
|
@ -162,32 +186,43 @@ public class Incremental2PackActivator implements BundleActivator, ServiceTracke
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (getDBLock()) {
|
||||||
for(TwoPackEntry entry : list) {
|
for(TwoPackEntry entry : list) {
|
||||||
|
if (!installedVersions.contains(entry.version)) {
|
||||||
if (!packIn(entry.url)) {
|
if (!packIn(entry.url)) {
|
||||||
// stop processing further packages if one fail
|
// stop processing further packages if one fail
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
releaseLock();
|
||||||
|
} else {
|
||||||
|
logger.log(Level.SEVERE, "Could not acquire the DB lock to install:" + getName());
|
||||||
|
}
|
||||||
|
} catch (AdempiereSystemError e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private String extractVersionString(URL u) {
|
private String extractVersionString(URL u) {
|
||||||
String p = u.getPath();
|
String p = u.getPath();
|
||||||
int upos=p.lastIndexOf("_");
|
int upos=p.lastIndexOf("2Pack_");
|
||||||
int dpos=p.lastIndexOf(".");
|
int dpos=p.lastIndexOf(".");
|
||||||
String v = p.substring(upos+1, dpos);
|
String v = p.substring(upos+"2Pack_".length(), dpos);
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean packIn(URL packout) {
|
protected boolean packIn(URL packout) {
|
||||||
if (packout != null && service != null) {
|
if (packout != null && service != null) {
|
||||||
String path = packout.getPath();
|
String path = packout.getPath();
|
||||||
String suffix = path.substring(path.lastIndexOf("_"));
|
String suffix = "_"+path.substring(path.lastIndexOf("2Pack_"));
|
||||||
System.out.println("Installing " + getName() + " " + path + " ...");
|
System.out.println("Installing " + getName() + " " + path + " ...");
|
||||||
FileOutputStream zipstream = null;
|
FileOutputStream zipstream = null;
|
||||||
try {
|
try {
|
||||||
// copy the resource to a temporary file to process it with 2pack
|
// copy the resource to a temporary file to process it with 2pack
|
||||||
InputStream stream = packout.openStream();
|
InputStream stream = packout.openStream();
|
||||||
File zipfile = File.createTempFile(getName(), suffix);
|
File zipfile = File.createTempFile(getName()+"_", suffix);
|
||||||
zipstream = new FileOutputStream(zipfile);
|
zipstream = new FileOutputStream(zipfile);
|
||||||
byte[] buffer = new byte[1024];
|
byte[] buffer = new byte[1024];
|
||||||
int read;
|
int read;
|
||||||
|
@ -195,7 +230,8 @@ public class Incremental2PackActivator implements BundleActivator, ServiceTracke
|
||||||
zipstream.write(buffer, 0, read);
|
zipstream.write(buffer, 0, read);
|
||||||
}
|
}
|
||||||
// call 2pack
|
// call 2pack
|
||||||
service.merge(context, zipfile);
|
if (!merge(zipfile, extractVersionString(packout)))
|
||||||
|
return false;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.log(Level.SEVERE, "Pack in failed.", e);
|
logger.log(Level.SEVERE, "Pack in failed.", e);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -0,0 +1,309 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Copyright (C) 2013 Heng Sin Low *
|
||||||
|
* Copyright (C) 2013 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.plugin.utils;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Properties;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.adempiere.base.IDictionaryService;
|
||||||
|
import org.adempiere.util.ServerContext;
|
||||||
|
import org.compiere.Adempiere;
|
||||||
|
import org.compiere.model.Query;
|
||||||
|
import org.compiere.model.ServerStateChangeEvent;
|
||||||
|
import org.compiere.model.ServerStateChangeListener;
|
||||||
|
import org.compiere.model.X_AD_Package_Imp;
|
||||||
|
import org.compiere.util.AdempiereSystemError;
|
||||||
|
import org.compiere.util.CLogger;
|
||||||
|
import org.compiere.util.Env;
|
||||||
|
import org.compiere.util.Util;
|
||||||
|
import org.osgi.framework.BundleContext;
|
||||||
|
import org.osgi.framework.ServiceReference;
|
||||||
|
import org.osgi.util.tracker.ServiceTracker;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author hengsin
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class Version2PackActivator extends AbstractActivator {
|
||||||
|
|
||||||
|
protected final static CLogger logger = CLogger.getCLogger(Version2PackActivator.class.getName());
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start(BundleContext context) throws Exception {
|
||||||
|
this.context = context;
|
||||||
|
if (logger.isLoggable(Level.INFO)) logger.info(getName() + " " + getVersion() + " starting...");
|
||||||
|
serviceTracker = new ServiceTracker<IDictionaryService, IDictionaryService>(context, IDictionaryService.class.getName(), this);
|
||||||
|
serviceTracker.open();
|
||||||
|
start();
|
||||||
|
if (logger.isLoggable(Level.INFO)) logger.info(getName() + " " + getVersion() + " ready.");
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return context.getBundle().getSymbolicName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVersion() {
|
||||||
|
String version = (String) context.getBundle().getHeaders().get("Bundle-Version");
|
||||||
|
// e.g. 1.0.0.qualifier, check only the "1.0.0" part
|
||||||
|
String[] components = version.split("[.]");
|
||||||
|
StringBuilder versionBuilder = new StringBuilder(components[0]);
|
||||||
|
if (components.length >= 3) {
|
||||||
|
versionBuilder.append(".").append(components[1]).append(".").append(components[2]);
|
||||||
|
} else if (components.length == 2) {
|
||||||
|
versionBuilder.append(".").append(components[1]).append(".0");
|
||||||
|
} else {
|
||||||
|
versionBuilder.append(".0.0");
|
||||||
|
}
|
||||||
|
return versionBuilder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void installPackage() {
|
||||||
|
// e.g. 1.0.0.qualifier, check only the "1.0.0" part
|
||||||
|
String bundleVersionPart = getVersion();
|
||||||
|
String installedVersionPart = null;
|
||||||
|
String where = "Name=? AND PK_Status = 'Completed successfully'";
|
||||||
|
Query q = new Query(Env.getCtx(), X_AD_Package_Imp.Table_Name,
|
||||||
|
where.toString(), null);
|
||||||
|
q.setParameters(new Object[] { getName() });
|
||||||
|
List<X_AD_Package_Imp> pkgs = q.list();
|
||||||
|
if (pkgs != null && !pkgs.isEmpty()) {
|
||||||
|
for(X_AD_Package_Imp pkg : pkgs) {
|
||||||
|
String packageVersionPart = pkg.getPK_Version();
|
||||||
|
String[] part = packageVersionPart.split("[.]");
|
||||||
|
if (installedVersionPart == null) {
|
||||||
|
if (part.length > 3) {
|
||||||
|
installedVersionPart = part[0]+"."+part[1]+"."+part[2];
|
||||||
|
} else {
|
||||||
|
installedVersionPart = packageVersionPart;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Version installedVersion = new Version(installedVersionPart);
|
||||||
|
if (part.length > 3) {
|
||||||
|
packageVersionPart = part[0]+"."+part[1]+"."+part[2];
|
||||||
|
}
|
||||||
|
Version packageVersion = new Version(packageVersionPart);
|
||||||
|
if (packageVersion.compareTo(installedVersion) > 0) {
|
||||||
|
installedVersionPart = packageVersionPart;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
packIn(installedVersionPart, bundleVersionPart);
|
||||||
|
afterPackIn();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class TwoPackEntry {
|
||||||
|
private URL url;
|
||||||
|
private String version;
|
||||||
|
private TwoPackEntry(URL url, String version) {
|
||||||
|
this.url=url;
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void packIn(String installedVersionPart, String bundleVersionPart) {
|
||||||
|
List<TwoPackEntry> list = new ArrayList<TwoPackEntry>();
|
||||||
|
|
||||||
|
//2Pack_1.0.0.zip, 2Pack_1.0.1.zip, etc
|
||||||
|
Enumeration<URL> urls = context.getBundle().findEntries("/META-INF", "2Pack_*.zip", false);
|
||||||
|
Version bundleVersion = new Version(bundleVersionPart);
|
||||||
|
if (!Util.isEmpty(installedVersionPart)) {
|
||||||
|
Version installedVersion = new Version(installedVersionPart);
|
||||||
|
while(urls.hasMoreElements()) {
|
||||||
|
URL u = urls.nextElement();
|
||||||
|
String version = extractVersionString(u);
|
||||||
|
Version packageVersion = new Version(version);
|
||||||
|
if (packageVersion.compareTo(bundleVersion) <= 0 && packageVersion.compareTo(installedVersion) > 0)
|
||||||
|
list.add(new TwoPackEntry(u, version));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
while(urls.hasMoreElements()) {
|
||||||
|
URL u = urls.nextElement();
|
||||||
|
String version = extractVersionString(u);
|
||||||
|
Version packageVersion = new Version(version);
|
||||||
|
if (packageVersion.compareTo(bundleVersion) <= 0)
|
||||||
|
list.add(new TwoPackEntry(u, version));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Collections.sort(list, new Comparator<TwoPackEntry>() {
|
||||||
|
@Override
|
||||||
|
public int compare(TwoPackEntry o1, TwoPackEntry o2) {
|
||||||
|
return new Version(o1.version).compareTo(new Version(o2.version));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (getDBLock()) {
|
||||||
|
for(TwoPackEntry entry : list) {
|
||||||
|
if (!packIn(entry.url)) {
|
||||||
|
// stop processing further packages if one fail
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
releaseLock();
|
||||||
|
} else {
|
||||||
|
logger.log(Level.SEVERE, "Could not acquire the DB lock to install:" + getName());
|
||||||
|
}
|
||||||
|
} catch (AdempiereSystemError e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String extractVersionString(URL u) {
|
||||||
|
String p = u.getPath();
|
||||||
|
int upos=p.lastIndexOf("_");
|
||||||
|
int dpos=p.lastIndexOf(".");
|
||||||
|
String v = p.substring(upos+1, dpos);
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean packIn(URL packout) {
|
||||||
|
if (packout != null && service != null) {
|
||||||
|
String path = packout.getPath();
|
||||||
|
String suffix = "_"+path.substring(path.lastIndexOf("2Pack_"));
|
||||||
|
System.out.println("Installing " + getName() + " " + path + " ...");
|
||||||
|
FileOutputStream zipstream = null;
|
||||||
|
try {
|
||||||
|
// copy the resource to a temporary file to process it with 2pack
|
||||||
|
InputStream stream = packout.openStream();
|
||||||
|
File zipfile = File.createTempFile(getName()+"_", suffix);
|
||||||
|
zipstream = new FileOutputStream(zipfile);
|
||||||
|
byte[] buffer = new byte[1024];
|
||||||
|
int read;
|
||||||
|
while((read = stream.read(buffer)) != -1){
|
||||||
|
zipstream.write(buffer, 0, read);
|
||||||
|
}
|
||||||
|
// call 2pack
|
||||||
|
if (!merge(zipfile, extractVersionString(packout)))
|
||||||
|
return false;
|
||||||
|
} catch (Throwable e) {
|
||||||
|
logger.log(Level.SEVERE, "Pack in failed.", e);
|
||||||
|
return false;
|
||||||
|
} finally{
|
||||||
|
if (zipstream != null) {
|
||||||
|
try {
|
||||||
|
zipstream.close();
|
||||||
|
} catch (Exception e2) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println(getName() + " " + packout.getPath() + " installed");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected BundleContext getContext() {
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setContext(BundleContext context) {
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stop(BundleContext context) throws Exception {
|
||||||
|
stop();
|
||||||
|
serviceTracker.close();
|
||||||
|
this.context = null;
|
||||||
|
if (logger.isLoggable(Level.INFO)) logger.info(context.getBundle().getSymbolicName() + " "
|
||||||
|
+ context.getBundle().getHeaders().get("Bundle-Version")
|
||||||
|
+ " stopped.");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void afterPackIn() {
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* call when bundle have been started ( after this.context have been set )
|
||||||
|
*/
|
||||||
|
protected void start() {
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* call when bundle is stop ( before this.context is set to null )
|
||||||
|
*/
|
||||||
|
protected void stop() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IDictionaryService addingService(
|
||||||
|
ServiceReference<IDictionaryService> reference) {
|
||||||
|
service = context.getService(reference);
|
||||||
|
if (Adempiere.getThreadPoolExecutor() != null) {
|
||||||
|
Adempiere.getThreadPoolExecutor().execute(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
ClassLoader cl = Thread.currentThread().getContextClassLoader();
|
||||||
|
try {
|
||||||
|
Thread.currentThread().setContextClassLoader(Version2PackActivator.class.getClassLoader());
|
||||||
|
setupPackInContext();
|
||||||
|
installPackage();
|
||||||
|
} finally {
|
||||||
|
ServerContext.dispose();
|
||||||
|
service = null;
|
||||||
|
Thread.currentThread().setContextClassLoader(cl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Adempiere.addServerStateChangeListener(new ServerStateChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void stateChange(ServerStateChangeEvent event) {
|
||||||
|
if (event.getEventType() == ServerStateChangeEvent.SERVER_START && service != null) {
|
||||||
|
ClassLoader cl = Thread.currentThread().getContextClassLoader();
|
||||||
|
try {
|
||||||
|
Thread.currentThread().setContextClassLoader(Version2PackActivator.class.getClassLoader());
|
||||||
|
setupPackInContext();
|
||||||
|
installPackage();
|
||||||
|
} finally {
|
||||||
|
ServerContext.dispose();
|
||||||
|
service = null;
|
||||||
|
Thread.currentThread().setContextClassLoader(cl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void modifiedService(ServiceReference<IDictionaryService> reference,
|
||||||
|
IDictionaryService service) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removedService(ServiceReference<IDictionaryService> reference,
|
||||||
|
IDictionaryService service) {
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setupPackInContext() {
|
||||||
|
Properties serverContext = new Properties();
|
||||||
|
ServerContext.setCurrentInstance(serverContext);
|
||||||
|
};
|
||||||
|
}
|
|
@ -155,4 +155,8 @@
|
||||||
<Arg>java.naming.factory.url.pkgs</Arg>
|
<Arg>java.naming.factory.url.pkgs</Arg>
|
||||||
<Arg><Property name="java.naming.factory.url.pkgs" default="org.eclipse.jetty.jndi"/></Arg>
|
<Arg><Property name="java.naming.factory.url.pkgs" default="org.eclipse.jetty.jndi"/></Arg>
|
||||||
</Call>
|
</Call>
|
||||||
|
<Call name="setAttribute">
|
||||||
|
<Arg>org.eclipse.jetty.server.Request.maxFormContentSize</Arg>
|
||||||
|
<Arg>1048576</Arg>
|
||||||
|
</Call>
|
||||||
</Configure>
|
</Configure>
|
|
@ -138,8 +138,10 @@ public final class Prop implements Serializable {
|
||||||
}
|
}
|
||||||
catch (FileNotFoundException e)
|
catch (FileNotFoundException e)
|
||||||
{
|
{
|
||||||
log.warning(filename + " not found");
|
if (log.isLoggable(Level.INFO)) {
|
||||||
log.warning("!!WARNING:Please locate yout custom home.properties on iDEMPIERE_HOME.");
|
log.info(filename + " not found");
|
||||||
|
log.info("!!WARNING:Please locate your custom home.properties on IDEMPIERE_HOME.");
|
||||||
|
}
|
||||||
loadOK = false;
|
loadOK = false;
|
||||||
try {
|
try {
|
||||||
fis = Prop.class.getResourceAsStream(HOME_PROPERTY_FILE);
|
fis = Prop.class.getResourceAsStream(HOME_PROPERTY_FILE);
|
||||||
|
|
|
@ -270,6 +270,7 @@ public class AlertProcessor extends AdempiereServer
|
||||||
Trx trx = null;
|
Trx trx = null;
|
||||||
try {
|
try {
|
||||||
trx = Trx.get(Trx.createTrxName("AP_NU"), true);
|
trx = Trx.get(Trx.createTrxName("AP_NU"), true);
|
||||||
|
trx.setDisplayName(getClass().getName()+"_"+m_model.getName()+"_notifyUsers");
|
||||||
// Notice
|
// Notice
|
||||||
int AD_Message_ID = 52244; /* TODO - Hardcoded message=notes */
|
int AD_Message_ID = 52244; /* TODO - Hardcoded message=notes */
|
||||||
MNote note = new MNote(getCtx(), AD_Message_ID, user_id, trx.getTrxName());
|
MNote note = new MNote(getCtx(), AD_Message_ID, user_id, trx.getTrxName());
|
||||||
|
|
|
@ -115,6 +115,7 @@ public class Scheduler extends AdempiereServer
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_trx = Trx.get(Trx.createTrxName("Scheduler"), true);
|
m_trx = Trx.get(Trx.createTrxName("Scheduler"), true);
|
||||||
|
m_trx.setDisplayName(getClass().getName()+"_"+getModel().getName()+"_doWork");
|
||||||
m_summary.append(runProcess(process));
|
m_summary.append(runProcess(process));
|
||||||
m_trx.commit(true);
|
m_trx.commit(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -957,8 +957,13 @@ public class AdempiereMonitor extends HttpServlet
|
||||||
{
|
{
|
||||||
line = new tr();
|
line = new tr();
|
||||||
line.addElement(new th().addElement("Active Transaction "));
|
line.addElement(new th().addElement("Active Transaction "));
|
||||||
line.addElement(new td().addElement("Name="+trx.getTrxName()
|
td td = new td();
|
||||||
+ ", StartTime=" + trx.getStartTime()));
|
td.setOnClick("var newwindow=window.open('','Popup', 'width=800,height=600');newwindow.document.write('<title>" + escapeEcmaScript(trx.getDisplayName()) +"</title>"
|
||||||
|
+ "<pre>" + escapeEcmaScript(trx.getStrackTrace()) + "</pre>')");
|
||||||
|
td.addElement("Name="+trx.getDisplayName() + ", StartTime=" + trx.getStartTime());
|
||||||
|
td.setTitle("Click to see stack trace");
|
||||||
|
td.setStyle("text-decoration: underline; color: blue");
|
||||||
|
line.addElement(td);
|
||||||
table.addElement(line);
|
table.addElement(line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1247,4 +1252,14 @@ public class AdempiereMonitor extends HttpServlet
|
||||||
|
|
||||||
return dirAccessList;
|
return dirAccessList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final String escapeEcmaScript(String input) {
|
||||||
|
input = input.replace("'", "\\'");
|
||||||
|
input = input.replace("\"", "\\\"");
|
||||||
|
input = input.replace("\\", "\\\\");
|
||||||
|
input = input.replace("/", "\\/");
|
||||||
|
input = input.replace("\n", "\\n");
|
||||||
|
input = input.replace("\t", "\\t");
|
||||||
|
return input;
|
||||||
|
}
|
||||||
} // AdempiereMonitor
|
} // AdempiereMonitor
|
||||||
|
|
|
@ -93,6 +93,13 @@ public class ADSortTab extends Panel implements IADTabpanel
|
||||||
|
|
||||||
m_AD_Table_ID = gridTab.getAD_Table_ID();
|
m_AD_Table_ID = gridTab.getAD_Table_ID();
|
||||||
ZKUpdateUtil.setVflex(this, "true");
|
ZKUpdateUtil.setVflex(this, "true");
|
||||||
|
|
||||||
|
addEventListener(ON_ACTIVATE_EVENT, new EventListener<Event>() {
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
removeAttribute(ATTR_ON_ACTIVATE_POSTED);
|
||||||
|
}
|
||||||
|
});
|
||||||
} // ADSortTab
|
} // ADSortTab
|
||||||
|
|
||||||
/** Logger */
|
/** Logger */
|
||||||
|
@ -357,13 +364,6 @@ public class ADSortTab extends Panel implements IADTabpanel
|
||||||
ZKUpdateUtil.setVflex(yesList, true);
|
ZKUpdateUtil.setVflex(yesList, true);
|
||||||
ZKUpdateUtil.setHflex(yesList, "1");
|
ZKUpdateUtil.setHflex(yesList, "1");
|
||||||
hlayout.appendChild(yesList);
|
hlayout.appendChild(yesList);
|
||||||
|
|
||||||
addEventListener(ON_ACTIVATE_EVENT, new EventListener<Event>() {
|
|
||||||
@Override
|
|
||||||
public void onEvent(Event event) throws Exception {
|
|
||||||
removeAttribute(ATTR_ON_ACTIVATE_POSTED);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} // Init
|
} // Init
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
|
@ -744,10 +744,12 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
comp.dynamicDisplay();
|
|
||||||
boolean rw = mField.isEditable(true); // r/w - check Context
|
boolean rw = mField.isEditable(true); // r/w - check Context
|
||||||
|
if (rw && !comp.isReadWrite()) // IDEMPIERE-3421 - if it was read-only the list can contain direct values
|
||||||
|
mField.refreshLookup();
|
||||||
comp.setReadWrite(rw);
|
comp.setReadWrite(rw);
|
||||||
comp.setMandatory(mField.isMandatory(true)); // check context
|
comp.setMandatory(mField.isMandatory(true)); // check context
|
||||||
|
comp.dynamicDisplay();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (comp.isVisible())
|
else if (comp.isVisible())
|
||||||
|
|
|
@ -1344,15 +1344,15 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
||||||
|
|
||||||
toolbar.enablePrint(adTabbox.getSelectedGridTab().isPrinted() && !adTabbox.getSelectedGridTab().isNew());
|
toolbar.enablePrint(adTabbox.getSelectedGridTab().isPrinted() && !adTabbox.getSelectedGridTab().isNew());
|
||||||
|
|
||||||
|
boolean isNewRow = adTabbox.getSelectedGridTab().getRowCount() == 0 || adTabbox.getSelectedGridTab().isNew();
|
||||||
//Deepak-Enabling customize button IDEMPIERE-364
|
//Deepak-Enabling customize button IDEMPIERE-364
|
||||||
if(!(adTabbox.getSelectedTabpanel() instanceof ADSortTab))
|
if(adTabbox.getSelectedTabpanel() instanceof ADSortTab){//consistent with dataStatusChanged
|
||||||
{
|
|
||||||
toolbar.enableCustomize(((ADTabpanel)adTabbox.getSelectedTabpanel()).isGridView());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
toolbar.enableCustomize(false);
|
|
||||||
toolbar.enableProcessButton (false);
|
toolbar.enableProcessButton (false);
|
||||||
|
toolbar.enableCustomize(false);
|
||||||
|
}else{
|
||||||
|
ADTabpanel adtab = (ADTabpanel) adTabbox.getSelectedTabpanel();
|
||||||
|
toolbar.enableProcessButton(!isNewRow && adtab != null && adtab.getToolbarButtons().size() > 0);
|
||||||
|
toolbar.enableCustomize(adtab.isGridView());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1715,8 +1715,6 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isNewRow = adTabbox.getSelectedGridTab().getRowCount() == 0 || adTabbox.getSelectedGridTab().isNew();
|
boolean isNewRow = adTabbox.getSelectedGridTab().getRowCount() == 0 || adTabbox.getSelectedGridTab().isNew();
|
||||||
ADTabpanel adtab = (ADTabpanel) adTabbox.getSelectedTabpanel();
|
|
||||||
toolbar.enableProcessButton(!isNewRow && adtab != null && adtab.getToolbarButtons().size() > 0);
|
|
||||||
toolbar.enableArchive(!isNewRow);
|
toolbar.enableArchive(!isNewRow);
|
||||||
toolbar.enableZoomAcross(!isNewRow);
|
toolbar.enableZoomAcross(!isNewRow);
|
||||||
toolbar.enableActiveWorkflows(!isNewRow);
|
toolbar.enableActiveWorkflows(!isNewRow);
|
||||||
|
@ -1731,9 +1729,15 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
||||||
toolbar.enableTabNavigation(breadCrumb.hasParentLink(), adTabbox.getSelectedDetailADTabpanel() != null);
|
toolbar.enableTabNavigation(breadCrumb.hasParentLink(), adTabbox.getSelectedDetailADTabpanel() != null);
|
||||||
|
|
||||||
//Deepak-Enabling customize button IDEMPIERE-364
|
//Deepak-Enabling customize button IDEMPIERE-364
|
||||||
if(!(adTabbox.getSelectedTabpanel() instanceof ADSortTab))
|
if(adTabbox.getSelectedTabpanel() instanceof ADSortTab){//consistent with updateToolbar
|
||||||
|
toolbar.enableProcessButton (false);
|
||||||
|
toolbar.enableCustomize(false);
|
||||||
|
}else{
|
||||||
|
ADTabpanel adtab = (ADTabpanel) adTabbox.getSelectedTabpanel();
|
||||||
|
toolbar.enableProcessButton(!isNewRow && adtab != null && adtab.getToolbarButtons().size() > 0);
|
||||||
toolbar.enableCustomize(adtab.isGridView());
|
toolbar.enableCustomize(adtab.isGridView());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return boolean
|
* @return boolean
|
||||||
|
@ -1811,6 +1815,10 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
||||||
{
|
{
|
||||||
sortColumn.setSortDirection("natural");
|
sortColumn.setSortDirection("natural");
|
||||||
}
|
}
|
||||||
|
if (gridTab.isSortTab()) { // refresh is not refreshing sort tabs
|
||||||
|
IADTabpanel tabPanel = adTabbox.getSelectedTabpanel();
|
||||||
|
tabPanel.query(false, 0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Column findCurrentSortColumn() {
|
private Column findCurrentSortColumn() {
|
||||||
|
|
|
@ -996,9 +996,12 @@ public class GridView extends Vbox implements EventListener<Event>, IdSpace, IFi
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
comp.dynamicDisplay();
|
boolean rw = mField.isEditable(true); // r/w - check Context
|
||||||
boolean rw = mField.isEditableGrid(true); // r/w - check Context
|
if (rw && !comp.isReadWrite()) // IDEMPIERE-3421 - if it was read-only the list can contain direct values
|
||||||
|
mField.refreshLookup();
|
||||||
comp.setReadWrite(rw);
|
comp.setReadWrite(rw);
|
||||||
|
comp.setMandatory(mField.isMandatory(true)); // check context
|
||||||
|
comp.dynamicDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
Properties ctx = isDetailPane() ? new GridRowCtx(Env.getCtx(), gridTab, gridTab.getCurrentRow())
|
Properties ctx = isDetailPane() ? new GridRowCtx(Env.getCtx(), gridTab, gridTab.getCurrentRow())
|
||||||
|
|
|
@ -260,6 +260,7 @@ public class FeedbackRequestWindow extends Window implements EventListener<Event
|
||||||
|
|
||||||
protected void saveRequest() throws IOException {
|
protected void saveRequest() throws IOException {
|
||||||
Trx trx = Trx.get(Trx.createTrxName("SaveNewRequest"), true);
|
Trx trx = Trx.get(Trx.createTrxName("SaveNewRequest"), true);
|
||||||
|
trx.setDisplayName(getClass().getName()+"_saveRequest");
|
||||||
try {
|
try {
|
||||||
trx.start();
|
trx.start();
|
||||||
MRequest request = createMRequest(trx);
|
MRequest request = createMRequest(trx);
|
||||||
|
|
|
@ -846,6 +846,7 @@ public class WBOMDrop extends ADForm implements EventListener<Event>
|
||||||
{
|
{
|
||||||
String trxName = Trx.createTrxName("BDP");
|
String trxName = Trx.createTrxName("BDP");
|
||||||
Trx localTrx = Trx.get(trxName, true); //trx needs to be committed too
|
Trx localTrx = Trx.get(trxName, true); //trx needs to be committed too
|
||||||
|
localTrx.setDisplayName(getClass().getName()+"_onSave");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (cmd_save(localTrx))
|
if (cmd_save(localTrx))
|
||||||
|
|
|
@ -634,6 +634,7 @@ public class WWFActivity extends ADForm implements EventListener<Event>
|
||||||
Trx trx = null;
|
Trx trx = null;
|
||||||
try {
|
try {
|
||||||
trx = Trx.get(Trx.createTrxName("FWFA"), true);
|
trx = Trx.get(Trx.createTrxName("FWFA"), true);
|
||||||
|
trx.setDisplayName(getClass().getName()+"_onOK");
|
||||||
m_activity.set_TrxName(trx.getTrxName());
|
m_activity.set_TrxName(trx.getTrxName());
|
||||||
|
|
||||||
if (forward != null)
|
if (forward != null)
|
||||||
|
|
|
@ -160,6 +160,7 @@ public class ADTreeOnDropListener implements EventListener<Event> {
|
||||||
|
|
||||||
// *** Save changes to disk
|
// *** Save changes to disk
|
||||||
Trx trx = Trx.get (Trx.createTrxName("ADTree"), true);
|
Trx trx = Trx.get (Trx.createTrxName("ADTree"), true);
|
||||||
|
trx.setDisplayName(getClass().getName()+"_moveNode");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
|
|
|
@ -23,6 +23,7 @@ import org.adempiere.util.Callback;
|
||||||
import org.adempiere.webui.AdempiereIdGenerator;
|
import org.adempiere.webui.AdempiereIdGenerator;
|
||||||
import org.adempiere.webui.apps.AEnv;
|
import org.adempiere.webui.apps.AEnv;
|
||||||
import org.adempiere.webui.factory.ButtonFactory;
|
import org.adempiere.webui.factory.ButtonFactory;
|
||||||
|
import org.adempiere.webui.session.SessionManager;
|
||||||
import org.adempiere.webui.theme.ThemeManager;
|
import org.adempiere.webui.theme.ThemeManager;
|
||||||
import org.adempiere.webui.util.ZKUpdateUtil;
|
import org.adempiere.webui.util.ZKUpdateUtil;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
@ -338,7 +339,12 @@ public class Messagebox extends Window implements EventListener<Event>
|
||||||
returnValue = IGNORE;
|
returnValue = IGNORE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
this.detach();
|
this.detach();
|
||||||
|
} catch (NullPointerException npe) {
|
||||||
|
if (! (SessionManager.getSessionApplication() == null)) // IDEMPIERE-1937 - ignore when session was closed
|
||||||
|
throw npe;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class Textbox extends org.zkoss.zul.Textbox implements EventListener<Even
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 2201466028538929955L;
|
private static final long serialVersionUID = -3919623360765045602L;
|
||||||
|
|
||||||
private Obscure m_obscure = null;
|
private Obscure m_obscure = null;
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ public class Textbox extends org.zkoss.zul.Textbox implements EventListener<Even
|
||||||
String value = super.getValue();
|
String value = super.getValue();
|
||||||
if (m_obscure != null && value != null && value.length() > 0)
|
if (m_obscure != null && value != null && value.length() > 0)
|
||||||
{
|
{
|
||||||
if (!isReadonly() && value.equals(m_obscure.getObscuredValue()))
|
if (!isReadonly() && value.equals(m_obscure.getObscuredValue(getMaxlength())))
|
||||||
value = m_obscure.getClearValue();
|
value = m_obscure.getClearValue();
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
|
@ -94,9 +94,9 @@ public class Textbox extends org.zkoss.zul.Textbox implements EventListener<Even
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setValue(String value) throws WrongValueException {
|
public void setValue(String value) throws WrongValueException {
|
||||||
if (m_obscure != null && !m_infocus)
|
if (m_obscure != null && ("password".equals(getType()) || !m_infocus))
|
||||||
{
|
{
|
||||||
super.setValue(m_obscure.getObscuredValue(value));
|
super.setValue(m_obscure.getObscuredValue(value, getMaxlength()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -118,4 +118,12 @@ public class Textbox extends org.zkoss.zul.Textbox implements EventListener<Even
|
||||||
setValue(getValue());
|
setValue(getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setType(String type) throws WrongValueException {
|
||||||
|
if ("password".equals(type))
|
||||||
|
setObscureType(Obscure.OBSCURETYPE_ObscureMaskMax10Asterisk);
|
||||||
|
super.setType(type);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,8 +93,6 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
|
||||||
|
|
||||||
private boolean readOnly;
|
private boolean readOnly;
|
||||||
|
|
||||||
private boolean updateable;
|
|
||||||
|
|
||||||
private String columnName;
|
private String columnName;
|
||||||
|
|
||||||
protected WEditorPopupMenu popupMenu;
|
protected WEditorPopupMenu popupMenu;
|
||||||
|
@ -177,7 +175,6 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
|
||||||
this.setMandatory(gridField.isMandatory(true));
|
this.setMandatory(gridField.isMandatory(true));
|
||||||
this.readOnly = gridField.isReadOnly();
|
this.readOnly = gridField.isReadOnly();
|
||||||
this.description = gridField.getDescription();
|
this.description = gridField.getDescription();
|
||||||
this.updateable = gridField.isUpdateable();
|
|
||||||
this.columnName = gridField.getColumnName();
|
this.columnName = gridField.getColumnName();
|
||||||
this.strLabel = gridField.getHeader();
|
this.strLabel = gridField.getHeader();
|
||||||
init();
|
init();
|
||||||
|
@ -227,7 +224,6 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
|
||||||
this.setMandatory(mandatory);
|
this.setMandatory(mandatory);
|
||||||
this.readOnly = readonly;
|
this.readOnly = readonly;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.updateable = updateable;
|
|
||||||
this.strLabel = label;
|
this.strLabel = label;
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
@ -253,7 +249,6 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
|
||||||
this.setMandatory(mandatory);
|
this.setMandatory(mandatory);
|
||||||
this.readOnly = readonly;
|
this.readOnly = readonly;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.updateable = updateable;
|
|
||||||
this.strLabel = label;
|
this.strLabel = label;
|
||||||
this.columnName = columnName;
|
this.columnName = columnName;
|
||||||
init();
|
init();
|
||||||
|
@ -277,15 +272,7 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
|
||||||
label.setMandatory(mandatory);
|
label.setMandatory(mandatory);
|
||||||
|
|
||||||
this.setMandatory (mandatory);
|
this.setMandatory (mandatory);
|
||||||
|
this.setReadWrite(!readOnly);
|
||||||
if (readOnly || !updateable)
|
|
||||||
{
|
|
||||||
this.setReadWrite(false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.setReadWrite(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
((HtmlBasedComponent)component).setTooltiptext(description);
|
((HtmlBasedComponent)component).setTooltiptext(description);
|
||||||
label.setTooltiptext(description);
|
label.setTooltiptext(description);
|
||||||
|
|
|
@ -68,6 +68,7 @@ import org.compiere.model.MLookupFactory;
|
||||||
import org.compiere.model.MLookupInfo;
|
import org.compiere.model.MLookupInfo;
|
||||||
import org.compiere.model.MProcess;
|
import org.compiere.model.MProcess;
|
||||||
import org.compiere.model.MRole;
|
import org.compiere.model.MRole;
|
||||||
|
import org.compiere.model.MSysConfig;
|
||||||
import org.compiere.model.MTable;
|
import org.compiere.model.MTable;
|
||||||
import org.compiere.model.X_AD_InfoColumn;
|
import org.compiere.model.X_AD_InfoColumn;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
|
@ -464,12 +465,13 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
||||||
|
|
||||||
boolean splitValue = false;
|
boolean splitValue = false;
|
||||||
if (m_count <= 0) {
|
if (m_count <= 0) {
|
||||||
String[] values = queryValue.split("[_]");
|
String separator = MSysConfig.getValue(MSysConfig.IDENTIFIER_SEPARATOR, "_", Env.getAD_Client_ID(Env.getCtx()));
|
||||||
|
String[] values = queryValue.split("[" + separator.trim()+"]");
|
||||||
if (values.length == 2) {
|
if (values.length == 2) {
|
||||||
splitValue = true;
|
splitValue = true;
|
||||||
for(int i = 0; i < values.length && i < identifiers.size(); i++) {
|
for(int i = 0; i < values.length && i < identifiers.size(); i++) {
|
||||||
WEditor editor = identifiers.get(i);
|
WEditor editor = identifiers.get(i);
|
||||||
editor.setValue(values[i]);
|
editor.setValue(values[i].trim());
|
||||||
}
|
}
|
||||||
testCount(false);
|
testCount(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -316,6 +316,7 @@ public class ChangePasswordPanel extends Window implements EventListener<Event>
|
||||||
{
|
{
|
||||||
String trxName = Trx.createTrxName("ChangePasswordTrx");
|
String trxName = Trx.createTrxName("ChangePasswordTrx");
|
||||||
trx = Trx.get(trxName, true);
|
trx = Trx.get(trxName, true);
|
||||||
|
trx.setDisplayName(getClass().getName()+"_validateChangePassword");
|
||||||
|
|
||||||
for (KeyNamePair clientKNPair : m_clientKNPairs)
|
for (KeyNamePair clientKNPair : m_clientKNPairs)
|
||||||
{
|
{
|
||||||
|
|
|
@ -847,6 +847,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
|
||||||
//https://jdbc.postgresql.org/documentation/head/query.html#query-with-cursor
|
//https://jdbc.postgresql.org/documentation/head/query.html#query-with-cursor
|
||||||
String trxName = Trx.createTrxName("InfoPanelLoad:");
|
String trxName = Trx.createTrxName("InfoPanelLoad:");
|
||||||
trx = Trx.get(trxName, true);
|
trx = Trx.get(trxName, true);
|
||||||
|
trx.setDisplayName(getClass().getName()+"_readLine");
|
||||||
m_pstmt = DB.prepareStatement(dataSql, trxName);
|
m_pstmt = DB.prepareStatement(dataSql, trxName);
|
||||||
setParameters (m_pstmt, false); // no count
|
setParameters (m_pstmt, false); // no count
|
||||||
if (log.isLoggable(Level.FINE))
|
if (log.isLoggable(Level.FINE))
|
||||||
|
@ -1778,6 +1779,11 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
|
||||||
{
|
{
|
||||||
updateListSelected();
|
updateListSelected();
|
||||||
int pgNo = paging.getActivePage();
|
int pgNo = paging.getActivePage();
|
||||||
|
if (pgNo == paging.getPageCount()-1 && !isLoadPageNumber()) {
|
||||||
|
testCount();
|
||||||
|
paging.setTotalSize(m_count);
|
||||||
|
pgNo = paging.getActivePage();
|
||||||
|
}
|
||||||
|
|
||||||
if (pageNo != pgNo)
|
if (pageNo != pgNo)
|
||||||
{
|
{
|
||||||
|
|
|
@ -258,6 +258,7 @@ public class ResetPasswordPanel extends Window implements EventListener<Event>
|
||||||
txtSecurityQuestion.setVisible(false);
|
txtSecurityQuestion.setVisible(false);
|
||||||
|
|
||||||
txtAnswer = new Textbox();
|
txtAnswer = new Textbox();
|
||||||
|
txtAnswer.setType("password");
|
||||||
txtAnswer.setId("txtAnswer");
|
txtAnswer.setId("txtAnswer");
|
||||||
// txtAnswer.setType("password");
|
// txtAnswer.setType("password");
|
||||||
txtAnswer.setCols(25);
|
txtAnswer.setCols(25);
|
||||||
|
@ -449,6 +450,7 @@ public class ResetPasswordPanel extends Window implements EventListener<Event>
|
||||||
{
|
{
|
||||||
String trxName = Trx.createTrxName("ResetPasswordTrx");
|
String trxName = Trx.createTrxName("ResetPasswordTrx");
|
||||||
trx = Trx.get(trxName, true);
|
trx = Trx.get(trxName, true);
|
||||||
|
trx.setDisplayName(getClass().getName()+"_validateResetPassword");
|
||||||
|
|
||||||
for (MUser user : users)
|
for (MUser user : users)
|
||||||
{
|
{
|
||||||
|
|
|
@ -149,6 +149,7 @@ public class GridTabDataBinder implements ValueChangeListener {
|
||||||
int recordId = gridTab.getKeyID(gridTab.getCurrentRow());
|
int recordId = gridTab.getKeyID(gridTab.getCurrentRow());
|
||||||
|
|
||||||
Trx trx = Trx.get(Trx.createTrxName(), true);
|
Trx trx = Trx.get(Trx.createTrxName(), true);
|
||||||
|
trx.setDisplayName(getClass().getName()+"_valueChange");
|
||||||
trx.start();
|
trx.start();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -101,6 +101,7 @@ public class WGadgets extends Window implements EventListener<Event>{
|
||||||
if (panel.getButton("Ok").equals(event.getTarget()))
|
if (panel.getButton("Ok").equals(event.getTarget()))
|
||||||
{
|
{
|
||||||
Trx trx = Trx.get(Trx.createTrxName("ManagedGadgets"), true);
|
Trx trx = Trx.get(Trx.createTrxName("ManagedGadgets"), true);
|
||||||
|
trx.setDisplayName(getClass().getName()+"_onEvent_onOk");
|
||||||
try {
|
try {
|
||||||
trx.start();
|
trx.start();
|
||||||
for(MDashboardPreference pre : dirtyList.values()) {
|
for(MDashboardPreference pre : dirtyList.values()) {
|
||||||
|
|
|
@ -915,6 +915,7 @@ public class WLocationDialog extends Window implements EventListener<Event>
|
||||||
private boolean action_OK()
|
private boolean action_OK()
|
||||||
{
|
{
|
||||||
Trx trx = Trx.get(Trx.createTrxName("WLocationDialog"), true);
|
Trx trx = Trx.get(Trx.createTrxName("WLocationDialog"), true);
|
||||||
|
trx.setDisplayName(getClass().getName()+"_action_Ok");
|
||||||
m_location.set_TrxName(trx.getTrxName());
|
m_location.set_TrxName(trx.getTrxName());
|
||||||
m_location.setAddress1(txtAddress1.getValue());
|
m_location.setAddress1(txtAddress1.getValue());
|
||||||
m_location.setAddress2(txtAddress2.getValue());
|
m_location.setAddress2(txtAddress2.getValue());
|
||||||
|
|
|
@ -247,6 +247,7 @@ public class InOutGen extends GenForm
|
||||||
if (log.isLoggable(Level.INFO)) log.info("M_Warehouse_ID=" + m_M_Warehouse_ID);
|
if (log.isLoggable(Level.INFO)) log.info("M_Warehouse_ID=" + m_M_Warehouse_ID);
|
||||||
String trxName = Trx.createTrxName("IOG");
|
String trxName = Trx.createTrxName("IOG");
|
||||||
Trx trx = Trx.get(trxName, true); //trx needs to be committed too
|
Trx trx = Trx.get(trxName, true); //trx needs to be committed too
|
||||||
|
trx.setDisplayName(getClass().getName()+"_generate");
|
||||||
|
|
||||||
setSelectionActive(false); // prevents from being called twice
|
setSelectionActive(false); // prevents from being called twice
|
||||||
statusBar.setStatusLine(Msg.getMsg(Env.getCtx(), "InOutGenerateGen"));
|
statusBar.setStatusLine(Msg.getMsg(Env.getCtx(), "InOutGenerateGen"));
|
||||||
|
|
|
@ -247,6 +247,7 @@ public class InvoiceGen extends GenForm
|
||||||
String info = "";
|
String info = "";
|
||||||
String trxName = Trx.createTrxName("IVG");
|
String trxName = Trx.createTrxName("IVG");
|
||||||
Trx trx = Trx.get(trxName, true); //trx needs to be committed too
|
Trx trx = Trx.get(trxName, true); //trx needs to be committed too
|
||||||
|
trx.setDisplayName(getClass().getName()+"_generate");
|
||||||
|
|
||||||
setSelectionActive(false); // prevents from being called twice
|
setSelectionActive(false); // prevents from being called twice
|
||||||
statusBar.setStatusLine(Msg.getMsg(Env.getCtx(), "InvGenerateGen"));
|
statusBar.setStatusLine(Msg.getMsg(Env.getCtx(), "InvGenerateGen"));
|
||||||
|
|
|
@ -206,6 +206,7 @@ public class Match
|
||||||
// Create it
|
// Create it
|
||||||
String innerTrxName = Trx.createTrxName("Match");
|
String innerTrxName = Trx.createTrxName("Match");
|
||||||
Trx innerTrx = Trx.get(innerTrxName, true);
|
Trx innerTrx = Trx.get(innerTrxName, true);
|
||||||
|
innerTrx.setDisplayName(getClass().getName()+"_cmd_process");
|
||||||
|
|
||||||
try{
|
try{
|
||||||
if (createMatchRecord(invoice, M_InOutLine_ID, Line_ID, BigDecimal.valueOf(qty), innerTrxName))
|
if (createMatchRecord(invoice, M_InOutLine_ID, Line_ID, BigDecimal.valueOf(qty), innerTrxName))
|
||||||
|
|
|
@ -114,8 +114,9 @@ public class Merge
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_trx = Trx.get(Trx.createTrxName("merge"), true);
|
m_trx = Trx.get(Trx.createTrxName("merge"), true);
|
||||||
|
m_trx.setDisplayName(getClass().getName()+"_merge");
|
||||||
//
|
//
|
||||||
pstmt = DB.prepareStatement(sql, Trx.createTrxName());
|
pstmt = DB.prepareStatement(sql, m_trx.getTrxName());
|
||||||
pstmt.setString(1, ColumnName);
|
pstmt.setString(1, ColumnName);
|
||||||
pstmt.setString(2, ColumnName);
|
pstmt.setString(2, ColumnName);
|
||||||
rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
|
|
|
@ -422,6 +422,7 @@ public class PaySelect
|
||||||
try {
|
try {
|
||||||
trxName = Trx.createTrxName("PaySelect");
|
trxName = Trx.createTrxName("PaySelect");
|
||||||
trx = Trx.get(trxName, true);
|
trx = Trx.get(trxName, true);
|
||||||
|
trx.setDisplayName(getClass().getName()+"_generatePaySelect");
|
||||||
|
|
||||||
String PaymentRule = paymentRule.getValue();
|
String PaymentRule = paymentRule.getValue();
|
||||||
|
|
||||||
|
|
|
@ -239,6 +239,7 @@ public class RunProcess extends TableFixture {
|
||||||
if (process.isJavaProcess() && !jasperreport)
|
if (process.isJavaProcess() && !jasperreport)
|
||||||
{
|
{
|
||||||
Trx trx = Trx.get(Trx.createTrxName("FixturePrc"), true);
|
Trx trx = Trx.get(Trx.createTrxName("FixturePrc"), true);
|
||||||
|
trx.setDisplayName(getClass().getName()+"_doStaticTable");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
processOK = process.processIt(pi, trx);
|
processOK = process.processIt(pi, trx);
|
||||||
|
|
|
@ -97,6 +97,7 @@ public class SetDocAction extends TableFixture {
|
||||||
}
|
}
|
||||||
|
|
||||||
Trx trx = Trx.get(Trx.createTrxName("FixtureSetDocAction"), true);
|
Trx trx = Trx.get(Trx.createTrxName("FixtureSetDocAction"), true);
|
||||||
|
trx.setDisplayName(getClass().getName()+"_doStaticTable");
|
||||||
|
|
||||||
gpo = table.getPO(recordID, trx.getTrxName());
|
gpo = table.getPO(recordID, trx.getTrxName());
|
||||||
if (gpo == null) {
|
if (gpo == null) {
|
||||||
|
|
|
@ -93,6 +93,7 @@ public class CompositeServiceImpl extends AbstractService implements CompositeSe
|
||||||
String trxName = Trx.createTrxName(webServiceName);
|
String trxName = Trx.createTrxName(webServiceName);
|
||||||
|
|
||||||
Trx trx = Trx.get(trxName, true);
|
Trx trx = Trx.get(trxName, true);
|
||||||
|
trx.setDisplayName(getClass().getName()+"_"+webServiceName+"_compositeOperation");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
modelADService.setLocalTrxName(trxName);
|
modelADService.setLocalTrxName(trxName);
|
||||||
|
|
|
@ -214,6 +214,8 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
||||||
}
|
}
|
||||||
|
|
||||||
trx = Trx.get(trxName, true);
|
trx = Trx.get(trxName, true);
|
||||||
|
if (manageTrx)
|
||||||
|
trx.setDisplayName(getClass().getName()+"_"+webServiceName+"_setDocAction");
|
||||||
|
|
||||||
Map<String, Object> requestCtx = getRequestCtx();
|
Map<String, Object> requestCtx = getRequestCtx();
|
||||||
|
|
||||||
|
@ -698,6 +700,8 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
||||||
}
|
}
|
||||||
|
|
||||||
trx = Trx.get(trxName, true);
|
trx = Trx.get(trxName, true);
|
||||||
|
if (manageTrx)
|
||||||
|
trx.setDisplayName(getClass().getName()+"_"+webServiceName+"_deleteData");
|
||||||
|
|
||||||
// get the PO for the tablename and record ID
|
// get the PO for the tablename and record ID
|
||||||
MTable table = MTable.get(ctx, tableName);
|
MTable table = MTable.get(ctx, tableName);
|
||||||
|
@ -780,6 +784,8 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
||||||
}
|
}
|
||||||
|
|
||||||
trx = Trx.get(trxName, true);
|
trx = Trx.get(trxName, true);
|
||||||
|
if (manageTrx)
|
||||||
|
trx.setDisplayName(getClass().getName()+"_"+webServiceName+"_createData");
|
||||||
|
|
||||||
|
|
||||||
// get the PO for the tablename and record ID
|
// get the PO for the tablename and record ID
|
||||||
|
@ -892,6 +898,8 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
||||||
manageTrx = true;
|
manageTrx = true;
|
||||||
}
|
}
|
||||||
trx = Trx.get(trxName, true);
|
trx = Trx.get(trxName, true);
|
||||||
|
if (manageTrx)
|
||||||
|
trx.setDisplayName(getClass().getName()+"_"+webServiceName+"_createUpdateData");
|
||||||
|
|
||||||
// get the PO for the tablename and record ID
|
// get the PO for the tablename and record ID
|
||||||
MTable table = MTable.get(ctx, tableName);
|
MTable table = MTable.get(ctx, tableName);
|
||||||
|
@ -1272,6 +1280,8 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
||||||
}
|
}
|
||||||
|
|
||||||
trx = Trx.get(trxName, true);
|
trx = Trx.get(trxName, true);
|
||||||
|
if (manageTrx)
|
||||||
|
trx.setDisplayName(getClass().getName()+"_"+webServiceName+"_updateData");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1464,6 +1474,8 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
||||||
manageTrx = true;
|
manageTrx = true;
|
||||||
}
|
}
|
||||||
trx = Trx.get(trxName, true);
|
trx = Trx.get(trxName, true);
|
||||||
|
if (manageTrx)
|
||||||
|
trx.setDisplayName(getClass().getName()+"_"+webServiceName+"_queryData");
|
||||||
|
|
||||||
StringBuilder sqlBuilder = new StringBuilder(role.addAccessSQL("SELECT * FROM " + tableName, tableName, true, true));
|
StringBuilder sqlBuilder = new StringBuilder(role.addAccessSQL("SELECT * FROM " + tableName, tableName, true, true));
|
||||||
|
|
||||||
|
|
|
@ -340,6 +340,8 @@ public class Process {
|
||||||
if (process.isJavaProcess() && !jasperreport)
|
if (process.isJavaProcess() && !jasperreport)
|
||||||
{
|
{
|
||||||
Trx trx = trxName == null ? Trx.get(Trx.createTrxName("WebPrc"), true) : Trx.get(trxName, true);
|
Trx trx = trxName == null ? Trx.get(Trx.createTrxName("WebPrc"), true) : Trx.get(trxName, true);
|
||||||
|
if (trxName == null)
|
||||||
|
trx.setDisplayName(Process.class.getName()+"_runProcess");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
processOK = process.processIt(pi, trx, false);
|
processOK = process.processIt(pi, trx, false);
|
||||||
|
|
Loading…
Reference in New Issue