[2pack] Packout reference table call wrong ElementHandler.packOut overloading
Description
Environment
Attachments
- 24 Apr 2020, 10:29 PM
- 24 Apr 2020, 08:31 PM
- 24 Apr 2020, 08:31 PM
Activity
>That doesn't look good in case GenericPOElementHandler is used to process a table that don't have an ID column.
is packout product with M_Product_PO and it still work well after apply my patch
M_Product_PO is a table without ID
(don't like AD_Role_OrgAccess has OrgRoleElementHandler to handle M_Product_PO hasn't any ElementHandler for it)
in that case then call to function handler.packOut(ctx.packOut, document, ctx.logDocument, po.get_ID());
also not good.
because po.get_ID() return id of parent table but handler.packOut expect id of current record
it's also not predicate on case multi parent.
example AD_Role_OrgAccess has two parent AD_Role and AD_Org then po.get_ID() return AD_Role_ID or AD_Org_ID depend one order of columns on POInfo.m_columns (order by AD_Column_ID isn't meaning value)
Hi @Hiep Lq, haven't tested but I checked the patch and I notice you're changing this approach:
if (po.get_ID() > 0) {
by this different:
int id = po.get_ValueAsInt(po.get_TableName() + "_ID");
if (id > 0) {
That doesn't look good in case GenericPOElementHandler is used to process a table that don't have an ID column.
Regards,
Carlos Ruiz
to do 2pack for role of client gardenworld, i define a packout with detail record follow Packout reference table :
type = data
table = AD_Role
sql = SELECT * FROM AD_Role WHERE AD_Role_UU='66ad18b5-262f-42fe-bf02-e868ef0fdb2b';AD_Role_OrgAccess
i attach my pack out define at
when run packout i get error "AD_Role_OrgAccess doesn't have ID, use method with UUID"
Test Case 2:
Type = Data
Table = AD_Org
SQL Statement = SELECT * FROM AD_Org WHERE AD_Org_ID=11;AD_Role_OrgAccess