From 79cf3109d013db5e8f1ee9bf96f96fcc6aa637bf Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 5 Sep 2013 14:44:45 -0500 Subject: [PATCH 01/15] IDEMPIERE-1323 Zoom Condition bug --- .../WEB-INF/src/org/adempiere/webui/apps/AEnv.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AEnv.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AEnv.java index 6e40073b13..9eca46c30c 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AEnv.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AEnv.java @@ -386,8 +386,13 @@ public final class AEnv zoomQuery.addRestriction(column, MQuery.EQUAL, value); zoomQuery.setRecordCount(1); // guess } - int windowId = lookup.getZoom(zoomQuery); - zoom(windowId, zoomQuery); + if (value instanceof Integer && ((Integer) value).intValue() >= 0 && zoomQuery != null && zoomQuery.getZoomTableName() != null) { + int tableId = MTable.getTable_ID(zoomQuery.getZoomTableName()); + zoom(tableId, ((Integer) value).intValue()); + } else { + int windowId = lookup.getZoom(zoomQuery); + zoom(windowId, zoomQuery); + } } /** From b57c8c638f5f2651e4fdd0243764a1b5184ffb81 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 5 Sep 2013 17:36:19 -0500 Subject: [PATCH 02/15] IDEMPIERE-1025 Improve translation for custom tables / do not insert translations if the language is not installed --- .../adempiere/pipo2/handler/CommonTranslationHandler.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/CommonTranslationHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/CommonTranslationHandler.java index 07daff48fb..40901fc17f 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/CommonTranslationHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/CommonTranslationHandler.java @@ -16,6 +16,7 @@ import org.adempiere.pipo2.ElementHandler; import org.adempiere.pipo2.PIPOContext; import org.adempiere.pipo2.PackOut; import org.adempiere.pipo2.PoExporter; +import org.compiere.model.MLanguage; import org.compiere.model.MTable; import org.compiere.util.DB; import org.compiere.util.Env; @@ -52,6 +53,10 @@ public class CommonTranslationHandler extends AbstractElementHandler implements throw new SAXException(); String language = getStringValue(element, "AD_Language"); + MLanguage lang = MLanguage.get(ctx.ctx, language); + // skip if not system installed language + if (! lang.isSystemLanguage()) + return; if (log.isLoggable(Level.INFO)) log.info(elementValue+" "+getStringValue(element, "Name")); From 1ab0741364ab982572b49a2348d6a79df3c86469 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 5 Sep 2013 18:01:05 -0500 Subject: [PATCH 03/15] IDEMPIERE-1270 PaymentFormOnCredit is not translating payment terms / based on patch from Naim Berisha --- .../org/compiere/grid/PaymentFormOnCredit.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/org.adempiere.ui/src/org/compiere/grid/PaymentFormOnCredit.java b/org.adempiere.ui/src/org/compiere/grid/PaymentFormOnCredit.java index a023f6e6c5..eb31219957 100644 --- a/org.adempiere.ui/src/org/compiere/grid/PaymentFormOnCredit.java +++ b/org.adempiere.ui/src/org/compiere/grid/PaymentFormOnCredit.java @@ -23,6 +23,7 @@ import org.compiere.model.GridTab; import org.compiere.model.MRole; import org.compiere.util.DB; import org.compiere.util.KeyNamePair; +import org.compiere.util.Env; /** * @@ -52,9 +53,21 @@ public abstract class PaymentFormOnCredit extends PaymentForm { /** * Load Payment Terms */ + String ad_language = Env.getAD_Language(Env.getCtx()); + boolean isBaseLanguage = Env.isBaseLanguage(ad_language, "C_PaymentTerm"); + StringBuilder sb = new StringBuilder(); + if (isBaseLanguage) { + sb.append("SELECT p.C_PaymentTerm_ID, p.Name FROM C_PaymentTerm p") + .append(" WHERE p.IsActive='Y' ORDER BY p.Name"); + } else { + sb.append("SELECT p.C_PaymentTerm_ID, pt.Name FROM C_PaymentTerm p") + .append(" JOIN C_PaymentTerm_Trl pt ON (p.C_PaymentTerm_ID=pt.C_PaymentTerm_ID AND pt.AD_Language='") + .append(ad_language).append("')") + .append(" WHERE p.IsActive='Y' ORDER BY p.Name"); + } + String SQL = MRole.getDefault().addAccessSQL( - "SELECT C_PaymentTerm_ID, Name FROM C_PaymentTerm WHERE IsActive='Y' ORDER BY Name", - "C_PaymentTerm", MRole.SQL_NOTQUALIFIED, MRole.SQL_RO); + sb.toString(), "p", MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO); PreparedStatement pstmt = null; ResultSet rs = null; try From 01807c9191f942a24f7de7401c4bdaffcffeea3d Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Sat, 7 Sep 2013 02:37:10 +0800 Subject: [PATCH 04/15] IDEMPIERE-1297 2Pack: Remove code for the lookup of record and reference using business key. Fixed handling of column that reference zero id table. --- org.adempiere.pipo/src/org/adempiere/pipo2/PoFiller.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/org.adempiere.pipo/src/org/adempiere/pipo2/PoFiller.java b/org.adempiere.pipo/src/org/adempiere/pipo2/PoFiller.java index deff5a71bc..d40620893e 100644 --- a/org.adempiere.pipo/src/org/adempiere/pipo2/PoFiller.java +++ b/org.adempiere.pipo/src/org/adempiere/pipo2/PoFiller.java @@ -7,6 +7,7 @@ import java.util.ArrayList; import java.util.List; import org.adempiere.exceptions.AdempiereException; +import org.compiere.model.MColumn; import org.compiere.model.MTable; import org.compiere.model.PO; import org.compiere.model.POInfo; @@ -161,7 +162,13 @@ public class PoFiller{ po.set_ValueNoCheck(columnName, id); } return id; - } + } else if (id == 0) { + MColumn col = MColumn.get(ctx.ctx, po.get_TableName(), columnName); + if (MTable.isZeroIDTable(col.getReferenceTableName())) { + po.set_ValueNoCheck(columnName, id); + return id; + } + } return -1; } else { return 0; From fb4c2d30072a7cdea3de489f011013a169e5a43c Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Sat, 7 Sep 2013 03:52:22 +0800 Subject: [PATCH 05/15] IDEMPIERE-1297 2Pack: Remove code for the lookup of record and reference using business key. Fixed NPE in previous revision. --- org.adempiere.pipo/src/org/adempiere/pipo2/PoFiller.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/org.adempiere.pipo/src/org/adempiere/pipo2/PoFiller.java b/org.adempiere.pipo/src/org/adempiere/pipo2/PoFiller.java index d40620893e..f8d6e8317c 100644 --- a/org.adempiere.pipo/src/org/adempiere/pipo2/PoFiller.java +++ b/org.adempiere.pipo/src/org/adempiere/pipo2/PoFiller.java @@ -164,7 +164,8 @@ public class PoFiller{ return id; } else if (id == 0) { MColumn col = MColumn.get(ctx.ctx, po.get_TableName(), columnName); - if (MTable.isZeroIDTable(col.getReferenceTableName())) { + String refTableName = col.getReferenceTableName(); + if (refTableName != null && MTable.isZeroIDTable(refTableName)) { po.set_ValueNoCheck(columnName, id); return id; } From e3adf9a1139b303d9f6dafaf78dcc37e7995c68d Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Sat, 7 Sep 2013 03:59:28 +0800 Subject: [PATCH 06/15] Fixed auto packin doesn't work with attachment due to invalid package directory setting. --- .../src/org/adempiere/pipo/srv/PipoDictionaryService.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/org.adempiere.pipo/src/org/adempiere/pipo/srv/PipoDictionaryService.java b/org.adempiere.pipo/src/org/adempiere/pipo/srv/PipoDictionaryService.java index d93d58fe1b..8ebd499a96 100644 --- a/org.adempiere.pipo/src/org/adempiere/pipo/srv/PipoDictionaryService.java +++ b/org.adempiere.pipo/src/org/adempiere/pipo/srv/PipoDictionaryService.java @@ -7,7 +7,6 @@ import java.util.logging.Level; import org.adempiere.base.IDictionaryService; import org.adempiere.pipo2.PackIn; import org.adempiere.pipo2.Zipper; -import org.compiere.Adempiere; import org.compiere.model.X_AD_Package_Imp_Proc; import org.compiere.util.CLogger; import org.compiere.util.Env; @@ -30,7 +29,7 @@ public class PipoDictionaryService implements IDictionaryService { packIn.setPackageName(context.getBundle().getSymbolicName()); packIn.setPackageVersion((String) context.getBundle().getHeaders().get("Bundle-Version")); packIn.setUpdateDictionary(false); - packIn.setPackageDirectory(getPackageDir()); +// packIn.setPackageDirectory(getPackageDir()); X_AD_Package_Imp_Proc adPackageImp = new X_AD_Package_Imp_Proc(Env.getCtx(), 0, trxName); @@ -42,6 +41,8 @@ public class PipoDictionaryService implements IDictionaryService { String dict_file = targetDir + File.separator + parentDir + File.separator + "dict" + File.separator + "PackOut.xml"; + + packIn.setPackageDirectory(targetDir + File.separator + parentDir); if (logger.isLoggable(Level.INFO)) logger.info("dict file->" + dict_file); @@ -64,6 +65,7 @@ public class PipoDictionaryService implements IDictionaryService { } + /* private String getPackageDir() { // Create Target directory if required @@ -79,6 +81,6 @@ public class PipoDictionaryService implements IDictionaryService { } } return result; - } + }*/ } From aa21582761d76310e0075797d291a42cf83888ba Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Mon, 9 Sep 2013 10:49:58 +0800 Subject: [PATCH 07/15] IDEMPIERE-1343 GL Journal Generator Show Ok When no journal have been created. --- .../src/org/globalqss/process/GLJournalGenerate.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/org.adempiere.base/src/org/globalqss/process/GLJournalGenerate.java b/org.adempiere.base/src/org/globalqss/process/GLJournalGenerate.java index f764ce2beb..088ae036af 100644 --- a/org.adempiere.base/src/org/globalqss/process/GLJournalGenerate.java +++ b/org.adempiere.base/src/org/globalqss/process/GLJournalGenerate.java @@ -524,6 +524,8 @@ public class GLJournalGenerate extends SvrProcess if (j != null) { StringBuilder msg = new StringBuilder(Msg.parseTranslation(getCtx(), "@Created@ @GL_Journal_ID@=")).append(j.getDocumentNo()); addLog(j.get_ID(), null, null, msg.toString(), MJournal.Table_ID, j.get_ID()); + }else{ + return "0 @GL_Journal_ID@ @Created@"; } return "@OK@"; From b2061ea8ef1e0999476e546bf0a3970015ba4521 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Tue, 10 Sep 2013 13:15:18 +0800 Subject: [PATCH 08/15] Minor: added null check to prevent runtime NPE. --- .../src/org/adempiere/pipo2/AbstractElementHandler.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/org.adempiere.pipo/src/org/adempiere/pipo2/AbstractElementHandler.java b/org.adempiere.pipo/src/org/adempiere/pipo2/AbstractElementHandler.java index 0cffa3e603..fc27a29811 100644 --- a/org.adempiere.pipo/src/org/adempiere/pipo2/AbstractElementHandler.java +++ b/org.adempiere.pipo/src/org/adempiere/pipo2/AbstractElementHandler.java @@ -306,11 +306,14 @@ public abstract class AbstractElementHandler implements ElementHandler { * @return string value */ protected String getStringValue(Element element, String qName, List excludes) { - String name = qName; - String s = element.properties.get(qName).contents.toString(); + if (element == null) return null; + if (qName == null) return null; + Element propertyElement = element.properties.get(qName); + if (propertyElement == null || propertyElement.contents == null) return null; + String s = propertyElement.contents.toString(); if (s != null && s.trim().length() > 0 && excludes != null) { - excludes.add(name); + excludes.add(qName); } return ((s == null || s.trim().length() == 0) ? null : s.trim()); } From 53731cbfffa4172c5278e4fe0565c8011129b941 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Tue, 10 Sep 2013 14:44:18 +0800 Subject: [PATCH 09/15] IDEMPIERE-1347 2Pack: ColumnElementHandler should ensure column exists in database when IsSyncDatabase=Y. --- .../pipo2/handler/ColumnElementHandler.java | 42 ++++++++++++------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/ColumnElementHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/ColumnElementHandler.java index c399a83d59..643cf8c090 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/ColumnElementHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/ColumnElementHandler.java @@ -51,7 +51,6 @@ public class ColumnElementHandler extends AbstractElementHandler { public void startElement(PIPOContext ctx, Element element) throws SAXException { - int success = 0; String entitytype = getStringValue(element, "EntityType"); if (isProcessElement(ctx.ctx, entitytype)) { if (isParentDefer(element, I_AD_Table.Table_Name)) { @@ -78,8 +77,13 @@ public class ColumnElementHandler extends AbstractElementHandler { return; } - if (!mColumn.is_new() && !mColumn.is_Changed()) + if (!mColumn.is_new() && !mColumn.is_Changed()) { + boolean syncDatabase = "Y".equalsIgnoreCase(getStringValue(element, "IsSyncDatabase")); + if (syncDatabase) { + syncColumn(ctx, mColumn, "Sync", false); + } return; + } X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, X_AD_Column.Table_Name, X_AD_Column.Table_ID); String action = null; @@ -156,26 +160,32 @@ public class ColumnElementHandler extends AbstractElementHandler { } if (recreateColumn || syncDatabase) { - MTable table = new MTable(ctx.ctx, mColumn.getAD_Table_ID(), getTrxName(ctx)); - if (!table.isView() && !mColumn.isVirtualColumn()) { - success = createColumn(ctx, table, mColumn, recreateColumn); - - X_AD_Package_Imp_Detail dbDetail = createImportDetail(ctx, "dbColumn", X_AD_Column.Table_Name, X_AD_Column.Table_ID); - if (success == 1) { - logImportDetail(ctx, dbDetail, 1, mColumn.getColumnName(), - mColumn.get_ID(), action); - } else { - logImportDetail(ctx, dbDetail, 0, mColumn.getColumnName(), - mColumn.get_ID(), action); - throw new DatabaseAccessException("Failed to create column or related constraint for " + mColumn.getColumnName()); - } - } + syncColumn(ctx, mColumn, action, recreateColumn); } } else { element.skip = true; } } + private void syncColumn(PIPOContext ctx, MColumn mColumn, String action, + boolean recreateColumn) throws SAXException { + int success = 0; + MTable table = new MTable(ctx.ctx, mColumn.getAD_Table_ID(), getTrxName(ctx)); + if (!table.isView() && !mColumn.isVirtualColumn()) { + success = createColumn(ctx, table, mColumn, recreateColumn); + + X_AD_Package_Imp_Detail dbDetail = createImportDetail(ctx, "dbColumn", X_AD_Column.Table_Name, X_AD_Column.Table_ID); + if (success == 1) { + logImportDetail(ctx, dbDetail, 1, mColumn.getColumnName(), + mColumn.get_ID(), action); + } else { + logImportDetail(ctx, dbDetail, 0, mColumn.getColumnName(), + mColumn.get_ID(), action); + throw new DatabaseAccessException("Failed to create column or related constraint for " + mColumn.getColumnName()); + } + } + } + /** * Check if column exists in database and modify. If not create column. * From 36630243443d85076ea47a7c865a08f023dba9e3 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Tue, 10 Sep 2013 15:17:10 +0800 Subject: [PATCH 10/15] IDEMPIERE-1305 Payment allocation form- Need alignment of field to be corrected. --- .../org/adempiere/webui/apps/form/WAllocation.java | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WAllocation.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WAllocation.java index 67cd41b7c6..cfc82e4f72 100755 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WAllocation.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WAllocation.java @@ -199,7 +199,7 @@ public class WAllocation extends Allocation row = rows.newRow(); row.appendCellChild(bpartnerLabel.rightAlign()); bpartnerSearch.getComponent().setHflex("true"); - row.appendCellChild(bpartnerSearch.getComponent(),1); + row.appendCellChild(bpartnerSearch.getComponent(),2); row.appendCellChild(dateLabel.rightAlign()); row.appendCellChild(dateField.getComponent()); row.appendCellChild(organizationLabel.rightAlign()); @@ -211,16 +211,8 @@ public class WAllocation extends Allocation currencyPick.getComponent().setHflex("true"); row.appendCellChild(currencyPick.getComponent(),1); row.appendCellChild(multiCurrency,2); - row.appendCellChild(new Space(),1); - row.appendCellChild(new Space(),1); - - row = rows.newRow(); - row.appendCellChild(new Space()); - row.appendCellChild(autoWriteOff); - row.appendCellChild(new Space()); - row.appendCellChild(new Space()); - row.appendCellChild(new Space()); - row.appendCellChild(new Space()); + row.appendCellChild(autoWriteOff,2); + row.appendCellChild(new Space(),1); South south = new South(); south.setStyle("border: none"); From 37567602ce9f3f5e7a2b9279c189c4fde1e00e01 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Tue, 10 Sep 2013 15:44:45 +0800 Subject: [PATCH 11/15] IDEMPIERE-1304 Document allow to select price list without version. Commit patch from Richard Morales Herrera. --- .../oracle/201309100739_IDEMPIERE-1304.sql | 13 +++++++++++++ .../postgresql/201309100739_IDEMPIERE-1304.sql | 13 +++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 migration/i1.0c-release/oracle/201309100739_IDEMPIERE-1304.sql create mode 100644 migration/i1.0c-release/postgresql/201309100739_IDEMPIERE-1304.sql diff --git a/migration/i1.0c-release/oracle/201309100739_IDEMPIERE-1304.sql b/migration/i1.0c-release/oracle/201309100739_IDEMPIERE-1304.sql new file mode 100644 index 0000000000..61451b2cd1 --- /dev/null +++ b/migration/i1.0c-release/oracle/201309100739_IDEMPIERE-1304.sql @@ -0,0 +1,13 @@ +-- Aug 28, 2013 5:35:23 PM COT +-- IDEMPIERE-1304 Document allow to select price list without version +UPDATE AD_Val_Rule SET Code='M_PriceList.IsSOPriceList = ''@IsSOTrx@'' AND (SELECT COUNT(*) FROM M_PriceList_Version WHERE M_PriceList.M_PriceList_ID=M_PriceList_Version.M_PriceList_ID AND M_PriceList_Version.IsActive=''Y'')>0',Updated=TO_DATE('2013-08-28 17:35:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=271 +; + +-- Aug 29, 2013 9:45:47 AM COT +-- IDEMPIERE-1304 Document allow to select price list without version +UPDATE AD_Column SET AD_Val_Rule_ID=271,Updated=TO_DATE('2013-08-29 09:45:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3789 +; + +SELECT register_migration_script('201309100739_IDEMPIERE-1304.sql') FROM dual +; + diff --git a/migration/i1.0c-release/postgresql/201309100739_IDEMPIERE-1304.sql b/migration/i1.0c-release/postgresql/201309100739_IDEMPIERE-1304.sql new file mode 100644 index 0000000000..76941de631 --- /dev/null +++ b/migration/i1.0c-release/postgresql/201309100739_IDEMPIERE-1304.sql @@ -0,0 +1,13 @@ +-- Aug 28, 2013 5:35:23 PM COT +-- IDEMPIERE-1304 Document allow to select price list without version +UPDATE AD_Val_Rule SET Code='M_PriceList.IsSOPriceList = ''@IsSOTrx@'' AND (SELECT COUNT(*) FROM M_PriceList_Version WHERE M_PriceList.M_PriceList_ID=M_PriceList_Version.M_PriceList_ID AND M_PriceList_Version.IsActive=''Y'')>0',Updated=TO_TIMESTAMP('2013-08-28 17:35:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=271 +; + +-- Aug 29, 2013 9:45:47 AM COT +-- IDEMPIERE-1304 Document allow to select price list without version +UPDATE AD_Column SET AD_Val_Rule_ID=271,Updated=TO_TIMESTAMP('2013-08-29 09:45:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3789 +; + +SELECT register_migration_script('201309100739_IDEMPIERE-1304.sql') FROM dual +; + From f1b344bcbe47d2918e9964c7a259e1c77bd41353 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Tue, 10 Sep 2013 18:17:55 +0800 Subject: [PATCH 12/15] IDEMPIERE-1313 Web Client: Reduce space used by collapsed context help pane. Better implementation that doesn't take up any space on the right when the help pane is collapsed. --- .../webui/desktop/DefaultDesktop.java | 37 ++++++++++------ .../theme/default/css/theme.css.dsp | 43 +++---------------- 2 files changed, 29 insertions(+), 51 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DefaultDesktop.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DefaultDesktop.java index 2b0bde8a07..02fac1451b 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DefaultDesktop.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DefaultDesktop.java @@ -27,7 +27,6 @@ import org.adempiere.base.event.IEventManager; import org.adempiere.base.event.IEventTopics; import org.adempiere.model.MBroadcastMessage; import org.adempiere.util.ServerContext; -import org.adempiere.webui.LayoutUtils; import org.adempiere.webui.adwindow.ADWindow; import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.apps.BusyDialog; @@ -103,6 +102,8 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria private static final String IMAGES_UPARROW_PNG = "images/collapse-header.png"; private static final String IMAGES_DOWNARROW_PNG = "images/expand-header.png"; + + private static final String IMAGES_CONTEXT_HELP_PNG = "images/Help16.png"; /** * generated serial version ID @@ -133,6 +134,8 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria private HelpController helpController; private ToolBarButton max; + + private ToolBarButton contextHelp; public DefaultDesktop() { @@ -196,11 +199,9 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria updateHelpCollapsedPreference(!oe.isOpen()); HtmlBasedComponent comp = windowContainer.getComponent(); if (comp != null) { - if (oe.isOpen()) { - LayoutUtils.removeSclass("with-right-icon", comp); - } else { - LayoutUtils.addSclass("with-right-icon", comp); - } + contextHelp.setVisible(!oe.isOpen()); + if (!oe.isOpen()) + layout.getEast().setVisible(false); } } }); @@ -220,11 +221,8 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria }); boolean helpCollapsed= pref.isPropertyBool(UserPreference.P_HELP_COLLAPSED); - e.setOpen(!helpCollapsed); - Clients.evalJavaScript("$('.desktop-layout > div > .z-east-colpsd > .z-borderlayout-icon').attr('title', '" + - Msg.getElement(Env.getCtx(), "AD_CtxHelp_ID") + "');"); - - + e.setVisible(!helpCollapsed); + helpController.render(e, this); Center windowArea = layout.getCenter(); @@ -273,6 +271,7 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria ToolBar toolbar = new ToolBar(); windowContainer.getComponent().appendChild(toolbar); + max = new ToolBarButton(); toolbar.appendChild(max); max.setImage(ThemeManager.getThemeResource(IMAGES_UPARROW_PNG)); @@ -280,9 +279,13 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria max.setSclass("window-container-toolbar-btn"); max.setStyle("cursor: pointer; border: 1px solid transparent; padding: 2px;"); - if (!e.isOpen()) { - LayoutUtils.addSclass("with-right-icon", windowContainer.getComponent()); - } + contextHelp = new ToolBarButton(); + toolbar.appendChild(contextHelp); + contextHelp.setImage(ThemeManager.getThemeResource(IMAGES_CONTEXT_HELP_PNG)); + contextHelp.addEventListener(Events.ON_CLICK, this); + contextHelp.setSclass("window-container-toolbar-btn context-help-btn"); + contextHelp.setStyle("cursor: pointer; border: 1px solid transparent; padding: 2px;"); + contextHelp.setTooltiptext(Util.cleanAmp(Msg.getElement(Env.getCtx(), "AD_CtxHelp_ID"))); return layout; } @@ -331,6 +334,12 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria max.setImage(ThemeManager.getThemeResource(IMAGES_UPARROW_PNG)); } } + else if (comp == contextHelp) + { + layout.getEast().setVisible(true); + layout.getEast().setOpen(true); + contextHelp.setVisible(false); + } else if(comp instanceof ToolBarButton) { ToolBarButton btn = (ToolBarButton) comp; diff --git a/org.adempiere.ui.zk/theme/default/css/theme.css.dsp b/org.adempiere.ui.zk/theme/default/css/theme.css.dsp index 265169e913..ad97af5834 100644 --- a/org.adempiere.ui.zk/theme/default/css/theme.css.dsp +++ b/org.adempiere.ui.zk/theme/default/css/theme.css.dsp @@ -151,6 +151,12 @@ html,body { height: 22px; } +.window-container-toolbar-btn.context-help-btn .z-toolbarbutton-cnt img { + width: 16px; + height: 16px; + padding: 3px 3px; +} + .tree-search-combo .z-comboitem-img img { width: 16px; height: 16px; @@ -496,10 +502,6 @@ div.wc-modal, div.wc-modal-none, div.wc-highlighted, div.wc-highlighted-none { margin: 0px !important; } -.desktop-tabbox.with-right-icon .z-tabs .z-toolbar-tabs-body { - margin-right: 12px !important; -} - .desktop-tabbox .z-tabs .z-toolbar-tabs-body .z-toolbarbutton { padding: 0px !important; border: 1px solid transparent !important; @@ -1915,36 +1917,3 @@ table.z-vbox > tbody > tr > td > table { border-radius: 0px; background-color: #ddd; } - -<%-- Context Help --%> -.desktop-layout > div > .z-east-colpsd { - border: none; - width: 0px !important; - position: absolute; - overflow: visible; - padding: 0px !important; - margin: 0px !important; -} - -.desktop-layout > div > .z-east-colpsd > .z-borderlayout-icon { - background-image: url(${c:encodeURL('/theme/default/images/Help16.png')}) !important; - background-position:center !important; - width: 16px; - height: 16px; - position: relative; - left: -20px; - background-size: 16px 16px; - margin-left: 0px !important; - margin-right: 0px !important; - margin-top: 4px !important; - padding: 3px !important; -} - -.desktop-layout > div > .z-east-colpsd > .z-borderlayout-icon:hover { - background-color:#DDD !important; - -webkit-box-shadow:inset 0px 0px 3px #CCC; - -moz-box-shadow:inset 0px 0px 3px #CCC; - -o-box-shadow:inset 0px 0px 3px #CCC; - -ms-box-shadow:inset 0px 0px 3px #CCC; - box-shadow:inset 0px 0px 3px #CCC; -} From 3b60b8913d307ff28e27792a755ae65f4d14e1b2 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Tue, 10 Sep 2013 14:13:55 -0500 Subject: [PATCH 13/15] IDEMPIERE-1345 Allow Translation Export from webui --- .../oracle/201309091625_IDEMPIERE-1345.sql | 11 +++ .../201309091625_IDEMPIERE-1345.sql | 8 ++ org.adempiere.ui.zk/META-INF/MANIFEST.MF | 2 + .../webui/install/WTranslationDialog.java | 77 +++++++++++++++++-- 4 files changed, 90 insertions(+), 8 deletions(-) create mode 100644 migration/i1.0c-release/oracle/201309091625_IDEMPIERE-1345.sql create mode 100644 migration/i1.0c-release/postgresql/201309091625_IDEMPIERE-1345.sql diff --git a/migration/i1.0c-release/oracle/201309091625_IDEMPIERE-1345.sql b/migration/i1.0c-release/oracle/201309091625_IDEMPIERE-1345.sql new file mode 100644 index 0000000000..bfdea45e1e --- /dev/null +++ b/migration/i1.0c-release/oracle/201309091625_IDEMPIERE-1345.sql @@ -0,0 +1,11 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Sep 9, 2013 4:25:23 PM COT +-- IDEMPIERE-1345 Allow Translation Export from webui +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Org_ID,Created,AD_Client_ID) VALUES ('I','Export ZIP',200230,'D','d68b4fb8-d613-47a5-879b-c54aa9d3c415','ExportZIP','Y',TO_DATE('2013-09-09 16:25:22','YYYY-MM-DD HH24:MI:SS'),100,100,0,TO_DATE('2013-09-09 16:25:22','YYYY-MM-DD HH24:MI:SS'),0) +; + +SELECT register_migration_script('201309091625_IDEMPIERE-1345.sql') FROM dual +; + diff --git a/migration/i1.0c-release/postgresql/201309091625_IDEMPIERE-1345.sql b/migration/i1.0c-release/postgresql/201309091625_IDEMPIERE-1345.sql new file mode 100644 index 0000000000..b47b0eaa78 --- /dev/null +++ b/migration/i1.0c-release/postgresql/201309091625_IDEMPIERE-1345.sql @@ -0,0 +1,8 @@ +-- Sep 9, 2013 4:25:23 PM COT +-- IDEMPIERE-1345 Allow Translation Export from webui +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Org_ID,Created,AD_Client_ID) VALUES ('I','Export ZIP',200230,'D','d68b4fb8-d613-47a5-879b-c54aa9d3c415','ExportZIP','Y',TO_TIMESTAMP('2013-09-09 16:25:22','YYYY-MM-DD HH24:MI:SS'),100,100,0,TO_TIMESTAMP('2013-09-09 16:25:22','YYYY-MM-DD HH24:MI:SS'),0) +; + +SELECT register_migration_script('201309091625_IDEMPIERE-1345.sql') FROM dual +; + diff --git a/org.adempiere.ui.zk/META-INF/MANIFEST.MF b/org.adempiere.ui.zk/META-INF/MANIFEST.MF index f8850cab9b..db3edefd22 100644 --- a/org.adempiere.ui.zk/META-INF/MANIFEST.MF +++ b/org.adempiere.ui.zk/META-INF/MANIFEST.MF @@ -11,6 +11,8 @@ Import-Package: javax.activation;version="1.1.1", org.apache.commons.codec.binary, org.apache.ecs, org.apache.ecs.xhtml, + org.apache.tools.ant, + org.apache.tools.ant.taskdefs, org.compiere.css, org.osgi.framework;version="1.5.0", org.osgi.service.event;version="1.3.0", diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/install/WTranslationDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/install/WTranslationDialog.java index 3e078fd993..237b4d6525 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/install/WTranslationDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/install/WTranslationDialog.java @@ -46,7 +46,11 @@ import org.adempiere.webui.panel.StatusBarPanel; import org.adempiere.webui.session.SessionManager; import org.adempiere.webui.util.ReaderInputStream; import org.adempiere.webui.window.FDialog; +import org.adempiere.webui.window.MultiFileDownloadDialog; import org.apache.commons.io.FileUtils; +import org.apache.tools.ant.Project; +import org.apache.tools.ant.Target; +import org.apache.tools.ant.taskdefs.Zip; import org.compiere.install.Translation; import org.compiere.install.TranslationController; import org.compiere.util.Env; @@ -100,6 +104,7 @@ public class WTranslationDialog extends TranslationController implements IFormCo private Button bExport = new Button(); private Button bImport = new Button(); + private Button bExportZIP = new Button(); private Button bImportZIP = new Button(); private Label lClient = new Label(); @@ -128,6 +133,8 @@ public class WTranslationDialog extends TranslationController implements IFormCo bExport.setStyle("text-align: right;"); bImport.setLabel(Msg.getMsg(Env.getCtx(), "Import")); bImport.addActionListener(this); + bExportZIP.setLabel(Msg.getMsg(Env.getCtx(), "ExportZIP")); + bExportZIP.addActionListener(this); bImportZIP.setLabel(Msg.getMsg(Env.getCtx(), "ImportZIP")); bImportZIP.setUpload(AdempiereWebUI.getUploadSetting()); bImportZIP.addEventListener(Events.ON_UPLOAD, this); @@ -152,10 +159,16 @@ public class WTranslationDialog extends TranslationController implements IFormCo row.appendChild(div); div = new Div(); - div.setStyle("text-align: center;"); + div.setStyle("text-align: left;"); div.appendChild(bImport); row.appendChild(div); + row = rows.newRow(); + div = new Div(); + div.setStyle("text-align: right;"); + div.appendChild(bExportZIP); + row.appendChild(div); + div = new Div(); div.setStyle("text-align: left;"); div.appendChild(bImportZIP); @@ -247,13 +260,17 @@ public class WTranslationDialog extends TranslationController implements IFormCo return; } - final FolderBrowser directoryDialog = new FolderBrowser(true); - directoryDialog.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener() { - @Override - public void onEvent(Event event) throws Exception { - callImportProcess(directoryDialog.getPath()); - } - }); + if ((e.getTarget() == bImport || e.getTarget() == bExport)) { + final FolderBrowser directoryDialog = new FolderBrowser(true); + directoryDialog.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener() { + @Override + public void onEvent(Event event) throws Exception { + callImportProcess(directoryDialog.getPath()); + } + }); + } else if (e.getTarget() == bExportZIP) { + processExportZIP(); + } } // onEvent private void callImportProcess(String directory) { @@ -408,4 +425,48 @@ public class WTranslationDialog extends TranslationController implements IFormCo out.close(); } + private void processExportZIP() { + File tempfolder; + try { + tempfolder = File.createTempFile(m_AD_Language.getValue(), ".trl"); + tempfolder.delete(); + tempfolder.mkdir(); + } catch (IOException e1) { + throw new AdempiereException("Problem creating temp folder", e1); + } + // export to temp folder + callImportProcess(tempfolder.getPath()); + + // and now zip the exported files + File destZipFile = null; + try { + destZipFile = File.createTempFile(m_AD_Language.getValue() + "_trlExport_", ".zip"); + } catch (Throwable e) { + throw new AdempiereException("Unable to create temp file", e); + } + destZipFile.delete(); + + Zip zipper = new Zip(); + zipper.setDestFile(destZipFile); + zipper.setBasedir(tempfolder); + zipper.setUpdate(false); + zipper.setCompress(true); + zipper.setCaseSensitive(false); + zipper.setFilesonly(true); + zipper.setTaskName("zip"); + zipper.setTaskType("zip"); + zipper.setProject(new Project()); + zipper.setOwningTarget(new Target()); + zipper.execute(); + + try { + FileUtils.deleteDirectory(tempfolder); + } catch (IOException e) {} + + MultiFileDownloadDialog downloadDialog = new MultiFileDownloadDialog(new File [] {destZipFile}); + downloadDialog.setPage(getForm().getPage()); + downloadDialog.setTitle(Msg.getMsg(Env.getCtx(), "ExportZIP")); + Events.postEvent(downloadDialog, new Event(MultiFileDownloadDialog.ON_SHOW)); + } + } From 6eaa8be4e4c23e98d85ec8f27e18bea66cd00eb5 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Wed, 11 Sep 2013 12:35:55 +0800 Subject: [PATCH 14/15] IDEMPIERE-1350 Deleting a line from the "Payments into Batch" window. --- .../src/org/compiere/model/MDepositBatchLine.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.adempiere.base/src/org/compiere/model/MDepositBatchLine.java b/org.adempiere.base/src/org/compiere/model/MDepositBatchLine.java index 1344acb23a..8f87402b69 100644 --- a/org.adempiere.base/src/org/compiere/model/MDepositBatchLine.java +++ b/org.adempiere.base/src/org/compiere/model/MDepositBatchLine.java @@ -170,7 +170,7 @@ import org.compiere.util.Env; updateHeader(); if (getC_Payment_ID() != 0 ) { - String sql = "UPDATE C_Payment p SET C_DepositBatch_ID= 0 WHERE p.C_Payment_ID=?"; + String sql = "UPDATE C_Payment p SET C_DepositBatch_ID= Null WHERE p.C_Payment_ID=?"; DB.executeUpdateEx(sql, new Object[] {getC_Payment_ID()}, get_TrxName()); } From ed4f7e42e73258d47c396d39d67e54fba0281410 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Wed, 11 Sep 2013 13:06:43 +0800 Subject: [PATCH 15/15] IDEMPIERE-1351 Quick Entry when Field can not zoom to 2 different windows. --- .../src/org/adempiere/webui/editor/WEditorPopupMenu.java | 5 +++-- .../src/org/adempiere/webui/editor/WSearchEditor.java | 5 ++++- .../WEB-INF/src/org/adempiere/webui/grid/WQuickEntry.java | 7 +++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WEditorPopupMenu.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WEditorPopupMenu.java index 9ec004d5fe..27220601ff 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WEditorPopupMenu.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WEditorPopupMenu.java @@ -121,6 +121,7 @@ public class WEditorPopupMenu extends Menupopup implements EventListener if (lookup != null) { int winID = lookup.getZoom(); + int winIDPO = lookup.getZoom(false) ; Boolean canAccess = MRole.getDefault().getWindowAccess(winID); if (winID <= 0 || canAccess == null || ! canAccess) { this.zoomEnabled = false; @@ -144,13 +145,13 @@ public class WEditorPopupMenu extends Menupopup implements EventListener + "FROM AD_Field f " + " JOIN AD_Tab t " + " ON ( t.AD_Tab_ID = f.AD_Tab_ID ) " - + "WHERE t.AD_Window_ID = ? " + + "WHERE t.AD_Window_ID IN (?,?) " + " AND f.IsActive = 'Y' " + " AND t.IsActive = 'Y' " + " AND f.IsQuickEntry = 'Y' " + " AND (t.TabLevel = 0 " + " AND t.AD_Table_ID IN (SELECT AD_Table_ID FROM AD_Table WHERE TableName = ? )) ", - winID,tableName); + winID,winIDPO,tableName); if (cnt > 0) { this.newEnabled = true; this.updateEnabled = true; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java index 20c860ca78..1338b3a50e 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java @@ -494,7 +494,10 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value if(!getComponent().isEnabled()) return; - final WQuickEntry vqe = new WQuickEntry (lookup.getWindowNo(), lookup.getZoom()); + int zoomWindowId = gridField != null ? lookup.getZoom(Env.isSOTrx(Env.getCtx(), gridField.getWindowNo())) : lookup.getZoom(Env.isSOTrx(Env.getCtx())); + final WQuickEntry vqe = new WQuickEntry (lookup.getWindowNo(), zoomWindowId); + if (vqe.getQuickFields()<=0) + return; int Record_ID = 0; // if update, get current value diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/grid/WQuickEntry.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/grid/WQuickEntry.java index b4b0e348f0..40c96923e9 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/grid/WQuickEntry.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/grid/WQuickEntry.java @@ -516,5 +516,12 @@ public class WQuickEntry extends Window implements EventListener, ValueCh editor.setVisible(field.isDisplayed(true)); } } // dynamicDisplay + + /** + * get size quickfields + */ + public int getQuickFields(){ + return quickFields.size(); + }// size of quickfields } // WQuickEntry