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; }; };