refs #6276 hotFix: setUserError and return

This commit is contained in:
Sergio De la torre 2024-03-25 13:00:55 +01:00
parent b179fc1b5a
commit 386bc1c934
2 changed files with 3 additions and 3 deletions

View File

@ -38,7 +38,7 @@ module.exports = Self => {
}, myOptions);
if (!machine)
throw new Error($t('the plate does not exist', {plate}));
throw new UserError($t('the plate does not exist', {plate}));
const machineWorker = await Self.findOne({
where: {
@ -48,7 +48,7 @@ module.exports = Self => {
}, myOptions);
const {maxHours} = await models.MachineWorkerConfig.findOne({fields: ['maxHours']}, myOptions);
const hoursDifference = (Date.vnNow() - machineWorker?.inTimed?.getTime() ?? 0) / (60 * 60 * 1000);
const hoursDifference = (Date.vnNow() - machineWorker?.inTime?.getTime() ?? 0) / (60 * 60 * 1000);
if (machineWorker) {
const isHimself = userId == machineWorker.workerFk;

View File

@ -89,7 +89,7 @@ module.exports = Self => {
const {itemOriginalFk} = await models.Buy.findById(buyFk, {fields: ['itemOriginalFk']}, myOptions);
if (itemOriginalFk) await models.SaleBuy.create({saleFk, buyFk}, myOptions);
} catch (e) {
if (tx) await tx.commit();
if (tx) return tx.commit();
}
if (tx) await tx.commit();
} catch (e) {