From e80754f2805dcf06772877456eb9ba55bb14bde4 Mon Sep 17 00:00:00 2001 From: joan Date: Mon, 24 Oct 2022 18:37:38 +0200 Subject: [PATCH 1/2] Added new SQL version --- db/changes/10491-august/delete.keep | 0 db/changes/10500-november/00-ACL.sql | 5 ++++ db/changes/10500-november/00-claim.sql | 1 + db/changes/10500-november/00-claimRma.sql | 7 +++++ .../claim/back/methods/claim/getSummary.js | 2 +- modules/claim/back/model-config.json | 9 ++++-- modules/claim/back/models/claim-rma.json | 30 +++++++++++++++++++ modules/claim/back/models/claim.json | 9 ++++++ 8 files changed, 59 insertions(+), 4 deletions(-) delete mode 100644 db/changes/10491-august/delete.keep create mode 100644 db/changes/10500-november/00-ACL.sql create mode 100644 db/changes/10500-november/00-claim.sql create mode 100644 db/changes/10500-november/00-claimRma.sql create mode 100644 modules/claim/back/models/claim-rma.json diff --git a/db/changes/10491-august/delete.keep b/db/changes/10491-august/delete.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/db/changes/10500-november/00-ACL.sql b/db/changes/10500-november/00-ACL.sql new file mode 100644 index 000000000..0b726538c --- /dev/null +++ b/db/changes/10500-november/00-ACL.sql @@ -0,0 +1,5 @@ +INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) +VALUES + ('ClaimRma', '*', 'READ', 'ALLOW', 'ROLE', 'claimManager'), + ('ClaimRma', '*', 'WRITE', 'ALLOW', 'ROLE', 'claimManager'); + diff --git a/db/changes/10500-november/00-claim.sql b/db/changes/10500-november/00-claim.sql new file mode 100644 index 000000000..0b9879878 --- /dev/null +++ b/db/changes/10500-november/00-claim.sql @@ -0,0 +1 @@ +ALTER TABLE `vn`.`claim` ADD rma varchar(100) NULL ; \ No newline at end of file diff --git a/db/changes/10500-november/00-claimRma.sql b/db/changes/10500-november/00-claimRma.sql new file mode 100644 index 000000000..91e1ebaba --- /dev/null +++ b/db/changes/10500-november/00-claimRma.sql @@ -0,0 +1,7 @@ +CREATE TABLE `vn`.`claimRma` ( + id INT UNSIGNED auto_increment NOT NULL PRIMARY KEY, + code varchar(100) NOT NULL, + created timestamp DEFAULT current_timestamp() NOT NULL, + workerFk INTEGER UNSIGNED NOT NULL +) +ENGINE=InnoDB; diff --git a/modules/claim/back/methods/claim/getSummary.js b/modules/claim/back/methods/claim/getSummary.js index 8ab39eb45..ca376f853 100644 --- a/modules/claim/back/methods/claim/getSummary.js +++ b/modules/claim/back/methods/claim/getSummary.js @@ -47,7 +47,7 @@ module.exports = Self => { { relation: 'claimState', scope: { - fields: ['id', 'description'] + fields: ['id', 'code', 'description'] } }, { diff --git a/modules/claim/back/model-config.json b/modules/claim/back/model-config.json index e99a455ac..83d88039c 100644 --- a/modules/claim/back/model-config.json +++ b/modules/claim/back/model-config.json @@ -2,6 +2,9 @@ "Claim": { "dataSource": "vn" }, + "ClaimContainer": { + "dataSource": "claimStorage" + }, "ClaimBeginning": { "dataSource": "vn" }, @@ -41,7 +44,7 @@ "ClaimObservation": { "dataSource": "vn" }, - "ClaimContainer": { - "dataSource": "claimStorage" - } + "ClaimRma": { + "dataSource": "vn" + } } diff --git a/modules/claim/back/models/claim-rma.json b/modules/claim/back/models/claim-rma.json new file mode 100644 index 000000000..24c17a234 --- /dev/null +++ b/modules/claim/back/models/claim-rma.json @@ -0,0 +1,30 @@ +{ + "name": "ClaimRma", + "base": "VnModel", + "options": { + "mysql": { + "table": "claimRma" + } + }, + "properties": { + "id": { + "type": "number", + "id": true, + "description": "Identifier" + }, + "code": { + "type": "string", + "required": true + }, + "created": { + "type": "date" + } + }, + "relations": { + "worker": { + "type": "belongsTo", + "model": "worker", + "foreignKey": "workerFk" + } + } +} diff --git a/modules/claim/back/models/claim.json b/modules/claim/back/models/claim.json index a3490ccf4..76125c483 100644 --- a/modules/claim/back/models/claim.json +++ b/modules/claim/back/models/claim.json @@ -46,6 +46,9 @@ }, "packages": { "type": "number" + }, + "rma": { + "type": "string" } }, "relations": { @@ -54,6 +57,12 @@ "model": "ClaimState", "foreignKey": "claimStateFk" }, + "claimRma": { + "type": "belongsTo", + "model": "ClaimRma", + "foreignKey": "rma", + "primaryKey": "code" + }, "client": { "type": "belongsTo", "model": "Client", From 4520443734acaa97fe7286399014e7010b7918fc Mon Sep 17 00:00:00 2001 From: joan Date: Tue, 25 Oct 2022 08:16:56 +0200 Subject: [PATCH 2/2] fix: Intl polyfill for spanish locale --- print/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/print/index.js b/print/index.js index 7ba3586eb..2ed713897 100644 --- a/print/index.js +++ b/print/index.js @@ -7,8 +7,12 @@ const componentsPath = path.resolve(__dirname, './core/components'); module.exports = { async boot(app) { - // Init database instance + // Extended locale intl polyfill + const IntlPolyfill = require('intl'); + Intl.NumberFormat = IntlPolyfill.NumberFormat; + Intl.DateTimeFormat = IntlPolyfill.DateTimeFormat; + // Init database instance require('./core/database').init(app.dataSources); require('./core/smtp').init(); require('./core/cluster').init();