From 01537d410ccda58d453b722f9e6b3f780dd852df Mon Sep 17 00:00:00 2001 From: robert Date: Wed, 27 Nov 2024 13:08:14 +0100 Subject: [PATCH] feat: refs #6629 refs # 6629 updateAddress --- .../client/back/methods/client/updateAddress.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/modules/client/back/methods/client/updateAddress.js b/modules/client/back/methods/client/updateAddress.js index 7342b28f1..190ebbc63 100644 --- a/modules/client/back/methods/client/updateAddress.js +++ b/modules/client/back/methods/client/updateAddress.js @@ -72,6 +72,10 @@ module.exports = function(Self) { { arg: 'isLogifloraAllowed', type: 'boolean' + }, + { + arg: 'updateObservations', + type: 'boolean' } ], returns: { @@ -127,6 +131,17 @@ module.exports = function(Self) { delete args.ctx; // Remove unwanted properties const updatedAddress = await address.updateAttributes(ctx.args, myOptions); + if (args.updateObservations) { + const ticket = await Self.rawSql(` + UPDATE ticketObservation to2 + JOIN ticket t ON t.id = to2.ticketFk + JOIN address a ON a.id = t.addressFk + JOIN addressObservation ao ON ao.addressFk = a.id + SET to2.description = ao.description + WHERE ao.observationTypeFk = to2.observationTypeFk + AND a.id = ? + AND t.shipped >= util.VN_CURDATE()`, [addressId]); + } return updatedAddress; };