From 234d2d3aa5dbbc5fce149d475688eaeb14bd80da Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Fri, 27 Jan 2012 16:02:08 -0500 Subject: [PATCH] IDEMPIERE-127 Implement Recent Items dashboard http://jira.idempiere.com/browse/IDEMPIERE-127 --- .../oracle/812_IDEMPIERE-127_RecentItems.sql | 176 ++++++++++++ .../812_IDEMPIERE-127_RecentItems.sql | 176 ++++++++++++ .../org/compiere/model/I_AD_RecentItem.java | 206 ++++++++++++++ .../src/org/compiere/model/MRecentItem.java | 254 +++++++++++++++++ .../src/org/compiere/model/PO_Record.java | 6 +- .../org/compiere/model/X_AD_RecentItem.java | 257 ++++++++++++++++++ .../webui/dashboard/DPRecentItems.java | 211 ++++++++++++++ .../webui/panel/AbstractADWindowPanel.java | 23 ++ org.adempiere.ui.zk/zul/recentItems.zul | 2 + 9 files changed, 1309 insertions(+), 2 deletions(-) create mode 100644 migration/360lts-release/oracle/812_IDEMPIERE-127_RecentItems.sql create mode 100644 migration/360lts-release/postgresql/812_IDEMPIERE-127_RecentItems.sql create mode 100644 org.adempiere.base/src/org/compiere/model/I_AD_RecentItem.java create mode 100644 org.adempiere.base/src/org/compiere/model/MRecentItem.java create mode 100644 org.adempiere.base/src/org/compiere/model/X_AD_RecentItem.java create mode 100644 org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPRecentItems.java create mode 100644 org.adempiere.ui.zk/zul/recentItems.zul diff --git a/migration/360lts-release/oracle/812_IDEMPIERE-127_RecentItems.sql b/migration/360lts-release/oracle/812_IDEMPIERE-127_RecentItems.sql new file mode 100644 index 0000000000..f940341676 --- /dev/null +++ b/migration/360lts-release/oracle/812_IDEMPIERE-127_RecentItems.sql @@ -0,0 +1,176 @@ +-- Jan 27, 2012 3:19:59 PM COT +-- IDEMPIERE-127 Implement Recent Items dashboard +INSERT INTO AD_Element (AD_Element_ID,PrintName,EntityType,ColumnName,Name,AD_Client_ID,Created,Updated,IsActive,AD_Org_ID,CreatedBy,UpdatedBy) VALUES (200000,'Recent Item','D','AD_RecentItem_ID','Recent Item',0,TO_DATE('2012-01-27 15:19:57','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2012-01-27 15:19:57','YYYY-MM-DD HH24:MI:SS'),'Y',0,100,100) +; + +-- Jan 27, 2012 3:19:59 PM COT +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, PrintName,Help,PO_Description,PO_Help,Name,Description,PO_PrintName,PO_Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.PrintName,t.Help,t.PO_Description,t.PO_Help,t.Name,t.Description,t.PO_PrintName,t.PO_Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=200000 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) +; + +-- Jan 27, 2012 3:20:26 PM COT +UPDATE AD_Element_Trl SET IsTranslated='Y',Name='Registro Reciente',PrintName='Registro Reciente',Updated=TO_DATE('2012-01-27 15:20:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=200000 AND AD_Language LIKE 'es_%' +; + +-- Jan 27, 2012 3:21:36 PM COT +INSERT INTO AD_Table (IsSecurityEnabled,ImportTable,AccessLevel,LoadSeq,AD_Table_ID,IsHighVolume,IsChangeLog,IsView,CopyColumnsFromTable,EntityType,IsCentrallyMaintained,IsDeleteable,ReplicationType,TableName,Name,AD_Client_ID,IsActive,AD_Org_ID,CreatedBy,Updated,UpdatedBy,Created) VALUES ('N','N','7',0,200000,'N','N','N','N','D','Y','Y','L','AD_RecentItem','Recent Item',0,'Y',0,100,TO_DATE('2012-01-27 15:21:35','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2012-01-27 15:21:35','YYYY-MM-DD HH24:MI:SS')) +; + +-- Jan 27, 2012 3:21:36 PM COT +INSERT INTO AD_Table_Trl (AD_Language,AD_Table_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Table_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Table t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Table_ID=200000 AND NOT EXISTS (SELECT * FROM AD_Table_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Table_ID=t.AD_Table_ID) +; + +-- Jan 27, 2012 3:21:37 PM COT +INSERT INTO AD_Sequence (IncrementNo,StartNewYear,CurrentNextSys,IsTableID,StartNo,CurrentNext,IsAudited,IsAutoSequence,AD_Sequence_ID,Description,Name,AD_Org_ID,AD_Client_ID,Updated,UpdatedBy,Created,CreatedBy,IsActive) VALUES (1,'N',50000,'Y',1000000,1000000,'N','Y',200000,'Table AD_RecentItem','AD_RecentItem',0,0,TO_DATE('2012-01-27 15:21:36','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2012-01-27 15:21:36','YYYY-MM-DD HH24:MI:SS'),100,'Y') +; + +-- Jan 27, 2012 3:22:36 PM COT +INSERT INTO AD_Column (DefaultValue,AD_Column_ID,AD_Table_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES ('@#AD_Client_ID@',200000,200000,'D',0,'Y','N','N',0,'A Client is a company or a legal entity. You cannot share data between Clients. Tenant is a synonym for Client.','N',22,'N',19,'N','N',102,'N','Y','N','Y','N','AD_Client_ID','Client/Tenant for this installation.','Client','N',100,TO_DATE('2012-01-27 15:22:35','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-01-27 15:22:35','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jan 27, 2012 3:22:36 PM COT +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200000 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Jan 27, 2012 3:25:24 PM COT +INSERT INTO AD_Column (DefaultValue,AD_Column_ID,AD_Table_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,AD_Val_Rule_ID,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES ('@#AD_Org_ID@',200001,200000,'D',0,'Y','N','N',0,'An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.','N',22,'N',19,'N',104,'N',113,'N','Y','N','N','N','AD_Org_ID','Organizational entity within client','Organization','N',100,TO_DATE('2012-01-27 15:25:23','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-01-27 15:25:23','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jan 27, 2012 3:25:24 PM COT +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200001 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Jan 27, 2012 3:25:54 PM COT +INSERT INTO AD_Column (AD_Column_ID,AD_Table_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200002,200000,'D',0,'Y','N','N',0,'N',22,'N',13,'N','Y',200000,'N','Y','N','N','N','AD_RecentItem_ID','Recent Item','N',100,TO_DATE('2012-01-27 15:25:54','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-01-27 15:25:54','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jan 27, 2012 3:25:54 PM COT +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200002 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Jan 27, 2012 3:26:23 PM COT +INSERT INTO AD_Column (AD_Column_ID,AD_Table_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200003,200000,'D',0,'Y','N','N',0,'The Role determines security and access a user who has this Role will have in the System.','N',10,'N',19,'N','N',123,'N','Y','N','Y','N','AD_Role_ID','Responsibility Role','Role','Y',100,TO_DATE('2012-01-27 15:26:22','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-01-27 15:26:22','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jan 27, 2012 3:26:23 PM COT +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200003 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Jan 27, 2012 3:26:50 PM COT +INSERT INTO AD_Column (AD_Column_ID,AD_Table_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200004,200000,'D',0,'N','N','N',0,'The Tab indicates a tab that displays within a window.','N',10,'N',19,'N','N',125,'N','Y','N','Y','N','AD_Tab_ID','Tab within a Window','Tab','Y',100,TO_DATE('2012-01-27 15:26:49','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-01-27 15:26:49','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jan 27, 2012 3:26:50 PM COT +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200004 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Jan 27, 2012 3:27:15 PM COT +INSERT INTO AD_Column (AD_Column_ID,AD_Table_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200005,200000,'D',0,'Y','N','N',0,'The Database Table provides the information of the table definition','N',10,'N',19,'N','N',126,'N','Y','N','Y','N','AD_Table_ID','Database Table information','Table','Y',100,TO_DATE('2012-01-27 15:27:14','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-01-27 15:27:14','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jan 27, 2012 3:27:15 PM COT +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200005 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Jan 27, 2012 3:27:34 PM COT +INSERT INTO AD_Column (AD_Column_ID,AD_Table_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200006,200000,'D',0,'N','N','N',0,'The User identifies a unique user in the system. This could be an internal user or a business partner contact','N',10,'N',30,'N','N',138,'N','Y','N','Y','N','AD_User_ID','User within the system - Internal or Business Partner Contact','User/Contact','Y',100,TO_DATE('2012-01-27 15:27:34','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-01-27 15:27:34','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jan 27, 2012 3:27:34 PM COT +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200006 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Jan 27, 2012 3:28:00 PM COT +INSERT INTO AD_Column (AD_Column_ID,AD_Table_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200007,200000,'D',0,'N','N','N',0,'The Window field identifies a unique Window in the system.','N',10,'N',19,'N','N',143,'N','Y','N','Y','N','AD_Window_ID','Data entry or display window','Window','Y',100,TO_DATE('2012-01-27 15:27:59','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-01-27 15:27:59','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jan 27, 2012 3:28:00 PM COT +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200007 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Jan 27, 2012 3:28:26 PM COT +INSERT INTO AD_Column (AD_Column_ID,AD_Table_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200008,200000,'D',0,'Y','N','N',0,'The Created field indicates the date that this record was created.','N',7,'N',16,'N','N',245,'N','Y','N','N','N','Created','Date this record was created','Created','N',100,TO_DATE('2012-01-27 15:28:26','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-01-27 15:28:26','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jan 27, 2012 3:28:26 PM COT +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200008 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Jan 27, 2012 3:28:56 PM COT +INSERT INTO AD_Column (AD_Column_ID,AD_Table_ID,EntityType,Version,AD_Reference_Value_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200009,200000,'D',0,110,'Y','N','N',0,'The Created By field indicates the user who created this record.','N',22,'N',18,'N','N',246,'N','Y','N','N','N','CreatedBy','User who created this records','Created By','N',100,TO_DATE('2012-01-27 15:28:55','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-01-27 15:28:55','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jan 27, 2012 3:28:56 PM COT +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200009 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Jan 27, 2012 3:30:02 PM COT +INSERT INTO AD_Column (DefaultValue,AD_Column_ID,AD_Table_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES ('Y',200010,200000,'D',0,'Y','N','N',0,'There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reports. +There are two reasons for de-activating and not deleting records: +(1) The system requires the record for audit purposes. +(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.','N',1,'N',20,'N','N',348,'N','Y','N','Y','N','IsActive','The record is active in the system','Active','N',100,TO_DATE('2012-01-27 15:30:01','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-01-27 15:30:01','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jan 27, 2012 3:30:02 PM COT +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200010 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Jan 27, 2012 3:30:47 PM COT +INSERT INTO AD_Column (AD_Column_ID,AD_Table_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200011,200000,'D',0,'Y','N','N',0,'The Record ID is the internal unique identifier of a record. Please note that zooming to the record may not be successful for Orders, Invoices and Shipment/Receipts as sometimes the Sales Order type is not known.','N',10,'N',28,'N','N',538,'N','Y','N','Y','N','Record_ID','Direct internal record ID','Record ID','Y',100,TO_DATE('2012-01-27 15:30:47','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-01-27 15:30:47','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jan 27, 2012 3:30:47 PM COT +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200011 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Jan 27, 2012 3:31:12 PM COT +INSERT INTO AD_Column (AD_Column_ID,AD_Table_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200012,200000,'D',0,'Y','N','N',0,'The Updated field indicates the date that this record was updated.','N',7,'N',16,'N','N',607,'N','Y','N','Y','N','Updated','Date this record was updated','Updated','N',100,TO_DATE('2012-01-27 15:31:11','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-01-27 15:31:11','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jan 27, 2012 3:31:12 PM COT +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200012 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Jan 27, 2012 3:31:43 PM COT +INSERT INTO AD_Column (AD_Column_ID,AD_Table_ID,EntityType,Version,AD_Reference_Value_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200013,200000,'D',0,110,'Y','N','N',0,'The Updated By field indicates the user who updated this record.','N',22,'N',18,'N','N',608,'N','Y','N','N','N','UpdatedBy','User who updated this records','Updated By','N',100,TO_DATE('2012-01-27 15:31:42','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-01-27 15:31:42','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jan 27, 2012 3:31:43 PM COT +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200013 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Jan 27, 2012 3:31:53 PM COT +UPDATE AD_Column SET IsUpdateable='N',Updated=TO_DATE('2012-01-27 15:31:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200012 +; + +-- Jan 27, 2012 3:33:15 PM COT +UPDATE AD_Column SET EntityType='D',Updated=TO_DATE('2012-01-27 15:33:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200000 +; + +-- Jan 27, 2012 3:33:21 PM COT +CREATE TABLE AD_RecentItem (AD_Client_ID NUMBER(10) NOT NULL, AD_Org_ID NUMBER(10) NOT NULL, AD_RecentItem_ID NUMBER(10) NOT NULL, AD_Role_ID NUMBER(10) NOT NULL, AD_Tab_ID NUMBER(10) DEFAULT NULL , AD_Table_ID NUMBER(10) NOT NULL, AD_User_ID NUMBER(10) DEFAULT NULL , AD_Window_ID NUMBER(10) DEFAULT NULL , Created DATE NOT NULL, CreatedBy NUMBER(10) NOT NULL, IsActive CHAR(1) DEFAULT 'Y' CHECK (IsActive IN ('Y','N')) NOT NULL, Record_ID NUMBER(10) NOT NULL, Updated DATE NOT NULL, UpdatedBy NUMBER(10) NOT NULL, CONSTRAINT AD_RecentItem_Key PRIMARY KEY (AD_RecentItem_ID)) +; + +-- Jan 27, 2012 3:34:35 PM COT +INSERT INTO PA_DashboardContent (Line,Description,PA_DashboardContent_ID,ZulFilePath,ColumnNo,IsCollapsible,GoalDisplay,Name,Created,CreatedBy,UpdatedBy,Updated,AD_Client_ID,IsActive,AD_Org_ID) VALUES (0,'Recent items',200000,'/zul/recentItems.zul',1,'Y','T','Recent Items',TO_DATE('2012-01-27 15:34:34','YYYY-MM-DD HH24:MI:SS'),100,100,TO_DATE('2012-01-27 15:34:34','YYYY-MM-DD HH24:MI:SS'),0,'Y',0) +; + +-- Jan 27, 2012 3:34:35 PM COT +INSERT INTO PA_DashboardContent_Trl (AD_Language,PA_DashboardContent_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.PA_DashboardContent_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, PA_DashboardContent t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.PA_DashboardContent_ID=200000 AND NOT EXISTS (SELECT * FROM PA_DashboardContent_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.PA_DashboardContent_ID=t.PA_DashboardContent_ID) +; + +-- Jan 27, 2012 3:35:09 PM COT +UPDATE PA_DashboardContent_Trl SET IsTranslated='Y',Name='Registros recientes',Description='Registros recientes',Updated=TO_DATE('2012-01-27 15:35:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE PA_DashboardContent_ID=200000 AND AD_Language LIKE 'es_%' +; + +-- Jan 27, 2012 3:36:24 PM COT +INSERT INTO AD_SysConfig (AD_SysConfig_ID,ConfigurationLevel,EntityType,Name,Value,Description,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive) VALUES (200000,'C','D','RecentItems_MaxShown','10','Max number of records to show on recent items dashboard',0,0,TO_DATE('2012-01-27 15:36:23','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2012-01-27 15:36:23','YYYY-MM-DD HH24:MI:SS'),100,100,'Y') +; + +-- Jan 27, 2012 3:37:11 PM COT +INSERT INTO AD_SysConfig (AD_SysConfig_ID,ConfigurationLevel,EntityType,Name,Value,Description,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive) VALUES (200001,'C','D','RecentItems_MaxSaved','50','Max number of records to save on recent items table per user',0,0,TO_DATE('2012-01-27 15:37:11','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2012-01-27 15:37:11','YYYY-MM-DD HH24:MI:SS'),100,100,'Y') +; + +-- Jan 27, 2012 3:37:22 PM COT +UPDATE AD_SysConfig SET Description='Max number of records to save on recent items table per user/client',Updated=TO_DATE('2012-01-27 15:37:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_SysConfig_ID=200001 +; + diff --git a/migration/360lts-release/postgresql/812_IDEMPIERE-127_RecentItems.sql b/migration/360lts-release/postgresql/812_IDEMPIERE-127_RecentItems.sql new file mode 100644 index 0000000000..c1b4465696 --- /dev/null +++ b/migration/360lts-release/postgresql/812_IDEMPIERE-127_RecentItems.sql @@ -0,0 +1,176 @@ +-- Jan 27, 2012 3:19:59 PM COT +-- IDEMPIERE-127 Implement Recent Items dashboard +INSERT INTO AD_Element (AD_Element_ID,PrintName,EntityType,ColumnName,Name,AD_Client_ID,Created,Updated,IsActive,AD_Org_ID,CreatedBy,UpdatedBy) VALUES (200000,'Recent Item','D','AD_RecentItem_ID','Recent Item',0,TO_TIMESTAMP('2012-01-27 15:19:57','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2012-01-27 15:19:57','YYYY-MM-DD HH24:MI:SS'),'Y',0,100,100) +; + +-- Jan 27, 2012 3:19:59 PM COT +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, PrintName,Help,PO_Description,PO_Help,Name,Description,PO_PrintName,PO_Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.PrintName,t.Help,t.PO_Description,t.PO_Help,t.Name,t.Description,t.PO_PrintName,t.PO_Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=200000 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) +; + +-- Jan 27, 2012 3:20:26 PM COT +UPDATE AD_Element_Trl SET IsTranslated='Y',Name='Registro Reciente',PrintName='Registro Reciente',Updated=TO_TIMESTAMP('2012-01-27 15:20:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=200000 AND AD_Language LIKE 'es_%' +; + +-- Jan 27, 2012 3:21:36 PM COT +INSERT INTO AD_Table (IsSecurityEnabled,ImportTable,AccessLevel,LoadSeq,AD_Table_ID,IsHighVolume,IsChangeLog,IsView,CopyColumnsFromTable,EntityType,IsCentrallyMaintained,IsDeleteable,ReplicationType,TableName,Name,AD_Client_ID,IsActive,AD_Org_ID,CreatedBy,Updated,UpdatedBy,Created) VALUES ('N','N','7',0,200000,'N','N','N','N','D','Y','Y','L','AD_RecentItem','Recent Item',0,'Y',0,100,TO_TIMESTAMP('2012-01-27 15:21:35','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2012-01-27 15:21:35','YYYY-MM-DD HH24:MI:SS')) +; + +-- Jan 27, 2012 3:21:36 PM COT +INSERT INTO AD_Table_Trl (AD_Language,AD_Table_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Table_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Table t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Table_ID=200000 AND NOT EXISTS (SELECT * FROM AD_Table_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Table_ID=t.AD_Table_ID) +; + +-- Jan 27, 2012 3:21:37 PM COT +INSERT INTO AD_Sequence (IncrementNo,StartNewYear,CurrentNextSys,IsTableID,StartNo,CurrentNext,IsAudited,IsAutoSequence,AD_Sequence_ID,Description,Name,AD_Org_ID,AD_Client_ID,Updated,UpdatedBy,Created,CreatedBy,IsActive) VALUES (1,'N',50000,'Y',1000000,1000000,'N','Y',200000,'Table AD_RecentItem','AD_RecentItem',0,0,TO_TIMESTAMP('2012-01-27 15:21:36','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2012-01-27 15:21:36','YYYY-MM-DD HH24:MI:SS'),100,'Y') +; + +-- Jan 27, 2012 3:22:36 PM COT +INSERT INTO AD_Column (DefaultValue,AD_Column_ID,AD_Table_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES ('@#AD_Client_ID@',200000,200000,'D',0,'Y','N','N',0,'A Client is a company or a legal entity. You cannot share data between Clients. Tenant is a synonym for Client.','N',22,'N',19,'N','N',102,'N','Y','N','Y','N','AD_Client_ID','Client/Tenant for this installation.','Client','N',100,TO_TIMESTAMP('2012-01-27 15:22:35','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-01-27 15:22:35','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jan 27, 2012 3:22:36 PM COT +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200000 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Jan 27, 2012 3:25:24 PM COT +INSERT INTO AD_Column (DefaultValue,AD_Column_ID,AD_Table_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,AD_Val_Rule_ID,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES ('@#AD_Org_ID@',200001,200000,'D',0,'Y','N','N',0,'An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.','N',22,'N',19,'N',104,'N',113,'N','Y','N','N','N','AD_Org_ID','Organizational entity within client','Organization','N',100,TO_TIMESTAMP('2012-01-27 15:25:23','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-01-27 15:25:23','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jan 27, 2012 3:25:24 PM COT +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200001 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Jan 27, 2012 3:25:54 PM COT +INSERT INTO AD_Column (AD_Column_ID,AD_Table_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200002,200000,'D',0,'Y','N','N',0,'N',22,'N',13,'N','Y',200000,'N','Y','N','N','N','AD_RecentItem_ID','Recent Item','N',100,TO_TIMESTAMP('2012-01-27 15:25:54','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-01-27 15:25:54','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jan 27, 2012 3:25:54 PM COT +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200002 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Jan 27, 2012 3:26:23 PM COT +INSERT INTO AD_Column (AD_Column_ID,AD_Table_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200003,200000,'D',0,'Y','N','N',0,'The Role determines security and access a user who has this Role will have in the System.','N',10,'N',19,'N','N',123,'N','Y','N','Y','N','AD_Role_ID','Responsibility Role','Role','Y',100,TO_TIMESTAMP('2012-01-27 15:26:22','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-01-27 15:26:22','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jan 27, 2012 3:26:23 PM COT +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200003 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Jan 27, 2012 3:26:50 PM COT +INSERT INTO AD_Column (AD_Column_ID,AD_Table_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200004,200000,'D',0,'N','N','N',0,'The Tab indicates a tab that displays within a window.','N',10,'N',19,'N','N',125,'N','Y','N','Y','N','AD_Tab_ID','Tab within a Window','Tab','Y',100,TO_TIMESTAMP('2012-01-27 15:26:49','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-01-27 15:26:49','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jan 27, 2012 3:26:50 PM COT +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200004 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Jan 27, 2012 3:27:15 PM COT +INSERT INTO AD_Column (AD_Column_ID,AD_Table_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200005,200000,'D',0,'Y','N','N',0,'The Database Table provides the information of the table definition','N',10,'N',19,'N','N',126,'N','Y','N','Y','N','AD_Table_ID','Database Table information','Table','Y',100,TO_TIMESTAMP('2012-01-27 15:27:14','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-01-27 15:27:14','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jan 27, 2012 3:27:15 PM COT +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200005 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Jan 27, 2012 3:27:34 PM COT +INSERT INTO AD_Column (AD_Column_ID,AD_Table_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200006,200000,'D',0,'N','N','N',0,'The User identifies a unique user in the system. This could be an internal user or a business partner contact','N',10,'N',30,'N','N',138,'N','Y','N','Y','N','AD_User_ID','User within the system - Internal or Business Partner Contact','User/Contact','Y',100,TO_TIMESTAMP('2012-01-27 15:27:34','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-01-27 15:27:34','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jan 27, 2012 3:27:34 PM COT +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200006 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Jan 27, 2012 3:28:00 PM COT +INSERT INTO AD_Column (AD_Column_ID,AD_Table_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200007,200000,'D',0,'N','N','N',0,'The Window field identifies a unique Window in the system.','N',10,'N',19,'N','N',143,'N','Y','N','Y','N','AD_Window_ID','Data entry or display window','Window','Y',100,TO_TIMESTAMP('2012-01-27 15:27:59','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-01-27 15:27:59','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jan 27, 2012 3:28:00 PM COT +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200007 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Jan 27, 2012 3:28:26 PM COT +INSERT INTO AD_Column (AD_Column_ID,AD_Table_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200008,200000,'D',0,'Y','N','N',0,'The Created field indicates the date that this record was created.','N',7,'N',16,'N','N',245,'N','Y','N','N','N','Created','Date this record was created','Created','N',100,TO_TIMESTAMP('2012-01-27 15:28:26','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-01-27 15:28:26','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jan 27, 2012 3:28:26 PM COT +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200008 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Jan 27, 2012 3:28:56 PM COT +INSERT INTO AD_Column (AD_Column_ID,AD_Table_ID,EntityType,Version,AD_Reference_Value_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200009,200000,'D',0,110,'Y','N','N',0,'The Created By field indicates the user who created this record.','N',22,'N',18,'N','N',246,'N','Y','N','N','N','CreatedBy','User who created this records','Created By','N',100,TO_TIMESTAMP('2012-01-27 15:28:55','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-01-27 15:28:55','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jan 27, 2012 3:28:56 PM COT +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200009 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Jan 27, 2012 3:30:02 PM COT +INSERT INTO AD_Column (DefaultValue,AD_Column_ID,AD_Table_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES ('Y',200010,200000,'D',0,'Y','N','N',0,'There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reports. +There are two reasons for de-activating and not deleting records: +(1) The system requires the record for audit purposes. +(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.','N',1,'N',20,'N','N',348,'N','Y','N','Y','N','IsActive','The record is active in the system','Active','N',100,TO_TIMESTAMP('2012-01-27 15:30:01','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-01-27 15:30:01','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jan 27, 2012 3:30:02 PM COT +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200010 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Jan 27, 2012 3:30:47 PM COT +INSERT INTO AD_Column (AD_Column_ID,AD_Table_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200011,200000,'D',0,'Y','N','N',0,'The Record ID is the internal unique identifier of a record. Please note that zooming to the record may not be successful for Orders, Invoices and Shipment/Receipts as sometimes the Sales Order type is not known.','N',10,'N',28,'N','N',538,'N','Y','N','Y','N','Record_ID','Direct internal record ID','Record ID','Y',100,TO_TIMESTAMP('2012-01-27 15:30:47','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-01-27 15:30:47','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jan 27, 2012 3:30:47 PM COT +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200011 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Jan 27, 2012 3:31:12 PM COT +INSERT INTO AD_Column (AD_Column_ID,AD_Table_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200012,200000,'D',0,'Y','N','N',0,'The Updated field indicates the date that this record was updated.','N',7,'N',16,'N','N',607,'N','Y','N','Y','N','Updated','Date this record was updated','Updated','N',100,TO_TIMESTAMP('2012-01-27 15:31:11','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-01-27 15:31:11','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jan 27, 2012 3:31:12 PM COT +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200012 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Jan 27, 2012 3:31:43 PM COT +INSERT INTO AD_Column (AD_Column_ID,AD_Table_ID,EntityType,Version,AD_Reference_Value_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200013,200000,'D',0,110,'Y','N','N',0,'The Updated By field indicates the user who updated this record.','N',22,'N',18,'N','N',608,'N','Y','N','N','N','UpdatedBy','User who updated this records','Updated By','N',100,TO_TIMESTAMP('2012-01-27 15:31:42','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-01-27 15:31:42','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jan 27, 2012 3:31:43 PM COT +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200013 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Jan 27, 2012 3:31:53 PM COT +UPDATE AD_Column SET IsUpdateable='N',Updated=TO_TIMESTAMP('2012-01-27 15:31:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200012 +; + +-- Jan 27, 2012 3:33:15 PM COT +UPDATE AD_Column SET EntityType='D',Updated=TO_TIMESTAMP('2012-01-27 15:33:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200000 +; + +-- Jan 27, 2012 3:33:21 PM COT +CREATE TABLE AD_RecentItem (AD_Client_ID NUMERIC(10) NOT NULL, AD_Org_ID NUMERIC(10) NOT NULL, AD_RecentItem_ID NUMERIC(10) NOT NULL, AD_Role_ID NUMERIC(10) NOT NULL, AD_Tab_ID NUMERIC(10) DEFAULT NULL , AD_Table_ID NUMERIC(10) NOT NULL, AD_User_ID NUMERIC(10) DEFAULT NULL , AD_Window_ID NUMERIC(10) DEFAULT NULL , Created TIMESTAMP NOT NULL, CreatedBy NUMERIC(10) NOT NULL, IsActive CHAR(1) DEFAULT 'Y' CHECK (IsActive IN ('Y','N')) NOT NULL, Record_ID NUMERIC(10) NOT NULL, Updated TIMESTAMP NOT NULL, UpdatedBy NUMERIC(10) NOT NULL, CONSTRAINT AD_RecentItem_Key PRIMARY KEY (AD_RecentItem_ID)) +; + +-- Jan 27, 2012 3:34:35 PM COT +INSERT INTO PA_DashboardContent (Line,Description,PA_DashboardContent_ID,ZulFilePath,ColumnNo,IsCollapsible,GoalDisplay,Name,Created,CreatedBy,UpdatedBy,Updated,AD_Client_ID,IsActive,AD_Org_ID) VALUES (0,'Recent items',200000,'/zul/recentItems.zul',1,'Y','T','Recent Items',TO_TIMESTAMP('2012-01-27 15:34:34','YYYY-MM-DD HH24:MI:SS'),100,100,TO_TIMESTAMP('2012-01-27 15:34:34','YYYY-MM-DD HH24:MI:SS'),0,'Y',0) +; + +-- Jan 27, 2012 3:34:35 PM COT +INSERT INTO PA_DashboardContent_Trl (AD_Language,PA_DashboardContent_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.PA_DashboardContent_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, PA_DashboardContent t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.PA_DashboardContent_ID=200000 AND NOT EXISTS (SELECT * FROM PA_DashboardContent_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.PA_DashboardContent_ID=t.PA_DashboardContent_ID) +; + +-- Jan 27, 2012 3:35:09 PM COT +UPDATE PA_DashboardContent_Trl SET IsTranslated='Y',Name='Registros recientes',Description='Registros recientes',Updated=TO_TIMESTAMP('2012-01-27 15:35:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE PA_DashboardContent_ID=200000 AND AD_Language LIKE 'es_%' +; + +-- Jan 27, 2012 3:36:24 PM COT +INSERT INTO AD_SysConfig (AD_SysConfig_ID,ConfigurationLevel,EntityType,Name,Value,Description,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive) VALUES (200000,'C','D','RecentItems_MaxShown','10','Max number of records to show on recent items dashboard',0,0,TO_TIMESTAMP('2012-01-27 15:36:23','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2012-01-27 15:36:23','YYYY-MM-DD HH24:MI:SS'),100,100,'Y') +; + +-- Jan 27, 2012 3:37:11 PM COT +INSERT INTO AD_SysConfig (AD_SysConfig_ID,ConfigurationLevel,EntityType,Name,Value,Description,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive) VALUES (200001,'C','D','RecentItems_MaxSaved','50','Max number of records to save on recent items table per user',0,0,TO_TIMESTAMP('2012-01-27 15:37:11','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2012-01-27 15:37:11','YYYY-MM-DD HH24:MI:SS'),100,100,'Y') +; + +-- Jan 27, 2012 3:37:22 PM COT +UPDATE AD_SysConfig SET Description='Max number of records to save on recent items table per user/client',Updated=TO_TIMESTAMP('2012-01-27 15:37:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_SysConfig_ID=200001 +; + diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_RecentItem.java b/org.adempiere.base/src/org/compiere/model/I_AD_RecentItem.java new file mode 100644 index 0000000000..1eecfd476c --- /dev/null +++ b/org.adempiere.base/src/org/compiere/model/I_AD_RecentItem.java @@ -0,0 +1,206 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. * + * This program is free software, you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY, without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program, if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.model; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import org.compiere.util.KeyNamePair; + +/** Generated Interface for AD_RecentItem + * @author Adempiere (generated) + * @version Release 3.6.0LTS + */ +public interface I_AD_RecentItem +{ + + /** TableName=AD_RecentItem */ + public static final String Table_Name = "AD_RecentItem"; + + /** AD_Table_ID=200000 */ + public static final int Table_ID = 200000; + + KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name); + + /** AccessLevel = 7 - System - Client - Org + */ + BigDecimal accessLevel = BigDecimal.valueOf(7); + + /** Load Meta Data */ + + /** Column name AD_Client_ID */ + public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID"; + + /** Get Client. + * Client/Tenant for this installation. + */ + public int getAD_Client_ID(); + + /** Column name AD_Org_ID */ + public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID"; + + /** Set Organization. + * Organizational entity within client + */ + public void setAD_Org_ID (int AD_Org_ID); + + /** Get Organization. + * Organizational entity within client + */ + public int getAD_Org_ID(); + + /** Column name AD_RecentItem_ID */ + public static final String COLUMNNAME_AD_RecentItem_ID = "AD_RecentItem_ID"; + + /** Set Recent Item */ + public void setAD_RecentItem_ID (int AD_RecentItem_ID); + + /** Get Recent Item */ + public int getAD_RecentItem_ID(); + + /** Column name AD_Role_ID */ + public static final String COLUMNNAME_AD_Role_ID = "AD_Role_ID"; + + /** Set Role. + * Responsibility Role + */ + public void setAD_Role_ID (int AD_Role_ID); + + /** Get Role. + * Responsibility Role + */ + public int getAD_Role_ID(); + + public org.compiere.model.I_AD_Role getAD_Role() throws RuntimeException; + + /** Column name AD_Tab_ID */ + public static final String COLUMNNAME_AD_Tab_ID = "AD_Tab_ID"; + + /** Set Tab. + * Tab within a Window + */ + public void setAD_Tab_ID (int AD_Tab_ID); + + /** Get Tab. + * Tab within a Window + */ + public int getAD_Tab_ID(); + + public org.compiere.model.I_AD_Tab getAD_Tab() throws RuntimeException; + + /** Column name AD_Table_ID */ + public static final String COLUMNNAME_AD_Table_ID = "AD_Table_ID"; + + /** Set Table. + * Database Table information + */ + public void setAD_Table_ID (int AD_Table_ID); + + /** Get Table. + * Database Table information + */ + public int getAD_Table_ID(); + + public org.compiere.model.I_AD_Table getAD_Table() throws RuntimeException; + + /** Column name AD_User_ID */ + public static final String COLUMNNAME_AD_User_ID = "AD_User_ID"; + + /** Set Usuario. + * User within the system - Internal or Business Partner Contact + */ + public void setAD_User_ID (int AD_User_ID); + + /** Get Usuario. + * User within the system - Internal or Business Partner Contact + */ + public int getAD_User_ID(); + + public org.compiere.model.I_AD_User getAD_User() throws RuntimeException; + + /** Column name AD_Window_ID */ + public static final String COLUMNNAME_AD_Window_ID = "AD_Window_ID"; + + /** Set Window. + * Data entry or display window + */ + public void setAD_Window_ID (int AD_Window_ID); + + /** Get Window. + * Data entry or display window + */ + public int getAD_Window_ID(); + + public org.compiere.model.I_AD_Window getAD_Window() throws RuntimeException; + + /** Column name Created */ + public static final String COLUMNNAME_Created = "Created"; + + /** Get Created. + * Date this record was created + */ + public Timestamp getCreated(); + + /** Column name CreatedBy */ + public static final String COLUMNNAME_CreatedBy = "CreatedBy"; + + /** Get Created By. + * User who created this records + */ + public int getCreatedBy(); + + /** Column name IsActive */ + public static final String COLUMNNAME_IsActive = "IsActive"; + + /** Set Active. + * The record is active in the system + */ + public void setIsActive (boolean IsActive); + + /** Get Active. + * The record is active in the system + */ + public boolean isActive(); + + /** Column name Record_ID */ + public static final String COLUMNNAME_Record_ID = "Record_ID"; + + /** Set Record ID. + * Direct internal record ID + */ + public void setRecord_ID (int Record_ID); + + /** Get Record ID. + * Direct internal record ID + */ + public int getRecord_ID(); + + /** Column name Updated */ + public static final String COLUMNNAME_Updated = "Updated"; + + /** Get Updated. + * Date this record was updated + */ + public Timestamp getUpdated(); + + /** Column name UpdatedBy */ + public static final String COLUMNNAME_UpdatedBy = "UpdatedBy"; + + /** Get Updated By. + * User who updated this records + */ + public int getUpdatedBy(); +} diff --git a/org.adempiere.base/src/org/compiere/model/MRecentItem.java b/org.adempiere.base/src/org/compiere/model/MRecentItem.java new file mode 100644 index 0000000000..65010658b5 --- /dev/null +++ b/org.adempiere.base/src/org/compiere/model/MRecentItem.java @@ -0,0 +1,254 @@ +/****************************************************************************** + * Copyright (C) 2012 Carlos Ruiz * + * Copyright (C) 2012 GlobalQSS - Quality Systems & Solutions * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.compiere.model; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Iterator; +import java.util.List; +import java.util.Properties; + +import org.adempiere.exceptions.AdempiereException; +import org.compiere.util.CCache; +import org.compiere.util.CLogger; +import org.compiere.util.DB; +import org.compiere.util.Env; + +/** + * Recent Item model + * + * @author Carlos Ruiz - GlobalQSS + */ +public class MRecentItem extends X_AD_RecentItem +{ + /** + * + */ + private static final long serialVersionUID = 8337619537799431984L; + + /** Recent Item Cache */ + private static CCache s_cache = new CCache("AD_RecentItem", 10); + /** Logger */ + private static CLogger s_log = CLogger.getCLogger(MRecentItem.class); + + /************************************************************************** + * Standard Constructor + * @param ctx context + * @param AD_RecentItem_ID id + * @param trxName transaction + */ + public MRecentItem (Properties ctx, int AD_RecentItem_ID, String trxName) + { + super (ctx, AD_RecentItem_ID, trxName); + if (AD_RecentItem_ID > 0) { + Integer key = new Integer (AD_RecentItem_ID); + if (!s_cache.containsKey(key)) + s_cache.put (key, this); + } + } // MRecentItem + + /** + * Load Constructor + * @param ctx ctx + * @param rs result set + * @param trxName transaction + */ + public MRecentItem (Properties ctx, ResultSet rs, String trxName) + { + super(ctx, rs, trxName); + Integer key = null; + try { + key = new Integer (rs.getInt("AD_RecentItem_ID")); + } catch (SQLException e) { + throw new AdempiereException(e); + } + if (key != null && !s_cache.containsKey(key)) + s_cache.put (key, this); + } // MRecentItem + + /** + * Get from Cache using ID + * @param ctx context + * @param AD_RecentItem_ID id + * @return recent item + */ + public static MRecentItem get (Properties ctx, int AD_RecentItem_ID) + { + Integer ii = new Integer (AD_RecentItem_ID); + MRecentItem ri = (MRecentItem)s_cache.get(ii); + if (ri == null) + ri = new MRecentItem (ctx, AD_RecentItem_ID, null); + return ri; + } // get + + /** + * Get Recent Item from Cache using table+recordID + * @param ctx context + * @param AD_Table_ID tableID + * @param Record_ID recordID + * @return recent item + */ + public static MRecentItem get (Properties ctx, int AD_Table_ID, int Record_ID, int AD_User_ID) + { + Iterator it = s_cache.values().iterator(); + while (it.hasNext()) + { + MRecentItem retValue = it.next(); + if (retValue.getAD_Table_ID() == AD_Table_ID + && retValue.getRecord_ID() == Record_ID + && retValue.getCtx() == ctx + ) + { + return retValue; + } + } + // + MRecentItem retValue = null; + String sql = "SELECT * FROM AD_RecentItem WHERE AD_Table_ID=? AND Record_ID=? AND AD_User_ID=?"; + PreparedStatement pstmt = null; + ResultSet rs = null; + try + { + pstmt = DB.prepareStatement (sql, null); + pstmt.setInt(1, AD_Table_ID); + pstmt.setInt(2, Record_ID); + pstmt.setInt(3, AD_User_ID); + rs = pstmt.executeQuery (); + if (rs.next ()) + retValue = new MRecentItem (ctx, rs, null); + } catch (SQLException e) { + e.printStackTrace(); + throw new AdempiereException(e); + } + finally + { + DB.close(rs, pstmt); + rs = null; pstmt = null; + } + + if (retValue != null) + { + Integer key = new Integer (retValue.getAD_RecentItem_ID()); + s_cache.put (key, retValue); + } + return retValue; + } // get + + /* + * addModifiedField / method to be called when first field is modified on a window + * it adds a record in recent item, or touches the record if it was added before + */ + public static void addModifiedField(Properties ctx, int AD_Table_ID, int Record_ID, int AD_User_ID, int AD_Role_ID, int AD_Window_ID, int AD_Tab_ID) { + int maxri = MSysConfig.getIntValue("RecentItems_MaxSaved", 50, Env.getAD_Client_ID(ctx)); + if (maxri <= 0) + return; + MRecentItem ri = get(ctx, AD_Table_ID, Record_ID, AD_User_ID); + if (ri == null) { + ri = new MRecentItem(ctx, 0, null); + ri.setAD_Table_ID(AD_Table_ID); + ri.setRecord_ID(Record_ID); + ri.setAD_User_ID(AD_User_ID); + } + ri.setAD_Role_ID(AD_Role_ID); + ri.setAD_Window_ID(AD_Window_ID); + ri.setAD_Tab_ID(AD_Tab_ID); + ri.saveEx(); + } + + /* + * touchUpdatedRecord / method to be called when a record is saved or updated in database + * it touches the record added before + * also delete recent items beyond the number of records allowed per user + */ + public static void touchUpdatedRecord(Properties ctx, int AD_Table_ID, int Record_ID, int AD_User_ID) { + MRecentItem ri = get(ctx, AD_Table_ID, Record_ID, AD_User_ID); + if (ri != null) { + DB.executeUpdateEx("UPDATE AD_RecentItem SET Updated=SYSDATE WHERE AD_RecentItem_ID=?", new Object[] {ri.getAD_RecentItem_ID()}, null); + deleteExtraRecentItems(ctx, AD_User_ID); + } + } + + private static void deleteExtraRecentItems(Properties ctx, int AD_User_ID) { + int AD_Client_ID = Env.getAD_Client_ID(ctx); + int maxri = MSysConfig.getIntValue("RecentItems_MaxSaved", 50, AD_Client_ID); + if (maxri < 0) + maxri = 0; + int cntri = DB.getSQLValue(null, "SELECT COUNT(*) FROM AD_RecentItem WHERE AD_User_ID=? AND AD_Client_ID=?", AD_User_ID, AD_Client_ID); + if (cntri > maxri) { + int cntdel = cntri - maxri; + String sql = "SELECT AD_Table_ID, Record_ID FROM AD_RecentItem WHERE AD_User_ID=? AND AD_Client_ID=? ORDER BY Updated"; + PreparedStatement pstmt = null; + ResultSet rs = null; + try + { + pstmt = DB.prepareStatement (sql, null); + pstmt.setInt(1, AD_User_ID); + pstmt.setInt(2, AD_Client_ID); + rs = pstmt.executeQuery (); + while (rs.next()) { + int AD_Table_ID = rs.getInt(1); + int Record_ID = rs.getInt(2); + MRecentItem ri = get(ctx, AD_Table_ID, Record_ID, AD_User_ID); + ri.deleteEx(true); + cntdel--; + if (cntdel == 0) + break; + } + } catch (SQLException e) { + e.printStackTrace(); + throw new AdempiereException(e); + } + finally + { + DB.close(rs, pstmt); + rs = null; pstmt = null; + } + } + } + + @Override + public boolean delete(boolean force) { + Integer ii = new Integer (getAD_RecentItem_ID()); + s_cache.remove(ii); + return super.delete(force); + } + + public static List getFromUser(Properties ctx, int AD_User_ID) { + List ris = new Query(ctx, MRecentItem.Table_Name, "AD_User_ID=?", null) + .setOnlyActiveRecords(true) + .setClient_ID() + .setParameters(AD_User_ID) + .setOrderBy("Updated DESC") + .list(); + return ris; + } + + public String getLabel() { + MWindow win = new MWindow(getCtx(), getAD_Window_ID(), null); + String windowName = win.get_Translation("Name"); + MTable table = MTable.get(getCtx(), getAD_Table_ID()); + PO po = table.getPO(getRecord_ID(), null); + String recordIdentifier = ""; + if (po.get_ColumnIndex("DocumentNo") > 0) + recordIdentifier = recordIdentifier + "_" + po.get_ValueAsString("DocumentNo"); + if (po.get_ColumnIndex("Value") > 0) + recordIdentifier = recordIdentifier + "_" + po.get_ValueAsString("Value"); + if (po.get_ColumnIndex("Name") > 0) + recordIdentifier = recordIdentifier + "_" + po.get_ValueAsString("Name"); + + return windowName + ": " + recordIdentifier.substring(1); + } + +} // MRecentItem 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 4c8fdf1843..3076fb918f 100644 --- a/org.adempiere.base/src/org/compiere/model/PO_Record.java +++ b/org.adempiere.base/src/org/compiere/model/PO_Record.java @@ -59,7 +59,8 @@ public class PO_Record // X_CM_ContainerTTable.Table_ID, // X_CM_CStageTTable.Table_ID, X_K_Index.Table_ID, - X_AD_Note.Table_ID + X_AD_Note.Table_ID, + X_AD_RecentItem.Table_ID }; /** Cascade Table Names */ private static String[] s_cascadeNames = new String[]{ @@ -68,7 +69,8 @@ public class PO_Record // X_CM_ContainerTTable.Table_Name, // X_CM_CStageTTable.Table_Name, X_K_Index.Table_Name, - X_AD_Note.Table_Name + X_AD_Note.Table_Name, + X_AD_RecentItem.Table_Name }; /** Restrict Table ID */ diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_RecentItem.java b/org.adempiere.base/src/org/compiere/model/X_AD_RecentItem.java new file mode 100644 index 0000000000..0f805d1921 --- /dev/null +++ b/org.adempiere.base/src/org/compiere/model/X_AD_RecentItem.java @@ -0,0 +1,257 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. * + * This program is free software, you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY, without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program, if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +/** Generated Model - DO NOT CHANGE */ +package org.compiere.model; + +import java.sql.ResultSet; +import java.util.Properties; + +/** Generated Model for AD_RecentItem + * @author Adempiere (generated) + * @version Release 3.6.0LTS - $Id$ */ +public class X_AD_RecentItem extends PO implements I_AD_RecentItem, I_Persistent +{ + + /** + * + */ + private static final long serialVersionUID = 20120127L; + + /** Standard Constructor */ + public X_AD_RecentItem (Properties ctx, int AD_RecentItem_ID, String trxName) + { + super (ctx, AD_RecentItem_ID, trxName); + /** if (AD_RecentItem_ID == 0) + { + setAD_RecentItem_ID (0); + setAD_Role_ID (0); + setAD_Table_ID (0); + setRecord_ID (0); + } */ + } + + /** Load Constructor */ + public X_AD_RecentItem (Properties ctx, ResultSet rs, String trxName) + { + super (ctx, rs, trxName); + } + + /** AccessLevel + * @return 7 - System - Client - Org + */ + protected int get_AccessLevel() + { + return accessLevel.intValue(); + } + + /** Load Meta Data */ + protected POInfo initPO (Properties ctx) + { + POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName()); + return poi; + } + + public String toString() + { + StringBuffer sb = new StringBuffer ("X_AD_RecentItem[") + .append(get_ID()).append("]"); + return sb.toString(); + } + + /** Set Recent Item. + @param AD_RecentItem_ID Recent Item */ + public void setAD_RecentItem_ID (int AD_RecentItem_ID) + { + if (AD_RecentItem_ID < 1) + set_ValueNoCheck (COLUMNNAME_AD_RecentItem_ID, null); + else + set_ValueNoCheck (COLUMNNAME_AD_RecentItem_ID, Integer.valueOf(AD_RecentItem_ID)); + } + + /** Get Recent Item. + @return Recent Item */ + public int getAD_RecentItem_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_AD_RecentItem_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public org.compiere.model.I_AD_Role getAD_Role() throws RuntimeException + { + return (org.compiere.model.I_AD_Role)MTable.get(getCtx(), org.compiere.model.I_AD_Role.Table_Name) + .getPO(getAD_Role_ID(), get_TrxName()); } + + /** Set Role. + @param AD_Role_ID + Responsibility Role + */ + public void setAD_Role_ID (int AD_Role_ID) + { + if (AD_Role_ID < 0) + set_Value (COLUMNNAME_AD_Role_ID, null); + else + set_Value (COLUMNNAME_AD_Role_ID, Integer.valueOf(AD_Role_ID)); + } + + /** Get Role. + @return Responsibility Role + */ + public int getAD_Role_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_AD_Role_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public org.compiere.model.I_AD_Tab getAD_Tab() throws RuntimeException + { + return (org.compiere.model.I_AD_Tab)MTable.get(getCtx(), org.compiere.model.I_AD_Tab.Table_Name) + .getPO(getAD_Tab_ID(), get_TrxName()); } + + /** Set Tab. + @param AD_Tab_ID + Tab within a Window + */ + public void setAD_Tab_ID (int AD_Tab_ID) + { + if (AD_Tab_ID < 1) + set_Value (COLUMNNAME_AD_Tab_ID, null); + else + set_Value (COLUMNNAME_AD_Tab_ID, Integer.valueOf(AD_Tab_ID)); + } + + /** Get Tab. + @return Tab within a Window + */ + public int getAD_Tab_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_AD_Tab_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public org.compiere.model.I_AD_Table getAD_Table() throws RuntimeException + { + return (org.compiere.model.I_AD_Table)MTable.get(getCtx(), org.compiere.model.I_AD_Table.Table_Name) + .getPO(getAD_Table_ID(), get_TrxName()); } + + /** Set Table. + @param AD_Table_ID + Database Table information + */ + public void setAD_Table_ID (int AD_Table_ID) + { + if (AD_Table_ID < 1) + set_Value (COLUMNNAME_AD_Table_ID, null); + else + set_Value (COLUMNNAME_AD_Table_ID, Integer.valueOf(AD_Table_ID)); + } + + /** Get Table. + @return Database Table information + */ + public int getAD_Table_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_AD_Table_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public org.compiere.model.I_AD_User getAD_User() throws RuntimeException + { + return (org.compiere.model.I_AD_User)MTable.get(getCtx(), org.compiere.model.I_AD_User.Table_Name) + .getPO(getAD_User_ID(), get_TrxName()); } + + /** Set Usuario. + @param AD_User_ID + User within the system - Internal or Business Partner Contact + */ + public void setAD_User_ID (int AD_User_ID) + { + if (AD_User_ID < 1) + set_Value (COLUMNNAME_AD_User_ID, null); + else + set_Value (COLUMNNAME_AD_User_ID, Integer.valueOf(AD_User_ID)); + } + + /** Get Usuario. + @return User within the system - Internal or Business Partner Contact + */ + public int getAD_User_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_AD_User_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public org.compiere.model.I_AD_Window getAD_Window() throws RuntimeException + { + return (org.compiere.model.I_AD_Window)MTable.get(getCtx(), org.compiere.model.I_AD_Window.Table_Name) + .getPO(getAD_Window_ID(), get_TrxName()); } + + /** Set Window. + @param AD_Window_ID + Data entry or display window + */ + public void setAD_Window_ID (int AD_Window_ID) + { + if (AD_Window_ID < 1) + set_Value (COLUMNNAME_AD_Window_ID, null); + else + set_Value (COLUMNNAME_AD_Window_ID, Integer.valueOf(AD_Window_ID)); + } + + /** Get Window. + @return Data entry or display window + */ + public int getAD_Window_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_AD_Window_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Record ID. + @param Record_ID + Direct internal record ID + */ + public void setRecord_ID (int Record_ID) + { + if (Record_ID < 0) + set_Value (COLUMNNAME_Record_ID, null); + else + set_Value (COLUMNNAME_Record_ID, Integer.valueOf(Record_ID)); + } + + /** Get Record ID. + @return Direct internal record ID + */ + public int getRecord_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_Record_ID); + if (ii == null) + return 0; + return ii.intValue(); + } +} \ No newline at end of file diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPRecentItems.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPRecentItems.java new file mode 100644 index 0000000000..8fcc1ecd9c --- /dev/null +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPRecentItems.java @@ -0,0 +1,211 @@ +/****************************************************************************** + * Copyright (C) 2012 Carlos Ruiz * + * Copyright (C) 2012 GlobalQSS - Quality Systems & Solutions * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.adempiere.webui.dashboard; + +import java.util.List; + +import org.adempiere.webui.component.ToolBarButton; +import org.adempiere.webui.session.SessionManager; +import org.adempiere.webui.util.ServerPushTemplate; +import org.compiere.model.MQuery; +import org.compiere.model.MRecentItem; +import org.compiere.model.MSysConfig; +import org.compiere.model.MTable; +import org.compiere.util.Env; +import org.zkoss.zk.ui.Component; +import org.zkoss.zk.ui.event.DropEvent; +import org.zkoss.zk.ui.event.Event; +import org.zkoss.zk.ui.event.EventListener; +import org.zkoss.zk.ui.event.Events; +import org.zkoss.zul.Box; +import org.zkoss.zul.Image; +import org.zkoss.zul.Panel; +import org.zkoss.zul.Panelchildren; +import org.zkoss.zul.Toolbar; +import org.zkoss.zul.Vbox; + +/** + * Dashboard item: Recent Items + * @author Carlos Ruiz / GlobalQSS + * @date January 27, 2012 + */ +public class DPRecentItems extends DashboardPanel implements EventListener { + + /** + * + */ + private static final long serialVersionUID = 662950038476166515L; + + public static final String DELETE_RECENTITEMS_DROPPABLE = "deleteRecentItems"; + + private Box bxRecentItems; + + public DPRecentItems() + { + super(); + + Panel panel = new Panel(); + this.appendChild(panel); + + Panelchildren recentItemsContent = new Panelchildren(); + panel.appendChild(recentItemsContent); + recentItemsContent.appendChild(createRecentItemsPanel()); + + Toolbar recentItemsToolbar = new Toolbar(); + this.appendChild(recentItemsToolbar); + + Image imgr = new Image("/images/Refresh24.png"); + recentItemsToolbar.appendChild(imgr); + imgr.setAlign("left"); + imgr.addEventListener(Events.ON_CLICK, this); + // + + Image img = new Image("/images/Delete24.png"); + recentItemsToolbar.appendChild(img); + img.setAlign("right"); + img.setDroppable(DELETE_RECENTITEMS_DROPPABLE); + img.addEventListener(Events.ON_DROP, this); + // + + } + + private Box createRecentItemsPanel() + { + bxRecentItems = new Vbox(); + + refresh(); + + return bxRecentItems; + } + + /** + * Make Recent Item remove persistent + * @param AD_RecentItem_ID Recent Item ID + * @return true if updated + */ + private void riDBremove(int AD_RecentItem_ID) + { + MRecentItem ri = MRecentItem.get(Env.getCtx(), AD_RecentItem_ID); + ri.deleteEx(true); + } + + public void onEvent(Event event) + { + Component comp = event.getTarget(); + String eventName = event.getName(); + + if (eventName.equals(Events.ON_CLICK)) + { + if (comp instanceof ToolBarButton) + { + ToolBarButton btn = (ToolBarButton) comp; + + int AD_RecentItem_ID = 0; + try + { + AD_RecentItem_ID = Integer.valueOf(btn.getName()); + } + catch (Exception e) { + } + + if (AD_RecentItem_ID > 0) { + MRecentItem ri = MRecentItem.get(Env.getCtx(), AD_RecentItem_ID); + String TableName = MTable.getTableName(Env.getCtx(), ri.getAD_Table_ID()); + MQuery query = MQuery.getEqualQuery(TableName + "_ID", ri.getRecord_ID()); + + SessionManager.getAppDesktop().openWindow(ri.getAD_Window_ID(), query); + } + } + if (comp instanceof Image) // Refresh button + { + refresh(); + } + } + else if(eventName.equals(Events.ON_DROP)) + { + DropEvent de = (DropEvent) event; + Component dragged = de.getDragged(); + + if(comp instanceof Image) + { + if(dragged instanceof ToolBarButton) + { + ToolBarButton btn = (ToolBarButton) dragged; + removeLink(btn); + } + } + } + } + + private void refresh() { + // Please review here - is throwing NPE in some cases when user push repeatedly the refresh button + List childs = bxRecentItems.getChildren(); + int childCount = childs.size(); + for (int c = childCount - 1; c >=0; c--) { + Component comp = (Component) childs.get(c); + if (comp instanceof ToolBarButton) { + ((ToolBarButton) comp).removeEventListener(Events.ON_CLICK, this); + ((ToolBarButton) comp).removeEventListener(Events.ON_DROP, this); + } + bxRecentItems.removeChild(comp); + } + + int maxri = MSysConfig.getIntValue("RecentItems_MaxShown", 10, Env.getAD_Client_ID(Env.getCtx())); + if (maxri <= 0) + return; + + int AD_User_ID = Env.getAD_User_ID(Env.getCtx()); + List ris = MRecentItem.getFromUser(Env.getCtx(), AD_User_ID); + int riShown = 0; + for (MRecentItem ri : ris) { + String label = ri.getLabel(); + ToolBarButton btnrecentItem = new ToolBarButton(String.valueOf(ri.getAD_RecentItem_ID())); + btnrecentItem.setLabel(label); + btnrecentItem.setImage(getIconFile()); + btnrecentItem.setDraggable(DELETE_RECENTITEMS_DROPPABLE); + btnrecentItem.addEventListener(Events.ON_CLICK, this); + btnrecentItem.addEventListener(Events.ON_DROP, this); + bxRecentItems.appendChild(btnrecentItem); + riShown++; + if (riShown >= maxri) + break; + } + + } + + private void removeLink(ToolBarButton btn) { + String value = btn.getName(); + + if (value != null) + { + int AD_RecentItem_ID = Integer.valueOf(value.toString()); + riDBremove(AD_RecentItem_ID); + bxRecentItems.removeChild(btn); + bxRecentItems.invalidate(); + } + } + + private String getIconFile() { + return "images/mWindow.png"; + } + + @Override + public void refresh(ServerPushTemplate template) + { + refresh(); + bxRecentItems.invalidate(); + template.execute(this); + } + +} diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java index 9b413c6c14..3d0b39d9c0 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java @@ -67,6 +67,7 @@ import org.compiere.model.GridWindowVO; import org.compiere.model.Lookup; import org.compiere.model.MProcess; import org.compiere.model.MQuery; +import org.compiere.model.MRecentItem; import org.compiere.model.MRole; import org.compiere.process.DocAction; import org.compiere.process.ProcessInfo; @@ -1228,6 +1229,16 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To readOnly = false; } toolbar.enableIgnore(changed && !readOnly); + + if (changed && !readOnly && !toolbar.isSaveEnable() ) { + if (curTabIndex == 0 && curTab.getRecord_ID() > 0) { + MRecentItem.addModifiedField(ctx, curTab.getAD_Table_ID(), + curTab.getRecord_ID(), Env.getAD_User_ID(ctx), + Env.getAD_Role_ID(ctx), curTab.getAD_Window_ID(), + curTab.getAD_Tab_ID()); + } + } + toolbar.enableSave(changed && !readOnly); toolbar.enableSaveAndCreate(changed && !readOnly); // @@ -1508,6 +1519,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To */ private boolean onSave(boolean onSaveEvent) { + boolean newRecord = (curTab.getRecord_ID() <= 0); if (curTab.isSortTab()) { ((ADSortTab)curTabpanel).saveData(); @@ -1537,6 +1549,17 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To } curTabpanel.dynamicDisplay(0); curTabpanel.afterSave(onSaveEvent); + + if (newRecord) { + MRecentItem.addModifiedField(ctx, curTab.getAD_Table_ID(), + curTab.getRecord_ID(), Env.getAD_User_ID(ctx), + Env.getAD_Role_ID(ctx), curTab.getAD_Window_ID(), + curTab.getAD_Tab_ID()); + } else { + MRecentItem.touchUpdatedRecord(ctx, curTab.getAD_Table_ID(), + curTab.getRecord_ID(), Env.getAD_User_ID(ctx)); + } + return true; } } diff --git a/org.adempiere.ui.zk/zul/recentItems.zul b/org.adempiere.ui.zk/zul/recentItems.zul new file mode 100644 index 0000000000..644b067044 --- /dev/null +++ b/org.adempiere.ui.zk/zul/recentItems.zul @@ -0,0 +1,2 @@ + +