From 2f089681df8b64698c3d3508604f2bda82ae7ffc Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Thu, 20 Feb 2020 12:52:05 +0100 Subject: [PATCH] Don't throw error if no salesPerson is assigned --- modules/ticket/back/methods/ticket/updateDiscount.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/ticket/back/methods/ticket/updateDiscount.js b/modules/ticket/back/methods/ticket/updateDiscount.js index 66b4d6f95..8777a60fc 100644 --- a/modules/ticket/back/methods/ticket/updateDiscount.js +++ b/modules/ticket/back/methods/ticket/updateDiscount.js @@ -108,8 +108,10 @@ module.exports = Self => { await Promise.all(promises); - query = `call vn.manaSpellersRequery(?)`; - await Self.rawSql(query, [salesPersonId], options); + if (salesPersonId) { + const query = `call vn.manaSpellersRequery(?)`; + await Self.rawSql(query, [salesPersonId], options); + } await tx.commit(); } catch (error) {