IDEMPIERE-1025 Improve translation for custom tables / based on patch from Richard Morales

This commit is contained in:
Carlos Ruiz 2013-08-05 17:49:37 -05:00
parent 2eb2c0ef2c
commit a14fd8642f
24 changed files with 205 additions and 46 deletions

View File

@ -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
;

View File

@ -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
;

View File

@ -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;

View File

@ -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

View File

@ -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());
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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

View File

@ -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<String> excludes = defaultExcludeList(X_AD_Message.Table_Name);
if (messages.contains(mMessage.getAD_Message_ID())) {
element.skip = true;
return;
}
List<String> 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);
}

View File

@ -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);
}

View File

@ -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));

View File

@ -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);
}

View File

@ -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) {

View File

@ -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);
}

View File

@ -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.

View File

@ -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);
}

View File

@ -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 = "

View File

@ -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 = "

View File

@ -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);
}

View File

@ -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"));
}
/**

View File

@ -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();

View File

@ -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;
}