From 5161b9b5e9f930b1d13ba5b64c27c5a42b089c11 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Tue, 26 Nov 2013 19:00:28 -0500 Subject: [PATCH 1/5] IDEMPIERE-1542 Calendar doesn't recognise language Date Pattern --- .../src/org/adempiere/webui/dashboard/CalendarWindow.java | 4 ++-- .../WEB-INF/src/org/adempiere/webui/dashboard/DPCalendar.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/CalendarWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/CalendarWindow.java index a173f2fc0d..01f361c1f1 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/CalendarWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/CalendarWindow.java @@ -37,6 +37,7 @@ import org.adempiere.webui.session.SessionManager; import org.adempiere.webui.theme.ThemeManager; import org.compiere.model.MSysConfig; import org.compiere.model.X_R_RequestType; +import org.compiere.util.DisplayType; import org.compiere.util.Env; import org.compiere.util.Msg; import org.compiere.util.Util; @@ -52,7 +53,6 @@ import org.zkoss.calendar.event.CalendarsEvent; import org.zkoss.calendar.impl.SimpleCalendarEvent; import org.zkoss.calendar.impl.SimpleCalendarModel; import org.zkoss.image.AImage; -import org.zkoss.util.Locales; import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Executions; import org.zkoss.zk.ui.event.Event; @@ -410,7 +410,7 @@ public class CalendarWindow extends Window implements EventListener, ITab private void updateDateLabel() { Date b = calendars.getBeginDate(); Date e = calendars.getEndDate(); - SimpleDateFormat sdfV = new SimpleDateFormat("yyyy/MMM/dd", Locales.getCurrent()); + SimpleDateFormat sdfV = DisplayType.getDateFormat(); sdfV.setTimeZone(calendars.getDefaultTimeZone()); lblDate.setValue(sdfV.format(b) + " - " + sdfV.format(e)); } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPCalendar.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPCalendar.java index 3f4bab01af..44bc423668 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPCalendar.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPCalendar.java @@ -38,6 +38,7 @@ import org.compiere.model.PO; import org.compiere.model.X_R_RequestType; import org.compiere.util.CLogger; import org.compiere.util.DB; +import org.compiere.util.DisplayType; import org.compiere.util.Env; import org.compiere.util.Trx; import org.compiere.util.TrxEventListener; @@ -49,7 +50,6 @@ import org.zkoss.calendar.Calendars; import org.zkoss.calendar.api.CalendarEvent; import org.zkoss.calendar.event.CalendarsEvent; import org.zkoss.calendar.impl.SimpleCalendarModel; -import org.zkoss.util.Locales; import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Desktop; import org.zkoss.zk.ui.Executions; @@ -397,7 +397,7 @@ public class DPCalendar extends DashboardPanel implements EventListener, private void updateDateLabel() { Date b = calendars.getBeginDate(); Date e = calendars.getEndDate(); - SimpleDateFormat sdfV = new SimpleDateFormat("yyyy/MMM/dd", Locales.getCurrent()); + SimpleDateFormat sdfV = DisplayType.getDateFormat(); sdfV.setTimeZone(calendars.getDefaultTimeZone()); lblDate.setValue(sdfV.format(b) + " - " + sdfV.format(e)); } From 89afd608a6222515072e8fc41ab92c5df40be660 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Tue, 26 Nov 2013 19:10:53 -0500 Subject: [PATCH 2/5] IDEMPIERE-1544 Error in org.adempiere.report.jasper.library/META-INF/MANIFEST.MF / thanks to Ken Longnan --- org.adempiere.report.jasper.library/META-INF/MANIFEST.MF | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.adempiere.report.jasper.library/META-INF/MANIFEST.MF b/org.adempiere.report.jasper.library/META-INF/MANIFEST.MF index e0ed64dee9..004a56a191 100644 --- a/org.adempiere.report.jasper.library/META-INF/MANIFEST.MF +++ b/org.adempiere.report.jasper.library/META-INF/MANIFEST.MF @@ -302,7 +302,7 @@ Import-Package: com.lowagie.text, groovyjarjarasm.asm.signature, groovyjarjarasm.asm.tree, groovyjarjarcommonscli, - org.apache.batik;version="17.0.0", + org.apache.batik;version="1.7.0", org.apache.batik.anim;version="1.7.0", org.apache.batik.anim.timing;version="1.7.0", org.apache.batik.anim.values;version="1.7.0", From 7cf96275a244665a576e1be1bf756c03e74237cd Mon Sep 17 00:00:00 2001 From: hieplq Date: Tue, 26 Nov 2013 19:22:42 -0500 Subject: [PATCH 3/5] IDEMPIERE-1213 set encoding when export grid to file --- .../src/org/adempiere/impexp/GridTabCSVExporter.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVExporter.java b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVExporter.java index cbb4cb39ea..6fa6c2e42c 100644 --- a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVExporter.java +++ b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVExporter.java @@ -16,9 +16,11 @@ package org.adempiere.impexp; import static org.compiere.model.SystemIDs.REFERENCE_PAYMENTRULE; +import java.io.BufferedWriter; import java.io.File; -import java.io.FileWriter; +import java.io.FileOutputStream; import java.io.IOException; +import java.io.OutputStreamWriter; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Collections; @@ -47,6 +49,7 @@ import org.compiere.util.DB; import org.compiere.util.DisplayType; import org.compiere.util.Env; import org.compiere.util.Evaluator; +import org.compiere.util.Ini; import org.compiere.util.Msg; import org.compiere.util.Util; import org.supercsv.cellprocessor.FmtBool; @@ -76,7 +79,10 @@ public class GridTabCSVExporter implements IGridTabExporter MTable table= null; MTable tableDetail = null; try { - mapWriter = new CsvMapWriter(new FileWriter(file), CsvPreference.STANDARD_PREFERENCE); + FileOutputStream fileOut = new FileOutputStream (file); + OutputStreamWriter oStrW = new OutputStreamWriter(fileOut, Ini.getCharset()); + BufferedWriter bw = new BufferedWriter(oStrW); + mapWriter = new CsvMapWriter(bw, CsvPreference.STANDARD_PREFERENCE); String isValidTab = isValidTabToExport(gridTab); if(isValidTab!=null){ throw new AdempiereException(isValidTab); From 2f14109f1d3a73f6fd07b53c177a03b6987cb873 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Tue, 26 Nov 2013 19:44:48 -0500 Subject: [PATCH 4/5] IDEMPIERE-594 Improve positioning on windows / Fix Relation Type window layout --- .../oracle/201311261943_IDEMPIERE-594.sql | 47 +++++++++++++++++++ .../postgresql/201311261943_IDEMPIERE-594.sql | 44 +++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 migration/i2.0/oracle/201311261943_IDEMPIERE-594.sql create mode 100644 migration/i2.0/postgresql/201311261943_IDEMPIERE-594.sql diff --git a/migration/i2.0/oracle/201311261943_IDEMPIERE-594.sql b/migration/i2.0/oracle/201311261943_IDEMPIERE-594.sql new file mode 100644 index 0000000000..96e1ed6ce3 --- /dev/null +++ b/migration/i2.0/oracle/201311261943_IDEMPIERE-594.sql @@ -0,0 +1,47 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Nov 26, 2013 7:43:01 PM COT +-- IDEMPIERE-594 Improve positioning on windows / Fix Relation Type window layout +UPDATE AD_Field SET SeqNo=20, IsDisplayed='Y', XPosition=4,Updated=TO_DATE('2013-11-26 19:43:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58069 +; + +-- Nov 26, 2013 7:43:01 PM COT +UPDATE AD_Field SET SeqNo=40,Updated=TO_DATE('2013-11-26 19:43:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58066 +; + +-- Nov 26, 2013 7:43:02 PM COT +UPDATE AD_Field SET SeqNo=50,Updated=TO_DATE('2013-11-26 19:43:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58067 +; + +-- Nov 26, 2013 7:43:02 PM COT +UPDATE AD_Field SET SeqNo=60,Updated=TO_DATE('2013-11-26 19:43:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58075 +; + +-- Nov 26, 2013 7:43:02 PM COT +UPDATE AD_Field SET SeqNo=70,Updated=TO_DATE('2013-11-26 19:43:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58071 +; + +-- Nov 26, 2013 7:43:02 PM COT +UPDATE AD_Field SET SeqNo=80, IsDisplayed='Y', XPosition=4, ColumnSpan=2,Updated=TO_DATE('2013-11-26 19:43:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58072 +; + +-- Nov 26, 2013 7:43:02 PM COT +UPDATE AD_Field SET SeqNo=90, IsDisplayed='Y', XPosition=1,Updated=TO_DATE('2013-11-26 19:43:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58073 +; + +-- Nov 26, 2013 7:43:02 PM COT +UPDATE AD_Field SET SeqNo=100, IsDisplayed='Y', XPosition=4, ColumnSpan=2,Updated=TO_DATE('2013-11-26 19:43:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58074 +; + +-- Nov 26, 2013 7:43:02 PM COT +UPDATE AD_Field SET SeqNo=110, IsDisplayed='Y', XPosition=2,Updated=TO_DATE('2013-11-26 19:43:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58064 +; + +-- Nov 26, 2013 7:43:02 PM COT +UPDATE AD_Field SET SeqNo=0,Updated=TO_DATE('2013-11-26 19:43:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58070 +; + +SELECT register_migration_script('201311261943_IDEMPIERE-594.sql') FROM dual +; + diff --git a/migration/i2.0/postgresql/201311261943_IDEMPIERE-594.sql b/migration/i2.0/postgresql/201311261943_IDEMPIERE-594.sql new file mode 100644 index 0000000000..30d0f193fb --- /dev/null +++ b/migration/i2.0/postgresql/201311261943_IDEMPIERE-594.sql @@ -0,0 +1,44 @@ +-- Nov 26, 2013 7:43:01 PM COT +-- IDEMPIERE-594 Improve positioning on windows / Fix Relation Type window layout +UPDATE AD_Field SET SeqNo=20, IsDisplayed='Y', XPosition=4,Updated=TO_TIMESTAMP('2013-11-26 19:43:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58069 +; + +-- Nov 26, 2013 7:43:01 PM COT +UPDATE AD_Field SET SeqNo=40,Updated=TO_TIMESTAMP('2013-11-26 19:43:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58066 +; + +-- Nov 26, 2013 7:43:02 PM COT +UPDATE AD_Field SET SeqNo=50,Updated=TO_TIMESTAMP('2013-11-26 19:43:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58067 +; + +-- Nov 26, 2013 7:43:02 PM COT +UPDATE AD_Field SET SeqNo=60,Updated=TO_TIMESTAMP('2013-11-26 19:43:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58075 +; + +-- Nov 26, 2013 7:43:02 PM COT +UPDATE AD_Field SET SeqNo=70,Updated=TO_TIMESTAMP('2013-11-26 19:43:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58071 +; + +-- Nov 26, 2013 7:43:02 PM COT +UPDATE AD_Field SET SeqNo=80, IsDisplayed='Y', XPosition=4, ColumnSpan=2,Updated=TO_TIMESTAMP('2013-11-26 19:43:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58072 +; + +-- Nov 26, 2013 7:43:02 PM COT +UPDATE AD_Field SET SeqNo=90, IsDisplayed='Y', XPosition=1,Updated=TO_TIMESTAMP('2013-11-26 19:43:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58073 +; + +-- Nov 26, 2013 7:43:02 PM COT +UPDATE AD_Field SET SeqNo=100, IsDisplayed='Y', XPosition=4, ColumnSpan=2,Updated=TO_TIMESTAMP('2013-11-26 19:43:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58074 +; + +-- Nov 26, 2013 7:43:02 PM COT +UPDATE AD_Field SET SeqNo=110, IsDisplayed='Y', XPosition=2,Updated=TO_TIMESTAMP('2013-11-26 19:43:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58064 +; + +-- Nov 26, 2013 7:43:02 PM COT +UPDATE AD_Field SET SeqNo=0,Updated=TO_TIMESTAMP('2013-11-26 19:43:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58070 +; + +SELECT register_migration_script('201311261943_IDEMPIERE-594.sql') FROM dual +; + From 382208ffe9f009692a004ebbd325bcb8feb34e9d Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Tue, 26 Nov 2013 20:06:57 -0500 Subject: [PATCH 5/5] IDEMPIERE-1465 Zoom Across Only retrieve one Parent Record when target have multiple parent record. / commit patch provided by Heng Sin --- .../adwindow/AbstractADWindowContent.java | 109 ++++++++++++------ 1 file changed, 76 insertions(+), 33 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java index 88553b11fe..ee66df1cdc 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java @@ -411,79 +411,122 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements if (field.getColumnName().equalsIgnoreCase(query.getZoomColumnName())) { gridWindow.initTab(tabIndex); - int parentId = DB.getSQLValue(null, "SELECT " + gTab.getLinkColumnName() + " FROM " + gTab.getTableName() + " WHERE " + query.getWhereClause()); - if (parentId > 0) + int[] parentIds = DB.getIDsEx(null, "SELECT " + gTab.getLinkColumnName() + " FROM " + gTab.getTableName() + " WHERE " + query.getWhereClause()); + if (parentIds.length > 0) { - MapparentMap = new TreeMap(); - int index = tabIndex; - int oldpid = parentId; - GridTab currentTab = gTab; - while (index > 0) + GridTab parentTab = null; + MapqueryMap = new TreeMap(); + + for (int parentId : parentIds) { - index--; - GridTab pTab = gridWindow.getTab(index); - if (pTab.getTabLevel() < currentTab.getTabLevel()) + MapparentMap = new TreeMap(); + int index = tabIndex; + int oldpid = parentId; + GridTab currentTab = gTab; + while (index > 0) { - gridWindow.initTab(index); - if (index > 0) + index--; + GridTab pTab = gridWindow.getTab(index); + if (pTab.getTabLevel() < currentTab.getTabLevel()) { - if (pTab.getLinkColumnName() != null && pTab.getLinkColumnName().trim().length() > 0) + if (parentTab == null) + parentTab = pTab; + gridWindow.initTab(index); + if (index > 0) { - int pid = DB.getSQLValue(null, "SELECT " + pTab.getLinkColumnName() + " FROM " + pTab.getTableName() + " WHERE " + currentTab.getLinkColumnName() + " = ?", oldpid); - if (pid > 0) + if (pTab.getLinkColumnName() != null && pTab.getLinkColumnName().trim().length() > 0) { - parentMap.put(index, new Object[]{currentTab.getLinkColumnName(), oldpid}); - oldpid = pid; - currentTab = pTab; - } - else - { - parentMap.clear(); - break; + int pid = DB.getSQLValue(null, "SELECT " + pTab.getLinkColumnName() + " FROM " + pTab.getTableName() + " WHERE " + currentTab.getLinkColumnName() + " = ?", oldpid); + if (pid > 0) + { + parentMap.put(index, new Object[]{currentTab.getLinkColumnName(), oldpid}); + oldpid = pid; + currentTab = pTab; + } + else + { + parentMap.clear(); + break; + } } } + else + { + parentMap.put(index, new Object[]{currentTab.getLinkColumnName(), oldpid}); + } + } + } + + for(Map.Entry entry : parentMap.entrySet()) + { + GridTab pTab = gridWindow.getTab(entry.getKey()); + Object[] value = entry.getValue(); + MQuery pquery = queryMap.get(entry.getKey()); + if (pquery == null) + { + pquery = new MQuery(pTab.getAD_Table_ID()); + queryMap.put(entry.getKey(), pquery); + pquery.addRestriction((String)value[0], "=", value[1]); } else { - parentMap.put(index, new Object[]{currentTab.getLinkColumnName(), oldpid}); + pquery.addRestriction((String)value[0], "=", value[1], null, null, false, 0); } } } - for(Map.Entry entry : parentMap.entrySet()) + for (Map.Entry entry : queryMap.entrySet()) { GridTab pTab = gridWindow.getTab(entry.getKey()); - Object[] value = entry.getValue(); - MQuery pquery = new MQuery(pTab.getAD_Table_ID()); - pquery.addRestriction((String)value[0], "=", value[1]); IADTabpanel tp = adTabbox.findADTabpanel(pTab); tp.createUI(); if (tp.getTabLevel() == 0) { - pTab.setQuery(pquery); + pTab.setQuery(entry.getValue()); tp.query(); } else { tp.query(); - pTab.setQuery(pquery); + pTab.setQuery(entry.getValue()); tp.query(); - } + } } MQuery targetQuery = new MQuery(gTab.getAD_Table_ID()); - targetQuery.addRestriction(gTab.getLinkColumnName(), "=", parentId); + targetQuery.addRestriction(gTab.getLinkColumnName(), "=", parentTab.getRecord_ID()); gTab.setQuery(targetQuery); IADTabpanel gc = null; gc = adTabbox.findADTabpanel(gTab); gc.createUI(); gc.query(false, 0, 0); + int zoomColumnIndex = -1; GridTable table = gTab.getTableModel(); + for (int i = 0; i < table.getColumnCount(); i++) + { + if (table.getColumnName(i).equalsIgnoreCase(query.getZoomColumnName())) + { + zoomColumnIndex = i; + break; + } + } int count = table.getRowCount(); for(int i = 0; i < count; i++) { - int id = table.getKeyID(i); + int id = -1; + if (zoomColumnIndex >= 0) + { + Object zoomValue = table.getValueAt(i, zoomColumnIndex); + if (zoomValue != null && zoomValue instanceof Number) + { + id = ((Number)zoomValue).intValue(); + } + } + else + { + id = table.getKeyID(i); + } if (id == ((Integer)query.getZoomValue()).intValue()) { setActiveTab(gridWindow.getTabIndex(gTab), null);