Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -150,10 +150,17 @@ WHERE b.typ = 'img'
|
||||
AND (
|
||||
-- exact code match (spaces ignored)
|
||||
UPPER(REPLACE(COALESCE(i.code,''), ' ', '')) = UPPER(REPLACE(COALESCE($1,''), ' ', ''))
|
||||
-- or exact core-code match after last '-' (e.g. S901-DMY18252 -> DMY18252)
|
||||
OR UPPER(REPLACE(REGEXP_REPLACE(COALESCE(i.code,''), '^.*-', ''), ' ', '')) =
|
||||
-- core-code fallback only when there is no exact item code for the input
|
||||
OR (
|
||||
NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM mmitem ix
|
||||
WHERE UPPER(REPLACE(COALESCE(ix.code,''), ' ', '')) = UPPER(REPLACE(COALESCE($1,''), ' ', ''))
|
||||
)
|
||||
AND UPPER(REPLACE(REGEXP_REPLACE(COALESCE(i.code,''), '^.*-', ''), ' ', '')) =
|
||||
UPPER(REPLACE(REGEXP_REPLACE(COALESCE($1,''), '^.*-', ''), ' ', ''))
|
||||
)
|
||||
)
|
||||
ORDER BY
|
||||
COALESCE(b.sort_order,999999),
|
||||
b.zlins_dttm DESC,
|
||||
|
||||
Reference in New Issue
Block a user