From 2efd1945f882bd21cc509beb4d4f74a212e05f94 Mon Sep 17 00:00:00 2001 From: pablone Date: Thu, 4 Apr 2024 07:27:27 +0200 Subject: [PATCH 01/13] feat: refs #4988 add agency --- modules/zone/back/models/agency.json | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/modules/zone/back/models/agency.json b/modules/zone/back/models/agency.json index be262b670..18b315d9a 100644 --- a/modules/zone/back/models/agency.json +++ b/modules/zone/back/models/agency.json @@ -15,6 +15,22 @@ "name": { "type": "string", "required": false + }, + "warehouseFk": { + "type": "number", + "required": false + }, + "isOwn": { + "type": "boolean", + "required": false + }, + "workCenterFk": { + "type": "number", + "required": false + }, + "isAnyVolumeAllowed": { + "type": "boolean", + "required": false } }, "relations": { @@ -22,6 +38,16 @@ "type": "hasOne", "model": "SupplierAgencyTerm", "foreignKey": "agencyFk" - } + }, + "warehouse": { + "type": "belongsTo", + "model": "Warehouse", + "foreignKey": "warehouseFk" + }, + "workCenter": { + "type": "belongsTo", + "model": "WorkCenter", + "foreignKey": "workCenterFk" + } } } -- 2.40.1 From 336c3274ea40cb9c536b157684b0608b8bcfa5ab Mon Sep 17 00:00:00 2001 From: pablone Date: Tue, 16 Apr 2024 07:38:48 +0200 Subject: [PATCH 02/13] feat(agency): refs #4988 add summary --- back/models/agency-log.json | 9 ++++++++ .../vn/triggers/agency_afterInsert.sql | 1 + .../10995-navyErica/00-firstScript.sql | 2 ++ .../10995-navyErica/01-agencyLogCreate.sql | 23 +++++++++++++++++++ 4 files changed, 35 insertions(+) create mode 100644 back/models/agency-log.json create mode 100644 db/versions/10995-navyErica/00-firstScript.sql create mode 100644 db/versions/10995-navyErica/01-agencyLogCreate.sql diff --git a/back/models/agency-log.json b/back/models/agency-log.json new file mode 100644 index 000000000..04b0b2995 --- /dev/null +++ b/back/models/agency-log.json @@ -0,0 +1,9 @@ +{ + "name": "AgencyLog", + "base": "Log", + "options": { + "mysql": { + "table": "agencyLog" + } + } +} diff --git a/db/routines/vn/triggers/agency_afterInsert.sql b/db/routines/vn/triggers/agency_afterInsert.sql index 35670538b..cdd6401cd 100644 --- a/db/routines/vn/triggers/agency_afterInsert.sql +++ b/db/routines/vn/triggers/agency_afterInsert.sql @@ -3,6 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`agency_afterInsert` AFTER INSERT ON `agency` FOR EACH ROW BEGIN + SET NEW.editorFk = account.myUser_getId(); INSERT INTO agencyMode(name,agencyFk) VALUES(NEW.name,NEW.id); END$$ DELIMITER ; diff --git a/db/versions/10995-navyErica/00-firstScript.sql b/db/versions/10995-navyErica/00-firstScript.sql new file mode 100644 index 000000000..15fcaeef6 --- /dev/null +++ b/db/versions/10995-navyErica/00-firstScript.sql @@ -0,0 +1,2 @@ +-- Place your SQL code here +INSERT INTO salix.ACL (id, model, property, accessType, permission, principalType, principalId) VALUES(826, 'Agency', '*', 'READ', 'ALLOW', 'ROLE', 'employee'); \ No newline at end of file diff --git a/db/versions/10995-navyErica/01-agencyLogCreate.sql b/db/versions/10995-navyErica/01-agencyLogCreate.sql new file mode 100644 index 000000000..ec0ae0bdd --- /dev/null +++ b/db/versions/10995-navyErica/01-agencyLogCreate.sql @@ -0,0 +1,23 @@ +-- vn.agencyLog definition +ALTER TABLE vn.agency ADD IF NOT EXISTS editorFk int(10) unsigned DEFAULT NULL NULL; + + +CREATE TABLE IF NOT EXISTS `agencyLog` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `originFk` int(11) DEFAULT NULL, + `userFk` int(10) unsigned DEFAULT NULL, + `action` set('insert','update','delete','select') NOT NULL, + `creationDate` timestamp NULL DEFAULT current_timestamp(), + `description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `changedModel` enum('agency','agencyMode') NOT NULL DEFAULT 'agency', + `oldInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`oldInstance`)), + `newInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`newInstance`)), + `changedModelId` int(11) NOT NULL, + `changedModelValue` varchar(45) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `logAgencyUserFk` (`userFk`), + KEY `agencyLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), + KEY `agencyLog_originFk` (`originFk`,`creationDate`), + CONSTRAINT `agencyOriginFk` FOREIGN KEY (`agency`) REFERENCES `agency` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `agencyUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; \ No newline at end of file -- 2.40.1 From d0dfdc668b313dea77ba828947f8d43f21659c90 Mon Sep 17 00:00:00 2001 From: pablone Date: Tue, 16 Apr 2024 16:25:27 +0200 Subject: [PATCH 03/13] feat(agency): refs #4988 add new agency --- back/model-config.json | 3 +++ db/routines/vn/triggers/agency_afterInsert.sql | 1 - db/routines/vn/triggers/agency_beforeInsert.sql | 8 ++++++++ db/versions/10995-navyErica/00-firstScript.sql | 5 ++++- db/versions/10995-navyErica/01-agencyLogCreate.sql | 10 +++++----- 5 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 db/routines/vn/triggers/agency_beforeInsert.sql diff --git a/back/model-config.json b/back/model-config.json index ebcdb7bce..739a7965a 100644 --- a/back/model-config.json +++ b/back/model-config.json @@ -177,5 +177,8 @@ }, "ProductionConfig": { "dataSource": "vn" + }, + "AgencyLog": { + "dataSource": "vn" } } \ No newline at end of file diff --git a/db/routines/vn/triggers/agency_afterInsert.sql b/db/routines/vn/triggers/agency_afterInsert.sql index cdd6401cd..35670538b 100644 --- a/db/routines/vn/triggers/agency_afterInsert.sql +++ b/db/routines/vn/triggers/agency_afterInsert.sql @@ -3,7 +3,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`agency_afterInsert` AFTER INSERT ON `agency` FOR EACH ROW BEGIN - SET NEW.editorFk = account.myUser_getId(); INSERT INTO agencyMode(name,agencyFk) VALUES(NEW.name,NEW.id); END$$ DELIMITER ; diff --git a/db/routines/vn/triggers/agency_beforeInsert.sql b/db/routines/vn/triggers/agency_beforeInsert.sql new file mode 100644 index 000000000..8ff3958e1 --- /dev/null +++ b/db/routines/vn/triggers/agency_beforeInsert.sql @@ -0,0 +1,8 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`agency_beforeInsert` + BEFORE INSERT ON `agency` + FOR EACH ROW +BEGIN + SET NEW.editorFk = account.myUser_getId(); +END$$ +DELIMITER ; diff --git a/db/versions/10995-navyErica/00-firstScript.sql b/db/versions/10995-navyErica/00-firstScript.sql index 15fcaeef6..104d1c322 100644 --- a/db/versions/10995-navyErica/00-firstScript.sql +++ b/db/versions/10995-navyErica/00-firstScript.sql @@ -1,2 +1,5 @@ -- Place your SQL code here -INSERT INTO salix.ACL (id, model, property, accessType, permission, principalType, principalId) VALUES(826, 'Agency', '*', 'READ', 'ALLOW', 'ROLE', 'employee'); \ No newline at end of file +INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId) + VALUES('Agency', '*', 'READ', 'ALLOW', 'ROLE', 'employee'); +INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) + VALUES ('AgencyLog','*','READ','ALLOW','ROLE','employee'); diff --git a/db/versions/10995-navyErica/01-agencyLogCreate.sql b/db/versions/10995-navyErica/01-agencyLogCreate.sql index ec0ae0bdd..bfb1f83a8 100644 --- a/db/versions/10995-navyErica/01-agencyLogCreate.sql +++ b/db/versions/10995-navyErica/01-agencyLogCreate.sql @@ -2,9 +2,9 @@ ALTER TABLE vn.agency ADD IF NOT EXISTS editorFk int(10) unsigned DEFAULT NULL NULL; -CREATE TABLE IF NOT EXISTS `agencyLog` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `originFk` int(11) DEFAULT NULL, +CREATE TABLE IF NOT EXISTS `vn`.`agencyLog` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `originFk` smallint(5) unsigned DEFAULT NULL, `userFk` int(10) unsigned DEFAULT NULL, `action` set('insert','update','delete','select') NOT NULL, `creationDate` timestamp NULL DEFAULT current_timestamp(), @@ -18,6 +18,6 @@ CREATE TABLE IF NOT EXISTS `agencyLog` ( KEY `logAgencyUserFk` (`userFk`), KEY `agencyLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), KEY `agencyLog_originFk` (`originFk`,`creationDate`), - CONSTRAINT `agencyOriginFk` FOREIGN KEY (`agency`) REFERENCES `agency` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `agencyOriginFk` FOREIGN KEY (`originFk`) REFERENCES `agency` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `agencyUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; \ No newline at end of file +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; \ No newline at end of file -- 2.40.1 From 77f7348acbb25862b27e8f0c6d217c891be49ed7 Mon Sep 17 00:00:00 2001 From: pablone Date: Thu, 18 Apr 2024 09:02:01 +0200 Subject: [PATCH 04/13] feat(workcenter): refs #4988 add workcenter config menu --- back/model-config.json | 3 ++ back/models/agency-workCenter.json | 36 +++++++++++++++++++ .../10995-navyErica/00-firstScript.sql | 4 +++ .../10995-navyErica/02-createTable.sql | 17 +++++++++ 4 files changed, 60 insertions(+) create mode 100644 back/models/agency-workCenter.json create mode 100644 db/versions/10995-navyErica/02-createTable.sql diff --git a/back/model-config.json b/back/model-config.json index 739a7965a..db43f89b2 100644 --- a/back/model-config.json +++ b/back/model-config.json @@ -180,5 +180,8 @@ }, "AgencyLog": { "dataSource": "vn" + }, + "AgencyWorkCenter": { + "dataSource": "vn" } } \ No newline at end of file diff --git a/back/models/agency-workCenter.json b/back/models/agency-workCenter.json new file mode 100644 index 000000000..cd1b295b4 --- /dev/null +++ b/back/models/agency-workCenter.json @@ -0,0 +1,36 @@ +{ + "name": "AgencyWorkCenter", + "base": "VnModel", + "options": { + "mysql": { + "table": "agencyWorkCenter" + } + }, + "properties": { + "id": { + "id": true, + "type": "number", + "forceId": false + }, + "agencyFk": { + "type": "number", + "required": false + }, + "workCenterFk": { + "type": "number", + "required": false + } + }, + "relations": { + "agency": { + "type": "belongsTo", + "model": "WorkCenter", + "foreignKey": "agencyFk" + }, + "workCenter": { + "type": "belongsTo", + "model": "WorkCenter", + "foreignKey": "workCenterFk" + } + } +} diff --git a/db/versions/10995-navyErica/00-firstScript.sql b/db/versions/10995-navyErica/00-firstScript.sql index 104d1c322..1b692301e 100644 --- a/db/versions/10995-navyErica/00-firstScript.sql +++ b/db/versions/10995-navyErica/00-firstScript.sql @@ -3,3 +3,7 @@ INSERT INTO salix.ACL (model, property, accessType, permission, principalType, p VALUES('Agency', '*', 'READ', 'ALLOW', 'ROLE', 'employee'); INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) VALUES ('AgencyLog','*','READ','ALLOW','ROLE','employee'); + +INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) + VALUES ('Agency','*','WRITE','ALLOW','ROLE','deliveryAssistant'); + diff --git a/db/versions/10995-navyErica/02-createTable.sql b/db/versions/10995-navyErica/02-createTable.sql new file mode 100644 index 000000000..063e210fb --- /dev/null +++ b/db/versions/10995-navyErica/02-createTable.sql @@ -0,0 +1,17 @@ +CREATE TABLE IF NOT EXISTS vn.agencyWorkCenter ( + id INT UNSIGNED auto_increment NOT NULL, + agencyFk smallint(5) unsigned NULL, + workCenterFk int(11) NULL, + CONSTRAINT agencyWorkCenter_pk PRIMARY KEY (id), + CONSTRAINT agencyWorkCenter_agency_FK FOREIGN KEY (agencyFk) REFERENCES vn.agency(id) ON DELETE CASCADE, + CONSTRAINT agencyWorkCenter_workCenter_FK FOREIGN KEY (workCenterFk) REFERENCES vn.workCenter(id) +) +ENGINE=InnoDB +DEFAULT CHARSET=utf8mb3 +COLLATE=utf8mb3_unicode_ci +COMMENT='refs #4988'; + +INSERT INTO vn.agencyWorkCenter (agencyFk, workCenterFk) + SELECT id, workCenterFk + FROM vn.agency + WHERE workCenterFk IS NOT NULL; -- 2.40.1 From adc3b413f5ede3342ca052377e404a001e80295f Mon Sep 17 00:00:00 2001 From: pablone Date: Mon, 22 Apr 2024 17:17:17 +0200 Subject: [PATCH 05/13] feat: refs #4988 agency add module --- back/models/agency-workCenter.json | 5 +++++ .../10995-navyErica/01-agencyLogCreate.sql | 1 + .../02-agencyWorkCenterCreate.sql | 18 ++++++++++++++++++ db/versions/10995-navyErica/02-createTable.sql | 17 ----------------- .../{00-firstScript.sql => 03-tableAcl.sql} | 14 ++++++++++++-- 5 files changed, 36 insertions(+), 19 deletions(-) create mode 100644 db/versions/10995-navyErica/02-agencyWorkCenterCreate.sql delete mode 100644 db/versions/10995-navyErica/02-createTable.sql rename db/versions/10995-navyErica/{00-firstScript.sql => 03-tableAcl.sql} (50%) diff --git a/back/models/agency-workCenter.json b/back/models/agency-workCenter.json index cd1b295b4..adf1e5bcb 100644 --- a/back/models/agency-workCenter.json +++ b/back/models/agency-workCenter.json @@ -32,5 +32,10 @@ "model": "WorkCenter", "foreignKey": "workCenterFk" } + }, + "scope": { + "include":{ + "relation": "workCenter" + } } } diff --git a/db/versions/10995-navyErica/01-agencyLogCreate.sql b/db/versions/10995-navyErica/01-agencyLogCreate.sql index bfb1f83a8..0b8a1ed87 100644 --- a/db/versions/10995-navyErica/01-agencyLogCreate.sql +++ b/db/versions/10995-navyErica/01-agencyLogCreate.sql @@ -1,6 +1,7 @@ -- vn.agencyLog definition ALTER TABLE vn.agency ADD IF NOT EXISTS editorFk int(10) unsigned DEFAULT NULL NULL; +ALTER TABLE vn.agency ADD CONSTRAINT agency_user_FK FOREIGN KEY (editorFk) REFERENCES `account`.`user`(id); CREATE TABLE IF NOT EXISTS `vn`.`agencyLog` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, diff --git a/db/versions/10995-navyErica/02-agencyWorkCenterCreate.sql b/db/versions/10995-navyErica/02-agencyWorkCenterCreate.sql new file mode 100644 index 000000000..1d716ee9c --- /dev/null +++ b/db/versions/10995-navyErica/02-agencyWorkCenterCreate.sql @@ -0,0 +1,18 @@ +CREATE TABLE IF NOT EXISTS `agencyWorkCenter` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `agencyFk` smallint(5) unsigned NOT NULL, + `workCenterFk` int(11) NOT NULL, + `editorFk` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `agencyWorkCenter_unique` (`agencyFk`,`workCenterFk`), + KEY `agencyWorkCenter_workCenter_FK` (`workCenterFk`), + KEY `agencyWorkCenter_user_FK` (`editorFk`), + CONSTRAINT `agencyWorkCenter_agency_FK` FOREIGN KEY (`agencyFk`) REFERENCES `agency` (`id`) ON DELETE CASCADE, + CONSTRAINT `agencyWorkCenter_user_FK` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `agencyWorkCenter_workCenter_FK` FOREIGN KEY (`workCenterFk`) REFERENCES `workCenter` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #4988'; + +INSERT INTO vn.agencyWorkCenter (agencyFk, workCenterFk) + SELECT id, workCenterFk + FROM vn.agency + WHERE workCenterFk IS NOT NULL; diff --git a/db/versions/10995-navyErica/02-createTable.sql b/db/versions/10995-navyErica/02-createTable.sql deleted file mode 100644 index 063e210fb..000000000 --- a/db/versions/10995-navyErica/02-createTable.sql +++ /dev/null @@ -1,17 +0,0 @@ -CREATE TABLE IF NOT EXISTS vn.agencyWorkCenter ( - id INT UNSIGNED auto_increment NOT NULL, - agencyFk smallint(5) unsigned NULL, - workCenterFk int(11) NULL, - CONSTRAINT agencyWorkCenter_pk PRIMARY KEY (id), - CONSTRAINT agencyWorkCenter_agency_FK FOREIGN KEY (agencyFk) REFERENCES vn.agency(id) ON DELETE CASCADE, - CONSTRAINT agencyWorkCenter_workCenter_FK FOREIGN KEY (workCenterFk) REFERENCES vn.workCenter(id) -) -ENGINE=InnoDB -DEFAULT CHARSET=utf8mb3 -COLLATE=utf8mb3_unicode_ci -COMMENT='refs #4988'; - -INSERT INTO vn.agencyWorkCenter (agencyFk, workCenterFk) - SELECT id, workCenterFk - FROM vn.agency - WHERE workCenterFk IS NOT NULL; diff --git a/db/versions/10995-navyErica/00-firstScript.sql b/db/versions/10995-navyErica/03-tableAcl.sql similarity index 50% rename from db/versions/10995-navyErica/00-firstScript.sql rename to db/versions/10995-navyErica/03-tableAcl.sql index 1b692301e..f3fc4d336 100644 --- a/db/versions/10995-navyErica/00-firstScript.sql +++ b/db/versions/10995-navyErica/03-tableAcl.sql @@ -1,9 +1,19 @@ -- Place your SQL code here -INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId) - VALUES('Agency', '*', 'READ', 'ALLOW', 'ROLE', 'employee'); INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) VALUES ('AgencyLog','*','READ','ALLOW','ROLE','employee'); +INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) + VALUES ('AgencyWorkCenter','*','READ','ALLOW','ROLE','employee'); + +INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId) + VALUES('AgencyMode', '*', 'READ', 'ALLOW', 'ROLE', 'employee'); + +INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId) + VALUES('Agency', '*', 'READ', 'ALLOW', 'ROLE', 'employee'); + INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) VALUES ('Agency','*','WRITE','ALLOW','ROLE','deliveryAssistant'); +INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) + VALUES ('AgencyWorkCenter','*','WRITE','ALLOW','ROLE','deliveryAssistant'); + -- 2.40.1 From 42591af5c7282f165dc6a18b4ece69cf9f253791 Mon Sep 17 00:00:00 2001 From: pablone Date: Thu, 25 Apr 2024 09:46:15 +0200 Subject: [PATCH 06/13] fix: refs #4988 create table --- db/versions/10995-navyErica/02-agencyWorkCenterCreate.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/versions/10995-navyErica/02-agencyWorkCenterCreate.sql b/db/versions/10995-navyErica/02-agencyWorkCenterCreate.sql index 1d716ee9c..179fbc63c 100644 --- a/db/versions/10995-navyErica/02-agencyWorkCenterCreate.sql +++ b/db/versions/10995-navyErica/02-agencyWorkCenterCreate.sql @@ -1,4 +1,4 @@ -CREATE TABLE IF NOT EXISTS `agencyWorkCenter` ( +CREATE TABLE IF NOT EXISTS `vn`.`agencyWorkCenter` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `agencyFk` smallint(5) unsigned NOT NULL, `workCenterFk` int(11) NOT NULL, -- 2.40.1 From 4e11e46fff7a0c78b772832e1702ba3e96189449 Mon Sep 17 00:00:00 2001 From: pablone Date: Thu, 25 Apr 2024 12:40:54 +0200 Subject: [PATCH 07/13] feat: refs #4988 capture error on duplicate --- back/models/agency-workCenter.js | 8 ++++++++ db/dump/fixtures.before.sql | 3 +++ loopback/locale/en.json | 4 +++- loopback/locale/es.json | 3 ++- 4 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 back/models/agency-workCenter.js diff --git a/back/models/agency-workCenter.js b/back/models/agency-workCenter.js new file mode 100644 index 000000000..3220999e9 --- /dev/null +++ b/back/models/agency-workCenter.js @@ -0,0 +1,8 @@ +let UserError = require('vn-loopback/util/user-error'); +module.exports = Self => { + Self.rewriteDbError(function(err) { + if (err.code === 'ER_DUP_ENTRY') + return new UserError(`This workCenter is already assigned to this agency`); + return err; + }); +}; diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index ff58af2e2..ee115751e 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -3787,3 +3787,6 @@ INSERT INTO `vn`.`accountReconciliationConfig`(currencyFk, warehouseFk) INSERT INTO vn.workerTeam(id, team, workerFk) VALUES (8, 1, 19); + +INSERT INTO vn.workCenter (id, name, payrollCenterFk, counter, warehouseFk, street, geoFk, deliveryManAdjustment) + VALUES(100, 'workCenterOne', 1, NULL, 1, 'gotham', NULL, NULL); \ No newline at end of file diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 9a3a1f52a..fdaea2697 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -225,5 +225,7 @@ "ticketCommercial": "The ticket {{ ticket }} for the salesperson {{ salesMan }} is in preparation. (automatically generated message)", "This password can only be changed by the user themselves": "This password can only be changed by the user themselves", "They're not your subordinate": "They're not your subordinate", - "InvoiceIn is already booked": "InvoiceIn is already booked" + "InvoiceIn is already booked": "InvoiceIn is already booked", + "This workCenter already exists": "This workCenter already exists", + "This workCenter is already assigned to this agency": "This workCenter is already assigned to this agency" } \ No newline at end of file diff --git a/loopback/locale/es.json b/loopback/locale/es.json index d7f9564fe..b218f03ec 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -353,5 +353,6 @@ "This password can only be changed by the user themselves": "Esta contraseña solo puede ser modificada por el propio usuario", "They're not your subordinate": "No es tu subordinado/a.", "No results found": "No se han encontrado resultados", - "InvoiceIn is already booked": "La factura recibida está contabilizada" + "InvoiceIn is already booked": "La factura recibida está contabilizada", + "This workCenter is already assigned to this agency": "This workCenter is already assigned to this agency" } \ No newline at end of file -- 2.40.1 From c2888e4f97d0ec9e457ed3cf79b82a9c1228a81d Mon Sep 17 00:00:00 2001 From: pablone Date: Thu, 25 Apr 2024 12:43:47 +0200 Subject: [PATCH 08/13] fix: refs #4988 correct yml --- loopback/locale/en.json | 3 +-- loopback/locale/es.json | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/loopback/locale/en.json b/loopback/locale/en.json index fdaea2697..921c18d95 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -226,6 +226,5 @@ "This password can only be changed by the user themselves": "This password can only be changed by the user themselves", "They're not your subordinate": "They're not your subordinate", "InvoiceIn is already booked": "InvoiceIn is already booked", - "This workCenter already exists": "This workCenter already exists", - "This workCenter is already assigned to this agency": "This workCenter is already assigned to this agency" + "This workCenter already exists": "This workCenter already exists" } \ No newline at end of file diff --git a/loopback/locale/es.json b/loopback/locale/es.json index b218f03ec..d7f9564fe 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -353,6 +353,5 @@ "This password can only be changed by the user themselves": "Esta contraseña solo puede ser modificada por el propio usuario", "They're not your subordinate": "No es tu subordinado/a.", "No results found": "No se han encontrado resultados", - "InvoiceIn is already booked": "La factura recibida está contabilizada", - "This workCenter is already assigned to this agency": "This workCenter is already assigned to this agency" + "InvoiceIn is already booked": "La factura recibida está contabilizada" } \ No newline at end of file -- 2.40.1 From 00359a0a6b4065594252f528dd4ce596653ab756 Mon Sep 17 00:00:00 2001 From: pablone Date: Thu, 25 Apr 2024 12:44:27 +0200 Subject: [PATCH 09/13] fix: refs #4988 traduction --- loopback/locale/en.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 921c18d95..9a3a1f52a 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -225,6 +225,5 @@ "ticketCommercial": "The ticket {{ ticket }} for the salesperson {{ salesMan }} is in preparation. (automatically generated message)", "This password can only be changed by the user themselves": "This password can only be changed by the user themselves", "They're not your subordinate": "They're not your subordinate", - "InvoiceIn is already booked": "InvoiceIn is already booked", - "This workCenter already exists": "This workCenter already exists" + "InvoiceIn is already booked": "InvoiceIn is already booked" } \ No newline at end of file -- 2.40.1 From 48d3ee373ed0461ad777399f405bc483aefcb34a Mon Sep 17 00:00:00 2001 From: pablone Date: Thu, 25 Apr 2024 12:47:52 +0200 Subject: [PATCH 10/13] fix: refs #4988 yml --- loopback/locale/es.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index d7f9564fe..249a46e80 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -353,5 +353,6 @@ "This password can only be changed by the user themselves": "Esta contraseña solo puede ser modificada por el propio usuario", "They're not your subordinate": "No es tu subordinado/a.", "No results found": "No se han encontrado resultados", - "InvoiceIn is already booked": "La factura recibida está contabilizada" + "InvoiceIn is already booked": "La factura recibida está contabilizada", + "This workCenter is already assigned to this agency": "Este centro de trabajo ya está asignado a esta agencia" } \ No newline at end of file -- 2.40.1 From af1abe934f50b5940e50c7df16a3253b27e33160 Mon Sep 17 00:00:00 2001 From: pablone Date: Thu, 25 Apr 2024 17:21:59 +0200 Subject: [PATCH 11/13] fix: refs #4988 translates --- loopback/locale/en.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 9a3a1f52a..601a26f5b 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -225,5 +225,6 @@ "ticketCommercial": "The ticket {{ ticket }} for the salesperson {{ salesMan }} is in preparation. (automatically generated message)", "This password can only be changed by the user themselves": "This password can only be changed by the user themselves", "They're not your subordinate": "They're not your subordinate", - "InvoiceIn is already booked": "InvoiceIn is already booked" + "InvoiceIn is already booked": "InvoiceIn is already booked", + "This workCenter is already assigned to this agency": "This workCenter is already assigned to this agency" } \ No newline at end of file -- 2.40.1 From d25c5eb327b6b2c3bce0021337536448eee322f8 Mon Sep 17 00:00:00 2001 From: pablone Date: Thu, 25 Apr 2024 17:22:22 +0200 Subject: [PATCH 12/13] fix: refs #4988 translates --- loopback/locale/en.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 601a26f5b..9a3a1f52a 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -225,6 +225,5 @@ "ticketCommercial": "The ticket {{ ticket }} for the salesperson {{ salesMan }} is in preparation. (automatically generated message)", "This password can only be changed by the user themselves": "This password can only be changed by the user themselves", "They're not your subordinate": "They're not your subordinate", - "InvoiceIn is already booked": "InvoiceIn is already booked", - "This workCenter is already assigned to this agency": "This workCenter is already assigned to this agency" + "InvoiceIn is already booked": "InvoiceIn is already booked" } \ No newline at end of file -- 2.40.1 From 51c42d09b2433c28fdfc970ac53dd05ba3c29f73 Mon Sep 17 00:00:00 2001 From: pablone Date: Fri, 26 Apr 2024 08:39:05 +0200 Subject: [PATCH 13/13] fix: refs #4988 agency hook --- back/models/agency-workCenter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/back/models/agency-workCenter.js b/back/models/agency-workCenter.js index 3220999e9..32114355e 100644 --- a/back/models/agency-workCenter.js +++ b/back/models/agency-workCenter.js @@ -1,4 +1,4 @@ -let UserError = require('vn-loopback/util/user-error'); +const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.rewriteDbError(function(err) { if (err.code === 'ER_DUP_ENTRY') -- 2.40.1