From ec8c0ea1787fb3b3aa9a62bd74d932f45dc90621 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 8 Dec 2016 00:03:57 +0100 Subject: [PATCH 01/22] IDEMPIERE-2771 Improve 2pack tracing for errors / add servername to the subject email --- .../src/org/adempiere/pipo2/PackInNotifier.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/org.adempiere.pipo/src/org/adempiere/pipo2/PackInNotifier.java b/org.adempiere.pipo/src/org/adempiere/pipo2/PackInNotifier.java index 43b24f5ce2..d6348b54bd 100644 --- a/org.adempiere.pipo/src/org/adempiere/pipo2/PackInNotifier.java +++ b/org.adempiere.pipo/src/org/adempiere/pipo2/PackInNotifier.java @@ -25,6 +25,8 @@ package org.adempiere.pipo2; +import java.net.InetAddress; +import java.net.UnknownHostException; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; @@ -34,6 +36,7 @@ import org.compiere.model.MSysConfig; import org.compiere.util.EMail; import org.compiere.util.Env; import org.compiere.util.KeyNamePair; +import org.compiere.util.WebUtil; /** * PackIn Notifier @@ -105,7 +108,13 @@ public class PackInNotifier { } else { status = "Failure"; } - subject.append(status).append("* Result for PackIn ").append(getFileName()); + String serverName = null; + try { + serverName = InetAddress.getLocalHost().getHostName(); + } catch (UnknownHostException e) { + serverName = WebUtil.getHostIP(); + } + subject.append(status).append("* ").append(serverName).append(" - Result for PackIn ").append(getFileName()); if (getPluginName() != null) { subject.append(" from ").append(getPluginName()); } From 060c5a285492bbf4a198a94bd0b5d5e9935f1736 Mon Sep 17 00:00:00 2001 From: hieplq Date: Mon, 12 Dec 2016 17:15:19 +0700 Subject: [PATCH 02/22] IDEMPIERE-2271:iDempiere is hardcoded EMail to support subject conducte feedback header from env variable --- migration/i4.1/oracle/201612121604-IDEMPIERE-2271.sql | 9 +++++++++ .../i4.1/postgresql/201612121604-IDEMPIERE-2271.sql | 6 ++++++ .../WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java | 3 +++ .../adempiere/webui/factory/DefaultFeedbackService.java | 7 ++++++- 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 migration/i4.1/oracle/201612121604-IDEMPIERE-2271.sql create mode 100644 migration/i4.1/postgresql/201612121604-IDEMPIERE-2271.sql diff --git a/migration/i4.1/oracle/201612121604-IDEMPIERE-2271.sql b/migration/i4.1/oracle/201612121604-IDEMPIERE-2271.sql new file mode 100644 index 0000000000..8d4fce6a7a --- /dev/null +++ b/migration/i4.1/oracle/201612121604-IDEMPIERE-2271.sql @@ -0,0 +1,9 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-2271 iDempiere is hardcoded EMail to support subject +-- Dec 12, 2016 4:50:36 PM ICT +INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','@#System_Name@ Trace Information',0,0,'Y',TO_DATE('2016-12-12 16:50:35','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2016-12-12 16:50:35','YYYY-MM-DD HH24:MI:SS'),100,200414,'FeedBackHeader','D','1a27d0a9-0832-4e63-b49b-bb26eeceafc4') +; +SELECT register_migration_script('201612121604-IDEMPIERE-2271.sql') FROM dual +; diff --git a/migration/i4.1/postgresql/201612121604-IDEMPIERE-2271.sql b/migration/i4.1/postgresql/201612121604-IDEMPIERE-2271.sql new file mode 100644 index 0000000000..3b23e697e8 --- /dev/null +++ b/migration/i4.1/postgresql/201612121604-IDEMPIERE-2271.sql @@ -0,0 +1,6 @@ +-- IDEMPIERE-2271 iDempiere is hardcoded EMail to support subject +-- Dec 12, 2016 4:50:36 PM ICT +INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','@#System_Name@ Trace Information',0,0,'Y',TO_TIMESTAMP('2016-12-12 16:50:35','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2016-12-12 16:50:35','YYYY-MM-DD HH24:MI:SS'),100,200414,'FeedBackHeader','D','1a27d0a9-0832-4e63-b49b-bb26eeceafc4') +; +SELECT register_migration_script('201612121604-IDEMPIERE-2271.sql') FROM dual +; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java index c1b7e3c07a..39e4ed5b03 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java @@ -188,6 +188,9 @@ public class AdempiereWebUI extends Window implements EventListener, IWeb Env.setContext(ctx, Env.LANGUAGE, langSession); } + MSystem system = MSystem.get(Env.getCtx()); + Env.setContext(ctx, "#System_Name", system.getName()); + // Validate language Language language = Language.getLanguage(langLogin); String locale = Env.getContext(ctx, AEnv.LOCALE); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/DefaultFeedbackService.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/DefaultFeedbackService.java index c5da1f38f4..c8f341263a 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/DefaultFeedbackService.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/DefaultFeedbackService.java @@ -96,6 +96,11 @@ public class DefaultFeedbackService implements IFeedbackService { showEmailDialog(imageBytes); } + protected String getFeedbackSubject() { + String feedBackHeader = Msg.getMsg(Env.getCtx(), "FeedBackHeader"); + return Env.parseContext(Env.getCtx(), 0, feedBackHeader, false, false); + } + protected void showEmailDialog(byte[] imageBytes) { DataSource ds = FeedbackManager.getLogAttachment(errorOnly); @@ -103,7 +108,7 @@ public class DefaultFeedbackService implements IFeedbackService { Msg.getMsg(Env.getCtx(), "EMailSupport"), MUser.get(Env.getCtx()), "", // to - MSystem.get(Env.getCtx()).getName() + " " + Msg.getMsg(Env.getCtx(), "TraceInfo"), + getFeedbackSubject(), "", ds); dialog.setAttribute(Window.MODE_KEY, Mode.OVERLAPPED); From 9dc33882167c5a0d23859f00105bbbd2afd50d88 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Tue, 13 Dec 2016 18:26:34 +0100 Subject: [PATCH 03/22] IDEMPIERE-3259 Default logic: Add support for lookup of foreign table values / integrate patch from Heng Sin --- org.adempiere.base/src/org/compiere/model/GridField.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.adempiere.base/src/org/compiere/model/GridField.java b/org.adempiere.base/src/org/compiere/model/GridField.java index 237771dcaf..a347161fad 100644 --- a/org.adempiere.base/src/org/compiere/model/GridField.java +++ b/org.adempiere.base/src/org/compiere/model/GridField.java @@ -792,7 +792,7 @@ public class GridField if (defStr.equals("@SysDate@")) // System Time return new Timestamp (System.currentTimeMillis()); else if (defStr.indexOf('@') != -1) // it is a variable - defStr = Env.getContext(m_vo.ctx, m_vo.WindowNo, defStr.replace('@',' ').trim()); + defStr = Env.parseContext(m_vo.ctx, m_vo.WindowNo, defStr.trim(), false, false); else if (defStr.indexOf("'") != -1) // it is a 'String' defStr = defStr.replace('\'', ' ').trim(); From 6ea08beba8f46e8c627a83bc8889952adc6c1714 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Tue, 21 Jul 2015 20:26:02 +0800 Subject: [PATCH 04/22] 1005028 Payment Term record -- Code should ignore inactive records. Do not pick inactive record as default payment term for order and invoice. (IDEMPIERE-3260) --- org.adempiere.base/src/org/compiere/model/MInvoice.java | 2 +- org.adempiere.base/src/org/compiere/model/MOrder.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MInvoice.java b/org.adempiere.base/src/org/compiere/model/MInvoice.java index 9925a808c5..32e4d1411e 100644 --- a/org.adempiere.base/src/org/compiere/model/MInvoice.java +++ b/org.adempiere.base/src/org/compiere/model/MInvoice.java @@ -994,7 +994,7 @@ public class MInvoice extends X_C_Invoice implements DocAction setC_PaymentTerm_ID (ii); else { - String sql = "SELECT C_PaymentTerm_ID FROM C_PaymentTerm WHERE AD_Client_ID=? AND IsDefault='Y'"; + String sql = "SELECT C_PaymentTerm_ID FROM C_PaymentTerm WHERE AD_Client_ID=? AND IsDefault='Y' AND IsActive='Y'"; ii = DB.getSQLValue(null, sql, getAD_Client_ID()); if (ii != 0) setC_PaymentTerm_ID (ii); diff --git a/org.adempiere.base/src/org/compiere/model/MOrder.java b/org.adempiere.base/src/org/compiere/model/MOrder.java index 8b88601987..ad2da57bb6 100644 --- a/org.adempiere.base/src/org/compiere/model/MOrder.java +++ b/org.adempiere.base/src/org/compiere/model/MOrder.java @@ -1039,7 +1039,7 @@ public class MOrder extends X_C_Order implements DocAction setC_PaymentTerm_ID(ii); else { - String sql = "SELECT C_PaymentTerm_ID FROM C_PaymentTerm WHERE AD_Client_ID=? AND IsDefault='Y'"; + String sql = "SELECT C_PaymentTerm_ID FROM C_PaymentTerm WHERE AD_Client_ID=? AND IsDefault='Y' AND IsActive='Y'"; ii = DB.getSQLValue(null, sql, getAD_Client_ID()); if (ii != 0) setC_PaymentTerm_ID (ii); From 06626f6674c86d53b0d9ba8c335474f88acf0583 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Tue, 13 Dec 2016 18:44:07 +0100 Subject: [PATCH 05/22] IDEMPIERE-950 - detected a NPE when zooming from Trial Report to Account Elemen window --- .../WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java index d40eeaa6bc..cee0191f0f 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java @@ -1274,7 +1274,7 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer boolean refresh=true; Treeitem item = treePanel.getTree().getSelectedItem(); SimpleTreeModel model = (SimpleTreeModel)(TreeModel) treePanel.getTree().getModel(); - if (item != null) + if (item != null && item.getValue() != null) { @SuppressWarnings("unchecked") MTreeNode treeNode = ((DefaultTreeNode) item.getValue()).getData(); From 979d022418d925955dfa9c84391991fd24df5266 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Tue, 10 May 2016 20:31:56 +0800 Subject: [PATCH 06/22] 1006008 Add field type for dashboard content. (IDEMPIERE-3270) --- .../201605101800_System_Ticket_1006008.sql | 231 +++++++++++ .../201605101800_System_Ticket_1006008.sql | 229 ++++++++++ .../src/org/compiere/model/GridField.java | 5 + .../src/org/compiere/model/GridFieldVO.java | 5 + .../src/org/compiere/model/I_AD_Column.java | 11 + .../src/org/compiere/model/SystemIDs.java | 1 + .../src/org/compiere/model/X_AD_Column.java | 29 +- .../src/org/compiere/util/DisplayType.java | 3 + .../webui/desktop/DashboardController.java | 391 +++++++++--------- .../adempiere/webui/editor/WChartEditor.java | 75 +++- .../webui/editor/WDashboardContentEditor.java | 141 +++++++ .../webui/factory/DefaultEditorFactory.java | 7 + 12 files changed, 918 insertions(+), 210 deletions(-) create mode 100644 migration/i3.1/oracle/201605101800_System_Ticket_1006008.sql create mode 100644 migration/i3.1/postgresql/201605101800_System_Ticket_1006008.sql create mode 100644 org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WDashboardContentEditor.java diff --git a/migration/i3.1/oracle/201605101800_System_Ticket_1006008.sql b/migration/i3.1/oracle/201605101800_System_Ticket_1006008.sql new file mode 100644 index 0000000000..d8b86992b5 --- /dev/null +++ b/migration/i3.1/oracle/201605101800_System_Ticket_1006008.sql @@ -0,0 +1,231 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- May 9, 2016 8:34:27 PM MYT +-- 1006008 Add field type for dashboard content +INSERT INTO AD_Reference (AD_Reference_ID,Name,AD_Reference_UU,IsOrderByValue,AD_Org_ID,Description,ValidationType,Updated,IsActive,CreatedBy,UpdatedBy,AD_Client_ID,Created,EntityType) VALUES (200122,'Dashboard Content','eddd31af-5ab7-4b88-967f-4fe7b7e091ea','N',0,'Dashboard Content','D',TO_DATE('2016-05-09 20:34:20','YYYY-MM-DD HH24:MI:SS'),'Y',100,100,0,TO_DATE('2016-05-09 20:34:20','YYYY-MM-DD HH24:MI:SS'),'D') +; + +-- May 9, 2016 8:35:29 PM MYT +INSERT INTO AD_Column (AD_Column_ID,SeqNoSelection,IsSyncDatabase,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,Updated,IsUpdateable,ColumnName,Name,IsAllowCopy,IsActive,CreatedBy,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,AD_Org_ID,Created,EntityType,IsEncrypted,IsSecure,FKConstraintType,AD_Element_ID,AD_Reference_ID,AD_Table_ID) VALUES (212762,0,'N',0,'N','N','N',0,'N',22,'N','N','N','Y','e5d70049-4a7e-49ab-aba9-ad181833c0d9',TO_DATE('2016-05-09 20:35:23','YYYY-MM-DD HH24:MI:SS'),'Y','PA_DashboardContent_ID','Dashboard Content','Y','Y',100,100,'N','N',0,0,TO_DATE('2016-05-09 20:35:23','YYYY-MM-DD HH24:MI:SS'),'D','N','N','N',51006,19,101) +; + +-- May 9, 2016 8:35:38 PM MYT +UPDATE AD_Column SET FKConstraintType='N', FKConstraintName='PADashboardContent_ADColumn',Updated=TO_DATE('2016-05-09 20:35:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212762 +; + +-- May 9, 2016 8:35:38 PM MYT +ALTER TABLE AD_Column ADD PA_DashboardContent_ID NUMBER(10) DEFAULT NULL +; + +-- May 9, 2016 8:58:49 PM MYT +-- 1006008 Add field type for dashboard content +INSERT INTO AD_Field (SortNo,AD_Field_ID,IsEncrypted,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,IsReadOnly,DisplayLogic,AD_Org_ID,Updated,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,CreatedBy,UpdatedBy,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,IsQuickEntry,AD_Client_ID,Created,ColumnSpan,NumLines,IsAdvancedField,IsDefaultFocus,AD_Column_ID,EntityType,AD_Tab_ID) VALUES (0,204220,'N',0,'N','N',210,'Y','N','@AD_Reference_ID@=200122',0,TO_DATE('2016-05-09 20:58:43','YYYY-MM-DD HH24:MI:SS'),'Dashboard Content','dc337329-72dd-4532-8abf-e0a24ea0340b','Y','N',100,100,'Y','Y',210,1,'N',0,TO_DATE('2016-05-09 20:58:43','YYYY-MM-DD HH24:MI:SS'),2,1,'N','N',212762,'D',101) +; + +-- May 9, 2016 8:59:12 PM MYT +UPDATE AD_Field SET SeqNo=200,IsDisplayed='Y' WHERE AD_Field_ID=204220 +; + +-- May 9, 2016 8:59:12 PM MYT +UPDATE AD_Field SET SeqNo=210,IsDisplayed='Y' WHERE AD_Field_ID=171 +; + +-- May 9, 2016 8:59:12 PM MYT +UPDATE AD_Field SET SeqNo=220,IsDisplayed='Y' WHERE AD_Field_ID=56279 +; + +-- May 9, 2016 8:59:12 PM MYT +UPDATE AD_Field SET SeqNo=230,IsDisplayed='Y' WHERE AD_Field_ID=54403 +; + +-- May 9, 2016 8:59:12 PM MYT +UPDATE AD_Field SET SeqNo=240,IsDisplayed='Y' WHERE AD_Field_ID=2574 +; + +-- May 9, 2016 8:59:12 PM MYT +UPDATE AD_Field SET SeqNo=250,IsDisplayed='Y' WHERE AD_Field_ID=2573 +; + +-- May 9, 2016 8:59:12 PM MYT +UPDATE AD_Field SET SeqNo=260,IsDisplayed='Y' WHERE AD_Field_ID=202518 +; + +-- May 9, 2016 8:59:12 PM MYT +UPDATE AD_Field SET SeqNo=270,IsDisplayed='Y' WHERE AD_Field_ID=202519 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=280,IsDisplayed='Y' WHERE AD_Field_ID=160 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=290,IsDisplayed='Y' WHERE AD_Field_ID=161 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=300,IsDisplayed='Y' WHERE AD_Field_ID=162 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=310,IsDisplayed='Y' WHERE AD_Field_ID=166 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=320,IsDisplayed='Y' WHERE AD_Field_ID=5122 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=330,IsDisplayed='Y' WHERE AD_Field_ID=169 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=340,IsDisplayed='Y' WHERE AD_Field_ID=2370 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=350,IsDisplayed='Y' WHERE AD_Field_ID=10128 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=360,IsDisplayed='Y' WHERE AD_Field_ID=4941 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=370,IsDisplayed='Y' WHERE AD_Field_ID=50188 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=380,IsDisplayed='Y' WHERE AD_Field_ID=168 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=390,IsDisplayed='Y' WHERE AD_Field_ID=159 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=400,IsDisplayed='Y' WHERE AD_Field_ID=4940 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=410,IsDisplayed='Y' WHERE AD_Field_ID=200288 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=420,IsDisplayed='Y' WHERE AD_Field_ID=200648 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=430,IsDisplayed='Y' WHERE AD_Field_ID=202257 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=440,IsDisplayed='Y' WHERE AD_Field_ID=56317 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=450,IsDisplayed='Y' WHERE AD_Field_ID=62467 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=460,IsDisplayed='Y' WHERE AD_Field_ID=167 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=470,IsDisplayed='Y' WHERE AD_Field_ID=825 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=480,IsDisplayed='Y' WHERE AD_Field_ID=1000320 +; + +-- May 9, 2016 8:59:56 PM MYT +UPDATE AD_Field SET SeqNoGrid=340,IsDisplayedGrid='Y' WHERE AD_Field_ID=204220 +; + +-- May 9, 2016 8:59:56 PM MYT +UPDATE AD_Field SET SeqNoGrid=350,IsDisplayedGrid='Y' WHERE AD_Field_ID=167 +; + +-- May 9, 2016 8:59:56 PM MYT +UPDATE AD_Field SET SeqNoGrid=360,IsDisplayedGrid='Y' WHERE AD_Field_ID=5121 +; + +-- May 9, 2016 8:59:56 PM MYT +UPDATE AD_Field SET SeqNoGrid=370,IsDisplayedGrid='Y' WHERE AD_Field_ID=56317 +; + +-- May 9, 2016 8:59:56 PM MYT +UPDATE AD_Field SET SeqNoGrid=380,IsDisplayedGrid='Y' WHERE AD_Field_ID=62467 +; + +-- May 9, 2016 8:59:56 PM MYT +UPDATE AD_Field SET SeqNoGrid=390,IsDisplayedGrid='Y' WHERE AD_Field_ID=202518 +; + +-- May 9, 2016 8:59:56 PM MYT +UPDATE AD_Field SET SeqNoGrid=400,IsDisplayedGrid='Y' WHERE AD_Field_ID=202519 +; + +-- May 9, 2016 8:59:57 PM MYT +UPDATE AD_Field SET SeqNoGrid=410,IsDisplayedGrid='Y' WHERE AD_Field_ID=5122 +; + +-- May 9, 2016 8:59:57 PM MYT +UPDATE AD_Field SET SeqNoGrid=420,IsDisplayedGrid='Y' WHERE AD_Field_ID=200288 +; + +-- May 9, 2016 8:59:57 PM MYT +UPDATE AD_Field SET SeqNoGrid=430,IsDisplayedGrid='Y' WHERE AD_Field_ID=202257 +; + +-- May 9, 2016 8:59:57 PM MYT +UPDATE AD_Field SET SeqNoGrid=440,IsDisplayedGrid='Y' WHERE AD_Field_ID=59619 +; + +-- May 9, 2016 8:59:57 PM MYT +UPDATE AD_Field SET SeqNoGrid=450,IsDisplayedGrid='Y' WHERE AD_Field_ID=1000320 +; + +CREATE OR REPLACE VIEW ad_field_v AS + SELECT t.ad_window_id, f.ad_tab_id, f.ad_field_id, tbl.ad_table_id, f.ad_column_id, f.name, f.description, f.help, f.isdisplayed, f.displaylogic, f.displaylength, f.seqno, f.sortno, f.issameline, +f.isheading, f.isfieldonly, f.isreadonly, f.isencrypted AS isencryptedfield, f.obscuretype, c.columnname, c.columnsql, c.fieldlength, c.vformat, COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue, +c.iskey, c.isparent, COALESCE(f.ismandatory, c.ismandatory) AS ismandatory, c.isidentifier, c.istranslated, COALESCE(f.ad_reference_value_id, c.ad_reference_value_id) AS ad_reference_value_id, +c.callout, COALESCE(f.ad_reference_id, c.ad_reference_id) AS ad_reference_id, COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) AS ad_val_rule_id, c.ad_process_id, COALESCE(f.isalwaysupdateable, c.isalwaysupdateable) AS isalwaysupdateable, +COALESCE(f.readonlylogic, c.readonlylogic) AS readonlylogic, COALESCE(f.mandatorylogic, c.mandatorylogic) AS mandatorylogic, COALESCE(f.isupdateable, c.isupdateable) AS isupdateable, +c.isencrypted AS isencryptedcolumn, c.isselectioncolumn, tbl.tablename, c.valuemin, c.valuemax, fg.name AS fieldgroup, vr.code AS validationcode, f.included_tab_id, fg.fieldgrouptype, +fg.iscollapsedbydefault, COALESCE(f.infofactoryclass, c.infofactoryclass) AS infofactoryclass, c.isautocomplete, COALESCE(f.isallowcopy, c.isallowcopy) AS isallowcopy, f.isdisplayedgrid, +f.seqnogrid, c.seqnoselection, f.xposition, f.columnspan, f.numlines, COALESCE(f.istoolbarbutton, c.istoolbarbutton) AS istoolbarbutton, c.formatpattern, f.isadvancedfield, f.isdefaultfocus, +c.ad_chart_id, f.ad_labelstyle_id, f.ad_fieldstyle_id, c.pa_dashboardcontent_id + FROM ad_field f + JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id + LEFT JOIN ad_fieldgroup fg ON f.ad_fieldgroup_id = fg.ad_fieldgroup_id + LEFT JOIN ad_column c ON f.ad_column_id = c.ad_column_id + JOIN ad_table tbl ON c.ad_table_id = tbl.ad_table_id + LEFT JOIN ad_val_rule vr ON vr.ad_val_rule_id = COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) + WHERE f.isactive = 'Y' AND c.isactive = 'Y' +; + +CREATE OR REPLACE VIEW ad_field_vt AS + SELECT trl.ad_language, t.ad_window_id, f.ad_tab_id, f.ad_field_id, tbl.ad_table_id, f.ad_column_id, trl.name, trl.description, trl.help, f.isdisplayed, f.displaylogic, f.displaylength, f.seqno, + f.sortno, f.issameline, f.isheading, f.isfieldonly, f.isreadonly, f.isencrypted AS isencryptedfield, f.obscuretype, c.columnname, c.columnsql, c.fieldlength, c.vformat, COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue, + c.iskey, c.isparent, COALESCE(f.ismandatory, c.ismandatory) AS ismandatory, c.isidentifier, c.istranslated, COALESCE(f.ad_reference_value_id, c.ad_reference_value_id) AS ad_reference_value_id, + c.callout, COALESCE(f.ad_reference_id, c.ad_reference_id) AS ad_reference_id, COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) AS ad_val_rule_id, c.ad_process_id, COALESCE(f.isalwaysupdateable, + c.isalwaysupdateable) AS isalwaysupdateable, COALESCE(f.readonlylogic, c.readonlylogic) AS readonlylogic, COALESCE(f.mandatorylogic, c.mandatorylogic) AS mandatorylogic, COALESCE(f.isupdateable, c.isupdateable) AS isupdateable, + c.isencrypted AS isencryptedcolumn, c.isselectioncolumn, tbl.tablename, c.valuemin, c.valuemax, fgt.name AS fieldgroup, vr.code AS validationcode, f.included_tab_id, fg.fieldgrouptype, + fg.iscollapsedbydefault, COALESCE(f.infofactoryclass, c.infofactoryclass) AS infofactoryclass, c.isautocomplete, COALESCE(f.isallowcopy, c.isallowcopy) AS isallowcopy, f.isdisplayedgrid, + f.seqnogrid, c.seqnoselection, f.xposition, f.columnspan, f.numlines, COALESCE(f.istoolbarbutton, c.istoolbarbutton) AS istoolbarbutton, c.formatpattern, f.isadvancedfield, f.isdefaultfocus, c.ad_chart_id, f.ad_labelstyle_id, f.ad_fieldstyle_id, c.pa_dashboardcontent_id + FROM ad_field f + JOIN ad_field_trl trl ON f.ad_field_id = trl.ad_field_id + JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id + LEFT JOIN ad_fieldgroup fg ON f.ad_fieldgroup_id = fg.ad_fieldgroup_id + LEFT JOIN ad_fieldgroup_trl fgt ON f.ad_fieldgroup_id = fgt.ad_fieldgroup_id AND trl.ad_language::text = fgt.ad_language::text + LEFT JOIN ad_column c ON f.ad_column_id = c.ad_column_id + JOIN ad_table tbl ON c.ad_table_id = tbl.ad_table_id + LEFT JOIN ad_val_rule vr ON vr.ad_val_rule_id = COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) + WHERE f.isactive = 'Y' AND c.isactive = 'Y' +; + +SELECT register_migration_script('201605101800_System_Ticket_1006008.sql') FROM dual +; + diff --git a/migration/i3.1/postgresql/201605101800_System_Ticket_1006008.sql b/migration/i3.1/postgresql/201605101800_System_Ticket_1006008.sql new file mode 100644 index 0000000000..e6800e68c3 --- /dev/null +++ b/migration/i3.1/postgresql/201605101800_System_Ticket_1006008.sql @@ -0,0 +1,229 @@ +-- May 9, 2016 8:34:27 PM MYT +-- 1006008 Add field type for dashboard content +INSERT INTO AD_Reference (AD_Reference_ID,Name,AD_Reference_UU,IsOrderByValue,AD_Org_ID,Description,ValidationType,Updated,IsActive,CreatedBy,UpdatedBy,AD_Client_ID,Created,EntityType) VALUES (200122,'Dashboard Content','eddd31af-5ab7-4b88-967f-4fe7b7e091ea','N',0,'Dashboard Content','D',TO_TIMESTAMP('2016-05-09 20:34:20','YYYY-MM-DD HH24:MI:SS'),'Y',100,100,0,TO_TIMESTAMP('2016-05-09 20:34:20','YYYY-MM-DD HH24:MI:SS'),'D') +; + +-- May 9, 2016 8:35:29 PM MYT +INSERT INTO AD_Column (AD_Column_ID,SeqNoSelection,IsSyncDatabase,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,Updated,IsUpdateable,ColumnName,Name,IsAllowCopy,IsActive,CreatedBy,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,AD_Org_ID,Created,EntityType,IsEncrypted,IsSecure,FKConstraintType,AD_Element_ID,AD_Reference_ID,AD_Table_ID) VALUES (212762,0,'N',0,'N','N','N',0,'N',22,'N','N','N','Y','e5d70049-4a7e-49ab-aba9-ad181833c0d9',TO_TIMESTAMP('2016-05-09 20:35:23','YYYY-MM-DD HH24:MI:SS'),'Y','PA_DashboardContent_ID','Dashboard Content','Y','Y',100,100,'N','N',0,0,TO_TIMESTAMP('2016-05-09 20:35:23','YYYY-MM-DD HH24:MI:SS'),'D','N','N','N',51006,19,101) +; + +-- May 9, 2016 8:35:38 PM MYT +UPDATE AD_Column SET FKConstraintType='N', FKConstraintName='PADashboardContent_ADColumn',Updated=TO_TIMESTAMP('2016-05-09 20:35:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212762 +; + +-- May 9, 2016 8:35:38 PM MYT +ALTER TABLE AD_Column ADD COLUMN PA_DashboardContent_ID NUMERIC(10) DEFAULT NULL +; + +-- May 9, 2016 8:58:49 PM MYT +-- 1006008 Add field type for dashboard content +INSERT INTO AD_Field (SortNo,AD_Field_ID,IsEncrypted,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,IsReadOnly,DisplayLogic,AD_Org_ID,Updated,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,CreatedBy,UpdatedBy,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,IsQuickEntry,AD_Client_ID,Created,ColumnSpan,NumLines,IsAdvancedField,IsDefaultFocus,AD_Column_ID,EntityType,AD_Tab_ID) VALUES (0,204220,'N',0,'N','N',210,'Y','N','@AD_Reference_ID@=200122',0,TO_TIMESTAMP('2016-05-09 20:58:43','YYYY-MM-DD HH24:MI:SS'),'Dashboard Content','dc337329-72dd-4532-8abf-e0a24ea0340b','Y','N',100,100,'Y','Y',210,1,'N',0,TO_TIMESTAMP('2016-05-09 20:58:43','YYYY-MM-DD HH24:MI:SS'),2,1,'N','N',212762,'D',101) +; + +-- May 9, 2016 8:59:12 PM MYT +UPDATE AD_Field SET SeqNo=200,IsDisplayed='Y' WHERE AD_Field_ID=204220 +; + +-- May 9, 2016 8:59:12 PM MYT +UPDATE AD_Field SET SeqNo=210,IsDisplayed='Y' WHERE AD_Field_ID=171 +; + +-- May 9, 2016 8:59:12 PM MYT +UPDATE AD_Field SET SeqNo=220,IsDisplayed='Y' WHERE AD_Field_ID=56279 +; + +-- May 9, 2016 8:59:12 PM MYT +UPDATE AD_Field SET SeqNo=230,IsDisplayed='Y' WHERE AD_Field_ID=54403 +; + +-- May 9, 2016 8:59:12 PM MYT +UPDATE AD_Field SET SeqNo=240,IsDisplayed='Y' WHERE AD_Field_ID=2574 +; + +-- May 9, 2016 8:59:12 PM MYT +UPDATE AD_Field SET SeqNo=250,IsDisplayed='Y' WHERE AD_Field_ID=2573 +; + +-- May 9, 2016 8:59:12 PM MYT +UPDATE AD_Field SET SeqNo=260,IsDisplayed='Y' WHERE AD_Field_ID=202518 +; + +-- May 9, 2016 8:59:12 PM MYT +UPDATE AD_Field SET SeqNo=270,IsDisplayed='Y' WHERE AD_Field_ID=202519 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=280,IsDisplayed='Y' WHERE AD_Field_ID=160 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=290,IsDisplayed='Y' WHERE AD_Field_ID=161 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=300,IsDisplayed='Y' WHERE AD_Field_ID=162 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=310,IsDisplayed='Y' WHERE AD_Field_ID=166 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=320,IsDisplayed='Y' WHERE AD_Field_ID=5122 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=330,IsDisplayed='Y' WHERE AD_Field_ID=169 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=340,IsDisplayed='Y' WHERE AD_Field_ID=2370 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=350,IsDisplayed='Y' WHERE AD_Field_ID=10128 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=360,IsDisplayed='Y' WHERE AD_Field_ID=4941 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=370,IsDisplayed='Y' WHERE AD_Field_ID=50188 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=380,IsDisplayed='Y' WHERE AD_Field_ID=168 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=390,IsDisplayed='Y' WHERE AD_Field_ID=159 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=400,IsDisplayed='Y' WHERE AD_Field_ID=4940 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=410,IsDisplayed='Y' WHERE AD_Field_ID=200288 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=420,IsDisplayed='Y' WHERE AD_Field_ID=200648 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=430,IsDisplayed='Y' WHERE AD_Field_ID=202257 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=440,IsDisplayed='Y' WHERE AD_Field_ID=56317 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=450,IsDisplayed='Y' WHERE AD_Field_ID=62467 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=460,IsDisplayed='Y' WHERE AD_Field_ID=167 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=470,IsDisplayed='Y' WHERE AD_Field_ID=825 +; + +-- May 9, 2016 8:59:13 PM MYT +UPDATE AD_Field SET SeqNo=480,IsDisplayed='Y' WHERE AD_Field_ID=1000320 +; + +-- May 9, 2016 8:59:56 PM MYT +UPDATE AD_Field SET SeqNoGrid=340,IsDisplayedGrid='Y' WHERE AD_Field_ID=204220 +; + +-- May 9, 2016 8:59:56 PM MYT +UPDATE AD_Field SET SeqNoGrid=350,IsDisplayedGrid='Y' WHERE AD_Field_ID=167 +; + +-- May 9, 2016 8:59:56 PM MYT +UPDATE AD_Field SET SeqNoGrid=360,IsDisplayedGrid='Y' WHERE AD_Field_ID=5121 +; + +-- May 9, 2016 8:59:56 PM MYT +UPDATE AD_Field SET SeqNoGrid=370,IsDisplayedGrid='Y' WHERE AD_Field_ID=56317 +; + +-- May 9, 2016 8:59:56 PM MYT +UPDATE AD_Field SET SeqNoGrid=380,IsDisplayedGrid='Y' WHERE AD_Field_ID=62467 +; + +-- May 9, 2016 8:59:56 PM MYT +UPDATE AD_Field SET SeqNoGrid=390,IsDisplayedGrid='Y' WHERE AD_Field_ID=202518 +; + +-- May 9, 2016 8:59:56 PM MYT +UPDATE AD_Field SET SeqNoGrid=400,IsDisplayedGrid='Y' WHERE AD_Field_ID=202519 +; + +-- May 9, 2016 8:59:57 PM MYT +UPDATE AD_Field SET SeqNoGrid=410,IsDisplayedGrid='Y' WHERE AD_Field_ID=5122 +; + +-- May 9, 2016 8:59:57 PM MYT +UPDATE AD_Field SET SeqNoGrid=420,IsDisplayedGrid='Y' WHERE AD_Field_ID=200288 +; + +-- May 9, 2016 8:59:57 PM MYT +UPDATE AD_Field SET SeqNoGrid=430,IsDisplayedGrid='Y' WHERE AD_Field_ID=202257 +; + +-- May 9, 2016 8:59:57 PM MYT +UPDATE AD_Field SET SeqNoGrid=440,IsDisplayedGrid='Y' WHERE AD_Field_ID=59619 +; + +-- May 9, 2016 8:59:57 PM MYT +UPDATE AD_Field SET SeqNoGrid=450,IsDisplayedGrid='Y' WHERE AD_Field_ID=1000320 +; + +CREATE OR REPLACE VIEW ad_field_v AS + SELECT t.ad_window_id, f.ad_tab_id, f.ad_field_id, tbl.ad_table_id, f.ad_column_id, f.name, f.description, f.help, f.isdisplayed, f.displaylogic, f.displaylength, f.seqno, f.sortno, f.issameline, +f.isheading, f.isfieldonly, f.isreadonly, f.isencrypted AS isencryptedfield, f.obscuretype, c.columnname, c.columnsql, c.fieldlength, c.vformat, COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue, +c.iskey, c.isparent, COALESCE(f.ismandatory, c.ismandatory) AS ismandatory, c.isidentifier, c.istranslated, COALESCE(f.ad_reference_value_id, c.ad_reference_value_id) AS ad_reference_value_id, +c.callout, COALESCE(f.ad_reference_id, c.ad_reference_id) AS ad_reference_id, COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) AS ad_val_rule_id, c.ad_process_id, COALESCE(f.isalwaysupdateable, c.isalwaysupdateable) AS isalwaysupdateable, +COALESCE(f.readonlylogic, c.readonlylogic) AS readonlylogic, COALESCE(f.mandatorylogic, c.mandatorylogic) AS mandatorylogic, COALESCE(f.isupdateable, c.isupdateable) AS isupdateable, +c.isencrypted AS isencryptedcolumn, c.isselectioncolumn, tbl.tablename, c.valuemin, c.valuemax, fg.name AS fieldgroup, vr.code AS validationcode, f.included_tab_id, fg.fieldgrouptype, +fg.iscollapsedbydefault, COALESCE(f.infofactoryclass, c.infofactoryclass) AS infofactoryclass, c.isautocomplete, COALESCE(f.isallowcopy, c.isallowcopy) AS isallowcopy, f.isdisplayedgrid, +f.seqnogrid, c.seqnoselection, f.xposition, f.columnspan, f.numlines, COALESCE(f.istoolbarbutton, c.istoolbarbutton) AS istoolbarbutton, c.formatpattern, f.isadvancedfield, f.isdefaultfocus, +c.ad_chart_id, f.ad_labelstyle_id, f.ad_fieldstyle_id, c.pa_dashboardcontent_id + FROM ad_field f + JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id + LEFT JOIN ad_fieldgroup fg ON f.ad_fieldgroup_id = fg.ad_fieldgroup_id + LEFT JOIN ad_column c ON f.ad_column_id = c.ad_column_id + JOIN ad_table tbl ON c.ad_table_id = tbl.ad_table_id + LEFT JOIN ad_val_rule vr ON vr.ad_val_rule_id = COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) + WHERE f.isactive = 'Y' AND c.isactive = 'Y' +; + +CREATE OR REPLACE VIEW ad_field_vt AS + SELECT trl.ad_language, t.ad_window_id, f.ad_tab_id, f.ad_field_id, tbl.ad_table_id, f.ad_column_id, trl.name, trl.description, trl.help, f.isdisplayed, f.displaylogic, f.displaylength, f.seqno, + f.sortno, f.issameline, f.isheading, f.isfieldonly, f.isreadonly, f.isencrypted AS isencryptedfield, f.obscuretype, c.columnname, c.columnsql, c.fieldlength, c.vformat, COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue, + c.iskey, c.isparent, COALESCE(f.ismandatory, c.ismandatory) AS ismandatory, c.isidentifier, c.istranslated, COALESCE(f.ad_reference_value_id, c.ad_reference_value_id) AS ad_reference_value_id, + c.callout, COALESCE(f.ad_reference_id, c.ad_reference_id) AS ad_reference_id, COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) AS ad_val_rule_id, c.ad_process_id, COALESCE(f.isalwaysupdateable, + c.isalwaysupdateable) AS isalwaysupdateable, COALESCE(f.readonlylogic, c.readonlylogic) AS readonlylogic, COALESCE(f.mandatorylogic, c.mandatorylogic) AS mandatorylogic, COALESCE(f.isupdateable, c.isupdateable) AS isupdateable, + c.isencrypted AS isencryptedcolumn, c.isselectioncolumn, tbl.tablename, c.valuemin, c.valuemax, fgt.name AS fieldgroup, vr.code AS validationcode, f.included_tab_id, fg.fieldgrouptype, + fg.iscollapsedbydefault, COALESCE(f.infofactoryclass, c.infofactoryclass) AS infofactoryclass, c.isautocomplete, COALESCE(f.isallowcopy, c.isallowcopy) AS isallowcopy, f.isdisplayedgrid, + f.seqnogrid, c.seqnoselection, f.xposition, f.columnspan, f.numlines, COALESCE(f.istoolbarbutton, c.istoolbarbutton) AS istoolbarbutton, c.formatpattern, f.isadvancedfield, f.isdefaultfocus, c.ad_chart_id, f.ad_labelstyle_id, f.ad_fieldstyle_id, c.pa_dashboardcontent_id + FROM ad_field f + JOIN ad_field_trl trl ON f.ad_field_id = trl.ad_field_id + JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id + LEFT JOIN ad_fieldgroup fg ON f.ad_fieldgroup_id = fg.ad_fieldgroup_id + LEFT JOIN ad_fieldgroup_trl fgt ON f.ad_fieldgroup_id = fgt.ad_fieldgroup_id AND trl.ad_language::text = fgt.ad_language::text + LEFT JOIN ad_column c ON f.ad_column_id = c.ad_column_id + JOIN ad_table tbl ON c.ad_table_id = tbl.ad_table_id + LEFT JOIN ad_val_rule vr ON vr.ad_val_rule_id = COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) + WHERE f.isactive = 'Y' AND c.isactive = 'Y' +; + +SELECT register_migration_script('201605101800_System_Ticket_1006008.sql') FROM dual +; + + diff --git a/org.adempiere.base/src/org/compiere/model/GridField.java b/org.adempiere.base/src/org/compiere/model/GridField.java index a347161fad..8ef4e0bc87 100644 --- a/org.adempiere.base/src/org/compiere/model/GridField.java +++ b/org.adempiere.base/src/org/compiere/model/GridField.java @@ -2457,6 +2457,11 @@ public class GridField return m_vo.displayType == DisplayType.Button && MColumn.ISTOOLBARBUTTON_Toolbar.equals(m_vo.IsToolbarButton); } + public int getPA_DashboardContent_ID() + { + return m_vo.PA_DashboardContent_ID; + } + public GridField clone(Properties ctx) { try { diff --git a/org.adempiere.base/src/org/compiere/model/GridFieldVO.java b/org.adempiere.base/src/org/compiere/model/GridFieldVO.java index 38a2552b5a..e5ee17b1dc 100644 --- a/org.adempiere.base/src/org/compiere/model/GridFieldVO.java +++ b/org.adempiere.base/src/org/compiere/model/GridFieldVO.java @@ -234,6 +234,8 @@ public class GridFieldVO implements Serializable vo.AD_LabelStyle_ID = rs.getInt (i); else if (columnName.equalsIgnoreCase("AD_FieldStyle_ID")) vo.AD_FieldStyle_ID = rs.getInt (i); + else if (columnName.equalsIgnoreCase("PA_DashboardContent_ID")) + vo.PA_DashboardContent_ID = rs.getInt (i); } if (vo.Header == null) vo.Header = vo.ColumnName; @@ -671,6 +673,8 @@ public class GridFieldVO implements Serializable public int AD_FieldStyle_ID = 0; + public int PA_DashboardContent_ID = 0; + /** * Set Context including contained elements * @param newCtx new context @@ -802,6 +806,7 @@ public class GridFieldVO implements Serializable clone.IsDefaultFocus = IsDefaultFocus; clone.AD_FieldStyle_ID = AD_FieldStyle_ID; clone.AD_LabelStyle_ID = AD_LabelStyle_ID; + clone.PA_DashboardContent_ID = PA_DashboardContent_ID; // Lookup clone.ValidationCode = ValidationCode; diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_Column.java b/org.adempiere.base/src/org/compiere/model/I_AD_Column.java index bd9d80ac81..8823d4d5b8 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_Column.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_Column.java @@ -570,6 +570,17 @@ public interface I_AD_Column */ public String getName(); + /** Column name PA_DashboardContent_ID */ + public static final String COLUMNNAME_PA_DashboardContent_ID = "PA_DashboardContent_ID"; + + /** Set Dashboard Content */ + public void setPA_DashboardContent_ID (int PA_DashboardContent_ID); + + /** Get Dashboard Content */ + public int getPA_DashboardContent_ID(); + + public org.compiere.model.I_PA_DashboardContent getPA_DashboardContent() throws RuntimeException; + /** Column name ReadOnlyLogic */ public static final String COLUMNNAME_ReadOnlyLogic = "ReadOnlyLogic"; diff --git a/org.adempiere.base/src/org/compiere/model/SystemIDs.java b/org.adempiere.base/src/org/compiere/model/SystemIDs.java index a0c7b5ab33..9500ee8825 100644 --- a/org.adempiere.base/src/org/compiere/model/SystemIDs.java +++ b/org.adempiere.base/src/org/compiere/model/SystemIDs.java @@ -116,6 +116,7 @@ public class SystemIDs public final static int REFERENCE_DATATYPE_URL = 40; public final static int REFERENCE_DATATYPE_YES_NO = 20; public final static int REFERENCE_DATATYPE_CHART = 53370; + public final static int REFERENCE_DATATYPE_DASHBOARD_CONTENT = 200122; public final static int REFERENCE_AD_USER = 110; public final static int REFERENCE_DOCUMENTACTION = 135; diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_Column.java b/org.adempiere.base/src/org/compiere/model/X_AD_Column.java index 99122984f6..4fb8c1c90a 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_Column.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_Column.java @@ -32,7 +32,7 @@ public class X_AD_Column extends PO implements I_AD_Column, I_Persistent /** * */ - private static final long serialVersionUID = 20161030L; + private static final long serialVersionUID = 20161215L; /** Standard Constructor */ public X_AD_Column (Properties ctx, int AD_Column_ID, String trxName) @@ -924,6 +924,31 @@ public class X_AD_Column extends PO implements I_AD_Column, I_Persistent return (String)get_Value(COLUMNNAME_Name); } + public org.compiere.model.I_PA_DashboardContent getPA_DashboardContent() throws RuntimeException + { + return (org.compiere.model.I_PA_DashboardContent)MTable.get(getCtx(), org.compiere.model.I_PA_DashboardContent.Table_Name) + .getPO(getPA_DashboardContent_ID(), get_TrxName()); } + + /** Set Dashboard Content. + @param PA_DashboardContent_ID Dashboard Content */ + public void setPA_DashboardContent_ID (int PA_DashboardContent_ID) + { + if (PA_DashboardContent_ID < 1) + set_Value (COLUMNNAME_PA_DashboardContent_ID, null); + else + set_Value (COLUMNNAME_PA_DashboardContent_ID, Integer.valueOf(PA_DashboardContent_ID)); + } + + /** Get Dashboard Content. + @return Dashboard Content */ + public int getPA_DashboardContent_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_PA_DashboardContent_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + /** Set Read Only Logic. @param ReadOnlyLogic Logic to determine if field is read only (applies only when field is read-write) @@ -1051,4 +1076,4 @@ public class X_AD_Column extends PO implements I_AD_Column, I_Persistent { return (String)get_Value(COLUMNNAME_VFormat); } -} \ No newline at end of file +} diff --git a/org.adempiere.base/src/org/compiere/util/DisplayType.java b/org.adempiere.base/src/org/compiere/util/DisplayType.java index 0c639249dc..6ea07bca94 100644 --- a/org.adempiere.base/src/org/compiere/util/DisplayType.java +++ b/org.adempiere.base/src/org/compiere/util/DisplayType.java @@ -50,6 +50,7 @@ import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_TIME; import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_URL; import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_YES_NO; import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_CHART; +import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_DASHBOARD_CONTENT; import java.text.DateFormat; import java.text.DecimalFormat; @@ -144,6 +145,8 @@ public final class DisplayType public static final int Payment = REFERENCE_DATATYPE_PAYMENT; public static final int Chart = REFERENCE_DATATYPE_CHART; + + public static final int DashboardContent = REFERENCE_DATATYPE_DASHBOARD_CONTENT; /** * - New Display Type diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DashboardController.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DashboardController.java index 7b87d3256d..bb0e74a0a3 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DashboardController.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DashboardController.java @@ -211,197 +211,7 @@ public class DashboardController implements EventListener { boolean panelEmpty = true; - // HTML content - String htmlContent = dc.get_Translation(MDashboardContent.COLUMNNAME_HTML); - if(htmlContent != null) - { - StringBuilder result = new StringBuilder(""); - - URL url = getClass().getClassLoader().getResource("org/compiere/css/PAPanel.css"); - InputStreamReader ins; - BufferedReader bufferedReader = null; - try { - ins = new InputStreamReader(url.openStream()); - bufferedReader = new BufferedReader( ins ); - String cssLine; - result.append(""); - } catch (Exception e1) { - logger.log(Level.SEVERE, e1.getLocalizedMessage(), e1); - } - finally{ - if (bufferedReader != null) { - try { - bufferedReader.close(); - } catch (Exception e) {} - bufferedReader = null; - } - } - result.append("
\n"); - -// if(description != null) -// result.append("

" + description + "

\n"); - result.append(stripHtml(htmlContent, false) + "
\n"); - result.append("
\n\n"); - - Html html = new Html(); - html.setContent(result.toString()); - content.appendChild(html); - panelEmpty = false; - } - - // Window - int AD_Window_ID = dc.getAD_Window_ID(); - if(AD_Window_ID > 0) - { - int AD_Menu_ID = dc.getAD_Menu_ID(); - Div div = new Div(); - ToolBarButton btn = new ToolBarButton(String.valueOf(AD_Menu_ID)); - I_AD_Menu menu = dc.getAD_Menu(); - btn.setLabel(menu.getName()); - btn.setAttribute("AD_Menu_ID", AD_Menu_ID); - btn.addEventListener(Events.ON_CLICK, this); - div.appendChild(btn); - content.appendChild(div); - panelEmpty = false; - } - - //Report & Process - int AD_Process_ID = dc.getAD_Process_ID(); - if(AD_Process_ID > 0) - { - String sql = "SELECT AD_MENU_ID FROM AD_MENU WHERE AD_Process_ID=?"; - int AD_Menu_ID = DB.getSQLValue(null, sql, AD_Process_ID); - ToolBarButton btn = new ToolBarButton(); - MMenu menu = new MMenu(Env.getCtx(), AD_Menu_ID, null); - btn.setAttribute("AD_Menu_ID", AD_Menu_ID); - btn.addEventListener(Events.ON_CLICK, this); - panelEmpty = false; - - if (dc.isEmbedReportContent()) - { - String processParameters = dc.getProcessParameters(); - embedReport(content, AD_Process_ID, processParameters); - - Toolbar toolbar = new Toolbar(); - content.appendChild(toolbar); - btn.setLabel("Open run dialog"); - toolbar.appendChild(btn); - - btn = new ToolBarButton(); - btn.setAttribute("AD_Process_ID", AD_Process_ID); - btn.setAttribute("ProcessParameters", processParameters); - btn.addEventListener(Events.ON_CLICK, this); - btn.setLabel("View report in new tab"); - toolbar.appendChild(new Separator("vertical")); - toolbar.appendChild(btn); - } - else - { - btn.setLabel(menu.getName()); - content.appendChild(btn); - } - } - - // Goal - int PA_Goal_ID = dc.getPA_Goal_ID(); - if(PA_Goal_ID > 0) - { - //link to open performance detail - Div div = new Div(); - Toolbarbutton link = new Toolbarbutton(); - link.setImage(ThemeManager.getThemeResource("images/Zoom16.png")); - link.setAttribute("PA_Goal_ID", PA_Goal_ID); - link.addEventListener(Events.ON_CLICK, new EventListener() { - public void onEvent(Event event) throws Exception { - int PA_Goal_ID = (Integer)event.getTarget().getAttribute("PA_Goal_ID"); - MGoal goal = new MGoal(Env.getCtx(), PA_Goal_ID, null); - new WPerformanceDetail(goal); - } - }); - div.appendChild(link); - content.appendChild(div); - - String goalDisplay = dc.getGoalDisplay(); - MGoal goal = new MGoal(Env.getCtx(), PA_Goal_ID, null); - WGraph graph = new WGraph(goal, 55, false, true, - !(MDashboardContent.GOALDISPLAY_Chart.equals(goalDisplay)), - MDashboardContent.GOALDISPLAY_Chart.equals(goalDisplay)); - content.appendChild(graph); - panelEmpty = false; - } - - // ZUL file url - String url = dc.getZulFilePath(); - if(url != null) - { - try { - - Component component = null; - List f = Service.locator().list(IDashboardGadgetFactory.class).getServices(); - for (IDashboardGadgetFactory factory : f) { - component = factory.getGadget(url.toString(),content); - if(component != null) - break; - } - - if(component != null) - { - if (component instanceof Include) - component = component.getFirstChild(); - - if (component instanceof DashboardPanel) - { - DashboardPanel dashboardPanel = (DashboardPanel) component; - if (!dashboardPanel.getChildren().isEmpty()) { - content.appendChild(dashboardPanel); - dashboardRunnable.add(dashboardPanel); - panelEmpty = false; - } - } - else - { - content.appendChild(component); - panelEmpty = false; - } - } - } catch (Exception e) { - logger.log(Level.WARNING, "Failed to create components. zul="+url, e); - throw new AdempiereException(e); - } - } - - //chart - final int AD_Chart_ID = dc.getAD_Chart_ID(); - if (AD_Chart_ID > 0) { - final Div chartPanel = new Div(); - chartPanel.setSclass("chart-gadget"); - final MChart chartModel = new MChart(Env.getCtx(), AD_Chart_ID, null); - content.appendChild(chartPanel); - panelEmpty = false; - chartPanel.addEventListener(Events.ON_AFTER_SIZE, new EventListener() { - @Override - public void onEvent(AfterSizeEvent event) throws Exception { - int width = event.getWidth()*90/100; - int height = event.getHeight(); - //set normal height - if (height == 0) { - height = width * 85 / 100; - ZKUpdateUtil.setHeight(chartPanel, height+"px"); - } - chartPanel.getChildren().clear(); - ChartModel model = new ChartModel(); - model.chart = chartModel; - List list = Service.locator().list(IChartRendererService.class).getServices(); - for (IChartRendererService renderer : list) { - if (renderer.renderChart(chartPanel, width, height, model)) - break; - } - } - }); - } + panelEmpty = !render(content, dc, dashboardRunnable); if (panelEmpty) panel.detach(); @@ -467,6 +277,205 @@ public class DashboardController implements EventListener { } } + public boolean render(Component content, MDashboardContent dc, DashboardRunnable dashboardRunnable) throws Exception { + boolean empty = true; + + // HTML content + String htmlContent = dc.get_Translation(MDashboardContent.COLUMNNAME_HTML); + if(htmlContent != null) + { + StringBuilder result = new StringBuilder(""); + + URL url = getClass().getClassLoader().getResource("org/compiere/css/PAPanel.css"); + InputStreamReader ins; + BufferedReader bufferedReader = null; + try { + ins = new InputStreamReader(url.openStream()); + bufferedReader = new BufferedReader( ins ); + String cssLine; + result.append(""); + } catch (Exception e1) { + logger.log(Level.SEVERE, e1.getLocalizedMessage(), e1); + } + finally{ + if (bufferedReader != null) { + try { + bufferedReader.close(); + } catch (Exception e) {} + bufferedReader = null; + } + } + result.append("
\n"); + +// if(description != null) +// result.append("

" + description + "

\n"); + result.append(stripHtml(htmlContent, false) + "
\n"); + result.append("
\n\n"); + + Html html = new Html(); + html.setContent(result.toString()); + content.appendChild(html); + empty = false; + } + + // Window + int AD_Window_ID = dc.getAD_Window_ID(); + if(AD_Window_ID > 0) + { + int AD_Menu_ID = dc.getAD_Menu_ID(); + Div div = new Div(); + ToolBarButton btn = new ToolBarButton(String.valueOf(AD_Menu_ID)); + I_AD_Menu menu = dc.getAD_Menu(); + btn.setLabel(menu.getName()); + btn.setAttribute("AD_Menu_ID", AD_Menu_ID); + btn.addEventListener(Events.ON_CLICK, this); + div.appendChild(btn); + content.appendChild(div); + empty = false; + } + + //Report & Process + int AD_Process_ID = dc.getAD_Process_ID(); + if(AD_Process_ID > 0) + { + String sql = "SELECT AD_MENU_ID FROM AD_MENU WHERE AD_Process_ID=?"; + int AD_Menu_ID = DB.getSQLValue(null, sql, AD_Process_ID); + ToolBarButton btn = new ToolBarButton(); + MMenu menu = new MMenu(Env.getCtx(), AD_Menu_ID, null); + btn.setAttribute("AD_Menu_ID", AD_Menu_ID); + btn.addEventListener(Events.ON_CLICK, this); + empty = false; + + if (dc.isEmbedReportContent()) + { + String processParameters = dc.getProcessParameters(); + embedReport(content, AD_Process_ID, processParameters); + + Toolbar toolbar = new Toolbar(); + content.appendChild(toolbar); + btn.setLabel("Open run dialog"); + toolbar.appendChild(btn); + + btn = new ToolBarButton(); + btn.setAttribute("AD_Process_ID", AD_Process_ID); + btn.setAttribute("ProcessParameters", processParameters); + btn.addEventListener(Events.ON_CLICK, this); + btn.setLabel("View report in new tab"); + toolbar.appendChild(new Separator("vertical")); + toolbar.appendChild(btn); + } + else + { + btn.setLabel(menu.getName()); + content.appendChild(btn); + } + } + + // Goal + int PA_Goal_ID = dc.getPA_Goal_ID(); + if(PA_Goal_ID > 0) + { + //link to open performance detail + Div div = new Div(); + Toolbarbutton link = new Toolbarbutton(); + link.setImage(ThemeManager.getThemeResource("images/Zoom16.png")); + link.setAttribute("PA_Goal_ID", PA_Goal_ID); + link.addEventListener(Events.ON_CLICK, new EventListener() { + public void onEvent(Event event) throws Exception { + int PA_Goal_ID = (Integer)event.getTarget().getAttribute("PA_Goal_ID"); + MGoal goal = new MGoal(Env.getCtx(), PA_Goal_ID, null); + new WPerformanceDetail(goal); + } + }); + div.appendChild(link); + content.appendChild(div); + + String goalDisplay = dc.getGoalDisplay(); + MGoal goal = new MGoal(Env.getCtx(), PA_Goal_ID, null); + WGraph graph = new WGraph(goal, 55, false, true, + !(MDashboardContent.GOALDISPLAY_Chart.equals(goalDisplay)), + MDashboardContent.GOALDISPLAY_Chart.equals(goalDisplay)); + content.appendChild(graph); + empty = false; + } + + // ZUL file url + String url = dc.getZulFilePath(); + if(url != null) + { + try { + + Component component = null; + List f = Service.locator().list(IDashboardGadgetFactory.class).getServices(); + for (IDashboardGadgetFactory factory : f) { + component = factory.getGadget(url.toString(),content); + if(component != null) + break; + } + + if(component != null) + { + if (component instanceof Include) + component = component.getFirstChild(); + + if (component instanceof DashboardPanel) + { + DashboardPanel dashboardPanel = (DashboardPanel) component; + if (!dashboardPanel.getChildren().isEmpty()) { + content.appendChild(dashboardPanel); + if (dashboardRunnable != null) + dashboardRunnable.add(dashboardPanel); + empty = false; + } + } + else + { + content.appendChild(component); + empty = false; + } + } + } catch (Exception e) { + logger.log(Level.WARNING, "Failed to create components. zul="+url, e); + throw new AdempiereException(e); + } + } + + //chart + final int AD_Chart_ID = dc.getAD_Chart_ID(); + if (AD_Chart_ID > 0) { + final Div chartPanel = new Div(); + chartPanel.setSclass("chart-gadget"); + final MChart chartModel = new MChart(Env.getCtx(), AD_Chart_ID, null); + content.appendChild(chartPanel); + empty = false; + chartPanel.addEventListener(Events.ON_AFTER_SIZE, new EventListener() { + @Override + public void onEvent(AfterSizeEvent event) throws Exception { + int width = event.getWidth()*90/100; + int height = event.getHeight(); + //set normal height + if (height == 0) { + height = width * 85 / 100; + chartPanel.setHeight(height+"px"); + } + chartPanel.getChildren().clear(); + ChartModel model = new ChartModel(); + model.chart = chartModel; + List list = Service.locator().list(IChartRendererService.class).getServices(); + for (IChartRendererService renderer : list) { + if (renderer.renderChart(chartPanel, width, height, model)) + break; + } + } + }); + } + + return !empty; + } + public void onEvent(Event event) throws Exception { Component comp = event.getTarget(); String eventName = event.getName(); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WChartEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WChartEditor.java index 5a2d19b9cf..b472da5636 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WChartEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WChartEditor.java @@ -23,8 +23,10 @@ import org.compiere.model.GridField; import org.compiere.model.MChart; import org.compiere.util.CLogger; import org.compiere.util.Env; +import org.zkoss.zk.ui.event.AfterSizeEvent; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Events; +import org.zkoss.zul.Div; import org.zkoss.zul.Panel; import org.zkoss.zul.Panelchildren; @@ -40,6 +42,12 @@ public class WChartEditor extends WEditor private static final String[] LISTENER_EVENTS = {Events.ON_CLICK}; private MChart chartModel = null; + + private int chartWidth; + + private int chartHeight; + + private Div chartDiv; /** Logger */ @SuppressWarnings("unused") @@ -54,21 +62,16 @@ public class WChartEditor extends WEditor } private void createChart() { - Panel panel = getComponent(); - if (panel.getPanelchildren() != null) { - panel.getPanelchildren().getChildren().clear(); - } else { - Panelchildren pc = new Panelchildren(); - panel.appendChild(pc); - pc.setSclass("chart-field"); - } - ChartModel model = new ChartModel(); - model.chart = chartModel; - List list = Service.locator().list(IChartRendererService.class).getServices(); - for (IChartRendererService renderer : list) { - if (renderer.renderChart(panel.getPanelchildren(), 400, chartModel.getWinHeight(), model)) - break; - } + if (chartHeight > 0 && chartWidth > 0) { + chartDiv.getChildren().clear(); + ChartModel model = new ChartModel(); + model.chart = chartModel; + List list = Service.locator().list(IChartRendererService.class).getServices(); + for (IChartRendererService renderer : list) { + if (renderer.renderChart(chartDiv, chartWidth, chartHeight, model)) + break; + } + } } @Override @@ -77,10 +80,16 @@ public class WChartEditor extends WEditor } private void init() - { + { + Panelchildren pc = new Panelchildren(); + getComponent().appendChild(pc); + pc.setSclass("chart-field"); + chartDiv = new Div(); + chartDiv.addEventListener(Events.ON_AFTER_SIZE, this); + pc.appendChild(chartDiv); } - @Override + @Override public String getDisplay() { return chartModel.get_Translation(MChart.COLUMNNAME_Name); @@ -129,6 +138,30 @@ public class WChartEditor extends WEditor public void onEvent(Event event) throws Exception { + if (event instanceof AfterSizeEvent) + { + AfterSizeEvent ase = (AfterSizeEvent) event; + chartWidth = ase.getWidth(); + if (chartWidth == 0) { + chartWidth = 400; + } + chartHeight = 0; + if (chartDiv.getStyle() != null && chartDiv.getStyle().contains("height")) + chartHeight = ase.getHeight(); + //set default height + if (chartHeight == 0) { + chartHeight = chartModel.getWinHeight(); + chartDiv.setHeight(chartHeight+"px"); + } + chartDiv.getChildren().clear(); + ChartModel model = new ChartModel(); + model.chart = chartModel; + List list = Service.locator().list(IChartRendererService.class).getServices(); + for (IChartRendererService renderer : list) { + if (renderer.renderChart(chartDiv, chartWidth, chartHeight, model)) + break; + } + } } @Override @@ -136,4 +169,12 @@ public class WChartEditor extends WEditor super.dynamicDisplay(); createChart(); } + + /* (non-Javadoc) + * @see org.adempiere.webui.editor.WEditor#setFieldStyle(java.lang.String) + */ + @Override + protected void setFieldStyle(String style) { + chartDiv.setStyle(style); + } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WDashboardContentEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WDashboardContentEditor.java new file mode 100644 index 0000000000..3cc1122f19 --- /dev/null +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WDashboardContentEditor.java @@ -0,0 +1,141 @@ +/** + * + */ +package org.adempiere.webui.editor; + +import java.util.logging.Level; + +import org.adempiere.webui.dashboard.DashboardRunnable; +import org.adempiere.webui.desktop.DashboardController; +import org.compiere.model.GridField; +import org.compiere.model.MDashboardContent; +import org.compiere.util.CLogger; +import org.compiere.util.Env; +import org.compiere.util.Util; +import org.zkoss.zk.ui.event.Event; +import org.zkoss.zk.ui.event.Events; +import org.zkoss.zul.Caption; +import org.zkoss.zul.Div; +import org.zkoss.zul.Panel; +import org.zkoss.zul.Panelchildren; + +/** + * @author hengsin + * + */ +public class WDashboardContentEditor extends WEditor { + + private static final String ON_RENDER_CONTENT = "onRenderContent"; + private DashboardController dashboardController; + private MDashboardContent content; + private String fieldStyle; + + private final static CLogger logger = CLogger.getCLogger(WDashboardContentEditor.class); + + /** + * @param comp + * @param gridField + */ + public WDashboardContentEditor(GridField gridField, int windowNo) { + super(new Panel(), gridField); + dashboardController = new DashboardController(); + content = new MDashboardContent(Env.getCtx(), gridField.getPA_DashboardContent_ID(), null); + Panelchildren pc = new Panelchildren(); + getComponent().appendChild(pc); + + Caption caption = new Caption(content.get_Translation(MDashboardContent.COLUMNNAME_Name)); + getComponent().appendChild(caption); + getComponent().addEventListener(ON_RENDER_CONTENT, this); + } + + /* (non-Javadoc) + * @see org.zkoss.zk.ui.event.EventListener#onEvent(org.zkoss.zk.ui.event.Event) + */ + @Override + public void onEvent(Event event) throws Exception { + if (event.getName().equals(ON_RENDER_CONTENT)) { + try { + render(); + } catch (Exception e) { + logger.log(Level.SEVERE, e.getLocalizedMessage(), e); + } + } + } + + /* (non-Javadoc) + * @see org.adempiere.webui.editor.WEditor#setReadWrite(boolean) + */ + @Override + public void setReadWrite(boolean readWrite) { + } + + /* (non-Javadoc) + * @see org.adempiere.webui.editor.WEditor#isReadWrite() + */ + @Override + public boolean isReadWrite() { + return false; + } + + /* (non-Javadoc) + * @see org.adempiere.webui.editor.WEditor#setValue(java.lang.Object) + */ + @Override + public void setValue(Object value) { + } + + /* (non-Javadoc) + * @see org.adempiere.webui.editor.WEditor#getValue() + */ + @Override + public Object getValue() { + return null; + } + + /* (non-Javadoc) + * @see org.adempiere.webui.editor.WEditor#getDisplay() + */ + @Override + public String getDisplay() { + return null; + } + + @Override + public void dynamicDisplay() { + super.dynamicDisplay(); + Events.postEvent(ON_RENDER_CONTENT, getComponent(), null); + } + + /* (non-Javadoc) + * @see org.adempiere.webui.editor.WEditor#getComponent() + */ + @Override + public Panel getComponent() { + return (Panel) super.getComponent(); + } + + private void render() throws Exception { + Panel panel = getComponent(); + Panelchildren pc = panel.getPanelchildren(); + pc.getChildren().clear(); + Div div = new Div(); + if (!Util.isEmpty(fieldStyle)) + div.setStyle(fieldStyle); + + DashboardRunnable dashboardRunnable = new DashboardRunnable(panel.getDesktop()); + dashboardController.render(div, content, dashboardRunnable); + if (!dashboardRunnable.isEmpty()) + dashboardRunnable.refreshDashboard(false); + + pc.appendChild(div); + } + + /* (non-Javadoc) + * @see org.adempiere.webui.editor.WEditor#setFieldStyle(java.lang.String) + */ + @Override + protected void setFieldStyle(String style) { + fieldStyle = style; + } + +} diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/DefaultEditorFactory.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/DefaultEditorFactory.java index 31ac92e67e..21d6e8fb51 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/DefaultEditorFactory.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/DefaultEditorFactory.java @@ -18,6 +18,7 @@ import org.adempiere.webui.editor.WAssignmentEditor; import org.adempiere.webui.editor.WBinaryEditor; import org.adempiere.webui.editor.WButtonEditor; import org.adempiere.webui.editor.WChartEditor; +import org.adempiere.webui.editor.WDashboardContentEditor; import org.adempiere.webui.editor.WDateEditor; import org.adempiere.webui.editor.WDatetimeEditor; import org.adempiere.webui.editor.WEditor; @@ -126,6 +127,12 @@ public class DefaultEditorFactory implements IEditorFactory { editor = new WChartEditor(gridField, (gridTab == null ? 0 : gridTab.getWindowNo())); } + /** Dashboard Content */ + else if(displayType == DisplayType.DashboardContent) + { + editor = new WDashboardContentEditor(gridField, (gridTab == null ? 0 : gridTab.getWindowNo())); + } + /** Button */ else if (displayType == DisplayType.Button) { From 146af78c0533bffbbc6ebc221bf7f686565d3bb0 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Mon, 23 May 2016 21:11:38 +0800 Subject: [PATCH 07/22] 1006008 Add field type for dashboard content. (IDEMPIERE-3270) --- .../oracle/201605231800_Ticket_1006008.sql | 72 +++++++++++++++++++ .../201605231800_Ticket_1006008.sql | 69 ++++++++++++++++++ .../src/org/compiere/model/GridFieldVO.java | 3 + .../compiere/model/I_AD_UserDef_Field.java | 11 +++ .../compiere/model/X_AD_UserDef_Field.java | 29 +++++++- 5 files changed, 182 insertions(+), 2 deletions(-) create mode 100644 migration/i3.1/oracle/201605231800_Ticket_1006008.sql create mode 100644 migration/i3.1/postgresql/201605231800_Ticket_1006008.sql diff --git a/migration/i3.1/oracle/201605231800_Ticket_1006008.sql b/migration/i3.1/oracle/201605231800_Ticket_1006008.sql new file mode 100644 index 0000000000..4d70f1f5b4 --- /dev/null +++ b/migration/i3.1/oracle/201605231800_Ticket_1006008.sql @@ -0,0 +1,72 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- May 23, 2016 6:17:30 PM MYT +-- 1006008 Add field type for dashboard content +INSERT INTO AD_Column (AD_Column_ID,SeqNoSelection,IsSyncDatabase,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,Updated,IsUpdateable,ColumnName,Name,IsAllowCopy,IsActive,CreatedBy,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,AD_Org_ID,Created,EntityType,IsEncrypted,IsSecure,FKConstraintType,AD_Element_ID,AD_Reference_ID,AD_Table_ID) VALUES (212763,0,'N',0,'N','N','N',0,'N',22,'N','N','N','Y','84c773d0-4cdf-45e0-a0cd-0ce63907e53d',TO_DATE('2016-05-23 18:17:24','YYYY-MM-DD HH24:MI:SS'),'N','PA_DashboardContent_ID','Dashboard Content','Y','Y',100,100,'N','N',0,0,TO_DATE('2016-05-23 18:17:24','YYYY-MM-DD HH24:MI:SS'),'U','N','N','N',51006,19,464) +; + +-- May 23, 2016 6:25:24 PM MYT +UPDATE AD_Column SET EntityType='D',Updated=TO_DATE('2016-05-23 18:25:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212763 +; + +-- May 23, 2016 6:28:36 PM MYT +INSERT INTO AD_Field (SortNo,AD_Field_ID,IsEncrypted,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,IsReadOnly,DisplayLogic,AD_Org_ID,Updated,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,CreatedBy,UpdatedBy,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,IsQuickEntry,AD_Client_ID,Created,ColumnSpan,NumLines,IsAdvancedField,IsDefaultFocus,AD_Column_ID,EntityType,AD_Tab_ID) VALUES (0,204221,'N',0,'N','N',300,'Y','N','@AD_Reference_ID@=200122',0,TO_DATE('2016-05-23 18:28:29','YYYY-MM-DD HH24:MI:SS'),'Dashboard Content','f6d15a90-273e-4810-866d-6a1842a23c32','Y','N',100,100,'Y','Y',280,1,'N',0,TO_DATE('2016-05-23 18:28:29','YYYY-MM-DD HH24:MI:SS'),1,1,'N','N',212763,'D',395) +; + +-- May 23, 2016 6:29:09 PM MYT +UPDATE AD_Field SET ColumnSpan=2,Updated=TO_DATE('2016-05-23 18:29:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204221 +; + +-- May 23, 2016 6:29:31 PM MYT +UPDATE AD_Field SET SeqNo=230,IsDisplayed='Y' WHERE AD_Field_ID=204221 +; + +-- May 23, 2016 6:29:31 PM MYT +UPDATE AD_Field SET SeqNo=240,IsDisplayed='Y' WHERE AD_Field_ID=5054 +; + +-- May 23, 2016 6:29:31 PM MYT +UPDATE AD_Field SET SeqNo=250,IsDisplayed='Y' WHERE AD_Field_ID=200849 +; + +-- May 23, 2016 6:29:32 PM MYT +UPDATE AD_Field SET SeqNo=260,IsDisplayed='Y' WHERE AD_Field_ID=200851 +; + +-- May 23, 2016 6:29:32 PM MYT +UPDATE AD_Field SET SeqNo=270,IsDisplayed='Y' WHERE AD_Field_ID=200852 +; + +-- May 23, 2016 6:29:32 PM MYT +UPDATE AD_Field SET SeqNo=280,IsDisplayed='Y' WHERE AD_Field_ID=200854 +; + +-- May 23, 2016 6:29:32 PM MYT +UPDATE AD_Field SET SeqNo=290,IsDisplayed='Y' WHERE AD_Field_ID=5051 +; + +-- May 23, 2016 6:29:32 PM MYT +UPDATE AD_Field SET SeqNo=300,IsDisplayed='Y' WHERE AD_Field_ID=5057 +; + +-- May 23, 2016 8:25:15 PM MYT +-- 1006008 Add field type for dashboard content +UPDATE AD_Column SET FKConstraintType='N', FKConstraintName='PADashboardContent_ADUserDefFi',Updated=TO_DATE('2016-05-23 20:25:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212763 +; + +-- May 23, 2016 8:25:15 PM MYT +ALTER TABLE AD_UserDef_Field ADD PA_DashboardContent_ID NUMBER(10) DEFAULT NULL +; + +-- May 23, 2016 8:25:16 PM MYT +ALTER TABLE AD_UserDef_Field ADD CONSTRAINT PADashboardContent_ADUserDefFi FOREIGN KEY (PA_DashboardContent_ID) REFERENCES pa_dashboardcontent(pa_dashboardcontent_id) DEFERRABLE INITIALLY DEFERRED +; + +-- May 23, 2016 8:49:33 PM MYT +UPDATE AD_Column SET IsUpdateable='Y',Updated=TO_DATE('2016-05-23 20:49:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212763 +; + +SELECT register_migration_script('201605231800_Ticket_1006008') FROM dual +; + diff --git a/migration/i3.1/postgresql/201605231800_Ticket_1006008.sql b/migration/i3.1/postgresql/201605231800_Ticket_1006008.sql new file mode 100644 index 0000000000..1fb4b118fb --- /dev/null +++ b/migration/i3.1/postgresql/201605231800_Ticket_1006008.sql @@ -0,0 +1,69 @@ +-- May 23, 2016 6:17:30 PM MYT +-- 1006008 Add field type for dashboard content +INSERT INTO AD_Column (AD_Column_ID,SeqNoSelection,IsSyncDatabase,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,Updated,IsUpdateable,ColumnName,Name,IsAllowCopy,IsActive,CreatedBy,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,AD_Org_ID,Created,EntityType,IsEncrypted,IsSecure,FKConstraintType,AD_Element_ID,AD_Reference_ID,AD_Table_ID) VALUES (212763,0,'N',0,'N','N','N',0,'N',22,'N','N','N','Y','84c773d0-4cdf-45e0-a0cd-0ce63907e53d',TO_TIMESTAMP('2016-05-23 18:17:24','YYYY-MM-DD HH24:MI:SS'),'N','PA_DashboardContent_ID','Dashboard Content','Y','Y',100,100,'N','N',0,0,TO_TIMESTAMP('2016-05-23 18:17:24','YYYY-MM-DD HH24:MI:SS'),'U','N','N','N',51006,19,464) +; + +-- May 23, 2016 6:25:24 PM MYT +UPDATE AD_Column SET EntityType='D',Updated=TO_TIMESTAMP('2016-05-23 18:25:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212763 +; + +-- May 23, 2016 6:28:36 PM MYT +INSERT INTO AD_Field (SortNo,AD_Field_ID,IsEncrypted,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,IsReadOnly,DisplayLogic,AD_Org_ID,Updated,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,CreatedBy,UpdatedBy,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,IsQuickEntry,AD_Client_ID,Created,ColumnSpan,NumLines,IsAdvancedField,IsDefaultFocus,AD_Column_ID,EntityType,AD_Tab_ID) VALUES (0,204221,'N',0,'N','N',300,'Y','N','@AD_Reference_ID@=200122',0,TO_TIMESTAMP('2016-05-23 18:28:29','YYYY-MM-DD HH24:MI:SS'),'Dashboard Content','f6d15a90-273e-4810-866d-6a1842a23c32','Y','N',100,100,'Y','Y',280,1,'N',0,TO_TIMESTAMP('2016-05-23 18:28:29','YYYY-MM-DD HH24:MI:SS'),1,1,'N','N',212763,'D',395) +; + +-- May 23, 2016 6:29:09 PM MYT +UPDATE AD_Field SET ColumnSpan=2,Updated=TO_TIMESTAMP('2016-05-23 18:29:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204221 +; + +-- May 23, 2016 6:29:31 PM MYT +UPDATE AD_Field SET SeqNo=230,IsDisplayed='Y' WHERE AD_Field_ID=204221 +; + +-- May 23, 2016 6:29:31 PM MYT +UPDATE AD_Field SET SeqNo=240,IsDisplayed='Y' WHERE AD_Field_ID=5054 +; + +-- May 23, 2016 6:29:31 PM MYT +UPDATE AD_Field SET SeqNo=250,IsDisplayed='Y' WHERE AD_Field_ID=200849 +; + +-- May 23, 2016 6:29:32 PM MYT +UPDATE AD_Field SET SeqNo=260,IsDisplayed='Y' WHERE AD_Field_ID=200851 +; + +-- May 23, 2016 6:29:32 PM MYT +UPDATE AD_Field SET SeqNo=270,IsDisplayed='Y' WHERE AD_Field_ID=200852 +; + +-- May 23, 2016 6:29:32 PM MYT +UPDATE AD_Field SET SeqNo=280,IsDisplayed='Y' WHERE AD_Field_ID=200854 +; + +-- May 23, 2016 6:29:32 PM MYT +UPDATE AD_Field SET SeqNo=290,IsDisplayed='Y' WHERE AD_Field_ID=5051 +; + +-- May 23, 2016 6:29:32 PM MYT +UPDATE AD_Field SET SeqNo=300,IsDisplayed='Y' WHERE AD_Field_ID=5057 +; + +-- May 23, 2016 8:25:15 PM MYT +-- 1006008 Add field type for dashboard content +UPDATE AD_Column SET FKConstraintType='N', FKConstraintName='PADashboardContent_ADUserDefFi',Updated=TO_TIMESTAMP('2016-05-23 20:25:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212763 +; + +-- May 23, 2016 8:25:15 PM MYT +ALTER TABLE AD_UserDef_Field ADD COLUMN PA_DashboardContent_ID NUMERIC(10) DEFAULT NULL +; + +-- May 23, 2016 8:25:16 PM MYT +ALTER TABLE AD_UserDef_Field ADD CONSTRAINT PADashboardContent_ADUserDefFi FOREIGN KEY (PA_DashboardContent_ID) REFERENCES pa_dashboardcontent(pa_dashboardcontent_id) DEFERRABLE INITIALLY DEFERRED +; + +-- May 23, 2016 8:49:33 PM MYT +UPDATE AD_Column SET IsUpdateable='Y',Updated=TO_TIMESTAMP('2016-05-23 20:49:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212763 +; + +SELECT register_migration_script('201605231800_Ticket_1006008') FROM dual +; + diff --git a/org.adempiere.base/src/org/compiere/model/GridFieldVO.java b/org.adempiere.base/src/org/compiere/model/GridFieldVO.java index e5ee17b1dc..beb4e2c961 100644 --- a/org.adempiere.base/src/org/compiere/model/GridFieldVO.java +++ b/org.adempiere.base/src/org/compiere/model/GridFieldVO.java @@ -318,6 +318,9 @@ public class GridFieldVO implements Serializable if (userDef.getAD_FieldStyle_ID() > 0) vo.AD_FieldStyle_ID = userDef.getAD_FieldStyle_ID(); + + if (userDef.getPA_DashboardContent_ID() > 0) + vo.PA_DashboardContent_ID = userDef.getPA_DashboardContent_ID(); } } // diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_UserDef_Field.java b/org.adempiere.base/src/org/compiere/model/I_AD_UserDef_Field.java index 3d564e8455..13758d1c7e 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_UserDef_Field.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_UserDef_Field.java @@ -416,6 +416,17 @@ public interface I_AD_UserDef_Field */ public int getNumLines(); + /** Column name PA_DashboardContent_ID */ + public static final String COLUMNNAME_PA_DashboardContent_ID = "PA_DashboardContent_ID"; + + /** Set Dashboard Content */ + public void setPA_DashboardContent_ID (int PA_DashboardContent_ID); + + /** Get Dashboard Content */ + public int getPA_DashboardContent_ID(); + + public org.compiere.model.I_PA_DashboardContent getPA_DashboardContent() throws RuntimeException; + /** Column name ReadOnlyLogic */ public static final String COLUMNNAME_ReadOnlyLogic = "ReadOnlyLogic"; diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_UserDef_Field.java b/org.adempiere.base/src/org/compiere/model/X_AD_UserDef_Field.java index e4179b1e3a..abca5dab54 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_UserDef_Field.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_UserDef_Field.java @@ -30,7 +30,7 @@ public class X_AD_UserDef_Field extends PO implements I_AD_UserDef_Field, I_Pers /** * */ - private static final long serialVersionUID = 20161030L; + private static final long serialVersionUID = 20161215L; /** Standard Constructor */ public X_AD_UserDef_Field (Properties ctx, int AD_UserDef_Field_ID, String trxName) @@ -638,6 +638,31 @@ public class X_AD_UserDef_Field extends PO implements I_AD_UserDef_Field, I_Pers return ii.intValue(); } + public org.compiere.model.I_PA_DashboardContent getPA_DashboardContent() throws RuntimeException + { + return (org.compiere.model.I_PA_DashboardContent)MTable.get(getCtx(), org.compiere.model.I_PA_DashboardContent.Table_Name) + .getPO(getPA_DashboardContent_ID(), get_TrxName()); } + + /** Set Dashboard Content. + @param PA_DashboardContent_ID Dashboard Content */ + public void setPA_DashboardContent_ID (int PA_DashboardContent_ID) + { + if (PA_DashboardContent_ID < 1) + set_Value (COLUMNNAME_PA_DashboardContent_ID, null); + else + set_Value (COLUMNNAME_PA_DashboardContent_ID, Integer.valueOf(PA_DashboardContent_ID)); + } + + /** Get Dashboard Content. + @return Dashboard Content */ + public int getPA_DashboardContent_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_PA_DashboardContent_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + /** Set Read Only Logic. @param ReadOnlyLogic Logic to determine if field is read only (applies only when field is read-write) @@ -731,4 +756,4 @@ public class X_AD_UserDef_Field extends PO implements I_AD_UserDef_Field, I_Pers return 0; return ii.intValue(); } -} \ No newline at end of file +} From 9f9806d8de38f792c4b58956d6b6f9b49dcd10b6 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Tue, 24 May 2016 08:27:37 -0500 Subject: [PATCH 08/22] 1006008 Add field type for dashboard content. / fix migration script register (IDEMPIERE-3270) --- migration/i3.1/oracle/201605231800_Ticket_1006008.sql | 2 +- migration/i3.1/postgresql/201605231800_Ticket_1006008.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/migration/i3.1/oracle/201605231800_Ticket_1006008.sql b/migration/i3.1/oracle/201605231800_Ticket_1006008.sql index 4d70f1f5b4..30b34b512a 100644 --- a/migration/i3.1/oracle/201605231800_Ticket_1006008.sql +++ b/migration/i3.1/oracle/201605231800_Ticket_1006008.sql @@ -67,6 +67,6 @@ ALTER TABLE AD_UserDef_Field ADD CONSTRAINT PADashboardContent_ADUserDefFi FOREI UPDATE AD_Column SET IsUpdateable='Y',Updated=TO_DATE('2016-05-23 20:49:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212763 ; -SELECT register_migration_script('201605231800_Ticket_1006008') FROM dual +SELECT register_migration_script('201605231800_Ticket_1006008.sql') FROM dual ; diff --git a/migration/i3.1/postgresql/201605231800_Ticket_1006008.sql b/migration/i3.1/postgresql/201605231800_Ticket_1006008.sql index 1fb4b118fb..79d0b951b0 100644 --- a/migration/i3.1/postgresql/201605231800_Ticket_1006008.sql +++ b/migration/i3.1/postgresql/201605231800_Ticket_1006008.sql @@ -64,6 +64,6 @@ ALTER TABLE AD_UserDef_Field ADD CONSTRAINT PADashboardContent_ADUserDefFi FOREI UPDATE AD_Column SET IsUpdateable='Y',Updated=TO_TIMESTAMP('2016-05-23 20:49:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212763 ; -SELECT register_migration_script('201605231800_Ticket_1006008') FROM dual +SELECT register_migration_script('201605231800_Ticket_1006008.sql') FROM dual ; From 2c1f41dd7b455106bcd8c935d000f40ac4e63f1f Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Fri, 27 May 2016 12:44:41 +0800 Subject: [PATCH 09/22] 1006008 Add field type for dashboard content. layout fix. (IDEMPIERE-3270) --- .../org/adempiere/webui/editor/WDashboardContentEditor.java | 1 + .../theme/default/css/fragment/field-editor.css.dsp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WDashboardContentEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WDashboardContentEditor.java index 3cc1122f19..f55364a552 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WDashboardContentEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WDashboardContentEditor.java @@ -116,6 +116,7 @@ public class WDashboardContentEditor extends WEditor { private void render() throws Exception { Panel panel = getComponent(); + panel.setSclass("dashboard-field-panel"); Panelchildren pc = panel.getPanelchildren(); pc.getChildren().clear(); Div div = new Div(); diff --git a/org.adempiere.ui.zk/theme/default/css/fragment/field-editor.css.dsp b/org.adempiere.ui.zk/theme/default/css/fragment/field-editor.css.dsp index dea06a956f..a0d4807313 100644 --- a/org.adempiere.ui.zk/theme/default/css/fragment/field-editor.css.dsp +++ b/org.adempiere.ui.zk/theme/default/css/fragment/field-editor.css.dsp @@ -187,3 +187,7 @@ span.grid-combobox-editor { cursor: default; border: none; } + +.dashboard-field-panel.z-panel, .dashboard-field-panel.z-panel > .z-panel-body, .dashboard-field-panel.z-panel > .z-panel-body > .z-panelchildren { + overflow: visible; +} From e2d26b3a974f2e19ec9cf33ff366daeea1d6eb86 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Tue, 19 Jul 2016 17:41:02 +0800 Subject: [PATCH 10/22] 1006181 Speed-up windows - Field to show read-only grid. (IDEMPIERE-3269) --- .../oracle/201607191600_Ticket_1006181.sql | 154 +++++++ .../201607191600_Ticket_1006181.sql | 151 +++++++ .../src/org/compiere/model/GridTab.java | 14 + .../src/org/compiere/model/GridTable.java | 4 + .../src/org/compiere/model/SystemIDs.java | 2 + .../src/org/compiere/util/DisplayType.java | 10 +- .../selection/GridTabSelectionListView.java | 379 ++++++++++++++++++ .../GridTabSelectionListViewRenderer.java | 257 ++++++++++++ .../editor/grid/selection/GridTableRow.java | 47 +++ .../selection/SimpleGridTableListModel.java | 154 +++++++ .../WGridTabMultiSelectionEditor.java | 240 +++++++++++ .../WGridTabSingleSelectionEditor.java | 191 +++++++++ .../webui/factory/DefaultEditorFactory.java | 10 + 13 files changed, 1612 insertions(+), 1 deletion(-) create mode 100644 migration/i3.1/oracle/201607191600_Ticket_1006181.sql create mode 100644 migration/i3.1/postgresql/201607191600_Ticket_1006181.sql create mode 100644 org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/GridTabSelectionListView.java create mode 100644 org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/GridTabSelectionListViewRenderer.java create mode 100644 org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/GridTableRow.java create mode 100644 org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/SimpleGridTableListModel.java create mode 100644 org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/WGridTabMultiSelectionEditor.java create mode 100644 org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/WGridTabSingleSelectionEditor.java diff --git a/migration/i3.1/oracle/201607191600_Ticket_1006181.sql b/migration/i3.1/oracle/201607191600_Ticket_1006181.sql new file mode 100644 index 0000000000..5fbe086802 --- /dev/null +++ b/migration/i3.1/oracle/201607191600_Ticket_1006181.sql @@ -0,0 +1,154 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Jul 15, 2016 6:12:46 PM MYT +-- 1006181 Speed-up windows - Field to show read-only grid +UPDATE AD_Field SET Included_Tab_ID = NULL WHERE Included_Tab_ID IS NOT NULL +; + +INSERT INTO AD_Reference (AD_Reference_ID,Name,AD_Reference_UU,IsOrderByValue,AD_Org_ID,ValidationType,Updated,IsActive,CreatedBy,UpdatedBy,AD_Client_ID,Created,EntityType) VALUES (200127,'Single Selection Grid','ce2bb5f1-efab-44ba-b5b7-7308a509c39c','N',0,'D',TO_DATE('2016-07-15 18:12:40','YYYY-MM-DD HH24:MI:SS'),'Y',100,100,0,TO_DATE('2016-07-15 18:12:40','YYYY-MM-DD HH24:MI:SS'),'D') +; + +-- Jul 15, 2016 6:13:13 PM MYT +INSERT INTO AD_Reference (AD_Reference_ID,Name,AD_Reference_UU,IsOrderByValue,AD_Org_ID,ValidationType,Updated,IsActive,CreatedBy,UpdatedBy,AD_Client_ID,Created,EntityType) VALUES (200128,'Multiple Selection Grid','ca6d9bef-47eb-4278-a11f-20a8a99257cd','N',0,'D',TO_DATE('2016-07-15 18:13:13','YYYY-MM-DD HH24:MI:SS'),'Y',100,100,0,TO_DATE('2016-07-15 18:13:13','YYYY-MM-DD HH24:MI:SS'),'D') +; + +-- Jul 15, 2016 6:24:20 PM MYT +UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=6432 +; + +-- Jul 15, 2016 6:24:20 PM MYT +UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=132 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=140,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=200276 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=150,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=200771 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=160,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=924 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=170,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=133 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=180,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=137 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=190,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=200274 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=200,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=138 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=210,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=202362 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=220,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=142 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=230,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=8343 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=240,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=140 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=250,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=202341 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=260,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=141 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=270,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=200350 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=280,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=200348 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=290,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=200349 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=300,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=204213 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=310,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=204214 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=320,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=13425 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=330,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=200837 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=340,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=54402 +; + +-- Jul 15, 2016 6:24:22 PM MYT +UPDATE AD_Field SET SeqNo=350,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=54401 +; + +-- Jul 15, 2016 6:24:22 PM MYT +UPDATE AD_Field SET SeqNo=360,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=200838 +; + +-- Jul 15, 2016 6:24:22 PM MYT +UPDATE AD_Field SET SeqNo=370,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=200834 +; + +-- Jul 15, 2016 6:24:22 PM MYT +UPDATE AD_Field SET SeqNo=380,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=13424 +; + +-- Jul 15, 2016 6:24:22 PM MYT +UPDATE AD_Field SET SeqNo=390,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=62468 +; + +-- Jul 15, 2016 6:24:22 PM MYT +UPDATE AD_Field SET SeqNo=400,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=53280 +; + +-- Jul 15, 2016 6:24:22 PM MYT +UPDATE AD_Field SET SeqNo=410,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=200836 +; + +-- Jul 15, 2016 6:24:22 PM MYT +UPDATE AD_Field SET SeqNo=420,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=200835 +; + +-- Jul 15, 2016 6:24:22 PM MYT +UPDATE AD_Field SET SeqNo=430,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=136 +; + +-- Jul 15, 2016 6:24:22 PM MYT +UPDATE AD_Field SET SeqNo=440,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=139 +; + +-- Jul 15, 2016 6:27:18 PM MYT +UPDATE AD_Field SET DisplayLogic='@AD_Column_ID.AD_Reference_ID@=200127|@AD_Column_ID.AD_Reference_ID@=200128', IsActive='Y', SeqNoGrid=120,Updated=TO_DATE('2016-07-15 18:27:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6432 +; + +SELECT register_migration_script('201607191600_Ticket_1006181.sql') FROM dual +; + diff --git a/migration/i3.1/postgresql/201607191600_Ticket_1006181.sql b/migration/i3.1/postgresql/201607191600_Ticket_1006181.sql new file mode 100644 index 0000000000..f87ccc66b9 --- /dev/null +++ b/migration/i3.1/postgresql/201607191600_Ticket_1006181.sql @@ -0,0 +1,151 @@ +-- Jul 15, 2016 6:12:46 PM MYT +-- 1006181 Speed-up windows - Field to show read-only grid +UPDATE AD_Field SET Included_Tab_ID = NULL WHERE Included_Tab_ID IS NOT NULL +; + +INSERT INTO AD_Reference (AD_Reference_ID,Name,AD_Reference_UU,IsOrderByValue,AD_Org_ID,ValidationType,Updated,IsActive,CreatedBy,UpdatedBy,AD_Client_ID,Created,EntityType) VALUES (200127,'Single Selection Grid','ce2bb5f1-efab-44ba-b5b7-7308a509c39c','N',0,'D',TO_TIMESTAMP('2016-07-15 18:12:40','YYYY-MM-DD HH24:MI:SS'),'Y',100,100,0,TO_TIMESTAMP('2016-07-15 18:12:40','YYYY-MM-DD HH24:MI:SS'),'D') +; + +-- Jul 15, 2016 6:13:13 PM MYT +INSERT INTO AD_Reference (AD_Reference_ID,Name,AD_Reference_UU,IsOrderByValue,AD_Org_ID,ValidationType,Updated,IsActive,CreatedBy,UpdatedBy,AD_Client_ID,Created,EntityType) VALUES (200128,'Multiple Selection Grid','ca6d9bef-47eb-4278-a11f-20a8a99257cd','N',0,'D',TO_TIMESTAMP('2016-07-15 18:13:13','YYYY-MM-DD HH24:MI:SS'),'Y',100,100,0,TO_TIMESTAMP('2016-07-15 18:13:13','YYYY-MM-DD HH24:MI:SS'),'D') +; + +-- Jul 15, 2016 6:24:20 PM MYT +UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=6432 +; + +-- Jul 15, 2016 6:24:20 PM MYT +UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=132 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=140,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=200276 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=150,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=200771 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=160,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=924 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=170,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=133 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=180,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=137 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=190,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=200274 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=200,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=138 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=210,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=202362 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=220,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=142 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=230,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=8343 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=240,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=140 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=250,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=202341 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=260,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=141 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=270,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=200350 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=280,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=200348 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=290,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=200349 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=300,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=204213 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=310,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=204214 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=320,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=13425 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=330,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=200837 +; + +-- Jul 15, 2016 6:24:21 PM MYT +UPDATE AD_Field SET SeqNo=340,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=54402 +; + +-- Jul 15, 2016 6:24:22 PM MYT +UPDATE AD_Field SET SeqNo=350,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=54401 +; + +-- Jul 15, 2016 6:24:22 PM MYT +UPDATE AD_Field SET SeqNo=360,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=200838 +; + +-- Jul 15, 2016 6:24:22 PM MYT +UPDATE AD_Field SET SeqNo=370,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=200834 +; + +-- Jul 15, 2016 6:24:22 PM MYT +UPDATE AD_Field SET SeqNo=380,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=13424 +; + +-- Jul 15, 2016 6:24:22 PM MYT +UPDATE AD_Field SET SeqNo=390,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=62468 +; + +-- Jul 15, 2016 6:24:22 PM MYT +UPDATE AD_Field SET SeqNo=400,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=53280 +; + +-- Jul 15, 2016 6:24:22 PM MYT +UPDATE AD_Field SET SeqNo=410,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=200836 +; + +-- Jul 15, 2016 6:24:22 PM MYT +UPDATE AD_Field SET SeqNo=420,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=200835 +; + +-- Jul 15, 2016 6:24:22 PM MYT +UPDATE AD_Field SET SeqNo=430,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=136 +; + +-- Jul 15, 2016 6:24:22 PM MYT +UPDATE AD_Field SET SeqNo=440,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=139 +; + +-- Jul 15, 2016 6:27:18 PM MYT +UPDATE AD_Field SET DisplayLogic='@AD_Column_ID.AD_Reference_ID@=200127|@AD_Column_ID.AD_Reference_ID@=200128', IsActive='Y', SeqNoGrid=120,Updated=TO_TIMESTAMP('2016-07-15 18:27:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6432 +; + +SELECT register_migration_script('201607191600_Ticket_1006181.sql') FROM dual +; + diff --git a/org.adempiere.base/src/org/compiere/model/GridTab.java b/org.adempiere.base/src/org/compiere/model/GridTab.java index be6ee8ef77..5bb961f489 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTab.java +++ b/org.adempiere.base/src/org/compiere/model/GridTab.java @@ -1286,6 +1286,11 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable { return m_keyColumnName; } // getKeyColumnName + + public int getKeyColumnIndex() + { + return m_mTable.getKeyColumnIndex(); + } /** * Set Name of the Key Column @@ -3338,4 +3343,13 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable selection.clear(); } + public GridWindow getGridWindow() + { + return this.m_window; + } + + public GridTabVO getVO() + { + return m_vo; + } } // GridTab diff --git a/org.adempiere.base/src/org/compiere/model/GridTable.java b/org.adempiere.base/src/org/compiere/model/GridTable.java index 2324809613..3d310a76f0 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTable.java +++ b/org.adempiere.base/src/org/compiere/model/GridTable.java @@ -3948,4 +3948,8 @@ public class GridTable extends AbstractTableModel m_lastSortColumnIndex = -1; m_lastSortedAscending = true; } + + public int getKeyColumnIndex() { + return m_indexKeyColumn; + } } diff --git a/org.adempiere.base/src/org/compiere/model/SystemIDs.java b/org.adempiere.base/src/org/compiere/model/SystemIDs.java index 9500ee8825..d80a915946 100644 --- a/org.adempiere.base/src/org/compiere/model/SystemIDs.java +++ b/org.adempiere.base/src/org/compiere/model/SystemIDs.java @@ -117,6 +117,8 @@ public class SystemIDs public final static int REFERENCE_DATATYPE_YES_NO = 20; public final static int REFERENCE_DATATYPE_CHART = 53370; public final static int REFERENCE_DATATYPE_DASHBOARD_CONTENT = 200122; + public final static int REFERENCE_DATATYPE_SINGLE_SELECTION_GRID = 200127; + public final static int REFERENCE_DATATYPE_MULTIPLE_SELECTION_GRID = 200128; public final static int REFERENCE_AD_USER = 110; public final static int REFERENCE_DOCUMENTACTION = 135; diff --git a/org.adempiere.base/src/org/compiere/util/DisplayType.java b/org.adempiere.base/src/org/compiere/util/DisplayType.java index 6ea07bca94..eb6b2609eb 100644 --- a/org.adempiere.base/src/org/compiere/util/DisplayType.java +++ b/org.adempiere.base/src/org/compiere/util/DisplayType.java @@ -51,6 +51,8 @@ import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_URL; import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_YES_NO; import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_CHART; import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_DASHBOARD_CONTENT; +import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_SINGLE_SELECTION_GRID; +import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_MULTIPLE_SELECTION_GRID; import java.text.DateFormat; import java.text.DecimalFormat; @@ -147,6 +149,10 @@ public final class DisplayType public static final int Chart = REFERENCE_DATATYPE_CHART; public static final int DashboardContent = REFERENCE_DATATYPE_DASHBOARD_CONTENT; + + public static final int SingleSelectionGrid = REFERENCE_DATATYPE_SINGLE_SELECTION_GRID; + + public static final int MultipleSelectionGrid = REFERENCE_DATATYPE_MULTIPLE_SELECTION_GRID; /** * - New Display Type @@ -262,7 +268,9 @@ public final class DisplayType if (displayType == String || displayType == Text || displayType == TextLong || displayType == Memo || displayType == FilePath || displayType == FileName - || displayType == URL || displayType == PrinterName) + || displayType == URL || displayType == PrinterName + || displayType == SingleSelectionGrid + || displayType == MultipleSelectionGrid) return true; List factoryList = Service.locator().list(IDisplayTypeFactory.class).getServices(); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/GridTabSelectionListView.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/GridTabSelectionListView.java new file mode 100644 index 0000000000..431e9f42c6 --- /dev/null +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/GridTabSelectionListView.java @@ -0,0 +1,379 @@ +/****************************************************************************** + * Copyright (C) 2008 Low Heng Sin * + * 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.editor.grid.selection; + + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; + +import javax.swing.table.AbstractTableModel; + +import org.adempiere.model.MTabCustomization; +import org.adempiere.webui.component.Label; +import org.adempiere.webui.component.ListHead; +import org.adempiere.webui.component.ListHeader; +import org.adempiere.webui.component.Listbox; +import org.compiere.model.GridField; +import org.compiere.model.GridTab; +import org.compiere.model.GridTable; +import org.compiere.model.MSysConfig; +import org.compiere.util.DisplayType; +import org.compiere.util.Env; +import org.compiere.util.Msg; +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.Borderlayout; +import org.zkoss.zul.Center; +import org.zkoss.zul.ListModel; +import org.zkoss.zul.South; +import org.zkoss.zul.ext.Selectable; + +/** + * Read only grid view for single or multi selection + * @author Low Heng Sin + * + */ +public class GridTabSelectionListView extends Borderlayout implements EventListener +{ + /** + * + */ + private static final long serialVersionUID = 4145737989132101461L; + + private static final int MIN_COLUMN_WIDTH = 100; + + private static final int MAX_COLUMN_WIDTH = 300; + + private Listbox listbox = null; + + private int pageSize = 100; + + private GridField[] gridField; + private AbstractTableModel tableModel; + + private int numColumns = 5; + + private int windowNo; + + private GridTab gridTab; + + private boolean init; + + private SimpleGridTableListModel listModel; + + private GridTabSelectionListViewRenderer renderer; + + private South south; + + private Map columnWidthMap; + + private Label selectedLabel; + + public GridTabSelectionListView(boolean multiple) + { + this(multiple, 0); + } + + /** + * @param windowNo + */ + public GridTabSelectionListView(boolean multiple, int windowNo) + { + this.windowNo = windowNo; + listbox = new Listbox(); + listbox.setCheckmark(true); + listbox.setMultiple(multiple); + south = new South(); + this.appendChild(south); + + //default paging size + pageSize = MSysConfig.getIntValue(MSysConfig.ZK_PAGING_SIZE, 100); + listbox.setMold("paging"); + listbox.setPageSize(pageSize); + + setStyle("min-height: 200px;"); + } + + /** + * + * @param gridTab + */ + public void init(GridTab gridTab) + { + if (init) return; + + setupFields(gridTab); + + setupColumns(); + render(); + + this.init = true; + } + + private void setupFields(GridTab gridTab) { + this.gridTab = gridTab; + tableModel = gridTab.getTableModel(); + GridField[] tmpFields = ((GridTable)tableModel).getFields(); + MTabCustomization tabCustomization = MTabCustomization.get(Env.getCtx(), Env.getAD_User_ID(Env.getCtx()), gridTab.getAD_Tab_ID(), null); + if (tabCustomization != null && tabCustomization.getAD_Tab_Customization_ID() > 0 + && tabCustomization.getCustom() != null && tabCustomization.getCustom().trim().length() > 0) { + String custom = tabCustomization.getCustom().trim(); + String[] customComponent = custom.split(";"); + String[] fieldIds = customComponent[0].split("[,]"); + List fieldList = new ArrayList(); + for(String fieldIdStr : fieldIds) { + fieldIdStr = fieldIdStr.trim(); + if (fieldIdStr.length() == 0) continue; + int AD_Field_ID = Integer.parseInt(fieldIdStr); + for(GridField gridField : tmpFields) { + if (gridField.getAD_Field_ID() == AD_Field_ID) { + fieldList.add(gridField); + break; + } + } + } + gridField = fieldList.toArray(new GridField[0]); + if (customComponent.length == 2) { + String[] widths = customComponent[1].split("[,]"); + for(int i = 0; i< gridField.length; i++) { + columnWidthMap.put(gridField[i].getAD_Field_ID(), widths[i]); + } + } + } else { + gridField = tmpFields; + } + numColumns = gridField.length; + } + + /** + * + * @return boolean + */ + public boolean isInit() { + return init; + } + + /** + * + * @param gridTab + */ + public void activate(GridTab gridTab) { + if (isInit()) + { + if (this.gridTab != gridTab) + { + init = false; + init(gridTab); + } + } + else + init(gridTab); + } + + /** + * + * @param gridTab + */ + public void refresh(GridTab gridTab) { + gridTab.query(false, 0, 0); + gridTab.getTableModel().fireTableDataChanged(); + + if (this.gridTab != gridTab) + { + init = false; + init(gridTab); + } + } + + /** + * Set paging size + * @param pageSize + */ + public void setPageSize(int pageSize) + { + this.pageSize = pageSize; + } + + public void clear() + { + this.getChildren().clear(); + } + + private void setupColumns() + { + if (init) return; + + ListHead header = new ListHead(); + header.setSizable(true); + + ListHeader selectionHeader = new ListHeader(); + selectionHeader.setWidth("40px"); + selectionHeader.setAlign("center"); + header.appendChild(selectionHeader); + + Map colnames = new HashMap(); + int index = 0; + for (int i = 0; i < numColumns; i++) + { + if (gridField[i].isDisplayed() && gridField[i].isDisplayedGrid()) + { + colnames.put(index, gridField[i].getHeader()); + index++; + ListHeader colHeader = new ListHeader(); + colHeader.setSort("auto"); + colHeader.setLabel(gridField[i].getHeader()); + if (columnWidthMap != null && columnWidthMap.get(gridField[i].getAD_Field_ID()) != null) { + colHeader.setWidth(columnWidthMap.get(gridField[i].getAD_Field_ID())); + } else { + int l = DisplayType.isNumeric(gridField[i].getDisplayType()) + ? 100 : gridField[i].getDisplayLength() * 9; + if (gridField[i].getHeader().length() * 9 > l) + l = gridField[i].getHeader().length() * 9; + if (l > MAX_COLUMN_WIDTH) + l = MAX_COLUMN_WIDTH; + else if ( l < MIN_COLUMN_WIDTH) + l = MIN_COLUMN_WIDTH; + colHeader.setWidth(Integer.toString(l) + "px"); + } + header.appendChild(colHeader); + } + } + listbox.appendChild(header); + } + + private void render() + { + listbox.setStyle("min-height: 200px"); + listbox.setVflex(true); + listbox.setHflex("1"); + listbox.setSizedByContent(true); + listbox.addEventListener(Events.ON_SELECT, this); + + updateModel(); + + Center center = new Center(); + center.appendChild(listbox); + this.appendChild(center); + + selectedLabel = new Label(Msg.getMsg(Env.getCtx(), "Selected") + " : 0"); + south.appendChild(selectedLabel); + } + + private void updateModel() { + listModel = new SimpleGridTableListModel((GridTable)tableModel, windowNo); + listModel.setMultiple(listbox.isMultiple()); + renderer = new GridTabSelectionListViewRenderer(gridTab, windowNo); + renderer.setListView(this); + + listbox.setItemRenderer(renderer); + listbox.setModel(listModel); + } + + /** + * deactive panel + */ + public void deactivate() { + } + + public void onEvent(Event event) throws Exception + { + if (event == null) + return; + else if (event.getTarget() == listbox) + { + int count = listbox.getSelectedCount(); + selectedLabel.setValue(Msg.getMsg(Env.getCtx(), "Selected") + " : " + count); + } + } + + /** + * + * @return Listbox + */ + public Listbox getListbox() { + return listbox; + } + + /** + * + * @param windowNo + */ + public void setWindowNo(int windowNo) { + this.windowNo = windowNo; + } + + public GridField[] getFields() { + return gridField; + } + + /* (non-Javadoc) + * @see org.zkoss.zk.ui.AbstractComponent#addEventListener(int, java.lang.String, org.zkoss.zk.ui.event.EventListener) + */ + @Override + public boolean addEventListener(int priority, String evtnm, + EventListener listener) { + if (Events.ON_SELECT.equals(evtnm)) { + return listbox.addEventListener(priority, evtnm, listener); + } else { + return super.addEventListener(priority, evtnm, listener); + } + } + + public void setSelectedIndices(int[] selectedIndices) { + ListModel model = listbox.getModel(); + if (model != null && model instanceof Selectable) { + Collection selection = new HashSet(); + @SuppressWarnings("unchecked") + Selectable selectable = (Selectable) model; + for (int selected : selectedIndices) { + selection.add(model.getElementAt(selected)); + } + + selectable.setSelection(selection); + } else { + listbox.setSelectedIndices(selectedIndices); + } + selectedLabel.setValue(Msg.getMsg(Env.getCtx(), "Selected") + " : " + selectedIndices.length); + } + + public void clearSelection() { + ListModel model = listbox.getModel(); + if (model != null && model instanceof Selectable) { + Selectable selectable = (Selectable) model; + selectable.clearSelection(); + } else { + listbox.clearSelection(); + } + selectedLabel.setValue(Msg.getMsg(Env.getCtx(), "Selected") + " : 0"); + } + + public void setSelectedIndex(int selected) { + ListModel model = listbox.getModel(); + if (model != null && model instanceof Selectable) { + @SuppressWarnings("unchecked") + Selectable selectable = (Selectable) model; + Collection selection = new HashSet(); + selection.add(model.getElementAt(selected)); + selectable.setSelection(selection); + selectedLabel.setValue(Msg.getMsg(Env.getCtx(), "Selected") + " : " + selection.size()); + } else { + listbox.setSelectedIndex(selected); + selectedLabel.setValue(Msg.getMsg(Env.getCtx(), "Selected") + " : " + listbox.getSelectedCount()); + } + } +} diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/GridTabSelectionListViewRenderer.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/GridTabSelectionListViewRenderer.java new file mode 100644 index 0000000000..2fa74c357a --- /dev/null +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/GridTabSelectionListViewRenderer.java @@ -0,0 +1,257 @@ +/******************************************************************************* + * Copyright (C) 2016 Trek Global Inc. * + * Copyright (C) 2016 Low Heng Sin * + * 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.editor.grid.selection; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.adempiere.webui.component.ListCell; +import org.adempiere.webui.component.ListItem; +import org.adempiere.webui.editor.WEditor; +import org.adempiere.webui.editor.WebEditorFactory; +import org.compiere.model.GridField; +import org.compiere.model.GridTab; +import org.compiere.util.DisplayType; +import org.zkoss.zk.ui.Component; +import org.zkoss.zul.Listbox; +import org.zkoss.zul.Listcell; +import org.zkoss.zul.Listitem; +import org.zkoss.zul.ListitemRenderer; +import org.zkoss.zul.ListitemRendererExt; +import org.zkoss.zul.RendererCtrl; + +/** + * ListItem renderer for GridTabSelectionListView + * @author hengsin + * + */ +public class GridTabSelectionListViewRenderer implements ListitemRenderer, ListitemRendererExt, RendererCtrl { + + private static final int MAX_TEXT_LENGTH = 60; + private GridTab gridTab; + @SuppressWarnings("unused") + private int windowNo; + private Map editors = new HashMap(); + private GridTabSelectionListView listView; + + /** + * + * @param gridTab + * @param windowNo + */ + public GridTabSelectionListViewRenderer(GridTab gridTab, int windowNo) { + this.gridTab = gridTab; + this.windowNo = windowNo; + } + + /** + * @param listitem + * @param data + * @see ListitemRenderer#render(Listitem, Object) + */ + @Override + public void render(Listitem listitem, GridTableRow data, int index) throws Exception { + //don't render if not visible + if (listView != null && !listView.isVisible()) { + return; + } + + GridField[] listViewFields = listView.getFields(); + int columnCount = listViewFields.length; + + GridField[] gridTabFields = gridTab.getFields(); + boolean isGridViewCustomized = gridTabFields.length != listViewFields.length; + if (!isGridViewCustomized) { + for(int i = 0; i < gridTabFields.length; i++) { + if (listViewFields[i].getAD_Field_ID() != gridTabFields[i].getAD_Field_ID()) { + isGridViewCustomized = true; + break; + } + } + } + + for(Component c = listitem.getParent(); c != null; c = c.getParent()) { + if (!c.isVisible()) + return; + } + Object[] values = null; + if (!isGridViewCustomized) { + values = data.getValues(); + } else { + List dataList = new ArrayList(); + for(GridField gridField : listViewFields) { + for(int i = 0; i < gridTabFields.length; i++) { + if (gridField.getAD_Field_ID() == gridTabFields[i].getAD_Field_ID()) { + dataList.add(data.getValues()[i]); + break; + } + } + } + values = dataList.toArray(new Object[0]); + } + + Listcell selectionCell = new Listcell(); + listitem.appendChild(selectionCell); + + for (int i = 0; i < columnCount; i++) { + if (!listViewFields[i].isDisplayedGrid()) { + continue; + } + if (!editors.containsKey(listViewFields[i])) { + WEditor editor = null; + int displayType = listViewFields[i].getDisplayType(); + if (displayType != DisplayType.YesNo && displayType != DisplayType.Image && displayType != DisplayType.Chart && + displayType != DisplayType.Button && displayType != DisplayType.DashboardContent) { + editor = WebEditorFactory.getEditor(listViewFields[i], true); + editor.setReadWrite(false); + } + editors.put(listViewFields[i], editor); + } + + Listcell cell = renderCell(listViewFields[i], values[i]); + cell.setParent(listitem); + } + } + + private Listcell renderCell(GridField gridField, Object value) { + Listcell cell; + if (gridField.getDisplayType() == DisplayType.YesNo) { + cell = new Listcell("", null); + cell.setStyle("text-align:center"); + WEditor editor = WebEditorFactory.getEditor(gridField, true); + editor.setReadWrite(false); + editor.setValue(value); + cell.appendChild(editor.getComponent()); + } else if (gridField.getDisplayType() == DisplayType.Image || gridField.getDisplayType() == DisplayType.Chart) { + WEditor editor = WebEditorFactory.getEditor(gridField, true); + editor.setReadWrite(false); + editor.setValue(value); + cell = new Listcell("", null); + cell.appendChild(editor.getComponent()); + } else { + String text = getDisplayText(gridField, value); + String display = text; + if (text != null && text.length() > MAX_TEXT_LENGTH) + display = text.substring(0, MAX_TEXT_LENGTH - 3) + "..."; + cell = new Listcell(display, null); + if (text != null && text.length() > MAX_TEXT_LENGTH) + cell.setTooltiptext(text); + if (DisplayType.isNumeric(gridField.getDisplayType())) { + cell.setStyle("text-align:right"); + } else if (gridField.getDisplayType() == DisplayType.Image) { + cell.setStyle("text-align:center"); + } + } + return cell; + } + + /** + * @see ListitemRendererExt#getControls() + */ + public int getControls() { + return DETACH_ON_RENDER; + } + + /** + * @param item + * @see ListitemRendererExt#newListcell(Listitem) + */ + public Listcell newListcell(Listitem item) { + ListCell listCell = new ListCell(); + listCell.applyProperties(); + listCell.setParent(item); + return listCell; + } + + /** + * @param listbox + * @see ListitemRendererExt#newListitem(Listbox) + */ + public Listitem newListitem(Listbox listbox) { + ListItem item = new ListItem(); + item.applyProperties(); + return item; + } + + private String getDisplayText(GridField gridField, Object value) + { + if (value == null) + return ""; + + if (gridField.isEncryptedField()) + { + return "********"; + } + else if (DisplayType.Button == gridField.getDisplayType()) + { + return ""; + } + else + { + WEditor editor = editors.get(gridField); + if (editor != null) + return editor.getDisplayTextForGridView(value); + else + return value.toString(); + } + } + + /** + * Is renderer initialize + * @return boolean + */ + public boolean isInitialize() { + return !editors.isEmpty(); + } + + /** + * + * @return active editor list + */ + public List getEditors() { + List editorList = new ArrayList(); + if (!editors.isEmpty()) + editorList.addAll(editors.values()); + + return editorList; + } + + /** + * @see RendererCtrl#doCatch(Throwable) + */ + public void doCatch(Throwable ex) throws Throwable { + } + + /** + * @see RendererCtrl#doFinally() + */ + public void doFinally() { + } + + /** + * @see RendererCtrl#doTry() + */ + public void doTry() { + } + + public void setListView (GridTabSelectionListView listView) { + this.listView = listView; + } + + public GridTabSelectionListView getListView() { + return listView; + } +} diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/GridTableRow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/GridTableRow.java new file mode 100644 index 0000000000..ee0a043d4b --- /dev/null +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/GridTableRow.java @@ -0,0 +1,47 @@ +/** + * + */ +package org.adempiere.webui.editor.grid.selection; + +/** + * @author hengsin + * + */ +public class GridTableRow { + + private int id; + private Object[] values; + + /** + * + */ + public GridTableRow(int id, Object[] values) { + this.id = id; + this.values = values; + } + + /* (non-Javadoc) + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + return id; + } + + public Object[] getValues() { + return values; + } + + /* (non-Javadoc) + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object obj) { + if (obj instanceof GridTableRow && obj != null) { + GridTableRow that = (GridTableRow) obj; + if (this.id > 0 && that.id == this.id) + return true; + } + return false; + } +} diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/SimpleGridTableListModel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/SimpleGridTableListModel.java new file mode 100644 index 0000000000..41f4f45288 --- /dev/null +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/SimpleGridTableListModel.java @@ -0,0 +1,154 @@ +/******************************************************************************* + * Copyright (C) 2016 Trek Global Inc. * + * Copyright (C) 2016 Low Heng Sin * + * 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.editor.grid.selection; + +import java.util.Comparator; + +import javax.swing.event.TableModelEvent; +import javax.swing.event.TableModelListener; + +import org.adempiere.webui.util.SortComparator; +import org.compiere.model.GridField; +import org.compiere.model.GridTable; +import org.zkoss.zk.ui.Executions; +import org.zkoss.zul.AbstractListModel; +import org.zkoss.zul.ListModel; +import org.zkoss.zul.ListitemComparator; +import org.zkoss.zul.event.ListDataEvent; +import org.zkoss.zul.ext.Sortable; + +/** + * + * @author Low Heng Sin + * + */ +public class SimpleGridTableListModel extends AbstractListModel implements TableModelListener, Sortable { + + /** + * + */ + private static final long serialVersionUID = 698185856751242764L; + private GridTable tableModel; + @SuppressWarnings("unused") + private GridField[] gridField; + @SuppressWarnings("unused") + private int windowNo; + + /** + * + * @param tableModel + * @param windowNo + */ + public SimpleGridTableListModel(GridTable tableModel, int windowNo) { + this.tableModel = tableModel; + this.windowNo = windowNo; + gridField = tableModel.getFields(); + tableModel.addTableModelListener(this); + } + + /** + * @param rowIndex + * @see ListModel#getElementAt(int) + */ + public GridTableRow getElementAt(int rowIndex) { + GridTableRow row = null; + int columnCount = tableModel.getColumnCount(); + Object[] values = new Object[columnCount]; + if (rowIndex < tableModel.getRowCount()) { + for (int i = 0; i < columnCount; i++) { + values[i] = tableModel.getValueAt(rowIndex, i); + } + row = new GridTableRow(tableModel.getKeyID(rowIndex), values); + } + + return row; + } + + /** + * Get total number of rows + * @return int + * @see ListModel#getSize() + */ + public int getSize() { + return tableModel.getRowCount(); + } + + /** + * Request components that attached to this model to re-render a row. + * @param row + */ + public void updateComponent(int row) { + updateComponent(row, row); + } + + /** + * Request components that attached to this model to re-render a range of row. + * @param fromRow + * @param toRow + */ + public void updateComponent(int fromRow, int toRow) { + //must run from the UI thread + if (Executions.getCurrent() != null) { + fireEvent(ListDataEvent.CONTENTS_CHANGED, fromRow, toRow); + } + } + + /** + * @param cmpr + * @param ascending + * @see ListModelExt#sort(Comparator, boolean) + */ + public void sort(Comparator cmpr, boolean ascending) { + //use default zk comparator + if (cmpr instanceof ListitemComparator) { + ListitemComparator lic = (ListitemComparator) cmpr; + tableModel.sort(lic.getListheader().getColumnIndex(), ascending); + } else if (cmpr instanceof SortComparator) { + SortComparator sc = (SortComparator)cmpr; + tableModel.sort(sc.getColumnIndex(), ascending); + } + fireEvent(ListDataEvent.CONTENTS_CHANGED, -1, -1); + } + + /** + * @param e + * @see TableModelListener#tableChanged(TableModelEvent) + */ + public void tableChanged(TableModelEvent e) { + if (Executions.getCurrent() != null) { + if (e.getType() == TableModelEvent.DELETE) + { + fireEvent(ListDataEvent.INTERVAL_REMOVED, e.getFirstRow(), e.getLastRow()); + } + else if (e.getType() == TableModelEvent.INSERT) + { + fireEvent(ListDataEvent.INTERVAL_ADDED, e.getFirstRow(), e.getLastRow()); + } + else if (e.getLastRow() == Integer.MAX_VALUE) + { + fireEvent(ListDataEvent.CONTENTS_CHANGED, -1, -1); + } + else + { + fireEvent(ListDataEvent.CONTENTS_CHANGED, e.getFirstRow(), e.getLastRow()); + } + } + } + + @Override + public String getSortDirection(Comparator cmpr) { + return "natural"; + } + +} diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/WGridTabMultiSelectionEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/WGridTabMultiSelectionEditor.java new file mode 100644 index 0000000000..89e983d258 --- /dev/null +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/WGridTabMultiSelectionEditor.java @@ -0,0 +1,240 @@ +/******************************************************************************* + * Copyright (C) 2016 Trek Global Inc. * + * Copyright (C) 2016 Low Heng Sin * + * 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.editor.grid.selection; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +import org.adempiere.webui.ValuePreference; +import org.adempiere.webui.component.Listbox; +import org.adempiere.webui.editor.WEditor; +import org.adempiere.webui.editor.WEditorPopupMenu; +import org.adempiere.webui.event.ContextMenuEvent; +import org.adempiere.webui.event.ContextMenuListener; +import org.adempiere.webui.event.ValueChangeEvent; +import org.adempiere.webui.window.WFieldRecordInfo; +import org.compiere.model.GridField; +import org.compiere.model.GridTab; +import org.compiere.model.GridTabVO; +import org.compiere.model.GridWindow; +import org.compiere.util.Env; +import org.compiere.util.Util; +import org.zkoss.zk.ui.event.Event; +import org.zkoss.zk.ui.event.Events; +import org.zkoss.zul.ListModel; +import org.zkoss.zul.ext.Selectable; + +/** + * + * @author hengsin + * + */ +public class WGridTabMultiSelectionEditor extends WEditor implements ContextMenuListener +{ + private static final String[] LISTENER_EVENTS = {Events.ON_SELECT}; + + private Object oldValue; + + private boolean tableEditor = false; + + private GridTab listViewGridTab = null; + + private String currentLinkValue = null; + + public WGridTabMultiSelectionEditor(GridField gridField) { + this(gridField, false); + } + + public WGridTabMultiSelectionEditor(GridField gridField, boolean tableEditor) + { + super(new GridTabSelectionListView(true, gridField.getWindowNo()), gridField); + this.tableEditor = tableEditor; + init(); + } + + @Override + public GridTabSelectionListView getComponent() { + return (GridTabSelectionListView) component; + } + + @Override + public boolean isReadWrite() { + return !getComponent().getListbox().isEnabled(); + } + + @Override + public void setReadWrite(boolean readWrite) { + getComponent().getListbox().setEnabled(readWrite); + } + + private void init() + { + if (tableEditor) + setVisible(false); + else if (gridField != null) + { + int AD_Tab_ID = gridField.getIncluded_Tab_ID(); + GridWindow gridWindow = gridField.getGridTab().getGridWindow(); + int count = gridWindow.getTabCount(); + for(int i = 0; i < count; i++) + { + GridTab t = gridWindow.getTab(i); + if (t.getAD_Tab_ID() == AD_Tab_ID) + { + GridTabVO vo = t.getVO(); + listViewGridTab = new GridTab(vo, gridWindow); + listViewGridTab.setLinkColumnName(t.getLinkColumnName()); + getComponent().init(listViewGridTab); + break; + } + } + } + } + + public void onEvent(Event event) + { + if (Events.ON_SELECT.equals(event.getName())) + { + Object newValue = null; + Listbox listbox = getComponent().getListbox(); + ListModel model = listbox.getModel(); + if (model != null && model instanceof Selectable) + { + StringBuilder buffer = new StringBuilder(); + @SuppressWarnings("unchecked") + Selectable selectable = (Selectable) model; + Set selection = selectable.getSelection(); + for(GridTableRow row : selection) + { + if (buffer.length() > 0) + buffer.append(","); + buffer.append(row.hashCode()); + } + newValue = buffer.toString(); + } + else + { + int[] selection = getComponent().getListbox().getSelectedIndices(); + StringBuilder buffer = new StringBuilder(); + for(int rowIndex : selection) + { + int id = listViewGridTab.getKeyID(rowIndex); + if (buffer.length() > 0) + buffer.append(","); + buffer.append(id); + } + newValue = buffer.toString(); + } + if (oldValue != null && newValue != null && oldValue.equals(newValue)) { + return; + } + if (oldValue == null && newValue == null) { + return; + } + Object prevValue = oldValue; + oldValue = newValue; + ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), prevValue, newValue); + super.fireValueChange(changeEvent); + } + } + + @Override + public String getDisplay() + { + return oldValue != null ? oldValue.toString() : ""; + } + + @Override + public Object getValue() + { + return oldValue; + } + + @Override + public void setValue(Object value) + { + if (value == null && oldValue == null) + { + return; + } + else if (value != null && oldValue != null && value.equals(oldValue)) + { + return; + } + oldValue = value; + updateSlectedIndices(); + } + + private void updateSlectedIndices() { + if (!Util.isEmpty((String)oldValue)) + { + List list = new ArrayList(); + String[] selected = ((String)oldValue).split("[,]"); + for(String s : selected) { + int id = Integer.parseInt(s); + for(int i = 0; i < listViewGridTab.getRowCount(); i++) { + if (listViewGridTab.getKeyID(i) == id) { + list.add(i); + break; + } + } + } + int[] selectedIndices = new int[list.size()]; + for(int i = 0; i < selectedIndices.length; i++) + { + selectedIndices[i] = list.get(i); + } + getComponent().setSelectedIndices(selectedIndices); + } + else + { + getComponent().clearSelection(); + } + } + + @Override + public String[] getEvents() + { + return LISTENER_EVENTS; + } + + public void onMenu(ContextMenuEvent evt) + { + if (WEditorPopupMenu.PREFERENCE_EVENT.equals(evt.getContextEvent())) + { + if (isShowPreference()) + ValuePreference.start (getComponent(), this.getGridField(), getValue()); + return; + } + else if (WEditorPopupMenu.CHANGE_LOG_EVENT.equals(evt.getContextEvent())) + { + WFieldRecordInfo.start(gridField); + } + } + + @Override + public void dynamicDisplay() { + String name = listViewGridTab.getLinkColumnName(); + String linkValue = Env.getContext(Env.getCtx(), gridField.getWindowNo(), name); + if ((currentLinkValue == null && linkValue != null) + || (currentLinkValue != null && linkValue == null) + || (currentLinkValue != null && linkValue != null && !currentLinkValue.equals(linkValue))) + { + getComponent().refresh(listViewGridTab); + updateSlectedIndices(); + } + } +} diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/WGridTabSingleSelectionEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/WGridTabSingleSelectionEditor.java new file mode 100644 index 0000000000..ed963cf48f --- /dev/null +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/WGridTabSingleSelectionEditor.java @@ -0,0 +1,191 @@ +/******************************************************************************* + * Copyright (C) 2016 Trek Global Inc. * + * Copyright (C) 2016 Low Heng Sin * + * 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.editor.grid.selection; + +import org.adempiere.webui.ValuePreference; +import org.adempiere.webui.editor.WEditor; +import org.adempiere.webui.editor.WEditorPopupMenu; +import org.adempiere.webui.event.ContextMenuEvent; +import org.adempiere.webui.event.ContextMenuListener; +import org.adempiere.webui.event.ValueChangeEvent; +import org.adempiere.webui.window.WFieldRecordInfo; +import org.compiere.model.GridField; +import org.compiere.model.GridTab; +import org.compiere.model.GridTabVO; +import org.compiere.model.GridWindow; +import org.compiere.util.Env; +import org.compiere.util.Util; +import org.zkoss.zk.ui.event.Event; +import org.zkoss.zk.ui.event.Events; + +/** + * + * @author hengsin + * + */ +public class WGridTabSingleSelectionEditor extends WEditor implements ContextMenuListener +{ + private static final String[] LISTENER_EVENTS = {Events.ON_SELECT}; + + private Object oldValue; + + private boolean tableEditor = false; + + private GridTab listViewGridTab = null; + + private String currentLinkValue = null; + + public WGridTabSingleSelectionEditor(GridField gridField) { + this(gridField, false); + } + + public WGridTabSingleSelectionEditor(GridField gridField, boolean tableEditor) + { + super(new GridTabSelectionListView(false, gridField.getWindowNo()), gridField); + this.tableEditor = tableEditor; + init(); + } + + @Override + public GridTabSelectionListView getComponent() { + return (GridTabSelectionListView) component; + } + + @Override + public boolean isReadWrite() { + return !getComponent().getListbox().isEnabled(); + } + + @Override + public void setReadWrite(boolean readWrite) { + getComponent().getListbox().setEnabled(readWrite); + } + + private void init() + { + if (tableEditor) + setVisible(false); + else if (gridField != null) + { + int AD_Tab_ID = gridField.getIncluded_Tab_ID(); + GridWindow gridWindow = gridField.getGridTab().getGridWindow(); + int count = gridWindow.getTabCount(); + for(int i = 0; i < count; i++) + { + GridTab t = gridWindow.getTab(i); + if (t.getAD_Tab_ID() == AD_Tab_ID) + { + GridTabVO vo = t.getVO(); + listViewGridTab = new GridTab(vo, gridWindow); + listViewGridTab.setLinkColumnName(t.getLinkColumnName()); + getComponent().init(listViewGridTab); + break; + } + } + } + } + + public void onEvent(Event event) + { + if (Events.ON_SELECT.equals(event.getName())) + { + int selected = getComponent().getListbox().getSelectedIndex(); + Object newValue = selected >= 0 ? Integer.toString(listViewGridTab.getKeyID(selected)) : null; + if (oldValue != null && newValue != null && oldValue.equals(newValue)) { + return; + } + if (oldValue == null && newValue == null) { + return; + } + ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue); + super.fireValueChange(changeEvent); + oldValue = newValue; + } + } + + @Override + public String getDisplay() + { + return oldValue != null ? oldValue.toString() : ""; + } + + @Override + public Object getValue() + { + return oldValue; + } + + @Override + public void setValue(Object value) + { + if (value == null && oldValue == null) + { + return; + } + else if (value != null && oldValue != null && value.equals(oldValue)) + { + return; + } + oldValue = value; + updateSlectedIndices(); + } + + private void updateSlectedIndices() { + getComponent().clearSelection(); + if (!Util.isEmpty((String)oldValue)) + { + int id = Integer.parseInt((String) oldValue); + for(int i = 0; i < listViewGridTab.getRowCount(); i++) { + if (listViewGridTab.getKeyID(i) == id) { + getComponent().setSelectedIndex(i); + return; + } + } + } + } + + @Override + public String[] getEvents() + { + return LISTENER_EVENTS; + } + + public void onMenu(ContextMenuEvent evt) + { + if (WEditorPopupMenu.PREFERENCE_EVENT.equals(evt.getContextEvent())) + { + if (isShowPreference()) + ValuePreference.start (getComponent(), this.getGridField(), getValue()); + return; + } + else if (WEditorPopupMenu.CHANGE_LOG_EVENT.equals(evt.getContextEvent())) + { + WFieldRecordInfo.start(gridField); + } + } + + @Override + public void dynamicDisplay() { + String name = listViewGridTab.getLinkColumnName(); + String linkValue = Env.getContext(Env.getCtx(), gridField.getWindowNo(), name); + if ((currentLinkValue == null && linkValue != null) + || (currentLinkValue != null && linkValue == null) + || (currentLinkValue != null && linkValue != null && !currentLinkValue.equals(linkValue))) + { + getComponent().refresh(listViewGridTab); + updateSlectedIndices(); + } + } +} diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/DefaultEditorFactory.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/DefaultEditorFactory.java index 21d6e8fb51..95d31750d9 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/DefaultEditorFactory.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/DefaultEditorFactory.java @@ -38,6 +38,8 @@ import org.adempiere.webui.editor.WTimeEditor; import org.adempiere.webui.editor.WUnknownEditor; import org.adempiere.webui.editor.WUrlEditor; import org.adempiere.webui.editor.WYesNoEditor; +import org.adempiere.webui.editor.grid.selection.WGridTabMultiSelectionEditor; +import org.adempiere.webui.editor.grid.selection.WGridTabSingleSelectionEditor; import org.compiere.model.GridField; import org.compiere.model.GridTab; import org.compiere.util.DisplayType; @@ -189,6 +191,14 @@ public class DefaultEditorFactory implements IEditorFactory { { editor = new WAssignmentEditor(gridField); } + else if (displayType == DisplayType.SingleSelectionGrid) + { + editor = new WGridTabSingleSelectionEditor(gridField, tableEditor); + } + else if (displayType == DisplayType.MultipleSelectionGrid) + { + editor = new WGridTabMultiSelectionEditor(gridField, tableEditor); + } else { editor = new WUnknownEditor(gridField); From 3d1c1aea15efa6bba38e8b301d94f95ab0f5fcd8 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Tue, 26 Jul 2016 17:29:16 +0800 Subject: [PATCH 11/22] 1006181 Speed-up windows - Field to show read-only grid. Fixed selected label bug. Added clear selection context menu. (IDEMPIERE-3269) --- .../oracle/201607261600_Ticket_1006181.sql | 16 ++++++++++++ .../201607261600_Ticket_1006181.sql | 12 +++++++++ .../selection/GridTabSelectionListView.java | 14 +---------- .../WGridTabMultiSelectionEditor.java | 25 +++++++++++++++++-- .../WGridTabSingleSelectionEditor.java | 25 +++++++++++++++++-- 5 files changed, 75 insertions(+), 17 deletions(-) create mode 100644 migration/i3.1/oracle/201607261600_Ticket_1006181.sql create mode 100644 migration/i3.1/postgresql/201607261600_Ticket_1006181.sql diff --git a/migration/i3.1/oracle/201607261600_Ticket_1006181.sql b/migration/i3.1/oracle/201607261600_Ticket_1006181.sql new file mode 100644 index 0000000000..b16d68bf37 --- /dev/null +++ b/migration/i3.1/oracle/201607261600_Ticket_1006181.sql @@ -0,0 +1,16 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Jul 26, 2016 4:43:35 PM MYT +-- 1006181 Speed-up windows - Field to show read-only grid +UPDATE AD_Field SET DisplayLogic='@AD_Column_ID.AD_Reference_ID@=200127|@AD_Column_ID.AD_Reference_ID@=200128|@AD_Reference_ID@=200127|@AD_Reference_ID@=200128',Updated=TO_DATE('2016-07-26 16:43:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6432 +; + +-- Jul 26, 2016 4:45:34 PM MYT +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,MsgTip,AD_Message_UU,Updated,Value,IsActive,CreatedBy,AD_Org_ID,AD_Client_ID,Created,UpdatedBy,EntityType) VALUES ('I','Clear Selection',200404,'Clear current selections','af2f6c7a-7f24-46e2-8ae7-0b67ca44890f',TO_DATE('2016-07-26 16:45:27','YYYY-MM-DD HH24:MI:SS'),'ClearSelection','Y',100,0,0,TO_DATE('2016-07-26 16:45:27','YYYY-MM-DD HH24:MI:SS'),100,'D') +; + +SELECT register_migration_script('201607261600_Ticket_1006181.sql') FROM dual +; + + diff --git a/migration/i3.1/postgresql/201607261600_Ticket_1006181.sql b/migration/i3.1/postgresql/201607261600_Ticket_1006181.sql new file mode 100644 index 0000000000..0b85d42c39 --- /dev/null +++ b/migration/i3.1/postgresql/201607261600_Ticket_1006181.sql @@ -0,0 +1,12 @@ +-- Jul 26, 2016 4:43:35 PM MYT +-- 1006181 Speed-up windows - Field to show read-only grid +UPDATE AD_Field SET DisplayLogic='@AD_Column_ID.AD_Reference_ID@=200127|@AD_Column_ID.AD_Reference_ID@=200128|@AD_Reference_ID@=200127|@AD_Reference_ID@=200128',Updated=TO_TIMESTAMP('2016-07-26 16:43:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6432 +; + +-- Jul 26, 2016 4:45:34 PM MYT +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,MsgTip,AD_Message_UU,Updated,Value,IsActive,CreatedBy,AD_Org_ID,AD_Client_ID,Created,UpdatedBy,EntityType) VALUES ('I','Clear Selection',200404,'Clear current selections','af2f6c7a-7f24-46e2-8ae7-0b67ca44890f',TO_TIMESTAMP('2016-07-26 16:45:27','YYYY-MM-DD HH24:MI:SS'),'ClearSelection','Y',100,0,0,TO_TIMESTAMP('2016-07-26 16:45:27','YYYY-MM-DD HH24:MI:SS'),100,'D') +; + +SELECT register_migration_script('201607261600_Ticket_1006181.sql') FROM dual +; + diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/GridTabSelectionListView.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/GridTabSelectionListView.java index 431e9f42c6..10acb8888a 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/GridTabSelectionListView.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/GridTabSelectionListView.java @@ -48,7 +48,7 @@ import org.zkoss.zul.ext.Selectable; * @author Low Heng Sin * */ -public class GridTabSelectionListView extends Borderlayout implements EventListener +public class GridTabSelectionListView extends Borderlayout { /** * @@ -262,7 +262,6 @@ public class GridTabSelectionListView extends Borderlayout implements EventListe listbox.setVflex(true); listbox.setHflex("1"); listbox.setSizedByContent(true); - listbox.addEventListener(Events.ON_SELECT, this); updateModel(); @@ -290,17 +289,6 @@ public class GridTabSelectionListView extends Borderlayout implements EventListe public void deactivate() { } - public void onEvent(Event event) throws Exception - { - if (event == null) - return; - else if (event.getTarget() == listbox) - { - int count = listbox.getSelectedCount(); - selectedLabel.setValue(Msg.getMsg(Env.getCtx(), "Selected") + " : " + count); - } - } - /** * * @return Listbox diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/WGridTabMultiSelectionEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/WGridTabMultiSelectionEditor.java index 89e983d258..91d873c04c 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/WGridTabMultiSelectionEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/WGridTabMultiSelectionEditor.java @@ -31,10 +31,12 @@ import org.compiere.model.GridTab; import org.compiere.model.GridTabVO; import org.compiere.model.GridWindow; import org.compiere.util.Env; +import org.compiere.util.Msg; import org.compiere.util.Util; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Events; import org.zkoss.zul.ListModel; +import org.zkoss.zul.Menuitem; import org.zkoss.zul.ext.Selectable; /** @@ -84,7 +86,7 @@ public class WGridTabMultiSelectionEditor extends WEditor implements ContextMenu { if (tableEditor) setVisible(false); - else if (gridField != null) + else if (gridField != null && gridField.getGridTab() != null) { int AD_Tab_ID = gridField.getIncluded_Tab_ID(); GridWindow gridWindow = gridField.getGridTab().getGridWindow(); @@ -96,11 +98,24 @@ public class WGridTabMultiSelectionEditor extends WEditor implements ContextMenu { GridTabVO vo = t.getVO(); listViewGridTab = new GridTab(vo, gridWindow); - listViewGridTab.setLinkColumnName(t.getLinkColumnName()); + String lcn = t.getLinkColumnName(); + if (Util.isEmpty(lcn)) { + t.setLinkColumnName(null); + lcn = t.getLinkColumnName(); + } + listViewGridTab.setLinkColumnName(lcn); getComponent().init(listViewGridTab); break; } } + + popupMenu = new WEditorPopupMenu(false, false, isShowPreference()); + Menuitem clear = new Menuitem(Msg.getMsg(Env.getCtx(), "ClearSelection"), null); + clear.setAttribute("EVENT", "onClearSelection"); + clear.addEventListener(Events.ON_CLICK, popupMenu); + popupMenu.appendChild(clear); + + getComponent().getListbox().setContext(popupMenu); } } @@ -223,6 +238,12 @@ public class WGridTabMultiSelectionEditor extends WEditor implements ContextMenu { WFieldRecordInfo.start(gridField); } + else if ("onClearSelection".equals(evt.getContextEvent())) + { + ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, null); + super.fireValueChange(changeEvent); + oldValue = null; + } } @Override diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/WGridTabSingleSelectionEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/WGridTabSingleSelectionEditor.java index ed963cf48f..e88f77032b 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/WGridTabSingleSelectionEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/WGridTabSingleSelectionEditor.java @@ -26,9 +26,11 @@ import org.compiere.model.GridTab; import org.compiere.model.GridTabVO; import org.compiere.model.GridWindow; import org.compiere.util.Env; +import org.compiere.util.Msg; import org.compiere.util.Util; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Events; +import org.zkoss.zul.Menuitem; /** * @@ -77,7 +79,7 @@ public class WGridTabSingleSelectionEditor extends WEditor implements ContextMen { if (tableEditor) setVisible(false); - else if (gridField != null) + else if (gridField != null && gridField.getGridTab() != null) { int AD_Tab_ID = gridField.getIncluded_Tab_ID(); GridWindow gridWindow = gridField.getGridTab().getGridWindow(); @@ -89,11 +91,24 @@ public class WGridTabSingleSelectionEditor extends WEditor implements ContextMen { GridTabVO vo = t.getVO(); listViewGridTab = new GridTab(vo, gridWindow); - listViewGridTab.setLinkColumnName(t.getLinkColumnName()); + String lcn = t.getLinkColumnName(); + if (Util.isEmpty(lcn)) { + t.setLinkColumnName(null); + lcn = t.getLinkColumnName(); + } + listViewGridTab.setLinkColumnName(lcn); getComponent().init(listViewGridTab); break; } } + + popupMenu = new WEditorPopupMenu(false, false, isShowPreference()); + Menuitem clear = new Menuitem(Msg.getMsg(Env.getCtx(), "ClearSelection"), null); + clear.setAttribute("EVENT", "onClearSelection"); + clear.addEventListener(Events.ON_CLICK, popupMenu); + popupMenu.appendChild(clear); + + getComponent().getListbox().setContext(popupMenu); } } @@ -174,6 +189,12 @@ public class WGridTabSingleSelectionEditor extends WEditor implements ContextMen { WFieldRecordInfo.start(gridField); } + else if ("onClearSelection".equals(evt.getContextEvent())) + { + ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, null); + super.fireValueChange(changeEvent); + oldValue = null; + } } @Override From fda19e207d1b6451427e647267af3a8e22d3c507 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Mon, 8 Aug 2016 13:21:10 +0800 Subject: [PATCH 12/22] 1006181 Speed-up windows - Field to show read-only grid. Fixed NPE and Grid View exception. (IDEMPIERE-3269) --- .../WGridTabMultiSelectionEditor.java | 61 ++++++++++++------- .../WGridTabSingleSelectionEditor.java | 59 ++++++++++++------ 2 files changed, 79 insertions(+), 41 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/WGridTabMultiSelectionEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/WGridTabMultiSelectionEditor.java index 91d873c04c..1e046fab09 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/WGridTabMultiSelectionEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/WGridTabMultiSelectionEditor.java @@ -20,6 +20,7 @@ import java.util.Set; import org.adempiere.webui.ValuePreference; import org.adempiere.webui.component.Listbox; +import org.adempiere.webui.component.Textbox; import org.adempiere.webui.editor.WEditor; import org.adempiere.webui.editor.WEditorPopupMenu; import org.adempiere.webui.event.ContextMenuEvent; @@ -33,6 +34,7 @@ import org.compiere.model.GridWindow; import org.compiere.util.Env; import org.compiere.util.Msg; import org.compiere.util.Util; +import org.zkoss.zk.ui.HtmlBasedComponent; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Events; import org.zkoss.zul.ListModel; @@ -55,6 +57,8 @@ public class WGridTabMultiSelectionEditor extends WEditor implements ContextMenu private GridTab listViewGridTab = null; private String currentLinkValue = null; + + private boolean readWrite; public WGridTabMultiSelectionEditor(GridField gridField) { this(gridField, false); @@ -62,35 +66,42 @@ public class WGridTabMultiSelectionEditor extends WEditor implements ContextMenu public WGridTabMultiSelectionEditor(GridField gridField, boolean tableEditor) { - super(new GridTabSelectionListView(true, gridField.getWindowNo()), gridField); + super(tableEditor ? new Textbox() : new GridTabSelectionListView(true, gridField.getWindowNo()), gridField); this.tableEditor = tableEditor; init(); } @Override - public GridTabSelectionListView getComponent() { - return (GridTabSelectionListView) component; + public HtmlBasedComponent getComponent() { + return (HtmlBasedComponent) component; } @Override public boolean isReadWrite() { - return !getComponent().getListbox().isEnabled(); + return readWrite; } @Override public void setReadWrite(boolean readWrite) { - getComponent().getListbox().setEnabled(readWrite); + if (getComponent() instanceof GridTabSelectionListView) { + GridTabSelectionListView listView = (GridTabSelectionListView) getComponent(); + listView.getListbox().setEnabled(readWrite); + } + this.readWrite = readWrite; } private void init() { if (tableEditor) - setVisible(false); + { + ((Textbox)getComponent()).setReadonly(true); + } else if (gridField != null && gridField.getGridTab() != null) { int AD_Tab_ID = gridField.getIncluded_Tab_ID(); GridWindow gridWindow = gridField.getGridTab().getGridWindow(); int count = gridWindow.getTabCount(); + GridTabSelectionListView listView = (GridTabSelectionListView) getComponent(); for(int i = 0; i < count; i++) { GridTab t = gridWindow.getTab(i); @@ -104,7 +115,7 @@ public class WGridTabMultiSelectionEditor extends WEditor implements ContextMenu lcn = t.getLinkColumnName(); } listViewGridTab.setLinkColumnName(lcn); - getComponent().init(listViewGridTab); + listView.init(listViewGridTab); break; } } @@ -115,7 +126,7 @@ public class WGridTabMultiSelectionEditor extends WEditor implements ContextMenu clear.addEventListener(Events.ON_CLICK, popupMenu); popupMenu.appendChild(clear); - getComponent().getListbox().setContext(popupMenu); + listView.getListbox().setContext(popupMenu); } } @@ -124,7 +135,8 @@ public class WGridTabMultiSelectionEditor extends WEditor implements ContextMenu if (Events.ON_SELECT.equals(event.getName())) { Object newValue = null; - Listbox listbox = getComponent().getListbox(); + GridTabSelectionListView listView = (GridTabSelectionListView) getComponent(); + Listbox listbox = listView.getListbox(); ListModel model = listbox.getModel(); if (model != null && model instanceof Selectable) { @@ -142,7 +154,7 @@ public class WGridTabMultiSelectionEditor extends WEditor implements ContextMenu } else { - int[] selection = getComponent().getListbox().getSelectedIndices(); + int[] selection = listView.getListbox().getSelectedIndices(); StringBuilder buffer = new StringBuilder(); for(int rowIndex : selection) { @@ -190,10 +202,14 @@ public class WGridTabMultiSelectionEditor extends WEditor implements ContextMenu return; } oldValue = value; - updateSlectedIndices(); + if (!tableEditor) + updateSlectedIndices(); + else + ((Textbox)getComponent()).setValue(oldValue != null ? oldValue.toString() : ""); } private void updateSlectedIndices() { + GridTabSelectionListView listView = (GridTabSelectionListView) getComponent(); if (!Util.isEmpty((String)oldValue)) { List list = new ArrayList(); @@ -212,11 +228,11 @@ public class WGridTabMultiSelectionEditor extends WEditor implements ContextMenu { selectedIndices[i] = list.get(i); } - getComponent().setSelectedIndices(selectedIndices); + listView.setSelectedIndices(selectedIndices); } else { - getComponent().clearSelection(); + listView.clearSelection(); } } @@ -248,14 +264,17 @@ public class WGridTabMultiSelectionEditor extends WEditor implements ContextMenu @Override public void dynamicDisplay() { - String name = listViewGridTab.getLinkColumnName(); - String linkValue = Env.getContext(Env.getCtx(), gridField.getWindowNo(), name); - if ((currentLinkValue == null && linkValue != null) - || (currentLinkValue != null && linkValue == null) - || (currentLinkValue != null && linkValue != null && !currentLinkValue.equals(linkValue))) - { - getComponent().refresh(listViewGridTab); - updateSlectedIndices(); + if (!tableEditor && listViewGridTab != null) { + String name = listViewGridTab.getLinkColumnName(); + String linkValue = Env.getContext(Env.getCtx(), gridField.getWindowNo(), name); + if ((currentLinkValue == null && linkValue != null) + || (currentLinkValue != null && linkValue == null) + || (currentLinkValue != null && linkValue != null && !currentLinkValue.equals(linkValue))) + { + GridTabSelectionListView listView = (GridTabSelectionListView) getComponent(); + listView.refresh(listViewGridTab); + updateSlectedIndices(); + } } } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/WGridTabSingleSelectionEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/WGridTabSingleSelectionEditor.java index e88f77032b..2bd50a9c66 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/WGridTabSingleSelectionEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/WGridTabSingleSelectionEditor.java @@ -15,6 +15,7 @@ package org.adempiere.webui.editor.grid.selection; import org.adempiere.webui.ValuePreference; +import org.adempiere.webui.component.Textbox; import org.adempiere.webui.editor.WEditor; import org.adempiere.webui.editor.WEditorPopupMenu; import org.adempiere.webui.event.ContextMenuEvent; @@ -28,6 +29,7 @@ import org.compiere.model.GridWindow; import org.compiere.util.Env; import org.compiere.util.Msg; import org.compiere.util.Util; +import org.zkoss.zk.ui.HtmlBasedComponent; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Events; import org.zkoss.zul.Menuitem; @@ -49,41 +51,50 @@ public class WGridTabSingleSelectionEditor extends WEditor implements ContextMen private String currentLinkValue = null; + private boolean readWrite; + public WGridTabSingleSelectionEditor(GridField gridField) { this(gridField, false); } public WGridTabSingleSelectionEditor(GridField gridField, boolean tableEditor) { - super(new GridTabSelectionListView(false, gridField.getWindowNo()), gridField); + super(tableEditor ? new Textbox() : new GridTabSelectionListView(false, gridField.getWindowNo()), gridField); this.tableEditor = tableEditor; init(); } @Override - public GridTabSelectionListView getComponent() { - return (GridTabSelectionListView) component; + public HtmlBasedComponent getComponent() { + return (HtmlBasedComponent) component; } @Override public boolean isReadWrite() { - return !getComponent().getListbox().isEnabled(); + return readWrite; } @Override public void setReadWrite(boolean readWrite) { - getComponent().getListbox().setEnabled(readWrite); + if (getComponent() instanceof GridTabSelectionListView) { + GridTabSelectionListView listView = (GridTabSelectionListView) getComponent(); + listView.getListbox().setEnabled(readWrite); + } + this.readWrite = readWrite; } private void init() { if (tableEditor) - setVisible(false); + { + ((Textbox)getComponent()).setReadonly(true); + } else if (gridField != null && gridField.getGridTab() != null) { int AD_Tab_ID = gridField.getIncluded_Tab_ID(); GridWindow gridWindow = gridField.getGridTab().getGridWindow(); int count = gridWindow.getTabCount(); + GridTabSelectionListView listView = (GridTabSelectionListView) getComponent(); for(int i = 0; i < count; i++) { GridTab t = gridWindow.getTab(i); @@ -97,7 +108,7 @@ public class WGridTabSingleSelectionEditor extends WEditor implements ContextMen lcn = t.getLinkColumnName(); } listViewGridTab.setLinkColumnName(lcn); - getComponent().init(listViewGridTab); + listView.init(listViewGridTab); break; } } @@ -108,7 +119,7 @@ public class WGridTabSingleSelectionEditor extends WEditor implements ContextMen clear.addEventListener(Events.ON_CLICK, popupMenu); popupMenu.appendChild(clear); - getComponent().getListbox().setContext(popupMenu); + listView.getListbox().setContext(popupMenu); } } @@ -116,7 +127,8 @@ public class WGridTabSingleSelectionEditor extends WEditor implements ContextMen { if (Events.ON_SELECT.equals(event.getName())) { - int selected = getComponent().getListbox().getSelectedIndex(); + GridTabSelectionListView listView = (GridTabSelectionListView) getComponent(); + int selected = listView.getListbox().getSelectedIndex(); Object newValue = selected >= 0 ? Integer.toString(listViewGridTab.getKeyID(selected)) : null; if (oldValue != null && newValue != null && oldValue.equals(newValue)) { return; @@ -154,17 +166,21 @@ public class WGridTabSingleSelectionEditor extends WEditor implements ContextMen return; } oldValue = value; - updateSlectedIndices(); + if (!tableEditor) + updateSlectedIndices(); + else + ((Textbox)getComponent()).setValue(oldValue != null ? oldValue.toString() : ""); } private void updateSlectedIndices() { - getComponent().clearSelection(); + GridTabSelectionListView listView = (GridTabSelectionListView) getComponent(); + listView.clearSelection(); if (!Util.isEmpty((String)oldValue)) { int id = Integer.parseInt((String) oldValue); for(int i = 0; i < listViewGridTab.getRowCount(); i++) { if (listViewGridTab.getKeyID(i) == id) { - getComponent().setSelectedIndex(i); + listView.setSelectedIndex(i); return; } } @@ -199,14 +215,17 @@ public class WGridTabSingleSelectionEditor extends WEditor implements ContextMen @Override public void dynamicDisplay() { - String name = listViewGridTab.getLinkColumnName(); - String linkValue = Env.getContext(Env.getCtx(), gridField.getWindowNo(), name); - if ((currentLinkValue == null && linkValue != null) - || (currentLinkValue != null && linkValue == null) - || (currentLinkValue != null && linkValue != null && !currentLinkValue.equals(linkValue))) - { - getComponent().refresh(listViewGridTab); - updateSlectedIndices(); + if (!tableEditor && listViewGridTab != null) { + String name = listViewGridTab.getLinkColumnName(); + String linkValue = Env.getContext(Env.getCtx(), gridField.getWindowNo(), name); + if ((currentLinkValue == null && linkValue != null) + || (currentLinkValue != null && linkValue == null) + || (currentLinkValue != null && linkValue != null && !currentLinkValue.equals(linkValue))) + { + GridTabSelectionListView listView = (GridTabSelectionListView) getComponent(); + listView.refresh(listViewGridTab); + updateSlectedIndices(); + } } } } From 7b0ce20cb86980648c3da9af84969ae8877e9738 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Tue, 9 Aug 2016 17:21:55 +0800 Subject: [PATCH 13/22] 1006181 Speed-up windows - Field to show read-only grid. Fixed sorting. (IDEMPIERE-3269) --- .../grid/selection/GridTabSelectionListView.java | 10 ++++++++++ .../grid/selection/SimpleGridTableListModel.java | 6 +++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/GridTabSelectionListView.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/GridTabSelectionListView.java index 10acb8888a..33dee3488c 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/GridTabSelectionListView.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/GridTabSelectionListView.java @@ -237,6 +237,7 @@ public class GridTabSelectionListView extends Borderlayout ListHeader colHeader = new ListHeader(); colHeader.setSort("auto"); colHeader.setLabel(gridField[i].getHeader()); + colHeader.setAttribute("ColumnIndex", getColumnIndex(gridField[i].getColumnName())); if (columnWidthMap != null && columnWidthMap.get(gridField[i].getAD_Field_ID()) != null) { colHeader.setWidth(columnWidthMap.get(gridField[i].getAD_Field_ID())); } else { @@ -256,6 +257,15 @@ public class GridTabSelectionListView extends Borderlayout listbox.appendChild(header); } + private int getColumnIndex(String columnName) { + for(int i = 0; i < gridTab.getTableModel().getColumnCount(); i++) { + if (gridTab.getTableModel().getColumnName(i).equals(columnName)) { + return i; + } + } + return -1; + } + private void render() { listbox.setStyle("min-height: 200px"); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/SimpleGridTableListModel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/SimpleGridTableListModel.java index 41f4f45288..7cdb06941d 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/SimpleGridTableListModel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/grid/selection/SimpleGridTableListModel.java @@ -113,7 +113,11 @@ public class SimpleGridTableListModel extends AbstractListModel im //use default zk comparator if (cmpr instanceof ListitemComparator) { ListitemComparator lic = (ListitemComparator) cmpr; - tableModel.sort(lic.getListheader().getColumnIndex(), ascending); + Integer index = (Integer) lic.getListheader().getAttribute("ColumnIndex"); + if (index != null && index.intValue() >= 0) + tableModel.sort(index.intValue(), ascending); + else + tableModel.sort(lic.getListheader().getColumnIndex(), ascending); } else if (cmpr instanceof SortComparator) { SortComparator sc = (SortComparator)cmpr; tableModel.sort(sc.getColumnIndex(), ascending); From d23d6a1b44126ca79aae1a202bcf3fba46697137 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 15 Dec 2016 14:08:16 +0100 Subject: [PATCH 14/22] IDEMPIERE-3269 Field to show read-only grid / fix integration issue adding same method as IDEMPIERE-2331 --- org.adempiere.base/src/org/compiere/model/GridTab.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/GridTab.java b/org.adempiere.base/src/org/compiere/model/GridTab.java index 5bb961f489..909348cb31 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTab.java +++ b/org.adempiere.base/src/org/compiere/model/GridTab.java @@ -155,10 +155,6 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable // The window of this tab private GridWindow m_window; - public GridWindow getGridWindow() { - return m_window; - } - /** The Table Model for Query */ private GridTable m_mTable = null; From 3a813602ead4ab3bcd4df9c6ae948f311c834ceb Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Fri, 16 Dec 2016 17:44:08 +0100 Subject: [PATCH 15/22] fix issue with the launcher - not detecting java sources --- org.adempiere.server-feature/server.product.launch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.adempiere.server-feature/server.product.launch b/org.adempiere.server-feature/server.product.launch index 2ea1560880..916dafc3e5 100644 --- a/org.adempiere.server-feature/server.product.launch +++ b/org.adempiere.server-feature/server.product.launch @@ -15,7 +15,7 @@ - + From 8d236a3a9d5d65aaea9edb871891e1dc91a186e3 Mon Sep 17 00:00:00 2001 From: hieplq Date: Fri, 16 Dec 2016 16:12:14 +0700 Subject: [PATCH 16/22] IDEMPIERE-2273:CSV Import fail on evaluate column mandatory logic --- .../org/adempiere/impexp/GridTabCSVImporter.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java index f62dd73b17..e35ce4819c 100644 --- a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java +++ b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java @@ -940,8 +940,17 @@ public class GridTabCSVImporter implements IGridTabImporter if (!(field.isDisplayed() || field.isDisplayedGrid())) return new StringBuilder(Msg.getMsg(Env.getCtx(), "FieldNotDisplayed",new Object[] {header.get(i)})); - MColumn column = MColumn.get(Env.getCtx(), field.getAD_Column_ID()); - if((field.isMandatory(false) || column.isMandatory()) && value == null && field.getDefault()==null){ + MColumn column = MColumn.get(Env.getCtx(), field.getAD_Column_ID()); + boolean isWrongValueForMandatory = false; + if (field.isMandatory(false) || column.isMandatory()){ + if (isInsertMode() && value == null && field.getDefault()==null){ + isWrongValueForMandatory = true; + }else if (!isInsertMode() && "(null)".equals(value)){ + isWrongValueForMandatory = true; + } + } + + if(isWrongValueForMandatory){ mandatoryColumns.append(" / "); mandatoryColumns.append(header.get(i)); } From e9f3492ae3a38f744c631cf3ed5df5c1f1c995b3 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 21 Dec 2016 12:49:15 +0100 Subject: [PATCH 17/22] IDEMPIERE-3272 Configure quick entry for basic tables / System Element --- .../201612191644_SystemElementQuickEntry.sql | 31 +++++++++++++++++++ .../201612191644_SystemElementQuickEntry.sql | 28 +++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 migration/i4.1/oracle/201612191644_SystemElementQuickEntry.sql create mode 100644 migration/i4.1/postgresql/201612191644_SystemElementQuickEntry.sql diff --git a/migration/i4.1/oracle/201612191644_SystemElementQuickEntry.sql b/migration/i4.1/oracle/201612191644_SystemElementQuickEntry.sql new file mode 100644 index 0000000000..0036f3bcda --- /dev/null +++ b/migration/i4.1/oracle/201612191644_SystemElementQuickEntry.sql @@ -0,0 +1,31 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-3272 +-- Dec 19, 2016 4:43:42 PM CET +UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsQuickEntry='Y', IsToolbarButton=NULL,Updated=TO_DATE('2016-12-19 16:43:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1397 +; + +-- Dec 19, 2016 4:43:48 PM CET +UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsQuickEntry='Y', IsToolbarButton=NULL,Updated=TO_DATE('2016-12-19 16:43:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1400 +; + +-- Dec 19, 2016 4:43:51 PM CET +UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsQuickEntry='Y', IsToolbarButton=NULL,Updated=TO_DATE('2016-12-19 16:43:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3270 +; + +-- Dec 19, 2016 4:43:55 PM CET +UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsQuickEntry='Y', IsToolbarButton=NULL,Updated=TO_DATE('2016-12-19 16:43:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1398 +; + +-- Dec 19, 2016 4:43:57 PM CET +UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsQuickEntry='Y', IsToolbarButton=NULL,Updated=TO_DATE('2016-12-19 16:43:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1401 +; + +-- Dec 19, 2016 4:44:02 PM CET +UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsQuickEntry='Y', IsToolbarButton=NULL,Updated=TO_DATE('2016-12-19 16:44:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5127 +; + +SELECT register_migration_script('201612191644_SystemElementQuickEntry.sql') FROM dual +; + diff --git a/migration/i4.1/postgresql/201612191644_SystemElementQuickEntry.sql b/migration/i4.1/postgresql/201612191644_SystemElementQuickEntry.sql new file mode 100644 index 0000000000..82cecdd133 --- /dev/null +++ b/migration/i4.1/postgresql/201612191644_SystemElementQuickEntry.sql @@ -0,0 +1,28 @@ +-- IDEMPIERE-3272 +-- Dec 19, 2016 4:43:42 PM CET +UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsQuickEntry='Y', IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2016-12-19 16:43:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1397 +; + +-- Dec 19, 2016 4:43:48 PM CET +UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsQuickEntry='Y', IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2016-12-19 16:43:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1400 +; + +-- Dec 19, 2016 4:43:51 PM CET +UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsQuickEntry='Y', IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2016-12-19 16:43:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3270 +; + +-- Dec 19, 2016 4:43:55 PM CET +UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsQuickEntry='Y', IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2016-12-19 16:43:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1398 +; + +-- Dec 19, 2016 4:43:57 PM CET +UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsQuickEntry='Y', IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2016-12-19 16:43:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1401 +; + +-- Dec 19, 2016 4:44:02 PM CET +UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsQuickEntry='Y', IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2016-12-19 16:44:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5127 +; + +SELECT register_migration_script('201612191644_SystemElementQuickEntry.sql') FROM dual +; + From 54afa51292875c41d3a25da115067a5e8c22dd32 Mon Sep 17 00:00:00 2001 From: Nicolas Micoud Date: Wed, 21 Dec 2016 12:51:18 +0100 Subject: [PATCH 18/22] IDEMPIERE-3269 Field to show read-only grid / fix oracle migration script --- .../oracle/201607191600_Ticket_1006181.sql | 66 +++++++++---------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/migration/i3.1/oracle/201607191600_Ticket_1006181.sql b/migration/i3.1/oracle/201607191600_Ticket_1006181.sql index 5fbe086802..8feb8c003f 100644 --- a/migration/i3.1/oracle/201607191600_Ticket_1006181.sql +++ b/migration/i3.1/oracle/201607191600_Ticket_1006181.sql @@ -14,135 +14,135 @@ INSERT INTO AD_Reference (AD_Reference_ID,Name,AD_Reference_UU,IsOrderByValue,AD ; -- Jul 15, 2016 6:24:20 PM MYT -UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=6432 +UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y', Updated=Sysdate, UpdatedBy=100 WHERE AD_Field_ID=6432 ; -- Jul 15, 2016 6:24:20 PM MYT -UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=132 +UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y', Updated=Sysdate, UpdatedBy=100 WHERE AD_Field_ID=132 ; -- Jul 15, 2016 6:24:21 PM MYT -UPDATE AD_Field SET SeqNo=140,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=200276 +UPDATE AD_Field SET SeqNo=140,IsDisplayed='Y', Updated=Sysdate, UpdatedBy=100 WHERE AD_Field_ID=200276 ; -- Jul 15, 2016 6:24:21 PM MYT -UPDATE AD_Field SET SeqNo=150,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=200771 +UPDATE AD_Field SET SeqNo=150,IsDisplayed='Y', Updated=Sysdate, UpdatedBy=100 WHERE AD_Field_ID=200771 ; -- Jul 15, 2016 6:24:21 PM MYT -UPDATE AD_Field SET SeqNo=160,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=924 +UPDATE AD_Field SET SeqNo=160,IsDisplayed='Y', Updated=Sysdate, UpdatedBy=100 WHERE AD_Field_ID=924 ; -- Jul 15, 2016 6:24:21 PM MYT -UPDATE AD_Field SET SeqNo=170,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=133 +UPDATE AD_Field SET SeqNo=170,IsDisplayed='Y', Updated=Sysdate, UpdatedBy=100 WHERE AD_Field_ID=133 ; -- Jul 15, 2016 6:24:21 PM MYT -UPDATE AD_Field SET SeqNo=180,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=137 +UPDATE AD_Field SET SeqNo=180,IsDisplayed='Y', Updated=Sysdate, UpdatedBy=100 WHERE AD_Field_ID=137 ; -- Jul 15, 2016 6:24:21 PM MYT -UPDATE AD_Field SET SeqNo=190,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=200274 +UPDATE AD_Field SET SeqNo=190,IsDisplayed='Y', Updated=Sysdate, UpdatedBy=100 WHERE AD_Field_ID=200274 ; -- Jul 15, 2016 6:24:21 PM MYT -UPDATE AD_Field SET SeqNo=200,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=138 +UPDATE AD_Field SET SeqNo=200,IsDisplayed='Y', Updated=Sysdate, UpdatedBy=100 WHERE AD_Field_ID=138 ; -- Jul 15, 2016 6:24:21 PM MYT -UPDATE AD_Field SET SeqNo=210,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=202362 +UPDATE AD_Field SET SeqNo=210,IsDisplayed='Y', Updated=Sysdate, UpdatedBy=100 WHERE AD_Field_ID=202362 ; -- Jul 15, 2016 6:24:21 PM MYT -UPDATE AD_Field SET SeqNo=220,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=142 +UPDATE AD_Field SET SeqNo=220,IsDisplayed='Y', Updated=Sysdate, UpdatedBy=100 WHERE AD_Field_ID=142 ; -- Jul 15, 2016 6:24:21 PM MYT -UPDATE AD_Field SET SeqNo=230,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=8343 +UPDATE AD_Field SET SeqNo=230,IsDisplayed='Y', Updated=Sysdate, UpdatedBy=100 WHERE AD_Field_ID=8343 ; -- Jul 15, 2016 6:24:21 PM MYT -UPDATE AD_Field SET SeqNo=240,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=140 +UPDATE AD_Field SET SeqNo=240,IsDisplayed='Y', Updated=Sysdate, UpdatedBy=100 WHERE AD_Field_ID=140 ; -- Jul 15, 2016 6:24:21 PM MYT -UPDATE AD_Field SET SeqNo=250,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=202341 +UPDATE AD_Field SET SeqNo=250,IsDisplayed='Y', Updated=Sysdate, UpdatedBy=100 WHERE AD_Field_ID=202341 ; -- Jul 15, 2016 6:24:21 PM MYT -UPDATE AD_Field SET SeqNo=260,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=141 +UPDATE AD_Field SET SeqNo=260,IsDisplayed='Y', Updated=Sysdate, UpdatedBy=100 WHERE AD_Field_ID=141 ; -- Jul 15, 2016 6:24:21 PM MYT -UPDATE AD_Field SET SeqNo=270,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=200350 +UPDATE AD_Field SET SeqNo=270,IsDisplayed='Y', Updated=Sysdate, UpdatedBy=100 WHERE AD_Field_ID=200350 ; -- Jul 15, 2016 6:24:21 PM MYT -UPDATE AD_Field SET SeqNo=280,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=200348 +UPDATE AD_Field SET SeqNo=280,IsDisplayed='Y', Updated=Sysdate, UpdatedBy=100 WHERE AD_Field_ID=200348 ; -- Jul 15, 2016 6:24:21 PM MYT -UPDATE AD_Field SET SeqNo=290,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=200349 +UPDATE AD_Field SET SeqNo=290,IsDisplayed='Y', Updated=Sysdate, UpdatedBy=100 WHERE AD_Field_ID=200349 ; -- Jul 15, 2016 6:24:21 PM MYT -UPDATE AD_Field SET SeqNo=300,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=204213 +UPDATE AD_Field SET SeqNo=300,IsDisplayed='Y', Updated=Sysdate, UpdatedBy=100 WHERE AD_Field_ID=204213 ; -- Jul 15, 2016 6:24:21 PM MYT -UPDATE AD_Field SET SeqNo=310,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=204214 +UPDATE AD_Field SET SeqNo=310,IsDisplayed='Y', Updated=Sysdate, UpdatedBy=100 WHERE AD_Field_ID=204214 ; -- Jul 15, 2016 6:24:21 PM MYT -UPDATE AD_Field SET SeqNo=320,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=13425 +UPDATE AD_Field SET SeqNo=320,IsDisplayed='Y', Updated=Sysdate, UpdatedBy=100 WHERE AD_Field_ID=13425 ; -- Jul 15, 2016 6:24:21 PM MYT -UPDATE AD_Field SET SeqNo=330,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=200837 +UPDATE AD_Field SET SeqNo=330,IsDisplayed='Y', Updated=Sysdate, UpdatedBy=100 WHERE AD_Field_ID=200837 ; -- Jul 15, 2016 6:24:21 PM MYT -UPDATE AD_Field SET SeqNo=340,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=54402 +UPDATE AD_Field SET SeqNo=340,IsDisplayed='Y', Updated=Sysdate, UpdatedBy=100 WHERE AD_Field_ID=54402 ; -- Jul 15, 2016 6:24:22 PM MYT -UPDATE AD_Field SET SeqNo=350,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=54401 +UPDATE AD_Field SET SeqNo=350,IsDisplayed='Y', Updated=Sysdate, UpdatedBy=100 WHERE AD_Field_ID=54401 ; -- Jul 15, 2016 6:24:22 PM MYT -UPDATE AD_Field SET SeqNo=360,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=200838 +UPDATE AD_Field SET SeqNo=360,IsDisplayed='Y', Updated=Sysdate, UpdatedBy=100 WHERE AD_Field_ID=200838 ; -- Jul 15, 2016 6:24:22 PM MYT -UPDATE AD_Field SET SeqNo=370,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=200834 +UPDATE AD_Field SET SeqNo=370,IsDisplayed='Y', Updated=Sysdate, UpdatedBy=100 WHERE AD_Field_ID=200834 ; -- Jul 15, 2016 6:24:22 PM MYT -UPDATE AD_Field SET SeqNo=380,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=13424 +UPDATE AD_Field SET SeqNo=380,IsDisplayed='Y', Updated=Sysdate, UpdatedBy=100 WHERE AD_Field_ID=13424 ; -- Jul 15, 2016 6:24:22 PM MYT -UPDATE AD_Field SET SeqNo=390,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=62468 +UPDATE AD_Field SET SeqNo=390,IsDisplayed='Y', Updated=Sysdate, UpdatedBy=100 WHERE AD_Field_ID=62468 ; -- Jul 15, 2016 6:24:22 PM MYT -UPDATE AD_Field SET SeqNo=400,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=53280 +UPDATE AD_Field SET SeqNo=400,IsDisplayed='Y', Updated=Sysdate, UpdatedBy=100 WHERE AD_Field_ID=53280 ; -- Jul 15, 2016 6:24:22 PM MYT -UPDATE AD_Field SET SeqNo=410,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=200836 +UPDATE AD_Field SET SeqNo=410,IsDisplayed='Y', Updated=Sysdate, UpdatedBy=100 WHERE AD_Field_ID=200836 ; -- Jul 15, 2016 6:24:22 PM MYT -UPDATE AD_Field SET SeqNo=420,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=200835 +UPDATE AD_Field SET SeqNo=420,IsDisplayed='Y', Updated=Sysdate, UpdatedBy=100 WHERE AD_Field_ID=200835 ; -- Jul 15, 2016 6:24:22 PM MYT -UPDATE AD_Field SET SeqNo=430,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=136 +UPDATE AD_Field SET SeqNo=430,IsDisplayed='Y', Updated=Sysdate, UpdatedBy=100 WHERE AD_Field_ID=136 ; -- Jul 15, 2016 6:24:22 PM MYT -UPDATE AD_Field SET SeqNo=440,IsDisplayed='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=139 +UPDATE AD_Field SET SeqNo=440,IsDisplayed='Y', Updated=Sysdate, UpdatedBy=100 WHERE AD_Field_ID=139 ; -- Jul 15, 2016 6:27:18 PM MYT From 66a493bc90a9fcd4810211ee0657fd5d148db2f5 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 21 Dec 2016 12:54:41 +0100 Subject: [PATCH 19/22] IDEMPIERE-3270 fix wrong folder integration issue --- .../{i3.1 => i4.1}/oracle/201605101800_System_Ticket_1006008.sql | 0 migration/{i3.1 => i4.1}/oracle/201605231800_Ticket_1006008.sql | 0 .../postgresql/201605101800_System_Ticket_1006008.sql | 0 .../{i3.1 => i4.1}/postgresql/201605231800_Ticket_1006008.sql | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename migration/{i3.1 => i4.1}/oracle/201605101800_System_Ticket_1006008.sql (100%) rename migration/{i3.1 => i4.1}/oracle/201605231800_Ticket_1006008.sql (100%) rename migration/{i3.1 => i4.1}/postgresql/201605101800_System_Ticket_1006008.sql (100%) rename migration/{i3.1 => i4.1}/postgresql/201605231800_Ticket_1006008.sql (100%) diff --git a/migration/i3.1/oracle/201605101800_System_Ticket_1006008.sql b/migration/i4.1/oracle/201605101800_System_Ticket_1006008.sql similarity index 100% rename from migration/i3.1/oracle/201605101800_System_Ticket_1006008.sql rename to migration/i4.1/oracle/201605101800_System_Ticket_1006008.sql diff --git a/migration/i3.1/oracle/201605231800_Ticket_1006008.sql b/migration/i4.1/oracle/201605231800_Ticket_1006008.sql similarity index 100% rename from migration/i3.1/oracle/201605231800_Ticket_1006008.sql rename to migration/i4.1/oracle/201605231800_Ticket_1006008.sql diff --git a/migration/i3.1/postgresql/201605101800_System_Ticket_1006008.sql b/migration/i4.1/postgresql/201605101800_System_Ticket_1006008.sql similarity index 100% rename from migration/i3.1/postgresql/201605101800_System_Ticket_1006008.sql rename to migration/i4.1/postgresql/201605101800_System_Ticket_1006008.sql diff --git a/migration/i3.1/postgresql/201605231800_Ticket_1006008.sql b/migration/i4.1/postgresql/201605231800_Ticket_1006008.sql similarity index 100% rename from migration/i3.1/postgresql/201605231800_Ticket_1006008.sql rename to migration/i4.1/postgresql/201605231800_Ticket_1006008.sql From a697612728a290c66fc0f97a1d3145beff18a67f Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 21 Dec 2016 12:55:46 +0100 Subject: [PATCH 20/22] IDEMPIERE-3269 fix wrong folder integration issue --- migration/{i3.1 => i4.1}/oracle/201607191600_Ticket_1006181.sql | 0 migration/{i3.1 => i4.1}/oracle/201607261600_Ticket_1006181.sql | 0 .../{i3.1 => i4.1}/postgresql/201607191600_Ticket_1006181.sql | 0 .../{i3.1 => i4.1}/postgresql/201607261600_Ticket_1006181.sql | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename migration/{i3.1 => i4.1}/oracle/201607191600_Ticket_1006181.sql (100%) rename migration/{i3.1 => i4.1}/oracle/201607261600_Ticket_1006181.sql (100%) rename migration/{i3.1 => i4.1}/postgresql/201607191600_Ticket_1006181.sql (100%) rename migration/{i3.1 => i4.1}/postgresql/201607261600_Ticket_1006181.sql (100%) diff --git a/migration/i3.1/oracle/201607191600_Ticket_1006181.sql b/migration/i4.1/oracle/201607191600_Ticket_1006181.sql similarity index 100% rename from migration/i3.1/oracle/201607191600_Ticket_1006181.sql rename to migration/i4.1/oracle/201607191600_Ticket_1006181.sql diff --git a/migration/i3.1/oracle/201607261600_Ticket_1006181.sql b/migration/i4.1/oracle/201607261600_Ticket_1006181.sql similarity index 100% rename from migration/i3.1/oracle/201607261600_Ticket_1006181.sql rename to migration/i4.1/oracle/201607261600_Ticket_1006181.sql diff --git a/migration/i3.1/postgresql/201607191600_Ticket_1006181.sql b/migration/i4.1/postgresql/201607191600_Ticket_1006181.sql similarity index 100% rename from migration/i3.1/postgresql/201607191600_Ticket_1006181.sql rename to migration/i4.1/postgresql/201607191600_Ticket_1006181.sql diff --git a/migration/i3.1/postgresql/201607261600_Ticket_1006181.sql b/migration/i4.1/postgresql/201607261600_Ticket_1006181.sql similarity index 100% rename from migration/i3.1/postgresql/201607261600_Ticket_1006181.sql rename to migration/i4.1/postgresql/201607261600_Ticket_1006181.sql From f4648d26a15cfa015ffb139f1bcc64649117e09f Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 21 Dec 2016 19:30:38 +0100 Subject: [PATCH 21/22] Fix sample AccountingUS.csv to avoid the warning reported by Adam Tang at https://groups.google.com/d/msg/idempiere/V0emWIXtAiU/srBBnrNBCgAJ --- .../data/import/AccountingUS.csv | 62 +++++++++---------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/org.adempiere.server-feature/data/import/AccountingUS.csv b/org.adempiere.server-feature/data/import/AccountingUS.csv index 423ce7d773..0b5706d8e4 100644 --- a/org.adempiere.server-feature/data/import/AccountingUS.csv +++ b/org.adempiere.server-feature/data/import/AccountingUS.csv @@ -1,9 +1,9 @@ -"[Account_Value]","[Account_Name]","[Account_Description]","[Account_Type]","[Account_Sign]","[Account_Document]","[Account_Summary]","[Default_Account]","[Account_Parent]","[Balance Sheet]","[Balance Sheet_Name]","[US 1120 Balance Sheet]","US 1120 Balance Sheet_Name","[Profit & Loss]","[Profit & Loss_Name]","[US 1120 Income Statement]","[US 1120 Income Statement_Name]","[Cash Flow]","[Cash Flow_Name]" +[Account_Value],[Account_Name],[Account_Description],[Account_Type],[Account_Sign],[Account_Document],[Account_Summary],[Default_Account],[Account_Parent],[Balance Sheet],[Balance Sheet_Name],[US 1120 Balance Sheet],[US 1120 Balance Sheet_Name],[Profit & Loss],[Profit & Loss_Name],[US 1120 Income Statement],[US 1120 Income Statement_Name],[Cash Flow],[Cash Flow_Name] 1,"Assets",,"Asset",,,"Yes",,,1,"Assets",15,"Total Assets",,,,,, 11,"Cash",,"Asset",,,"Yes",,1,11,"Cash",1,"Cash",,,,,, 11100,"Checking Account","Bank Asset","Asset",,"Yes","No","B_ASSET_ACCT",11,,,,,,,,,, 11110,"Checking In-Transfer","Bank transactions in transit","Asset",,"Yes","No","B_INTRANSIT_ACCT",11,,,,,,,,,, -11120,"Checking Unidentified Receipts","Receipts from unidentified customer","Asset",,"Yes","No","",11,,,,,,,,,, +11120,"Checking Unidentified Receipts","Receipts from unidentified customer","Asset",,"Yes","No",,11,,,,,,,,,, 11130,"Checking Unallocated Receipts","Received, unallocated payments","Asset",,"Yes","No","B_UNALLOCATEDCASH_ACCT",11,,,,,,,,,, 11200,"Checking Account 2",,"Asset",,,"No",,11,,,,,,,,,, 11300,"Savings Account",,"Asset",,,"No",,11,,,,,,,,,, @@ -16,7 +16,7 @@ 12115,"Accounts Receivable Services - Trade","Accounts Receivables for Services","Asset",,"Yes","No","C_RECEIVABLE_SERVICES_ACCT",121,,,"2a","Trade nodes and accounts receivables",,,,,, 12120,"A/R Non Sufficient Funds Returned Checks",,"Asset",,,"No",,121,,,"2a",,,,,,, 12180,"A/R Trade Allowance for Bad Debit",,"Asset",,,"No",,121,,,"2b","Less allowances for bad debts",,,,,, -12190,"Not invoiced receivables","We delivered but have not invoiced yet","Asset",,"Yes","No","",121,,,"2a",,,,,,, +12190,"Not invoiced receivables","We delivered but have not invoiced yet","Asset",,"Yes","No",,121,,,"2a",,,,,,, 122,"Credit Card in Transit",,"Asset",,,"Yes",,12,,,,,,,,,, 12210,"In Transit A/R Amex",,"Asset",,,"No",,122,,,"2a",,,,,,, 12220,"In Transit A/R Master Card",,"Asset",,,"No",,122,,,"2a",,,,,,, @@ -30,10 +30,10 @@ 12440,"Loans Receivable Others",,"Asset",,,"No",,124,,,"2a",,,,,,, 125,"Prepayments",,"Asset",,,"Yes",,12,,,,,,,,,, 12510,"Vendor prepayment","Prepayments for future expense","Asset",,"Yes","No","V_PREPAYMENT_ACCT",125,,,"2a",,,,,,, -12520,"Employee Expense Prepayment","Expense advances","Asset",,"Yes","No","",125,,,"2a",,,,,,, +12520,"Employee Expense Prepayment","Expense advances","Asset",,"Yes","No",,125,,,"2a",,,,,,, 126,"Tax receivables",,"Asset",,,"Yes",,12,,,,,,,,,, 12610,"Tax credit A/R","Tax to be reimbursed - before tax declaration","Asset",,"Yes","No","T_CREDIT_ACCT",126,,,6,,,,,,, -12620,"Tax receivables","Tax to receive based on tax declaration","Asset",,"Yes","No","",126,,,6,,,,,,, +12620,"Tax receivables","Tax to receive based on tax declaration","Asset",,"Yes","No",,126,,,6,,,,,,, 12800,"Intercompany Due From","Default Receivables account for intercompany trx","Asset",,"Yes","No","INTERCOMPANYDUEFROM_ACCT",12,,,6,,,,,,, 12900,"A/R Miscellaneous",,"Asset",,,"No",,12,,,"2a",,,,,,, 13,"Investments",,"Asset",,,"Yes",,1,13,"Investments",,,,,,,, @@ -41,10 +41,10 @@ 13200,"Tax-Exempt Securities",,"Asset",,,"No",,13,,,5,"Tax-Exempt Securities",,,,,, 13300,"Other Investments",,"Asset",,,"No",,13,,,9,"Other Investments",,,,,, 14,"Inventory",,"Asset",,,"Yes",,1,14,"Inventory",3,"Inventories",,,,,, -14100,"General Trade Inventory","Inventory Account","Asset",,"Yes","No","",14,,,,,,,,,, +14100,"General Trade Inventory","Inventory Account","Asset",,"Yes","No",,14,,,,,,,,,, 14120,"Product asset","Product Inventory Account","Asset",,"Yes","No","P_ASSET_ACCT",14,,,,,,,,,, -14130,"Work In Process","Work In Process Account","Asset",,"Yes","No","",14,,,,,,,,,, -14140,"Floor Stock","Floor Stock Account","Asset",,"Yes","No","",14,,,,,,,,,, +14130,"Work In Process","Work In Process Account","Asset",,"Yes","No",,14,,,,,,,,,, +14140,"Floor Stock","Floor Stock Account","Asset",,"Yes","No",,14,,,,,,,,,, 15,"Prepaid Expenses, Deposits & Other Current Assets",,"Asset",,,"Yes",,1,15,"Prepaid Expenses, Deposits & Other Current Assets",6,"Other Current Assets",,,,,, 151,"Prepaid Expenses",,"Asset",,,"Yes",,15,,,,,,,,,, 15110,"Prepaid Insurance",,"Asset",,,"No",,151,,,,,,,,,, @@ -110,8 +110,8 @@ 21550,"Mail Order Deposits",,"Liability",,,"No",,215,,,,,,,,,, 216,"Tax Payables",,"Liability",,,"Yes",,21,,,18,"Other current liabilities",,,,,, 21610,"Tax due","Tax to be paid - before tax declaration","Liability",,"Yes","No","T_DUE_ACCT",216,,,,,,,,,, -21620,"Tax liability","Tax to be paid based on tax declaration","Liability",,"Yes","No","",216,,,,,,,,,, -21700,"Withholding (Tax)","Withholding for 1099 or Quality Guarantee","Liability",,"Yes","No","",21,,,,,,,,,, +21620,"Tax liability","Tax to be paid based on tax declaration","Liability",,"Yes","No",,216,,,,,,,,,, +21700,"Withholding (Tax)","Withholding for 1099 or Quality Guarantee","Liability",,"Yes","No",,21,,,,,,,,,, 21710,"Withholding (Other)",,"Liability",,,"No",,21,,,,,,,,,, 21800,"Intercompany Due To","Default Payables account for intercompany trx","Liability",,"Yes","No","INTERCOMPANYDUETO_ACCT",21,,,,,,,,,, 22,"Accrued Expenses",,"Liability",,,"Yes",,2,22,"Accrued Expenses",18,,,,,,, @@ -152,7 +152,7 @@ 32,"Earnings",,"Owner's Equity",,,"Yes",,3,32,"Current Profit & Loss",25,"Retained Earnings",,,,,, 32100,"Dividends",,"Owner's Equity",,,"No",,32,,,,,,,,,, 32200,"Drawings",,"Owner's Equity",,,"No",,32,,,,,,,,,, -32900,"Retained Earnings","Year end processing to balance account (Income Summary)","Owner's Equity",,"Yes","No","",32,,,,,,,,,, +32900,"Retained Earnings","Year end processing to balance account (Income Summary)","Owner's Equity",,"Yes","No",,32,,,,,,,,,, ,,,,,,,,,33,"Total Liabilities and Equity",,,,,,,, 4,"Sales",,"Revenue",,,"Yes",,,,,,,4,"Sales",,,, 41000,"Trade Revenue","Default Product or Service revenue","Revenue",,"Yes","No","P_REVENUE_ACCT",4,,,,,,,"1a","Gross receipts or sales",, @@ -160,16 +160,16 @@ 43000,"Sideline Revenue",,"Revenue",,,"No",,4,,,,,,,"1a",,, 46000,"Royalties Revenue",,"Revenue",,,"No",,4,,,,,,,7,"Gross Royalties",, 47000,"Unearned revenue","We have invoiced, but not delivered yet","Revenue",,"Yes","No","UNEARNEDREVENUE_ACCT",4,,,,,,,"1a",,, -48000,"Not invoiced revenue","We delivered but have not invoiced yet","Revenue",,"Yes","No","",4,,,,,,,"1a",,, +48000,"Not invoiced revenue","We delivered but have not invoiced yet","Revenue",,"Yes","No",,4,,,,,,,"1a",,, 49,"Sales Discounts",,"Revenue",,,"Yes",,4,,,,,49,"Sales Discounts","1b","Less returns and allowances",, 49100,"Trade Discounts","Granted Trade discounts (corrects Product Revenue)","Revenue",,"Yes","No","P_TRADEDISCOUNTGRANT_ACCT",49,,,,,,,,,, 49200,"Payment discount expense","Granted early payment discount to customers","Revenue",,"Yes","No","PAYDISCOUNT_EXP_ACCT",49,,,,,,,,,, 49300,"Promotion Discounts",,"Revenue",,,"No",,49,,,,,,,,,, 5,"Cost of Goods Sold",,"Expense",,,"Yes",,,,,,,5,"Cost of Goods Sold",2,"Cost of goods sold",, 51100,"Product CoGs","Cost of Goods Sold","Expense",,"Yes","No","P_COGS_ACCT",5,,,,,,,,,, -51110,"Cost Of Production","Cost Of Production Account","Expense",,"Yes","No","",5,,,,,,,,,, -51120,"Scrap","Scrap Account","Expense",,"Yes","No","",5,,,,,,,,,, -51130,"Outside Processing (Subcontract)","Outside Processing Account","Expense",,"Yes","No","",5,,,,,,,,,, +51110,"Cost Of Production","Cost Of Production Account","Expense",,"Yes","No",,5,,,,,,,,,, +51120,"Scrap","Scrap Account","Expense",,"Yes","No",,5,,,,,,,,,, +51130,"Outside Processing (Subcontract)","Outside Processing Account","Expense",,"Yes","No",,5,,,,,,,,,, 51200,"Product Expense","Default Service costs (I.e. not on inventory)","Expense",,"Yes","No","P_EXPENSE_ACCT",5,,,,,,,,,, 51210,"Product Cost Adjustment","Product Cost Adjustments","Expense",,"Yes","No","P_COSTADJUSTMENT_ACCT",5,,,,,,,,,, 51280,"Landed Cost Clearing","Default Landed Cost Clearing","Expense",,"Yes","No","P_LANDEDCOSTCLEARING_ACCT",5,,,,,,,,,, @@ -183,17 +183,17 @@ 56,"Inventory CoGs",,"Expense",,,"Yes",,5,,,,,56,"Inventory CoGs",2,,, 56100,"Inventory Shrinkage","Physical Inventory Gain/Loss","Expense",,"Yes","No","W_DIFFERENCES_ACCT",56,,,,,,,,,, 56200,"Inventory Write Down Below Cost",,"Expense",,,"No",,56,,,,,,,,,, -56300,"Inventory Adjustment","Inventory Actual Accounting Value Adjustment","Expense",,"Yes","No","",56,,,,,,,,,, -56400,"Inventory Revaluation","Difference to (lower cost) or market","Expense",,"Yes","No","",56,,,,,,,,,, +56300,"Inventory Adjustment","Inventory Actual Accounting Value Adjustment","Expense",,"Yes","No",,56,,,,,,,,,, +56400,"Inventory Revaluation","Difference to (lower cost) or market","Expense",,"Yes","No",,56,,,,,,,,,, 57000,"Direct Labor",,"Expense",,,"No",,5,,,,,,,,,, 58,"CoGS Variances",,"Expense",,,"Yes",,5,,,,,58,"CoGs Variances",2,,, 58100,"Invoice price variance","Difference between product cost and invoice price (IPV)","Expense",,"Yes","No","P_INVOICEPRICEVARIANCE_ACCT",58,,,,,,,,,, 58200,"Purchase price variance","Difference between purchase price and standard costs (PPV)","Expense",,"Yes","No","P_PURCHASEPRICEVARIANCE_ACCT",58,,,,,,,,,, 58300,"Purchase price variance Offset","Offset Account for Purchase price variance (PPV) ","Expense",,"Yes","No","PPVOFFSET_ACCT",58,,,,,,,,,, -58400,"Using Variance","Account for Using Variance","Expense",,"Yes","No","",58,,,,,,,,,, +58400,"Using Variance","Account for Using Variance","Expense",,"Yes","No",,58,,,,,,,,,, 58500,"Method Change Variance","Account for Method Change Variance","Expense",,"Yes","No","P_RATEVARIANCE_ACCT",58,,,,,,,,,, -58600,"Rate Variance","Account for Rate Variance","Expense",,"Yes","No","",58,,,,,,,,,, -58700,"Mix Variance","Account for Mix Variance","Expense",,"Yes","No","",58,,,,,,,,,, +58600,"Rate Variance","Account for Rate Variance","Expense",,"Yes","No",,58,,,,,,,,,, +58700,"Mix Variance","Account for Mix Variance","Expense",,"Yes","No",,58,,,,,,,,,, 58800,"Average Cost Variance","Account for Average Cost Variance","Expense",,"Yes","No","P_AVERAGECOSTVARIANCE_ACCT",58,,,,,,,,,, 59,"CoGs Discounts",,"Expense",,,"Yes",,5,,,,,59,"CoGS Discounts",2,,, 59100,"Trade discounts received","Received Trade Discounts (corrects Product expense)","Expense",,"Yes","No","P_TRADEDISCOUNTREC_ACCT",59,,,,,,,,,, @@ -274,7 +274,7 @@ 68300,"Business Travel - Hotel",,"Expense",,,"No",,68,,,,,,,,,, 68400,"Business Meals & Entertainment (50%)",,"Expense",,,"No",,68,,,,,,,,,, 68500,"Staff Meeting Food (100%)",,"Expense",,,"No",,68,,,,,,,,,, -68600,"Employee expense","Default employee expenses","Expense",,"Yes","No","",68,,,,,,,,,, +68600,"Employee expense","Default employee expenses","Expense",,"Yes","No",,68,,,,,,,,,, 68900,"Business Travel Other Expense",,"Expense",,,"No",,68,,,,,,,,,, 69,"Insurance",,"Expense",,,"Yes",,6,,,,,69,"Insurance",,,, 69100,"Business Insurance",,"Expense",,,"No",,69,,,,,,,,,, @@ -283,7 +283,7 @@ 69400,"Other Insurance",,"Expense",,,"No",,69,,,,,,,,,, 70,"Payment Processor Costs",,"Expense",,,"Yes",,6,,,,,70,"Payment Processor Costs",,,, 70100,"Credit Card Service Charges",,"Expense",,,"No",,70,,,,,,,,,, -70200,"Bank Service Charges","Bank expenses","Expense",,"Yes","No","",70,,,,,,,,,, +70200,"Bank Service Charges","Bank expenses","Expense",,"Yes","No",,70,,,,,,,,,, 70900,"Other Payment Service Charges",,"Expense",,,"No",,70,,,,,,,,,, 71,"Dues & Subscription",,"Expense",,,"Yes",,6,,,,,71,"Dues & Subscriptions",,,, 71100,"Association Membership Fees",,"Expense",,,"No",,71,,,,,,,,,, @@ -330,7 +330,7 @@ 79,"Default/Suspense Accounts","Temporary accounts - balance should be zero","Expense",,,"Yes",,6,,,,,79,"Default/Suspense Accounts",,,, 79100,"Default account","Default Account (if no other account is defined) V1.1","Expense",,"Yes","No","DEFAULT_ACCT",79,,,,,,,,,, 79200,"Suspense balancing ","Difference to make journal balance in source currency - needs to be solved","Expense",,"Yes","No","SUSPENSEBALANCING_ACCT",79,,,,,,,,,, -79300,"Suspense error","Import did not find account - needs to be solved","Expense",,"Yes","No","",79,,,,,,,,,, +79300,"Suspense error","Import did not find account - needs to be solved","Expense",,"Yes","No",,79,,,,,,,,,, 79400,"Cash book expense","Default other expense for petty cash transactions","Expense",,"Yes","No","CB_EXPENSE_ACCT",79,,,,,,,,,, 79500,"Cash book receipts","Default other revenue for petty cash transactions","Revenue",,"Yes","No","CB_RECEIPT_ACCT",79,,,,,,,,,, 79600,"Charge expense","Default other expense","Expense",,"Yes","No","CH_EXPENSE_ACCT",79,,,,,,,,,, @@ -343,8 +343,8 @@ 80300,"Rental Income",,"Revenue",,,"No",,80,,,,,,,6,"Gross Rents",, 80400,"Sales Tax Commission",,"Revenue",,,"No",,80,,,,,,,,,, 805,"Currency Gain",,"Revenue",,,"Yes",,80,,,,,805,"Currency Gain",,,, -80510,"Bank revaluation gain","Foreign currency bank account gain","Revenue",,"Yes","No","",805,,,,,,,,,, -80520,"Bank settlement gain","Difference between payment and bank account currency","Revenue",,"Yes","No","",805,,,,,,,,,, +80510,"Bank revaluation gain","Foreign currency bank account gain","Revenue",,"Yes","No",,805,,,,,,,,,, +80520,"Bank settlement gain","Difference between payment and bank account currency","Revenue",,"Yes","No",,805,,,,,,,,,, 80530,"Unrealized gain","Difference between foreign currency receivables/payables and current rate","Revenue",,"Yes","No","UNREALIZEDGAIN_ACCT",805,,,,,,,,,, 80540,"Realized gain","Difference between invoice and payment currency","Revenue",,"Yes","No","REALIZEDGAIN_ACCT",805,,,,,,,,,, 80700,"Capital Gains Income",,"Revenue",,,"No",,80,,,,,,,,,, @@ -356,8 +356,8 @@ 82300,"Uninsured Casualty Loss",,"Expense",,,"No",,82,,,,,,,,,, 82400,"Charitable Contributions",,"Expense",,,"No",,82,,,,,,,19,"Charitable Contributions",, 825,"Currency Loss",,"Expense",,,"Yes",,82,,,,,825,"Currency Loss",,,, -82510,"Bank revaluation loss","Foreign currency bank account loss","Expense",,"Yes","No","",825,,,,,,,,,, -82520,"Bank settlement loss","Difference between payment and bank account currency","Expense",,"Yes","No","",825,,,,,,,,,, +82510,"Bank revaluation loss","Foreign currency bank account loss","Expense",,"Yes","No",,825,,,,,,,,,, +82520,"Bank settlement loss","Difference between payment and bank account currency","Expense",,"Yes","No",,825,,,,,,,,,, 82530,"Unrealized loss","Difference between foreign currency receivables/payables and current rate","Expense",,"Yes","No","UNREALIZEDLOSS_ACCT",825,,,,,,,,,, 82540,"Realized loss","Difference between invoice and payment currency","Expense",,"Yes","No","REALIZEDLOSS_ACCT",825,,,,,,,,,, 82550,"Currency balancing","Rounding difference to make journal balance in accounting currency","Expense",,"Yes","No","CURRENCYBALANCING_ACCT",825,,,,,,,,,, @@ -365,15 +365,15 @@ 82800,"Fixes Asset Sale Loss",,"Expense",,,"No",,82,,,,,,,,,, 82900,"Other Expense",,"Expense",,,"No",,82,,,,,,,,,, 83,"Expense (Absorbed)",,"Expense",,,"Yes",,,,,,,83,"Expense (Absorbed)",,,, -83100,"Labor (Absorbed)","Labor Absorbed account","Expense",,"Yes","No","",83,,,,,,,,,, -83200,"Burden (Absorbed)","Burden Absorbed account","Expense",,"Yes","No","",83,,,,,,,,,, -83300,"Overhead (Applied)","Overhead Applied account","Expense",,"Yes","No","",83,,,,,,,,,, +83100,"Labor (Absorbed)","Labor Absorbed account","Expense",,"Yes","No",,83,,,,,,,,,, +83200,"Burden (Absorbed)","Burden Absorbed account","Expense",,"Yes","No",,83,,,,,,,,,, +83300,"Overhead (Applied)","Overhead Applied account","Expense",,"Yes","No",,83,,,,,,,,,, ,,,,,,,,,,,,,"83_","Net Income before Tax",,,, 89,"Income Tax & Summary",,"Expense",,,"Yes",,,,,,,89,"Income Tax & Summary",,,, 89100,"Federal Income Tax",,"Expense",,,"No",,89,,,,,,,,,, 89200,"State Income Tax",,"Expense",,,"No",,89,,,,,,,,,, 89300,"Local Income Tax",,"Expense",,,"No",,89,,,,,,,,,, -89900,"Income Summary","Year end processing to balance account (Retained Earnings)","Expense",,"Yes","No","",89,,,,,"89_","Net Income",,,, +89900,"Income Summary","Year end processing to balance account (Retained Earnings)","Expense",,"Yes","No",,89,,,,,"89_","Net Income",,,, 91,"Costing",,"Memo",,,"Yes",,,,,,,,,,,, 911,"Profit Center Costing Distribution",,"Memo",,,"No",,91,,,,,,,,,, 912,"Project Costing Distribution",,"Memo",,,"No",,91,,,,,,,,,, From f1d8a68569eb1cfaf487b2419afeaee92fb7f0dd Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 21 Dec 2016 23:41:56 +0100 Subject: [PATCH 22/22] IDEMPIERE-2558 don't allow use old password when change password / fix dictionary and db for table AD_Password_History --- .../oracle/201612212302_IDEMPIERE-2558.sql | 119 ++++++++++++++++++ .../201612212302_IDEMPIERE-2558.sql | 116 +++++++++++++++++ 2 files changed, 235 insertions(+) create mode 100644 migration/i4.1/oracle/201612212302_IDEMPIERE-2558.sql create mode 100644 migration/i4.1/postgresql/201612212302_IDEMPIERE-2558.sql diff --git a/migration/i4.1/oracle/201612212302_IDEMPIERE-2558.sql b/migration/i4.1/oracle/201612212302_IDEMPIERE-2558.sql new file mode 100644 index 0000000000..e56a952c55 --- /dev/null +++ b/migration/i4.1/oracle/201612212302_IDEMPIERE-2558.sql @@ -0,0 +1,119 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-2558 don't allow use old password when change password +-- Dec 21, 2016 11:01:23 PM CET +UPDATE AD_Table SET AccessLevel='7',LoadSeq=85,Updated=TO_DATE('2016-12-21 23:01:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=200171 +; + +-- Dec 21, 2016 11:34:17 PM CET +UPDATE AD_Column SET IsMandatory='Y',Updated=TO_DATE('2016-12-21 23:34:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212106 +; + +-- Dec 21, 2016 11:34:21 PM CET +UPDATE AD_Column SET IsMandatory='Y',Updated=TO_DATE('2016-12-21 23:34:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212107 +; + +-- Dec 21, 2016 11:34:49 PM CET +UPDATE AD_Column SET IsMandatory='Y', IsUpdateable='N',Updated=TO_DATE('2016-12-21 23:34:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212113 +; + +-- Dec 21, 2016 11:35:19 PM CET +UPDATE AD_Column SET IsMandatory='Y',Updated=TO_DATE('2016-12-21 23:35:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212114 +; + +-- Dec 21, 2016 11:35:27 PM CET +UPDATE AD_Column SET IsMandatory='Y',Updated=TO_DATE('2016-12-21 23:35:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212115 +; + +-- Dec 21, 2016 11:35:46 PM CET +UPDATE AD_Column SET IsMandatory='Y',Updated=TO_DATE('2016-12-21 23:35:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212118 +; + +-- Dec 21, 2016 11:36:15 PM CET +UPDATE AD_Column SET IsMandatory='Y',Updated=TO_DATE('2016-12-21 23:36:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212116 +; + +-- Dec 21, 2016 11:36:31 PM CET +UPDATE AD_Column SET IsMandatory='Y',Updated=TO_DATE('2016-12-21 23:36:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212117 +; + +-- Dec 21, 2016 11:37:15 PM CET +ALTER TABLE AD_Password_History MODIFY AD_Client_ID NUMBER(10) +; + +-- Dec 21, 2016 11:37:15 PM CET +ALTER TABLE AD_Password_History MODIFY AD_Client_ID NOT NULL +; + +-- Dec 21, 2016 11:37:15 PM CET +ALTER TABLE AD_Password_History ADD CONSTRAINT ADClient_ADPasswordHistory FOREIGN KEY (AD_Client_ID) REFERENCES ad_client(ad_client_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Dec 21, 2016 11:38:06 PM CET +ALTER TABLE AD_Password_History MODIFY AD_Org_ID NUMBER(10) +; + +-- Dec 21, 2016 11:38:06 PM CET +ALTER TABLE AD_Password_History MODIFY AD_Org_ID NOT NULL +; + +-- Dec 21, 2016 11:38:06 PM CET +ALTER TABLE AD_Password_History ADD CONSTRAINT ADOrg_ADPasswordHistory FOREIGN KEY (AD_Org_ID) REFERENCES ad_org(ad_org_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Dec 21, 2016 11:38:18 PM CET +ALTER TABLE AD_Password_History MODIFY Created DATE DEFAULT SYSDATE +; + +-- Dec 21, 2016 11:38:18 PM CET +UPDATE AD_Password_History SET Created=SYSDATE WHERE Created IS NULL +; + +-- Dec 21, 2016 11:38:18 PM CET +ALTER TABLE AD_Password_History MODIFY Created NOT NULL +; + +-- Dec 21, 2016 11:38:24 PM CET +ALTER TABLE AD_Password_History MODIFY CreatedBy NUMBER(10) +; + +-- Dec 21, 2016 11:38:24 PM CET +ALTER TABLE AD_Password_History MODIFY CreatedBy NOT NULL +; + +-- Dec 21, 2016 11:38:31 PM CET +ALTER TABLE AD_Password_History MODIFY IsActive CHAR(1) DEFAULT 'Y' +; + +-- Dec 21, 2016 11:38:31 PM CET +UPDATE AD_Password_History SET IsActive='Y' WHERE IsActive IS NULL +; + +-- Dec 21, 2016 11:38:31 PM CET +ALTER TABLE AD_Password_History MODIFY IsActive NOT NULL +; + +-- Dec 21, 2016 11:38:38 PM CET +ALTER TABLE AD_Password_History MODIFY Updated DATE DEFAULT SYSDATE +; + +-- Dec 21, 2016 11:38:38 PM CET +UPDATE AD_Password_History SET Updated=SYSDATE WHERE Updated IS NULL +; + +-- Dec 21, 2016 11:38:38 PM CET +ALTER TABLE AD_Password_History MODIFY Updated NOT NULL +; + +-- Dec 21, 2016 11:38:43 PM CET +ALTER TABLE AD_Password_History MODIFY UpdatedBy NUMBER(10) +; + +-- Dec 21, 2016 11:38:43 PM CET +ALTER TABLE AD_Password_History MODIFY UpdatedBy NOT NULL +; + +SELECT register_migration_script('201612212302_IDEMPIERE-2558.sql') FROM dual +; + diff --git a/migration/i4.1/postgresql/201612212302_IDEMPIERE-2558.sql b/migration/i4.1/postgresql/201612212302_IDEMPIERE-2558.sql new file mode 100644 index 0000000000..d32e3a9a5f --- /dev/null +++ b/migration/i4.1/postgresql/201612212302_IDEMPIERE-2558.sql @@ -0,0 +1,116 @@ +-- IDEMPIERE-2558 don't allow use old password when change password +-- Dec 21, 2016 11:01:23 PM CET +UPDATE AD_Table SET AccessLevel='7',LoadSeq=85,Updated=TO_TIMESTAMP('2016-12-21 23:01:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=200171 +; + +-- Dec 21, 2016 11:34:17 PM CET +UPDATE AD_Column SET IsMandatory='Y',Updated=TO_TIMESTAMP('2016-12-21 23:34:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212106 +; + +-- Dec 21, 2016 11:34:21 PM CET +UPDATE AD_Column SET IsMandatory='Y',Updated=TO_TIMESTAMP('2016-12-21 23:34:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212107 +; + +-- Dec 21, 2016 11:34:49 PM CET +UPDATE AD_Column SET IsMandatory='Y', IsUpdateable='N',Updated=TO_TIMESTAMP('2016-12-21 23:34:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212113 +; + +-- Dec 21, 2016 11:35:19 PM CET +UPDATE AD_Column SET IsMandatory='Y',Updated=TO_TIMESTAMP('2016-12-21 23:35:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212114 +; + +-- Dec 21, 2016 11:35:27 PM CET +UPDATE AD_Column SET IsMandatory='Y',Updated=TO_TIMESTAMP('2016-12-21 23:35:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212115 +; + +-- Dec 21, 2016 11:35:46 PM CET +UPDATE AD_Column SET IsMandatory='Y',Updated=TO_TIMESTAMP('2016-12-21 23:35:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212118 +; + +-- Dec 21, 2016 11:36:15 PM CET +UPDATE AD_Column SET IsMandatory='Y',Updated=TO_TIMESTAMP('2016-12-21 23:36:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212116 +; + +-- Dec 21, 2016 11:36:31 PM CET +UPDATE AD_Column SET IsMandatory='Y',Updated=TO_TIMESTAMP('2016-12-21 23:36:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212117 +; + +-- Dec 21, 2016 11:37:15 PM CET +INSERT INTO t_alter_column values('ad_password_history','AD_Client_ID','NUMERIC(10)',null,null) +; + +-- Dec 21, 2016 11:37:15 PM CET +INSERT INTO t_alter_column values('ad_password_history','AD_Client_ID',null,'NOT NULL',null) +; + +-- Dec 21, 2016 11:37:15 PM CET +ALTER TABLE AD_Password_History ADD CONSTRAINT ADClient_ADPasswordHistory FOREIGN KEY (AD_Client_ID) REFERENCES ad_client(ad_client_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Dec 21, 2016 11:38:06 PM CET +INSERT INTO t_alter_column values('ad_password_history','AD_Org_ID','NUMERIC(10)',null,null) +; + +-- Dec 21, 2016 11:38:06 PM CET +INSERT INTO t_alter_column values('ad_password_history','AD_Org_ID',null,'NOT NULL',null) +; + +-- Dec 21, 2016 11:38:06 PM CET +ALTER TABLE AD_Password_History ADD CONSTRAINT ADOrg_ADPasswordHistory FOREIGN KEY (AD_Org_ID) REFERENCES ad_org(ad_org_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Dec 21, 2016 11:38:18 PM CET +INSERT INTO t_alter_column values('ad_password_history','Created','TIMESTAMP',null,'statement_timestamp()') +; + +-- Dec 21, 2016 11:38:18 PM CET +UPDATE AD_Password_History SET Created=statement_timestamp() WHERE Created IS NULL +; + +-- Dec 21, 2016 11:38:18 PM CET +INSERT INTO t_alter_column values('ad_password_history','Created',null,'NOT NULL',null) +; + +-- Dec 21, 2016 11:38:24 PM CET +INSERT INTO t_alter_column values('ad_password_history','CreatedBy','NUMERIC(10)',null,null) +; + +-- Dec 21, 2016 11:38:24 PM CET +INSERT INTO t_alter_column values('ad_password_history','CreatedBy',null,'NOT NULL',null) +; + +-- Dec 21, 2016 11:38:31 PM CET +INSERT INTO t_alter_column values('ad_password_history','IsActive','CHAR(1)',null,'Y') +; + +-- Dec 21, 2016 11:38:31 PM CET +UPDATE AD_Password_History SET IsActive='Y' WHERE IsActive IS NULL +; + +-- Dec 21, 2016 11:38:31 PM CET +INSERT INTO t_alter_column values('ad_password_history','IsActive',null,'NOT NULL',null) +; + +-- Dec 21, 2016 11:38:38 PM CET +INSERT INTO t_alter_column values('ad_password_history','Updated','TIMESTAMP',null,'statement_timestamp()') +; + +-- Dec 21, 2016 11:38:38 PM CET +UPDATE AD_Password_History SET Updated=statement_timestamp() WHERE Updated IS NULL +; + +-- Dec 21, 2016 11:38:38 PM CET +INSERT INTO t_alter_column values('ad_password_history','Updated',null,'NOT NULL',null) +; + +-- Dec 21, 2016 11:38:43 PM CET +INSERT INTO t_alter_column values('ad_password_history','UpdatedBy','NUMERIC(10)',null,null) +; + +-- Dec 21, 2016 11:38:43 PM CET +INSERT INTO t_alter_column values('ad_password_history','UpdatedBy',null,'NOT NULL',null) +; + +SELECT register_migration_script('201612212302_IDEMPIERE-2558.sql') FROM dual +; +