Model CreateData Web service input field lookup feature bug

Description

When using the ID lookup feature (dataField.setLval(value)), the boolean SQL logic generated by ADLookup fails to enclose the identifier clause in parenthesis and can result in more than 1 row returned. For instance, dataField.setLval("Standard") for AD_Org_ID generates:

SELECT M_Warehouse.M_Warehouse_ID FROM M_Warehouse
WHERE
UPPER(Name) LIKE 'STANDARD'
OR UPPER(Value) LIKE 'STANDARD'
AND IsActive='Y'
AND M_Warehouse.AD_Org_ID=1000011
AND AD_Client_ID IN (0,1000009)
AND (M_Warehouse_ID IS NULL
OR M_Warehouse_ID NOT IN (
SELECT Record_ID FROM AD_Private_Access WHERE AD_Table_ID = 190 AND AD_User_ID <> 1000022 AND IsActive = 'Y' ));

Where it should be:

SELECT M_Warehouse.M_Warehouse_ID FROM M_Warehouse
WHERE
(
UPPER(Name) LIKE 'STANDARD'
OR UPPER(Value) LIKE 'STANDARD'
)
AND IsActive='Y'
AND M_Warehouse.AD_Org_ID=1000011
AND AD_Client_ID IN (0,1000009)
AND (M_Warehouse_ID IS NULL
OR M_Warehouse_ID NOT IN (
SELECT Record_ID FROM AD_Private_Access WHERE AD_Table_ID = 190 AND AD_User_ID <> 1000022 AND IsActive = 'Y' ));

Environment

All

Activity

Show:
Andy Conn
June 24, 2016, 8:48 PM

@@ -288,6 +288,11 @@
log.log(Level.SEVERE, m_columnName + " (TableDir) - no standard/identifier columns");
return "";
}
+
+ // Enclose "OR'd" identifier lookup clause in parens to not boolean corrupt additionally appended "AND" clauses
+ sql.insert(0,"(");
+ sql.append(") ");
+
//
StringBuffer retValue = new StringBuffer ("SELECT ")
.append(m_columnName).append(" FROM ").append(m_tableName)

Andy Conn
June 24, 2016, 8:49 PM
Edited

Hello - I am sorry - very new to this. I am probably not submitting this correctly and I just realized that I was debugging the 3.1 and not the trunk. I committed a change for this to the 3.1 release. Checking if is fixed in trunk ...

  • Just checked and is broken in trunk too

Andy Conn
June 25, 2016, 3:28 AM
Edited

Please forgive my clumsy attempt at my first JIRA. I aim to improve! I figured out how to export the patch (new to HG). I am pasting it. It is against 3.1 but that file I do believe has NOT been changed in development. Afterwards, I will attempt to check out the development branch and create/attach the patch from there as well.

Andy Conn
June 25, 2016, 3:59 AM

The 11386.patch I believe is for development

Fixed

Assignee

Andy Conn

Reporter

Andy Conn

Labels

None

Tested By

None

Time tracking

0m

Time remaining

0m

Components

Affects versions

Priority

Major
Configure