From d9d7904aaf7d19411d622718a389bc9bd359bee9 Mon Sep 17 00:00:00 2001 From: jgallego Date: Wed, 29 May 2024 11:58:13 +0200 Subject: [PATCH 1/2] refs: #7108 weekends --- .../back/methods/invoice-in/exchangeRateUpdate.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/modules/invoiceIn/back/methods/invoice-in/exchangeRateUpdate.js b/modules/invoiceIn/back/methods/invoice-in/exchangeRateUpdate.js index 3ad06b242..989b1d4a2 100644 --- a/modules/invoiceIn/back/methods/invoice-in/exchangeRateUpdate.js +++ b/modules/invoiceIn/back/methods/invoice-in/exchangeRateUpdate.js @@ -54,6 +54,20 @@ module.exports = Self => { value: rate }); } + const monday = 1; + if (xmlDateWithoutTime.getDay() === monday) { + const saturday = new Date(xmlDateWithoutTime); + saturday.setDate(xmlDateWithoutTime.getDate() - 2); + const sunday = new Date(xmlDateWithoutTime); + sunday.setDate(xmlDateWithoutTime.getDate() - 1); + + for (const date of [saturday, sunday]) { + await models.ReferenceRate.upsertWithWhere( + {currencyFk: currency.id, dated: date}, + {currencyFk: currency.id, dated: date, value: rate} + ); + } + } } } } From db1c352be375526c7b7267940d3719041181c3ab Mon Sep 17 00:00:00 2001 From: sergiodt Date: Thu, 30 May 2024 18:06:35 +0200 Subject: [PATCH 2/2] feat: packaging refs #4021 --- modules/entry/back/model-config.json | 5 +++- modules/entry/back/models/entry-type.json | 25 +++++++++++++++++++ modules/entry/back/models/entry.json | 19 ++++++++------ .../methods/supplier/getItemsPackaging.js | 3 ++- 4 files changed, 43 insertions(+), 9 deletions(-) create mode 100644 modules/entry/back/models/entry-type.json diff --git a/modules/entry/back/model-config.json b/modules/entry/back/model-config.json index 7b6e23685..dc7fd86be 100644 --- a/modules/entry/back/model-config.json +++ b/modules/entry/back/model-config.json @@ -22,5 +22,8 @@ }, "EntryObservation": { "dataSource": "vn" + }, + "EntryType": { + "dataSource": "vn" } -} +} \ No newline at end of file diff --git a/modules/entry/back/models/entry-type.json b/modules/entry/back/models/entry-type.json new file mode 100644 index 000000000..989aa3a8a --- /dev/null +++ b/modules/entry/back/models/entry-type.json @@ -0,0 +1,25 @@ +{ + "name": "EntryType", + "base": "VnModel", + "mixins": { + "Loggable": true + }, + "options": { + "mysql": { + "table": "entryType" + } + }, + "properties": { + "code": { + "type": "string", + "id": true, + "description": "Identifier" + }, + "description": { + "type": "string" + }, + "isInformal": { + "type": "boolean" + } + } +} \ No newline at end of file diff --git a/modules/entry/back/models/entry.json b/modules/entry/back/models/entry.json index ab451219e..833edf14d 100644 --- a/modules/entry/back/models/entry.json +++ b/modules/entry/back/models/entry.json @@ -35,9 +35,9 @@ }, "isVirtual": { "type": "boolean", - "mysql": { - "columnName": "isRaid" - } + "mysql": { + "columnName": "isRaid" + } }, "isRaid": { "type": "boolean" @@ -53,9 +53,9 @@ }, "observation": { "type": "string", - "mysql": { - "columnName": "evaNotes" - } + "mysql": { + "columnName": "evaNotes" + } }, "loadPriority": { "type": "number" @@ -101,6 +101,11 @@ "type": "belongsTo", "model": "Account", "foreignKey": "observationEditorFk" + }, + "entryType": { + "type": "belongsTo", + "model": "EntryType", + "foreignKey": "typeFk" } } -} +} \ No newline at end of file diff --git a/modules/supplier/back/methods/supplier/getItemsPackaging.js b/modules/supplier/back/methods/supplier/getItemsPackaging.js index c06195a55..8a27c89c4 100644 --- a/modules/supplier/back/methods/supplier/getItemsPackaging.js +++ b/modules/supplier/back/methods/supplier/getItemsPackaging.js @@ -33,7 +33,7 @@ module.exports = Self => { JOIN vn.item i ON i.id = b.itemFk WHERE e.id = ? AND e.supplierFk = ? GROUP BY i.id - ) SELECT i.id, i.name, et.quantity, SUM(b.quantity) quantityTotal, et.printedStickers + ) SELECT i.id, i.name, et.quantity, SUM(b.quantity) quantityTotal, et.printedStickers, ic.url FROM vn.buy b JOIN vn.item i ON i.id = b.itemFk JOIN vn.entry e ON e.id = b.entryFk @@ -41,6 +41,7 @@ module.exports = Self => { JOIN vn.buyConfig bc ON bc.monthsAgo JOIN vn.travel t ON t.id = e.travelFk LEFT JOIN entryTmp et ON et.id = i.id + JOIN hedera.imageConfig ic WHERE e.supplierFk = ? AND i.family IN ('EMB', 'CONT') AND b.created > (util.VN_CURDATE() - INTERVAL bc.monthsAgo MONTH)