From f9007d168cf1ed087f7b1ed444c14dffdac5edb8 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 7 Nov 2013 17:02:37 -0500 Subject: [PATCH 1/6] IDEMPIERE-1442 Additional confirmation on close and void action / fix new fields positioning --- .../oracle/201311071647_IDEMPIERE-1442.sql | 39 +++++++++++++++++++ .../201311071647_IDEMPIERE-1442.sql | 36 +++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 migration/i2.0/oracle/201311071647_IDEMPIERE-1442.sql create mode 100644 migration/i2.0/postgresql/201311071647_IDEMPIERE-1442.sql diff --git a/migration/i2.0/oracle/201311071647_IDEMPIERE-1442.sql b/migration/i2.0/oracle/201311071647_IDEMPIERE-1442.sql new file mode 100644 index 0000000000..7caa7885c5 --- /dev/null +++ b/migration/i2.0/oracle/201311071647_IDEMPIERE-1442.sql @@ -0,0 +1,39 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Nov 7, 2013 4:46:57 PM COT +-- IDEMPIERE-1442 Additional confirmation on close and void action +UPDATE AD_Field SET SeqNo=50,Updated=TO_DATE('2013-11-07 16:46:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1311 +; + +-- Nov 7, 2013 4:46:57 PM COT +UPDATE AD_Field SET SeqNo=70,Updated=TO_DATE('2013-11-07 16:46:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3052 +; + +-- Nov 7, 2013 4:46:57 PM COT +UPDATE AD_Field SET SeqNo=80,Updated=TO_DATE('2013-11-07 16:46:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3054 +; + +-- Nov 7, 2013 4:46:57 PM COT +UPDATE AD_Field SET SeqNo=90, IsDisplayed='Y', XPosition=4,Updated=TO_DATE('2013-11-07 16:46:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201340 +; + +-- Nov 7, 2013 4:46:57 PM COT +UPDATE AD_Field SET SeqNo=100, IsDisplayed='Y', XPosition=1,Updated=TO_DATE('2013-11-07 16:46:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200948 +; + +-- Nov 7, 2013 4:46:57 PM COT +UPDATE AD_Field SET SeqNo=110, IsDisplayed='Y', XPosition=4,Updated=TO_DATE('2013-11-07 16:46:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200949 +; + +-- Nov 7, 2013 4:46:57 PM COT +UPDATE AD_Field SET SeqNo=120, IsDisplayed='Y', XPosition=2,Updated=TO_DATE('2013-11-07 16:46:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202532 +; + +-- Nov 7, 2013 4:46:57 PM COT +UPDATE AD_Field SET SeqNo=130, IsDisplayed='Y', XPosition=5,Updated=TO_DATE('2013-11-07 16:46:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202533 +; + +SELECT register_migration_script('201311071647_IDEMPIERE-1442.sql') FROM dual +; + diff --git a/migration/i2.0/postgresql/201311071647_IDEMPIERE-1442.sql b/migration/i2.0/postgresql/201311071647_IDEMPIERE-1442.sql new file mode 100644 index 0000000000..ef79b695fe --- /dev/null +++ b/migration/i2.0/postgresql/201311071647_IDEMPIERE-1442.sql @@ -0,0 +1,36 @@ +-- Nov 7, 2013 4:46:57 PM COT +-- IDEMPIERE-1442 Additional confirmation on close and void action +UPDATE AD_Field SET SeqNo=50,Updated=TO_TIMESTAMP('2013-11-07 16:46:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1311 +; + +-- Nov 7, 2013 4:46:57 PM COT +UPDATE AD_Field SET SeqNo=70,Updated=TO_TIMESTAMP('2013-11-07 16:46:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3052 +; + +-- Nov 7, 2013 4:46:57 PM COT +UPDATE AD_Field SET SeqNo=80,Updated=TO_TIMESTAMP('2013-11-07 16:46:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3054 +; + +-- Nov 7, 2013 4:46:57 PM COT +UPDATE AD_Field SET SeqNo=90, IsDisplayed='Y', XPosition=4,Updated=TO_TIMESTAMP('2013-11-07 16:46:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201340 +; + +-- Nov 7, 2013 4:46:57 PM COT +UPDATE AD_Field SET SeqNo=100, IsDisplayed='Y', XPosition=1,Updated=TO_TIMESTAMP('2013-11-07 16:46:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200948 +; + +-- Nov 7, 2013 4:46:57 PM COT +UPDATE AD_Field SET SeqNo=110, IsDisplayed='Y', XPosition=4,Updated=TO_TIMESTAMP('2013-11-07 16:46:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200949 +; + +-- Nov 7, 2013 4:46:57 PM COT +UPDATE AD_Field SET SeqNo=120, IsDisplayed='Y', XPosition=2,Updated=TO_TIMESTAMP('2013-11-07 16:46:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202532 +; + +-- Nov 7, 2013 4:46:57 PM COT +UPDATE AD_Field SET SeqNo=130, IsDisplayed='Y', XPosition=5,Updated=TO_TIMESTAMP('2013-11-07 16:46:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202533 +; + +SELECT register_migration_script('201311071647_IDEMPIERE-1442.sql') FROM dual +; + From 5447f06c0f4df240ae36e427542f76bac9b4f09b Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 7 Nov 2013 17:03:39 -0500 Subject: [PATCH 2/6] In order to make the migration scripts littler in size - just write the comment one time or when changed --- .../src/org/compiere/dbPort/Convert.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/dbPort/Convert.java b/org.adempiere.base/src/org/compiere/dbPort/Convert.java index 2e6a636c8e..9b314fe0f8 100644 --- a/org.adempiere.base/src/org/compiere/dbPort/Convert.java +++ b/org.adempiere.base/src/org/compiere/dbPort/Convert.java @@ -566,6 +566,8 @@ public abstract class Convert return false; } + private static String m_oldprm_COMMENT = ""; + private static void writeLogMigrationScript(Writer w, String statement) throws IOException { boolean isUseCentralizedID = "Y".equals(MSysConfig.getValue(MSysConfig.DICTIONARY_ID_USE_CENTRALIZED_ID, "Y")); // defaults to Y @@ -581,10 +583,14 @@ public abstract class Convert w.append("-- "); w.append(dateTimeText); w.append("\n"); - // log sysconfig comment - w.append("-- "); - w.append(prm_COMMENT); - w.append("\n"); + if (prm_COMMENT != null && ! m_oldprm_COMMENT.equals(prm_COMMENT)) { + // log sysconfig comment + w.append("-- "); + w.append(prm_COMMENT); + w.append("\n"); + if (w == writerPg) + m_oldprm_COMMENT = prm_COMMENT; + } // log statement w.append(statement); // close statement From e391acaf5155cf755a49f0c5fc9e5994b934b612 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Fri, 8 Nov 2013 10:23:01 +0800 Subject: [PATCH 3/6] IDEMPIERE-1513 Find Window : should hide simple search tab if there's no selection column define. --- .../adempiere/webui/window/FindWindow.java | 39 ++++++++++++++----- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java index b6a558974a..737ba3b619 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java @@ -269,6 +269,13 @@ public class FindWindow extends Window implements EventListener, ValueCha { return false; } + + if (!winMain.getComponent().getTabpanel(0).isVisible()) + { + winMain.getComponent().setSelectedIndex(1); + onAdvanceTabSelected(); + } + return true; } @@ -676,6 +683,12 @@ public class FindWindow extends Window implements EventListener, ValueCha addSelectionColumn (field); } + if (m_sEditors.isEmpty()) { + Tabpanel tabPanel = winMain.getComponent().getTabpanel(0); + tabPanel.getLinkedTab().setVisible(false); + tabPanel.setVisible(false); + } + gridFieldList = null; m_total = getNoOfRecords(null, false); @@ -1072,16 +1085,9 @@ public class FindWindow extends Window implements EventListener, ValueCha } else if (event.getTarget() instanceof Tab) { if (winMain.getComponent().getSelectedIndex() == 1) { - fQueryName.setReadonly(false); - btnSave.setDisabled(m_AD_Tab_ID <= 0); - historyCombo.setSelectedItem(null); - if (advancedPanel.getItems().size() == 0) { - createFields(); - } + onAdvanceTabSelected(); } else { - fQueryName.setReadonly(true); - btnSave.setDisabled(true); - historyCombo.setDisabled(false); + onSimpleTabSelected(); } } } // @@ -1171,6 +1177,21 @@ public class FindWindow extends Window implements EventListener, ValueCha } // onEvent + private void onSimpleTabSelected() { + fQueryName.setReadonly(true); + btnSave.setDisabled(true); + historyCombo.setDisabled(false); + } + + private void onAdvanceTabSelected() { + fQueryName.setReadonly(false); + btnSave.setDisabled(m_AD_Tab_ID <= 0); + historyCombo.setSelectedItem(null); + if (advancedPanel.getItems().size() == 0) { + createFields(); + } + } + private void parseUserQuery(MUserQuery userQuery) { String code = userQuery.getCode(); From d19475f4bf4bb249293d6be1e2ca3f141ab5ed12 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Fri, 8 Nov 2013 11:16:05 +0800 Subject: [PATCH 4/6] Minor typo and if condition fix for InfoWindow ( The fix is needed by #1003450 ). --- .../WEB-INF/src/org/adempiere/webui/info/InfoWindow.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java index e8246ef915..b06d2d376a 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java @@ -469,21 +469,21 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL super.prepareTable(layout, from, where, orderBy); if (m_sqlMain.indexOf("@") >= 0) { String sql = Env.parseContext(infoContext, p_WindowNo, m_sqlMain, true); - if (sql == null || sql.length() == 9) { + if (sql == null || sql.length() == 0) { log.severe("Failed to parsed sql. sql=" + m_sqlMain); } else { m_sqlMain = sql; } } - if (infoWindow.isDistinct()) { + if (m_sqlMain.length() > 0 && infoWindow.isDistinct()) { m_sqlMain = m_sqlMain.substring("SELECT ".length()); m_sqlMain = "SELECT DISTINCT " + m_sqlMain; } if (m_sqlOrder != null && m_sqlOrder.indexOf("@") >= 0) { String sql = Env.parseContext(infoContext, p_WindowNo, m_sqlOrder, false, false); - if (sql == null || sql.length() == 9) { + if (sql == null || sql.length() == 0) { log.severe("Failed to parsed sql. sql=" + m_sqlOrder); } else { m_sqlOrder = sql; From 74f6661322912001ec56e9307d67b4aec563c47f Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Fri, 8 Nov 2013 16:45:10 +0800 Subject: [PATCH 5/6] IDEMPIERE-1442 Additional confirmation on close and void action. Shouldn't pass document action value back to the document window until user have confirm the action. --- .../webui/panel/WDocActionPanel.java | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WDocActionPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WDocActionPanel.java index 5888e9b596..cb3b723598 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WDocActionPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WDocActionPanel.java @@ -305,13 +305,10 @@ public class WDocActionPanel extends Window implements EventListener, Dia if (Events.ON_CLICK.equals(event.getName())) { if (confirmPanel.getButton("Ok").equals(event.getTarget())) - { - m_OKpressed = true; - setValue(); + { MClientInfo clientInfo = MClientInfo.get(Env.getCtx()); if(clientInfo.isConfirmOnDocClose() || clientInfo.isConfirmOnDocVoid()) { - final Window window = this; String selected = lstDocAction.getSelectedItem().getValue().toString(); if((selected.equals(org.compiere.process.DocAction.ACTION_Close) && clientInfo.isConfirmOnDocClose()) || (selected.equals(org.compiere.process.DocAction.ACTION_Void) && clientInfo.isConfirmOnDocVoid())) @@ -323,17 +320,23 @@ public class WDocActionPanel extends Window implements EventListener, Dia @Override public void onCallback(Boolean result) { if(result) - window.detach(); + { + setValueAndClose(); + } else return; } }); } else - this.detach(); + { + setValueAndClose(); + } } else - this.detach(); + { + setValueAndClose(); + } } else if (confirmPanel.getButton("Cancel").equals(event.getTarget())) { @@ -351,6 +354,12 @@ public class WDocActionPanel extends Window implements EventListener, Dia } } + private void setValueAndClose() { + m_OKpressed = true; + setValue(); + detach(); + } + private void setValue() { int index = getSelectedIndex(); From f92efb10c71b472ed1ec9cf7afb3747ae751534c Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Fri, 8 Nov 2013 17:52:00 +0800 Subject: [PATCH 6/6] 1002848 IDEMPIERE-1132 Improve AD_Index; AD_View; foreign keys management. Always create foreign key with the DEFERRABLE INITIALLY DEFERRED clause. --- .../src/org/compiere/process/ColumnSync.java | 2 ++ .../src/org/compiere/process/CreateForeignKey.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/org.adempiere.base.process/src/org/compiere/process/ColumnSync.java b/org.adempiere.base.process/src/org/compiere/process/ColumnSync.java index 3910590bef..5ba2df5619 100644 --- a/org.adempiere.base.process/src/org/compiere/process/ColumnSync.java +++ b/org.adempiere.base.process/src/org/compiere/process/ColumnSync.java @@ -286,6 +286,8 @@ public class ColumnSync extends SvrProcess else if (fkConstraintType.equals(MColumn.FKCONSTRAINTTYPE_SetNull)) fkConstraint.append(" ON DELETE SET NULL"); + fkConstraint.append(" DEFERRABLE INITIALLY DEFERRED"); + fkConstraintSql.append(DB.SQLSTATEMENT_SEPARATOR); fkConstraintSql.append("ALTER TABLE ").append(table.getTableName()); fkConstraintSql.append(" ADD "); diff --git a/org.adempiere.base/src/org/compiere/process/CreateForeignKey.java b/org.adempiere.base/src/org/compiere/process/CreateForeignKey.java index c05966429b..16619b8cb1 100644 --- a/org.adempiere.base/src/org/compiere/process/CreateForeignKey.java +++ b/org.adempiere.base/src/org/compiere/process/CreateForeignKey.java @@ -444,6 +444,8 @@ public class CreateForeignKey extends SvrProcess { else if (fkConstraintType.equals(MColumn.FKCONSTRAINTTYPE_SetNull)) fkConstraint.append(" ON DELETE SET NULL"); + fkConstraint.append(" DEFERRABLE INITIALLY DEFERRED"); + column.setFKConstraintName(fkConstraintName); column.setFKConstraintType(fkConstraintType); column.saveEx();