diff --git a/migration/i2.0z/oracle/201407010832_IDEMPIERE-1770.sql b/migration/i2.0z/oracle/201407010832_IDEMPIERE-1770.sql index f24d6ff353..edb16d8f7e 100644 --- a/migration/i2.0z/oracle/201407010832_IDEMPIERE-1770.sql +++ b/migration/i2.0z/oracle/201407010832_IDEMPIERE-1770.sql @@ -14,6 +14,9 @@ INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Column_ID,IsMand ALTER TABLE M_InOutLineMA ADD IsAutoGenerated CHAR(1) DEFAULT 'N' CHECK (IsAutoGenerated IN ('Y','N')) ; +-- Updating historical records +Update M_InOutLineMA set IsAutoGenerated = 'Y'; + -- May 29, 2014 10:41:24 PM IST INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,CreatedBy,Updated,IsActive,IsDisplayedGrid,XPosition,IsQuickEntry,AD_Client_ID,ColumnSpan,NumLines,IsAdvancedField,IsDefaultFocus,EntityType) VALUES ('N',751,1,'N','N',211211,70,'Y',202878,'Y','Record is Auto Generated by System.','Auto Generated','d94f1477-cb26-41ec-a677-4162d13f5339','Y','N',100,0,TO_DATE('2014-05-29 22:41:24','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2014-05-29 22:41:24','YYYY-MM-DD HH24:MI:SS'),'Y','Y',2,'N',0,2,1,'N','N','D') ; @@ -30,6 +33,9 @@ INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Column_ID,IsMand ALTER TABLE M_InventoryLineMA ADD IsAutoGenerated CHAR(1) DEFAULT 'N' CHECK (IsAutoGenerated IN ('Y','N')) ; +-- Updating historical records +Update M_InventoryLineMA set IsAutoGenerated = 'Y'; + -- May 29, 2014 10:41:25 PM IST INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,CreatedBy,Updated,IsActive,IsDisplayedGrid,XPosition,IsQuickEntry,AD_Client_ID,ColumnSpan,NumLines,IsAdvancedField,IsDefaultFocus,EntityType) VALUES ('N',749,1,'N','N',211212,70,'Y',202880,'Y','Record is Auto Generated by System.','Auto Generated','040f311d-d321-46ac-a1b8-0650df7b9b8b','Y','N',100,0,TO_DATE('2014-05-29 22:41:25','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2014-05-29 22:41:25','YYYY-MM-DD HH24:MI:SS'),'Y','Y',2,'N',0,2,1,'N','N','D') ; @@ -42,6 +48,9 @@ INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Column_ID,IsMand ALTER TABLE M_MovementLineMA ADD IsAutoGenerated CHAR(1) DEFAULT 'N' CHECK (IsAutoGenerated IN ('Y','N')) ; +-- Updating historical records +Update M_MovementLineMA set IsAutoGenerated = 'Y'; + -- May 29, 2014 10:41:25 PM IST INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,CreatedBy,Updated,IsActive,IsDisplayedGrid,XPosition,IsQuickEntry,AD_Client_ID,ColumnSpan,NumLines,IsAdvancedField,IsDefaultFocus,EntityType) VALUES ('N',750,1,'N','N',211213,70,'Y',202881,'Y','Record is Auto Generated by System.','Auto Generated','9e2cc848-53dc-4ad8-916a-bf58ff5c3184','Y','N',100,0,TO_DATE('2014-05-29 22:41:25','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2014-05-29 22:41:25','YYYY-MM-DD HH24:MI:SS'),'Y','Y',2,'N',0,2,1,'N','N','D') ; diff --git a/migration/i2.0z/oracle/201409031529_IDEMPIERE-2060.sql b/migration/i2.0z/oracle/201409031529_IDEMPIERE-2060.sql new file mode 100644 index 0000000000..5bcbdc66b4 --- /dev/null +++ b/migration/i2.0z/oracle/201409031529_IDEMPIERE-2060.sql @@ -0,0 +1,35 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Sep 3, 2014 3:26:22 PM COT +-- IDEMPIERE-2060 Move some Delete Cascade Constraints to Model classes +INSERT INTO AD_Ref_List (AD_Ref_List_ID,AD_Reference_ID,AD_Ref_List_UU,Name,Value,CreatedBy,Updated,UpdatedBy,IsActive,EntityType,AD_Client_ID,AD_Org_ID,Created) VALUES (200278,200075,'c0542a52-fe58-4b87-8bd4-9dc2fe3afa7a','Model Cascade','M',100,TO_DATE('2014-09-03 15:26:21','YYYY-MM-DD HH24:MI:SS'),100,'Y','D',0,0,TO_DATE('2014-09-03 15:26:21','YYYY-MM-DD HH24:MI:SS')) +; + +-- Sep 3, 2014 3:44:58 PM COT +UPDATE AD_Column SET IsUpdateable='N', FKConstraintType='M',Updated=TO_DATE('2014-09-03 15:44:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2213 +; + +-- Sep 3, 2014 3:46:37 PM COT +ALTER TABLE C_OrderLine MODIFY C_Order_ID NUMBER(10) +; + +-- Sep 3, 2014 3:46:37 PM COT +ALTER TABLE C_OrderLine DROP CONSTRAINT corder_corderline +; + +-- Sep 3, 2014 3:46:37 PM COT +ALTER TABLE C_OrderLine ADD CONSTRAINT corder_corderline FOREIGN KEY (C_Order_ID) REFERENCES c_order(c_order_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Sep 3, 2014 4:36:39 PM COT +INSERT INTO AD_Val_Rule (Code,AD_Val_Rule_ID,EntityType,Name,Description,Type,AD_Val_Rule_UU,CreatedBy,UpdatedBy,Updated,AD_Org_ID,IsActive,AD_Client_ID,Created) VALUES ('(AD_Ref_List.Value!=''M'' OR @AD_Reference_ID@ IN (18,19,30))',200064,'D','FKConstraintType Model just for Direct Foreign Keys','Ref List by Reference','S','a56bce78-de21-4cfa-b18d-2dd367464c01',100,100,TO_DATE('2014-09-03 16:36:39','YYYY-MM-DD HH24:MI:SS'),0,'Y',0,TO_DATE('2014-09-03 16:36:39','YYYY-MM-DD HH24:MI:SS')) +; + +-- Sep 3, 2014 4:36:48 PM COT +UPDATE AD_Column SET AD_Val_Rule_ID=200064,Updated=TO_DATE('2014-09-03 16:36:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=210872 +; + +SELECT register_migration_script('201409031529_IDEMPIERE-2060.sql') FROM dual +; + diff --git a/migration/i2.0z/oracle/201409050839_IDEMPIERE-2188.sql b/migration/i2.0z/oracle/201409050839_IDEMPIERE-2188.sql new file mode 100644 index 0000000000..498cc0eb21 --- /dev/null +++ b/migration/i2.0z/oracle/201409050839_IDEMPIERE-2188.sql @@ -0,0 +1,11 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Sep 5, 2014 8:37:41 AM COT +-- IDEMPIERE-2188 Make hardcoded load timeout configurable +INSERT INTO AD_SysConfig (AD_SysConfig_ID,ConfigurationLevel,Value,Description,AD_SysConfig_UU,AD_Org_ID,CreatedBy,IsActive,UpdatedBy,Name,AD_Client_ID,EntityType,Created,Updated) VALUES (200059,'C','30','Load timeout for GridTable','0a5a3606-f25d-4ab2-9e50-a75e50dc931a',0,100,'Y',100,'GRIDTABLE_LOAD_TIMEOUT_IN_SECONDS',0,'D',TO_DATE('2014-09-05 08:37:41','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2014-09-05 08:37:41','YYYY-MM-DD HH24:MI:SS')) +; + +SELECT register_migration_script('201409050839_IDEMPIERE-2188.sql') FROM dual +; + diff --git a/migration/i2.0z/oracle/201409050848_IDEMPIERE-2190.sql b/migration/i2.0z/oracle/201409050848_IDEMPIERE-2190.sql new file mode 100644 index 0000000000..79279f55fb --- /dev/null +++ b/migration/i2.0z/oracle/201409050848_IDEMPIERE-2190.sql @@ -0,0 +1,18 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Sep 5, 2014 8:46:44 AM COT +-- IDEMPIERE-2190 Virtual Column M_Product.CostStandard too heavy +UPDATE AD_Column SET IsActive='N',Updated=TO_DATE('2014-09-05 08:46:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=61998 +; + +-- Sep 5, 2014 8:47:19 AM COT +UPDATE AD_Field SET SeqNo=0, IsDisplayed='N', IsActive='N', IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_DATE('2014-09-05 08:47:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62009 +; + +UPDATE AD_Field SET SeqNo=0, IsDisplayed='N', IsActive='N', IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_DATE('2014-09-05 08:47:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201344 +; + +SELECT register_migration_script('201409050848_IDEMPIERE-2190.sql') FROM dual +; + diff --git a/migration/i2.0z/oracle/201409051545_IDEMPIERE-1901.sql b/migration/i2.0z/oracle/201409051545_IDEMPIERE-1901.sql new file mode 100644 index 0000000000..bd5c0a4974 --- /dev/null +++ b/migration/i2.0z/oracle/201409051545_IDEMPIERE-1901.sql @@ -0,0 +1,47 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Sep 5, 2014 3:42:25 PM COT +-- IDEMPIERE-1901 Deprecate parent composite primary keys - leave management via table index +INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,Description,DefaultValue,Help,Name,IsAllowCopy,Updated,CreatedBy,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,IsEncrypted,IsSecure,AD_Element_ID,AD_Reference_ID,AD_Table_ID,AD_Client_ID,AD_Org_ID,EntityType) VALUES (0,'N',0,211762,'Y','N','N',0,'N',1,'N','N','N','Y','f1e7a14f-8ab9-4b2e-9655-95d728ecdc18','Y','IsKey','This column is the key in this table','N','The key column must also be display sequence 0 in the field definition and may be hidden.','Key column','Y',TO_DATE('2014-09-05 15:42:25','YYYY-MM-DD HH24:MI:SS'),100,'Y',TO_DATE('2014-09-05 15:42:25','YYYY-MM-DD HH24:MI:SS'),100,'N','N','N','N',389,20,200085,0,0,'D') +; + +-- Sep 5, 2014 3:42:31 PM COT +ALTER TABLE AD_TableIndex ADD IsKey CHAR(1) DEFAULT 'N' CHECK (IsKey IN ('Y','N')) NOT NULL +; + +-- Sep 5, 2014 3:42:57 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',200096,1,'N','N',140,'Y',203443,'N','The key column must also be display sequence 0 in the field definition and may be hidden.','This column is the key in this table','Key column','606cdea6-8002-4c89-b507-bdeffd5acb2b','Y','N',100,100,TO_DATE('2014-09-05 15:42:57','YYYY-MM-DD HH24:MI:SS'),'Y','Y',110,2,0,2,211762,'D',0,TO_DATE('2014-09-05 15:42:57','YYYY-MM-DD HH24:MI:SS')) +; + +-- Sep 5, 2014 3:43:29 PM COT +UPDATE AD_Field SET SeqNo=90, ColumnSpan=1,Updated=TO_DATE('2014-09-05 15:43:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202209 +; + +-- Sep 5, 2014 3:43:29 PM COT +UPDATE AD_Field SET SeqNo=100, IsDisplayed='Y', XPosition=3, ColumnSpan=1,Updated=TO_DATE('2014-09-05 15:43:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203443 +; + +-- Sep 5, 2014 3:43:29 PM COT +UPDATE AD_Field SET SeqNo=110,Updated=TO_DATE('2014-09-05 15:43:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202250 +; + +-- Sep 5, 2014 3:43:29 PM COT +UPDATE AD_Field SET SeqNo=120,Updated=TO_DATE('2014-09-05 15:43:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202206 +; + +-- Sep 5, 2014 3:43:29 PM COT +UPDATE AD_Field SET SeqNo=130,Updated=TO_DATE('2014-09-05 15:43:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202210 +; + +-- Sep 5, 2014 3:43:29 PM COT +UPDATE AD_Field SET SeqNo=140,Updated=TO_DATE('2014-09-05 15:43:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202535 +; + +-- Sep 5, 2014 3:44:41 PM COT +UPDATE AD_Field SET DisplayLogic='@IsCreateConstraint@=''Y'' & @IsUnique@=''Y''',Updated=TO_DATE('2014-09-05 15:44:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203443 +; + +SELECT register_migration_script('201409051545_IDEMPIERE-1901.sql') FROM dual +; + diff --git a/migration/i2.0z/oracle/201409051652_IDEMPIERE-1842.sql b/migration/i2.0z/oracle/201409051652_IDEMPIERE-1842.sql new file mode 100644 index 0000000000..280b88cfd5 --- /dev/null +++ b/migration/i2.0z/oracle/201409051652_IDEMPIERE-1842.sql @@ -0,0 +1,3 @@ +update ad_column set callout = 'org.compiere.model.CalloutOrder.organization' where ad_column_id = 2163; + +SELECT register_migration_script('201409051652_IDEMPIERE-1842.sql') FROM dual; diff --git a/migration/i2.0z/oracle/201409051741_IDEMPIERE-1970.sql b/migration/i2.0z/oracle/201409051741_IDEMPIERE-1970.sql new file mode 100644 index 0000000000..4e895ce214 --- /dev/null +++ b/migration/i2.0z/oracle/201409051741_IDEMPIERE-1970.sql @@ -0,0 +1,37 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +update ad_infoprocess set ad_column_id=null where ad_column_id is not null; + +ALTER TABLE AD_INFOPROCESS RENAME COLUMN AD_COLUMN_ID TO AD_INFOCOLUMN_ID; + +ALTER TABLE AD_INFOPROCESS DROP CONSTRAINT ADCOLUMN_ADINFOPROCESS; + +-- Sep 5, 2014 5:40:41 PM COT +-- IDEMPIERE-1970 Improve t_selection logic for info window +INSERT INTO AD_Val_Rule (Code,AD_Val_Rule_ID,EntityType,Name,Type,AD_Val_Rule_UU,CreatedBy,UpdatedBy,Updated,AD_Org_ID,IsActive,AD_Client_ID,Created) VALUES ('AD_InfoColumn.AD_InfoWindow_ID=@AD_InfoWindow_ID@',200065,'D','AD_InfoColumn from Info Window','S','010f3e1f-dd6c-48c7-8fe1-945e0a2482a2',100,100,TO_DATE('2014-09-05 17:40:37','YYYY-MM-DD HH24:MI:SS'),0,'Y',0,TO_DATE('2014-09-05 17:40:37','YYYY-MM-DD HH24:MI:SS')) +; + +-- Sep 5, 2014 5:40:55 PM COT +UPDATE AD_Column SET FieldLength=10, IsUpdateable='N', ColumnName='AD_InfoColumn_ID', Description='Info Window Column', Help='Column in the Info Window for display and/or selection. If used for selection, the column cannot be a SQL expression. The SQL clause must be fully qualified based on the FROM clause in the Info Window definition', Name='Info Column', FKConstraintName=NULL, AD_Element_ID=3069, AD_Val_Rule_ID=200065,Updated=TO_DATE('2014-09-05 17:40:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=211377 +; + +-- Sep 5, 2014 5:41:00 PM COT +UPDATE AD_Column SET FKConstraintName='ADInfoColumn_ADInfoProcess', FKConstraintType='N',Updated=TO_DATE('2014-09-05 17:41:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=211377 +; + +-- Sep 5, 2014 5:41:00 PM COT +ALTER TABLE AD_InfoProcess MODIFY AD_InfoColumn_ID NUMBER(10) DEFAULT NULL +; + +-- Sep 5, 2014 5:41:00 PM COT +ALTER TABLE AD_InfoProcess ADD CONSTRAINT ADInfoColumn_ADInfoProcess FOREIGN KEY (AD_InfoColumn_ID) REFERENCES ad_infocolumn(ad_infocolumn_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Sep 5, 2014 5:44:01 PM COT +UPDATE AD_Column SET IsUpdateable='Y',Updated=TO_DATE('2014-09-05 17:44:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=211377 +; + +SELECT register_migration_script('201409051741_IDEMPIERE-1970.sql') FROM dual +; + diff --git a/migration/i2.0z/oracle/201409251410_IDEMPIERE-1840.sql b/migration/i2.0z/oracle/201409251410_IDEMPIERE-1840.sql new file mode 100644 index 0000000000..a8dac82e55 --- /dev/null +++ b/migration/i2.0z/oracle/201409251410_IDEMPIERE-1840.sql @@ -0,0 +1,8 @@ +-- Mar 20, 2014 10:54:24 AM COT +-- IDEMPIERE-1840 Reference AD_Org Parent WhereClause bug +UPDATE AD_Ref_Table SET WhereClause='AD_Org.IsSummary=''Y''',Updated=TO_DATE('2014-03-20 10:54:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=113 +; + +SELECT register_migration_script('201409251410_IDEMPIERE-1840.sql') FROM dual +; + diff --git a/migration/i2.0z/postgresql/201407010832_IDEMPIERE-1770.sql b/migration/i2.0z/postgresql/201407010832_IDEMPIERE-1770.sql index b879e06a24..dad6d4cfae 100644 --- a/migration/i2.0z/postgresql/201407010832_IDEMPIERE-1770.sql +++ b/migration/i2.0z/postgresql/201407010832_IDEMPIERE-1770.sql @@ -11,6 +11,9 @@ INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Column_ID,IsMand ALTER TABLE M_InOutLineMA ADD COLUMN IsAutoGenerated CHAR(1) DEFAULT 'N' CHECK (IsAutoGenerated IN ('Y','N')) ; +-- Updating historical records +Update M_InOutLineMA set IsAutoGenerated = 'Y'; + -- May 29, 2014 10:41:24 PM IST INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,CreatedBy,Updated,IsActive,IsDisplayedGrid,XPosition,IsQuickEntry,AD_Client_ID,ColumnSpan,NumLines,IsAdvancedField,IsDefaultFocus,EntityType) VALUES ('N',751,1,'N','N',211211,70,'Y',202878,'Y','Record is Auto Generated by System.','Auto Generated','d94f1477-cb26-41ec-a677-4162d13f5339','Y','N',100,0,TO_TIMESTAMP('2014-05-29 22:41:24','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2014-05-29 22:41:24','YYYY-MM-DD HH24:MI:SS'),'Y','Y',2,'N',0,2,1,'N','N','D') ; @@ -27,6 +30,10 @@ INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Column_ID,IsMand ALTER TABLE M_InventoryLineMA ADD COLUMN IsAutoGenerated CHAR(1) DEFAULT 'N' CHECK (IsAutoGenerated IN ('Y','N')) ; +-- Updating historical records +Update M_InventoryLineMA set IsAutoGenerated = 'Y'; + + -- May 29, 2014 10:41:25 PM IST INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,CreatedBy,Updated,IsActive,IsDisplayedGrid,XPosition,IsQuickEntry,AD_Client_ID,ColumnSpan,NumLines,IsAdvancedField,IsDefaultFocus,EntityType) VALUES ('N',749,1,'N','N',211212,70,'Y',202880,'Y','Record is Auto Generated by System.','Auto Generated','040f311d-d321-46ac-a1b8-0650df7b9b8b','Y','N',100,0,TO_TIMESTAMP('2014-05-29 22:41:25','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2014-05-29 22:41:25','YYYY-MM-DD HH24:MI:SS'),'Y','Y',2,'N',0,2,1,'N','N','D') ; @@ -39,6 +46,9 @@ INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Column_ID,IsMand ALTER TABLE M_MovementLineMA ADD COLUMN IsAutoGenerated CHAR(1) DEFAULT 'N' CHECK (IsAutoGenerated IN ('Y','N')) ; +-- Updating historical records +Update M_MovementLineMA set IsAutoGenerated = 'Y'; + -- May 29, 2014 10:41:25 PM IST INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,CreatedBy,Updated,IsActive,IsDisplayedGrid,XPosition,IsQuickEntry,AD_Client_ID,ColumnSpan,NumLines,IsAdvancedField,IsDefaultFocus,EntityType) VALUES ('N',750,1,'N','N',211213,70,'Y',202881,'Y','Record is Auto Generated by System.','Auto Generated','9e2cc848-53dc-4ad8-916a-bf58ff5c3184','Y','N',100,0,TO_TIMESTAMP('2014-05-29 22:41:25','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2014-05-29 22:41:25','YYYY-MM-DD HH24:MI:SS'),'Y','Y',2,'N',0,2,1,'N','N','D') ; diff --git a/migration/i2.0z/postgresql/201409031529_IDEMPIERE-2060.sql b/migration/i2.0z/postgresql/201409031529_IDEMPIERE-2060.sql new file mode 100644 index 0000000000..5f9dc6aea9 --- /dev/null +++ b/migration/i2.0z/postgresql/201409031529_IDEMPIERE-2060.sql @@ -0,0 +1,32 @@ +-- Sep 3, 2014 3:26:22 PM COT +-- IDEMPIERE-2060 Move some Delete Cascade Constraints to Model classes +INSERT INTO AD_Ref_List (AD_Ref_List_ID,AD_Reference_ID,AD_Ref_List_UU,Name,Value,CreatedBy,Updated,UpdatedBy,IsActive,EntityType,AD_Client_ID,AD_Org_ID,Created) VALUES (200278,200075,'c0542a52-fe58-4b87-8bd4-9dc2fe3afa7a','Model Cascade','M',100,TO_TIMESTAMP('2014-09-03 15:26:21','YYYY-MM-DD HH24:MI:SS'),100,'Y','D',0,0,TO_TIMESTAMP('2014-09-03 15:26:21','YYYY-MM-DD HH24:MI:SS')) +; + +-- Sep 3, 2014 3:44:58 PM COT +UPDATE AD_Column SET IsUpdateable='N', FKConstraintType='M',Updated=TO_TIMESTAMP('2014-09-03 15:44:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2213 +; + +-- Sep 3, 2014 3:46:37 PM COT +INSERT INTO t_alter_column values('c_orderline','C_Order_ID','NUMERIC(10)',null,null) +; + +-- Sep 3, 2014 3:46:37 PM COT +ALTER TABLE C_OrderLine DROP CONSTRAINT corder_corderline +; + +-- Sep 3, 2014 3:46:37 PM COT +ALTER TABLE C_OrderLine ADD CONSTRAINT corder_corderline FOREIGN KEY (C_Order_ID) REFERENCES c_order(c_order_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Sep 3, 2014 4:36:39 PM COT +INSERT INTO AD_Val_Rule (Code,AD_Val_Rule_ID,EntityType,Name,Description,Type,AD_Val_Rule_UU,CreatedBy,UpdatedBy,Updated,AD_Org_ID,IsActive,AD_Client_ID,Created) VALUES ('(AD_Ref_List.Value!=''M'' OR @AD_Reference_ID@ IN (18,19,30))',200064,'D','FKConstraintType Model just for Direct Foreign Keys','Ref List by Reference','S','a56bce78-de21-4cfa-b18d-2dd367464c01',100,100,TO_TIMESTAMP('2014-09-03 16:36:39','YYYY-MM-DD HH24:MI:SS'),0,'Y',0,TO_TIMESTAMP('2014-09-03 16:36:39','YYYY-MM-DD HH24:MI:SS')) +; + +-- Sep 3, 2014 4:36:48 PM COT +UPDATE AD_Column SET AD_Val_Rule_ID=200064,Updated=TO_TIMESTAMP('2014-09-03 16:36:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=210872 +; + +SELECT register_migration_script('201409031529_IDEMPIERE-2060.sql') FROM dual +; + diff --git a/migration/i2.0z/postgresql/201409050839_IDEMPIERE-2188.sql b/migration/i2.0z/postgresql/201409050839_IDEMPIERE-2188.sql new file mode 100644 index 0000000000..f09765bac6 --- /dev/null +++ b/migration/i2.0z/postgresql/201409050839_IDEMPIERE-2188.sql @@ -0,0 +1,8 @@ +-- Sep 5, 2014 8:37:41 AM COT +-- IDEMPIERE-2188 Make hardcoded load timeout configurable +INSERT INTO AD_SysConfig (AD_SysConfig_ID,ConfigurationLevel,Value,Description,AD_SysConfig_UU,AD_Org_ID,CreatedBy,IsActive,UpdatedBy,Name,AD_Client_ID,EntityType,Created,Updated) VALUES (200059,'C','30','Load timeout for GridTable','0a5a3606-f25d-4ab2-9e50-a75e50dc931a',0,100,'Y',100,'GRIDTABLE_LOAD_TIMEOUT_IN_SECONDS',0,'D',TO_TIMESTAMP('2014-09-05 08:37:41','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2014-09-05 08:37:41','YYYY-MM-DD HH24:MI:SS')) +; + +SELECT register_migration_script('201409050839_IDEMPIERE-2188.sql') FROM dual +; + diff --git a/migration/i2.0z/postgresql/201409050848_IDEMPIERE-2190.sql b/migration/i2.0z/postgresql/201409050848_IDEMPIERE-2190.sql new file mode 100644 index 0000000000..eb934994ed --- /dev/null +++ b/migration/i2.0z/postgresql/201409050848_IDEMPIERE-2190.sql @@ -0,0 +1,15 @@ +-- Sep 5, 2014 8:46:44 AM COT +-- IDEMPIERE-2190 Virtual Column M_Product.CostStandard too heavy +UPDATE AD_Column SET IsActive='N',Updated=TO_TIMESTAMP('2014-09-05 08:46:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=61998 +; + +-- Sep 5, 2014 8:47:19 AM COT +UPDATE AD_Field SET SeqNo=0, IsDisplayed='N', IsActive='N', IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2014-09-05 08:47:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62009 +; + +UPDATE AD_Field SET SeqNo=0, IsDisplayed='N', IsActive='N', IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2014-09-05 08:47:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201344 +; + +SELECT register_migration_script('201409050848_IDEMPIERE-2190.sql') FROM dual +; + diff --git a/migration/i2.0z/postgresql/201409051545_IDEMPIERE-1901.sql b/migration/i2.0z/postgresql/201409051545_IDEMPIERE-1901.sql new file mode 100644 index 0000000000..0dc25b680d --- /dev/null +++ b/migration/i2.0z/postgresql/201409051545_IDEMPIERE-1901.sql @@ -0,0 +1,44 @@ +-- Sep 5, 2014 3:42:25 PM COT +-- IDEMPIERE-1901 Deprecate parent composite primary keys - leave management via table index +INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,Description,DefaultValue,Help,Name,IsAllowCopy,Updated,CreatedBy,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,IsEncrypted,IsSecure,AD_Element_ID,AD_Reference_ID,AD_Table_ID,AD_Client_ID,AD_Org_ID,EntityType) VALUES (0,'N',0,211762,'Y','N','N',0,'N',1,'N','N','N','Y','f1e7a14f-8ab9-4b2e-9655-95d728ecdc18','Y','IsKey','This column is the key in this table','N','The key column must also be display sequence 0 in the field definition and may be hidden.','Key column','Y',TO_TIMESTAMP('2014-09-05 15:42:25','YYYY-MM-DD HH24:MI:SS'),100,'Y',TO_TIMESTAMP('2014-09-05 15:42:25','YYYY-MM-DD HH24:MI:SS'),100,'N','N','N','N',389,20,200085,0,0,'D') +; + +-- Sep 5, 2014 3:42:31 PM COT +ALTER TABLE AD_TableIndex ADD COLUMN IsKey CHAR(1) DEFAULT 'N' CHECK (IsKey IN ('Y','N')) NOT NULL +; + +-- Sep 5, 2014 3:42:57 PM COT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,CreatedBy,Updated,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,AD_Org_ID,Created) VALUES ('N',200096,1,'N','N',140,'Y',203443,'N','The key column must also be display sequence 0 in the field definition and may be hidden.','This column is the key in this table','Key column','606cdea6-8002-4c89-b507-bdeffd5acb2b','Y','N',100,100,TO_TIMESTAMP('2014-09-05 15:42:57','YYYY-MM-DD HH24:MI:SS'),'Y','Y',110,2,0,2,211762,'D',0,TO_TIMESTAMP('2014-09-05 15:42:57','YYYY-MM-DD HH24:MI:SS')) +; + +-- Sep 5, 2014 3:43:29 PM COT +UPDATE AD_Field SET SeqNo=90, ColumnSpan=1,Updated=TO_TIMESTAMP('2014-09-05 15:43:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202209 +; + +-- Sep 5, 2014 3:43:29 PM COT +UPDATE AD_Field SET SeqNo=100, IsDisplayed='Y', XPosition=3, ColumnSpan=1,Updated=TO_TIMESTAMP('2014-09-05 15:43:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203443 +; + +-- Sep 5, 2014 3:43:29 PM COT +UPDATE AD_Field SET SeqNo=110,Updated=TO_TIMESTAMP('2014-09-05 15:43:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202250 +; + +-- Sep 5, 2014 3:43:29 PM COT +UPDATE AD_Field SET SeqNo=120,Updated=TO_TIMESTAMP('2014-09-05 15:43:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202206 +; + +-- Sep 5, 2014 3:43:29 PM COT +UPDATE AD_Field SET SeqNo=130,Updated=TO_TIMESTAMP('2014-09-05 15:43:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202210 +; + +-- Sep 5, 2014 3:43:29 PM COT +UPDATE AD_Field SET SeqNo=140,Updated=TO_TIMESTAMP('2014-09-05 15:43:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202535 +; + +-- Sep 5, 2014 3:44:41 PM COT +UPDATE AD_Field SET DisplayLogic='@IsCreateConstraint@=''Y'' & @IsUnique@=''Y''',Updated=TO_TIMESTAMP('2014-09-05 15:44:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203443 +; + +SELECT register_migration_script('201409051545_IDEMPIERE-1901.sql') FROM dual +; + diff --git a/migration/i2.0z/postgresql/201409051652_IDEMPIERE-1842.sql b/migration/i2.0z/postgresql/201409051652_IDEMPIERE-1842.sql new file mode 100644 index 0000000000..280b88cfd5 --- /dev/null +++ b/migration/i2.0z/postgresql/201409051652_IDEMPIERE-1842.sql @@ -0,0 +1,3 @@ +update ad_column set callout = 'org.compiere.model.CalloutOrder.organization' where ad_column_id = 2163; + +SELECT register_migration_script('201409051652_IDEMPIERE-1842.sql') FROM dual; diff --git a/migration/i2.0z/postgresql/201409051741_IDEMPIERE-1970.sql b/migration/i2.0z/postgresql/201409051741_IDEMPIERE-1970.sql new file mode 100644 index 0000000000..582bff9bdd --- /dev/null +++ b/migration/i2.0z/postgresql/201409051741_IDEMPIERE-1970.sql @@ -0,0 +1,34 @@ +update ad_infoprocess set ad_column_id=null where ad_column_id is not null; + +ALTER TABLE ad_infoprocess RENAME ad_column_id TO ad_infocolumn_id; + +ALTER TABLE ad_infoprocess DROP CONSTRAINT adcolumn_adinfoprocess CASCADE; + +-- Sep 5, 2014 5:40:41 PM COT +-- IDEMPIERE-1970 Improve t_selection logic for info window +INSERT INTO AD_Val_Rule (Code,AD_Val_Rule_ID,EntityType,Name,Type,AD_Val_Rule_UU,CreatedBy,UpdatedBy,Updated,AD_Org_ID,IsActive,AD_Client_ID,Created) VALUES ('AD_InfoColumn.AD_InfoWindow_ID=@AD_InfoWindow_ID@',200065,'D','AD_InfoColumn from Info Window','S','010f3e1f-dd6c-48c7-8fe1-945e0a2482a2',100,100,TO_TIMESTAMP('2014-09-05 17:40:37','YYYY-MM-DD HH24:MI:SS'),0,'Y',0,TO_TIMESTAMP('2014-09-05 17:40:37','YYYY-MM-DD HH24:MI:SS')) +; + +-- Sep 5, 2014 5:40:55 PM COT +UPDATE AD_Column SET FieldLength=10, IsUpdateable='N', ColumnName='AD_InfoColumn_ID', Description='Info Window Column', Help='Column in the Info Window for display and/or selection. If used for selection, the column cannot be a SQL expression. The SQL clause must be fully qualified based on the FROM clause in the Info Window definition', Name='Info Column', FKConstraintName=NULL, AD_Element_ID=3069, AD_Val_Rule_ID=200065,Updated=TO_TIMESTAMP('2014-09-05 17:40:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=211377 +; + +-- Sep 5, 2014 5:41:00 PM COT +UPDATE AD_Column SET FKConstraintName='ADInfoColumn_ADInfoProcess', FKConstraintType='N',Updated=TO_TIMESTAMP('2014-09-05 17:41:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=211377 +; + +-- Sep 5, 2014 5:41:00 PM COT +INSERT INTO t_alter_column values('ad_infoprocess','AD_InfoColumn_ID','NUMERIC(10)',null,'NULL') +; + +-- Sep 5, 2014 5:41:00 PM COT +ALTER TABLE AD_InfoProcess ADD CONSTRAINT ADInfoColumn_ADInfoProcess FOREIGN KEY (AD_InfoColumn_ID) REFERENCES ad_infocolumn(ad_infocolumn_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Sep 5, 2014 5:44:01 PM COT +UPDATE AD_Column SET IsUpdateable='Y',Updated=TO_TIMESTAMP('2014-09-05 17:44:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=211377 +; + +SELECT register_migration_script('201409051741_IDEMPIERE-1970.sql') FROM dual +; + diff --git a/migration/i2.0z/postgresql/201409251410_IDEMPIERE-1840.sql b/migration/i2.0z/postgresql/201409251410_IDEMPIERE-1840.sql new file mode 100644 index 0000000000..7b38fae0a7 --- /dev/null +++ b/migration/i2.0z/postgresql/201409251410_IDEMPIERE-1840.sql @@ -0,0 +1,8 @@ +-- Mar 20, 2014 10:54:24 AM COT +-- IDEMPIERE-1840 Reference AD_Org Parent WhereClause bug +UPDATE AD_Ref_Table SET WhereClause='AD_Org.IsSummary=''Y''',Updated=TO_TIMESTAMP('2014-03-20 10:54:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=113 +; + +SELECT register_migration_script('201409251410_IDEMPIERE-1840.sql') FROM dual +; + diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java index a8aef526ce..1afce71542 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java @@ -1374,6 +1374,27 @@ public class CalloutOrder extends CalloutEngine return ""; } // SalesOrderTenderType - + public String organization(Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value){ + + //Return if Organization field is empty + if(value == null || (Integer)value == 0) + return ""; + + log.info("Set default Warehouse for Organization " + value + " on Window " + WindowNo); + + //Get the current Warehouse + Integer m_warehouse_id = (Integer) mTab.getValue("M_Warehouse_ID"); + + //Only set Warehouse if the field is empty + if(m_warehouse_id == null || m_warehouse_id == 0){ + Integer ad_org_id = (Integer) value; + MOrgInfo orginfo = MOrgInfo.get(ctx, ad_org_id.intValue(), null); + + //only set Warehouse if there is a default Warehouse on OrgInfo + if(orginfo!=null && orginfo.getM_Warehouse_ID() != 0) + mTab.setValue("M_Warehouse_ID", orginfo.getM_Warehouse_ID()); + } + return ""; + } } // CalloutOrder diff --git a/org.adempiere.base.process/src/org/compiere/process/ExpenseAPInvoice.java b/org.adempiere.base.process/src/org/compiere/process/ExpenseAPInvoice.java index cd2e528ba4..be286a8349 100644 --- a/org.adempiere.base.process/src/org/compiere/process/ExpenseAPInvoice.java +++ b/org.adempiere.base.process/src/org/compiere/process/ExpenseAPInvoice.java @@ -120,7 +120,7 @@ public class ExpenseAPInvoice extends SvrProcess MBPartner bp = new MBPartner (getCtx(), te.getC_BPartner_ID(), get_TrxName()); // if (log.isLoggable(Level.INFO)) log.info("New Invoice for " + bp); - invoice = new MInvoice (getCtx(), 0, null); + invoice = new MInvoice (getCtx(), 0, get_TrxName()); invoice.setClientOrg(te.getAD_Client_ID(), te.getAD_Org_ID()); invoice.setC_DocTypeTarget_ID(MDocType.DOCBASETYPE_APInvoice); // API invoice.setDocumentNo (te.getDocumentNo()); diff --git a/org.adempiere.base.process/src/org/compiere/process/ImportInventory.java b/org.adempiere.base.process/src/org/compiere/process/ImportInventory.java index 7b599f9147..4401be2e9d 100644 --- a/org.adempiere.base.process/src/org/compiere/process/ImportInventory.java +++ b/org.adempiere.base.process/src/org/compiere/process/ImportInventory.java @@ -527,6 +527,7 @@ public class ImportInventory extends SvrProcess costingDoc = new MInventory(getCtx(), 0, get_TrxName()); costingDoc.setC_DocType_ID(p_C_DocType_ID); costingDoc.setCostingMethod(cost.getM_CostElement().getCostingMethod()); + costingDoc.setAD_Org_ID(imp.getAD_Org_ID()); costingDoc.setDocAction(DocAction.ACTION_Complete); costingDoc.saveEx(); } @@ -537,6 +538,7 @@ public class ImportInventory extends SvrProcess costingLine.setCurrentCostPrice(cost.getCurrentCostPrice()); costingLine.setNewCostPrice(imp.getCurrentCostPrice()); costingLine.setM_Locator_ID(0); + costingLine.setAD_Org_ID(imp.getAD_Org_ID()); costingLine.saveEx(); imp.setM_CostingLine_ID(costingLine.getM_InventoryLine_ID()); diff --git a/org.adempiere.base/src/org/adempiere/model/MInfoProcess.java b/org.adempiere.base/src/org/adempiere/model/MInfoProcess.java index d9d4d37b25..8e6de42a8b 100644 --- a/org.adempiere.base/src/org/adempiere/model/MInfoProcess.java +++ b/org.adempiere.base/src/org/adempiere/model/MInfoProcess.java @@ -16,7 +16,7 @@ package org.adempiere.model; import java.sql.ResultSet; import java.util.Properties; import java.util.logging.Level; -import org.compiere.model.MColumn; + import org.compiere.model.MProcess; import org.compiere.model.X_AD_InfoProcess; import org.compiere.util.Env; @@ -33,7 +33,7 @@ public class MInfoProcess extends X_AD_InfoProcess { /** * */ - private static final long serialVersionUID = -2167041563372362436L; + private static final long serialVersionUID = 2478699719088685214L; /** * {@inheritDoc} @@ -89,25 +89,4 @@ public class MInfoProcess extends X_AD_InfoProcess { return retValue; } - /** - * name of column define is ViewID - * @return - */ - public String getViewIDName (){ - // no column define - if (getAD_Column_ID() == 0) - return null; - - // return cache value - if (m_viewIDName != null) - return m_viewIDName; - - MColumn viewIDColumn = (MColumn)getAD_Column(); - if (viewIDColumn != null){ - return viewIDColumn.getColumnName(); -} - - return null; - } - } diff --git a/org.adempiere.base/src/org/adempiere/model/MTabCustomization.java b/org.adempiere.base/src/org/adempiere/model/MTabCustomization.java index 04261bb219..54110e13c1 100644 --- a/org.adempiere.base/src/org/adempiere/model/MTabCustomization.java +++ b/org.adempiere.base/src/org/adempiere/model/MTabCustomization.java @@ -32,6 +32,6 @@ public class MTabCustomization extends X_AD_Tab_Customization { */ public static MTabCustomization get(Properties ctx, int AD_User_ID, int AD_Tab_ID, String trxName) { Query query = new Query(ctx, Table_Name, "AD_User_ID=? AND AD_Tab_ID=?", trxName); - return query.setParameters(new Object[]{AD_User_ID, AD_Tab_ID}).first(); + return query.setClient_ID().setParameters(new Object[]{AD_User_ID, AD_Tab_ID}).first(); } } diff --git a/org.adempiere.base/src/org/compiere/acct/Doc.java b/org.adempiere.base/src/org/compiere/acct/Doc.java index d03ac4aab2..8a146028cc 100644 --- a/org.adempiere.base/src/org/compiere/acct/Doc.java +++ b/org.adempiere.base/src/org/compiere/acct/Doc.java @@ -1004,7 +1004,7 @@ public abstract class Doc m_period = MPeriod.get(getCtx(), ii.intValue()); } if (m_period == null) - m_period = MPeriod.get(getCtx(), getDateAcct(), getAD_Org_ID()); + m_period = MPeriod.get(getCtx(), getDateAcct(), getAD_Org_ID(), m_trxName); // Is Period Open? if (m_period != null && m_period.isOpen(getDocumentType(), getDateAcct())) diff --git a/org.adempiere.base/src/org/compiere/acct/DocTax.java b/org.adempiere.base/src/org/compiere/acct/DocTax.java index 13a4f9309c..f444c1aa1c 100644 --- a/org.adempiere.base/src/org/compiere/acct/DocTax.java +++ b/org.adempiere.base/src/org/compiere/acct/DocTax.java @@ -51,6 +51,7 @@ public final class DocTax m_C_Tax_ID = C_Tax_ID; m_name = name; m_rate = rate; + m_taxBaseAmt = taxBaseAmt;//IDEMPIERE-2160 Add by Hideaki Hagiwara m_amount = amount; m_salesTax = salesTax; } // DocTax diff --git a/org.adempiere.base/src/org/compiere/model/GridTable.java b/org.adempiere.base/src/org/compiere/model/GridTable.java index 83a0c95df4..1bed622ae9 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTable.java +++ b/org.adempiere.base/src/org/compiere/model/GridTable.java @@ -1073,13 +1073,14 @@ public class GridTable extends AbstractTableModel public void waitLoadingForRow(int row) { // need to wait for data read into buffer int loops = 0; - //wait for 30 seconds - while (row >= m_sort.size() && m_loaderFuture != null && !m_loaderFuture.isDone() && loops < 60) + //wait for [timeout] seconds + int timeout = MSysConfig.getIntValue(MSysConfig.GRIDTABLE_LOAD_TIMEOUT_IN_SECONDS, 30, Env.getAD_Client_ID(Env.getCtx())); + while (row >= m_sort.size() && m_loaderFuture != null && !m_loaderFuture.isDone() && loops < timeout) { if (log.isLoggable(Level.FINE)) log.fine("Waiting for loader row=" + row + ", size=" + m_sort.size()); try { - m_loaderFuture.get(500, TimeUnit.MILLISECONDS); + m_loaderFuture.get(1000, TimeUnit.MILLISECONDS); } catch (Exception ie) {} @@ -1092,6 +1093,7 @@ public class GridTable extends AbstractTableModel throw new IllegalStateException(savedEx); } if (row >= m_sort.size()) { + log.warning("Reached " + timeout + " seconds timeout loading row " + (row+1) + " for SQL=" + m_SQL); throw new IllegalStateException("Timeout loading row " + (row+1)); } } diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_InfoProcess.java b/org.adempiere.base/src/org/compiere/model/I_AD_InfoProcess.java index da0c5bfbba..69120a0d3d 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_InfoProcess.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_InfoProcess.java @@ -49,20 +49,20 @@ public interface I_AD_InfoProcess */ public int getAD_Client_ID(); - /** Column name AD_Column_ID */ - public static final String COLUMNNAME_AD_Column_ID = "AD_Column_ID"; + /** Column name AD_InfoColumn_ID */ + public static final String COLUMNNAME_AD_InfoColumn_ID = "AD_InfoColumn_ID"; - /** Set ViewID Column. - * Name of unique column in a view. value of this column will save to t_selection table + /** Set Info Column. + * Info Window Column */ - public void setAD_Column_ID (int AD_Column_ID); + public void setAD_InfoColumn_ID (int AD_InfoColumn_ID); - /** Get ViewID Column. - * Name of unique column in a view. value of this column will save to t_selection table + /** Get Info Column. + * Info Window Column */ - public int getAD_Column_ID(); + public int getAD_InfoColumn_ID(); - public org.compiere.model.I_AD_Column getAD_Column() throws RuntimeException; + public org.compiere.model.I_AD_InfoColumn getAD_InfoColumn() throws RuntimeException; /** Column name AD_InfoProcess_ID */ public static final String COLUMNNAME_AD_InfoProcess_ID = "AD_InfoProcess_ID"; diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_TableIndex.java b/org.adempiere.base/src/org/compiere/model/I_AD_TableIndex.java index c1ed38454a..230a866afc 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_TableIndex.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_TableIndex.java @@ -189,6 +189,19 @@ public interface I_AD_TableIndex /** Get Create Constraint */ public boolean isCreateConstraint(); + /** Column name IsKey */ + public static final String COLUMNNAME_IsKey = "IsKey"; + + /** Set Key column. + * This column is the key in this table + */ + public void setIsKey (boolean IsKey); + + /** Get Key column. + * This column is the key in this table + */ + public boolean isKey(); + /** Column name IsUnique */ public static final String COLUMNNAME_IsUnique = "IsUnique"; @@ -220,6 +233,15 @@ public interface I_AD_TableIndex /** Get Process Now */ public boolean isProcessing(); + /** Column name TableIndexDrop */ + public static final String COLUMNNAME_TableIndexDrop = "TableIndexDrop"; + + /** Set Drop table index */ + public void setTableIndexDrop (String TableIndexDrop); + + /** Get Drop table index */ + public String getTableIndexDrop(); + /** Column name Updated */ public static final String COLUMNNAME_Updated = "Updated"; diff --git a/org.adempiere.base/src/org/compiere/model/I_M_Product.java b/org.adempiere.base/src/org/compiere/model/I_M_Product.java index 0c1fb78de4..d587905812 100644 --- a/org.adempiere.base/src/org/compiere/model/I_M_Product.java +++ b/org.adempiere.base/src/org/compiere/model/I_M_Product.java @@ -88,19 +88,6 @@ public interface I_M_Product */ public String getCopyFrom(); - /** Column name CostStandard */ - public static final String COLUMNNAME_CostStandard = "CostStandard"; - - /** Set Standard Cost. - * Standard Costs - */ - public void setCostStandard (BigDecimal CostStandard); - - /** Get Standard Cost. - * Standard Costs - */ - public BigDecimal getCostStandard(); - /** Column name Created */ public static final String COLUMNNAME_Created = "Created"; @@ -229,6 +216,19 @@ public interface I_M_Product */ public Timestamp getDiscontinuedAt(); + /** Column name DocumentDescription */ + public static final String COLUMNNAME_DocumentDescription = "DocumentDescription"; + + /** Set DocumentDescription. + * DocumentDescription + */ + public void setDocumentDescription (String DocumentDescription); + + /** Get DocumentDescription. + * DocumentDescription + */ + public String getDocumentDescription(); + /** Column name DocumentNote */ public static final String COLUMNNAME_DocumentNote = "DocumentNote"; @@ -299,6 +299,24 @@ public interface I_M_Product */ public String getHelp(); + /** Column name ImageBig_ID */ + public static final String COLUMNNAME_ImageBig_ID = "ImageBig_ID"; + + /** Set ImageBig_ID */ + public void setImageBig_ID (int ImageBig_ID); + + /** Get ImageBig_ID */ + public int getImageBig_ID(); + + /** Column name ImageSmall_ID */ + public static final String COLUMNNAME_ImageSmall_ID = "ImageSmall_ID"; + + /** Set ImageSmall_ID */ + public void setImageSmall_ID (int ImageSmall_ID); + + /** Get ImageSmall_ID */ + public int getImageSmall_ID(); + /** Column name ImageURL */ public static final String COLUMNNAME_ImageURL = "ImageURL"; diff --git a/org.adempiere.base/src/org/compiere/model/MAssetDisposed.java b/org.adempiere.base/src/org/compiere/model/MAssetDisposed.java index a391976fe3..6e28a1a77b 100644 --- a/org.adempiere.base/src/org/compiere/model/MAssetDisposed.java +++ b/org.adempiere.base/src/org/compiere/model/MAssetDisposed.java @@ -325,7 +325,7 @@ implements DocAction } if (newRecord || is_ValueChanged(COLUMNNAME_DateAcct)) { - setC_Period_ID(MPeriod.get(getCtx(), getDateAcct(), getAD_Org_ID()).get_ID()); + setC_Period_ID(MPeriod.get(getCtx(), getDateAcct(), getAD_Org_ID(), get_TrxName()).get_ID()); } if (getA_Disposed_Date() == null) { diff --git a/org.adempiere.base/src/org/compiere/model/MAssetTransfer.java b/org.adempiere.base/src/org/compiere/model/MAssetTransfer.java index 3a8174751a..b571bcc66b 100644 --- a/org.adempiere.base/src/org/compiere/model/MAssetTransfer.java +++ b/org.adempiere.base/src/org/compiere/model/MAssetTransfer.java @@ -71,7 +71,7 @@ implements DocAction public void setC_Period_ID() { - MPeriod period = MPeriod.get(getCtx(), getDateAcct(), getAD_Org_ID()); + MPeriod period = MPeriod.get(getCtx(), getDateAcct(), getAD_Org_ID(), get_TrxName()); if (period == null) { throw new AdempiereException("@NotFound@ @C_Period_ID@"); diff --git a/org.adempiere.base/src/org/compiere/model/MBPGroup.java b/org.adempiere.base/src/org/compiere/model/MBPGroup.java index 4e02ef7172..9d8ae48efc 100644 --- a/org.adempiere.base/src/org/compiere/model/MBPGroup.java +++ b/org.adempiere.base/src/org/compiere/model/MBPGroup.java @@ -39,7 +39,7 @@ public class MBPGroup extends X_C_BP_Group /** * */ - private static final long serialVersionUID = -5323639776872742839L; + private static final long serialVersionUID = 8897399796117872715L; /** * Get MBPGroup from Cache @@ -244,15 +244,5 @@ public class MBPGroup extends X_C_BP_Group return insert_Accounting("C_BP_Group_Acct", "C_AcctSchema_Default", null); return success; } // afterSave - - - /** - * Before Delete - * @return true - */ - protected boolean beforeDelete () - { - return delete_Accounting("C_BP_Group_Acct"); - } // beforeDelete - + } // MBPGroup diff --git a/org.adempiere.base/src/org/compiere/model/MBPartner.java b/org.adempiere.base/src/org/compiere/model/MBPartner.java index 913b1906ce..c6eea18f51 100644 --- a/org.adempiere.base/src/org/compiere/model/MBPartner.java +++ b/org.adempiere.base/src/org/compiere/model/MBPartner.java @@ -47,7 +47,7 @@ public class MBPartner extends X_C_BPartner /** * */ - private static final long serialVersionUID = -4308267492285903865L; + private static final long serialVersionUID = -5503105554864289337L; /** * Get Empty Template Business Partner @@ -945,17 +945,6 @@ public class MBPartner extends X_C_BPartner return success; } // afterSave - /** - * Before Delete - * @return true - */ - protected boolean beforeDelete () - { - return delete_Accounting("C_BP_Customer_Acct") - && delete_Accounting("C_BP_Vendor_Acct") - && delete_Accounting("C_BP_Employee_Acct"); - } // beforeDelete - /** * After Delete * @param success diff --git a/org.adempiere.base/src/org/compiere/model/MBankAccount.java b/org.adempiere.base/src/org/compiere/model/MBankAccount.java index 65fae5382d..54a6a578bc 100644 --- a/org.adempiere.base/src/org/compiere/model/MBankAccount.java +++ b/org.adempiere.base/src/org/compiere/model/MBankAccount.java @@ -34,7 +34,7 @@ public class MBankAccount extends X_C_BankAccount /** * */ - private static final long serialVersionUID = -8742307130542608791L; + private static final long serialVersionUID = 2392818253347168347L; /** * Get BankAccount from Cache @@ -133,14 +133,5 @@ public class MBankAccount extends X_C_BankAccount return insert_Accounting("C_BankAccount_Acct", "C_AcctSchema_Default", null); return success; } // afterSave - - /** - * Before Delete - * @return true - */ - protected boolean beforeDelete () - { - return delete_Accounting("C_BankAccount_Acct"); - } // beforeDelete } // MBankAccount diff --git a/org.adempiere.base/src/org/compiere/model/MCashBook.java b/org.adempiere.base/src/org/compiere/model/MCashBook.java index c5915e8c73..d486d503e2 100644 --- a/org.adempiere.base/src/org/compiere/model/MCashBook.java +++ b/org.adempiere.base/src/org/compiere/model/MCashBook.java @@ -35,7 +35,7 @@ public class MCashBook extends X_C_CashBook /** * */ - private static final long serialVersionUID = 4602423783184037174L; + private static final long serialVersionUID = 3991585668643587699L; /** * Get MCashBook from Cache @@ -143,13 +143,4 @@ public class MCashBook extends X_C_CashBook return success; } // afterSave - /** - * Before Delete - * @return true - */ - protected boolean beforeDelete () - { - return delete_Accounting("C_Cashbook_Acct"); - } // beforeDelete - } // MCashBook diff --git a/org.adempiere.base/src/org/compiere/model/MCharge.java b/org.adempiere.base/src/org/compiere/model/MCharge.java index 13ec4cb005..2432e6a13e 100644 --- a/org.adempiere.base/src/org/compiere/model/MCharge.java +++ b/org.adempiere.base/src/org/compiere/model/MCharge.java @@ -39,7 +39,7 @@ public class MCharge extends X_C_Charge /** * */ - private static final long serialVersionUID = 8246481667219415012L; + private static final long serialVersionUID = -4628105180010713510L; /** * Get Charge Account @@ -150,13 +150,4 @@ public class MCharge extends X_C_Charge return success; } // afterSave - /** - * Before Delete - * @return true - */ - protected boolean beforeDelete () - { - return delete_Accounting("C_Charge_Acct"); - } // beforeDelete - } // MCharge diff --git a/org.adempiere.base/src/org/compiere/model/MDepreciationEntry.java b/org.adempiere.base/src/org/compiere/model/MDepreciationEntry.java index 0ad5af1767..10995f7dfc 100644 --- a/org.adempiere.base/src/org/compiere/model/MDepreciationEntry.java +++ b/org.adempiere.base/src/org/compiere/model/MDepreciationEntry.java @@ -93,7 +93,7 @@ implements DocAction public void setC_Period_ID() { - MPeriod period = MPeriod.get(getCtx(), getDateAcct(), getAD_Org_ID()); + MPeriod period = MPeriod.get(getCtx(), getDateAcct(), getAD_Org_ID(), get_TrxName()); if (period == null) { throw new AdempiereException("@NotFound@ @C_Period_ID@"); diff --git a/org.adempiere.base/src/org/compiere/model/MInOut.java b/org.adempiere.base/src/org/compiere/model/MInOut.java index 0c483f3fb2..f5f1418829 100644 --- a/org.adempiere.base/src/org/compiere/model/MInOut.java +++ b/org.adempiere.base/src/org/compiere/model/MInOut.java @@ -1463,10 +1463,7 @@ public class MInOut extends X_M_InOut implements DocAction // Correct Order Line if (product != null && oLine != null) // other in VMatch.createMatchRecord { - if (isSOTrx()) - oLine.setQtyReserved(oLine.getQtyReserved().subtract(sLine.getMovementQty())); - else - oLine.setQtyReserved(oLine.getQtyReserved().subtract(sLine.getMovementQty().subtract(sLine.getQtyOverReceipt()))); + oLine.setQtyReserved(oLine.getQtyReserved().subtract(sLine.getMovementQty().subtract(sLine.getQtyOverReceipt()))); } // Update Sales Order Line @@ -1820,6 +1817,8 @@ public class MInOut extends X_M_InOut implements DocAction for(MInOutLineMA sMA : shipmentMAS){ BigDecimal lineMAQty = qtyToReturn; BigDecimal qtyReturnable = (BigDecimal)sMA.get_Value(MInOutLineMA.COLUMNNAME_ReturnedQty); + if (qtyReturnable == null) + qtyReturnable = Env.ZERO; if(lineMAQty.compareTo(qtyReturnable)>0){ lineMAQty = qtyReturnable; } diff --git a/org.adempiere.base/src/org/compiere/model/MInfoWindow.java b/org.adempiere.base/src/org/compiere/model/MInfoWindow.java index 19d431cb13..3cb5124094 100644 --- a/org.adempiere.base/src/org/compiere/model/MInfoWindow.java +++ b/org.adempiere.base/src/org/compiere/model/MInfoWindow.java @@ -42,7 +42,7 @@ public class MInfoWindow extends X_AD_InfoWindow /** * */ - private static final long serialVersionUID = -3099366897275960300L; + private static final long serialVersionUID = -3627504150648422756L; /** * Standard Constructor @@ -178,6 +178,15 @@ public class MInfoWindow extends X_AD_InfoWindow } + /** return true if the current role can access to the specified info window ; otherwise return null */ + public static MInfoWindow get(int infoWindowID, String trxName) { + MInfoWindow iw = new MInfoWindow(Env.getCtx(), infoWindowID, null); + Boolean access = MRole.getDefault().getInfoAccess(iw.getAD_InfoWindow_ID()); + if (access != null && access.booleanValue()) + return iw; + return null; + } + public MInfoColumn[] getInfoColumns(TableInfo[] tableInfos) { Query query = new Query(getCtx(), MTable.get(getCtx(), I_AD_InfoColumn.Table_ID), I_AD_InfoColumn.COLUMNNAME_AD_InfoWindow_ID+"=?", get_TrxName()); List list = query.setParameters(getAD_InfoWindow_ID()) diff --git a/org.adempiere.base/src/org/compiere/model/MJournal.java b/org.adempiere.base/src/org/compiere/model/MJournal.java index add27fd13b..170f93aa52 100644 --- a/org.adempiere.base/src/org/compiere/model/MJournal.java +++ b/org.adempiere.base/src/org/compiere/model/MJournal.java @@ -438,7 +438,7 @@ public class MJournal extends X_GL_Journal implements DocAction MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); // Get Period - MPeriod period = MPeriod.get (getCtx(), getDateAcct(), getAD_Org_ID()); + MPeriod period = MPeriod.get (getCtx(), getDateAcct(), getAD_Org_ID(), get_TrxName()); if (period == null) { log.warning("No Period for " + getDateAcct()); @@ -756,6 +756,7 @@ public class MJournal extends X_GL_Journal implements DocAction // Reverse indicator StringBuilder msgd = new StringBuilder("(->").append(getDocumentNo()).append(")"); reverse.addDescription(msgd.toString()); + reverse.setControlAmt(getControlAmt().negate()); //FR [ 1948157 ] reverse.setReversal_ID(getGL_Journal_ID()); if (!reverse.save()) diff --git a/org.adempiere.base/src/org/compiere/model/MJournalBatch.java b/org.adempiere.base/src/org/compiere/model/MJournalBatch.java index ec67283ab7..9270bdfe45 100644 --- a/org.adempiere.base/src/org/compiere/model/MJournalBatch.java +++ b/org.adempiere.base/src/org/compiere/model/MJournalBatch.java @@ -630,6 +630,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction // Reverse indicator StringBuilder msgd = new StringBuilder("(->").append(getDocumentNo()).append(")"); reverse.addDescription(msgd.toString()); + reverse.setControlAmt(getControlAmt().negate()); //[ 1948157 ] reverse.setReversal_ID(getGL_JournalBatch_ID()); reverse.saveEx(); diff --git a/org.adempiere.base/src/org/compiere/model/MOrder.java b/org.adempiere.base/src/org/compiere/model/MOrder.java index 23f0389722..2d4b64a396 100644 --- a/org.adempiere.base/src/org/compiere/model/MOrder.java +++ b/org.adempiere.base/src/org/compiere/model/MOrder.java @@ -1193,10 +1193,7 @@ public class MOrder extends X_C_Order implements DocAction { if (isProcessed()) return false; - - for (MOrderLine line : getLines()) { - line.deleteEx(true); - } + // automatic deletion of lines is driven by model cascade definition in dictionary - see IDEMPIERE-2060 return true; } // beforeDelete diff --git a/org.adempiere.base/src/org/compiere/model/MPeriod.java b/org.adempiere.base/src/org/compiere/model/MPeriod.java index a93227c3d2..525e92bed9 100644 --- a/org.adempiere.base/src/org/compiere/model/MPeriod.java +++ b/org.adempiere.base/src/org/compiere/model/MPeriod.java @@ -54,7 +54,7 @@ public class MPeriod extends X_C_Period /** * */ - private static final long serialVersionUID = 6498973218391994963L; + private static final long serialVersionUID = -1636783790829454894L; /** * Get Period from Cache @@ -97,7 +97,7 @@ public class MPeriod extends X_C_Period * @param AD_Org_ID Organization * @return active Period or null */ - public static MPeriod get (Properties ctx, Timestamp DateAcct, int AD_Org_ID) + public static MPeriod get (Properties ctx, Timestamp DateAcct, int AD_Org_ID, String trxName) { if (DateAcct == null) @@ -105,9 +105,15 @@ public class MPeriod extends X_C_Period int C_Calendar_ID = getC_Calendar_ID(ctx,AD_Org_ID); - return findByCalendar(ctx, DateAcct, C_Calendar_ID); + return findByCalendar(ctx, DateAcct, C_Calendar_ID, trxName); } // get + @Deprecated + public static MPeriod get (Properties ctx, Timestamp DateAcct, int AD_Org_ID) + { + return get(ctx, DateAcct, AD_Org_ID, null); + } + /** * * @param ctx diff --git a/org.adempiere.base/src/org/compiere/model/MProduct.java b/org.adempiere.base/src/org/compiere/model/MProduct.java index 68e99774c6..ce10511096 100644 --- a/org.adempiere.base/src/org/compiere/model/MProduct.java +++ b/org.adempiere.base/src/org/compiere/model/MProduct.java @@ -757,7 +757,7 @@ public class MProduct extends X_M_Product }*/ // - return delete_Accounting("M_Product_Acct"); + return true; } // beforeDelete @Override diff --git a/org.adempiere.base/src/org/compiere/model/MProductCategory.java b/org.adempiere.base/src/org/compiere/model/MProductCategory.java index d191bf9820..1c836a32d9 100644 --- a/org.adempiere.base/src/org/compiere/model/MProductCategory.java +++ b/org.adempiere.base/src/org/compiere/model/MProductCategory.java @@ -41,8 +41,7 @@ public class MProductCategory extends X_M_Product_Category /** * */ - private static final long serialVersionUID = -1290361229726779892L; - + private static final long serialVersionUID = 1239249591584452179L; /** * Get from Cache @@ -178,15 +177,6 @@ public class MProductCategory extends X_M_Product_Category return success; } // afterSave - /** - * Before Delete - * @return true - */ - protected boolean beforeDelete () - { - return delete_Accounting("M_Product_Category_Acct"); - } // beforeDelete - /** * FiFo Material Movement Policy * @return true if FiFo diff --git a/org.adempiere.base/src/org/compiere/model/MProductPricing.java b/org.adempiere.base/src/org/compiere/model/MProductPricing.java index 0f740c8fac..199430e0d6 100644 --- a/org.adempiere.base/src/org/compiere/model/MProductPricing.java +++ b/org.adempiere.base/src/org/compiere/model/MProductPricing.java @@ -781,7 +781,7 @@ public class MProductPricing return; MDiscountSchema sd = MDiscountSchema.get(Env.getCtx(), M_DiscountSchema_ID); // not correct - if (sd.get_ID() == 0) + if (sd.get_ID() == 0 || MDiscountSchema.CUMULATIVELEVEL_Line.equals(sd.getCumulativeLevel())) return; // m_discountSchema = true; diff --git a/org.adempiere.base/src/org/compiere/model/MProject.java b/org.adempiere.base/src/org/compiere/model/MProject.java index 3854dcab3f..271caa4438 100644 --- a/org.adempiere.base/src/org/compiere/model/MProject.java +++ b/org.adempiere.base/src/org/compiere/model/MProject.java @@ -36,7 +36,7 @@ public class MProject extends X_C_Project /** * */ - private static final long serialVersionUID = 2151648902207548617L; + private static final long serialVersionUID = -6103964836289951325L; /** * Create new Project by copying @@ -442,15 +442,6 @@ public class MProject extends X_C_Project return success; } // afterSave - /** - * Before Delete - * @return true - */ - protected boolean beforeDelete () - { - return delete_Accounting("C_Project_Acct"); - } // beforeDelete - /** * After Delete * @param success diff --git a/org.adempiere.base/src/org/compiere/model/MQuery.java b/org.adempiere.base/src/org/compiere/model/MQuery.java index acca3d496f..bbb0fde4e3 100644 --- a/org.adempiere.base/src/org/compiere/model/MQuery.java +++ b/org.adempiere.base/src/org/compiere/model/MQuery.java @@ -1108,9 +1108,22 @@ class Restriction implements Serializable { if (DirectWhereClause != null) return DirectWhereClause; + // verify if is a virtual column, do not prefix tableName if this is a virtualColumn + boolean virtualColumn = false; + if (tableName != null && tableName.length() > 0) { + MTable table = MTable.get(Env.getCtx(), tableName); + if (table != null) { + for (MColumn col : table.getColumns(false)) { + if (ColumnName.equals(col.getColumnSQL())) { + virtualColumn = true; + break; + } + } + } + } // StringBuilder sb = new StringBuilder(); - if (tableName != null && tableName.length() > 0) + if (!virtualColumn && tableName != null && tableName.length() > 0) { // Assumes - REPLACE(INITCAP(variable),'s','X') or UPPER(variable) int pos = ColumnName.lastIndexOf('(')+1; // including ( diff --git a/org.adempiere.base/src/org/compiere/model/MSysConfig.java b/org.adempiere.base/src/org/compiere/model/MSysConfig.java index 84da9748bb..90d04f1041 100644 --- a/org.adempiere.base/src/org/compiere/model/MSysConfig.java +++ b/org.adempiere.base/src/org/compiere/model/MSysConfig.java @@ -42,7 +42,7 @@ public class MSysConfig extends X_AD_SysConfig /** * */ - private static final long serialVersionUID = -916592278422470367L; + private static final long serialVersionUID = 1418216769489567455L; public static final String ADDRESS_SAVE_REQUEST_RESPONSE_LOG = "ADDRESS_SAVE_REQUEST_RESPONSE_LOG"; public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION"; @@ -70,6 +70,7 @@ public class MSysConfig extends X_AD_SysConfig public static final String DOCACTIONBUTTON_SHOWACTIONNAME = "DOCACTIONBUTTON_SHOWACTIONNAME"; public static final String DPVIEWS_SHOWINFOACCOUNT = "DPViews_ShowInfoAccount"; public static final String DPVIEWS_SHOWINFOSCHEDULE = "DPViews_ShowInfoSchedule"; + public static final String GRIDTABLE_LOAD_TIMEOUT_IN_SECONDS = "GRIDTABLE_LOAD_TIMEOUT_IN_SECONDS"; public static final String Invoice_ReverseUseNewNumber = "Invoice_ReverseUseNewNumber"; public static final String JASPER_SWAP_MAX_PAGES = "JASPER_SWAP_MAX_PAGES"; public static final String LASTRUN_RECORD_COUNT = "LASTRUN_RECORD_COUNT"; diff --git a/org.adempiere.base/src/org/compiere/model/MTableIndex.java b/org.adempiere.base/src/org/compiere/model/MTableIndex.java index e36c310e0b..f54008ab3e 100644 --- a/org.adempiere.base/src/org/compiere/model/MTableIndex.java +++ b/org.adempiere.base/src/org/compiere/model/MTableIndex.java @@ -24,11 +24,10 @@ import org.adempiere.exceptions.AdempiereException; import org.compiere.util.Msg; public class MTableIndex extends X_AD_TableIndex { - /** * */ - private static final long serialVersionUID = 2672452678101398999L; + private static final long serialVersionUID = 5312095272014146977L; /** * Get active indexes from table @@ -168,7 +167,11 @@ public class MTableIndex extends X_AD_TableIndex { } else if (isUnique()) { - sql = new StringBuilder("ALTER TABLE " + getTableName() + " ADD CONSTRAINT " + getName() + " UNIQUE ("); + sql = new StringBuilder("ALTER TABLE ").append(getTableName()).append(" ADD CONSTRAINT ").append(getName()); + if (isKey()) + sql.append(" PRIMARY KEY ("); + else + sql.append(" UNIQUE ("); getColumns(false); for (int i = 0; i < m_columns.length; i++) { @@ -189,7 +192,7 @@ public class MTableIndex extends X_AD_TableIndex { return sql.toString(); } - + /** * Get SQL index create DDL * @return SQL DDL @@ -201,6 +204,20 @@ public class MTableIndex extends X_AD_TableIndex { return m_ddl; } + /** + * Get SQL index create DDL + * @return SQL DDL + */ + public String getDropDDL() + { + String sql = null; + if (isCreateConstraint()) + sql = "ALTER TABLE " + getAD_Table().getTableName() + " DROP CONSTRAINT " + getName() + " CASCADE"; + else + sql = "DROP INDEX " + getName(); + return sql; + } + /** * String representation * @return info diff --git a/org.adempiere.base/src/org/compiere/model/MTax.java b/org.adempiere.base/src/org/compiere/model/MTax.java index b328a4788f..4aff126572 100644 --- a/org.adempiere.base/src/org/compiere/model/MTax.java +++ b/org.adempiere.base/src/org/compiere/model/MTax.java @@ -41,8 +41,8 @@ public class MTax extends X_C_Tax /** * */ - private static final long serialVersionUID = 6423328193350641479L; - + private static final long serialVersionUID = 5871827364071851846L; + /** Cache */ private static CCache s_cache = new CCache(Table_Name, 5); /** Cache of Client */ @@ -317,13 +317,4 @@ public class MTax extends X_C_Tax return success; } // afterSave - /** - * Before Delete - * @return true - */ - protected boolean beforeDelete () - { - return delete_Accounting("C_Tax_Acct"); - } // beforeDelete - } // MTax diff --git a/org.adempiere.base/src/org/compiere/model/MUserDefWin.java b/org.adempiere.base/src/org/compiere/model/MUserDefWin.java index 22e2796e0e..6948f6fdad 100644 --- a/org.adempiere.base/src/org/compiere/model/MUserDefWin.java +++ b/org.adempiere.base/src/org/compiere/model/MUserDefWin.java @@ -106,11 +106,6 @@ public class MUserDefWin extends X_AD_UserDef_Win */ public static MUserDefWin getBestMatch (Properties ctx, int window_ID) { - // Check Cache - Integer key = new Integer(window_ID); - if (s_cache.containsKey(key)) - return s_cache.get(key); - // parameters final int AD_Org_ID = Env.getAD_Org_ID(ctx); //final int anyOrg = 0; @@ -119,6 +114,17 @@ public class MUserDefWin extends X_AD_UserDef_Win final int AD_User_ID = Env.getAD_User_ID(ctx); //final String anyUser = "NULL"; + // Check Cache + String key = new StringBuilder().append(window_ID).append("_") + .append(Env.getAD_Client_ID(ctx)).append("_") + .append(Env.getAD_Language(ctx)).append("_") + .append(AD_Org_ID).append("_") + .append(AD_Role_ID).append("_") + .append(AD_User_ID) + .toString(); + if (s_cache.containsKey(key)) + return s_cache.get(key); + // candidates MUserDefWin[] candidates = getAll(ctx, window_ID); if (candidates == null) { @@ -189,7 +195,7 @@ public class MUserDefWin extends X_AD_UserDef_Win } /** Cache of selected MUserDefWin entries **/ - private static CCache s_cache = new CCache(Table_Name, 3); // 3 weights + private static CCache s_cache = new CCache(Table_Name, 3); // 3 weights @Override protected boolean beforeSave(boolean newRecord) { diff --git a/org.adempiere.base/src/org/compiere/model/MWarehouse.java b/org.adempiere.base/src/org/compiere/model/MWarehouse.java index 0514055579..2f6d223310 100644 --- a/org.adempiere.base/src/org/compiere/model/MWarehouse.java +++ b/org.adempiere.base/src/org/compiere/model/MWarehouse.java @@ -41,7 +41,8 @@ public class MWarehouse extends X_M_Warehouse /** * */ - private static final long serialVersionUID = 7037547130625087045L; + private static final long serialVersionUID = 2696705459515717619L; + /** * Get from Cache * @param ctx context @@ -273,13 +274,4 @@ public class MWarehouse extends X_M_Warehouse return success; } // afterSave - /** - * Before Delete - * @return true - */ - protected boolean beforeDelete () - { - return delete_Accounting("M_Warehouse_Acct"); - } // beforeDelete - } // MWarehouse diff --git a/org.adempiere.base/src/org/compiere/model/MWithholding.java b/org.adempiere.base/src/org/compiere/model/MWithholding.java index 12a3a6a853..825a6869ca 100644 --- a/org.adempiere.base/src/org/compiere/model/MWithholding.java +++ b/org.adempiere.base/src/org/compiere/model/MWithholding.java @@ -31,7 +31,7 @@ public class MWithholding extends X_C_Withholding /** * */ - private static final long serialVersionUID = 7734620609620104180L; + private static final long serialVersionUID = 6368597644089198711L; /** * Standard Constructor @@ -69,13 +69,4 @@ public class MWithholding extends X_C_Withholding return success; } // afterSave - /** - * Before Delete - * @return true - */ - protected boolean beforeDelete () - { - return delete_Accounting("C_Withholding_Acct"); - } // beforeDelete - } // MWithholding diff --git a/org.adempiere.base/src/org/compiere/model/PO.java b/org.adempiere.base/src/org/compiere/model/PO.java index ba284f96b3..5ac0b8870a 100644 --- a/org.adempiere.base/src/org/compiere/model/PO.java +++ b/org.adempiere.base/src/org/compiere/model/PO.java @@ -3242,6 +3242,11 @@ public abstract class PO deleteTranslations(localTrxName); // Delete Cascade AD_Table_ID/Record_ID (Attachments, ..) PO_Record.deleteCascade(AD_Table_ID, Record_ID, localTrxName); + + //delete cascade only for single key column record + if (m_KeyColumns != null && m_KeyColumns.length == 1) { + PO_Record.deleteModelCascade(p_info.getTableName(), Record_ID, localTrxName); + } // The Delete Statement StringBuilder sql = new StringBuilder ("DELETE FROM ") //jz why no FROM?? @@ -3788,6 +3793,7 @@ public abstract class PO * @param acctTable accounting sub table * @return true */ + @Deprecated // see IDEMPIERE-2088 protected boolean delete_Accounting(String acctTable) { return true; diff --git a/org.adempiere.base/src/org/compiere/model/PO_Record.java b/org.adempiere.base/src/org/compiere/model/PO_Record.java index e5967e9923..74b68ef868 100644 --- a/org.adempiere.base/src/org/compiere/model/PO_Record.java +++ b/org.adempiere.base/src/org/compiere/model/PO_Record.java @@ -18,10 +18,12 @@ package org.compiere.model; import java.sql.PreparedStatement; import java.sql.ResultSet; +import java.util.List; import java.util.logging.Level; import org.compiere.util.CLogger; import org.compiere.util.DB; +import org.compiere.util.DisplayType; import org.compiere.util.Env; /** @@ -147,7 +149,43 @@ public class PO_Record } } return true; - } // deleteCascase + } // deleteCascade + + //IDEMPIERE-2060 + public static void deleteModelCascade(String tableName, int Record_ID, String trxName) { + //find dependent tables to delete cascade + final String sql = "" + + "SELECT t.TableName, " + + " c.ColumnName " + + "FROM AD_Column c " + + " JOIN AD_Table t ON c.AD_Table_ID = t.AD_Table_ID " + + " LEFT JOIN AD_Ref_Table r ON c.AD_Reference_Value_ID = r.AD_Reference_ID " + + " LEFT JOIN AD_Table tr ON r.AD_Table_ID = tr.AD_Table_ID " + + "WHERE t.IsView = 'N' " + + " AND t.IsActive = 'Y' " + + " AND c.IsActive = 'Y' " + + " AND ( ( c.AD_Reference_ID = " + DisplayType.TableDir + + " AND c.ColumnName = ? || '_ID' ) " + + " OR ( c.AD_Reference_ID IN ( " + DisplayType.Table + ", " + DisplayType.Search + " ) " + + " AND ( tr.TableName = ? OR ( tr.TableName IS NULL AND c.ColumnName = ? || '_ID' ) ) ) ) " + + " AND c.FKConstraintType = '" + MColumn.FKCONSTRAINTTYPE_ModelCascade + "' "; + + List> dependents = DB.getSQLArrayObjectsEx(trxName, sql, tableName, tableName, tableName); + if (dependents != null) { + for (List row : dependents) { + String dependentTableName = (String) row.get(0); + String dependentColumnName = (String) row.get(1); + String dependentWhere = dependentColumnName + "=?"; + List poList = new Query(Env.getCtx(), + dependentTableName, + dependentWhere, + trxName).setParameters(Record_ID).list(); + for (PO po : poList) { + po.deleteEx(true, trxName); + } + } + } + } /** * An entry Exists for restrict table/record combination diff --git a/org.adempiere.base/src/org/compiere/model/Tax.java b/org.adempiere.base/src/org/compiere/model/Tax.java index 4b13395696..7c4777e7fe 100644 --- a/org.adempiere.base/src/org/compiere/model/Tax.java +++ b/org.adempiere.base/src/org/compiere/model/Tax.java @@ -508,12 +508,12 @@ public class Tax * @return C_Tax_ID * @throws TaxNoExemptFoundException if no tax exempt found */ - private static int getExemptTax (Properties ctx, int AD_Org_ID, String trxName) + public static int getExemptTax (Properties ctx, int AD_Org_ID, String trxName) { final String sql = "SELECT t.C_Tax_ID " + "FROM C_Tax t" + " INNER JOIN AD_Org o ON (t.AD_Client_ID=o.AD_Client_ID) " - + "WHERE t.IsTaxExempt='Y' AND o.AD_Org_ID=? " + + "WHERE t.IsTaxExempt='Y' AND o.AD_Org_ID=? AND t.IsActive='Y' " + "ORDER BY t.Rate DESC"; int C_Tax_ID = DB.getSQLValueEx(trxName, sql, AD_Org_ID); if (log.isLoggable(Level.FINE)) log.fine("getExemptTax - TaxExempt=Y - C_Tax_ID=" + C_Tax_ID); @@ -543,7 +543,7 @@ public class Tax * @return C_Tax_ID * @throws TaxNotFoundException if no tax found for given criteria */ - protected static int get (Properties ctx, + public static int get (Properties ctx, int C_TaxCategory_ID, boolean IsSOTrx, Timestamp shipDate, int shipFromC_Location_ID, int shipToC_Location_ID, Timestamp billDate, int billFromC_Location_ID, int billToC_Location_ID, String trxName) diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_Column.java b/org.adempiere.base/src/org/compiere/model/X_AD_Column.java index 324de4c82c..9ffc7e8406 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_Column.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_Column.java @@ -32,7 +32,7 @@ public class X_AD_Column extends PO implements I_AD_Column, I_Persistent /** * */ - private static final long serialVersionUID = 20131031L; + private static final long serialVersionUID = 20140903L; /** Standard Constructor */ public X_AD_Column (Properties ctx, int AD_Column_ID, String trxName) @@ -487,6 +487,8 @@ public class X_AD_Column extends PO implements I_AD_Column, I_Persistent public static final String FKCONSTRAINTTYPE_Cascade = "C"; /** Set Null = S */ public static final String FKCONSTRAINTTYPE_SetNull = "S"; + /** Model Cascade = M */ + public static final String FKCONSTRAINTTYPE_ModelCascade = "M"; /** Set Constraint Type. @param FKConstraintType Constraint Type */ public void setFKConstraintType (String FKConstraintType) diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_InfoProcess.java b/org.adempiere.base/src/org/compiere/model/X_AD_InfoProcess.java index 0003f046d5..0592a21475 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_InfoProcess.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_InfoProcess.java @@ -30,7 +30,7 @@ public class X_AD_InfoProcess extends PO implements I_AD_InfoProcess, I_Persiste /** * */ - private static final long serialVersionUID = 20140606L; + private static final long serialVersionUID = 20140905L; /** Standard Constructor */ public X_AD_InfoProcess (Properties ctx, int AD_InfoProcess_ID, String trxName) @@ -76,29 +76,29 @@ public class X_AD_InfoProcess extends PO implements I_AD_InfoProcess, I_Persiste return sb.toString(); } - public org.compiere.model.I_AD_Column getAD_Column() throws RuntimeException + public org.compiere.model.I_AD_InfoColumn getAD_InfoColumn() throws RuntimeException { - return (org.compiere.model.I_AD_Column)MTable.get(getCtx(), org.compiere.model.I_AD_Column.Table_Name) - .getPO(getAD_Column_ID(), get_TrxName()); } + return (org.compiere.model.I_AD_InfoColumn)MTable.get(getCtx(), org.compiere.model.I_AD_InfoColumn.Table_Name) + .getPO(getAD_InfoColumn_ID(), get_TrxName()); } - /** Set ViewID Column. - @param AD_Column_ID - Name of unique column in a view. value of this column will save to t_selection table + /** Set Info Column. + @param AD_InfoColumn_ID + Info Window Column */ - public void setAD_Column_ID (int AD_Column_ID) + public void setAD_InfoColumn_ID (int AD_InfoColumn_ID) { - if (AD_Column_ID < 1) - set_Value (COLUMNNAME_AD_Column_ID, null); + if (AD_InfoColumn_ID < 1) + set_Value (COLUMNNAME_AD_InfoColumn_ID, null); else - set_Value (COLUMNNAME_AD_Column_ID, Integer.valueOf(AD_Column_ID)); + set_Value (COLUMNNAME_AD_InfoColumn_ID, Integer.valueOf(AD_InfoColumn_ID)); } - /** Get ViewID Column. - @return Name of unique column in a view. value of this column will save to t_selection table + /** Get Info Column. + @return Info Window Column */ - public int getAD_Column_ID () + public int getAD_InfoColumn_ID () { - Integer ii = (Integer)get_Value(COLUMNNAME_AD_Column_ID); + Integer ii = (Integer)get_Value(COLUMNNAME_AD_InfoColumn_ID); if (ii == null) return 0; return ii.intValue(); diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_TableIndex.java b/org.adempiere.base/src/org/compiere/model/X_AD_TableIndex.java index 36107d57c7..305c15199d 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_TableIndex.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_TableIndex.java @@ -30,7 +30,7 @@ public class X_AD_TableIndex extends PO implements I_AD_TableIndex, I_Persistent /** * */ - private static final long serialVersionUID = 20131031L; + private static final long serialVersionUID = 20140905L; /** Standard Constructor */ public X_AD_TableIndex (Properties ctx, int AD_TableIndex_ID, String trxName) @@ -43,6 +43,8 @@ public class X_AD_TableIndex extends PO implements I_AD_TableIndex, I_Persistent setEntityType (null); // U setIsCreateConstraint (false); +// N + setIsKey (false); // N setIsUnique (false); // N @@ -243,6 +245,30 @@ public class X_AD_TableIndex extends PO implements I_AD_TableIndex, I_Persistent return false; } + /** Set Key column. + @param IsKey + This column is the key in this table + */ + public void setIsKey (boolean IsKey) + { + set_Value (COLUMNNAME_IsKey, Boolean.valueOf(IsKey)); + } + + /** Get Key column. + @return This column is the key in this table + */ + public boolean isKey () + { + Object oo = get_Value(COLUMNNAME_IsKey); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + /** Set Unique. @param IsUnique Unique */ public void setIsUnique (boolean IsUnique) @@ -309,4 +335,18 @@ public class X_AD_TableIndex extends PO implements I_AD_TableIndex, I_Persistent } return false; } + + /** Set Drop table index. + @param TableIndexDrop Drop table index */ + public void setTableIndexDrop (String TableIndexDrop) + { + set_Value (COLUMNNAME_TableIndexDrop, TableIndexDrop); + } + + /** Get Drop table index. + @return Drop table index */ + public String getTableIndexDrop () + { + return (String)get_Value(COLUMNNAME_TableIndexDrop); + } } \ No newline at end of file diff --git a/org.adempiere.base/src/org/compiere/model/X_M_Product.java b/org.adempiere.base/src/org/compiere/model/X_M_Product.java index 693cd58967..127b3272fe 100644 --- a/org.adempiere.base/src/org/compiere/model/X_M_Product.java +++ b/org.adempiere.base/src/org/compiere/model/X_M_Product.java @@ -33,7 +33,7 @@ public class X_M_Product extends PO implements I_M_Product, I_Persistent /** * */ - private static final long serialVersionUID = 20131031L; + private static final long serialVersionUID = 20140905L; /** Standard Constructor */ public X_M_Product (Properties ctx, int M_Product_ID, String trxName) @@ -144,25 +144,6 @@ public class X_M_Product extends PO implements I_M_Product, I_Persistent return (String)get_Value(COLUMNNAME_CopyFrom); } - /** Set Standard Cost. - @param CostStandard - Standard Costs - */ - public void setCostStandard (BigDecimal CostStandard) - { - throw new IllegalArgumentException ("CostStandard is virtual column"); } - - /** Get Standard Cost. - @return Standard Costs - */ - public BigDecimal getCostStandard () - { - BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_CostStandard); - if (bd == null) - return Env.ZERO; - return bd; - } - public org.compiere.model.I_C_RevenueRecognition getC_RevenueRecognition() throws RuntimeException { return (org.compiere.model.I_C_RevenueRecognition)MTable.get(getCtx(), org.compiere.model.I_C_RevenueRecognition.Table_Name) @@ -350,6 +331,23 @@ public class X_M_Product extends PO implements I_M_Product, I_Persistent return (Timestamp)get_Value(COLUMNNAME_DiscontinuedAt); } + /** Set DocumentDescription. + @param DocumentDescription + DocumentDescription + */ + public void setDocumentDescription (String DocumentDescription) + { + set_Value (COLUMNNAME_DocumentDescription, DocumentDescription); + } + + /** Get DocumentDescription. + @return DocumentDescription + */ + public String getDocumentDescription () + { + return (String)get_Value(COLUMNNAME_DocumentDescription); + } + /** Set Document Note. @param DocumentNote Additional information for a Document @@ -452,6 +450,46 @@ public class X_M_Product extends PO implements I_M_Product, I_Persistent return (String)get_Value(COLUMNNAME_Help); } + /** Set ImageBig_ID. + @param ImageBig_ID ImageBig_ID */ + public void setImageBig_ID (int ImageBig_ID) + { + if (ImageBig_ID < 1) + set_Value (COLUMNNAME_ImageBig_ID, null); + else + set_Value (COLUMNNAME_ImageBig_ID, Integer.valueOf(ImageBig_ID)); + } + + /** Get ImageBig_ID. + @return ImageBig_ID */ + public int getImageBig_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_ImageBig_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set ImageSmall_ID. + @param ImageSmall_ID ImageSmall_ID */ + public void setImageSmall_ID (int ImageSmall_ID) + { + if (ImageSmall_ID < 1) + set_Value (COLUMNNAME_ImageSmall_ID, null); + else + set_Value (COLUMNNAME_ImageSmall_ID, Integer.valueOf(ImageSmall_ID)); + } + + /** Get ImageSmall_ID. + @return ImageSmall_ID */ + public int getImageSmall_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_ImageSmall_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + /** Set Image URL. @param ImageURL URL of image diff --git a/org.adempiere.base/src/org/compiere/print/DataEngine.java b/org.adempiere.base/src/org/compiere/print/DataEngine.java index 866615fb72..e0e229e6a7 100644 --- a/org.adempiere.base/src/org/compiere/print/DataEngine.java +++ b/org.adempiere.base/src/org/compiere/print/DataEngine.java @@ -171,8 +171,13 @@ public class DataEngine reportName = rs.getString(3); // Add WhereClause restriction from AD_ReportView - teo_sarca BF [ 1761891 ] String whereClause = rs.getString(4); - if (!Util.isEmpty(whereClause)) - queryCopy.addRestriction(whereClause); + if (!Util.isEmpty(whereClause)) { + if (whereClause.indexOf("@") == -1) { + queryCopy.addRestriction(whereClause); + } else { // replace context variables + queryCopy.addRestriction(Env.parseContext(ctx, 0, whereClause.toString(), false, true)); + } + } } } catch (SQLException e) diff --git a/org.adempiere.base/src/org/compiere/print/ReportEngine.java b/org.adempiere.base/src/org/compiere/print/ReportEngine.java index bc41248960..ebbfb2d69a 100644 --- a/org.adempiere.base/src/org/compiere/print/ReportEngine.java +++ b/org.adempiere.base/src/org/compiere/print/ReportEngine.java @@ -1125,7 +1125,6 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount) int AD_Table_ID = 0; int AD_ReportView_ID = 0; String TableName = null; - String whereClause = ""; int AD_PrintFormat_ID = 0; boolean IsForm = false; int Client_ID = -1; @@ -1152,9 +1151,6 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount) if (rs.next()) { AD_ReportView_ID = rs.getInt(1); // required - whereClause = rs.getString(2); - if (rs.wasNull()) - whereClause = ""; // AD_Table_ID = rs.getInt(3); TableName = rs.getString(4); // required for query @@ -1188,7 +1184,6 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount) rs = pstmt.executeQuery(); if (rs.next()) { - whereClause = ""; AD_Table_ID = rs.getInt(1); TableName = rs.getString(2); // required for query AD_PrintFormat_ID = rs.getInt(3); // required @@ -1223,10 +1218,6 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount) { query = MQuery.get (ctx, pi.getAD_PInstance_ID(), TableName); } - - // Add to static where clause from ReportView - if (whereClause.length() != 0) - query.addRestriction(whereClause); // Get Print Format MPrintFormat format = null; diff --git a/org.adempiere.base/src/org/compiere/process/TableIndexDrop.java b/org.adempiere.base/src/org/compiere/process/TableIndexDrop.java index d7154b9963..309931d149 100644 --- a/org.adempiere.base/src/org/compiere/process/TableIndexDrop.java +++ b/org.adempiere.base/src/org/compiere/process/TableIndexDrop.java @@ -12,6 +12,8 @@ ******************************************************************************/ package org.compiere.process; +import java.math.BigDecimal; + import org.compiere.model.MTableIndex; import org.compiere.util.DB; @@ -30,8 +32,9 @@ public class TableIndexDrop extends SvrProcess { MTableIndex index = new MTableIndex(getCtx(), p_AD_TableIndex_ID, get_TrxName()); log.info(index.toString()); - String sql = "DROP INDEX " + index.getName(); + String sql = index.getDropDDL(); int rvalue = DB.executeUpdateEx(sql, get_TrxName()); + addLog(0, null, new BigDecimal(rvalue), sql); return rvalue + " - " + sql; } diff --git a/org.adempiere.base/src/org/compiere/process/TableIndexValidate.java b/org.adempiere.base/src/org/compiere/process/TableIndexValidate.java index e829500a46..96c34633af 100644 --- a/org.adempiere.base/src/org/compiere/process/TableIndexValidate.java +++ b/org.adempiere.base/src/org/compiere/process/TableIndexValidate.java @@ -155,7 +155,7 @@ public class TableIndexValidate extends SvrProcess { if (modified) { - String sql = "DROP INDEX " + index.getName(); + String sql = index.getDropDDL(); int rvalue = DB.executeUpdate(sql, (Object[]) null, true, trxName); if (pi != null) pi.addLog(0, null, new BigDecimal(rvalue), sql); diff --git a/org.adempiere.base/src/org/compiere/util/EMail.java b/org.adempiere.base/src/org/compiere/util/EMail.java index 664ba1e36d..70f25d0844 100644 --- a/org.adempiere.base/src/org/compiere/util/EMail.java +++ b/org.adempiere.base/src/org/compiere/util/EMail.java @@ -22,8 +22,10 @@ import java.io.Serializable; import java.net.MalformedURLException; import java.net.URI; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Enumeration; +import java.util.List; import java.util.Properties; import java.util.logging.Level; @@ -307,14 +309,23 @@ public final class EMail implements Serializable rec = getBccs(); if (rec != null && rec.length > 0) m_msg.setRecipients (Message.RecipientType.BCC, rec); + if (m_replyTo != null) + m_msg.setReplyTo(new Address[] {m_replyTo}); } else { String bccAddressForAllMails = MSysConfig.getValue(MSysConfig.MAIL_SEND_BCC_TO_ADDRESS, Env.getAD_Client_ID(Env.getCtx())); if (! Util.isEmpty(bccAddressForAllMails, true)) { - m_msg.setRecipient (Message.RecipientType.TO, new InternetAddress(bccAddressForAllMails, true)); + m_msg.setRecipients (Message.RecipientType.TO, bccAddressForAllMails); } + List replyToList=new ArrayList(); + if(m_replyTo!=null) + replyToList.add(m_replyTo); InternetAddress[] rec = getTos(); - if (rec != null && rec.length > 0) + if (rec != null && rec.length > 0){ m_msg.setHeader("OriginalTo", getCommaSeparatedString(rec)); + replyToList.addAll(Arrays.asList(rec)); + } + if(replyToList.size()>0) + m_msg.setReplyTo(replyToList.toArray(new InternetAddress[]{})); rec = getCcs(); if (rec != null && rec.length > 0) m_msg.setHeader("OriginalCC", getCommaSeparatedString(rec)); @@ -322,8 +333,6 @@ public final class EMail implements Serializable if (rec != null && rec.length > 0) m_msg.setHeader("OriginalBCC", getCommaSeparatedString(rec)); } - if (m_replyTo != null) - m_msg.setReplyTo(new Address[] {m_replyTo}); // m_msg.setSentDate(new java.util.Date()); m_msg.setHeader("Comments", "iDempiereMail"); @@ -688,19 +697,22 @@ public final class EMail implements Serializable { if (newBcc == null || newBcc.length() == 0) return false; - InternetAddress ia = null; - try - { - ia = new InternetAddress (newBcc, true); + String[] addresses = newBcc.split(", *"); + for (String bccAddress : addresses) { + InternetAddress ia = null; + try + { + ia = new InternetAddress (bccAddress, true); + } + catch (Exception e) + { + log.log(Level.WARNING, bccAddress + ": " + e.getMessage()); + return false; + } + if (m_bcc == null) + m_bcc = new ArrayList(); + m_bcc.add (ia); } - catch (Exception e) - { - log.log(Level.WARNING, newBcc + ": " + e.getMessage()); - return false; - } - if (m_bcc == null) - m_bcc = new ArrayList(); - m_bcc.add (ia); return true; } // addBcc diff --git a/org.adempiere.base/src/org/eevolution/process/ExportFormatGenerator.java b/org.adempiere.base/src/org/eevolution/process/ExportFormatGenerator.java index a78d45e063..7c4fb8b80e 100644 --- a/org.adempiere.base/src/org/eevolution/process/ExportFormatGenerator.java +++ b/org.adempiere.base/src/org/eevolution/process/ExportFormatGenerator.java @@ -230,6 +230,7 @@ public class ExportFormatGenerator extends SvrProcess referenceFormat.setAD_Table_ID(MTable.getTable_ID(m_parent_table)); referenceFormat.setDescription(table.getDescription()); referenceFormat.setHelp(table.getHelp()); + referenceFormat.setVersion(version); referenceFormat.saveEx(); int AD_Column_ID=DB.getSQLValue(get_TrxName(), "SELECT AD_Column_ID FROM AD_Column WHERE AD_Table_ID=(SELECT AD_Table_ID FROM AD_Table WHERE TableName=?) AND UPPER(ColumnName)='DOCUMENTNO'",m_parent_table); @@ -322,8 +323,9 @@ public class ExportFormatGenerator extends SvrProcess && DisplayType.Image != col.getAD_Reference_ID()) { - - String tableName = col.getColumnName().substring(0, col.getColumnName().lastIndexOf("_ID")); + //String tableName = col.getColumnName().substring(0, col.getColumnName().lastIndexOf("_ID")); + String tableName = col.getColumnName().lastIndexOf("_ID") == -1 ? null + : col.getColumnName().substring(0, col.getColumnName().lastIndexOf("_ID")); if (log.isLoggable(Level.INFO)) log.info("Table Name:"+tableName); if(tableName==null) diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/RoleElementHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/RoleElementHandler.java index 8fde13353d..2fa373eac7 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/RoleElementHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/RoleElementHandler.java @@ -39,7 +39,6 @@ import org.compiere.model.X_AD_Package_Imp_Detail; import org.compiere.model.X_AD_Process; import org.compiere.model.X_AD_Role; import org.compiere.model.X_AD_Task; -import org.compiere.model.X_AD_User; import org.compiere.model.X_AD_Window; import org.compiere.model.X_AD_Workflow; import org.compiere.util.DB; @@ -51,7 +50,7 @@ public class RoleElementHandler extends AbstractElementHandler { private OrgRoleElementHandler orgHandler = new OrgRoleElementHandler(); private ProcessAccessElementHandler processHandler = new ProcessAccessElementHandler(); - private UserRoleElementHandler userHandler = new UserRoleElementHandler(); + // private UserRoleElementHandler userHandler = new UserRoleElementHandler(); private WindowAccessElementHandler windowHandler = new WindowAccessElementHandler(); private FormAccessElementHandler formHandler = new FormAccessElementHandler(); private TaskAccessElementHandler taskHandler = new TaskAccessElementHandler(); @@ -136,7 +135,8 @@ public class RoleElementHandler extends AbstractElementHandler { DB.close(rs, pstmt); } - // Process user assignment access + // Process user assignment access - processing of AD_User_Roles dropped with IDEMPIERE-2137 + /* sql = "SELECT AD_User_ID, AD_Role_ID, AD_Org_ID FROM AD_User_Roles WHERE AD_Role_ID= " + Role_id + " AND AD_User_ID > 0 "; pstmt = null; @@ -153,6 +153,7 @@ public class RoleElementHandler extends AbstractElementHandler { } finally { DB.close(rs, pstmt); } + */ // Process AD_Window_Access Values sql = "SELECT AD_Window_ID, AD_Role_ID FROM AD_Window_Access WHERE AD_Role_ID= " + Role_id; @@ -289,6 +290,7 @@ public class RoleElementHandler extends AbstractElementHandler { ctx.ctx.remove(X_AD_Role.COLUMNNAME_AD_Role_ID); } + /* private void createUserRole(PIPOContext ctx, TransformerHandler document, int AD_User_ID, int AD_Role_ID, int AD_Org_ID) throws SAXException { Env.setContext(ctx.ctx, X_AD_User.COLUMNNAME_AD_User_ID, AD_User_ID); @@ -299,6 +301,7 @@ public class RoleElementHandler extends AbstractElementHandler { ctx.ctx.remove(X_AD_Role.COLUMNNAME_AD_Role_ID); ctx.ctx.remove("AD_Org_ID"); } + */ private void createOrgAccess(PIPOContext ctx, TransformerHandler document, int AD_Org_ID, int AD_Role_ID) throws SAXException { diff --git a/org.adempiere.server-feature/idempiere-server.sh b/org.adempiere.server-feature/idempiere-server.sh index bbbf484018..805ebfb585 100644 --- a/org.adempiere.server-feature/idempiere-server.sh +++ b/org.adempiere.server-feature/idempiere-server.sh @@ -9,10 +9,14 @@ else echo Set JAVA_HOME to the directory of your local JDK. fi +if [ "$1" = "debug" ]; then + DEBUG="-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=4554,server=y,suspend=n" +fi + echo =================================== echo Starting iDempiere Server echo =================================== unset DISPLAY BASE=`dirname $( readlink -f idempiere-server.sh )` -$JAVA -Dosgi.console=localhost:12612 -Djetty.home=$BASE/jettyhome -Djetty.etc.config.urls=etc/jetty.xml,etc/jetty-selector.xml,etc/jetty-ssl.xml,etc/jetty-https.xml,etc/jetty-deployer.xml -XX:MaxPermSize=192m -jar $BASE/plugins/org.eclipse.equinox.launcher_1.*.jar -application org.adempiere.server.application +$JAVA ${DEBUG} -Dosgi.console=localhost:12612 -Djetty.home=$BASE/jettyhome -Djetty.etc.config.urls=etc/jetty.xml,etc/jetty-selector.xml,etc/jetty-ssl.xml,etc/jetty-https.xml,etc/jetty-deployer.xml -XX:MaxPermSize=192m -jar $BASE/plugins/org.eclipse.equinox.launcher_1.*.jar -application org.adempiere.server.application diff --git a/org.adempiere.server-feature/utils.unix/RUN_TrlExport.sh b/org.adempiere.server-feature/utils.unix/RUN_TrlExport.sh index 186840c310..568728f9bf 100644 --- a/org.adempiere.server-feature/utils.unix/RUN_TrlExport.sh +++ b/org.adempiere.server-feature/utils.unix/RUN_TrlExport.sh @@ -16,7 +16,6 @@ export DIRECTORY=$IDEMPIERE_HOME/data/$AD_LANGUAGE echo This Procedure exports language $AD_LANGUAGE to directory $DIRECTORY -$JAVA_HOME/bin/java -cp $CLASSPATH org.compiere.install.Translation $DIRECTORY $AD_LANGUAGE export - +$JAVA -Dosgi.compatibility.bootdelegation=true -Dosgi.noShutdown=true -Dosgi.framework.activeThreadType=normal -XX:MaxPermSize=192m -jar plugins/org.eclipse.equinox.launcher_1.*.jar -console 12612 -application org.adempiere.ui.translation export $DIRECTORY $AD_LANGUAGE echo Done diff --git a/org.adempiere.server-feature/utils.unix/RUN_TrlImport.sh b/org.adempiere.server-feature/utils.unix/RUN_TrlImport.sh index 19e4a046e7..d65811112b 100644 --- a/org.adempiere.server-feature/utils.unix/RUN_TrlImport.sh +++ b/org.adempiere.server-feature/utils.unix/RUN_TrlImport.sh @@ -16,7 +16,6 @@ export DIRECTORY=$IDEMPIERE_HOME/data/$AD_LANGUAGE echo This Procedure imports language $AD_LANGUAGE from directory $DIRECTORY -$JAVA_HOME/bin/java -cp $CLASSPATH org.compiere.install.Translation $DIRECTORY $AD_LANGUAGE import - +$JAVA -Dosgi.compatibility.bootdelegation=true -Dosgi.noShutdown=true -Dosgi.framework.activeThreadType=normal -XX:MaxPermSize=192m -jar plugins/org.eclipse.equinox.launcher_1.*.jar -console 12612 -application org.adempiere.ui.translation import $DIRECTORY $AD_LANGUAGE echo Done diff --git a/org.adempiere.server-feature/utils.unix/unix/idempiere_RedHat.sh b/org.adempiere.server-feature/utils.unix/unix/idempiere_RedHat.sh index 3b41434e78..b8d5e43a5f 100644 --- a/org.adempiere.server-feature/utils.unix/unix/idempiere_RedHat.sh +++ b/org.adempiere.server-feature/utils.unix/unix/idempiere_RedHat.sh @@ -40,6 +40,7 @@ start () { return 1 fi echo -n "Starting ADempiere ERP: " + cd $IDEMPIERE_HOME/utils source $ENVFILE export LOGFILE=$IDEMPIERE_HOME/log/idempiere_`date +%Y%m%d%H%M%S`.log su $IDEMPIEREUSER -c "mkdir -p $IDEMPIERE_HOME/log" @@ -81,6 +82,7 @@ stop () { return 1 fi echo -n "Stopping iDempiere ERP: " + cd $IDEMPIERE_HOME/utils source $ENVFILE echo "Trying direct kill with signal -15" # Adempiere didn't finish - try direct kill with signal 15, then signal 9 diff --git a/org.adempiere.server/src/main/servlet/org/compiere/web/AdempiereMonitor.java b/org.adempiere.server/src/main/servlet/org/compiere/web/AdempiereMonitor.java index 9183ceb616..d1f24988bf 100644 --- a/org.adempiere.server/src/main/servlet/org/compiere/web/AdempiereMonitor.java +++ b/org.adempiere.server/src/main/servlet/org/compiere/web/AdempiereMonitor.java @@ -28,6 +28,7 @@ import java.lang.management.RuntimeMXBean; import java.lang.management.ThreadMXBean; import java.sql.Timestamp; import java.util.ArrayList; +import java.util.List; import java.util.Properties; import java.util.logging.Level; @@ -62,8 +63,10 @@ import org.compiere.db.AdempiereDatabase; import org.compiere.db.CConnection; import org.compiere.model.AdempiereProcessorLog; import org.compiere.model.MClient; +import org.compiere.model.MSession; import org.compiere.model.MStore; import org.compiere.model.MSystem; +import org.compiere.model.Query; import org.compiere.server.AdempiereServerGroup; import org.compiere.server.AdempiereServerMgr; import org.compiere.server.AdempiereServerMgr.ServerWrapper; @@ -72,6 +75,8 @@ import org.compiere.util.CLogMgt; import org.compiere.util.CLogger; import org.compiere.util.CMemoryUsage; import org.compiere.util.CacheMgt; +import org.compiere.util.DB; +import org.compiere.util.Env; import org.compiere.util.Ini; import org.compiere.util.TimeUtil; import org.compiere.util.Trx; @@ -1032,6 +1037,50 @@ public class AdempiereMonitor extends HttpServlet p.addElement(" "); line.addElement(new td().addElement(p)); table.addElement(line); + // + line = new tr(); + List sessions = new Query(Env.getCtx(), MSession.Table_Name, "Processed = 'N'", null).list(); + line.addElement(new th().addElement("Active sessions #" + sessions.size())); + p = new p(); + for (int i = 0; i < clients.length; i++) { + MClient client = clients[i]; + if (i > 0) + p.addElement(" - "); + int count = 0; + for (MSession session : sessions) { + if (session.getAD_Client_ID()==client.getAD_Client_ID()) + count++; + } + p.addElement(client.getName() + " : " + count); + } + if (clients.length == 0) + p.addElement(" "); + line.addElement(new td().addElement(p)); + table.addElement(line); + // + line = new tr(); + int inMaintenanceClients[] = DB.getIDsEx(null, "SELECT AD_Client_ID FROM AD_SysConfig WHERE Name = 'SYSTEM_IN_MAINTENANCE_MODE' AND Value = 'Y'"); + line.addElement(new th().addElement("Maintenance Mode #"+inMaintenanceClients.length)); + p = new p(); + if (inMaintenanceClients.length > 0) { + for (int i = 0; i < clients.length; i++) { + MClient client = clients[i]; + if (i > 0) + p.addElement(" - "); + for (int clientID : inMaintenanceClients) { + if (client.getAD_Client_ID() == clientID) + p.addElement(client.getName() + " : Yes"); + else + p.addElement(client.getName() + " : No"); + } + } + } + else + p.addElement("All clients are in normal operation mode"); + if (clients.length == 0) + p.addElement(" "); + line.addElement(new td().addElement(p)); + table.addElement(line); // bb.addElement(table); } // createLogMgtPage diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADSortTab.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADSortTab.java index 41b4771457..a5b58aa231 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADSortTab.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADSortTab.java @@ -25,6 +25,7 @@ import java.util.List; import java.util.Set; import java.util.logging.Level; +import org.adempiere.webui.AdempiereIdGenerator; import org.adempiere.webui.LayoutUtils; import org.adempiere.webui.component.Button; import org.adempiere.webui.component.Label; @@ -267,7 +268,9 @@ public class ADSortTab extends Panel implements IADTabpanel yesList.setVflex(true); noList.setVflex(true); - EventListener mouseListener = new EventListener() + setId(AdempiereIdGenerator.escapeId(gridTab.getName())); + + EventListener mouseListener = new EventListener() { public void onEvent(Event event) throws Exception @@ -866,8 +869,10 @@ public class ADSortTab extends Panel implements IADTabpanel setAttribute(ATTR_ON_ACTIVATE_POSTED, Boolean.TRUE); } - - Event event = new Event(ON_ACTIVATE_EVENT, this, b); + + active = b; + + Event event = new Event(ON_ACTIVATE_EVENT, this, b); Events.postEvent(event); } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/GlobalSearch.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/GlobalSearch.java index cc0b8f8b07..4286614e9d 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/GlobalSearch.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/GlobalSearch.java @@ -104,7 +104,7 @@ public class GlobalSearch extends Div implements EventListener { menuController.create(tabPanel); tab = new Tab(); - tab.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(),"Document"))); + tab.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(),"search"))); tabs.appendChild(tab); tabPanel = new Tabpanel(); tabPanel.setSclass("global-search-tabpanel"); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/ListModelTable.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/ListModelTable.java index 43a8ce678b..ccab75bfd2 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/ListModelTable.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/ListModelTable.java @@ -279,6 +279,9 @@ public class ListModelTable extends ListModelList implements Sortable { for (int i = 0; i < infos.length; i++) { MInfoWindow info = infos[i]; - if (MInfoWindow.get(MTable.getTableName(Env.getCtx(), info.getAD_Table_ID()), null) != null) + if (MInfoWindow.get(info.getAD_InfoWindow_ID(), null) != null) { ToolBarButton btnViewItem = new ToolBarButton(info.getName()); btnViewItem.setSclass("link"); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WTableDirEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WTableDirEditor.java index 4ff9f46be7..364f6ea6d0 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WTableDirEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WTableDirEditor.java @@ -176,10 +176,10 @@ ContextMenuListener, IZoomableEditor if (gridField != null) { - String columnName = getColumnName(); - if ((columnName.toUpperCase().equals("C_BPARTNER_LOCATION_ID")) - || (columnName.toUpperCase().equals("BILL_LOCATION_ID")) - || (columnName.toUpperCase().equals("DROPSHIP_LOCATION_ID"))) + String tableName_temp = lookup.getColumnName(); // Returns AD_Org.AD_Org_ID + int posPoint = tableName_temp.indexOf("."); + String tableName = tableName_temp.substring(0, posPoint); + if (tableName.toUpperCase().equals("C_BPARTNER_LOCATION")) { popupMenu = new WEditorPopupMenu(true, true, isShowPreference(), false, false, true, lookup); } else { @@ -191,9 +191,6 @@ ContextMenuListener, IZoomableEditor boolean isShortListAvailable = false; // Short List available for this lookup if (lookup != null && (lookup.getDisplayType() == DisplayType.TableDir || lookup.getDisplayType() == DisplayType.Table)) // only for Table & TableDir { - String tableName_temp = lookup.getColumnName(); // Returns AD_Org.AD_Org_ID - int posPoint = tableName_temp.indexOf("."); - String tableName = tableName_temp.substring(0, posPoint); MTable table = MTable.get(Env.getCtx(), tableName); isShortListAvailable = (table.getColumnIndex("IsShortList") >= 0); if (isShortListAvailable) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java index 2a91204507..62e54d548e 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java @@ -400,6 +400,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL } private void processQueryValue() { + isQueryByUser = true; for (int i = 0; i < identifiers.size(); i++) { WEditor editor = identifiers.get(i); editor.setValue(queryValue); @@ -430,6 +431,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL } else if (!splitValue) { editors.get(0).setValue(queryValue); } + isQueryByUser = false; } private boolean loadInfoDefinition() { @@ -610,12 +612,15 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL if (infoColumn.isDisplayed(infoContext, p_WindowNo)) { ColumnInfo columnInfo = null; + String colSQL = infoColumn.getSelectClause(); + if (! colSQL.toUpperCase().contains(" AS ")) + colSQL += " AS " + infoColumn.getColumnName(); if (infoColumn.getAD_Reference_ID() == DisplayType.ID) { if (infoColumn.getSelectClause().equalsIgnoreCase(keySelectClause)) continue; - columnInfo = new ColumnInfo(infoColumn.get_Translation("Name"), infoColumn.getSelectClause(), DisplayType.getClass(infoColumn.getAD_Reference_ID(), true)); + columnInfo = new ColumnInfo(infoColumn.get_Translation("Name"), colSQL, DisplayType.getClass(infoColumn.getAD_Reference_ID(), true)); } else if (DisplayType.isLookup(infoColumn.getAD_Reference_ID())) { @@ -625,8 +630,8 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL editor = WebEditorFactory.getEditor(gridFields.get(i), true); editor.setMandatory(false); editor.setReadWrite(false); - editorMap.put(infoColumn.getSelectClause(), editor); - columnInfo = new ColumnInfo(infoColumn.get_Translation("Name"), infoColumn.getSelectClause(), ValueNamePair.class, (String)null); + editorMap.put(colSQL, editor); + columnInfo = new ColumnInfo(infoColumn.get_Translation("Name"), colSQL, ValueNamePair.class, (String)null); } else { @@ -635,7 +640,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL } else { - columnInfo = new ColumnInfo(infoColumn.get_Translation("Name"), infoColumn.getSelectClause(), DisplayType.getClass(infoColumn.getAD_Reference_ID(), true)); + columnInfo = new ColumnInfo(infoColumn.get_Translation("Name"), colSQL, DisplayType.getClass(infoColumn.getAD_Reference_ID(), true)); } columnInfo.setColDescription(infoColumn.get_Translation("Description")); columnInfo.setGridField(gridFields.get(i)); @@ -679,9 +684,12 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL editor = WebEditorFactory.getEditor(gridField, true); editor.setMandatory(false); editor.setReadWrite(false); - editorMap.put(infoColumn.getSelectClause(), editor); - - ColumnInfo columnInfo = new ColumnInfo(infoColumn.get_Translation("Name"), infoColumn.getSelectClause(), KeyNamePair.class, (String)null); + + String colSQL = infoColumn.getSelectClause(); + if (! colSQL.toUpperCase().contains(" AS ")) + colSQL += " AS " + infoColumn.getColumnName(); + editorMap.put(colSQL, editor); + ColumnInfo columnInfo = new ColumnInfo(infoColumn.get_Translation("Name"), colSQL, KeyNamePair.class, (String)null); return columnInfo; } @@ -914,7 +922,6 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL String fromClause = m_sqlMain.substring(fromIndex); // get alias of main table - String alias = getTableName(); StringBuilder sqlBuilder = new StringBuilder(selectClause); // reset flag relate viewID to recount @@ -922,29 +929,25 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL isHasViewID = false; // add View_ID column to select clause - for (MInfoProcess infoProcess : infoProcessList){ - String columnInQuery = infoProcess.getViewIDName(); + for (MInfoProcess infoProcess : infoProcessList) { // this process hasn't viewID column, next other infoProcess - if (columnInQuery == null) + if (infoProcess.getAD_InfoColumn_ID() <= 0) continue; - - // add alias of main table to column - columnInQuery = alias + "." + columnInQuery; - + + MInfoColumn infocol = (MInfoColumn) infoProcess.getAD_InfoColumn(); // maintain varial relate to ViewID, it can init just one time when load infoWindow define // but let it here for simple logic control numOfViewID++; isHasViewID = true; - - // if query is include this viewID column, not need add - if (sqlBuilder.toString().toLowerCase().contains(columnInQuery.toLowerCase())){ - continue; + + if (! infocol.isDisplayed()) { + // add column to SELECT clause of main sql + sqlBuilder.append(", "); + sqlBuilder.append (infocol.getSelectClause()); + sqlBuilder.append(" AS "); + sqlBuilder.append (infocol.getColumnName()); + sqlBuilder.append(" "); } - - // add column to SELECT clause of main sql - sqlBuilder.append(", "); - sqlBuilder.append (columnInQuery); - sqlBuilder.append(" "); } sqlBuilder.append(fromClause); @@ -1592,12 +1595,15 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL if (infoColumn.isDisplayed(infoContext, p_WindowNo)) { ColumnInfo columnInfo = null; + String colSQL = infoColumn.getSelectClause(); + if (! colSQL.toUpperCase().contains(" AS ")) + colSQL += " AS " + infoColumn.getColumnName(); if (infoColumn.getAD_Reference_ID() == DisplayType.ID) { if (infoColumn.getSelectClause().equalsIgnoreCase(keySelectClause)) continue; - columnInfo = new ColumnInfo(infoColumn.get_Translation("Name"), infoColumn.getSelectClause(), DisplayType.getClass(infoColumn.getAD_Reference_ID(), true)); + columnInfo = new ColumnInfo(infoColumn.get_Translation("Name"), colSQL, DisplayType.getClass(infoColumn.getAD_Reference_ID(), true)); } else if (DisplayType.isLookup(infoColumn.getAD_Reference_ID())) { @@ -1607,8 +1613,8 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL editor = WebEditorFactory.getEditor(getGridField(infoColumn), true); editor.setMandatory(false); editor.setReadWrite(false); - editorMap.put(infoColumn.getSelectClause(), editor); - columnInfo = new ColumnInfo(infoColumn.get_Translation("Name"), infoColumn.getSelectClause(), ValueNamePair.class, (String)null); + editorMap.put(colSQL, editor); + columnInfo = new ColumnInfo(infoColumn.get_Translation("Name"), colSQL, ValueNamePair.class, (String)null); } else { @@ -1618,7 +1624,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL } else { - columnInfo = new ColumnInfo(infoColumn.get_Translation("Name"), infoColumn.getSelectClause(), DisplayType.getClass(infoColumn.getAD_Reference_ID(), true)); + columnInfo = new ColumnInfo(infoColumn.get_Translation("Name"), colSQL, DisplayType.getClass(infoColumn.getAD_Reference_ID(), true)); } columnInfo.setColDescription(infoColumn.get_Translation("Description")); columnInfo.setGridField(getGridField(infoColumn)); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoGeneralPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoGeneralPanel.java index d9c513b40b..77de93f2a0 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoGeneralPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoGeneralPanel.java @@ -32,7 +32,6 @@ import org.adempiere.webui.component.Label; import org.adempiere.webui.component.Row; import org.adempiere.webui.component.Rows; import org.adempiere.webui.component.Textbox; -import org.adempiere.webui.event.WTableModelEvent; import org.adempiere.webui.window.FDialog; import org.compiere.minigrid.ColumnInfo; import org.compiere.minigrid.IDColumn; @@ -47,10 +46,10 @@ import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zul.Borderlayout; import org.zkoss.zul.Center; -import org.zkoss.zul.North; -import org.zkoss.zul.South; import org.zkoss.zul.Div; +import org.zkoss.zul.North; import org.zkoss.zul.Separator; +import org.zkoss.zul.South; import org.zkoss.zul.Vbox; /** @@ -61,9 +60,10 @@ import org.zkoss.zul.Vbox; public class InfoGeneralPanel extends InfoPanel implements EventListener { /** - * + * */ - private static final long serialVersionUID = -665127800885078238L; + private static final long serialVersionUID = 3328089102224160413L; + private Textbox txt1; private Textbox txt2; private Textbox txt3; @@ -508,10 +508,6 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener pstmt.setString(index++, getSQLText(txt4)); } // setParameters - public void tableChanged(WTableModelEvent event) - { - } - @Override protected void insertPagingComponent() { diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java index 576ba81248..5143bfbae3 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java @@ -60,6 +60,7 @@ import org.adempiere.webui.session.SessionManager; import org.adempiere.webui.window.FDialog; import org.compiere.minigrid.ColumnInfo; import org.compiere.minigrid.IDColumn; +import org.compiere.model.MInfoColumn; import org.compiere.model.MInfoWindow; import org.compiere.model.MPInstance; import org.compiere.model.MProcess; @@ -518,21 +519,20 @@ public abstract class InfoPanel extends Window implements EventListener, * IDEMPIERE-1970 */ protected void readViewID(ResultSet rs, List data) throws SQLException { - if (infoProcessList == null || infoProcessList.length == 0){ + if (infoProcessList == null || infoProcessList.length == 0) { return; } - + // with each process have viewID, read it form resultSet by name for (MInfoProcess infoProcess : infoProcessList){ - if (infoProcess.getAD_Column_ID() == 0){ + if (infoProcess.getAD_InfoColumn_ID() <= 0) continue; - } - String viewIDSql = infoProcess.getViewIDName(); - String viewIDValue = rs.getString(viewIDSql); - if (rs.wasNull()){ + MInfoColumn infocol = (MInfoColumn) infoProcess.getAD_InfoColumn(); + String viewIDValue = rs.getString(infocol.getColumnName()); + if (rs.wasNull()) { data.add(null); - }else{ + } else { data.add(viewIDValue); } } @@ -1511,7 +1511,7 @@ public abstract class InfoPanel extends Window implements EventListener, return index; } // just increase index when process is have ViewID column - if (infoProcessList[i].getAD_Column_ID() > 0) + if (infoProcessList[i].getAD_InfoColumn_ID() > 0) index++; } return -1; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java index 99f4f0589b..a58ac2be33 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java @@ -492,10 +492,6 @@ public class LoginPanel extends Window implements EventListener private void languageChanged(String langName) { Language language = findLanguage(langName); - - // Locales - Locale loc = language.getLocale(); - Locale.setDefault(loc); if (email_login) lblUserId.setValue(Msg.getMsg(language, "EMail")); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WDocActionPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WDocActionPanel.java index 494bd37acc..5ee9e43adf 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WDocActionPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WDocActionPanel.java @@ -321,7 +321,7 @@ public class WDocActionPanel extends Window implements EventListener, Dia String docAction = lstDocAction.getSelectedItem().getLabel(); MessageFormat mf = new MessageFormat(Msg.getMsg(Env.getAD_Language(Env.getCtx()), "ConfirmOnDocAction")); Object[] arguments = new Object[]{docAction}; - FDialog.ask(0, this, mf.format(arguments), new Callback() { + FDialog.ask(0, this, "", mf.format(arguments), new Callback() { @Override public void onCallback(Boolean result) { if(result) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FDialog.java index d58acdac2b..1abe6ab5a9 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FDialog.java @@ -299,7 +299,7 @@ public class FDialog * * @return true, if OK */ - public static boolean ask(int windowNo, Component comp, String adMessage, String msg, Callback callback) + public static boolean ask(int windowNo, Component comp, String adMessage, String msg, final Callback callback) { StringBuilder out = new StringBuilder(); if (adMessage != null && !adMessage.equals("")) @@ -307,7 +307,23 @@ public class FDialog if (msg != null && msg.length() > 0) out.append("\n").append(msg); String s = out.toString().replace("\n", "
"); - return ask(windowNo, comp, s, callback); + + Callback msgCallback = null; + if (callback != null) + { + msgCallback = new Callback() { + @Override + public void onCallback(Integer result) { + boolean b = result != null && result.intValue() == Messagebox.OK; + callback.onCallback(b); + } + }; + } + String title = AEnv.getDialogHeader(Env.getCtx(), windowNo); + int response = Messagebox.showDialog(s, title, + Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION, msgCallback, (msgCallback == null)); + + return (response == Messagebox.OK); } /************************************************************************** diff --git a/org.adempiere.ui/META-INF/MANIFEST.MF b/org.adempiere.ui/META-INF/MANIFEST.MF index 030ec55315..cc5d91da14 100644 --- a/org.adempiere.ui/META-INF/MANIFEST.MF +++ b/org.adempiere.ui/META-INF/MANIFEST.MF @@ -4,7 +4,9 @@ Bundle-Name: iDempiere UI base Bundle-SymbolicName: org.adempiere.ui;singleton:=true Bundle-Version: 3.0.0.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-1.7 -Require-Bundle: org.adempiere.base;bundle-version="3.0.0" +Require-Bundle: org.adempiere.base;bundle-version="3.0.0", + org.apache.xerces;bundle-version="2.9.0", + org.eclipse.equinox.app;bundle-version="1.3.0" Export-Package: org.compiere.apps, org.compiere.apps.form, org.compiere.apps.wf, diff --git a/org.adempiere.ui/src/org/compiere/apps/AbstractProcessCtl.java b/org.adempiere.ui/src/org/compiere/apps/AbstractProcessCtl.java index d893aa7bed..0ccdb99872 100644 --- a/org.adempiere.ui/src/org/compiere/apps/AbstractProcessCtl.java +++ b/org.adempiere.ui/src/org/compiere/apps/AbstractProcessCtl.java @@ -287,7 +287,7 @@ public abstract class AbstractProcessCtl implements Runnable m_pi.setReportingProcess(true); // Start Report ----------------------------------------------- boolean ok = ReportCtl.start(m_processUI, windowno, m_pi, IsDirectPrint); - m_pi.setSummary("Report", !ok); + m_pi.setSummary(Msg.getCleanMsg(Env.getCtx(), "Report"), !ok); MPInstance pinstance = new MPInstance(Env.getCtx(), m_pi.getAD_PInstance_ID(), null); String errmsg = pinstance.getErrorMsg(); if (Util.isEmpty(errmsg, true)) diff --git a/org.adempiere.ui/src/org/compiere/apps/form/Allocation.java b/org.adempiere.ui/src/org/compiere/apps/form/Allocation.java index 1a53af85e8..9d8ecd4521 100644 --- a/org.adempiere.ui/src/org/compiere/apps/form/Allocation.java +++ b/org.adempiere.ui/src/org/compiere/apps/form/Allocation.java @@ -408,7 +408,7 @@ public class Allocation // selection of payment row if (((Boolean)payment.getValueAt(row, 0)).booleanValue()) { - applied = open.signum() > 0 ? open : BigDecimal.ZERO; // Open Amount + applied = open; // Open Amount if (totalDiff.abs().compareTo(applied.abs()) < 0 // where less is available to allocate than open && totalDiff.signum() == -applied.signum() ) // and the available amount has the opposite sign applied = totalDiff.negate(); // reduce the amount applied to what's available diff --git a/org.adempiere.ui/src/org/compiere/apps/form/Charge.java b/org.adempiere.ui/src/org/compiere/apps/form/Charge.java index f035cf204d..f124b26435 100644 --- a/org.adempiere.ui/src/org/compiere/apps/form/Charge.java +++ b/org.adempiere.ui/src/org/compiere/apps/form/Charge.java @@ -16,6 +16,7 @@ package org.compiere.apps.form; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; +import java.util.Properties; import java.util.Vector; import java.util.logging.Level; @@ -51,8 +52,6 @@ public class Charge private int m_C_TaxCategory_ID = 0; private int m_AD_Client_ID = 0; private int m_AD_Org_ID = 0; - @SuppressWarnings("unused") - private int m_CreatedBy = 0; private MAcctSchema m_acctSchema = null; /** Logger */ public static CLogger log = CLogger.getCLogger(Charge.class); @@ -170,7 +169,6 @@ public class Charge // Other Defaults m_AD_Client_ID = Env.getAD_Client_ID(Env.getCtx()); m_AD_Org_ID = Env.getAD_Org_ID(Env.getCtx()); - m_CreatedBy = Env.getAD_User_ID(Env.getCtx()); // TaxCategory String sql = "SELECT C_TaxCategory_ID FROM C_TaxCategory " @@ -232,29 +230,30 @@ public class Charge MCharge charge; MAccount account; - if (log.isLoggable(Level.CONFIG)) log.config(name + " - "); - // Charge - charge = new MCharge(Env.getCtx(), 0, null); - charge.setName(name); - charge.setC_TaxCategory_ID(m_C_TaxCategory_ID); - if (!charge.save()) - { - log.log(Level.SEVERE, name + " not created"); - return 0; - } - refreshAccountSchema(); if (!isAccountSchemaValid()) { return 0; } - + // Target Account - account = getAccount(elementValueId, charge); + account = getAccount(elementValueId); if (account == null) { return 0; } + + if (log.isLoggable(Level.CONFIG)) log.config(name + " - "); + // Charge + charge = new MCharge(Env.getCtx(), 0, null); + // IDEMPIERE-1099 - Key must be included in name to avoid name crashes in account schema. + charge.setName(account.getAccount().getValue() + " " + name); + charge.setC_TaxCategory_ID(m_C_TaxCategory_ID); + if (!charge.save()) + { + log.log(Level.SEVERE, name + " not created"); + return 0; + } updateAccount(charge, account); @@ -338,15 +337,15 @@ public class Charge * Gets the account for the specified charge and element value. * The account is created if it doesn't already exist. * @param elementValueId identifier for the element value - * @param charge charge * @return the account */ - private MAccount getAccount(int elementValueId, MCharge charge) + private MAccount getAccount(int elementValueId) { + Properties ctx = Env.getCtx(); MAccount defaultAccount = MAccount.getDefault(m_acctSchema, true); // optional null - MAccount account = MAccount.get(Env.getCtx(), - charge.getAD_Client_ID(), - charge.getAD_Org_ID(), + MAccount account = MAccount.get(ctx, + Env.getAD_Client_ID(ctx), + Env.getAD_Org_ID(ctx), m_acctSchema.getC_AcctSchema_ID(), elementValueId, defaultAccount.getC_SubAcct_ID(), diff --git a/org.adempiere.ui/src/org/compiere/apps/form/Match.java b/org.adempiere.ui/src/org/compiere/apps/form/Match.java index fb97c4594b..0147048172 100644 --- a/org.adempiere.ui/src/org/compiere/apps/form/Match.java +++ b/org.adempiere.ui/src/org/compiere/apps/form/Match.java @@ -206,12 +206,19 @@ public class Match // Create it String innerTrxName = Trx.createTrxName("Match"); Trx innerTrx = Trx.get(innerTrxName, true); - if (createMatchRecord(invoice, M_InOutLine_ID, Line_ID, BigDecimal.valueOf(qty), innerTrxName)) - innerTrx.commit(); - else + + try{ + if (createMatchRecord(invoice, M_InOutLine_ID, Line_ID, BigDecimal.valueOf(qty), innerTrxName)) + innerTrx.commit(); + else + innerTrx.rollback(); + }catch(Exception ex){ innerTrx.rollback(); - innerTrx.close(); - innerTrx = null; + throw new AdempiereException(ex); + }finally{ + innerTrx.close(); + innerTrx = null; + } } } // requery diff --git a/org.adempiere.ui/src/org/compiere/install/Translation.java b/org.adempiere.ui/src/org/compiere/install/Translation.java index 7d2a6ca4a7..6fdcb59d17 100644 --- a/org.adempiere.ui/src/org/compiere/install/Translation.java +++ b/org.adempiere.ui/src/org/compiere/install/Translation.java @@ -24,6 +24,7 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; +import java.util.Map; import java.util.Properties; import java.util.logging.Level; @@ -37,10 +38,13 @@ import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; +import org.adempiere.base.Core; import org.compiere.Adempiere; import org.compiere.model.MLanguage; import org.compiere.model.MTable; import org.compiere.model.PO; +import org.compiere.process.ProcessCall; +import org.compiere.process.ProcessInfo; import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.Env; @@ -48,6 +52,8 @@ import org.compiere.util.Language; import org.compiere.util.Login; import org.compiere.util.Msg; import org.compiere.util.Util; +import org.eclipse.equinox.app.IApplication; +import org.eclipse.equinox.app.IApplicationContext; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -58,7 +64,7 @@ import org.w3c.dom.Element; * @author Jorg Janke * @version $Id: Translation.java,v 1.3 2006/07/30 00:51:28 jjanke Exp $ */ -public class Translation +public class Translation implements IApplication { /** * Translation @@ -68,6 +74,16 @@ public class Translation { m_ctx = ctx; } // Translation + + /** + * Do not use this Constructor in normal calls. It is used e.g. by the + * headless call for an only-translation batch script call. + * + * @author tbayen - IDEMPIERE-1554 + */ + public Translation(){ + m_ctx=Env.getCtx(); + } /** DTD */ public static final String DTD = ""; @@ -435,7 +451,7 @@ public class Translation * @param AD_Language language * @param mode mode */ - private void process (String directory, String AD_Language, String mode) + public void process (String directory, String AD_Language, String mode) { String sql = "SELECT Name, TableName " + "FROM AD_Table " @@ -489,7 +505,66 @@ public class Translation } } // process - + /************************************************************************** + * OSGi Batch Interface + * + * @author tbayen - IDEMPIERE-1554 + */ + + /** + * Launch method of the OSGi application. + * + * In pre-OSGi times commandline launching was done by a run of the main() + * method of {@link Translation}. This is the OSGized launch method. This + * class has to be mentioned in META-INF/MANIFEST.MF as an + * "org.eclipse.core.runtime.applications" extension. Because of that it can + * be called from the commandline. + * + * You should take care that the org.eclipse.equinox.event bundle is active + * if you run this to send events in the case something goes wrong (like a + * missing file etc.) + */ + @Override + public Object start(IApplicationContext context) throws Exception { + Adempiere.startup(false); + Map args = context.getArguments(); + String commandlineArgs[] = (String[]) args.get("application.args"); + if (commandlineArgs.length == 3 + && ("import".equals(commandlineArgs[0]) || "export".equals(commandlineArgs[0]))) { + String command = commandlineArgs[0]; + String directory = commandlineArgs[1]; + String countrycode = commandlineArgs[2]; + Properties ctx = Env.getCtx(); + Translation translation = new Translation(ctx); + translation.process(directory, countrycode, command); + } else if (commandlineArgs.length == 1 && "sync".equals(commandlineArgs[0])) { + ProcessInfo pi = new ProcessInfo("Synchronize Terminology", 172); + pi.setAD_Client_ID(0); + pi.setAD_User_ID(100); + /* + * I do not call this direct because I did not want the + * org.adempiere.process plugin become a dependency of + * org.adempier.ui only for this commandline sync command. + */ + ProcessCall process = Core.getProcess("org.compiere.process.SynchronizeTerminology"); + process.startProcess(Env.getCtx(), pi, null); + StringBuilder msgout = new StringBuilder("Process=").append(pi.getTitle()) + .append(" Error=").append(pi.isError()).append(" Summary=") + .append(pi.getSummary()); + System.out.println(msgout.toString()); + } else { + System.out.println("translation OSGi plugin commandline usage:"); + System.out.println("Translation.sh import translation/data de_DE"); + System.out.println("Translation.sh export translation/data de_DE"); + } + return IApplication.EXIT_OK; + } + + @Override + public void stop() { + // IApplication implementation method - (only start method used) + } + /************************************************************************** * Batch Interface * @param args directory AD_Language import/export