Merge with 8d3b639fd52cecdc89d7256e97f469430175ecb1

This commit is contained in:
Heng Sin Low 2012-11-14 10:21:13 +08:00
commit fcce5918dd
28 changed files with 2064 additions and 91 deletions

View File

@ -0,0 +1,13 @@
-- Nov 9, 2012 12:22:47 PM COT
-- IDEMPIERE-316 Inform when the user is not approver of a workflow doc
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Cannot Approve - No Approver',200111,'D','56d07e7f-7414-4e55-9083-1818e0a6c4f9','NoApprover','Y',TO_DATE('2012-11-09 12:22:46','YYYY-MM-DD HH24:MI:SS'),0,0,0,0,TO_DATE('2012-11-09 12:22:46','YYYY-MM-DD HH24:MI:SS'))
;
-- Nov 9, 2012 12:22:47 PM COT
-- IDEMPIERE-316 Inform when the user is not approver of a workflow doc
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200111 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
SELECT register_migration_script('201211091228_IDEMPIERE-316.sql') FROM dual
;

View File

@ -0,0 +1,8 @@
-- Nov 9, 2012 1:28:45 PM COT
-- Last migration script not being set
UPDATE AD_System SET LastMigrationScriptApplied=NULL WHERE AD_System_ID=0
;
SELECT register_migration_script('201211091328_LastMigrationNotSet.sql') FROM dual
;

View File

@ -0,0 +1,88 @@
-- IDEMPIERE-498 Make BP quick entry configurable
-- Nov 1, 2012 12:10:18 PM COT
INSERT INTO AD_Element (ColumnName,AD_Element_ID,EntityType,Name,PrintName,AD_Element_UU,AD_Client_ID,Created,Updated,AD_Org_ID,CreatedBy,UpdatedBy,IsActive) VALUES ('IsQuickEntry',200216,'D','Quick Entry','Quick Entry','ba2d92ea-f8c5-438e-ba30-053965fdb1ff',0,TO_DATE('2012-11-01 12:10:15','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2012-11-01 12:10:15','YYYY-MM-DD HH24:MI:SS'),0,0,0,'Y')
;
-- Nov 1, 2012 12:10:18 PM COT
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Help,PO_Description,PO_Help,Name,Description,PrintName,PO_Name,PO_PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Element_Trl_UU ) SELECT l.AD_Language,t.AD_Element_ID, t.Help,t.PO_Description,t.PO_Help,t.Name,t.Description,t.PrintName,t.PO_Name,t.PO_PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=200216 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)
;
-- Nov 1, 2012 12:11:28 PM COT
INSERT INTO AD_Column (IsSyncDatabase,IsEncrypted,Version,AD_Table_ID,AD_Column_ID,EntityType,IsMandatory,DefaultValue,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,IsAlwaysUpdateable,ColumnName,Name,IsAllowCopy,CreatedBy,Updated,AD_Org_ID,IsActive,Created,UpdatedBy,AD_Client_ID,SeqNoSelection,IsToolbarButton) VALUES ('N','N',0,107,200862,'D','Y','N','N','N',0,'N',1,'N',20,'N',200216,'N','Y','54666e5d-4260-4a97-8832-d5da6da8a5aa','Y','N','IsQuickEntry','Quick Entry','Y',0,TO_DATE('2012-11-01 12:11:25','YYYY-MM-DD HH24:MI:SS'),0,'Y',TO_DATE('2012-11-01 12:11:25','YYYY-MM-DD HH24:MI:SS'),0,0,0,'N')
;
-- Nov 1, 2012 12:11:28 PM COT
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Column_Trl_UU ) 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,Generate_UUID() FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200862 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)
;
-- Nov 1, 2012 2:26:31 PM COT
INSERT INTO AD_Field (NumLines,AD_Field_UU,SortNo,IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,EntityType,Name,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,AD_Client_ID,CreatedBy,Updated,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (1,'222ea356-f257-413d-9724-c2b59077b94f',0,'N',107,0,'N','N',200862,305,'Y',200771,'N','D','Quick Entry','Y','N',0,0,TO_DATE('2012-11-01 14:26:30','YYYY-MM-DD HH24:MI:SS'),0,0,TO_DATE('2012-11-01 14:26:30','YYYY-MM-DD HH24:MI:SS'),'Y','Y',305,2,1)
;
-- Nov 1, 2012 2:27:37 PM COT
ALTER TABLE AD_Field ADD (IsQuickEntry CHAR(1) DEFAULT 'N' CHECK (IsQuickEntry IN ('Y','N')) NOT NULL)
;
-- Nov 1, 2012 2:28:01 PM COT
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Field_Trl_UU ) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=200772 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- Nov 1, 2012 2:50:40 PM COT
UPDATE AD_Field SET IsQuickEntry='Y',Updated=TO_DATE('2012-11-01 14:50:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=2156
;
-- Nov 1, 2012 2:51:33 PM COT
UPDATE AD_Field SET IsQuickEntry='Y',Updated=TO_DATE('2012-11-01 14:51:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=3261
;
-- Nov 1, 2012 2:52:09 PM COT
UPDATE AD_Field SET IsQuickEntry='Y',Updated=TO_DATE('2012-11-01 14:52:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=2145
;
-- Nov 1, 2012 2:52:20 PM COT
UPDATE AD_Field SET IsQuickEntry='Y',Updated=TO_DATE('2012-11-01 14:52:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=3228
;
-- Nov 1, 2012 3:10:08 PM COT
UPDATE AD_Field SET IsQuickEntry='Y',Updated=TO_DATE('2012-11-01 15:10:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=7010
;
-- Nov 1, 2012 3:11:02 PM COT
UPDATE AD_Field SET IsQuickEntry='Y',Updated=TO_DATE('2012-11-01 15:11:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=7020
;
-- Nov 1, 2012 3:12:08 PM COT
UPDATE AD_Field SET IsQuickEntry='Y',Updated=TO_DATE('2012-11-01 15:12:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=7028
;
-- Nov 1, 2012 3:12:51 PM COT
UPDATE AD_Field SET IsQuickEntry='Y',Updated=TO_DATE('2012-11-01 15:12:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=7017
;
-- Nov 1, 2012 3:13:38 PM COT
UPDATE AD_Field SET IsQuickEntry='Y',Updated=TO_DATE('2012-11-01 15:13:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=7024
;
-- Nov 1, 2012 3:13:49 PM COT
UPDATE AD_Field SET IsQuickEntry='Y',Updated=TO_DATE('2012-11-01 15:13:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=7021
;
-- Nov 1, 2012 3:14:07 PM COT
UPDATE AD_Field SET IsQuickEntry='Y',Updated=TO_DATE('2012-11-01 15:14:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=7025
;
-- Nov 1, 2012 3:16:56 PM COT
UPDATE AD_Field SET IsQuickEntry='Y',Updated=TO_DATE('2012-11-01 15:16:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=2185
;
-- Nov 2, 2012 3:39:54 PM COT
UPDATE AD_Field SET DisplayLogic='@AD_Tab_ID@=220 || @AD_Tab_ID@=496 || @AD_Tab_ID@=222',Updated=TO_DATE('2012-11-02 15:39:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=200772
;
-- Nov 9, 2012 9:25:56 PM COT
UPDATE AD_Column SET Callout='org.adempiere.model.CalloutBPartnerLocation.formatPhone;org.adempiere.model.CalloutBPartnerLocation.quickEntryMandatory',Updated=TO_DATE('2012-11-09 21:25:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2959
;
SELECT register_migration_script('201211091853_IDEMPIERE-498.sql') FROM dual
;

View File

@ -0,0 +1,63 @@
-- Nov 7, 2012 2:27:45 PM COT
-- IDEMPIERE-457
INSERT INTO AD_Form (AccessLevel,Classname,AD_Form_ID,IsBetaFunctionality,EntityType,AD_Form_UU,Name,AD_Org_ID,UpdatedBy,CreatedBy,Updated,Created,AD_Client_ID,IsActive) VALUES ('4','org.compiere.apps.form.VTabEditor',200005,'N','D','4f5be293-6016-4bb5-9a7f-114018d1f1b7','Tab Editor',0,100,100,TO_DATE('2012-11-07 14:27:44','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2012-11-07 14:27:44','YYYY-MM-DD HH24:MI:SS'),0,'Y')
;
-- Nov 7, 2012 2:27:45 PM COT
-- IDEMPIERE-457
INSERT INTO AD_Form_Trl (AD_Language,AD_Form_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Form_Trl_UU ) SELECT l.AD_Language,t.AD_Form_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Form t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Form_ID=200005 AND NOT EXISTS (SELECT * FROM AD_Form_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Form_ID=t.AD_Form_ID)
;
-- Nov 7, 2012 2:28:05 PM COT
-- IDEMPIERE-457
INSERT INTO AD_Process (CopyFromProcess,AD_Process_ID,IsDirectPrint,IsReport,AD_Process_UU,AccessLevel,IsBetaFunctionality,IsServerProcess,Statistic_Seconds,Statistic_Count,ShowHelp,EntityType,AD_Form_ID,Name,Value,AD_Org_ID,AD_Client_ID,Updated,UpdatedBy,Created,IsActive,CreatedBy) VALUES ('N',200015,'N','N','0649c86f-a16d-427b-99d3-ee13408ff5c2','4','N','N',0,0,'Y','D',200005,'Tab Editor','TabEditor',0,0,TO_DATE('2012-11-07 14:28:04','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2012-11-07 14:28:04','YYYY-MM-DD HH24:MI:SS'),'Y',100)
;
-- Nov 7, 2012 2:28:05 PM COT
-- IDEMPIERE-457
INSERT INTO AD_Process_Trl (AD_Language,AD_Process_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Process_Trl_UU ) SELECT l.AD_Language,t.AD_Process_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Process t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_ID=200015 AND NOT EXISTS (SELECT * FROM AD_Process_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_ID=t.AD_Process_ID)
;
-- Nov 7, 2012 2:28:21 PM COT
-- IDEMPIERE-457
INSERT INTO AD_ToolBarButton (Action,AD_Tab_ID,AD_Process_ID,SeqNo,IsCustomization,Name,ComponentName,AD_Client_ID,AD_Org_ID,Created,CreatedBy,AD_ToolBarButton_ID,Updated,UpdatedBy,IsActive,AD_ToolBarButton_UU) VALUES ('W',106,200015,10,'N','Tab Editor','TabEditor',0,0,TO_DATE('2012-11-07 14:28:20','YYYY-MM-DD HH24:MI:SS'),100,200068,TO_DATE('2012-11-07 14:28:20','YYYY-MM-DD HH24:MI:SS'),100,'Y','ec63158f-8f95-4b24-a1ce-3caf0e1e738d')
;
-- Nov 7, 2012 2:29:45 PM COT
-- IDEMPIERE-457
UPDATE AD_ToolBarButton SET DisplayLogic='@IsSortTab@=N',Updated=TO_DATE('2012-11-07 14:29:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_ToolBarButton_ID=200068
;
-- Nov 12, 2012 6:03:28 PM COT
-- IDEMPIERE-457 Tab Editor (to ease positioning of fields)
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Property',200112,'D','8fefc045-b3aa-4bcf-a4ca-4db079842a67','Property','Y',TO_DATE('2012-11-12 18:03:27','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-11-12 18:03:27','YYYY-MM-DD HH24:MI:SS'))
;
-- Nov 12, 2012 6:03:29 PM COT
-- IDEMPIERE-457 Tab Editor (to ease positioning of fields)
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200112 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Nov 12, 2012 6:03:53 PM COT
-- IDEMPIERE-457 Tab Editor (to ease positioning of fields)
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Visible Fields',200113,'D','fbf72d95-345c-4506-a8fc-cb275c885cdd','VisibleFields','Y',TO_DATE('2012-11-12 18:03:53','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-11-12 18:03:53','YYYY-MM-DD HH24:MI:SS'))
;
-- Nov 12, 2012 6:03:53 PM COT
-- IDEMPIERE-457 Tab Editor (to ease positioning of fields)
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200113 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Nov 12, 2012 6:04:15 PM COT
-- IDEMPIERE-457 Tab Editor (to ease positioning of fields)
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Non Visible Fields',200114,'D','1e160a14-8b90-45c1-8a12-db2f9531add2','NonVisibleFields','Y',TO_DATE('2012-11-12 18:04:14','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-11-12 18:04:14','YYYY-MM-DD HH24:MI:SS'))
;
-- Nov 12, 2012 6:04:15 PM COT
-- IDEMPIERE-457 Tab Editor (to ease positioning of fields)
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200114 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
SELECT register_migration_script('201211121807_IDEMPIERE-457.sql') FROM dual
;

View File

@ -0,0 +1,13 @@
-- Nov 9, 2012 12:22:47 PM COT
-- IDEMPIERE-316 Inform when the user is not approver of a workflow doc
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Cannot Approve - No Approver',200111,'D','56d07e7f-7414-4e55-9083-1818e0a6c4f9','NoApprover','Y',TO_TIMESTAMP('2012-11-09 12:22:46','YYYY-MM-DD HH24:MI:SS'),0,0,0,0,TO_TIMESTAMP('2012-11-09 12:22:46','YYYY-MM-DD HH24:MI:SS'))
;
-- Nov 9, 2012 12:22:47 PM COT
-- IDEMPIERE-316 Inform when the user is not approver of a workflow doc
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200111 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
SELECT register_migration_script('201211091228_IDEMPIERE-316.sql') FROM dual
;

View File

@ -0,0 +1,8 @@
-- Nov 9, 2012 1:28:45 PM COT
-- Last migration script not being set
UPDATE AD_System SET LastMigrationScriptApplied=NULL WHERE AD_System_ID=0
;
SELECT register_migration_script('201211091328_LastMigrationNotSet.sql') FROM dual
;

View File

@ -0,0 +1,88 @@
-- IDEMPIERE-498 Make BP quick entry configurable
-- Nov 1, 2012 12:10:18 PM COT
INSERT INTO AD_Element (ColumnName,AD_Element_ID,EntityType,Name,PrintName,AD_Element_UU,AD_Client_ID,Created,Updated,AD_Org_ID,CreatedBy,UpdatedBy,IsActive) VALUES ('IsQuickEntry',200216,'D','Quick Entry','Quick Entry','ba2d92ea-f8c5-438e-ba30-053965fdb1ff',0,TO_TIMESTAMP('2012-11-01 12:10:15','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2012-11-01 12:10:15','YYYY-MM-DD HH24:MI:SS'),0,0,0,'Y')
;
-- Nov 1, 2012 12:10:18 PM COT
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Help,PO_Description,PO_Help,Name,Description,PrintName,PO_Name,PO_PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Element_Trl_UU ) SELECT l.AD_Language,t.AD_Element_ID, t.Help,t.PO_Description,t.PO_Help,t.Name,t.Description,t.PrintName,t.PO_Name,t.PO_PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=200216 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)
;
-- Nov 1, 2012 12:11:28 PM COT
INSERT INTO AD_Column (IsSyncDatabase,IsEncrypted,Version,AD_Table_ID,AD_Column_ID,EntityType,IsMandatory,DefaultValue,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,IsAlwaysUpdateable,ColumnName,Name,IsAllowCopy,CreatedBy,Updated,AD_Org_ID,IsActive,Created,UpdatedBy,AD_Client_ID,SeqNoSelection,IsToolbarButton) VALUES ('N','N',0,107,200862,'D','Y','N','N','N',0,'N',1,'N',20,'N',200216,'N','Y','54666e5d-4260-4a97-8832-d5da6da8a5aa','Y','N','IsQuickEntry','Quick Entry','Y',0,TO_TIMESTAMP('2012-11-01 12:11:25','YYYY-MM-DD HH24:MI:SS'),0,'Y',TO_TIMESTAMP('2012-11-01 12:11:25','YYYY-MM-DD HH24:MI:SS'),0,0,0,'N')
;
-- Nov 1, 2012 12:11:28 PM COT
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Column_Trl_UU ) 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,Generate_UUID() FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200862 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)
;
-- Nov 1, 2012 2:26:31 PM COT
INSERT INTO AD_Field (NumLines,AD_Field_UU,SortNo,IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,EntityType,Name,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,AD_Client_ID,CreatedBy,Updated,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (1,'222ea356-f257-413d-9724-c2b59077b94f',0,'N',107,0,'N','N',200862,305,'Y',200771,'N','D','Quick Entry','Y','N',0,0,TO_TIMESTAMP('2012-11-01 14:26:30','YYYY-MM-DD HH24:MI:SS'),0,0,TO_TIMESTAMP('2012-11-01 14:26:30','YYYY-MM-DD HH24:MI:SS'),'Y','Y',305,2,1)
;
-- Nov 1, 2012 2:27:37 PM COT
ALTER TABLE AD_Field ADD COLUMN IsQuickEntry CHAR(1) DEFAULT 'N' CHECK (IsQuickEntry IN ('Y','N')) NOT NULL
;
-- Nov 1, 2012 2:28:01 PM COT
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Field_Trl_UU ) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=200772 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- Nov 1, 2012 2:50:40 PM COT
UPDATE AD_Field SET IsQuickEntry='Y',Updated=TO_TIMESTAMP('2012-11-01 14:50:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=2156
;
-- Nov 1, 2012 2:51:33 PM COT
UPDATE AD_Field SET IsQuickEntry='Y',Updated=TO_TIMESTAMP('2012-11-01 14:51:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=3261
;
-- Nov 1, 2012 2:52:09 PM COT
UPDATE AD_Field SET IsQuickEntry='Y',Updated=TO_TIMESTAMP('2012-11-01 14:52:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=2145
;
-- Nov 1, 2012 2:52:20 PM COT
UPDATE AD_Field SET IsQuickEntry='Y',Updated=TO_TIMESTAMP('2012-11-01 14:52:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=3228
;
-- Nov 1, 2012 3:10:08 PM COT
UPDATE AD_Field SET IsQuickEntry='Y',Updated=TO_TIMESTAMP('2012-11-01 15:10:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=7010
;
-- Nov 1, 2012 3:11:02 PM COT
UPDATE AD_Field SET IsQuickEntry='Y',Updated=TO_TIMESTAMP('2012-11-01 15:11:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=7020
;
-- Nov 1, 2012 3:12:08 PM COT
UPDATE AD_Field SET IsQuickEntry='Y',Updated=TO_TIMESTAMP('2012-11-01 15:12:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=7028
;
-- Nov 1, 2012 3:12:51 PM COT
UPDATE AD_Field SET IsQuickEntry='Y',Updated=TO_TIMESTAMP('2012-11-01 15:12:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=7017
;
-- Nov 1, 2012 3:13:38 PM COT
UPDATE AD_Field SET IsQuickEntry='Y',Updated=TO_TIMESTAMP('2012-11-01 15:13:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=7024
;
-- Nov 1, 2012 3:13:49 PM COT
UPDATE AD_Field SET IsQuickEntry='Y',Updated=TO_TIMESTAMP('2012-11-01 15:13:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=7021
;
-- Nov 1, 2012 3:14:07 PM COT
UPDATE AD_Field SET IsQuickEntry='Y',Updated=TO_TIMESTAMP('2012-11-01 15:14:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=7025
;
-- Nov 1, 2012 3:16:56 PM COT
UPDATE AD_Field SET IsQuickEntry='Y',Updated=TO_TIMESTAMP('2012-11-01 15:16:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=2185
;
-- Nov 2, 2012 3:39:54 PM COT
UPDATE AD_Field SET DisplayLogic='@AD_Tab_ID@=220 || @AD_Tab_ID@=496 || @AD_Tab_ID@=222',Updated=TO_TIMESTAMP('2012-11-02 15:39:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=200772
;
-- Nov 9, 2012 9:25:56 PM COT
UPDATE AD_Column SET Callout='org.adempiere.model.CalloutBPartnerLocation.formatPhone;org.adempiere.model.CalloutBPartnerLocation.quickEntryMandatory',Updated=TO_TIMESTAMP('2012-11-09 21:25:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2959
;
SELECT register_migration_script('201211091853_IDEMPIERE-498.sql') FROM dual
;

View File

@ -0,0 +1,63 @@
-- Nov 7, 2012 2:27:45 PM COT
-- IDEMPIERE-457
INSERT INTO AD_Form (AccessLevel,Classname,AD_Form_ID,IsBetaFunctionality,EntityType,AD_Form_UU,Name,AD_Org_ID,UpdatedBy,CreatedBy,Updated,Created,AD_Client_ID,IsActive) VALUES ('4','org.compiere.apps.form.VTabEditor',200005,'N','D','4f5be293-6016-4bb5-9a7f-114018d1f1b7','Tab Editor',0,100,100,TO_TIMESTAMP('2012-11-07 14:27:44','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2012-11-07 14:27:44','YYYY-MM-DD HH24:MI:SS'),0,'Y')
;
-- Nov 7, 2012 2:27:45 PM COT
-- IDEMPIERE-457
INSERT INTO AD_Form_Trl (AD_Language,AD_Form_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Form_Trl_UU ) SELECT l.AD_Language,t.AD_Form_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Form t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Form_ID=200005 AND NOT EXISTS (SELECT * FROM AD_Form_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Form_ID=t.AD_Form_ID)
;
-- Nov 7, 2012 2:28:05 PM COT
-- IDEMPIERE-457
INSERT INTO AD_Process (CopyFromProcess,AD_Process_ID,IsDirectPrint,IsReport,AD_Process_UU,AccessLevel,IsBetaFunctionality,IsServerProcess,Statistic_Seconds,Statistic_Count,ShowHelp,EntityType,AD_Form_ID,Name,Value,AD_Org_ID,AD_Client_ID,Updated,UpdatedBy,Created,IsActive,CreatedBy) VALUES ('N',200015,'N','N','0649c86f-a16d-427b-99d3-ee13408ff5c2','4','N','N',0,0,'Y','D',200005,'Tab Editor','TabEditor',0,0,TO_TIMESTAMP('2012-11-07 14:28:04','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2012-11-07 14:28:04','YYYY-MM-DD HH24:MI:SS'),'Y',100)
;
-- Nov 7, 2012 2:28:05 PM COT
-- IDEMPIERE-457
INSERT INTO AD_Process_Trl (AD_Language,AD_Process_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Process_Trl_UU ) SELECT l.AD_Language,t.AD_Process_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Process t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_ID=200015 AND NOT EXISTS (SELECT * FROM AD_Process_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_ID=t.AD_Process_ID)
;
-- Nov 7, 2012 2:28:21 PM COT
-- IDEMPIERE-457
INSERT INTO AD_ToolBarButton ("action",AD_Tab_ID,AD_Process_ID,SeqNo,IsCustomization,Name,ComponentName,AD_Client_ID,AD_Org_ID,Created,CreatedBy,AD_ToolBarButton_ID,Updated,UpdatedBy,IsActive,AD_ToolBarButton_UU) VALUES ('W',106,200015,10,'N','Tab Editor','TabEditor',0,0,TO_TIMESTAMP('2012-11-07 14:28:20','YYYY-MM-DD HH24:MI:SS'),100,200068,TO_TIMESTAMP('2012-11-07 14:28:20','YYYY-MM-DD HH24:MI:SS'),100,'Y','ec63158f-8f95-4b24-a1ce-3caf0e1e738d')
;
-- Nov 7, 2012 2:29:45 PM COT
-- IDEMPIERE-457
UPDATE AD_ToolBarButton SET DisplayLogic='@IsSortTab@=N',Updated=TO_TIMESTAMP('2012-11-07 14:29:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_ToolBarButton_ID=200068
;
-- Nov 12, 2012 6:03:28 PM COT
-- IDEMPIERE-457 Tab Editor (to ease positioning of fields)
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Property',200112,'D','8fefc045-b3aa-4bcf-a4ca-4db079842a67','Property','Y',TO_TIMESTAMP('2012-11-12 18:03:27','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-11-12 18:03:27','YYYY-MM-DD HH24:MI:SS'))
;
-- Nov 12, 2012 6:03:29 PM COT
-- IDEMPIERE-457 Tab Editor (to ease positioning of fields)
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200112 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Nov 12, 2012 6:03:53 PM COT
-- IDEMPIERE-457 Tab Editor (to ease positioning of fields)
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Visible Fields',200113,'D','fbf72d95-345c-4506-a8fc-cb275c885cdd','VisibleFields','Y',TO_TIMESTAMP('2012-11-12 18:03:53','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-11-12 18:03:53','YYYY-MM-DD HH24:MI:SS'))
;
-- Nov 12, 2012 6:03:53 PM COT
-- IDEMPIERE-457 Tab Editor (to ease positioning of fields)
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200113 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Nov 12, 2012 6:04:15 PM COT
-- IDEMPIERE-457 Tab Editor (to ease positioning of fields)
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Non Visible Fields',200114,'D','1e160a14-8b90-45c1-8a12-db2f9531add2','NonVisibleFields','Y',TO_TIMESTAMP('2012-11-12 18:04:14','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-11-12 18:04:14','YYYY-MM-DD HH24:MI:SS'))
;
-- Nov 12, 2012 6:04:15 PM COT
-- IDEMPIERE-457 Tab Editor (to ease positioning of fields)
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200114 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
SELECT register_migration_script('201211121807_IDEMPIERE-457.sql') FROM dual
;

View File

@ -25,6 +25,7 @@ import org.compiere.model.MBPartnerLocation;
import org.compiere.model.MColumn;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.Msg;
/**
* BPartnerLocation Callouts.
@ -81,5 +82,18 @@ public class CalloutBPartnerLocation extends CalloutEngine
return "";
} // formatPhone
public String quickEntryMandatory (Properties ctx, int WindowNo,
GridTab mTab, GridField mField, Object value, Object oldValue)
{
// this callout is just for quick entry window
if ("Y".equals(Env.getContext(ctx, WindowNo, "_QUICK_ENTRY_MODE_"))) {
if (value == null) {
return Msg.getMsg(ctx, "FillMandatory") + " " + Msg.getElement(ctx, mField.getColumnName());
}
}
return "";
}
} // CalloutBPartnerLocation

View File

@ -983,19 +983,7 @@ public class GridTable extends AbstractTableModel
return null;
}
// need to wait for data read into buffer
int loops = 0;
while (row >= m_sort.size() && m_loaderFuture != null && !m_loaderFuture.isDone() && loops < 15)
{
log.fine("Waiting for loader row=" + row + ", size=" + m_sort.size());
try
{
Thread.sleep(500); // 1/2 second
}
catch (InterruptedException ie)
{}
loops++;
}
waitLoadm_sort(row);
// empty buffer
if (row >= m_sort.size())
@ -1015,6 +1003,22 @@ public class GridTable extends AbstractTableModel
return rowData[col];
} // getValueAt
private void waitLoadm_sort(int row) {
// need to wait for data read into buffer
int loops = 0;
while (row >= m_sort.size() && m_loaderFuture != null && !m_loaderFuture.isDone() && loops < 15)
{
log.fine("Waiting for loader row=" + row + ", size=" + m_sort.size());
try
{
Thread.sleep(500); // 1/2 second
}
catch (InterruptedException ie)
{}
loops++;
}
}
private Object[] getDataAtRow(int row)
{
return getDataAtRow(row, true);
@ -1022,6 +1026,7 @@ public class GridTable extends AbstractTableModel
private Object[] getDataAtRow(int row, boolean fetchIfNotFound)
{
waitLoadm_sort(row);
MSort sort = (MSort)m_sort.get(row);
Object[] rowData = null;
if (m_virtual)
@ -2754,7 +2759,6 @@ public class GridTable extends AbstractTableModel
if (row < 0 || m_sort.size() == 0 || m_inserting)
return;
MSort sort = (MSort)m_sort.get(row);
Object[] rowData = getDataAtRow(row);
// ignore
@ -2765,7 +2769,6 @@ public class GridTable extends AbstractTableModel
if (where == null || where.length() == 0)
where = "1=2";
String sql = m_SQL_Select + " WHERE " + where;
sort = (MSort)m_sort.get(row);
Object[] rowDataDB = null;
PreparedStatement pstmt = null;
ResultSet rs = null;

View File

@ -426,6 +426,15 @@ public interface I_AD_Field
*/
public String getIsMandatory();
/** Column name IsQuickEntry */
public static final String COLUMNNAME_IsQuickEntry = "IsQuickEntry";
/** Set Quick Entry */
public void setIsQuickEntry (boolean IsQuickEntry);
/** Get Quick Entry */
public boolean isQuickEntry();
/** Column name IsReadOnly */
public static final String COLUMNNAME_IsReadOnly = "IsReadOnly";

View File

@ -49,17 +49,9 @@ public class MDashboardPreference extends X_PA_DashboardPreference
{
Properties ctx = Env.getCtx();
StringBuilder whereClause = new StringBuilder(COLUMNNAME_IsShowInDashboard).append("=?");
if (AD_Role_ID == 0)
whereClause.append(" AND (").append(COLUMNNAME_AD_Role_ID).append(" IS NULL OR ").append(COLUMNNAME_AD_Role_ID).append("=?)");
else
whereClause.append(" AND ").append(COLUMNNAME_AD_Role_ID).append("=?");
if (AD_User_ID == 0)
whereClause.append(" AND (").append(COLUMNNAME_AD_User_ID).append(" IS NULL OR ").append(COLUMNNAME_AD_User_ID).append("=?)");
else
whereClause.append(" AND ").append(COLUMNNAME_AD_User_ID).append("=?");
StringBuilder whereClause = new StringBuilder(COLUMNNAME_IsShowInDashboard).append("=?")
.append(" AND ").append(COLUMNNAME_AD_Role_ID).append("=?")
.append(" AND ").append(COLUMNNAME_AD_User_ID).append("=?");
List<Object> parameters = new ArrayList<Object>();
parameters.add(isShowInDashboard);
@ -83,17 +75,9 @@ public class MDashboardPreference extends X_PA_DashboardPreference
{
Properties ctx = Env.getCtx();
StringBuilder whereClause = new StringBuilder();
if (AD_Role_ID == 0)
whereClause.append("(").append(COLUMNNAME_AD_Role_ID).append(" IS NULL OR ").append(COLUMNNAME_AD_Role_ID).append("=?)");
else
whereClause.append(COLUMNNAME_AD_Role_ID).append("=?");
if (AD_User_ID == 0)
whereClause.append(" AND (").append(COLUMNNAME_AD_User_ID).append(" IS NULL OR ").append(COLUMNNAME_AD_User_ID).append("=?)");
else
whereClause.append(" AND ").append(COLUMNNAME_AD_User_ID).append("=?");
StringBuilder whereClause = new StringBuilder()
.append(COLUMNNAME_AD_Role_ID).append("=?")
.append(" AND ").append(COLUMNNAME_AD_User_ID).append("=?");
List<Object> parameters = new ArrayList<Object>();
parameters.add(AD_Role_ID);

View File

@ -277,6 +277,7 @@ public class MLocation extends X_C_Location implements Comparator<Object>
if (region == null)
{
super.setC_Region_ID(0);
setRegionName(null);
}
else
{
@ -618,6 +619,8 @@ public class MLocation extends X_C_Location implements Comparator<Object>
getCountry();
if (!m_c.isHasRegion())
setC_Region_ID(0);
} else {
setRegionName(null);
}
if (getC_City_ID() <= 0 && getCity() != null && getCity().length() > 0) {
int city_id = DB.getSQLValue(

View File

@ -763,7 +763,7 @@ public class MUser extends X_AD_User
+ "WHERE r.IsActive='Y'"
+ " AND EXISTS (SELECT * FROM AD_User_Roles ur"
+ " WHERE r.AD_Role_ID=ur.AD_Role_ID AND ur.IsActive='Y' AND ur.AD_User_ID=?) "
+ " AND ("
+ " AND ( ( r.isaccessallorgs = 'Y' ) OR "
+ " ("
+ " r.IsUseUserOrgAccess <> 'Y'"
+ " AND EXISTS (SELECT * FROM AD_Role_OrgAccess ro"

View File

@ -39,6 +39,7 @@ public class SystemIDs
public final static int COLUMN_S_RESOURCE_S_RESOURCETYPE_ID = 6851;
public final static int COLUMN_S_RESOURCEASSIGNMENT_S_RESOURCE_ID = 6826;
public final static int COLUMN_WIZARDSTATUS = 200310;
public final static int COLUMN_AD_FIELD_AD_FIELDGROUP_ID = 5375;
public final static int COUNTRY_US = 100;
public final static int COUNTRY_JAPAN = 216;
@ -150,6 +151,8 @@ public class SystemIDs
public final static int WINDOW_WAREHOUSE_LOCATOR = 139;
public final static int WINDOW_WINDOW_TAB_FIELD = 102;
public final static int TAB_TAB = 106;
public final static int SYSCONFIG_USER_HASH_PASSWORD = 200013;
public final static int SYSCONFIG_SYSTEM_NATIVE_SEQUENCE = 50016;

View File

@ -32,7 +32,7 @@ public class X_AD_Field extends PO implements I_AD_Field, I_Persistent
/**
*
*/
private static final long serialVersionUID = 20121031L;
private static final long serialVersionUID = 20121101L;
/** Standard Constructor */
public X_AD_Field (Properties ctx, int AD_Field_ID, String trxName)
@ -52,6 +52,8 @@ public class X_AD_Field extends PO implements I_AD_Field, I_Persistent
setIsEncrypted (false);
setIsFieldOnly (false);
setIsHeading (false);
setIsQuickEntry (false);
// N
setIsReadOnly (false);
setIsSameLine (false);
setName (null);
@ -653,6 +655,27 @@ public class X_AD_Field extends PO implements I_AD_Field, I_Persistent
return (String)get_Value(COLUMNNAME_IsMandatory);
}
/** Set Quick Entry.
@param IsQuickEntry Quick Entry */
public void setIsQuickEntry (boolean IsQuickEntry)
{
set_Value (COLUMNNAME_IsQuickEntry, Boolean.valueOf(IsQuickEntry));
}
/** Get Quick Entry.
@return Quick Entry */
public boolean isQuickEntry ()
{
Object oo = get_Value(COLUMNNAME_IsQuickEntry);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Read Only.
@param IsReadOnly
Field is read only

View File

@ -663,7 +663,8 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable
if (user.equals(oldUser))
{
log.info("Loop - " + user.getName());
return -1;
user=null;
break;
}
oldUser = user;
log.fine("User=" + user.getName());
@ -749,7 +750,7 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable
ownDocument = false;
} // while there is a user to approve
log.fine("No user found");
log.fine("No user found");
return -1;
} // getApproval
@ -914,7 +915,7 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable
if (processMsg == null || processMsg.length() == 0)
processMsg = e.getMessage();
setTextMsg(processMsg);
addTextMsg(e);
// addTextMsg(e); // do not add the exception text
setWFState (StateEngine.STATE_Terminated); // unlocks
// Set Document Status
if (m_po != null && m_po instanceof DocAction && m_docStatus != null)
@ -1160,6 +1161,10 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable
doc.getC_Currency_ID(), doc.getApprovalAmt(),
doc.getAD_Org_ID(),
startAD_User_ID == doc.getDoc_User_ID()); // own doc
if (nextAD_User_ID<=0) {
m_docStatus = DocAction.STATUS_Invalid;
throw new AdempiereException(Msg.getMsg(getCtx(), "NoApprover"));
}
// same user = approved
autoApproval = startAD_User_ID == nextAD_User_ID;
if (!autoApproval)
@ -1346,7 +1351,7 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable
if (nextAD_User_ID <= 0)
{
newState = StateEngine.STATE_Aborted;
setTextMsg ("Cannot Approve - No Approver");
setTextMsg (Msg.getMsg(getCtx(), "NoApprover"));
doc.processIt (DocAction.ACTION_Reject);
}
else if (startAD_User_ID != nextAD_User_ID)

View File

@ -18,6 +18,7 @@ package org.adempiere.pipo2.handler;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.logging.Level;
@ -47,36 +48,38 @@ public class SQLStatementElementHandler extends AbstractElementHandler {
sql = sql.substring(0, sql.length() - 1);
PreparedStatement pstmt = null;
try {
// NOTE Postgres needs to commit DDL statements
// add a SQL command just with COMMIT if you want to simulate the Oracle behavior (commit on DDL)
// It is also recommended on postgres to add a COMMIT before any SQL statement that can fail
// for example a create index where is possible the index already exists
pstmt = DB.prepareStatement(sql, getTrxName(ctx));
if(DBType.equals("ALL")) {
if (DBType.equals("ALL")) {
int n = pstmt.executeUpdate();
log.info("Executed SQL Statement: "+ getStringValue(element, "statement") + " ReturnValue="+n);
}
else if(DB.isOracle() == true && DBType.equals("Oracle")) {
} else if (DB.isOracle() == true && DBType.equals("Oracle")) {
int n = pstmt.executeUpdate();
log.info("Executed SQL Statement for Oracle: "+ getStringValue(element, "statement") + " ReturnValue="+n);
}
else if ( DB.isPostgreSQL()
} else if (DB.isPostgreSQL()
&& ( DBType.equals("Postgres")
|| DBType.equals("PostgreSQL") // backward compatibility with old packages developed by hand
)
) {
// Avoid convert layer - command specific for postgresql
//
// pstmt = DB.prepareStatement(sql, null);
// pstmt = DB.prepareStatement(sql, getTrxName(ctx));
// pstmt.executeUpdate();
//
Connection m_con = DB.getConnectionRW(true);
Statement stmt = null;
try {
Statement stmt = m_con.createStatement();
stmt = pstmt.getConnection().createStatement();
int n = stmt.executeUpdate (sql);
log.info("Executed SQL Statement for PostgreSQL: "+ getStringValue(element,"statement") + " ReturnValue="+n);
// Postgres needs to commit DDL statements
if (m_con != null && !m_con.getAutoCommit())
m_con.commit();
stmt.close();
} finally {
m_con.close();
if (stmt != null)
stmt.close();
}
}
@ -84,6 +87,18 @@ public class SQLStatementElementHandler extends AbstractElementHandler {
0);
logImportDetail (ctx, impDetail, 1, "SQLStatement",1,"Execute");
} catch (Exception e) {
if (DB.isPostgreSQL()) {
// rollback immediately postgres on exception to avoid a wrong SQL stop the whole process
if (pstmt != null) {
Connection m_con = null;
try {
m_con = pstmt.getConnection();
if (m_con != null && !m_con.getAutoCommit())
m_con.rollback();
} catch (SQLException ex) {
}
}
}
log.log(Level.SEVERE,"SQLSatement", e);
X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, "",
0);

View File

@ -0,0 +1,818 @@
/******************************************************************************
* Copyright (C) 2012 Trek Global *
* Product: iDempiere ERP & CRM Smart Business Solution *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.adempiere.webui.apps.form;
import static org.compiere.model.SystemIDs.COLUMN_AD_FIELD_AD_FIELDGROUP_ID;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.logging.Level;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.component.Column;
import org.adempiere.webui.component.ConfirmPanel;
import org.adempiere.webui.component.EditorBox;
import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.Group;
import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.ListHead;
import org.adempiere.webui.component.ListHeader;
import org.adempiere.webui.component.ListItem;
import org.adempiere.webui.component.Listbox;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.editor.WEditor;
import org.adempiere.webui.editor.WImageEditor;
import org.adempiere.webui.editor.WNumberEditor;
import org.adempiere.webui.editor.WStringEditor;
import org.adempiere.webui.editor.WTableDirEditor;
import org.adempiere.webui.editor.WYesNoEditor;
import org.adempiere.webui.editor.WebEditorFactory;
import org.adempiere.webui.event.ValueChangeEvent;
import org.adempiere.webui.event.ValueChangeListener;
import org.adempiere.webui.panel.ADForm;
import org.adempiere.webui.panel.IFormController;
import org.adempiere.webui.panel.WTabEditorForm;
import org.adempiere.webui.session.SessionManager;
import org.compiere.apps.form.TabEditor;
import org.compiere.model.GridField;
import org.compiere.model.MField;
import org.compiere.model.MLookup;
import org.compiere.model.MLookupFactory;
import org.compiere.model.X_AD_FieldGroup;
import org.compiere.util.DB;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
import org.compiere.util.Util;
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.zk.ui.event.MouseEvent;
import org.zkoss.zul.Borderlayout;
import org.zkoss.zul.Cell;
import org.zkoss.zul.Center;
import org.zkoss.zul.Columns;
import org.zkoss.zul.Div;
import org.zkoss.zul.East;
import org.zkoss.zul.Listitem;
import org.zkoss.zul.Separator;
import org.zkoss.zul.Space;
import org.zkoss.zul.Vlayout;
import org.zkoss.zul.West;
/**
*
* @author Juan David Arboleda
* @author Carlos Ruiz
*
*/
public class WTabEditor extends TabEditor implements IFormController, EventListener, ValueChangeListener
{
// TODO: create messages Property, VisibleFields, NonVisibleField
private WTabEditorForm tabform =null;
private Borderlayout mainLayout = new Borderlayout();
/** Window No */
public int m_WindowNo = 0;
private Label displayedLabel = new Label();
private Label nodisplayedLabel = new Label();
private ConfirmPanel confirmPanel = new ConfirmPanel(true);
WEditor editorName = null;
WEditor editorAD_FieldGroup_ID = null;
WEditor editorIsDisplayed = null;
WEditor editorSeqNo = null;
WEditor editorXPosition = null;
WEditor editorColumnSpan = null;
WEditor editorNumLines = null;
private Listbox visible = new Listbox();
private Listbox invisible = new Listbox();
// The grid components
Group currentGroup;
ArrayList<Row> rowList;
Map<Cell, GridField> mapCellField = new HashMap<Cell, GridField>();
Map<Cell, Integer> mapEmptyCellField = new HashMap<Cell, Integer>();
Grid form;
Vlayout centerVLayout;
Vlayout westVLayout ;
public WTabEditor()
{
tabform = new WTabEditorForm(this);
}
public void initForm() {
try
{
initMFields(tabform.getWindowNo(), tabform.getProcessInfo().getRecord_ID());
dynList();
jbInit();
LayoutUtils.sendDeferLayoutEvent(mainLayout, 100);
}
catch (Exception ex)
{
log.log(Level.SEVERE, "WTabEditor.preInit", ex);
}
}
/**
* Initialize List of visible and non visible Fields
*/
private void dynList()
{
visible.addEventListener(Events.ON_SELECT, this);
visible.setVflex("70");
visible.setItemDraggable(true);
visible.setDroppable("true");
visible.addOnDropListener(this);
invisible.addEventListener(Events.ON_SELECT, this);
invisible.setVflex("30");
invisible.setItemDraggable(true);
invisible.setDroppable("true");
invisible.addOnDropListener(this);
updateLists(null);
} // dynList
/**
* Initialize Tab panel editor
* Same createUI algorithm used on ADTabPanel
*/
private void createUI() {
mapCellField.clear();
mapEmptyCellField.clear();
currentGroup = null;
rowList = null;
form = new Grid();
form.makeNoStrip();
form.setHflex("1");
form.setHeight(null);
form.setVflex(false);
int numCols = getMaxColumns(getMTab().getAD_Tab_ID());
if (numCols <= 0) {
numCols=4;
}
// set size in percentage per column leaving a MARGIN on right
Columns columns = new Columns();
form.appendChild(columns);
String numColsS=String.valueOf(numCols);
int equalWidth = 98 / numCols;
for (int h=0;h<numCols;h++){
Column col = new Column();
col.setWidth(equalWidth + "%");
columns.appendChild(col);
}
Rows rows = form.newRows();
Row row = new Row();
int actualxpos = 0;
String currentFieldGroup = null;
for (GridField gridField : getGridFields())
{
MField field = getMField(gridField.getAD_Field_ID());
if (!gridField.isDisplayed())
continue;
if (gridField.isToolbarButton()) {
continue;
}
// field group
String fieldGroup = gridField.getFieldGroup();
if (!Util.isEmpty(fieldGroup) && !fieldGroup.equals(currentFieldGroup)) // group changed
{
currentFieldGroup = fieldGroup;
if (numCols - actualxpos + 1 > 0) {
row.appendCellChild(createSpacer(), numCols - actualxpos + 1);
setLastCellProps(row.getLastCell(), actualxpos, field.getSeqNo());
}
row.setGroup(currentGroup);
rows.appendChild(row);
if (rowList != null)
rowList.add(row);
rowList = new ArrayList<Row>();
if (X_AD_FieldGroup.FIELDGROUPTYPE_Label.equals(gridField.getFieldGroupType()))
{
row = new Row();
Label groupLabel = new Label(fieldGroup);
row.appendCellChild(groupLabel, numCols);
rows.appendChild(row);
row = new Row();
Separator separator = new Separator();
separator.setBar(true);
row.appendCellChild(separator, numCols);
rows.appendChild(row);
currentGroup = null;
}
else
{
Group rowg = new Group(fieldGroup);
rowg.setSpans(numColsS);
if (X_AD_FieldGroup.FIELDGROUPTYPE_Tab.equals(gridField.getFieldGroupType()) || gridField.getIsCollapsedByDefault())
{
rowg.setOpen(false);
}
currentGroup = rowg;
rows.appendChild(rowg);
}
row = new Row();
actualxpos = 0;
}
//normal field
if (gridField.getXPosition() <= actualxpos) {
// Fill right part of the row with spacers until number of columns
if (numCols - actualxpos + 1 > 0) {
row.appendCellChild(createSpacer(), numCols - actualxpos + 1);
setLastCellProps(row.getLastCell(), actualxpos, field.getSeqNo());
}
row.setGroup(currentGroup);
rows.appendChild(row);
if (rowList != null)
rowList.add(row);
row=new Row();
actualxpos = 0;
}
// Fill left part of the field
if (gridField.getXPosition()-1 - actualxpos > 0) {
row.appendCellChild(createSpacer(), gridField.getXPosition()-1 - actualxpos);
setLastCellProps(row.getLastCell(), actualxpos, field.getSeqNo());
}
boolean paintLabel = ! (gridField.getDisplayType() == DisplayType.Button || gridField.getDisplayType() == DisplayType.YesNo || gridField.isFieldOnly());
if (gridField.isHeading())
actualxpos = gridField.getXPosition();
else
actualxpos = gridField.getXPosition() + gridField.getColumnSpan()-1 + (paintLabel ? 1 : 0);
if (! gridField.isHeading()) {
WEditor editor = WebEditorFactory.getEditor(null, gridField, false);
if (editor != null) // Not heading
{
editor.setReadWrite(true);
if (editor.getComponent() instanceof EditorBox) {
// disable button on URL editor
EditorBox editorbox = (EditorBox) editor.getComponent();
editorbox.getButton().setDisabled(true);
} else if (editor instanceof WImageEditor) {
// disable button on Image editor
editor.setReadWrite(false);
}
if (paintLabel) {
Div div = new Div();
div.setAlign("right");
Label label = editor.getLabel();
div.appendChild(label);
if (label.getDecorator() != null)
div.appendChild(label.getDecorator());
row.appendCellChild(div,1);
setLastCellProps(row.getLastCell(), gridField);
}
row.appendCellChild(editor.getComponent(), gridField.getColumnSpan());
setLastCellProps(row.getLastCell(), gridField);
//stretch component to fill grid cell
editor.fillHorizontal();
}
}
else // just heading
{
//display just a label if we are "heading only"
Label label = new Label(gridField.getHeader());
Div div = new Div();
div.setAlign("center");
row.appendCellChild(createSpacer());
div.appendChild(label);
row.appendCellChild(div);
setLastCellProps(row.getLastCell(), gridField);
}
}
if (numCols - actualxpos + 1 > 0)
row.appendCellChild(createSpacer(), numCols - actualxpos + 1);
row.setGroup(currentGroup);
rows.appendChild(row);
if (rowList != null)
rowList.add(row);
}
private void setLastCellProps(Cell lastCell, GridField field) {
lastCell.setDraggable("true");
lastCell.setDroppable("true");
lastCell.addEventListener(Events.ON_DROP, this);
lastCell.addEventListener(Events.ON_CLICK, this);
lastCell.addEventListener(Events.ON_DOUBLE_CLICK, this);
mapCellField.put(lastCell, field);
}
private void setLastCellProps(Cell lastCell, int actualxpos, int seqNo) {
lastCell.setDroppable("true");
lastCell.addEventListener(Events.ON_DROP, this);
int value = (actualxpos+1) * 10000000 + seqNo;
mapEmptyCellField.put(lastCell, value);
}
private Component createSpacer() {
return new Space();
}
private int getMaxColumns(int ad_Tab_ID) {
int col=0;
String sql="SELECT MAX(f.XPosition+f.ColumnSpan-case when f.isfieldonly='Y' OR c.ad_reference_id in (20/*yesno*/,28/*button*/) then 1 else 0 end)"
+" FROM AD_Field f JOIN AD_Column c ON (f.AD_Column_ID=c.AD_Column_ID)"
+" WHERE f.isdisplayed='Y' AND f.isactive='Y' AND c.isactive='Y' AND f.AD_Tab_ID=?";
col = DB.getSQLValue(null, sql, ad_Tab_ID);
return col;
}
/**
* Initialize Grid of Field's Properties
* return @Grid
*/
private Grid createPropertiesGrid()
{
Grid gridView = new Grid();
//
Columns columns = new Columns();
gridView.appendChild(columns);
//
Column column = new Column();
columns.appendChild(column);
column.setLabel(Msg.getMsg(Env.getCtx(), "Property"));
column.setWidth("30%");
column.setAlign("right");
column = new Column();
columns.appendChild(column);
column.setWidth("70%");
Rows rows = new Rows();
gridView.appendChild(rows);
Row row = null;
row = new Row();
Label labelName = new Label(Msg.getElement(Env.getCtx(), MField.COLUMNNAME_Name));
editorName = new WStringEditor(MField.COLUMNNAME_Name, false, true, false, 0, 0, null, null);
((WStringEditor) editorName).getComponent().setCols(30);
row.appendChild(labelName.rightAlign());
row.appendChild(editorName.getComponent());
// editorName.addValueChangeListener(this);
rows.appendChild(row);
row = new Row();
Label labelIsDisplayed = new Label(Msg.getElement(Env.getCtx(), MField.COLUMNNAME_IsDisplayed));
editorIsDisplayed = new WYesNoEditor(MField.COLUMNNAME_IsDisplayed, "", labelIsDisplayed.getValue(), false, true, false);
row.appendChild(labelIsDisplayed.rightAlign());
row.appendChild(editorIsDisplayed.getComponent());
// editorIsDisplayed.addValueChangeListener(this);
rows.appendChild(row);
row = new Row();
Label labelSeqNo = new Label(Msg.getElement(Env.getCtx(), MField.COLUMNNAME_SeqNo));
editorSeqNo = new WNumberEditor(MField.COLUMNNAME_SeqNo, false, true, false, DisplayType.Integer, labelSeqNo.getValue());
row.appendChild(labelSeqNo.rightAlign());
row.appendChild(editorSeqNo.getComponent());
// editorSeqNo.addValueChangeListener(this);
rows.appendChild(row);
row = new Row();
Label labelAD_FieldGroup_ID = new Label(Msg.getElement(Env.getCtx(), MField.COLUMNNAME_AD_FieldGroup_ID));
MLookup lookup = MLookupFactory.get (Env.getCtx(), tabform.getWindowNo(), 0, COLUMN_AD_FIELD_AD_FIELDGROUP_ID, DisplayType.TableDir);
editorAD_FieldGroup_ID = new WTableDirEditor(MField.COLUMNNAME_AD_FieldGroup_ID, false, false, true, lookup);
row.appendChild(labelAD_FieldGroup_ID.rightAlign());
row.appendChild(editorAD_FieldGroup_ID.getComponent());
editorAD_FieldGroup_ID.addValueChangeListener(this);
rows.appendChild(row);
row = new Row();
Label labelXPosition = new Label(Msg.getElement(Env.getCtx(), MField.COLUMNNAME_XPosition));
editorXPosition = new WNumberEditor(MField.COLUMNNAME_XPosition, true, false, true, DisplayType.Integer, labelXPosition.getValue());
row.appendChild(labelXPosition.rightAlign());
row.appendChild(editorXPosition.getComponent());
editorXPosition.addValueChangeListener(this);
rows.appendChild(row);
row = new Row();
Label labelColumnSpan = new Label(Msg.getElement(Env.getCtx(), MField.COLUMNNAME_ColumnSpan));
editorColumnSpan = new WNumberEditor(MField.COLUMNNAME_ColumnSpan, true, false, true, DisplayType.Integer, labelColumnSpan.getValue());
row.appendChild(labelColumnSpan.rightAlign());
row.appendChild(editorColumnSpan.getComponent());
editorColumnSpan.addValueChangeListener(this);
rows.appendChild(row);
row = new Row();
Label labelNumLines = new Label(Msg.getElement(Env.getCtx(), MField.COLUMNNAME_NumLines));
editorNumLines = new WNumberEditor(MField.COLUMNNAME_NumLines, true, false, true, DisplayType.Integer, labelNumLines.getValue());
row.appendChild(labelNumLines.rightAlign());
row.appendChild(editorNumLines.getComponent());
editorNumLines.addValueChangeListener(this);
rows.appendChild(row);
return gridView;
}
/**
* Static init
* @throws Exception
*/
private void jbInit() throws Exception
{
tabform.setSizable(true);
tabform.setClosable(true);
tabform.setMaximizable(true);
tabform.setWidth("95%");
tabform.setHeight("95%");
tabform.appendChild (mainLayout);
tabform.setBorder("normal");
confirmPanel.addActionListener(Events.ON_CLICK, this);
Grid propGrid = createPropertiesGrid();
Vlayout eastVLayout = new Vlayout();
eastVLayout.appendChild(propGrid);
Separator esep = new Separator("horizontal");
esep.setSpacing("10px");
eastVLayout.appendChild(esep);
eastVLayout.appendChild(confirmPanel);
East east = new East();
mainLayout.appendChild(east);
east.appendChild(eastVLayout);
east.setWidth("320px");
ListHead visibleHead = new ListHead();
visibleHead.setParent(visible);
ListHeader visibleHeader = new ListHeader();
displayedLabel.setText(Msg.getMsg(Env.getCtx(), "VisibleFields"));
visibleHeader.appendChild(displayedLabel);
visibleHeader.setParent(visibleHead);
ListHead invisibleHead = new ListHead();
invisibleHead.setParent(invisible);
ListHeader invisibleHeader = new ListHeader();
nodisplayedLabel.setText(Msg.getMsg(Env.getCtx(), "NonVisibleFields"));
invisibleHeader.appendChild(nodisplayedLabel);
invisibleHeader.setParent(invisibleHead);
westVLayout = new Vlayout();
westVLayout.setHeight("100%");
westVLayout.appendChild(visible);
Separator wsep = new Separator("horizontal");
westVLayout.appendChild(wsep);
westVLayout.appendChild(invisible);
createUI();
centerVLayout = new Vlayout();
centerVLayout.setHeight("100%");
centerVLayout.appendChild(form);
centerVLayout.setStyle("overflow:auto");
Center center = new Center();
mainLayout.appendChild(center);
center.appendChild(centerVLayout);
West west = new West();
mainLayout.appendChild(west);
west.appendChild(westVLayout);
west.setCollapsible(true);
west.setSplittable(true);
west.setWidth("200px");
} // jbInit
/**
* Dispose
*/
public void dispose()
{
SessionManager.getAppDesktop().closeActiveWindow();
} // dispose
/**
* Action Listener
* @param e event
*/
public void onEvent (Event e) throws Exception
{
// select an item within the list -- set it active and show the properties
if (Events.ON_SELECT.equals(e.getName()) && e.getTarget() instanceof Listbox) {
Listbox list = (Listbox) e.getTarget();
if (list.getSelectedItem() != null) {
int fieldid = list.getSelectedItem().getValue();
MField field = getMField(fieldid);
if (field != null) {
setActiveMField(field);
setBackgroundField(field);
setProperties(field);
}
}
}
// Check event ONCLICK on a cell -- set it active and show the properties
else if (Events.ON_CLICK.equals(e.getName()) && (e.getTarget() instanceof Cell)) {
GridField gridField = mapCellField.get(e.getTarget());
if (gridField != null) {
MField field = getMField(gridField.getAD_Field_ID());
if (field != null) {
setActiveMField(field);
setBackgroundField(field);
setProperties(field);
}
// select the field on the visible list and set focus
for (Listitem item : visible.getItems()) {
if (field.getAD_Field_ID() == (Integer) item.getValue()) {
visible.setSelectedItem(item);
}
}
}
}
else if (Events.ON_DOUBLE_CLICK.equals(e.getName()) && (e.getTarget() instanceof Cell)) {
MouseEvent me = (MouseEvent) e;
// by default expand column span by 1 on double click
int mult = 1;
if ((me.getKeys() & MouseEvent.CTRL_KEY) > 0) {
// control key pressed - shrink
mult = -1;
}
GridField gridField = mapCellField.get(e.getTarget());
if (gridField != null) {
MField field = getMField(gridField.getAD_Field_ID());
if (mult == -1 && field.getColumnSpan() <= 1) {
// shrinking when colspan = 1 is not valid
} else {
field.setColumnSpan(field.getColumnSpan()+mult);
}
setProperties(field);
resortArrays();
setProperties(field); // seqno could change
updateLists(field);
repaintGrid();
if (field != null) {
setActiveMField(field);
setBackgroundField(field);
setProperties(field);
}
// select the field on the visible list and set focus
for (Listitem item : visible.getItems()) {
if (field.getAD_Field_ID() == (Integer) item.getValue()) {
visible.setSelectedItem(item);
}
}
}
}
else if (e instanceof DropEvent ) {
DropEvent me = (DropEvent) e;
ListItem startItem = null;
if (me.getDragged() instanceof ListItem) {
startItem = (ListItem) me.getDragged();
} else if (me.getDragged() instanceof Cell) {
startItem = getItemFromCell((Cell) me.getDragged());
}
ListItem endItem = null;
if (me.getTarget() instanceof ListItem) {
endItem = (ListItem) me.getTarget();
} else if (me.getTarget() instanceof Cell) {
endItem = getItemFromCell((Cell) me.getTarget());
if (endItem == null) {
// check empty cells
Integer posseq = mapEmptyCellField.get(me.getTarget());
if (posseq != null) {
int actualxpos = posseq / 10000000;
int seqno = posseq - (actualxpos * 10000000);
MField field = getMField((Integer) startItem.getValue());
field.setSeqNo(seqno-5);
field.setIsDisplayed(true);
field.setXPosition(actualxpos);
setProperties(field);
resortArrays();
setProperties(field); // seqno could change
updateLists(field);
repaintGrid();
setActiveMField(field);
setBackgroundField(field);
return;
}
}
}
if (startItem.getListbox() == visible && endItem.getListbox() == invisible)
{
// item moved from visible to invisible
MField field = getMField((Integer) startItem.getValue());
setActiveMField(field);
setBackgroundField(field);
field.setSeqNo(0);
field.setIsDisplayed(false);
field.setXPosition(1);
setProperties(field);
resortArrays();
setProperties(field); // seqno could change
updateLists(field);
repaintGrid();
}
else if (startItem.getListbox() == invisible && endItem.getListbox() == visible)
{
// item moved from invisible to visible
MField field = getMField((Integer) startItem.getValue());
MField fieldTo = getMField((Integer) endItem.getValue());
field.setSeqNo(fieldTo.getSeqNo()-5);
field.setIsDisplayed(true);
field.setXPosition(fieldTo.getXPosition());
setProperties(field);
resortArrays();
setProperties(field); // seqno could change
updateLists(field);
repaintGrid();
setActiveMField(field);
setBackgroundField(field);
}
else if (startItem.getListbox() == visible && endItem.getListbox() == visible)
{
// item moved from visible to visible - reorder
MField field = getMField((Integer) startItem.getValue());
MField fieldTo = getMField((Integer) endItem.getValue());
field.setSeqNo(fieldTo.getSeqNo()-5);
field.setIsDisplayed(true);
field.setXPosition(fieldTo.getXPosition());
setProperties(field);
resortArrays();
setProperties(field); // seqno could change
updateLists(field);
repaintGrid();
setActiveMField(field);
setBackgroundField(field);
}
}
else if (e.getTarget().getId().equals("Cancel"))
{
tabform.detach();
}
// OK - Save
else if (e.getTarget().getId().equals("Ok"))
{
if (cmd_save())
tabform.detach();
}
} // actionPerformed
private ListItem getItemFromCell(Cell cell) {
GridField field = mapCellField.get(cell);
if (field != null) {
for (int idx = 0; idx < visible.getItemCount(); idx++) {
ListItem item = visible.getItemAtIndex(idx);
if (item != null && field.getAD_Field_ID() == (Integer) item.getValue()) {
return item;
}
}
}
return null;
}
private void setBackgroundField(MField field) {
Iterator<Entry<Cell, GridField>> it = mapCellField.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<Cell, GridField> pairs = (Map.Entry<Cell, GridField>)it.next();
Cell cell = pairs.getKey();
GridField gridField = pairs.getValue();
if (gridField.getAD_Field_ID() == field.getAD_Field_ID()) {
cell.setStyle("background-color: #BBC2DB;");
} else {
cell.setStyle("");
}
}
}
private void setProperties(MField field) {
editorName.setValue(field.getName());
editorSeqNo.setValue(field.getSeqNo());
editorIsDisplayed.setValue(field.isDisplayed());
editorAD_FieldGroup_ID.setValue(field.getAD_FieldGroup_ID());
editorXPosition.setValue(field.getXPosition());
editorColumnSpan.setValue(field.getColumnSpan());
editorNumLines.setValue(field.getNumLines());
GridField gridField = getGridField(field);
String fieldGroup = "";
String fieldGroupType = "";
if (field.getAD_FieldGroup() != null) {
fieldGroup = field.getAD_FieldGroup().getName();
fieldGroupType = field.getAD_FieldGroup().getFieldGroupType();
}
gridField.getVO().IsDisplayed = field.isDisplayed();
gridField.getVO().FieldGroup = fieldGroup;
gridField.getVO().FieldGroupType = fieldGroupType;
gridField.getVO().XPosition = field.getXPosition();
gridField.getVO().ColumnSpan = field.getColumnSpan();
gridField.getVO().NumLines = field.getNumLines();
}
public ADForm getForm()
{
return tabform;
}
private void updateLists(MField focusField){
visible.removeAllItems();
invisible.removeAllItems();
for(MField field : getMFields())
{
if (!field.isActive())
continue;
KeyNamePair pair = new KeyNamePair(field.getAD_Field_ID(), field.getName());
if (field.isDisplayed()) {
visible.addItem(pair);
if (field == focusField)
visible.setSelectedKeyNamePair(pair);
} else {
invisible.addItem(pair);
if (field == focusField)
invisible.setSelectedKeyNamePair(pair);
}
}
}
@Override
public void valueChange(ValueChangeEvent e) {
// changed a value on the properties editors
MField field = getActiveMField();
if (field != null) {
String propertyName = e.getPropertyName();
int intvalue = 0;
if (e.getNewValue() != null)
intvalue = (Integer) e.getNewValue();
if (MField.COLUMNNAME_AD_FieldGroup_ID.equals(propertyName)) {
field.setAD_FieldGroup_ID(intvalue);
} else if (MField.COLUMNNAME_XPosition.equals(propertyName)) {
field.setXPosition(intvalue);
} else if (MField.COLUMNNAME_ColumnSpan.equals(propertyName)) {
field.setColumnSpan(intvalue);
} else if (MField.COLUMNNAME_NumLines.equals(propertyName)) {
field.setNumLines(intvalue);
}
setProperties(field);
repaintGrid();
}
}
private void repaintGrid() {
centerVLayout.removeChild(form);
if (form.getRows() != null)
form.removeChild(form.getRows());
createUI();
centerVLayout.appendChild(form);
}
} // WTabEditor

View File

@ -33,6 +33,8 @@ public class Row extends org.zkoss.zul.Row
*/
private static final long serialVersionUID = -5813452501151101553L;
private Cell m_lastCell;
public boolean appendCellChild(Component child) {
return this.appendCellChild(child, 1);
}
@ -42,6 +44,7 @@ public class Row extends org.zkoss.zul.Row
cell.setColspan(colspan);
cell.setRowspan(1);
cell.appendChild(child);
m_lastCell = cell;
return super.appendChild(cell);
}
@ -57,4 +60,8 @@ public class Row extends org.zkoss.zul.Row
m_group.add(this);
}
public Cell getLastCell() {
return m_lastCell;
}
}

View File

@ -520,16 +520,13 @@ public class DashboardController implements EventListener<Event> {
private void createDashboardPreference()
{
if (Env.getAD_User_ID(Env.getCtx()) == 0 && Env.getAD_Role_ID(Env.getCtx()) == 0)
return;
MDashboardContent[] dcs = MDashboardContent.getForSession(0, 0);
for (MDashboardContent dc : dcs)
{
MDashboardPreference preference = new MDashboardPreference(Env.getCtx(), 0, null);
preference.setAD_Org_ID(Env.getAD_Org_ID(Env.getCtx()));
preference.setAD_Role_ID(Env.getAD_Role_ID(Env.getCtx()));
preference.setAD_User_ID(Env.getAD_User_ID(Env.getCtx()));
preference.set_ValueNoCheck("AD_User_ID", Env.getAD_User_ID(Env.getCtx()));
preference.setColumnNo(dc.getColumnNo());
preference.setIsCollapsedByDefault(dc.isCollapsedByDefault());
preference.setIsShowInDashboard(dc.isShowInDashboard());

View File

@ -22,6 +22,9 @@ import java.util.ArrayList;
import org.adempiere.webui.component.Menupopup;
import org.adempiere.webui.event.ContextMenuEvent;
import org.adempiere.webui.event.ContextMenuListener;
import org.compiere.model.Lookup;
import org.compiere.model.MRole;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.Util;
@ -41,7 +44,8 @@ public class WEditorPopupMenu extends Menupopup implements EventListener<Event>
/**
*
*/
private static final long serialVersionUID = 5813878069049398656L;
private static final long serialVersionUID = 7826535512581441259L;
public static final String EVENT_ATTRIBUTE = "EVENT";
public static final String ZOOM_EVENT = "ZOOM";
public static final String REQUERY_EVENT = "REQUERY";
@ -70,20 +74,37 @@ public class WEditorPopupMenu extends Menupopup implements EventListener<Event>
public WEditorPopupMenu(boolean zoom, boolean requery, boolean preferences)
{
this(zoom, requery, preferences, false, false, false);
this(zoom, requery, preferences, false, false, false, null); // no check zoom
}
@Deprecated
public WEditorPopupMenu(boolean zoom, boolean requery, boolean preferences, boolean newRecord)
{
this(zoom, requery, preferences, newRecord, false, false);
this(zoom, requery, preferences, newRecord, false, false, null);
}
@Deprecated
public WEditorPopupMenu(boolean zoom, boolean requery, boolean preferences, boolean newRecord, boolean updateRecord)
{
this(zoom, requery, preferences, newRecord, updateRecord, false);
this(zoom, requery, preferences, newRecord, updateRecord, false, null);
}
@Deprecated
public WEditorPopupMenu(boolean zoom, boolean requery, boolean preferences, boolean newRecord, boolean updateRecord, boolean showLocation)
{
this(zoom, requery, preferences, newRecord, updateRecord, false, null);
}
/**
* @param zoom - enable zoom in menu - disabled if the lookup cannot zoom
* @param requery - enable requery in menu
* @param preferences - enable preferences in menu
* @param newRecord - enable new record (ignored and recalculated if lookup is received)
* @param updateRecord - enable update record (ignored and recalculated if lookup is received)
* @param showLocation - enable show location in menu
* @param lookup - when this parameter is received then new and update are calculated based on the zoom and quickentry
*/
public WEditorPopupMenu(boolean zoom, boolean requery, boolean preferences, boolean newRecord, boolean updateRecord, boolean showLocation, Lookup lookup)
{
super();
this.zoomEnabled = zoom;
@ -92,6 +113,33 @@ public class WEditorPopupMenu extends Menupopup implements EventListener<Event>
this.newEnabled = newRecord;
this.updateEnabled = updateRecord; // Elaine 2009/02/16 - update record
this.showLocation = showLocation;
if (lookup != null) {
int winID = lookup.getZoom();
Boolean canAccess = MRole.getDefault().getWindowAccess(winID);
if (winID <= 0 || canAccess == null || ! canAccess) {
this.zoomEnabled = false;
this.newEnabled = false;
this.updateEnabled = false;
} else {
int cnt = DB.getSQLValueEx(null,
"SELECT COUNT(*) "
+ "FROM AD_Field f "
+ " JOIN AD_Tab t "
+ " ON ( t.AD_Tab_ID = f.AD_Tab_ID ) "
+ "WHERE t.AD_Window_ID = ? "
+ " AND f.IsActive = 'Y' "
+ " AND t.IsActive = 'Y' "
+ " AND f.IsQuickEntry = 'Y' ",
winID);
if (cnt > 0) {
this.newEnabled = true;
this.updateEnabled = true;
} else {
this.newEnabled = false;
this.updateEnabled = false;
}
}
}
init();
}

View File

@ -17,6 +17,9 @@
package org.adempiere.webui.editor;
import static org.compiere.model.SystemIDs.COLUMN_C_INVOICELINE_M_PRODUCT_ID;
import static org.compiere.model.SystemIDs.COLUMN_C_INVOICE_C_BPARTNER_ID;
import java.beans.PropertyChangeEvent;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@ -32,7 +35,7 @@ import org.adempiere.webui.event.DialogEvents;
import org.adempiere.webui.event.ValueChangeEvent;
import org.adempiere.webui.event.ValueChangeListener;
import org.adempiere.webui.factory.InfoManager;
import org.adempiere.webui.grid.WBPartner;
import org.adempiere.webui.grid.WQuickEntry;
import org.adempiere.webui.panel.InfoPanel;
import org.adempiere.webui.window.WFieldRecordInfo;
import org.compiere.model.GridField;
@ -40,7 +43,6 @@ import org.compiere.model.Lookup;
import org.compiere.model.MLookup;
import org.compiere.model.MLookupFactory;
import org.compiere.model.MRole;
import static org.compiere.model.SystemIDs.*;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.DisplayType;
@ -151,17 +153,17 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
columnName = this.getColumnName();
if (columnName.equals("C_BPartner_ID"))
{
popupMenu = new WEditorPopupMenu(true, true, isShowPreference(), true, true);
popupMenu = new WEditorPopupMenu(true, true, isShowPreference(), true, true, false, lookup);
getComponent().setButtonImage("/images/BPartner10.png");
}
else if (columnName.equals("M_Product_ID"))
{
popupMenu = new WEditorPopupMenu(true, true, isShowPreference(), false, false);
popupMenu = new WEditorPopupMenu(true, true, isShowPreference(), false, false, false, lookup);
getComponent().setButtonImage("/images/Product10.png");
}
else
{
popupMenu = new WEditorPopupMenu(true, true, isShowPreference(), false, false);
popupMenu = new WEditorPopupMenu(true, true, isShowPreference(), false, false, false, lookup);
getComponent().setButtonImage("/images/PickOpen10.png");
}
@ -293,7 +295,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
infoPanel.detach();
infoPanel = null;
}
actionBPartner(true);
actionQuickEntry(true);
}
// Elaine 2009/02/16 - update record
else if (WEditorPopupMenu.UPDATE_EVENT.equals(evt.getContextEvent()))
@ -303,7 +305,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
infoPanel.detach();
infoPanel = null;
}
actionBPartner(false);
actionQuickEntry(false);
}
else if (WEditorPopupMenu.CHANGE_LOG_EVENT.equals(evt.getContextEvent()))
{
@ -437,40 +439,40 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
} // actionCombo
/**
* Action - Special BPartner Screen
* Action - Special Quick Entry Screen
* @param newRecord true if new record should be created
*/
private void actionBPartner (boolean newRecord)
private void actionQuickEntry (boolean newRecord)
{
if(!getComponent().isEnabled())
return;
final WBPartner vbp = new WBPartner (lookup.getWindowNo());
int BPartner_ID = 0;
final WQuickEntry vqe = new WQuickEntry (lookup.getWindowNo(), lookup.getZoom());
int Record_ID = 0;
// if update, get current value
if (!newRecord)
{
if (value instanceof Integer)
BPartner_ID = ((Integer)value).intValue();
else if (value != null)
BPartner_ID = Integer.parseInt(value.toString());
Record_ID = ((Integer)value).intValue();
else if (value != null && "".compareTo(value.toString())!= 0)
Record_ID = Integer.parseInt(value.toString());
}
vbp.loadBPartner (BPartner_ID);
vqe.loadRecord (Record_ID);
final int finalBPartner_ID = BPartner_ID;
vbp.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
final int finalRecord_ID = Record_ID;
vqe.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
// get result
int result = vbp.getC_BPartner_ID();
int result = vqe.getRecord_ID();
if (result == 0 // 0 = not saved
&& result == finalBPartner_ID) // the same
&& result == finalRecord_ID) // the same
return;
// Maybe new BPartner - put in cache
// Maybe new Record - put in cache
lookup.getDirect(new Integer(result), false, true);
setValue(new Integer(result));
actionCombo (new Integer(result)); // data binding
@ -479,9 +481,9 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
}
});
vbp.setVisible(true);
AEnv.showWindow(vbp);
} // actionBPartner
vqe.setVisible(true);
AEnv.showWindow(vqe);
} // actionQuickEntry
private void actionButton(String queryValue)
{

View File

@ -27,7 +27,9 @@ import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Combobox;
import org.adempiere.webui.event.ContextMenuEvent;
import org.adempiere.webui.event.ContextMenuListener;
import org.adempiere.webui.event.DialogEvents;
import org.adempiere.webui.event.ValueChangeEvent;
import org.adempiere.webui.grid.WQuickEntry;
import org.adempiere.webui.window.WFieldRecordInfo;
import org.adempiere.webui.window.WLocationDialog;
import org.compiere.model.GridField;
@ -42,6 +44,7 @@ import org.compiere.util.Msg;
import org.compiere.util.NamePair;
import org.compiere.util.ValueNamePair;
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.Comboitem;
@ -151,9 +154,9 @@ ContextMenuListener, IZoomableEditor
|| (columnName.toUpperCase().equals("BILL_LOCATION_ID"))
|| (columnName.toUpperCase().equals("DROPSHIP_LOCATION_ID")))
{
popupMenu = new WEditorPopupMenu(true, true, isShowPreference(), false, false, true);
popupMenu = new WEditorPopupMenu(true, true, isShowPreference(), false, false, true, lookup);
} else {
popupMenu = new WEditorPopupMenu(zoom, true, isShowPreference());
popupMenu = new WEditorPopupMenu(zoom, true, isShowPreference(), false, false, false, lookup);
}
addChangeLogMenu(popupMenu);
}
@ -387,8 +390,57 @@ ContextMenuListener, IZoomableEditor
public void actionZoom()
{
AEnv.actionZoom(lookup, getValue());
}
}
/**
* Action - Special Quick Entry Screen
* @param newRecord true if new record should be created
*/
private void actionQuickEntry (boolean newRecord)
{
if(!getComponent().isEnabled())
return;
final WQuickEntry vqe = new WQuickEntry (lookup.getWindowNo(), lookup.getZoom());
int Record_ID = 0;
Object value = getValue();
// if update, get current value
if (!newRecord)
{
if (value instanceof Integer)
Record_ID = ((Integer)value).intValue();
else if (value != null && "".compareTo(value.toString())!= 0)
Record_ID = Integer.parseInt(value.toString());
}
vqe.loadRecord (Record_ID);
final int finalRecord_ID = Record_ID;
vqe.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
// get result
int result = vqe.getRecord_ID();
if (result == 0 // 0 = not saved
&& result == finalRecord_ID) // the same
return;
// Maybe new Record - put in cache
Object newValue = new Integer(result);
lookup.getDirect(newValue, false, true);
setValue(new Integer(result));
ValueChangeEvent changeEvent = new ValueChangeEvent(this, getColumnName(), oldValue, newValue);
fireValueChange(changeEvent);
oldValue = newValue;
}
});
vqe.setVisible(true);
AEnv.showWindow(vqe);
} // actionQuickEntry
private void actionLocation() {
int BPLocation_ID = 0;
Object value = getValue();
@ -425,6 +477,14 @@ ContextMenuListener, IZoomableEditor
ValuePreference.start (this.getGridField(), getValue());
return;
}
else if (WEditorPopupMenu.NEW_EVENT.equals(evt.getContextEvent()))
{
actionQuickEntry(true);
}
else if (WEditorPopupMenu.UPDATE_EVENT.equals(evt.getContextEvent()))
{
actionQuickEntry(false);
}
else if (WEditorPopupMenu.CHANGE_LOG_EVENT.equals(evt.getContextEvent()))
{
WFieldRecordInfo.start(gridField);

View File

@ -59,6 +59,7 @@ import org.zkoss.zul.Vlayout;
*
*/
@Deprecated /* use WQuickEntry instead */
public class WBPartner extends Window implements EventListener, ValueChangeListener
{
/**

View File

@ -0,0 +1,434 @@
/******************************************************************************
* Copyright (C) 2012 Trek Global *
* Product: iDempiere ERP & CRM Smart Business Solution *
* 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.grid;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import org.adempiere.webui.component.ConfirmPanel;
import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.editor.WEditor;
import org.adempiere.webui.editor.WebEditorFactory;
import org.adempiere.webui.event.ValueChangeEvent;
import org.adempiere.webui.event.ValueChangeListener;
import org.adempiere.webui.session.SessionManager;
import org.adempiere.webui.window.FDialog;
import org.compiere.model.GridField;
import org.compiere.model.GridTab;
import org.compiere.model.GridWindow;
import org.compiere.model.MField;
import org.compiere.model.MRole;
import org.compiere.model.MTable;
import org.compiere.model.PO;
import org.compiere.util.CLogger;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.Util;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.HtmlBasedComponent;
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.Hlayout;
import org.zkoss.zul.Separator;
import org.zkoss.zul.Span;
import org.zkoss.zul.Vlayout;
/**
* Quick Entry Window
* Author: Carlos Ruiz
*/
public class WQuickEntry extends Window implements EventListener, ValueChangeListener
{
/**
*
*/
private static final long serialVersionUID = -4121297375382998263L;
public static final String QUICK_ENTRY_MODE = "_QUICK_ENTRY_MODE_";
private static CLogger log = CLogger.getCLogger(WQuickEntry.class);
private int m_WindowNo;
private int parent_WindowNo;
List<GridField> quickFields = new ArrayList<GridField>();
List<WEditor> quickEditors = new ArrayList<WEditor>();
List<Object> initialValues = new ArrayList<Object>();
List<GridTab> quickTabs = new ArrayList<GridTab>();
List<PO> quickPOs = new ArrayList<PO>();
/** Read Only */
private boolean m_readOnly = false;
private Vlayout centerPanel = new Vlayout();
private ConfirmPanel confirmPanel = new ConfirmPanel(true, false, false, false, false, false);
private int m_AD_Window_ID;
/**
* Constructor.
* Requires call loadRecord
* @param WindowNo Window No
* @param AD_Window_ID
*/
public WQuickEntry(int WindowNo, int AD_Window_ID)
{
super();
m_AD_Window_ID = AD_Window_ID;
parent_WindowNo = WindowNo;
m_WindowNo = SessionManager.getAppDesktop().registerWindow(this);
log.info("R/O=" + m_readOnly);
try
{
jbInit();
}
catch(Exception ex)
{
log.log(Level.SEVERE, ex.getMessage());
}
Env.setContext(Env.getCtx(), m_WindowNo, QUICK_ENTRY_MODE, "Y");
initPOs();
} // WQuickEntry
/**
* Static Init
* @throws Exception
*/
void jbInit() throws Exception
{
this.setWidth("350px");
this.setBorder("normal");
this.setClosable(true);
this.setSizable(true);
this.appendChild(centerPanel);
this.appendChild(confirmPanel);
centerPanel.setWidth("100%");
confirmPanel.addActionListener(Events.ON_CLICK, this);
}
/**
* Dynamic Init
*/
private void initPOs()
{
GridWindow gridwindow = GridWindow.get(Env.getCtx(), m_WindowNo, m_AD_Window_ID);
this.setTitle(gridwindow.getName());
boolean newTab = false;
for (int i=0; i < gridwindow.getTabCount(); i++) {
GridTab gridtab = gridwindow.getTab(i);
if (i == 0) {
m_readOnly = !MRole.getDefault().canUpdate(
Env.getAD_Client_ID(Env.getCtx()), Env.getAD_Org_ID(Env.getCtx()),
gridtab.getAD_Table_ID(), 0, false);
}
if (!gridtab.isLoadComplete())
gridwindow.initTab(i);
for (GridField gridfield : gridtab.getFields()) {
MField field = new MField(Env.getCtx(), gridfield.getAD_Field_ID(), null);
if (field.isQuickEntry()) {
if (! isValidQuickEntryType(field.getAD_Reference_ID()))
continue;
WEditor editor = WebEditorFactory.getEditor(gridfield, false);
if (m_readOnly)
editor.setReadWrite(false);
if (gridfield.isMandatory(false))
editor.setMandatory(true);
createLine(editor, newTab, gridtab);
quickFields.add(gridfield);
quickEditors.add(editor);
editor.addValueChangeListener(this);
if (! quickTabs.contains(gridtab)) {
quickTabs.add(gridtab);
}
newTab = false;
}
}
newTab = true;
}
} // initPOs
private boolean isValidQuickEntryType(int refID) {
boolean valid =
! (
refID == DisplayType.Button
|| refID == DisplayType.Binary
|| refID == DisplayType.ID
);
return valid;
}
private void createLine(WEditor editor, boolean newTab, GridTab gt) {
if (newTab) {
Separator sep = new Separator();
centerPanel.appendChild(sep);
Label tabLabel = new Label(gt.getName());
centerPanel.appendChild(tabLabel);
Separator sepl = new Separator();
sepl.setBar(true);
centerPanel.appendChild(sepl);
}
Component field = editor.getComponent();
Hlayout layout = new Hlayout();
layout.setHflex("10");
Span span = new Span();
span.setHflex("3");
layout.appendChild(span);
Label label = editor.getLabel();
span.appendChild(label);
label.setSclass("field-label");
layout.appendChild(field);
((HtmlBasedComponent)field).setHflex("7");
centerPanel.appendChild(layout);
}
/**
* Load Record_ID
* @param Record_ID - existing Record or 0 for new
* @return true if loaded
*/
public boolean loadRecord (int Record_ID)
{
String parentColumn = null;
for (int idxt = 0; idxt < quickTabs.size(); idxt++) {
GridTab gridtab = quickTabs.get(idxt);
int id = 0;
if (idxt == 0) {
id = Record_ID;
parentColumn = gridtab.getTableName() + "_ID";
} else {
if (Record_ID > 0) {
String columnname = gridtab.getTableName() + "_ID";
id = Env.getContextAsInt(Env.getCtx(), parent_WindowNo, columnname);
}
}
MTable table = MTable.get(Env.getCtx(), gridtab.getTableName());
PO po = table.getPO(id, null);
if (idxt > 0) {
// check the detail record is a child of parent
int parentid = po.get_ValueAsInt(parentColumn);
if (parentid != Record_ID) {
po = table.getPO(0, null);
}
}
quickPOs.add(po);
}
log.config("Record_ID=" + Record_ID);
// New record
if (Record_ID == 0)
{
// set defaults on editors
for (int idxf = 0; idxf < quickFields.size(); idxf++) {
GridField field = quickFields.get(idxf);
WEditor editor = quickEditors.get(idxf);
Object value = field.getDefault();
if (value != null) {
editor.setValue(value);
field.setValue(value, true);
field.getGridTab().processCallout(field);
}
initialValues.add(editor.getValue());
}
return true;
}
if (quickPOs.get(0).get_ID() == 0)
{
FDialog.error(m_WindowNo, this, "RecordNotFound");
return false;
}
for (int idxf = 0; idxf < quickFields.size(); idxf++) {
GridField field = quickFields.get(idxf);
WEditor editor = quickEditors.get(idxf);
int idxt = quickTabs.indexOf(field.getGridTab());
PO po = quickPOs.get(idxt);
Object value = po.get_Value(field.getColumnName());
editor.setValue(value);
field.setValue(value, false);
initialValues.add(editor.getValue());
}
return true;
} // loadRecord
/**
* Save.
* @return true if saved
*/
private boolean actionSave()
{
log.config("");
boolean anyChange = false;
for (int idxf = 0; idxf < quickEditors.size(); idxf++) {
WEditor editor = quickEditors.get(idxf);
Object value = editor.getValue();
Object initialValue = initialValues.get(idxf);
boolean changed = (value != null && initialValue == null)
|| (value == null && initialValue != null)
|| (value != null && initialValue != null && ! value.equals(initialValue));
if (changed) {
anyChange = true;
}
}
if (anyChange) {
// Call all callouts to allow quick entry special behavior
for (GridField field : quickFields) {
String msg = field.getGridTab().processCallout(field);
if (! Util.isEmpty(msg)) {
FDialog.error(m_WindowNo, this, "", msg);
return false;
}
}
}
int parentID = 0;
String parentColumn = null;
for (int idxt = 0; idxt < quickTabs.size(); idxt++) {
GridTab gridtab = quickTabs.get(idxt);
PO po = quickPOs.get(idxt);
if (idxt == 0) {
parentColumn = gridtab.getTableName() + "_ID";
}
boolean savePO = false;
boolean fillMandatoryError = false;
StringBuilder mandatoryFields = new StringBuilder();
for (int idxf = 0; idxf < quickFields.size(); idxf++) {
GridField field = quickFields.get(idxf);
if (field.getGridTab() != gridtab)
continue;
WEditor editor = quickEditors.get(idxf);
Object value = editor.getValue();
Object initialValue = initialValues.get(idxf);
boolean changed = (value != null && initialValue == null)
|| (value == null && initialValue != null)
|| (value != null && initialValue != null && value != initialValue);
boolean thisMandatoryError = false;
if (field.isMandatory(true)) {
if (value == null || value.toString().length() == 0) {
fillMandatoryError = true;
thisMandatoryError = true;
if (mandatoryFields.length() > 0)
mandatoryFields.append(", ");
mandatoryFields.append(Msg.getElement(Env.getCtx(), field.getColumnName()));
}
}
po.set_ValueOfColumn(field.getColumnName(), value);
if (changed && ! thisMandatoryError) {
savePO = true;
}
}
if (savePO && fillMandatoryError) {
FDialog.error(m_WindowNo, this, "FillMandatory", mandatoryFields.toString());
return false;
}
if (savePO) {
if (idxt > 0) {
int actualID = po.get_ValueAsInt(parentColumn);
if (actualID != parentID) {
po.set_ValueOfColumn(parentColumn, parentID);
}
}
po.saveEx();
}
if (idxt == 0) {
parentID = po.get_ID();
}
}
return true;
} // actionSave
/**
* Returns Record_ID
* @return Record_ID (0 = not saved)
*/
public int getRecord_ID()
{
if (quickPOs.get(0) == null)
return 0;
return quickPOs.get(0).get_ID();
} // getRecord_ID
public void onEvent(Event e) throws Exception
{
if (m_readOnly)
this.detach();
// OK pressed
else if ((e.getTarget() == confirmPanel.getButton("Ok")) && actionSave())
this.detach();
// Cancel pressed
else if (e.getTarget() == confirmPanel.getButton("Cancel"))
this.detach();
}
@Override
public void detach() {
super.detach();
SessionManager.getAppDesktop().unregisterWindow(m_WindowNo);
}
public void valueChange(ValueChangeEvent evt)
{
if (evt.getSource() instanceof WEditor) {
int idx = quickEditors.indexOf(evt.getSource());
if (idx >= 0) {
GridField field = quickFields.get(idx);
// process dependencies and callouts for the changed field
field.setValue(evt.getNewValue(), true);
field.getGridTab().processFieldChange(field);
}
}
}
} // WQuickEntry

View File

@ -0,0 +1,49 @@
/******************************************************************************
* Copyright (C) 2012 Trek Global *
* Product: iDempiere ERP & CRM Smart Business Solution *
* 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.panel;
import org.adempiere.webui.apps.form.WTabEditor;
public class WTabEditorForm extends ADForm
{
/**
*
*/
private static final long serialVersionUID = -2533099650671242190L;
private WTabEditor te;
public WTabEditorForm(WTabEditor wTabEditor) {
te = wTabEditor;
}
@Override
public Mode getWindowMode() {
return Mode.HIGHLIGHTED;
}
@Override
public boolean setVisible(boolean visible) {
boolean ok = super.setVisible(visible);
if (visible && getProcessInfo() != null)
te.initForm();
return ok;
}
@Override
protected void initForm() {
}
}

View File

@ -0,0 +1,154 @@
/******************************************************************************
* Copyright (C) 2012 Trek Global *
* Product: iDempiere ERP & CRM Smart Business Solution *
* 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.apps.form;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import org.compiere.model.GridField;
import org.compiere.model.MField;
import org.compiere.model.MTab;
import org.compiere.util.CLogger;
import org.compiere.util.Env;
/**
*
* @author Juan David Arboleda
* @author Carlos Ruiz
*
*/
public class TabEditor
{
public MTab m_tab;
/** Logger */
public static CLogger log = CLogger.getCLogger(TabEditor.class);
private List<MField> fields = new ArrayList<MField>();
private MField m_activeField;
private List<GridField> gridFields = new ArrayList<GridField>();
public List<GridField> getGridFields() {
return gridFields;
}
public MTab getMTab() {
return m_tab;
}
public List<MField> getMFields() {
return fields;
}
protected void initMFields(int windowNo, int tabid) {
m_tab = new MTab(Env.getCtx(), tabid, null);
GridField[] l_gridFields = GridField.createFields(Env.getCtx(), windowNo, 0, tabid);
for (GridField gridField : l_gridFields) {
gridFields.add(gridField);
MField field = new MField(Env.getCtx(), gridField.getAD_Field_ID(), null);
fields.add(field);
gridField.getVO().IsReadOnly = true;
gridField.getVO().IsMandatory = false;
gridField.getVO().IsUpdateable = false;
gridField.getVO().IsAlwaysUpdateable = false;
}
resortArrays();
}
public boolean cmd_save() {
for (MField field : fields) {
if (field.isActive())
field.saveEx();
}
return true;
}
protected MField getMField(int fieldid) {
for (MField field : fields) {
if (field.getAD_Field_ID() == fieldid) {
return field;
}
}
return null;
}
protected GridField getGridField(MField field) {
for (GridField gridfield : gridFields) {
if (gridfield.getAD_Field_ID() == field.getAD_Field_ID()) {
return gridfield;
}
}
return null;
}
public MField getActiveMField() {
return m_activeField;
}
protected void setActiveMField(MField field) {
m_activeField = field;
}
protected void resortArrays() {
Collections.sort(fields, new Comparator<MField>() {
@Override
public int compare(MField field1, MField field2) {
String compare1 = String.format("%s%10d%s",
(field1.isDisplayed() ? "0" : "1"),
(field1.isDisplayed() ? field1.getSeqNo() : 0),
field1.getName());
String compare2 = String.format("%s%10d%s",
(field2.isDisplayed() ? "0" : "1"),
(field2.isDisplayed() ? field2.getSeqNo() : 0),
field2.getName());
return compare1.compareTo(compare2);
}
});
int seq = 10;
for (MField field : fields) {
if (field.isDisplayed()) {
field.setSeqNo(seq);
seq = seq + 10;
} else {
field.setSeqNo(0);
}
}
Collections.sort(gridFields, new Comparator<GridField>() {
@Override
public int compare(GridField f1, GridField f2) {
MField field1 = getMField(f1.getAD_Field_ID());
MField field2 = getMField(f2.getAD_Field_ID());
String compare1 = String.format("%s%10d%s",
(field1.isDisplayed() ? "0" : "1"),
(field1.isDisplayed() ? field1.getSeqNo() : 0),
field1.getName());
String compare2 = String.format("%s%10d%s",
(field2.isDisplayed() ? "0" : "1"),
(field2.isDisplayed() ? field2.getSeqNo() : 0),
field2.getName());
return compare1.compareTo(compare2);
}
});
}
} // TabEditor