7199-devToTest_2316 #2287

Merged
alexm merged 169 commits from 7199-devToTest_2316 into test 2024-04-11 06:25:23 +00:00
1 changed files with 6 additions and 1 deletions
Showing only changes of commit 678eb2928f - Show all commits

View File

@ -37,6 +37,11 @@ module.exports = Self => {
Self.hasItemOlder = async(shelvingFkIn, parking, shelvingFkOut, itemFk, options) => { Self.hasItemOlder = async(shelvingFkIn, parking, shelvingFkOut, itemFk, options) => {
if (!parking && !shelvingFkOut) throw new UserError('Missing data: parking or shelving'); 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(` const result = await Self.rawSql(`
SELECT COUNT(ish.id) countItemOlder SELECT COUNT(ish.id) countItemOlder
FROM vn.itemShelving ish FROM vn.itemShelving ish
@ -53,7 +58,7 @@ module.exports = Self => {
AND (p.code <> ? OR ? IS NULL) AND (p.code <> ? OR ? IS NULL)
AND (ish.shelvingFk <> ? OR ? IS NULL) AND (ish.shelvingFk <> ? OR ? IS NULL)
AND (ish.itemFk <> ? 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; return result[0]['countItemOlder'] > 0;
}; };
}; };