From 19661cd2549d4b063382d842756b821e1e71a5fb Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 5 Aug 2013 12:48:45 -0500 Subject: [PATCH 1/5] IDEMPIERE-1197 in advanced, when select empty item in column name, throw java.lang.NullPointerException / based on patch from Richard Morales --- .../WEB-INF/src/org/adempiere/webui/window/FindWindow.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 24c6b0db59..47266feae2 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 @@ -1019,7 +1019,7 @@ public class FindWindow extends Window implements EventListener, ValueCha if (listbox.getId().equals(listColumn.getId())) { ListItem column = listColumn.getSelectedItem(); - if (column != null) + if (column != null && column.getValue().toString().length() > 0) { addOperators(column, listOperator); } From bd6236850d39e5a17f03b0f13dec2cc1100439fd Mon Sep 17 00:00:00 2001 From: Juliana Corredor Date: Mon, 5 Aug 2013 13:16:51 -0500 Subject: [PATCH 2/5] IDEMPIERE-1241 problem with advanced search colum posted --- .../adempiere/webui/window/FindWindow.java | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 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 47266feae2..dbdc999e4b 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 @@ -62,6 +62,7 @@ import org.adempiere.webui.component.Window; import org.adempiere.webui.editor.WEditor; import org.adempiere.webui.editor.WNumberEditor; import org.adempiere.webui.editor.WStringEditor; +import org.adempiere.webui.editor.WTableDirEditor; import org.adempiere.webui.editor.WebEditorFactory; import org.adempiere.webui.event.DialogEvents; import org.adempiere.webui.event.ValueChangeEvent; @@ -73,7 +74,9 @@ import org.compiere.model.GridField; import org.compiere.model.GridFieldVO; import org.compiere.model.GridTab; import org.compiere.model.MColumn; +import org.compiere.model.MLookup; import org.compiere.model.MLookupFactory; +import org.compiere.model.MLookupInfo; import org.compiere.model.MProduct; import org.compiere.model.MQuery; import org.compiere.model.MRole; @@ -1663,18 +1666,24 @@ public class FindWindow extends Window implements EventListener, ValueCha { editor = new WNumberEditor(findField); } - else if (findField.getDisplayType() == DisplayType.Button) + else if (findField.getDisplayType() == DisplayType.Button) { - if (columnName.endsWith("_ID")) - { - editor = new WNumberEditor(findField); - } else { - editor = new WStringEditor(findField); - } + if (findField.getAD_Reference_Value_ID() > 0) { + MLookupInfo info = MLookupFactory.getLookup_List(Env.getLanguage(Env.getCtx()), findField.getAD_Reference_Value_ID()); + MLookup mLookup = new MLookup(info, 0); + editor = new WTableDirEditor(columnName, false,false, true, mLookup); + findField.addPropertyChangeListener(editor); + + } else { + if (columnName.endsWith("_ID")) { + editor = new WNumberEditor(findField); + } else { + editor = new WStringEditor(findField); + } + } } else { - //reload lookupinfo for find window if (DisplayType.isLookup(findField.getDisplayType()) ) { From 2eb2c0ef2c58782668b2d60a1d4fbcf9011e306b Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 5 Aug 2013 16:06:05 -0500 Subject: [PATCH 3/5] IDEMPIERE-1225 QuickEntry informs that no location has been introduced when in fact it has been --- .../src/org/adempiere/webui/grid/WQuickEntry.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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 f04875a62a..b4b0e348f0 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 @@ -23,6 +23,7 @@ import org.adempiere.webui.component.ConfirmPanel; import org.adempiere.webui.component.Label; import org.adempiere.webui.component.Window; import org.adempiere.webui.editor.WEditor; +import org.adempiere.webui.editor.WLocationEditor; import org.adempiere.webui.editor.WebEditorFactory; import org.adempiere.webui.event.ValueChangeEvent; import org.adempiere.webui.event.ValueChangeListener; @@ -466,11 +467,18 @@ public class WQuickEntry extends Window implements EventListener, ValueCh int idx = quickEditors.indexOf(evt.getSource()); if (idx >= 0) { GridField field = quickFields.get(idx); + WEditor editor = quickEditors.get(idx); GridTab gridTab = field.getGridTab(); String columnName = field.getColumnName(); // process dependencies and callouts for the changed field - field.getGridTab().setValue(field, evt.getNewValue()); - gridTab.processFieldChange(field); + if (evt.getSource() instanceof WLocationEditor && evt.getNewValue() == null && editor.getValue() != null) { + // ignore first call of WLocationEditor valuechange set to null + // it will be called later with correct value + // see WLocationEditor firing twice ValueChangeEvent (first with null and then with value) + } else { + field.setValue(evt.getNewValue(), field.getGridTab().getTableModel().isInserting()); + gridTab.processFieldChange(field); + } // Refresh the list on dependant fields ArrayList dependants = gridTab.getDependantFields(columnName); for (GridField dependentField : dependants) From a14fd8642faf5c3c96b39f5be6dc35042df58f4c Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 5 Aug 2013 17:49:37 -0500 Subject: [PATCH 4/5] IDEMPIERE-1025 Improve translation for custom tables / based on patch from Richard Morales --- .../oracle/201308051741_IDEMPIERE-1025.sql | 8 ++++++++ .../201308051741_IDEMPIERE-1025.sql | 8 ++++++++ .../src/org/compiere/dbPort/Convert.java | 2 ++ .../src/org/compiere/model/MColumn.java | 6 ++++++ .../pipo2/handler/AdElementHandler.java | 12 ++++-------- .../handler/CommonTranslationHandler.java | 19 +++++++++++++------ .../pipo2/handler/FieldElementHandler.java | 12 +++++++++--- .../handler/FieldGroupElementHandler.java | 15 +++++---------- .../pipo2/handler/FormElementHandler.java | 12 +++++++++++- .../pipo2/handler/MenuElementHandler.java | 19 ++++++++++++++++++- .../pipo2/handler/MessageElementHandler.java | 18 ++++++++++++++++-- .../PrintFormatItemElementHandler.java | 11 +++++++++++ .../pipo2/handler/ProcessElementHandler.java | 17 +++++++++++++---- .../handler/ProcessParaElementHandler.java | 11 +++++++++++ .../handler/ReferenceElementHandler.java | 11 ++++++++--- .../handler/ReferenceListElementHandler.java | 12 +++++++++++- .../pipo2/handler/TabElementHandler.java | 8 ++++++++ .../pipo2/handler/TaskElementHandler.java | 11 +++++++++++ .../pipo2/handler/WindowElementHandler.java | 9 +++++++-- .../pipo2/handler/WorkflowElementHandler.java | 12 +++++++++--- .../handler/WorkflowNodeElementHandler.java | 12 +++++++++++- .../pipo2/AbstractElementHandler.java | 2 +- .../src/org/adempiere/pipo2/PackIn.java | 2 ++ .../src/org/adempiere/pipo2/PackOut.java | 2 ++ 24 files changed, 205 insertions(+), 46 deletions(-) create mode 100644 migration/i1.0c-release/oracle/201308051741_IDEMPIERE-1025.sql create mode 100644 migration/i1.0c-release/postgresql/201308051741_IDEMPIERE-1025.sql diff --git a/migration/i1.0c-release/oracle/201308051741_IDEMPIERE-1025.sql b/migration/i1.0c-release/oracle/201308051741_IDEMPIERE-1025.sql new file mode 100644 index 0000000000..1d981dd8a0 --- /dev/null +++ b/migration/i1.0c-release/oracle/201308051741_IDEMPIERE-1025.sql @@ -0,0 +1,8 @@ +-- Aug 5, 2013 5:41:02 PM COT +-- IDEMPIERE-1025 Improve translation for custom tables +UPDATE AD_SysConfig SET Value='Y',Updated=TO_DATE('2013-08-05 17:41:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_SysConfig_ID=50031 +; + +SELECT register_migration_script('201308051741_IDEMPIERE-1025.sql') FROM dual +; + diff --git a/migration/i1.0c-release/postgresql/201308051741_IDEMPIERE-1025.sql b/migration/i1.0c-release/postgresql/201308051741_IDEMPIERE-1025.sql new file mode 100644 index 0000000000..a8cc6f0095 --- /dev/null +++ b/migration/i1.0c-release/postgresql/201308051741_IDEMPIERE-1025.sql @@ -0,0 +1,8 @@ +-- Aug 5, 2013 5:41:02 PM COT +-- IDEMPIERE-1025 Improve translation for custom tables +UPDATE AD_SysConfig SET Value='Y',Updated=TO_TIMESTAMP('2013-08-05 17:41:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_SysConfig_ID=50031 +; + +SELECT register_migration_script('201308051741_IDEMPIERE-1025.sql') FROM dual +; + diff --git a/org.adempiere.base/src/org/compiere/dbPort/Convert.java b/org.adempiere.base/src/org/compiere/dbPort/Convert.java index 93afb6636c..48cd57a85a 100644 --- a/org.adempiere.base/src/org/compiere/dbPort/Convert.java +++ b/org.adempiere.base/src/org/compiere/dbPort/Convert.java @@ -538,6 +538,8 @@ public abstract class Convert return true; if (uppStmt.startsWith("UPDATE C_ACCTPROCESSOR SET DATENEXTRUN")) return true; + if (uppStmt.startsWith("UPDATE R_REQUESTPROCESSOR SET DATELASTRUN")) + return true; // Don't log DELETE FROM Some_Table WHERE AD_Table_ID=? AND Record_ID=? if (uppStmt.startsWith("DELETE FROM ") && uppStmt.endsWith(" WHERE AD_TABLE_ID=? AND RECORD_ID=?")) return true; diff --git a/org.adempiere.base/src/org/compiere/model/MColumn.java b/org.adempiere.base/src/org/compiere/model/MColumn.java index a4a98ca0f8..502c410d19 100644 --- a/org.adempiere.base/src/org/compiere/model/MColumn.java +++ b/org.adempiere.base/src/org/compiere/model/MColumn.java @@ -370,6 +370,10 @@ public class MColumn extends X_AD_Column { if (!success) return success; + + /* Fields must inherit translation from element, not from column + * changing it here is useless as SynchronizeTerminology get trl from column */ + /* // Update Fields if (!newRecord) { @@ -387,6 +391,8 @@ public class MColumn extends X_AD_Column if (log.isLoggable(Level.FINE)) log.fine("afterSave - Fields updated #" + no); } } + */ + return success; } // afterSave diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/AdElementHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/AdElementHandler.java index efed2fe277..d6fa1479fc 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/AdElementHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/AdElementHandler.java @@ -78,7 +78,7 @@ public class AdElementHandler extends AbstractElementHandler { element.unresolved = notfounds.toString(); return; } - + element.recordId = mElement.getAD_Element_ID(); if (mElement.is_new() || mElement.is_Changed()) { X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, X_AD_Element.Table_Name, X_AD_Element.Table_ID); if (!mElement.is_new()) { @@ -92,8 +92,6 @@ public class AdElementHandler extends AbstractElementHandler { logImportDetail(ctx, impDetail, 1, mElement.getName(), mElement.get_ID(), action); - element.recordId = mElement.getAD_Element_ID(); - processedElements.add(mElement.getAD_Element_ID()); } else { @@ -123,7 +121,6 @@ public class AdElementHandler extends AbstractElementHandler { processedElements.add(adElement_id); X_AD_Element mAdElement = new X_AD_Element(ctx.ctx, adElement_id, null); - if (ctx.packOut.getFromDate() != null) { if (mAdElement.getUpdated().compareTo(ctx.packOut.getFromDate()) < 0) { return; @@ -136,11 +133,10 @@ public class AdElementHandler extends AbstractElementHandler { createAdElementBinding(ctx, document, mAdElement); PackOut packOut = ctx.packOut; - try{ + packOut.getCtx().ctx.put("Table_Name",X_AD_Element.Table_Name); + try { new CommonTranslationHandler().packOut(packOut,document,null,mAdElement.get_ID()); - } - catch(Exception e) - { + } catch(Exception e) { if (log.isLoggable(Level.INFO)) log.info(e.toString()); } 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 742568d0dc..07daff48fb 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 @@ -11,18 +11,17 @@ import javax.xml.transform.sax.TransformerHandler; import org.adempiere.exceptions.DBException; import org.adempiere.pipo2.AbstractElementHandler; -import org.adempiere.pipo2.PIPOContext; -import org.adempiere.pipo2.PoExporter; import org.adempiere.pipo2.Element; import org.adempiere.pipo2.ElementHandler; +import org.adempiere.pipo2.PIPOContext; import org.adempiere.pipo2.PackOut; +import org.adempiere.pipo2.PoExporter; +import org.compiere.model.MTable; import org.compiere.util.DB; import org.compiere.util.Env; import org.xml.sax.SAXException; import org.xml.sax.helpers.AttributesImpl; -import org.compiere.model.X_AD_Element; - public class CommonTranslationHandler extends AbstractElementHandler implements ElementHandler { public static final String CONTEXT_KEY_PARENT_TABLE = "currentParentTableForTranslation"; @@ -288,10 +287,18 @@ public class CommonTranslationHandler extends AbstractElementHandler implements return str.substring(1, str.length()-1); } + private boolean existTranslated(String Name) + { + if (MTable.getTable_ID(Name+"_Trl")>0) + return true; + else + return false; + } + public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler,int recordId) throws Exception { - if("true".equals(packout.getCtx().ctx.getProperty("isHandleTranslations"))){ - Env.setContext(packout.getCtx().ctx, CommonTranslationHandler.CONTEXT_KEY_PARENT_TABLE,X_AD_Element.Table_Name); + if("Y".equals(packout.getCtx().ctx.getProperty("isHandleTranslations")) && existTranslated(packout.getCtx().ctx.getProperty("Table_Name"))){ + Env.setContext(packout.getCtx().ctx, CommonTranslationHandler.CONTEXT_KEY_PARENT_TABLE,packout.getCtx().ctx.getProperty("Table_Name")); Env.setContext(packout.getCtx().ctx, CommonTranslationHandler.CONTEXT_KEY_PARENT_RECORD_ID,recordId); this.create(packout.getCtx(), packoutHandler); packout.getCtx().ctx.remove(CommonTranslationHandler.CONTEXT_KEY_PARENT_TABLE); diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/FieldElementHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/FieldElementHandler.java index 32eb62667e..efd5451551 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/FieldElementHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/FieldElementHandler.java @@ -17,6 +17,7 @@ package org.adempiere.pipo2.handler; import java.util.List; +import java.util.logging.Level; import javax.xml.transform.sax.TransformerHandler; @@ -134,7 +135,7 @@ public class FieldElementHandler extends AbstractElementHandler { element.unresolved = notfounds.toString(); return; } - + element.recordId = mField.getAD_Field_ID(); if (mField.is_new() || mField.is_Changed()) { X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, X_AD_Field.Table_Name, X_AD_Field.Table_ID); @@ -150,7 +151,6 @@ public class FieldElementHandler extends AbstractElementHandler { if (mField.save(getTrxName(ctx)) == true) { logImportDetail(ctx, impDetail, 1, mField.getName(), mField .get_ID(), action); - element.recordId = mField.getAD_Field_ID(); } else { logImportDetail(ctx, impDetail, 0, mField.getName(), mField .get_ID(), action); @@ -172,7 +172,6 @@ public class FieldElementHandler extends AbstractElementHandler { X_AD_Field m_Field = new X_AD_Field(ctx.ctx, AD_Field_ID, null); PackOut packOut = ctx.packOut; - try { if(m_Field.getAD_FieldGroup_ID() > 0) @@ -202,6 +201,13 @@ public class FieldElementHandler extends AbstractElementHandler { addTypeName(atts, "table"); document.startElement("", "", X_AD_Field.Table_Name, atts); createFieldBinding(ctx, document, m_Field); + packOut.getCtx().ctx.put("Table_Name",X_AD_Field.Table_Name); + try { + new CommonTranslationHandler().packOut(packOut,document,null,m_Field.get_ID()); + } catch(Exception e) { + if (log.isLoggable(Level.INFO)) log.info(e.toString()); + } + document.endElement("", "", X_AD_Field.Table_Name); } diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/FieldGroupElementHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/FieldGroupElementHandler.java index 4eb06680d0..e23a6324e5 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/FieldGroupElementHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/FieldGroupElementHandler.java @@ -83,6 +83,8 @@ public class FieldGroupElementHandler extends AbstractElementHandler { return; } + element.recordId = fieldGroup.getAD_FieldGroup_ID(); + if (fieldGroup.is_new() || fieldGroup.is_Changed()) { X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, X_AD_FieldGroup.Table_Name, X_AD_FieldGroup.Table_ID); @@ -96,9 +98,6 @@ public class FieldGroupElementHandler extends AbstractElementHandler { if (fieldGroup.save(getTrxName(ctx)) == true) { logImportDetail(ctx, impDetail, 1, fieldGroup.getName(), fieldGroup.get_ID(), action); - - element.recordId = fieldGroup.getAD_FieldGroup_ID(); - processedFieldGroups.add(fieldGroup.getAD_FieldGroup_ID()); } else { @@ -138,16 +137,13 @@ public class FieldGroupElementHandler extends AbstractElementHandler { AttributesImpl atts = new AttributesImpl(); addTypeName(atts, "table"); document.startElement("", "", I_AD_FieldGroup.Table_Name, atts); - createAdElementBinding(ctx, document, fieldGroup); PackOut packOut = ctx.packOut; - - try{ + packOut.getCtx().ctx.put("Table_Name",X_AD_FieldGroup.Table_Name); + try { new CommonTranslationHandler().packOut(packOut,document,null,fieldGroup.get_ID()); - } - catch(Exception e) - { + } catch(Exception e) { if (log.isLoggable(Level.INFO)) log.info(e.toString()); } document.endElement("", "", I_AD_FieldGroup.Table_Name); @@ -169,7 +165,6 @@ public class FieldGroupElementHandler extends AbstractElementHandler { public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler,int recordId) throws Exception { Env.setContext(packout.getCtx().ctx, X_AD_FieldGroup.COLUMNNAME_AD_FieldGroup_ID, recordId); - this.create(packout.getCtx(), packoutHandler); packout.getCtx().ctx.remove(X_AD_FieldGroup.COLUMNNAME_AD_FieldGroup_ID); } diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/FormElementHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/FormElementHandler.java index 0cf625922f..7b4ff2081d 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/FormElementHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/FormElementHandler.java @@ -19,6 +19,7 @@ package org.adempiere.pipo2.handler; import java.util.ArrayList; import java.util.List; +import java.util.logging.Level; import javax.xml.transform.sax.TransformerHandler; @@ -69,7 +70,7 @@ public class FormElementHandler extends AbstractElementHandler { element.unresolved = notfounds.toString(); return; } - + element.recordId = mForm.get_ID(); if (mForm.is_new() || mForm.is_Changed()) { X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, X_AD_Form.Table_Name, X_AD_Form.Table_ID); @@ -116,6 +117,15 @@ public class FormElementHandler extends AbstractElementHandler { addTypeName(atts, "table"); document.startElement("","",I_AD_Form.Table_Name,atts); createFormBinding(ctx, document, m_Form); + + PackOut packOut = ctx.packOut; + packOut.getCtx().ctx.put("Table_Name",X_AD_Form.Table_Name); + try { + new CommonTranslationHandler().packOut(packOut,document,null,m_Form.get_ID()); + } catch(Exception e) { + if (log.isLoggable(Level.INFO)) log.info(e.toString()); + } + document.endElement("","",I_AD_Form.Table_Name); } diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/MenuElementHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/MenuElementHandler.java index b451809644..7667f5b78e 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/MenuElementHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/MenuElementHandler.java @@ -79,7 +79,7 @@ public class MenuElementHandler extends AbstractElementHandler { element.unresolved = notFounds.toString(); return; } - + element.recordId = mMenu.get_ID(); if (!mMenu.is_new() && !mMenu.is_Changed()) return; @@ -211,6 +211,15 @@ public class MenuElementHandler extends AbstractElementHandler { addTypeName(atts, "table"); document.startElement("", "", I_AD_Menu.Table_Name, atts); createMenuBinding(ctx, document, m_Menu); + + PackOut packOut = ctx.packOut; + packOut.getCtx().ctx.put("Table_Name",X_AD_Menu.Table_Name); + try { + new CommonTranslationHandler().packOut(packOut,document,null,m_Menu.get_ID()); + } catch(Exception e) { + if (log.isLoggable(Level.INFO)) log.info(e.toString()); + } + createModule(ctx, document, AD_Menu_ID); document.endElement("", "", I_AD_Menu.Table_Name); } @@ -260,6 +269,14 @@ public class MenuElementHandler extends AbstractElementHandler { addTypeName(atts, "table"); document.startElement("", "", I_AD_Menu.Table_Name, atts); createMenuBinding(ctx, document, m_Menu); + + packOut.getCtx().ctx.put("Table_Name",X_AD_Menu.Table_Name); + try { + new CommonTranslationHandler().packOut(packOut,document,null,m_Menu.get_ID()); + } catch(Exception e) { + if (log.isLoggable(Level.INFO)) log.info(e.toString()); + } + if (rs.getInt("AD_WINDOW_ID") > 0 || rs.getInt("AD_WORKFLOW_ID") > 0 || rs.getInt("AD_TASK_ID") > 0 diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/MessageElementHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/MessageElementHandler.java index 6250e729a2..5f734ac53e 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/MessageElementHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/MessageElementHandler.java @@ -18,6 +18,7 @@ package org.adempiere.pipo2.handler; import java.util.ArrayList; import java.util.List; +import java.util.logging.Level; import javax.xml.transform.sax.TransformerHandler; @@ -55,6 +56,11 @@ public class MessageElementHandler extends AbstractElementHandler { } PoFiller filler = new PoFiller(ctx, mMessage, element, this); List excludes = defaultExcludeList(X_AD_Message.Table_Name); + + if (messages.contains(mMessage.getAD_Message_ID())) { + element.skip = true; + return; + } List notfounds = filler.autoFill(excludes); if (notfounds.size() > 0) { @@ -62,7 +68,7 @@ public class MessageElementHandler extends AbstractElementHandler { element.unresolved = notfounds.toString(); return; } - + element.recordId = mMessage.getAD_Message_ID(); if (mMessage.is_new() || mMessage.is_Changed()) { X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, X_AD_Message.Table_Name, X_AD_Message.Table_ID); @@ -102,7 +108,6 @@ public class MessageElementHandler extends AbstractElementHandler { messages.add(AD_Message_ID); AttributesImpl atts = new AttributesImpl(); X_AD_Message m_Message = new X_AD_Message (ctx.ctx, AD_Message_ID, null); - if (ctx.packOut.getFromDate() != null) { if (m_Message.getUpdated().compareTo(ctx.packOut.getFromDate()) < 0) { return; @@ -112,6 +117,15 @@ public class MessageElementHandler extends AbstractElementHandler { addTypeName(atts, "table"); document.startElement("","",I_AD_Message.Table_Name,atts); createMessageBinding(ctx,document,m_Message); + + PackOut packOut = ctx.packOut; + packOut.getCtx().ctx.put("Table_Name",X_AD_Message.Table_Name); + try { + new CommonTranslationHandler().packOut(packOut,document,null,m_Message.get_ID()); + } catch(Exception e) { + if (log.isLoggable(Level.INFO)) log.info(e.toString()); + } + document.endElement("","",I_AD_Message.Table_Name); } diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/PrintFormatItemElementHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/PrintFormatItemElementHandler.java index b0c14ca96d..d6991cd820 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/PrintFormatItemElementHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/PrintFormatItemElementHandler.java @@ -18,6 +18,7 @@ package org.adempiere.pipo2.handler; import java.util.List; +import java.util.logging.Level; import javax.xml.transform.sax.TransformerHandler; @@ -113,6 +114,7 @@ public class PrintFormatItemElementHandler extends AbstractElementHandler { return; } + element.recordId = mPrintFormatItem.get_ID(); if (mPrintFormatItem.is_new() || mPrintFormatItem.is_Changed()) { X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, X_AD_PrintFormatItem.Table_Name, X_AD_PrintFormatItem.Table_ID); @@ -150,10 +152,19 @@ public class PrintFormatItemElementHandler extends AbstractElementHandler { } } + PackOut packOut = ctx.packOut; AttributesImpl atts = new AttributesImpl(); addTypeName(atts, "table"); document.startElement("", "", I_AD_PrintFormatItem.Table_Name, atts); createPrintFormatItemBinding(ctx, document, m_PrintFormatItem); + + packOut.getCtx().ctx.put("Table_Name",I_AD_PrintFormatItem.Table_Name); + try { + new CommonTranslationHandler().packOut(packOut,document,null,m_PrintFormatItem.get_ID()); + } catch(Exception e) { + if (log.isLoggable(Level.INFO)) log.info(e.toString()); + } + document.endElement("", "", I_AD_PrintFormatItem.Table_Name); } diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/ProcessElementHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/ProcessElementHandler.java index a8c3aa38b4..07449bcd19 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/ProcessElementHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/ProcessElementHandler.java @@ -18,6 +18,7 @@ package org.adempiere.pipo2.handler; import java.util.ArrayList; import java.util.List; +import java.util.logging.Level; import javax.xml.transform.sax.TransformerHandler; @@ -82,6 +83,7 @@ public class ProcessElementHandler extends AbstractElementHandler { return; } + element.recordId = mProcess.get_ID(); if (mProcess.is_new() || mProcess.is_Changed()) { X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, X_AD_Process.Table_Name, X_AD_Process.Table_ID); @@ -96,7 +98,6 @@ public class ProcessElementHandler extends AbstractElementHandler { if (mProcess.save(getTrxName(ctx)) == true) { logImportDetail(ctx, impDetail, 1, mProcess.getName(), mProcess .get_ID(), action); - element.recordId = mProcess.getAD_Process_ID(); } else { logImportDetail(ctx, impDetail, 0, mProcess.getName(), mProcess .get_ID(), action); @@ -159,9 +160,17 @@ public class ProcessElementHandler extends AbstractElementHandler { } if (createElement) { - addTypeName(atts, "table"); - document.startElement("", "", I_AD_Process.Table_Name, atts); - createProcessBinding(ctx, document, m_Process); + addTypeName(atts, "table"); + document.startElement("", "", I_AD_Process.Table_Name, atts); + createProcessBinding(ctx, document, m_Process); + + packOut.getCtx().ctx.put("Table_Name",I_AD_Process.Table_Name); + try { + new CommonTranslationHandler().packOut(packOut,document,null,m_Process.get_ID()); + } catch(Exception e) { + if (log.isLoggable(Level.INFO)) log.info(e.toString()); + } + } Query query = new Query(ctx.ctx, "AD_Process_PARA", "AD_Process_ID = ?", getTrxName(ctx)); diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/ProcessParaElementHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/ProcessParaElementHandler.java index 4975772e7b..95ad9d8595 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/ProcessParaElementHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/ProcessParaElementHandler.java @@ -17,6 +17,7 @@ package org.adempiere.pipo2.handler; import java.util.List; +import java.util.logging.Level; import javax.xml.transform.sax.TransformerHandler; @@ -89,6 +90,7 @@ public class ProcessParaElementHandler extends AbstractElementHandler { return; } + element.recordId = mProcessPara.get_ID(); if (mProcessPara.is_new() || mProcessPara.is_Changed()) { X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, X_AD_Process_Para.Table_Name, X_AD_Process_Para.Table_ID); @@ -143,6 +145,15 @@ public class ProcessParaElementHandler extends AbstractElementHandler { addTypeName(atts, "table"); document.startElement("", "", I_AD_Process_Para.Table_Name, atts); createProcessParaBinding(ctx, document, m_Processpara); + + PackOut packOut = ctx.packOut; + packOut.getCtx().ctx.put("Table_Name",I_AD_Process_Para.Table_Name); + try { + new CommonTranslationHandler().packOut(packOut,document,null,m_Processpara.get_ID()); + } catch(Exception e) { + if (log.isLoggable(Level.INFO)) log.info(e.toString()); + } + document.endElement("", "", I_AD_Process_Para.Table_Name); } diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/ReferenceElementHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/ReferenceElementHandler.java index e4f47aa047..3c3b9ea56b 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/ReferenceElementHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/ReferenceElementHandler.java @@ -77,7 +77,7 @@ public class ReferenceElementHandler extends AbstractElementHandler { element.unresolved = notfounds.toString(); return; } - + element.recordId = mReference.getAD_Reference_ID(); if (mReference.is_new() || mReference.is_Changed()) { X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, X_AD_Reference.Table_Name, X_AD_Reference.Table_ID); @@ -96,7 +96,6 @@ public class ReferenceElementHandler extends AbstractElementHandler { logImportDetail(ctx, impDetail, 1, mReference.getName(), mReference.get_ID(), action); references.add(mReference.getAD_Reference_ID()); - element.recordId = mReference.getAD_Reference_ID(); } else { logImportDetail(ctx, impDetail, 0, mReference.getName(), mReference.get_ID(), action); @@ -130,11 +129,17 @@ public class ReferenceElementHandler extends AbstractElementHandler { createElement = false; } } - + PackOut packOut = ctx.packOut; + packOut.getCtx().ctx.put("Table_Name",X_AD_Reference.Table_Name); if (createElement) { addTypeName(atts, "table"); document.startElement("", "", I_AD_Reference.Table_Name, atts); createReferenceBinding(ctx, document, m_Reference); + try { + new CommonTranslationHandler().packOut(packOut,document,null,m_Reference.get_ID()); + } catch(Exception e) { + if (log.isLoggable(Level.INFO)) log.info(e.toString()); + } } if (m_Reference.getValidationType().compareTo("L") == 0) { diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/ReferenceListElementHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/ReferenceListElementHandler.java index 96457752f2..618568459e 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/ReferenceListElementHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/ReferenceListElementHandler.java @@ -17,6 +17,7 @@ package org.adempiere.pipo2.handler; import java.util.List; +import java.util.logging.Level; import javax.xml.transform.sax.TransformerHandler; @@ -77,7 +78,7 @@ public class ReferenceListElementHandler extends AbstractElementHandler { element.unresolved = notfounds.toString(); return; } - + element.recordId = mRefList.get_ID(); if (mRefList.is_new() || mRefList.is_Changed()) { X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, X_AD_Ref_List.Table_Name, X_AD_Ref_List.Table_ID); @@ -120,6 +121,15 @@ public class ReferenceListElementHandler extends AbstractElementHandler { addTypeName(atts, "table"); document.startElement("", "", I_AD_Ref_List.Table_Name, atts); createRefListBinding(ctx, document, m_Ref_List); + + PackOut packOut = ctx.packOut; + packOut.getCtx().ctx.put("Table_Name",X_AD_Ref_List.Table_Name); + try { + new CommonTranslationHandler().packOut(packOut,document,null,m_Ref_List.get_ID()); + } catch(Exception e) { + if (log.isLoggable(Level.INFO)) log.info(e.toString()); + } + document.endElement("", "", I_AD_Ref_List.Table_Name); } diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/TabElementHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/TabElementHandler.java index 516130bc66..42b4c4f39b 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/TabElementHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/TabElementHandler.java @@ -140,6 +140,7 @@ public class TabElementHandler extends AbstractElementHandler { return; } + element.recordId = mTab.get_ID(); if (mTab.is_new() || mTab.is_Changed()) { X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, X_AD_Tab.Table_Name, X_AD_Tab.Table_ID); @@ -185,6 +186,13 @@ public class TabElementHandler extends AbstractElementHandler { addTypeName(atts, "table"); document.startElement("","",I_AD_Tab.Table_Name,atts); createTabBinding(ctx,document,m_Tab); + + packOut.getCtx().ctx.put("Table_Name",X_AD_Tab.Table_Name); + try { + new CommonTranslationHandler().packOut(packOut,document,null,m_Tab.get_ID()); + } catch(Exception e) { + if (log.isLoggable(Level.INFO)) log.info(e.toString()); + } } //Fields tags. diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/TaskElementHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/TaskElementHandler.java index 5b20d96258..29b9849fa2 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/TaskElementHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/TaskElementHandler.java @@ -19,6 +19,7 @@ package org.adempiere.pipo2.handler; import java.util.ArrayList; import java.util.List; +import java.util.logging.Level; import javax.xml.transform.sax.TransformerHandler; @@ -69,6 +70,7 @@ public class TaskElementHandler extends AbstractElementHandler { return; } + element.recordId = mTask.get_ID(); if (mTask.is_new() || mTask.is_Changed()) { X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, X_AD_Task.Table_Name, X_AD_Task.Table_ID); @@ -112,6 +114,15 @@ public class TaskElementHandler extends AbstractElementHandler { addTypeName(atts, "table"); document.startElement("", "", I_AD_Task.Table_Name, atts); createTaskBinding(ctx, document, m_Task); + + PackOut packOut = ctx.packOut; + packOut.getCtx().ctx.put("Table_Name",I_AD_Task.Table_Name); + try { + new CommonTranslationHandler().packOut(packOut,document,null,m_Task.get_ID()); + } catch(Exception e) { + if (log.isLoggable(Level.INFO)) log.info(e.toString()); + } + document.endElement("", "", I_AD_Task.Table_Name); } diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/WindowElementHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/WindowElementHandler.java index 07310a3ff5..d1e20c5b03 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/WindowElementHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/WindowElementHandler.java @@ -90,7 +90,7 @@ public class WindowElementHandler extends AbstractElementHandler { element.unresolved = notfounds.toString(); return; } - + element.recordId = mWindow.get_ID(); if (mWindow.is_new() || mWindow.is_Changed()) { X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, X_AD_Window.Table_Name, X_AD_Window.Table_ID); @@ -104,7 +104,6 @@ public class WindowElementHandler extends AbstractElementHandler { if (mWindow.save(getTrxName(ctx)) == true) { logImportDetail(ctx, impDetail, 1, mWindow.getName(), mWindow .get_ID(), action); - element.recordId = mWindow.getAD_Window_ID(); windows.add(mWindow.getAD_Window_ID()); } else { logImportDetail(ctx, impDetail, 0, mWindow.getName(), mWindow @@ -164,6 +163,12 @@ public class WindowElementHandler extends AbstractElementHandler { addTypeName(atts, "table"); document.startElement("", "", I_AD_Window.Table_Name, atts); createWindowBinding(ctx, document, m_Window); + packOut.getCtx().ctx.put("Table_Name",X_AD_Window.Table_Name); + try { + new CommonTranslationHandler().packOut(packOut,document,null,m_Window.get_ID()); + } catch(Exception e) { + if (log.isLoggable(Level.INFO)) log.info(e.toString()); + } } // Tab Tag String sql = "SELECT AD_Tab_ID, AD_Table_ID FROM AD_TAB WHERE AD_WINDOW_ID = " diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/WorkflowElementHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/WorkflowElementHandler.java index c888a367ff..ea67fdd4d0 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/WorkflowElementHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/WorkflowElementHandler.java @@ -86,7 +86,7 @@ public class WorkflowElementHandler extends AbstractElementHandler { element.unresolved = notfounds.toString(); return; } - + element.recordId = mWorkflow.get_ID(); if (mWorkflow.is_new() || mWorkflow.is_Changed()) { X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, X_AD_Workflow.Table_Name, X_AD_Workflow.Table_ID); @@ -103,7 +103,6 @@ public class WorkflowElementHandler extends AbstractElementHandler { logImportDetail(ctx,impDetail, 1, mWorkflow.getName(), mWorkflow .get_ID(), action); workflows.add(mWorkflow.getAD_Workflow_ID()); - element.recordId = mWorkflow.getAD_Workflow_ID(); } else { log.info("m_Workflow save failure"); logImportDetail(ctx, impDetail, 0, mWorkflow.getName(), mWorkflow @@ -160,7 +159,7 @@ public class WorkflowElementHandler extends AbstractElementHandler { X_AD_Package_Exp_Detail.COLUMNNAME_AD_Workflow_ID); if (workflows.contains(AD_Workflow_ID)) return; - + PackOut packOut = ctx.packOut; workflows.add(AD_Workflow_ID); int ad_wf_nodenext_id = 0; int ad_wf_nodenextcondition_id = 0; @@ -179,6 +178,13 @@ public class WorkflowElementHandler extends AbstractElementHandler { atts.addAttribute("", "", "type-name", "CDATA", "ad.workflow"); document.startElement("", "", I_AD_Workflow.Table_Name, atts); createWorkflowBinding(ctx, document, m_Workflow); + + packOut.getCtx().ctx.put("Table_Name",I_AD_Workflow.Table_Name); + try { + new CommonTranslationHandler().packOut(packOut,document,null,m_Workflow.get_ID()); + } catch(Exception e) { + if (log.isLoggable(Level.INFO)) log.info(e.toString()); + } } String sql = "SELECT AD_WF_Node_ID FROM AD_WF_Node WHERE AD_Workflow_ID = " diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/WorkflowNodeElementHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/WorkflowNodeElementHandler.java index 3618687714..05e15d9396 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/WorkflowNodeElementHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/WorkflowNodeElementHandler.java @@ -18,6 +18,7 @@ package org.adempiere.pipo2.handler; import java.util.List; +import java.util.logging.Level; import javax.xml.transform.sax.TransformerHandler; @@ -94,7 +95,7 @@ public class WorkflowNodeElementHandler extends AbstractElementHandler { element.unresolved = notfounds.toString(); return; } - + element.recordId = mWFNode.get_ID(); if (mWFNode.is_new() || mWFNode.is_Changed()) { X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, X_AD_WF_Node.Table_Name, X_AD_WF_Node.Table_ID); @@ -141,6 +142,15 @@ public class WorkflowNodeElementHandler extends AbstractElementHandler { addTypeName(atts, "table"); document.startElement("", "", I_AD_WF_Node.Table_Name, atts); createWorkflowNodeBinding(ctx, document, m_WF_Node); + + PackOut packOut = ctx.packOut; + packOut.getCtx().ctx.put("Table_Name",I_AD_WF_Node.Table_Name); + try { + new CommonTranslationHandler().packOut(packOut,document,null,m_WF_Node.get_ID()); + } catch(Exception e) { + if (log.isLoggable(Level.INFO)) log.info(e.toString()); + } + document.endElement("", "", I_AD_WF_Node.Table_Name); } diff --git a/org.adempiere.pipo/src/org/adempiere/pipo2/AbstractElementHandler.java b/org.adempiere.pipo/src/org/adempiere/pipo2/AbstractElementHandler.java index d652b6d0bc..2919b41312 100644 --- a/org.adempiere.pipo/src/org/adempiere/pipo2/AbstractElementHandler.java +++ b/org.adempiere.pipo/src/org/adempiere/pipo2/AbstractElementHandler.java @@ -440,7 +440,7 @@ public abstract class AbstractElementHandler implements ElementHandler { */ protected boolean isHandleTranslations(Properties ctx) { - return "true".equalsIgnoreCase(Env.getContext(ctx, "isHandleTranslations")); + return "Y".equalsIgnoreCase(Env.getContext(ctx, "isHandleTranslations")); } /** diff --git a/org.adempiere.pipo/src/org/adempiere/pipo2/PackIn.java b/org.adempiere.pipo/src/org/adempiere/pipo2/PackIn.java index 33bb923834..1e29e41364 100644 --- a/org.adempiere.pipo/src/org/adempiere/pipo2/PackIn.java +++ b/org.adempiere.pipo/src/org/adempiere/pipo2/PackIn.java @@ -33,6 +33,7 @@ import java.util.logging.Level; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; +import org.compiere.model.MSysConfig; import org.compiere.model.PO; import org.compiere.model.X_AD_Package_Imp_Detail; import org.compiere.util.CLogger; @@ -153,6 +154,7 @@ public class PackIn { context.trx = Trx.get(trxName, true); context.packIn = this; context.ctx = ctx; + context.ctx.setProperty("isHandleTranslations", MSysConfig.getValue(MSysConfig.TWOPACK_HANDLE_TRANSLATIONS)); handler.setCtx(context); handler.setProcess(this); SAXParserFactory factory = SAXParserFactory.newInstance(); diff --git a/org.adempiere.pipo/src/org/adempiere/pipo2/PackOut.java b/org.adempiere.pipo/src/org/adempiere/pipo2/PackOut.java index 4dbd6b05de..55bd0c53a6 100644 --- a/org.adempiere.pipo/src/org/adempiere/pipo2/PackOut.java +++ b/org.adempiere.pipo/src/org/adempiere/pipo2/PackOut.java @@ -40,6 +40,7 @@ import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.stream.StreamResult; import org.compiere.model.MClient; +import org.compiere.model.MSysConfig; import org.compiere.model.MTable; import org.compiere.util.CLogger; import org.compiere.util.Trx; @@ -296,6 +297,7 @@ public class PackOut private void initContext() { if (trxName != null) pipoContext.trx = Trx.get(trxName, true); + pipoContext.ctx.setProperty("isHandleTranslations", MSysConfig.getValue(MSysConfig.TWOPACK_HANDLE_TRANSLATIONS)); pipoContext.packOut = this; } From 83cfb7fdda71a50c09449560a19a22c278c0929a Mon Sep 17 00:00:00 2001 From: Richard Morales Date: Mon, 5 Aug 2013 18:01:48 -0500 Subject: [PATCH 5/5] IDEMPIERE-1025 Improve translation for custom tables --- .../src/org/compiere/install/Translation.java | 14 +++++++++++++- .../org/compiere/install/TranslationHandler.java | 14 ++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/org.adempiere.ui/src/org/compiere/install/Translation.java b/org.adempiere.ui/src/org/compiere/install/Translation.java index e8bdd4ce2b..e473f165c5 100644 --- a/org.adempiere.ui/src/org/compiere/install/Translation.java +++ b/org.adempiere.ui/src/org/compiere/install/Translation.java @@ -39,6 +39,7 @@ import javax.xml.transform.stream.StreamResult; import org.compiere.Adempiere; import org.compiere.model.MLanguage; +import org.compiere.model.MTable; import org.compiere.model.PO; import org.compiere.util.CLogger; import org.compiere.util.DB; @@ -46,6 +47,7 @@ import org.compiere.util.Env; import org.compiere.util.Language; import org.compiere.util.Login; import org.compiere.util.Msg; +import org.compiere.util.Util; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -82,6 +84,8 @@ public class Translation public static final String XML_ROW_TAG = "row"; /** XML Row Attribute ID */ public static final String XML_ROW_ATTRIBUTE_ID = "id"; + /** XML Row Attribute UUID */ + public static final String XML_ROW_ATTRIBUTE_UUID = "uuid"; /** XML Row Attribute Translated */ public static final String XML_ROW_ATTRIBUTE_TRANSLATED = "trl"; @@ -165,6 +169,7 @@ public class Translation if (isBaseLanguage) tableName = Base_Table; String keyColumn = Base_Table + "_ID"; + String uuidColumn = MTable.getUUIDColumnName(Base_Table); String[] trlColumns = getTrlColumns (Base_Table); // StringBuffer sql = null; @@ -193,6 +198,7 @@ public class Translation else sql.append("t.IsTranslated,"); sql.append("t.").append(keyColumn); // 2 + sql.append(", o.").append(uuidColumn); // 3 // for (int i = 0; i < trlColumns.length; i++) sql.append(", t.").append(trlColumns[i]) @@ -224,7 +230,13 @@ public class Translation while (rs.next()) { Element row = document.createElement (XML_ROW_TAG); - row.setAttribute(XML_ROW_ATTRIBUTE_ID, String.valueOf(rs.getInt(2))); // KeyColumn + int keyid = rs.getInt(2); + String uuid = rs.getString(3); + if (keyid <= MTable.MAX_OFFICIAL_ID || Util.isEmpty(uuid)) { + row.setAttribute(XML_ROW_ATTRIBUTE_ID, String.valueOf(keyid)); // KeyColumn + } else { + row.setAttribute(XML_ROW_ATTRIBUTE_UUID, String.valueOf(uuid)); // UUIDColumn + } row.setAttribute(XML_ROW_ATTRIBUTE_TRANSLATED, rs.getString(1)); // IsTranslated for (int i = 0; i < trlColumns.length; i++) { diff --git a/org.adempiere.ui/src/org/compiere/install/TranslationHandler.java b/org.adempiere.ui/src/org/compiere/install/TranslationHandler.java index 22870f688c..078cbcd7a9 100644 --- a/org.adempiere.ui/src/org/compiere/install/TranslationHandler.java +++ b/org.adempiere.ui/src/org/compiere/install/TranslationHandler.java @@ -55,6 +55,8 @@ public class TranslationHandler extends DefaultHandler private String m_updateSQL = null; /** Current ID */ private String m_curID = null; + /** Current UUID */ + private String m_curUUID = null; /** Translated Flag */ private String m_trl = null; /** Current ColumnName */ @@ -97,6 +99,7 @@ public class TranslationHandler extends DefaultHandler else if (qName.equals(Translation.XML_ROW_TAG)) { m_curID = attributes.getValue(Translation.XML_ROW_ATTRIBUTE_ID); + m_curUUID = attributes.getValue(Translation.XML_ROW_ATTRIBUTE_UUID); m_trl = attributes.getValue(Translation.XML_ROW_ATTRIBUTE_TRANSLATED); // log.finest( "ID=" + m_curID); m_sql = new StringBuffer(); @@ -154,8 +157,15 @@ public class TranslationHandler extends DefaultHandler m_sql.append(",IsTranslated='Y'"); } // Where section - m_sql.append(" WHERE ") - .append(m_TableName).append("_ID=").append(m_curID); + m_sql.append(" WHERE "); + if (m_curUUID != null) { + StringBuilder sql = new StringBuilder("SELECT ").append(m_TableName).append("_ID").append(" FROM ").append(m_TableName) + .append(" WHERE ").append(m_TableName).append("_UU =?"); + int ID = DB.getSQLValueEx(null, sql.toString(), m_curUUID); + m_sql.append(m_TableName).append("_ID=").append(ID); + } else { + m_sql.append(m_TableName).append("_ID=").append(m_curID); + } if (!m_isBaseLanguage) m_sql.append(" AND AD_Language='").append(m_AD_Language).append("'"); if (m_AD_Client_ID >= 0)