[ 2876218 ] 2pack is not using proper key identifiers
https://sourceforge.net/tracker/?func=detail&aid=2876218&group_id=176962&atid=879335
This commit is contained in:
parent
e5ca457c33
commit
24a024a602
|
@ -13,6 +13,7 @@
|
|||
*
|
||||
* Copyright (C) 2005 Robert Klein. robeklein@hotmail.com
|
||||
* Contributor(s): Low Heng Sin hengsin@avantz.com
|
||||
* Teo Sarca, teo.sarca@gmail.com
|
||||
*****************************************************************************/
|
||||
package org.adempiere.pipo.handler;
|
||||
|
||||
|
@ -96,10 +97,16 @@ public class ColumnElementHandler extends AbstractElementHandler {
|
|||
}
|
||||
m_Column.setColumnName(columnName);
|
||||
|
||||
String Name = atts.getValue("ADProcessNameID");
|
||||
id = get_IDWithColumn(ctx, "AD_Process", "Name", Name);
|
||||
m_Column.setAD_Process_ID(id);
|
||||
Name = atts.getValue("ADReferenceNameID");
|
||||
// Process
|
||||
String processName = atts.getValue("ADProcessNameID");
|
||||
int AD_Process_ID = get_IDWithColumn(ctx, "AD_Process", "Value", processName);
|
||||
if (AD_Process_ID <= 0 /** TODO PackOut version check 005 */)
|
||||
{
|
||||
AD_Process_ID = get_IDWithColumn(ctx, "AD_Process", "Name", processName);
|
||||
}
|
||||
m_Column.setAD_Process_ID(AD_Process_ID);
|
||||
//
|
||||
String Name = atts.getValue("ADReferenceNameID");
|
||||
id = get_IDWithColumn(ctx, "AD_Reference", "Name", Name);
|
||||
m_Column.setAD_Reference_ID(id);
|
||||
// log.info("Column ID ->"+id);
|
||||
|
@ -408,18 +415,29 @@ public class ColumnElementHandler extends AbstractElementHandler {
|
|||
atts.addAttribute("", "", "ADColumnNameID", "CDATA", name);
|
||||
} else
|
||||
atts.addAttribute("", "", "ADColumnNameID", "CDATA", "");
|
||||
if (m_Column.getAD_Process_ID() > 0) {
|
||||
sql = "SELECT Name FROM AD_Process WHERE AD_Process_ID=?";
|
||||
name = DB.getSQLValueString(null, sql, m_Column.getAD_Process_ID());
|
||||
//
|
||||
if (m_Column.getAD_Process_ID() > 0)
|
||||
{
|
||||
sql = "SELECT Value FROM AD_Process WHERE AD_Process_ID=?";
|
||||
name = DB.getSQLValueStringEx(null, sql, m_Column.getAD_Process_ID());
|
||||
atts.addAttribute("", "", "ADProcessNameID", "CDATA", name);
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
atts.addAttribute("", "", "ADProcessNameID", "CDATA", "");
|
||||
if (m_Column.getAD_Element_ID() > 0) {
|
||||
sql = "SELECT Name FROM AD_Element WHERE AD_Element_ID=?";
|
||||
name = DB.getSQLValueString(null, sql, m_Column.getAD_Element_ID());
|
||||
}
|
||||
// Element - this info is not needed since we search for element based on ColumnName
|
||||
if (m_Column.getAD_Element_ID() > 0)
|
||||
{
|
||||
sql = "SELECT ColumnName FROM AD_Element WHERE AD_Element_ID=?";
|
||||
name = DB.getSQLValueStringEx(null, sql, m_Column.getAD_Element_ID());
|
||||
atts.addAttribute("", "", "ADElementNameID", "CDATA", name);
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
atts.addAttribute("", "", "ADElementNameID", "CDATA", "");
|
||||
}
|
||||
//
|
||||
if (m_Column.getAD_Reference_ID() > 0) {
|
||||
sql = "SELECT Name FROM AD_Reference WHERE AD_Reference_ID=?";
|
||||
name = DB.getSQLValueString(null, sql, m_Column
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
*
|
||||
* Copyright (C) 2005 Robert Klein. robeklein@hotmail.com
|
||||
* Contributor(s): Low Heng Sin hengsin@avantz.com
|
||||
* Teo Sarca, teo.sarca@gmail.com
|
||||
*****************************************************************************/
|
||||
package org.adempiere.pipo.handler;
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
*
|
||||
* Copyright (C) 2005 Robert Klein. robeklein@hotmail.com
|
||||
* Contributor(s): Low Heng Sin hengsin@avantz.com
|
||||
* Teo Sarca, teo.sarca@gmail.com
|
||||
*****************************************************************************/
|
||||
package org.adempiere.pipo.handler;
|
||||
|
||||
|
@ -97,7 +98,11 @@ public class ProcessParaElementHandler extends AbstractElementHandler {
|
|||
|
||||
name = atts.getValue("ADElementNameID");
|
||||
if (name != null && name.trim().length() > 0) {
|
||||
id = get_IDWithColumn(ctx, "AD_Element", "Name", name);
|
||||
id = get_IDWithColumn(ctx, "AD_Element", "ColumnName", name);
|
||||
if (id <= 0 /** Check Packout version - 005 */)
|
||||
{
|
||||
id = get_IDWithColumn(ctx, "AD_Element", "Name", name);
|
||||
}
|
||||
// Setup Element
|
||||
X_AD_Element adElement = new X_AD_Element(ctx, id, getTrxName(ctx));
|
||||
if (adElement.getAD_Element_ID() == 0) {
|
||||
|
@ -240,9 +245,8 @@ public class ProcessParaElementHandler extends AbstractElementHandler {
|
|||
} else
|
||||
atts.addAttribute("", "", "ADProcessParaNameID", "CDATA", "");
|
||||
if (m_Processpara.getAD_Element_ID() > 0) {
|
||||
sql = "SELECT Name FROM AD_Element WHERE AD_Element_ID=?";
|
||||
name = DB.getSQLValueString(null, sql, m_Processpara
|
||||
.getAD_Element_ID());
|
||||
sql = "SELECT ColumnName FROM AD_Element WHERE AD_Element_ID=?";
|
||||
name = DB.getSQLValueStringEx(null, sql, m_Processpara.getAD_Element_ID());
|
||||
atts.addAttribute("", "", "ADElementNameID", "CDATA", name);
|
||||
} else
|
||||
atts.addAttribute("", "", "ADElementNameID", "CDATA", "");
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
*
|
||||
* Copyright (C) 2005 Robert Klein. robeklein@hotmail.com
|
||||
* Contributor(s): Low Heng Sin hengsin@avantz.com
|
||||
* Teo Sarca, teo.sarca@gmail.com
|
||||
*****************************************************************************/
|
||||
package org.adempiere.pipo.handler;
|
||||
|
||||
|
@ -38,8 +39,8 @@ import org.xml.sax.Attributes;
|
|||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.helpers.AttributesImpl;
|
||||
|
||||
public class TabElementHandler extends AbstractElementHandler {
|
||||
|
||||
public class TabElementHandler extends AbstractElementHandler
|
||||
{
|
||||
private FieldElementHandler fieldHandler = new FieldElementHandler();
|
||||
|
||||
public void startElement(Properties ctx, Element element) throws SAXException {
|
||||
|
@ -128,10 +129,18 @@ public class TabElementHandler extends AbstractElementHandler {
|
|||
id = get_IDWithColumn(ctx, "AD_Table", "TableName", name);
|
||||
m_Tab.setAD_Table_ID(id);
|
||||
}
|
||||
if (getStringValue(atts,"ADColumnNameID")!= null){
|
||||
if (getStringValue(atts,"ADColumnNameID")!= null) {
|
||||
name = atts.getValue("ADColumnNameID");
|
||||
id = get_IDWithMasterAndColumn (ctx, "AD_Column","Name", atts.getValue("ADColumnNameID"), "AD_Table", get_IDWithColumn(ctx,"AD_Table", "TableName", atts.getValue("ADTableNameID")));
|
||||
m_Tab.setAD_Column_ID(id);
|
||||
id = get_IDWithMasterAndColumn(ctx, "AD_Column","ColumnName", atts.getValue("ADColumnNameID"), "AD_Table", m_Tab.getAD_Table_ID());
|
||||
if (id <= 0 /** TODO Check PackOut Version -- 005 */)
|
||||
{
|
||||
id = get_IDWithMasterAndColumn(ctx, "AD_Column","Name", atts.getValue("ADColumnNameID"), "AD_Table", m_Tab.getAD_Table_ID());
|
||||
}
|
||||
m_Tab.setAD_Column_ID(id);
|
||||
if (id <= 0)
|
||||
{
|
||||
log.warning("@NotFound@ @AD_Column_ID@ - @Name@:"+name+", @AD_Table_ID@:"+atts.getValue("ADTableNameID"));
|
||||
}
|
||||
}
|
||||
m_Tab.setAD_Window_ID(windowid);
|
||||
|
||||
|
@ -198,16 +207,14 @@ public class TabElementHandler extends AbstractElementHandler {
|
|||
String sql = "SELECT * FROM AD_FIELD WHERE AD_TAB_ID = " + AD_Tab_ID
|
||||
+ "ORDER BY SEQNO asc, "+X_AD_Field.COLUMNNAME_AD_Field_ID;
|
||||
PreparedStatement pstmt = null;
|
||||
pstmt = DB.prepareStatement (sql, getTrxName(ctx));
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
pstmt = DB.prepareStatement (sql, getTrxName(ctx));
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
createField(ctx, document, rs.getInt("AD_Field_ID"));
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -216,14 +223,8 @@ public class TabElementHandler extends AbstractElementHandler {
|
|||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
}
|
||||
catch (Exception e)
|
||||
{}
|
||||
pstmt = null;
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
document.endElement("","","tab");
|
||||
|
||||
|
@ -250,21 +251,21 @@ public class TabElementHandler extends AbstractElementHandler {
|
|||
atts.addAttribute("", "", "AD_Tab_ID", "CDATA", Integer.toString(m_Tab.getAD_Tab_ID()));
|
||||
atts.addAttribute("","","Name","CDATA",(m_Tab.getName () != null ? m_Tab.getName ():""));
|
||||
if (m_Tab.getAD_ColumnSortOrder_ID()>0){
|
||||
sql = "SELECT Name FROM AD_Column WHERE AD_Column_ID=?";
|
||||
sql = "SELECT ColumnName FROM AD_Column WHERE AD_Column_ID=?";
|
||||
name = DB.getSQLValueString(null,sql,m_Tab.getAD_ColumnSortOrder_ID());
|
||||
atts.addAttribute("","","ADColumnSortOrderNameID","CDATA",name);
|
||||
}
|
||||
else
|
||||
atts.addAttribute("","","ADColumnSortOrderNameID","CDATA","");
|
||||
if (m_Tab.getAD_ColumnSortYesNo_ID()>0 ){
|
||||
sql = "SELECT Name FROM AD_Column WHERE AD_Column_ID=?";
|
||||
sql = "SELECT ColumnName FROM AD_Column WHERE AD_Column_ID=?";
|
||||
name = DB.getSQLValueString(null,sql,m_Tab.getAD_ColumnSortYesNo_ID());
|
||||
atts.addAttribute("","","ADColumnSortYesNoNameID","CDATA",name);
|
||||
}
|
||||
else
|
||||
atts.addAttribute("","","ADColumnSortYesNoNameID","CDATA","");
|
||||
if (m_Tab.getAD_Column_ID()>0 ){
|
||||
sql = "SELECT Name FROM AD_Column WHERE AD_Column_ID=?";
|
||||
sql = "SELECT ColumnName FROM AD_Column WHERE AD_Column_ID=?";
|
||||
name = DB.getSQLValueString(null,sql,m_Tab.getAD_Column_ID());
|
||||
atts.addAttribute("","","ADColumnNameID","CDATA",name);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue