From 678eb2928f441fe3f86a75b9559c72e71cad3686 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Tue, 26 Mar 2024 10:30:17 +0100 Subject: [PATCH] refs #6964 feat:hasItemOlder --- modules/item/back/methods/item-shelving/hasItemOlder.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/item/back/methods/item-shelving/hasItemOlder.js b/modules/item/back/methods/item-shelving/hasItemOlder.js index b3fb6fa60..72f928ebc 100644 --- a/modules/item/back/methods/item-shelving/hasItemOlder.js +++ b/modules/item/back/methods/item-shelving/hasItemOlder.js @@ -37,6 +37,11 @@ module.exports = Self => { Self.hasItemOlder = async(shelvingFkIn, parking, shelvingFkOut, itemFk, options) => { if (!parking && !shelvingFkOut) throw new UserError('Missing data: parking or shelving'); + + const myOptions = {}; + if (typeof options == 'object') + Object.assign(myOptions, options); + const result = await Self.rawSql(` SELECT COUNT(ish.id) countItemOlder FROM vn.itemShelving ish @@ -53,7 +58,7 @@ module.exports = Self => { AND (p.code <> ? OR ? IS NULL) AND (ish.shelvingFk <> ? OR ? IS NULL) AND (ish.itemFk <> ? OR ? IS NULL)`, - [shelvingFkIn, parking, parking, shelvingFkOut, shelvingFkOut, itemFk, itemFk], options); + [shelvingFkIn, parking, parking, shelvingFkOut, shelvingFkOut, itemFk, itemFk], myOptions); return result[0]['countItemOlder'] > 0; }; };