From 33f1ed360b7dc91ec7e5c453e6b693edf3d69aef Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 23 May 2024 12:16:12 +0200 Subject: [PATCH 01/38] refactor: refs #7457 Added from param if not exists --- modules/order/back/methods/order/filter.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/modules/order/back/methods/order/filter.js b/modules/order/back/methods/order/filter.js index 592ed11e6..d22fa0804 100644 --- a/modules/order/back/methods/order/filter.js +++ b/modules/order/back/methods/order/filter.js @@ -96,9 +96,18 @@ module.exports = Self => { teamMembersId.push(userId); } - if (args && args.myTeam) + if (args?.myTeam) args.teamIds = teamIds; + if (args?.to) + args.to.setHours(23, 59, 0, 0); + + if (!args.from) { + const yesterday = new Date(); + yesterday.setDate(yesterday.getDate() - 1); + args.from = yesterday.toISOString().split('T')[0]; + } + const where = buildFilter(args, (param, value) => { switch (param) { case 'search': @@ -194,7 +203,7 @@ module.exports = Self => { `); stmt.merge(conn.makeWhere(filter.where)); - stmt.merge(`GROUP BY id`); + stmt.merge(`GROUP BY o.id`); stmt.merge(conn.makePagination(filter)); stmts.push(stmt); stmts.push(`SET SESSION optimizer_search_depth = @_optimizer_search_depth`); From a35c10adabbb4ea937fe43d55d8ca617a0f8d312 Mon Sep 17 00:00:00 2001 From: pablone Date: Thu, 17 Oct 2024 08:35:24 +0200 Subject: [PATCH 02/38] fix: refs #7457 error on empty from param and add translate --- loopback/locale/en.json | 3 ++- loopback/locale/es.json | 3 ++- loopback/locale/fr.json | 5 +++-- loopback/locale/pt.json | 3 ++- modules/order/back/methods/order/filter.js | 9 +++------ 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/loopback/locale/en.json b/loopback/locale/en.json index ea84cb6eb..0f6457754 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -240,5 +240,6 @@ "There is already a tray with the same height": "There is already a tray with the same height", "The height must be greater than 50cm": "The height must be greater than 50cm", "The maximum height of the wagon is 200cm": "The maximum height of the wagon is 200cm", - "The quantity claimed cannot be greater than the quantity of the line": "The quantity claimed cannot be greater than the quantity of the line" + "The quantity claimed cannot be greater than the quantity of the line": "The quantity claimed cannot be greater than the quantity of the line", + "The from field is required": "The 'from' field is required" } diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 9308fd4ec..8118b6f65 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -382,5 +382,6 @@ "This buyer has already made a reservation for this date": "Este comprador ya ha hecho una reserva para esta fecha", "No valid travel thermograph found": "No se encontró un termógrafo válido", "The quantity claimed cannot be greater than the quantity of the line": "La cantidad reclamada no puede ser mayor que la cantidad de la línea", - "type cannot be blank": "Se debe rellenar el tipo" + "type cannot be blank": "Se debe rellenar el tipo", + "The from field is required": "El campo 'desde' es obligatorio" } \ No newline at end of file diff --git a/loopback/locale/fr.json b/loopback/locale/fr.json index a6648b186..5bc98c3dd 100644 --- a/loopback/locale/fr.json +++ b/loopback/locale/fr.json @@ -123,7 +123,7 @@ "Added sale to ticket": "J'ai ajouté la ligne suivante au ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}", "Changed sale discount": "J'ai changé le rabais des lignes suivantes du ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", "Created claim": "J'ai créé la réclamation [{{claimId}}]({{{claimUrl}}}) des lignes suivantes du ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", - "Changed sale price": " le prix de [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) de {{oldPrice}}€ ➔ *{{newPrice}}€* du ticket [{{ticketId}}]({{{ticketUrl}}})",, + "Changed sale price": " le prix de [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) de {{oldPrice}}€ ➔ *{{newPrice}}€* du ticket [{{ticketId}}]({{{ticketUrl}}})", "Changed sale quantity": "J'ai changé {{changes}} du ticket [{{ticketId}}]({{{ticketUrl}}})", "Changes in sales": "la quantité de {{itemId}} {{concept}} de {{oldQuantity}} ➔ {{newQuantity}}", "State": "État", @@ -362,5 +362,6 @@ "It has been invoiced but the PDF of refund not be generated": "Il a été facturé mais le PDF de remboursement n'a pas été généré", "Cannot send mail": "Impossible d'envoyer le mail", "Original invoice not found": "Facture originale introuvable", - "The quantity claimed cannot be greater than the quantity of the line": "Le montant réclamé ne peut pas être supérieur au montant de la ligne" + "The quantity claimed cannot be greater than the quantity of the line": "Le montant réclamé ne peut pas être supérieur au montant de la ligne", + "The from field is required": "Le champ de est requis" } diff --git a/loopback/locale/pt.json b/loopback/locale/pt.json index a43f0e780..91dc372c3 100644 --- a/loopback/locale/pt.json +++ b/loopback/locale/pt.json @@ -362,5 +362,6 @@ "It has been invoiced but the PDF of refund not be generated": "Foi faturado mas não foi gerado o PDF do reembolso", "Original invoice not found": "Fatura original não encontrada", "Cannot send mail": "Não é possível enviar o email", - "The quantity claimed cannot be greater than the quantity of the line": "O valor reclamado não pode ser superior ao valor da linha" + "The quantity claimed cannot be greater than the quantity of the line": "O valor reclamado não pode ser superior ao valor da linha", + "The from field is required": "O campo de origem é obrigatório" } diff --git a/modules/order/back/methods/order/filter.js b/modules/order/back/methods/order/filter.js index affa53a55..5b5fe8701 100644 --- a/modules/order/back/methods/order/filter.js +++ b/modules/order/back/methods/order/filter.js @@ -2,6 +2,7 @@ const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; const buildFilter = require('vn-loopback/util/filter').buildFilter; const mergeFilters = require('vn-loopback/util/filter').mergeFilters; +const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethod('filter', { @@ -84,6 +85,8 @@ module.exports = Self => { const args = ctx.args; + if (!args.from) + throw new UserError('The from field is required'); // Apply filter by team const teamMembersId = []; if (args.myTeam != null) { @@ -106,12 +109,6 @@ module.exports = Self => { if (args?.to) args.to.setHours(23, 59, 0, 0); - if (!args.from) { - const yesterday = new Date(); - yesterday.setDate(yesterday.getDate() - 1); - args.from = yesterday.toISOString().split('T')[0]; - } - const where = buildFilter(args, (param, value) => { switch (param) { case 'search': From 78ee7e141d4c118099a6ecf2770771346cd296c0 Mon Sep 17 00:00:00 2001 From: pablone Date: Thu, 17 Oct 2024 08:40:25 +0200 Subject: [PATCH 03/38] fix: refs #7457 remove translate and use param definition for restriction --- loopback/locale/en.json | 3 +-- loopback/locale/es.json | 3 +-- loopback/locale/fr.json | 3 +-- loopback/locale/pt.json | 3 +-- modules/order/back/methods/order/filter.js | 7 ++----- 5 files changed, 6 insertions(+), 13 deletions(-) diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 0f6457754..ea84cb6eb 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -240,6 +240,5 @@ "There is already a tray with the same height": "There is already a tray with the same height", "The height must be greater than 50cm": "The height must be greater than 50cm", "The maximum height of the wagon is 200cm": "The maximum height of the wagon is 200cm", - "The quantity claimed cannot be greater than the quantity of the line": "The quantity claimed cannot be greater than the quantity of the line", - "The from field is required": "The 'from' field is required" + "The quantity claimed cannot be greater than the quantity of the line": "The quantity claimed cannot be greater than the quantity of the line" } diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 8118b6f65..9308fd4ec 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -382,6 +382,5 @@ "This buyer has already made a reservation for this date": "Este comprador ya ha hecho una reserva para esta fecha", "No valid travel thermograph found": "No se encontró un termógrafo válido", "The quantity claimed cannot be greater than the quantity of the line": "La cantidad reclamada no puede ser mayor que la cantidad de la línea", - "type cannot be blank": "Se debe rellenar el tipo", - "The from field is required": "El campo 'desde' es obligatorio" + "type cannot be blank": "Se debe rellenar el tipo" } \ No newline at end of file diff --git a/loopback/locale/fr.json b/loopback/locale/fr.json index 5bc98c3dd..3f6cc69e7 100644 --- a/loopback/locale/fr.json +++ b/loopback/locale/fr.json @@ -362,6 +362,5 @@ "It has been invoiced but the PDF of refund not be generated": "Il a été facturé mais le PDF de remboursement n'a pas été généré", "Cannot send mail": "Impossible d'envoyer le mail", "Original invoice not found": "Facture originale introuvable", - "The quantity claimed cannot be greater than the quantity of the line": "Le montant réclamé ne peut pas être supérieur au montant de la ligne", - "The from field is required": "Le champ de est requis" + "The quantity claimed cannot be greater than the quantity of the line": "Le montant réclamé ne peut pas être supérieur au montant de la ligne" } diff --git a/loopback/locale/pt.json b/loopback/locale/pt.json index 91dc372c3..a43f0e780 100644 --- a/loopback/locale/pt.json +++ b/loopback/locale/pt.json @@ -362,6 +362,5 @@ "It has been invoiced but the PDF of refund not be generated": "Foi faturado mas não foi gerado o PDF do reembolso", "Original invoice not found": "Fatura original não encontrada", "Cannot send mail": "Não é possível enviar o email", - "The quantity claimed cannot be greater than the quantity of the line": "O valor reclamado não pode ser superior ao valor da linha", - "The from field is required": "O campo de origem é obrigatório" + "The quantity claimed cannot be greater than the quantity of the line": "O valor reclamado não pode ser superior ao valor da linha" } diff --git a/modules/order/back/methods/order/filter.js b/modules/order/back/methods/order/filter.js index 5b5fe8701..844adb51e 100644 --- a/modules/order/back/methods/order/filter.js +++ b/modules/order/back/methods/order/filter.js @@ -2,7 +2,6 @@ const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; const buildFilter = require('vn-loopback/util/filter').buildFilter; const mergeFilters = require('vn-loopback/util/filter').mergeFilters; -const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethod('filter', { @@ -23,7 +22,8 @@ module.exports = Self => { }, { arg: 'from', type: 'date', - description: 'The from date' + description: 'The from date', + required: true }, { arg: 'to', type: 'date', @@ -84,9 +84,6 @@ module.exports = Self => { Object.assign(myOptions, options); const args = ctx.args; - - if (!args.from) - throw new UserError('The from field is required'); // Apply filter by team const teamMembersId = []; if (args.myTeam != null) { From 989b68c33a85259243ecfd587cbff7dafcd5eff6 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Thu, 17 Oct 2024 12:44:05 +0200 Subject: [PATCH 04/38] fix: refs #6861 setQuantity --- .../procedures/itemShelvingSale_setQuantity.sql | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/db/routines/vn/procedures/itemShelvingSale_setQuantity.sql b/db/routines/vn/procedures/itemShelvingSale_setQuantity.sql index cde1b6872..f141762b5 100644 --- a/db/routines/vn/procedures/itemShelvingSale_setQuantity.sql +++ b/db/routines/vn/procedures/itemShelvingSale_setQuantity.sql @@ -3,7 +3,8 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelvingSale_setQ vItemShelvingSaleFk INT(10), vQuantity DECIMAL(10,0), vIsItemShelvingSaleEmpty BOOLEAN, - vSectorFk INT + vSectorFk INT, + vShelvingFk VARCHAR(10) ) BEGIN /** @@ -24,6 +25,7 @@ BEGIN DECLARE vItemFk INT; DECLARE vTotalQuantity INT; DECLARE vStateCode VARCHAR(45); + DECLARE vCurrentShelvingFk VARCHAR(10); DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN @@ -45,18 +47,25 @@ BEGIN iss.saleFk, iss.itemShelvingFk, SUM(IFNULL(iss.quantity,0)), - IF(sgd.id, 'PREVIOUS_PREPARATION', 'PREPARED') + IF(sgd.id, 'PREVIOUS_PREPARATION', 'PREPARED'), + ish.shelvingFk INTO vItemFk, vSaleFk, vItemShelvingFk, vReservedQuantity, - vStateCode + vStateCode, + vCurrentShelvingFk FROM itemShelvingSale iss JOIN sale s ON s.id = iss.saleFk + JOIN itemShelving ish ON ish.id = iss.itemShelvingFk LEFT JOIN vn.saleGroupDetail sgd ON sgd.saleFk = iss.saleFk WHERE iss.id = vItemShelvingSaleFk AND NOT iss.isPicked; + IF NOT (vCurrentShelvingFk <=> vShelvingFk) THEN + CALL util.throw('The shelving can not be different from the shelving reserved'); + END IF; + IF vQuantity > vReservedQuantity OR (vQuantity < vReservedQuantity AND NOT vIsItemShelvingSaleEmpty) OR (vQuantity = vReservedQuantity AND vIsItemShelvingSaleEmpty) THEN From 7e0f19b368c796def55b3ebcb070535ff79c2f78 Mon Sep 17 00:00:00 2001 From: robert Date: Fri, 18 Oct 2024 08:21:09 +0200 Subject: [PATCH 05/38] feat: refs #8127 entry_getCommission --- .../vn/functions/entry_getCommission.sql | 78 +++++++++---------- .../vn/procedures/entry_updateComission.sql | 4 +- 2 files changed, 39 insertions(+), 43 deletions(-) diff --git a/db/routines/vn/functions/entry_getCommission.sql b/db/routines/vn/functions/entry_getCommission.sql index 4a19f4e63..898ac8521 100644 --- a/db/routines/vn/functions/entry_getCommission.sql +++ b/db/routines/vn/functions/entry_getCommission.sql @@ -1,58 +1,54 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`entry_getCommission`(vTravelFk INT, - vCurrencyFk INT, - vSupplierFk INT + vCurrencyFk INT, + vSupplierFk INT ) RETURNS int(11) NOT DETERMINISTIC READS SQL DATA BEGIN - DECLARE vCommission INT; - DECLARE vCurrentCommission INT; - DECLARE vIsCurrencyUsd INT; - DECLARE vLastEntryFk INT; - - SELECT count(*) INTO vIsCurrencyUsd - FROM currency c - WHERE c.code = 'USD' AND id = vCurrencyFk; - - IF NOT vIsCurrencyUsd THEN - - SELECT e.id INTO vLastEntryFk - FROM vn.entry e - JOIN vn.travel tr ON tr.id = e.travelFk - WHERE e.supplierFk = vSupplierFk - ORDER BY tr.landed DESC - LIMIT 1; - - IF vLastEntryFk THEN - - SELECT commission INTO vCurrentCommission - FROM vn.entry - WHERE id = vLastEntryFk; - - ELSE - - SELECT commission INTO vCurrentCommission - FROM supplier s - WHERE s.id = vSupplierFk; - - END IF; - - RETURN vCurrentCommission; - - ELSE + DECLARE vCommission INT; + DECLARE vCurrentCommission INT; + DECLARE vIsNotEUR INT; + DECLARE vLastEntryFk INT; + SELECT count(*) INTO vIsNotEUR + FROM currency c + WHERE c.code <> 'EUR' AND id = vCurrencyFk; + + IF vIsNotEUR THEN SELECT ROUND(-100 * (1 - (1 / r.value))) INTO vCommission FROM travel t LEFT JOIN referenceCurrent r ON r.currencyFk = vCurrencyFk AND r.`dated` <= t.shipped WHERE t.id = vTravelFk ORDER BY r.`dated` DESC LIMIT 1; - + RETURN IFNULL(vCommission, 0); - - END IF; - + + ELSE + SELECT e.id INTO vLastEntryFk + FROM vn.entry e + JOIN vn.travel tr ON tr.id = e.travelFk + WHERE e.supplierFk = vSupplierFk + ORDER BY tr.landed DESC + LIMIT 1; + + IF vLastEntryFk THEN + SELECT commission INTO vCurrentCommission + FROM vn.entry + WHERE id = vLastEntryFk; + + ELSE + SELECT commission INTO vCurrentCommission + FROM supplier s + WHERE s.id = vSupplierFk; + + END IF; + + RETURN vCurrentCommission; + + END IF; + END$$ DELIMITER ; diff --git a/db/routines/vn/procedures/entry_updateComission.sql b/db/routines/vn/procedures/entry_updateComission.sql index e2de2a4a5..8db28f97d 100644 --- a/db/routines/vn/procedures/entry_updateComission.sql +++ b/db/routines/vn/procedures/entry_updateComission.sql @@ -22,7 +22,7 @@ BEGIN FROM vn.entry e JOIN vn.travel t ON t.id = e.travelFk JOIN vn.warehouse w ON w.id = t.warehouseInFk - WHERE t.shipped >= util.VN_CURDATE() + WHERE t.landed >= util.VN_CURDATE() AND e.currencyFk = vCurrency AND NOT e.isBooked; @@ -33,7 +33,7 @@ BEGIN SET e.commission = vComission; SELECT `name` INTO vCurrencyName - FROM currency + FROM currency WHERE id = vCurrency; CALL entry_recalc(); From fc61f7e4aba587c1577e28e9009d673e9fd9302a Mon Sep 17 00:00:00 2001 From: pablone Date: Mon, 11 Nov 2024 07:27:50 +0100 Subject: [PATCH 06/38] fix: refs #7457 remove group by calc time reduce bellow 1s --- modules/order/back/methods/order/filter.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/order/back/methods/order/filter.js b/modules/order/back/methods/order/filter.js index 844adb51e..eff2eecb6 100644 --- a/modules/order/back/methods/order/filter.js +++ b/modules/order/back/methods/order/filter.js @@ -201,7 +201,6 @@ module.exports = Self => { `); stmt.merge(conn.makeWhere(filter.where)); - stmt.merge(`GROUP BY o.id`); stmt.merge(conn.makePagination(filter)); stmts.push(stmt); stmts.push(`SET SESSION optimizer_search_depth = @_optimizer_search_depth`); @@ -214,7 +213,6 @@ module.exports = Self => { const sql = ParameterizedSQL.join(stmts, ';'); const result = await conn.executeStmt(sql, myOptions); - return result[ordersIndex]; }; }; From 5c054fe0d3a6e73a71ab26f8e19ada1c0b757e6c Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 11 Nov 2024 09:09:51 +0100 Subject: [PATCH 07/38] feat: refs #6869 add back --- .../vn/procedures/itemShelving_get.sql | 30 ----------- .../back/methods/item-shelving/getItems.js | 51 +++++++++++++++++++ modules/item/back/models/item-shelving.js | 1 + 3 files changed, 52 insertions(+), 30 deletions(-) delete mode 100644 db/routines/vn/procedures/itemShelving_get.sql create mode 100644 modules/item/back/methods/item-shelving/getItems.js diff --git a/db/routines/vn/procedures/itemShelving_get.sql b/db/routines/vn/procedures/itemShelving_get.sql deleted file mode 100644 index 07384b721..000000000 --- a/db/routines/vn/procedures/itemShelving_get.sql +++ /dev/null @@ -1,30 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelving_get`(IN vSelf VARCHAR(8)) -BEGIN -/** -* Lista artículos de itemshelving -* -* @param vSelf matrícula del carro -**/ - SELECT ish.itemFk item, - i.name, - i.longName, - i.size, - ish.visible, - ish.packing, - ish.grouping, - p.code, - ish.id, - s.priority, - ish.isChecked, - ic.url, - ish.available, - ish.buyFk - FROM itemShelving ish - JOIN item i ON i.id = ish.itemFk - JOIN shelving s ON vSelf = s.code COLLATE utf8_unicode_ci - LEFT JOIN parking p ON s.parkingFk = p.id - JOIN hedera.imageConfig ic - WHERE ish.shelvingFk COLLATE utf8_unicode_ci = vSelf; -END$$ -DELIMITER ; diff --git a/modules/item/back/methods/item-shelving/getItems.js b/modules/item/back/methods/item-shelving/getItems.js new file mode 100644 index 000000000..2fe50d785 --- /dev/null +++ b/modules/item/back/methods/item-shelving/getItems.js @@ -0,0 +1,51 @@ +module.exports = Self => { + Self.remoteMethod('getItems', { + description: 'shelving item list', + accessType: 'READ', + accepts: [{ + arg: 'code', + type: 'string', + required: true, + description: 'Shelving code' + }], + returns: { + type: 'object', + root: true + }, + http: { + path: `/getItems`, + verb: 'GET' + } + }); + + Self.getItems = async(code, options) => { + const models = Self.app.models; + const myOptions = {}; + if (typeof options == 'object') + Object.assign(myOptions, options); + + const shelving = await models.Shelving.findOne({ + fields: ['priority', 'parkingFk'], + include: { + relation: 'parking', + scope: {fields: ['code']} + }, + where: {code} + }, myOptions); + + const itemShelvings = await Self.find({ + fields: ['itemFk', 'visible', 'packing', 'grouping', 'isChecked', 'available', 'buyFk'], + include: { + relation: 'item', + scope: {fields: ['name', 'longName', 'size']} + }, + where: {shelvingFk: code} + }, myOptions); + return { + code: shelving.parking().code, + priority: shelving.priority, + itemShelvings, + }; + // Add image from hedera.imageConfig + }; +}; diff --git a/modules/item/back/models/item-shelving.js b/modules/item/back/models/item-shelving.js index be72dac37..ba6ab780d 100644 --- a/modules/item/back/models/item-shelving.js +++ b/modules/item/back/models/item-shelving.js @@ -5,4 +5,5 @@ module.exports = Self => { require('../methods/item-shelving/getAlternative')(Self); require('../methods/item-shelving/updateFromSale')(Self); require('../methods/item-shelving/getListItemNewer')(Self); + require('../methods/item-shelving/getItems')(Self); }; From a41fc36f9092105384ccdd3bcf7f8adcc193d435 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 11 Nov 2024 13:02:09 +0100 Subject: [PATCH 08/38] feat: refs #6869 define model --- back/model-config.json | 3 ++ back/models/image-config.json | 22 ++++++++ .../back/methods/item-shelving/getItems.js | 51 ------------------- modules/item/back/models/item-shelving.js | 1 - modules/item/back/models/item-shelving.json | 3 ++ modules/shelving/back/models/shelving.json | 10 +++- 6 files changed, 36 insertions(+), 54 deletions(-) create mode 100644 back/models/image-config.json delete mode 100644 modules/item/back/methods/item-shelving/getItems.js diff --git a/back/model-config.json b/back/model-config.json index 5368769fd..73db0a31b 100644 --- a/back/model-config.json +++ b/back/model-config.json @@ -79,6 +79,9 @@ "ImageCollectionSize": { "dataSource": "vn" }, + "ImageConfig": { + "dataSource": "vn" + }, "ImageContainer": { "dataSource": "imageStorage" }, diff --git a/back/models/image-config.json b/back/models/image-config.json new file mode 100644 index 000000000..11f4c2284 --- /dev/null +++ b/back/models/image-config.json @@ -0,0 +1,22 @@ +{ + "name": "ImageConfig", + "base": "VnModel", + "options": { + "mysql": { + "table": "hedera.imageConfig" + } + }, + "properties": { + "url": { + "type": "string" + } + }, + "acls": [ + { + "accessType": "READ", + "principalType": "ROLE", + "principalId": "$authenticated", + "permission": "ALLOW" + } + ] +} \ No newline at end of file diff --git a/modules/item/back/methods/item-shelving/getItems.js b/modules/item/back/methods/item-shelving/getItems.js deleted file mode 100644 index 2fe50d785..000000000 --- a/modules/item/back/methods/item-shelving/getItems.js +++ /dev/null @@ -1,51 +0,0 @@ -module.exports = Self => { - Self.remoteMethod('getItems', { - description: 'shelving item list', - accessType: 'READ', - accepts: [{ - arg: 'code', - type: 'string', - required: true, - description: 'Shelving code' - }], - returns: { - type: 'object', - root: true - }, - http: { - path: `/getItems`, - verb: 'GET' - } - }); - - Self.getItems = async(code, options) => { - const models = Self.app.models; - const myOptions = {}; - if (typeof options == 'object') - Object.assign(myOptions, options); - - const shelving = await models.Shelving.findOne({ - fields: ['priority', 'parkingFk'], - include: { - relation: 'parking', - scope: {fields: ['code']} - }, - where: {code} - }, myOptions); - - const itemShelvings = await Self.find({ - fields: ['itemFk', 'visible', 'packing', 'grouping', 'isChecked', 'available', 'buyFk'], - include: { - relation: 'item', - scope: {fields: ['name', 'longName', 'size']} - }, - where: {shelvingFk: code} - }, myOptions); - return { - code: shelving.parking().code, - priority: shelving.priority, - itemShelvings, - }; - // Add image from hedera.imageConfig - }; -}; diff --git a/modules/item/back/models/item-shelving.js b/modules/item/back/models/item-shelving.js index ba6ab780d..be72dac37 100644 --- a/modules/item/back/models/item-shelving.js +++ b/modules/item/back/models/item-shelving.js @@ -5,5 +5,4 @@ module.exports = Self => { require('../methods/item-shelving/getAlternative')(Self); require('../methods/item-shelving/updateFromSale')(Self); require('../methods/item-shelving/getListItemNewer')(Self); - require('../methods/item-shelving/getItems')(Self); }; diff --git a/modules/item/back/models/item-shelving.json b/modules/item/back/models/item-shelving.json index 5df3b0703..b0e3f17fa 100644 --- a/modules/item/back/models/item-shelving.json +++ b/modules/item/back/models/item-shelving.json @@ -41,6 +41,9 @@ }, "available": { "type": "number" + }, + "buyFk": { + "type": "number" } }, "relations": { diff --git a/modules/shelving/back/models/shelving.json b/modules/shelving/back/models/shelving.json index 46fce31e8..f6df57d43 100644 --- a/modules/shelving/back/models/shelving.json +++ b/modules/shelving/back/models/shelving.json @@ -1,6 +1,6 @@ { "name": "Shelving", - "base": "VnModel", + "base": "VnModel", "mixins": { "Loggable": true }, @@ -44,6 +44,12 @@ "type": "belongsTo", "model": "Worker", "foreignKey": "id" + }, + "itemShelving": { + "type": "hasMany", + "model": "ItemShelving", + "foreignKey": "shelvingFk", + "primaryKey": "code" } } -} +} \ No newline at end of file From 3a8c37aef83218ba5674ab45dc1437fe9d68814f Mon Sep 17 00:00:00 2001 From: sergiodt Date: Tue, 12 Nov 2024 11:59:51 +0100 Subject: [PATCH 09/38] fix: refs #6861 refs#6861 getTickets --- back/methods/collection/getTickets.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/back/methods/collection/getTickets.js b/back/methods/collection/getTickets.js index 48301a366..4e91839f2 100644 --- a/back/methods/collection/getTickets.js +++ b/back/methods/collection/getTickets.js @@ -57,10 +57,10 @@ module.exports = Self => { ROW_NUMBER () OVER (PARTITION BY s.id ORDER BY pickingOrder) currentItemShelving, COUNT(*) OVER (PARTITION BY s.id ORDER BY s.id) totalItemShelving, sh.code, - p2.code parkingCode, - p2.pickingOrder pickingOrder, - p.code parkingCodePrevia, - p.pickingOrder pickingOrderPrevia, + p2.code parkingCodePrevia, + p2.pickingOrder pickingOrderPrevia, + p.code parkingCode, + p.pickingOrder pickingOrder, iss.id itemShelvingSaleFk, iss.isPicked, iss.itemShelvingFk From b7655b4f9208a807d217f1934f76806c5b740a6d Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 14 Nov 2024 08:24:42 +0100 Subject: [PATCH 10/38] feat: refs #8057 Added geoFk columns --- db/versions/11346-yellowPhormium/00-address.sql | 4 ++++ db/versions/11346-yellowPhormium/01-client.sql | 7 +++++++ db/versions/11346-yellowPhormium/02-supplier.sql | 6 ++++++ 3 files changed, 17 insertions(+) create mode 100644 db/versions/11346-yellowPhormium/00-address.sql create mode 100644 db/versions/11346-yellowPhormium/01-client.sql create mode 100644 db/versions/11346-yellowPhormium/02-supplier.sql diff --git a/db/versions/11346-yellowPhormium/00-address.sql b/db/versions/11346-yellowPhormium/00-address.sql new file mode 100644 index 000000000..02e09bd00 --- /dev/null +++ b/db/versions/11346-yellowPhormium/00-address.sql @@ -0,0 +1,4 @@ +ALTER TABLE vn.address + ADD geoFk int(11) DEFAULT NULL NULL AFTER isLogifloraAllowed, + ADD CONSTRAINT address_zoneGeo_FK FOREIGN KEY (geoFk) + REFERENCES vn.zoneGeo(id) ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/db/versions/11346-yellowPhormium/01-client.sql b/db/versions/11346-yellowPhormium/01-client.sql new file mode 100644 index 000000000..c58810fb1 --- /dev/null +++ b/db/versions/11346-yellowPhormium/01-client.sql @@ -0,0 +1,7 @@ +ALTER TABLE vn.client + CHANGE hasDailyInvoice hasDailyInvoice tinyint(1) DEFAULT 0 NOT NULL + COMMENT 'Indica si el cliente requiere facturación diaria por defecto se copiará lo que tenga country.hasDailyInvoice' + AFTER recommendedCredit, + ADD geoFk int(11) DEFAULT NULL NULL AFTER hasDailyInvoice, + ADD CONSTRAINT client_zoneGeo_FK FOREIGN KEY (geoFk) + REFERENCES vn.zoneGeo(id) ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/db/versions/11346-yellowPhormium/02-supplier.sql b/db/versions/11346-yellowPhormium/02-supplier.sql new file mode 100644 index 000000000..f38202d5e --- /dev/null +++ b/db/versions/11346-yellowPhormium/02-supplier.sql @@ -0,0 +1,6 @@ +ALTER TABLE vn.supplier + CHANGE companySize companySize enum('small','medium','big') CHARACTER SET utf8mb3 + COLLATE utf8mb3_general_ci DEFAULT NULL NULL AFTER stamp, + ADD geoFk int(11) DEFAULT NULL NULL AFTER companySize, + ADD CONSTRAINT supplier_zoneGeo_FK FOREIGN KEY (geoFk) + REFERENCES vn.zoneGeo(id) ON DELETE RESTRICT ON UPDATE CASCADE; From d4b0da50d0a60cab3e1da5c02358c2cdf060a190 Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 14 Nov 2024 09:00:19 +0100 Subject: [PATCH 11/38] feat: refs #8057 Added data updates --- .../11346-yellowPhormium/00-address.sql | 23 +++++++++++++-- .../11346-yellowPhormium/01-client.sql | 29 +++++++++++++++---- .../11346-yellowPhormium/02-supplier.sql | 27 +++++++++++++---- 3 files changed, 65 insertions(+), 14 deletions(-) diff --git a/db/versions/11346-yellowPhormium/00-address.sql b/db/versions/11346-yellowPhormium/00-address.sql index 02e09bd00..8e1315072 100644 --- a/db/versions/11346-yellowPhormium/00-address.sql +++ b/db/versions/11346-yellowPhormium/00-address.sql @@ -1,4 +1,21 @@ ALTER TABLE vn.address - ADD geoFk int(11) DEFAULT NULL NULL AFTER isLogifloraAllowed, - ADD CONSTRAINT address_zoneGeo_FK FOREIGN KEY (geoFk) - REFERENCES vn.zoneGeo(id) ON DELETE RESTRICT ON UPDATE CASCADE; + ADD geoFk int(11) DEFAULT NULL NULL AFTER isLogifloraAllowed, + ADD CONSTRAINT address_zoneGeo_FK FOREIGN KEY (geoFk) + REFERENCES vn.zoneGeo(id) ON DELETE RESTRICT ON UPDATE CASCADE; + +CREATE OR REPLACE TEMPORARY TABLE tAddressGeo + (PRIMARY KEY (id)) + ENGINE = MEMORY + SELECT a.id, p.geoFk + FROM address a + JOIN town t ON t.provinceFk = a.provinceFk + JOIN postCode p ON p.townFk = t.id + AND p.`code` = a.postalCode + GROUP BY a.id + ORDER BY (a.city SOUNDS LIKE t.`name`) DESC; + +UPDATE address a + JOIN tAddressGeo tag ON tag.id = a.id + SET a.geoFk = tag.geoFk; + +DROP TEMPORARY TABLE tAddressGeo; diff --git a/db/versions/11346-yellowPhormium/01-client.sql b/db/versions/11346-yellowPhormium/01-client.sql index c58810fb1..932b28ef5 100644 --- a/db/versions/11346-yellowPhormium/01-client.sql +++ b/db/versions/11346-yellowPhormium/01-client.sql @@ -1,7 +1,24 @@ ALTER TABLE vn.client - CHANGE hasDailyInvoice hasDailyInvoice tinyint(1) DEFAULT 0 NOT NULL - COMMENT 'Indica si el cliente requiere facturación diaria por defecto se copiará lo que tenga country.hasDailyInvoice' - AFTER recommendedCredit, - ADD geoFk int(11) DEFAULT NULL NULL AFTER hasDailyInvoice, - ADD CONSTRAINT client_zoneGeo_FK FOREIGN KEY (geoFk) - REFERENCES vn.zoneGeo(id) ON DELETE RESTRICT ON UPDATE CASCADE; + CHANGE hasDailyInvoice hasDailyInvoice tinyint(1) DEFAULT 0 NOT NULL + COMMENT 'Indica si el cliente requiere facturación diaria por defecto se copiará lo que tenga country.hasDailyInvoice' + AFTER recommendedCredit, + ADD geoFk int(11) DEFAULT NULL NULL AFTER hasDailyInvoice, + ADD CONSTRAINT client_zoneGeo_FK FOREIGN KEY (geoFk) + REFERENCES vn.zoneGeo(id) ON DELETE RESTRICT ON UPDATE CASCADE; + +CREATE OR REPLACE TEMPORARY TABLE tClientGeo + (PRIMARY KEY (id)) + ENGINE = MEMORY + SELECT c.id, p.geoFk + FROM client c + JOIN town t ON t.provinceFk = c.provinceFk + JOIN postCode p ON p.townFk = t.id + AND p.`code` = c.postcode + GROUP BY c.id + ORDER BY (c.city SOUNDS LIKE t.`name`) DESC; + +UPDATE client c + JOIN tClientGeo tcg ON tcg.id = c.id + SET c.geoFk = tcg.geoFk; + +DROP TEMPORARY TABLE tClientGeo; diff --git a/db/versions/11346-yellowPhormium/02-supplier.sql b/db/versions/11346-yellowPhormium/02-supplier.sql index f38202d5e..ef5e04a43 100644 --- a/db/versions/11346-yellowPhormium/02-supplier.sql +++ b/db/versions/11346-yellowPhormium/02-supplier.sql @@ -1,6 +1,23 @@ ALTER TABLE vn.supplier - CHANGE companySize companySize enum('small','medium','big') CHARACTER SET utf8mb3 - COLLATE utf8mb3_general_ci DEFAULT NULL NULL AFTER stamp, - ADD geoFk int(11) DEFAULT NULL NULL AFTER companySize, - ADD CONSTRAINT supplier_zoneGeo_FK FOREIGN KEY (geoFk) - REFERENCES vn.zoneGeo(id) ON DELETE RESTRICT ON UPDATE CASCADE; + CHANGE companySize companySize enum('small','medium','big') CHARACTER SET utf8mb3 + COLLATE utf8mb3_general_ci DEFAULT NULL NULL AFTER stamp, + ADD geoFk int(11) DEFAULT NULL NULL AFTER companySize, + ADD CONSTRAINT supplier_zoneGeo_FK FOREIGN KEY (geoFk) + REFERENCES vn.zoneGeo(id) ON DELETE RESTRICT ON UPDATE CASCADE; + +CREATE OR REPLACE TEMPORARY TABLE tSupplierGeo + (PRIMARY KEY (id)) + ENGINE = MEMORY + SELECT sa.supplierFk id, p.geoFk + FROM supplierAddress sa + JOIN town t ON t.provinceFk = sa.provinceFk + JOIN postCode p ON p.townFk = t.id + AND p.`code` = sa.postalCode + GROUP BY sa.supplierFk + ORDER BY (sa.city SOUNDS LIKE t.`name`) DESC; + +UPDATE supplier s + JOIN tSupplierGeo tsg ON tsg.id = s.id + SET s.geoFk = tsg.geoFk; + +DROP TEMPORARY TABLE tSupplierGeo; From cba1abad68cb90b238c3f0a7f7f4d158d247488c Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 14 Nov 2024 09:27:38 +0100 Subject: [PATCH 12/38] feat: refs #8057 Added data updates --- db/routines/vn/functions/client_getGeo.sql | 25 +++++++++++++++++++ db/routines/vn/functions/supplier_getGeo.sql | 25 +++++++++++++++++++ .../vn/triggers/address_beforeInsert.sql | 1 + .../vn/triggers/address_beforeUpdate.sql | 6 ++++- .../vn/triggers/client_beforeInsert.sql | 8 +++--- .../vn/triggers/client_beforeUpdate.sql | 6 +++++ .../vn/triggers/supplier_beforeInsert.sql | 1 + .../vn/triggers/supplier_beforeUpdate.sql | 5 ++++ .../11346-yellowPhormium/02-supplier.sql | 12 ++++----- 9 files changed, 77 insertions(+), 12 deletions(-) create mode 100644 db/routines/vn/functions/client_getGeo.sql create mode 100644 db/routines/vn/functions/supplier_getGeo.sql diff --git a/db/routines/vn/functions/client_getGeo.sql b/db/routines/vn/functions/client_getGeo.sql new file mode 100644 index 000000000..067eb84bc --- /dev/null +++ b/db/routines/vn/functions/client_getGeo.sql @@ -0,0 +1,25 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`client_getGeo`(vSelf INT) + RETURNS int(11) + DETERMINISTIC +BEGIN +/** + * Returns the geo for the passed client. + * + * @param vSelf The address id + * @return The geo id + */ + DECLARE vGeoFk INT; + + SELECT p.geoFk INTO vGeoFk + FROM client c + JOIN town t ON t.provinceFk = c.provinceFk + JOIN postCode p ON p.townFk = t.id + AND p.`code` = c.postcode + WHERE c.id = vSelf + ORDER BY (c.city SOUNDS LIKE t.`name`) DESC + LIMIT 1; + + RETURN vGeoFk; +END$$ +DELIMITER ; diff --git a/db/routines/vn/functions/supplier_getGeo.sql b/db/routines/vn/functions/supplier_getGeo.sql new file mode 100644 index 000000000..93115d712 --- /dev/null +++ b/db/routines/vn/functions/supplier_getGeo.sql @@ -0,0 +1,25 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`supplier_getGeo`(vSelf INT) + RETURNS int(11) + DETERMINISTIC +BEGIN +/** + * Returns the geo for the passed supplier. + * + * @param vSelf The address id + * @return The geo id + */ + DECLARE vGeoFk INT; + + SELECT p.geoFk INTO vGeoFk + FROM supplier s + JOIN town t ON t.provinceFk = s.provinceFk + JOIN postCode p ON p.townFk = t.id + AND p.`code` = s.postCode + WHERE s.id = vSelf + ORDER BY (s.city SOUNDS LIKE t.`name`) DESC + LIMIT 1; + + RETURN vGeoFk; +END$$ +DELIMITER ; diff --git a/db/routines/vn/triggers/address_beforeInsert.sql b/db/routines/vn/triggers/address_beforeInsert.sql index 56ef7aa51..a4f384f14 100644 --- a/db/routines/vn/triggers/address_beforeInsert.sql +++ b/db/routines/vn/triggers/address_beforeInsert.sql @@ -6,6 +6,7 @@ BEGIN DECLARE vIsEqualizated BOOL; SET NEW.editorFk = account.myUser_getId(); + SET NEW.geoFk = address_getGeo(NEW.id); IF (NEW.phone <> '') THEN CALL pbx.phone_isValid(NEW.phone); diff --git a/db/routines/vn/triggers/address_beforeUpdate.sql b/db/routines/vn/triggers/address_beforeUpdate.sql index 35887912c..0b19a6266 100644 --- a/db/routines/vn/triggers/address_beforeUpdate.sql +++ b/db/routines/vn/triggers/address_beforeUpdate.sql @@ -3,7 +3,6 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`address_beforeUpdate` BEFORE UPDATE ON `address` FOR EACH ROW BEGIN - SET NEW.editorFk = account.myUser_getId(); IF !(NEW.phone <=> OLD.phone) AND (NEW.phone <> '') THEN @@ -14,5 +13,10 @@ BEGIN CALL pbx.phone_isValid(NEW.mobile); END IF; + IF NOT (NEW.provinceFk <=> OLD.provinceFk) + OR (NEW.postalCode <=> OLD.postalCode) THEN + + SET NEW.geoFk = address_getGeo(NEW.id); + END IF; END$$ DELIMITER ; diff --git a/db/routines/vn/triggers/client_beforeInsert.sql b/db/routines/vn/triggers/client_beforeInsert.sql index 45de107f1..b4038a2ba 100644 --- a/db/routines/vn/triggers/client_beforeInsert.sql +++ b/db/routines/vn/triggers/client_beforeInsert.sql @@ -3,8 +3,10 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`client_beforeInsert` BEFORE INSERT ON `client` FOR EACH ROW BEGIN - SET NEW.editorFk = account.myUser_getId(); + SET NEW.accountingAccount = 4300000000 + NEW.id; + SET NEW.lastSalesPersonFk = NEW.salesPersonFk; + SET NEW.geoFk = client_getGeo(NEW.id); IF (NEW.phone <> '') THEN CALL pbx.phone_isValid(NEW.phone); @@ -13,9 +15,5 @@ BEGIN IF (NEW.mobile <> '') THEN CALL pbx.phone_isValid(NEW.mobile); END IF; - - SET NEW.accountingAccount = 4300000000 + NEW.id; - - SET NEW.lastSalesPersonFk = NEW.salesPersonFk; END$$ DELIMITER ; diff --git a/db/routines/vn/triggers/client_beforeUpdate.sql b/db/routines/vn/triggers/client_beforeUpdate.sql index 7142d6604..00418a9e7 100644 --- a/db/routines/vn/triggers/client_beforeUpdate.sql +++ b/db/routines/vn/triggers/client_beforeUpdate.sql @@ -72,5 +72,11 @@ BEGIN IF NOT (NEW.businessTypeFk <=> OLD.businessTypeFk) AND (NEW.businessTypeFk = 'individual' OR OLD.businessTypeFk = 'individual') THEN SET NEW.isTaxDataChecked = 0; END IF; + + IF NOT (NEW.provinceFk <=> OLD.provinceFk) + OR (NEW.postcode <=> OLD.postcode) THEN + + SET NEW.geoFk = client_getGeo(NEW.id); + END IF; END$$ DELIMITER ; diff --git a/db/routines/vn/triggers/supplier_beforeInsert.sql b/db/routines/vn/triggers/supplier_beforeInsert.sql index b141ec8fb..5bbfc79a1 100644 --- a/db/routines/vn/triggers/supplier_beforeInsert.sql +++ b/db/routines/vn/triggers/supplier_beforeInsert.sql @@ -4,5 +4,6 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`supplier_beforeInsert` FOR EACH ROW BEGIN SET NEW.editorFk = account.myUser_getId(); + SET NEW.geoFk = supplier_getGeo(NEW.id); END$$ DELIMITER ; diff --git a/db/routines/vn/triggers/supplier_beforeUpdate.sql b/db/routines/vn/triggers/supplier_beforeUpdate.sql index af730b49d..10b63ee72 100644 --- a/db/routines/vn/triggers/supplier_beforeUpdate.sql +++ b/db/routines/vn/triggers/supplier_beforeUpdate.sql @@ -40,5 +40,10 @@ BEGIN SET NEW.isPayMethodChecked = FALSE; END IF; + IF NOT (NEW.provinceFk <=> OLD.provinceFk) + OR (NEW.postcode <=> OLD.postcode) THEN + + SET NEW.geoFk = client_getGeo(NEW.id); + END IF; END$$ DELIMITER ; diff --git a/db/versions/11346-yellowPhormium/02-supplier.sql b/db/versions/11346-yellowPhormium/02-supplier.sql index ef5e04a43..b3e25bd7e 100644 --- a/db/versions/11346-yellowPhormium/02-supplier.sql +++ b/db/versions/11346-yellowPhormium/02-supplier.sql @@ -8,13 +8,13 @@ ALTER TABLE vn.supplier CREATE OR REPLACE TEMPORARY TABLE tSupplierGeo (PRIMARY KEY (id)) ENGINE = MEMORY - SELECT sa.supplierFk id, p.geoFk - FROM supplierAddress sa - JOIN town t ON t.provinceFk = sa.provinceFk + SELECT s.id, p.geoFk + FROM supplier s + JOIN town t ON t.provinceFk = s.provinceFk JOIN postCode p ON p.townFk = t.id - AND p.`code` = sa.postalCode - GROUP BY sa.supplierFk - ORDER BY (sa.city SOUNDS LIKE t.`name`) DESC; + AND p.`code` = s.postCode + GROUP BY s.id + ORDER BY (s.city SOUNDS LIKE t.`name`) DESC; UPDATE supplier s JOIN tSupplierGeo tsg ON tsg.id = s.id From bde192966e00803c883aa7a418ae7431ea018775 Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 14 Nov 2024 09:30:36 +0100 Subject: [PATCH 13/38] feat: refs #8057 Added data updates --- db/routines/vn/triggers/supplier_beforeUpdate.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/routines/vn/triggers/supplier_beforeUpdate.sql b/db/routines/vn/triggers/supplier_beforeUpdate.sql index 10b63ee72..55c671185 100644 --- a/db/routines/vn/triggers/supplier_beforeUpdate.sql +++ b/db/routines/vn/triggers/supplier_beforeUpdate.sql @@ -43,7 +43,7 @@ BEGIN IF NOT (NEW.provinceFk <=> OLD.provinceFk) OR (NEW.postcode <=> OLD.postcode) THEN - SET NEW.geoFk = client_getGeo(NEW.id); + SET NEW.geoFk = supplier_getGeo(NEW.id); END IF; END$$ DELIMITER ; From b9397c527ddbaffc660b30005729bba3b6d44a3c Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 14 Nov 2024 09:32:02 +0100 Subject: [PATCH 14/38] feat: refs #8057 Added data updates --- db/routines/vn/triggers/supplier_beforeUpdate.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/routines/vn/triggers/supplier_beforeUpdate.sql b/db/routines/vn/triggers/supplier_beforeUpdate.sql index 55c671185..b502340a3 100644 --- a/db/routines/vn/triggers/supplier_beforeUpdate.sql +++ b/db/routines/vn/triggers/supplier_beforeUpdate.sql @@ -41,7 +41,7 @@ BEGIN END IF; IF NOT (NEW.provinceFk <=> OLD.provinceFk) - OR (NEW.postcode <=> OLD.postcode) THEN + OR (NEW.postCode <=> OLD.postCode) THEN SET NEW.geoFk = supplier_getGeo(NEW.id); END IF; From 9ac54f463a9a714e092f2da8006905f5c580e2cc Mon Sep 17 00:00:00 2001 From: pablone Date: Thu, 14 Nov 2024 15:48:11 +0100 Subject: [PATCH 15/38] fix: refs #7457 add with on select to reduce --- modules/order/back/methods/order/filter.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/order/back/methods/order/filter.js b/modules/order/back/methods/order/filter.js index eff2eecb6..307843d46 100644 --- a/modules/order/back/methods/order/filter.js +++ b/modules/order/back/methods/order/filter.js @@ -23,7 +23,6 @@ module.exports = Self => { arg: 'from', type: 'date', description: 'The from date', - required: true }, { arg: 'to', type: 'date', @@ -153,7 +152,12 @@ module.exports = Self => { CREATE OR REPLACE TEMPORARY TABLE tmp.filter (INDEX (id)) ENGINE = MEMORY - SELECT o.id, + WITH wOrderTicket AS( + SELECT orderFk, + ticketFk + FROM orderTicket + GROUP BY orderFk + )SELECT o.id, o.total, o.date_send landed, o.date_make created, From 7a4455d6d01d2fe4a3157f94889e4b928edc807c Mon Sep 17 00:00:00 2001 From: sergiodt Date: Fri, 15 Nov 2024 08:12:16 +0100 Subject: [PATCH 16/38] feat: refs #6869 refs#6869 itemShelving_get --- .../vn/procedures/itemShelving_get.sql | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 db/routines/vn/procedures/itemShelving_get.sql diff --git a/db/routines/vn/procedures/itemShelving_get.sql b/db/routines/vn/procedures/itemShelving_get.sql new file mode 100644 index 000000000..07384b721 --- /dev/null +++ b/db/routines/vn/procedures/itemShelving_get.sql @@ -0,0 +1,30 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelving_get`(IN vSelf VARCHAR(8)) +BEGIN +/** +* Lista artículos de itemshelving +* +* @param vSelf matrícula del carro +**/ + SELECT ish.itemFk item, + i.name, + i.longName, + i.size, + ish.visible, + ish.packing, + ish.grouping, + p.code, + ish.id, + s.priority, + ish.isChecked, + ic.url, + ish.available, + ish.buyFk + FROM itemShelving ish + JOIN item i ON i.id = ish.itemFk + JOIN shelving s ON vSelf = s.code COLLATE utf8_unicode_ci + LEFT JOIN parking p ON s.parkingFk = p.id + JOIN hedera.imageConfig ic + WHERE ish.shelvingFk COLLATE utf8_unicode_ci = vSelf; +END$$ +DELIMITER ; From 07318656b78ebde742ad48a9b36bff327a7755d8 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Fri, 15 Nov 2024 08:47:30 +0100 Subject: [PATCH 17/38] feat: refs #8135 refs#8135 updateTicketACL --- db/versions/11349-azureBamboo/00-firstScript.sql | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 db/versions/11349-azureBamboo/00-firstScript.sql diff --git a/db/versions/11349-azureBamboo/00-firstScript.sql b/db/versions/11349-azureBamboo/00-firstScript.sql new file mode 100644 index 000000000..09c919b79 --- /dev/null +++ b/db/versions/11349-azureBamboo/00-firstScript.sql @@ -0,0 +1,7 @@ + + +UPDATE salix.ACL + SET principalId = 'deliveryAssistant' +WHERE model = 'Ticket' + AND property = 'updateAttributes' + AND principalId = "delivery"; From c5f1b05671c6fefaa22df376af105589dd60b402 Mon Sep 17 00:00:00 2001 From: robert Date: Fri, 15 Nov 2024 11:32:20 +0100 Subject: [PATCH 18/38] feat: refs #8127 quitar esquemas --- db/routines/vn/functions/entry_getCommission.sql | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/db/routines/vn/functions/entry_getCommission.sql b/db/routines/vn/functions/entry_getCommission.sql index 898ac8521..a4afdabd4 100644 --- a/db/routines/vn/functions/entry_getCommission.sql +++ b/db/routines/vn/functions/entry_getCommission.sql @@ -25,18 +25,17 @@ BEGIN LIMIT 1; RETURN IFNULL(vCommission, 0); - ELSE SELECT e.id INTO vLastEntryFk - FROM vn.entry e - JOIN vn.travel tr ON tr.id = e.travelFk + FROM `entry` e + JOIN travel tr ON tr.id = e.travelFk WHERE e.supplierFk = vSupplierFk ORDER BY tr.landed DESC LIMIT 1; IF vLastEntryFk THEN SELECT commission INTO vCurrentCommission - FROM vn.entry + FROM `entry` WHERE id = vLastEntryFk; ELSE @@ -47,8 +46,6 @@ BEGIN END IF; RETURN vCurrentCommission; - END IF; - END$$ DELIMITER ; From 6ed521ae5ea9913f258240cbff344d0d70599711 Mon Sep 17 00:00:00 2001 From: Jon Date: Fri, 15 Nov 2024 13:10:19 +0100 Subject: [PATCH 19/38] fix: redirect to invoice-out summary from salix' descriptor --- modules/invoiceOut/front/index.js | 2 +- modules/invoiceOut/front/routes.json | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/modules/invoiceOut/front/index.js b/modules/invoiceOut/front/index.js index a5e51d439..6d58a0a45 100644 --- a/modules/invoiceOut/front/index.js +++ b/modules/invoiceOut/front/index.js @@ -1,7 +1,7 @@ export * from './module'; import './main'; -import './summary'; import './descriptor'; import './descriptor-popover'; import './descriptor-menu'; +import './summary'; diff --git a/modules/invoiceOut/front/routes.json b/modules/invoiceOut/front/routes.json index 7c7495cb9..eba34dbbb 100644 --- a/modules/invoiceOut/front/routes.json +++ b/modules/invoiceOut/front/routes.json @@ -34,6 +34,21 @@ "params": { "invoice-out": "$ctrl.invoiceOut" } + }, + { + "url": "/:id", + "state": "invoiceOut.card", + "abstract": true, + "component": "vn-invoice-out-card" + }, + { + "url": "/negative-bases", + "state": "invoiceOut.negative-bases", + "component": "vn-negative-bases", + "description": "Negative bases", + "acl": [ + "administrative" + ] } ] } From 4783cc23ac43ff999a1875368d8f3afcfce9125f Mon Sep 17 00:00:00 2001 From: Jon Date: Fri, 15 Nov 2024 14:22:19 +0100 Subject: [PATCH 20/38] refactor: deleted negative bases route due to not being used --- modules/invoiceOut/front/routes.json | 9 --------- 1 file changed, 9 deletions(-) diff --git a/modules/invoiceOut/front/routes.json b/modules/invoiceOut/front/routes.json index eba34dbbb..908df3972 100644 --- a/modules/invoiceOut/front/routes.json +++ b/modules/invoiceOut/front/routes.json @@ -40,15 +40,6 @@ "state": "invoiceOut.card", "abstract": true, "component": "vn-invoice-out-card" - }, - { - "url": "/negative-bases", - "state": "invoiceOut.negative-bases", - "component": "vn-negative-bases", - "description": "Negative bases", - "acl": [ - "administrative" - ] } ] } From 6c00efae895790e83d0541bf6212215c3c0b3e30 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Sun, 17 Nov 2024 17:57:54 +0100 Subject: [PATCH 21/38] feat: refs #7289 #7289 apply option 1 --- loopback/locale/en.json | 4 +++- loopback/locale/es.json | 6 ++++-- modules/ticket/back/methods/ticket/transferSales.js | 3 +++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 95f6ff326..86ebebc89 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -244,5 +244,7 @@ "Invalid or expired verification code": "Invalid or expired verification code", "There are tickets for this area, delete them first": "There are tickets for this area, delete them first", "ticketLostExpedition": "The ticket [{{ticketId}}]({{{ticketUrl}}}) has the following lost expedition:{{ expeditionId }}", - "Payment method is required": "Payment method is required" + "Payment method is required": "Payment method is required", + "Sales already moved": "Sales already moved" + } diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 37976c0ea..a68fcc4e4 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -387,5 +387,7 @@ "There are tickets for this area, delete them first": "Hay tickets para esta sección, borralos primero", "There is no company associated with that warehouse": "No hay ninguna empresa asociada a ese almacén", "ticketLostExpedition": "El ticket [{{ticketId}}]({{{ticketUrl}}}) tiene la siguiente expedición perdida:{{ expeditionId }}", - "The web user's email already exists": "El correo del usuario web ya existe" -} \ No newline at end of file + "The web user's email already exists": "El correo del usuario web ya existe", + "Sales already moved": "Ya han sido transferidas", + "Línea ya ha sido transferida": "Línea ya ha sido transferida" +} diff --git a/modules/ticket/back/methods/ticket/transferSales.js b/modules/ticket/back/methods/ticket/transferSales.js index 5f5fdde67..bc3c467d7 100644 --- a/modules/ticket/back/methods/ticket/transferSales.js +++ b/modules/ticket/back/methods/ticket/transferSales.js @@ -80,6 +80,9 @@ module.exports = Self => { const hasClaimedSales = await models.ClaimBeginning.findOne({where: {saleFk: {inq: saleIds}}}); if (ticketId != id && hasClaimedSales) throw new UserError(`Can't transfer claimed sales`); + const missingSales = sales.some(({id}) => !map.has(id)); + if (missingSales) + throw new UserError($t('Sales already moved')); for (const sale of sales) { const originalSale = map.get(sale.id); From 353ca659cd98d133632c5a0e90ef332d9d1438b7 Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 18 Nov 2024 08:58:38 +0100 Subject: [PATCH 22/38] feat: refs #8057 Requested changes --- db/routines/vn/functions/address_getGeo.sql | 5 +++-- db/routines/vn/functions/client_getGeo.sql | 4 ++-- db/routines/vn/functions/supplier_getGeo.sql | 6 ++++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/db/routines/vn/functions/address_getGeo.sql b/db/routines/vn/functions/address_getGeo.sql index 04155c30c..248e8c787 100644 --- a/db/routines/vn/functions/address_getGeo.sql +++ b/db/routines/vn/functions/address_getGeo.sql @@ -14,9 +14,10 @@ BEGIN SELECT p.geoFk INTO vGeoFk FROM address a JOIN town t ON t.provinceFk = a.provinceFk - JOIN postCode p ON p.townFk = t.id AND p.`code` = a.postalCode + JOIN postCode p ON p.townFk = t.id WHERE a.id = vSelf - ORDER BY (a.city SOUNDS LIKE t.`name`) DESC + ORDER BY (a.city SOUNDS LIKE t.name) DESC, + (p.code = a.postalCode) DESC LIMIT 1; RETURN vGeoFk; diff --git a/db/routines/vn/functions/client_getGeo.sql b/db/routines/vn/functions/client_getGeo.sql index 067eb84bc..624becf1e 100644 --- a/db/routines/vn/functions/client_getGeo.sql +++ b/db/routines/vn/functions/client_getGeo.sql @@ -15,9 +15,9 @@ BEGIN FROM client c JOIN town t ON t.provinceFk = c.provinceFk JOIN postCode p ON p.townFk = t.id - AND p.`code` = c.postcode WHERE c.id = vSelf - ORDER BY (c.city SOUNDS LIKE t.`name`) DESC + ORDER BY (c.city SOUNDS LIKE t.name) DESC, + (p.code = c.postcode) DESC LIMIT 1; RETURN vGeoFk; diff --git a/db/routines/vn/functions/supplier_getGeo.sql b/db/routines/vn/functions/supplier_getGeo.sql index 93115d712..29b6736f3 100644 --- a/db/routines/vn/functions/supplier_getGeo.sql +++ b/db/routines/vn/functions/supplier_getGeo.sql @@ -15,9 +15,11 @@ BEGIN FROM supplier s JOIN town t ON t.provinceFk = s.provinceFk JOIN postCode p ON p.townFk = t.id - AND p.`code` = s.postCode + LEFT JOIN supplierAddress sad ON sad.supplierFk = s.id WHERE s.id = vSelf - ORDER BY (s.city SOUNDS LIKE t.`name`) DESC + ORDER BY (s.city SOUNDS LIKE t.name) DESC, + (p.code = s.postCode) DESC, + (p.code = sad.postalCode) DESC LIMIT 1; RETURN vGeoFk; From 9558d030ff8baa3b1d2a81af61f5b5e692fc4199 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 18 Nov 2024 10:10:30 +0100 Subject: [PATCH 23/38] feat: refs #7289 #7289 remove bad translation --- loopback/locale/es.json | 3 +-- modules/ticket/back/methods/ticket/transferSales.js | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index a68fcc4e4..8bf9f31c4 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -388,6 +388,5 @@ "There is no company associated with that warehouse": "No hay ninguna empresa asociada a ese almacén", "ticketLostExpedition": "El ticket [{{ticketId}}]({{{ticketUrl}}}) tiene la siguiente expedición perdida:{{ expeditionId }}", "The web user's email already exists": "El correo del usuario web ya existe", - "Sales already moved": "Ya han sido transferidas", - "Línea ya ha sido transferida": "Línea ya ha sido transferida" + "Sales already moved": "Ya han sido transferidas" } diff --git a/modules/ticket/back/methods/ticket/transferSales.js b/modules/ticket/back/methods/ticket/transferSales.js index bc3c467d7..580a8e1f7 100644 --- a/modules/ticket/back/methods/ticket/transferSales.js +++ b/modules/ticket/back/methods/ticket/transferSales.js @@ -80,6 +80,7 @@ module.exports = Self => { const hasClaimedSales = await models.ClaimBeginning.findOne({where: {saleFk: {inq: saleIds}}}); if (ticketId != id && hasClaimedSales) throw new UserError(`Can't transfer claimed sales`); + const missingSales = sales.some(({id}) => !map.has(id)); if (missingSales) throw new UserError($t('Sales already moved')); From dd637b9333ea75f966f8efb8e1823bae39de960a Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 18 Nov 2024 10:34:23 +0100 Subject: [PATCH 24/38] fix: refs #6869 use id as primaryKey --- modules/shelving/back/models/shelving.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/shelving/back/models/shelving.json b/modules/shelving/back/models/shelving.json index f6df57d43..84e260b9e 100644 --- a/modules/shelving/back/models/shelving.json +++ b/modules/shelving/back/models/shelving.json @@ -48,8 +48,7 @@ "itemShelving": { "type": "hasMany", "model": "ItemShelving", - "foreignKey": "shelvingFk", - "primaryKey": "code" + "foreignKey": "shelvingFk" } } } \ No newline at end of file From a64f9b74ec9d6d69231d62caa7dfbfa642890764 Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 18 Nov 2024 10:52:41 +0100 Subject: [PATCH 25/38] feat: refs #8057 Requested changes --- db/versions/11346-yellowPhormium/00-address.sql | 4 ++-- db/versions/11346-yellowPhormium/01-client.sql | 4 ++-- db/versions/11346-yellowPhormium/02-supplier.sql | 6 ++++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/db/versions/11346-yellowPhormium/00-address.sql b/db/versions/11346-yellowPhormium/00-address.sql index 8e1315072..a8ee88b94 100644 --- a/db/versions/11346-yellowPhormium/00-address.sql +++ b/db/versions/11346-yellowPhormium/00-address.sql @@ -10,9 +10,9 @@ CREATE OR REPLACE TEMPORARY TABLE tAddressGeo FROM address a JOIN town t ON t.provinceFk = a.provinceFk JOIN postCode p ON p.townFk = t.id - AND p.`code` = a.postalCode GROUP BY a.id - ORDER BY (a.city SOUNDS LIKE t.`name`) DESC; + ORDER BY (a.city SOUNDS LIKE t.`name`) DESC, + (p.code = a.postalCode) DESC; UPDATE address a JOIN tAddressGeo tag ON tag.id = a.id diff --git a/db/versions/11346-yellowPhormium/01-client.sql b/db/versions/11346-yellowPhormium/01-client.sql index 932b28ef5..e1294c30e 100644 --- a/db/versions/11346-yellowPhormium/01-client.sql +++ b/db/versions/11346-yellowPhormium/01-client.sql @@ -13,9 +13,9 @@ CREATE OR REPLACE TEMPORARY TABLE tClientGeo FROM client c JOIN town t ON t.provinceFk = c.provinceFk JOIN postCode p ON p.townFk = t.id - AND p.`code` = c.postcode GROUP BY c.id - ORDER BY (c.city SOUNDS LIKE t.`name`) DESC; + ORDER BY (c.city SOUNDS LIKE t.`name`) DESC, + (p.code = c.postcode) DESC; UPDATE client c JOIN tClientGeo tcg ON tcg.id = c.id diff --git a/db/versions/11346-yellowPhormium/02-supplier.sql b/db/versions/11346-yellowPhormium/02-supplier.sql index b3e25bd7e..57cdefaea 100644 --- a/db/versions/11346-yellowPhormium/02-supplier.sql +++ b/db/versions/11346-yellowPhormium/02-supplier.sql @@ -12,9 +12,11 @@ CREATE OR REPLACE TEMPORARY TABLE tSupplierGeo FROM supplier s JOIN town t ON t.provinceFk = s.provinceFk JOIN postCode p ON p.townFk = t.id - AND p.`code` = s.postCode + LEFT JOIN supplierAddress sad ON sad.supplierFk = s.id GROUP BY s.id - ORDER BY (s.city SOUNDS LIKE t.`name`) DESC; + ORDER BY (s.city SOUNDS LIKE t.`name`) DESC, + (p.code = s.postCode) DESC, + (p.code = sad.postalCode) DESC; UPDATE supplier s JOIN tSupplierGeo tsg ON tsg.id = s.id From aed4bc89c7eb09f808778804fa5ee94d93909e0a Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 18 Nov 2024 12:53:36 +0100 Subject: [PATCH 26/38] feat: refs #8057 Fix version --- db/versions/11346-yellowPhormium/00-address.sql | 6 +++--- db/versions/11346-yellowPhormium/01-client.sql | 6 +++--- db/versions/11346-yellowPhormium/02-supplier.sql | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/db/versions/11346-yellowPhormium/00-address.sql b/db/versions/11346-yellowPhormium/00-address.sql index a8ee88b94..70683fc8f 100644 --- a/db/versions/11346-yellowPhormium/00-address.sql +++ b/db/versions/11346-yellowPhormium/00-address.sql @@ -3,7 +3,7 @@ ALTER TABLE vn.address ADD CONSTRAINT address_zoneGeo_FK FOREIGN KEY (geoFk) REFERENCES vn.zoneGeo(id) ON DELETE RESTRICT ON UPDATE CASCADE; -CREATE OR REPLACE TEMPORARY TABLE tAddressGeo +CREATE OR REPLACE TEMPORARY TABLE tmp.tAddressGeo (PRIMARY KEY (id)) ENGINE = MEMORY SELECT a.id, p.geoFk @@ -15,7 +15,7 @@ CREATE OR REPLACE TEMPORARY TABLE tAddressGeo (p.code = a.postalCode) DESC; UPDATE address a - JOIN tAddressGeo tag ON tag.id = a.id + JOIN tmp.tAddressGeo tag ON tag.id = a.id SET a.geoFk = tag.geoFk; -DROP TEMPORARY TABLE tAddressGeo; +DROP TEMPORARY TABLE tmp.tAddressGeo; diff --git a/db/versions/11346-yellowPhormium/01-client.sql b/db/versions/11346-yellowPhormium/01-client.sql index e1294c30e..a8bd16921 100644 --- a/db/versions/11346-yellowPhormium/01-client.sql +++ b/db/versions/11346-yellowPhormium/01-client.sql @@ -6,7 +6,7 @@ ALTER TABLE vn.client ADD CONSTRAINT client_zoneGeo_FK FOREIGN KEY (geoFk) REFERENCES vn.zoneGeo(id) ON DELETE RESTRICT ON UPDATE CASCADE; -CREATE OR REPLACE TEMPORARY TABLE tClientGeo +CREATE OR REPLACE TEMPORARY TABLE tmp.tClientGeo (PRIMARY KEY (id)) ENGINE = MEMORY SELECT c.id, p.geoFk @@ -18,7 +18,7 @@ CREATE OR REPLACE TEMPORARY TABLE tClientGeo (p.code = c.postcode) DESC; UPDATE client c - JOIN tClientGeo tcg ON tcg.id = c.id + JOIN tmp.tClientGeo tcg ON tcg.id = c.id SET c.geoFk = tcg.geoFk; -DROP TEMPORARY TABLE tClientGeo; +DROP TEMPORARY TABLE tmp.tClientGeo; diff --git a/db/versions/11346-yellowPhormium/02-supplier.sql b/db/versions/11346-yellowPhormium/02-supplier.sql index 57cdefaea..5f902d039 100644 --- a/db/versions/11346-yellowPhormium/02-supplier.sql +++ b/db/versions/11346-yellowPhormium/02-supplier.sql @@ -5,7 +5,7 @@ ALTER TABLE vn.supplier ADD CONSTRAINT supplier_zoneGeo_FK FOREIGN KEY (geoFk) REFERENCES vn.zoneGeo(id) ON DELETE RESTRICT ON UPDATE CASCADE; -CREATE OR REPLACE TEMPORARY TABLE tSupplierGeo +CREATE OR REPLACE TEMPORARY TABLE tmp.tSupplierGeo (PRIMARY KEY (id)) ENGINE = MEMORY SELECT s.id, p.geoFk @@ -19,7 +19,7 @@ CREATE OR REPLACE TEMPORARY TABLE tSupplierGeo (p.code = sad.postalCode) DESC; UPDATE supplier s - JOIN tSupplierGeo tsg ON tsg.id = s.id + JOIN tmp.tSupplierGeo tsg ON tsg.id = s.id SET s.geoFk = tsg.geoFk; -DROP TEMPORARY TABLE tSupplierGeo; +DROP TEMPORARY TABLE tmp.tSupplierGeo; From 2b770c020141d637de644d2e40251f9eefc54e19 Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 18 Nov 2024 12:56:37 +0100 Subject: [PATCH 27/38] feat: refs #8057 Fix version --- db/versions/11346-yellowPhormium/00-address.sql | 8 ++++---- db/versions/11346-yellowPhormium/01-client.sql | 8 ++++---- db/versions/11346-yellowPhormium/02-supplier.sql | 10 +++++----- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/db/versions/11346-yellowPhormium/00-address.sql b/db/versions/11346-yellowPhormium/00-address.sql index 70683fc8f..2f8033b0a 100644 --- a/db/versions/11346-yellowPhormium/00-address.sql +++ b/db/versions/11346-yellowPhormium/00-address.sql @@ -7,14 +7,14 @@ CREATE OR REPLACE TEMPORARY TABLE tmp.tAddressGeo (PRIMARY KEY (id)) ENGINE = MEMORY SELECT a.id, p.geoFk - FROM address a - JOIN town t ON t.provinceFk = a.provinceFk - JOIN postCode p ON p.townFk = t.id + FROM vn.address a + JOIN vn.town t ON t.provinceFk = a.provinceFk + JOIN vn.postCode p ON p.townFk = t.id GROUP BY a.id ORDER BY (a.city SOUNDS LIKE t.`name`) DESC, (p.code = a.postalCode) DESC; -UPDATE address a +UPDATE vn.address a JOIN tmp.tAddressGeo tag ON tag.id = a.id SET a.geoFk = tag.geoFk; diff --git a/db/versions/11346-yellowPhormium/01-client.sql b/db/versions/11346-yellowPhormium/01-client.sql index a8bd16921..855d873f9 100644 --- a/db/versions/11346-yellowPhormium/01-client.sql +++ b/db/versions/11346-yellowPhormium/01-client.sql @@ -10,14 +10,14 @@ CREATE OR REPLACE TEMPORARY TABLE tmp.tClientGeo (PRIMARY KEY (id)) ENGINE = MEMORY SELECT c.id, p.geoFk - FROM client c - JOIN town t ON t.provinceFk = c.provinceFk - JOIN postCode p ON p.townFk = t.id + FROM vn.client c + JOIN vn.town t ON t.provinceFk = c.provinceFk + JOIN vn.postCode p ON p.townFk = t.id GROUP BY c.id ORDER BY (c.city SOUNDS LIKE t.`name`) DESC, (p.code = c.postcode) DESC; -UPDATE client c +UPDATE vn.client c JOIN tmp.tClientGeo tcg ON tcg.id = c.id SET c.geoFk = tcg.geoFk; diff --git a/db/versions/11346-yellowPhormium/02-supplier.sql b/db/versions/11346-yellowPhormium/02-supplier.sql index 5f902d039..9a0cd5b42 100644 --- a/db/versions/11346-yellowPhormium/02-supplier.sql +++ b/db/versions/11346-yellowPhormium/02-supplier.sql @@ -9,16 +9,16 @@ CREATE OR REPLACE TEMPORARY TABLE tmp.tSupplierGeo (PRIMARY KEY (id)) ENGINE = MEMORY SELECT s.id, p.geoFk - FROM supplier s - JOIN town t ON t.provinceFk = s.provinceFk - JOIN postCode p ON p.townFk = t.id - LEFT JOIN supplierAddress sad ON sad.supplierFk = s.id + FROM vn.supplier s + JOIN vn.town t ON t.provinceFk = s.provinceFk + JOIN vn.postCode p ON p.townFk = t.id + LEFT JOIN vn.supplierAddress sad ON sad.supplierFk = s.id GROUP BY s.id ORDER BY (s.city SOUNDS LIKE t.`name`) DESC, (p.code = s.postCode) DESC, (p.code = sad.postalCode) DESC; -UPDATE supplier s +UPDATE vn.supplier s JOIN tmp.tSupplierGeo tsg ON tsg.id = s.id SET s.geoFk = tsg.geoFk; From cdcc5051d2ba4619f140e9938a55f59941bcf85a Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 18 Nov 2024 13:09:33 +0100 Subject: [PATCH 28/38] feat: refs #8057 Fix version --- db/routines/vn/functions/address_getGeo.sql | 1 + db/routines/vn/functions/client_getGeo.sql | 1 + db/routines/vn/functions/supplier_getGeo.sql | 1 + db/versions/11346-yellowPhormium/00-address.sql | 1 + db/versions/11346-yellowPhormium/01-client.sql | 1 + db/versions/11346-yellowPhormium/02-supplier.sql | 1 + 6 files changed, 6 insertions(+) diff --git a/db/routines/vn/functions/address_getGeo.sql b/db/routines/vn/functions/address_getGeo.sql index 248e8c787..0800d226a 100644 --- a/db/routines/vn/functions/address_getGeo.sql +++ b/db/routines/vn/functions/address_getGeo.sql @@ -15,6 +15,7 @@ BEGIN FROM address a JOIN town t ON t.provinceFk = a.provinceFk JOIN postCode p ON p.townFk = t.id + JOIN zoneGeo zg ON zg.id = p.geoFk WHERE a.id = vSelf ORDER BY (a.city SOUNDS LIKE t.name) DESC, (p.code = a.postalCode) DESC diff --git a/db/routines/vn/functions/client_getGeo.sql b/db/routines/vn/functions/client_getGeo.sql index 624becf1e..e16653ee5 100644 --- a/db/routines/vn/functions/client_getGeo.sql +++ b/db/routines/vn/functions/client_getGeo.sql @@ -15,6 +15,7 @@ BEGIN FROM client c JOIN town t ON t.provinceFk = c.provinceFk JOIN postCode p ON p.townFk = t.id + JOIN zoneGeo zg ON zg.id = p.geoFk WHERE c.id = vSelf ORDER BY (c.city SOUNDS LIKE t.name) DESC, (p.code = c.postcode) DESC diff --git a/db/routines/vn/functions/supplier_getGeo.sql b/db/routines/vn/functions/supplier_getGeo.sql index 29b6736f3..10ca5b8b8 100644 --- a/db/routines/vn/functions/supplier_getGeo.sql +++ b/db/routines/vn/functions/supplier_getGeo.sql @@ -16,6 +16,7 @@ BEGIN JOIN town t ON t.provinceFk = s.provinceFk JOIN postCode p ON p.townFk = t.id LEFT JOIN supplierAddress sad ON sad.supplierFk = s.id + JOIN zoneGeo zg ON zg.id = p.geoFk WHERE s.id = vSelf ORDER BY (s.city SOUNDS LIKE t.name) DESC, (p.code = s.postCode) DESC, diff --git a/db/versions/11346-yellowPhormium/00-address.sql b/db/versions/11346-yellowPhormium/00-address.sql index 2f8033b0a..6837e0d86 100644 --- a/db/versions/11346-yellowPhormium/00-address.sql +++ b/db/versions/11346-yellowPhormium/00-address.sql @@ -10,6 +10,7 @@ CREATE OR REPLACE TEMPORARY TABLE tmp.tAddressGeo FROM vn.address a JOIN vn.town t ON t.provinceFk = a.provinceFk JOIN vn.postCode p ON p.townFk = t.id + JOIN vn.zoneGeo zg ON zg.id = p.geoFk GROUP BY a.id ORDER BY (a.city SOUNDS LIKE t.`name`) DESC, (p.code = a.postalCode) DESC; diff --git a/db/versions/11346-yellowPhormium/01-client.sql b/db/versions/11346-yellowPhormium/01-client.sql index 855d873f9..a95d21efa 100644 --- a/db/versions/11346-yellowPhormium/01-client.sql +++ b/db/versions/11346-yellowPhormium/01-client.sql @@ -13,6 +13,7 @@ CREATE OR REPLACE TEMPORARY TABLE tmp.tClientGeo FROM vn.client c JOIN vn.town t ON t.provinceFk = c.provinceFk JOIN vn.postCode p ON p.townFk = t.id + JOIN vn.zoneGeo zg ON zg.id = p.geoFk GROUP BY c.id ORDER BY (c.city SOUNDS LIKE t.`name`) DESC, (p.code = c.postcode) DESC; diff --git a/db/versions/11346-yellowPhormium/02-supplier.sql b/db/versions/11346-yellowPhormium/02-supplier.sql index 9a0cd5b42..a28e7d680 100644 --- a/db/versions/11346-yellowPhormium/02-supplier.sql +++ b/db/versions/11346-yellowPhormium/02-supplier.sql @@ -13,6 +13,7 @@ CREATE OR REPLACE TEMPORARY TABLE tmp.tSupplierGeo JOIN vn.town t ON t.provinceFk = s.provinceFk JOIN vn.postCode p ON p.townFk = t.id LEFT JOIN vn.supplierAddress sad ON sad.supplierFk = s.id + JOIN vn.zoneGeo zg ON zg.id = p.geoFk GROUP BY s.id ORDER BY (s.city SOUNDS LIKE t.`name`) DESC, (p.code = s.postCode) DESC, From 8d4769d74d45e4f0ec430c0273479cddea173c2e Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 18 Nov 2024 13:34:20 +0100 Subject: [PATCH 29/38] feat: refs #8057 More precision in getGeo --- db/routines/vn/functions/address_getGeo.sql | 1 + db/routines/vn/functions/client_getGeo.sql | 1 + db/routines/vn/functions/supplier_getGeo.sql | 1 + db/versions/11346-yellowPhormium/00-address.sql | 1 + db/versions/11346-yellowPhormium/01-client.sql | 1 + db/versions/11346-yellowPhormium/02-supplier.sql | 1 + 6 files changed, 6 insertions(+) diff --git a/db/routines/vn/functions/address_getGeo.sql b/db/routines/vn/functions/address_getGeo.sql index 0800d226a..213eb91c3 100644 --- a/db/routines/vn/functions/address_getGeo.sql +++ b/db/routines/vn/functions/address_getGeo.sql @@ -15,6 +15,7 @@ BEGIN FROM address a JOIN town t ON t.provinceFk = a.provinceFk JOIN postCode p ON p.townFk = t.id + AND (p.code = a.postalCode OR a.postalCode IS NULL) JOIN zoneGeo zg ON zg.id = p.geoFk WHERE a.id = vSelf ORDER BY (a.city SOUNDS LIKE t.name) DESC, diff --git a/db/routines/vn/functions/client_getGeo.sql b/db/routines/vn/functions/client_getGeo.sql index e16653ee5..9c2e3212e 100644 --- a/db/routines/vn/functions/client_getGeo.sql +++ b/db/routines/vn/functions/client_getGeo.sql @@ -15,6 +15,7 @@ BEGIN FROM client c JOIN town t ON t.provinceFk = c.provinceFk JOIN postCode p ON p.townFk = t.id + AND (p.code = c.postcode OR c.postcode IS NULL) JOIN zoneGeo zg ON zg.id = p.geoFk WHERE c.id = vSelf ORDER BY (c.city SOUNDS LIKE t.name) DESC, diff --git a/db/routines/vn/functions/supplier_getGeo.sql b/db/routines/vn/functions/supplier_getGeo.sql index 10ca5b8b8..86984272c 100644 --- a/db/routines/vn/functions/supplier_getGeo.sql +++ b/db/routines/vn/functions/supplier_getGeo.sql @@ -15,6 +15,7 @@ BEGIN FROM supplier s JOIN town t ON t.provinceFk = s.provinceFk JOIN postCode p ON p.townFk = t.id + AND (p.code = s.postCode OR s.postCode IS NULL) LEFT JOIN supplierAddress sad ON sad.supplierFk = s.id JOIN zoneGeo zg ON zg.id = p.geoFk WHERE s.id = vSelf diff --git a/db/versions/11346-yellowPhormium/00-address.sql b/db/versions/11346-yellowPhormium/00-address.sql index 6837e0d86..f91d0ae9f 100644 --- a/db/versions/11346-yellowPhormium/00-address.sql +++ b/db/versions/11346-yellowPhormium/00-address.sql @@ -10,6 +10,7 @@ CREATE OR REPLACE TEMPORARY TABLE tmp.tAddressGeo FROM vn.address a JOIN vn.town t ON t.provinceFk = a.provinceFk JOIN vn.postCode p ON p.townFk = t.id + AND (p.code = a.postalCode OR a.postalCode IS NULL) JOIN vn.zoneGeo zg ON zg.id = p.geoFk GROUP BY a.id ORDER BY (a.city SOUNDS LIKE t.`name`) DESC, diff --git a/db/versions/11346-yellowPhormium/01-client.sql b/db/versions/11346-yellowPhormium/01-client.sql index a95d21efa..cb6fe41e8 100644 --- a/db/versions/11346-yellowPhormium/01-client.sql +++ b/db/versions/11346-yellowPhormium/01-client.sql @@ -13,6 +13,7 @@ CREATE OR REPLACE TEMPORARY TABLE tmp.tClientGeo FROM vn.client c JOIN vn.town t ON t.provinceFk = c.provinceFk JOIN vn.postCode p ON p.townFk = t.id + AND (p.code = c.postcode OR c.postcode IS NULL) JOIN vn.zoneGeo zg ON zg.id = p.geoFk GROUP BY c.id ORDER BY (c.city SOUNDS LIKE t.`name`) DESC, diff --git a/db/versions/11346-yellowPhormium/02-supplier.sql b/db/versions/11346-yellowPhormium/02-supplier.sql index a28e7d680..4e866525e 100644 --- a/db/versions/11346-yellowPhormium/02-supplier.sql +++ b/db/versions/11346-yellowPhormium/02-supplier.sql @@ -12,6 +12,7 @@ CREATE OR REPLACE TEMPORARY TABLE tmp.tSupplierGeo FROM vn.supplier s JOIN vn.town t ON t.provinceFk = s.provinceFk JOIN vn.postCode p ON p.townFk = t.id + AND (p.code = s.postCode OR s.postCode IS NULL) LEFT JOIN vn.supplierAddress sad ON sad.supplierFk = s.id JOIN vn.zoneGeo zg ON zg.id = p.geoFk GROUP BY s.id From 6619ec451c4a7dc98aa7a3adab4014dd00e9b0c1 Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 18 Nov 2024 13:46:56 +0100 Subject: [PATCH 30/38] fix: getSales --- modules/ticket/back/methods/ticket/getSales.js | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/ticket/back/methods/ticket/getSales.js b/modules/ticket/back/methods/ticket/getSales.js index e721d90ae..5b2288d31 100644 --- a/modules/ticket/back/methods/ticket/getSales.js +++ b/modules/ticket/back/methods/ticket/getSales.js @@ -37,6 +37,7 @@ module.exports = Self => { 'name', 'subName', 'itemPackingTypeFk', + 'size', 'tag5', 'value5', 'tag6', From 33d9ba9b44117c1dde72c64449b340a011370371 Mon Sep 17 00:00:00 2001 From: pablone Date: Tue, 19 Nov 2024 06:21:00 +0100 Subject: [PATCH 31/38] fix: refs #7404 negative quantity --- db/routines/vn/procedures/stockBought_calculate.sql | 2 +- .../back/methods/stock-bought/getStockBoughtDetail.js | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/db/routines/vn/procedures/stockBought_calculate.sql b/db/routines/vn/procedures/stockBought_calculate.sql index c3b5a0dc6..c248d0deb 100644 --- a/db/routines/vn/procedures/stockBought_calculate.sql +++ b/db/routines/vn/procedures/stockBought_calculate.sql @@ -80,7 +80,7 @@ proc: BEGIN UPDATE stockBought s JOIN tStockSold ts ON ts.workerFk = s.workerFk - SET s.bought = IF(s.bought < ts.sold, ROUND(s.bought - ts.sold, 1), 0) + SET s.bought = IF(s.bought < ABS(ts.sold), 0, ROUND(s.bought - ABS(ts.sold), 1)) WHERE s.dated = vDated; DROP TEMPORARY TABLE tCurrentData, tmp.item, tmp.buyUltimate, tStockSold; diff --git a/modules/entry/back/methods/stock-bought/getStockBoughtDetail.js b/modules/entry/back/methods/stock-bought/getStockBoughtDetail.js index 60b099682..723e04cb9 100644 --- a/modules/entry/back/methods/stock-bought/getStockBoughtDetail.js +++ b/modules/entry/back/methods/stock-bought/getStockBoughtDetail.js @@ -50,8 +50,11 @@ module.exports = Self => { i.id itemFk, i.name itemName, ti.quantity, - ROUND((ac.conversionCoefficient * (ti.quantity / b.packing) * buy_getVolume(b.id)) - / (vc.trolleyM3 * 1000000),1) volume, + ROUND((ac.conversionCoefficient * + (ti.quantity / b.packing) * + buy_getVolume(b.id) + ) / (vc.trolleyM3 * 1000000), + 2) volume, b.packagingFk packagingFk, b.packing FROM tmp.item ti From 413e9e1e9f02ae2ac0b9b01c00231f5c63f9462c Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 19 Nov 2024 07:59:27 +0100 Subject: [PATCH 33/38] build: refs #8144 change package version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 767ec231e..d36360498 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-back", - "version": "24.44.0", + "version": "24.48.0", "author": "Verdnatura Levante SL", "description": "Salix backend", "license": "GPL-3.0", From 6a65ab42cedd640cec468282173443879739f907 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 19 Nov 2024 09:12:42 +0100 Subject: [PATCH 34/38] build: change package version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d36360498..ef1dd8f89 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-back", - "version": "24.48.0", + "version": "24.50.0", "author": "Verdnatura Levante SL", "description": "Salix backend", "license": "GPL-3.0", From 7b5e474d241d074e666081f1134e592ffb9d70e8 Mon Sep 17 00:00:00 2001 From: robert Date: Tue, 19 Nov 2024 11:15:57 +0100 Subject: [PATCH 35/38] feat: refs #8211 route_afterUpdate --- db/routines/vn/triggers/route_afterUpdate.sql | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/db/routines/vn/triggers/route_afterUpdate.sql b/db/routines/vn/triggers/route_afterUpdate.sql index ec205090e..447608acc 100644 --- a/db/routines/vn/triggers/route_afterUpdate.sql +++ b/db/routines/vn/triggers/route_afterUpdate.sql @@ -2,18 +2,18 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`route_afterUpdate` AFTER UPDATE ON `route` FOR EACH ROW -BEGIN +BEGIN IF IFNULL(NEW.gestdocFk,0) <> IFNULL(OLD.gestdocFk,0) AND NEW.gestdocFk > 0 THEN -- JGF 09/09/14 cuando se añade un gestdoc a una ruta, se le asigna automagicamente a todos sus Tickets - + -- Inserta el gestdoc en todos los tickets de la ruta INSERT INTO ticketDms(ticketFk,dmsFk) SELECT id, NEW.gestdocFk FROM ticket WHERE routeFk = NEW.id ON DUPLICATE KEY UPDATE dmsFk = NEW.gestdocFk; - -- Update del firmado - UPDATE ticket t - JOIN ticketDms tg ON t.id = tg.ticketFk + -- Update del firmado + UPDATE ticket t + JOIN ticketDms tg ON t.id = tg.ticketFk SET isSigned = 1 WHERE t.routeFk = NEW.id; END IF; @@ -21,7 +21,8 @@ BEGIN OR !(NEW.kmEnd <=> OLD.kmEnd) OR !(NEW.workerFk <=> OLD.workerFk) OR !(NEW.m3 <=> OLD.m3) - OR !(NEW.agencyModeFk <=> OLD.agencyModeFk)THEN + OR !(NEW.agencyModeFk <=> OLD.agencyModeFk) + OR !(NEW.vehicleFk <=> OLD.vehicleFk)THEN CALL route_calcCommission(NEW.id); END IF; From d21b42a5670cb092616c814943f01ab54edcaeb6 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Tue, 19 Nov 2024 11:24:00 +0100 Subject: [PATCH 36/38] feat: refs #8099 refs#8099 addComplmentSalary --- db/dump/fixtures.before.sql | 4 ++ .../11353-wheatCymbidium/00-firstScript.sql | 9 +++++ modules/route/back/model-config.json | 8 +++- modules/route/back/models/routeAction.json | 30 +++++++++++++++ .../route/back/models/routeComplement.json | 37 +++++++++++++++++++ 5 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 db/versions/11353-wheatCymbidium/00-firstScript.sql create mode 100644 modules/route/back/models/routeAction.json create mode 100644 modules/route/back/models/routeComplement.json diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index eb376b6c6..48e886ac9 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -4008,6 +4008,10 @@ INSERT IGNORE INTO pbx.queueMember UPDATE vn.department SET pbxQueue = '1000' WHERE name = "CAMARA"; UPDATE vn.department SET pbxQueue = '2000' WHERE name = "VENTAS"; +INSERT INTO vn.routeAction (id, name, price, isMainlineDelivered) VALUES(1, 'Pintar traje', 50.00, 0); +INSERT INTO vn.routeComplement (id, dated, workerFk, price, routeActionFk) VALUES(1, util.VN_CURDATE(), 9, 50.00, 1); + + INSERT INTO srt.buffer (id, x, y, `size`, `length`, stateFk, typeFk, isActive, code, stratus, hasWorkerWaiting, reserve, routeFk, dayMinute, lastUnloaded, hasStrapper, typeDefaultFk, motors, editorFk) VALUES (0, 0, 0, 0, NULL, 3, 1, 0, 'ENT', 0, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL), (1, 0, 9900, 0, NULL, 1, 0, 0, 'NOK', 0, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL), diff --git a/db/versions/11353-wheatCymbidium/00-firstScript.sql b/db/versions/11353-wheatCymbidium/00-firstScript.sql new file mode 100644 index 000000000..f29ae2f0e --- /dev/null +++ b/db/versions/11353-wheatCymbidium/00-firstScript.sql @@ -0,0 +1,9 @@ + + +USE vn; + +INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId) +VALUES('RouteAction', '*', 'READ', 'ALLOW', 'ROLE', 'delivery'); + +INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId) +VALUES('RouteComplement', '*', '*', 'ALLOW', 'ROLE', 'delivery'); diff --git a/modules/route/back/model-config.json b/modules/route/back/model-config.json index be5aa07ca..fb1c5d7fd 100644 --- a/modules/route/back/model-config.json +++ b/modules/route/back/model-config.json @@ -23,6 +23,12 @@ "Route": { "dataSource": "vn" }, + "RouteAction": { + "dataSource": "vn" + }, + "RouteComplement": { + "dataSource": "vn" + }, "RouteLog": { "dataSource": "vn" }, @@ -32,4 +38,4 @@ "RoutesMonitor": { "dataSource": "vn" } -} +} \ No newline at end of file diff --git a/modules/route/back/models/routeAction.json b/modules/route/back/models/routeAction.json new file mode 100644 index 000000000..88f7a8226 --- /dev/null +++ b/modules/route/back/models/routeAction.json @@ -0,0 +1,30 @@ +{ + "name": "RouteAction", + "base": "VnModel", + "mixins": { + "Loggable": true + }, + "options": { + "mysql": { + "table": "routeAction" + } + }, + "properties": { + "id": { + "type": "number", + "id": true, + "description": "Identifier" + }, + "name": { + "type": "string", + "required": true + }, + "price": { + "type": "number" + }, + "isMainlineDelivered": { + "type": "boolean", + "required": true + } + } +} \ No newline at end of file diff --git a/modules/route/back/models/routeComplement.json b/modules/route/back/models/routeComplement.json new file mode 100644 index 000000000..e2086f78d --- /dev/null +++ b/modules/route/back/models/routeComplement.json @@ -0,0 +1,37 @@ +{ + "name": "RouteComplement", + "base": "VnModel", + "mixins": { + "Loggable": true + }, + "options": { + "mysql": { + "table": "routeComplement" + } + }, + "properties": { + "id": { + "type": "number", + "id": true, + "description": "Identifier" + }, + "dated": { + "type": "date" + }, + "price": { + "type": "number" + } + }, + "relations": { + "worker": { + "type": "belongsTo", + "model": "Worker", + "foreignKey": "workerFk" + }, + "routeAction": { + "type": "belongsTo", + "model": "RouteAction", + "foreignKey": "routeActionFk" + } + } +} \ No newline at end of file From feb11c123e50c3896c5b1bec0e860d0be5af8963 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Tue, 19 Nov 2024 11:45:40 +0100 Subject: [PATCH 37/38] feat: refs #8099 refs#8099 addComplmentSalary --- db/versions/11353-wheatCymbidium/00-firstScript.sql | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/db/versions/11353-wheatCymbidium/00-firstScript.sql b/db/versions/11353-wheatCymbidium/00-firstScript.sql index f29ae2f0e..557ffab9e 100644 --- a/db/versions/11353-wheatCymbidium/00-firstScript.sql +++ b/db/versions/11353-wheatCymbidium/00-firstScript.sql @@ -3,7 +3,13 @@ USE vn; INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId) -VALUES('RouteAction', '*', 'READ', 'ALLOW', 'ROLE', 'delivery'); +VALUES('RouteAction', 'find', 'READ', 'ALLOW', 'ROLE', 'delivery'); INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId) -VALUES('RouteComplement', '*', '*', 'ALLOW', 'ROLE', 'delivery'); +VALUES('RouteComplement', 'find', 'READ', 'ALLOW', 'ROLE', 'delivery'); + +INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId) +VALUES('RouteComplement', 'create', 'WRITE', 'ALLOW', 'ROLE', 'delivery'); + +INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId) +VALUES('RouteComplement', 'deleteById', 'WRITE', 'ALLOW', 'ROLE', 'delivery'); \ No newline at end of file From f89080d3735cee92827131211224de7b36e728f1 Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 19 Nov 2024 11:53:12 +0100 Subject: [PATCH 38/38] fix: refs #7323 add remaining fields --- modules/worker/back/models/worker.json | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/worker/back/models/worker.json b/modules/worker/back/models/worker.json index 937df98c0..5c3b95fe6 100644 --- a/modules/worker/back/models/worker.json +++ b/modules/worker/back/models/worker.json @@ -301,7 +301,19 @@ "birth", "educationLevelFk", "originCountryFk", - "maritalStatus" + "maritalStatus", + "SSN" + ], + "include": [ + { + "relation": "client", + "scope": { + "fields": [ + "id", + "phone" + ] + } + } ] } }