From 2ed386d12f3576ef61065587246a30ba34149775 Mon Sep 17 00:00:00 2001 From: Gerard Date: Fri, 30 Nov 2018 11:55:56 +0100 Subject: [PATCH] #849 order.basic-data --- .../common/methods/order/specs/updateBasicData.spec.js | 4 ++-- services/loopback/common/methods/order/updateBasicData.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/services/loopback/common/methods/order/specs/updateBasicData.spec.js b/services/loopback/common/methods/order/specs/updateBasicData.spec.js index 76a108749..6a0eda933 100644 --- a/services/loopback/common/methods/order/specs/updateBasicData.spec.js +++ b/services/loopback/common/methods/order/specs/updateBasicData.spec.js @@ -3,7 +3,7 @@ const app = require(`${servicesDir}/order/server/server`); describe('Order updateBasicData', () => { afterAll(async () => { let validparams = {note: null}; - let orderId = 22; + let orderId = 21; await app.models.Order.updateBasicData(validparams, orderId); }); @@ -52,7 +52,7 @@ describe('Order updateBasicData', () => { it('should update the client fiscal data and return the count if changes made', async () => { let validparams = {note: 'test note'}; - let orderId = 22; + let orderId = 21; let order = await app.models.Order.findById(orderId); diff --git a/services/loopback/common/methods/order/updateBasicData.js b/services/loopback/common/methods/order/updateBasicData.js index 505b6f654..5887b9925 100644 --- a/services/loopback/common/methods/order/updateBasicData.js +++ b/services/loopback/common/methods/order/updateBasicData.js @@ -32,7 +32,7 @@ module.exports = Self => { let order = await Self.app.models.Order.findById(id); let orderRows = await Self.app.models.OrderRow.find({where: {orderFk: id}}); - if (order.confirmed || orderRows.length != 0) + if (order.isConfirmed || orderRows.length != 0) throw new UserError(`You can't make changes on the basic data of an confirmed order or with rows`); let validUpdateParams = [