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

Status

Assignee

Andy Conn

Reporter

Andy Conn

Labels

None

Tested By

None

Time tracking

0m

Components

Affects versions

Priority

Major
Configure