From c63dfba7da99f9ad7e28d2d38a282f10d64ceb99 Mon Sep 17 00:00:00 2001 From: pablone Date: Thu, 21 Nov 2024 10:18:09 +0100 Subject: [PATCH] feat: refs #7301 add inventory-config and acl --- db/dump/fixtures.before.sql | 10 ++++++++-- .../11352-blackErica/00-firstScript.sql | 3 +++ modules/entry/back/model-config.json | 3 +++ .../entry/back/models/inventory-config.json | 18 ++++++++++++++++++ .../back/methods/item/lastEntriesFilter.js | 3 ++- 5 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 db/versions/11352-blackErica/00-firstScript.sql create mode 100644 modules/entry/back/models/inventory-config.json diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index eb376b6c6..32653f3c2 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -1530,6 +1530,7 @@ INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed (8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2008', 'Movement 8', 1,''), (9, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 9', 1, ''), (10, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 10', 1, ''), + (11, 4, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 442, 'IN2001', 'Movement 1', 0, ''), (99, 69, '2000-12-01 00:00:00.000', 11, 0, 442, 'IN2009', 'Movement 99', 0, ''); INSERT INTO `vn`.`entryConfig` (`defaultEntry`, `inventorySupplierFk`, `defaultSupplierFk`) @@ -1570,7 +1571,8 @@ INSERT INTO `bs`.`waste`(`buyerFk`, `year`, `week`, `itemFk`, `itemTypeFk`, `sal (13, 7, 1, 50, 0, 3, 1, 2.000, 2.000, 0.000, 1, 1, 'packing', NULL, 0.00, 99.6, 99.4, 0, 1, 0, 4, util.VN_CURDATE()), (14, 7, 2, 5, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 'grouping', NULL, 0.00, 7.30, 7.00, 0, 1, 0, 4, util.VN_CURDATE()), (15, 7, 4, 1.25, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 'grouping', NULL, 0.00, 1.75, 1.67, 0, 1, 0, 4, util.VN_CURDATE()), - (16, 99,1,50.0000, 5000, 4, 1, 1.500, 1.500, 0.000, 1, 1, 'packing', NULL, 0.00, 99.60, 99.40, 0, 1, 0, 1.00, '2024-07-30 08:13:51.000'); + (16, 99,1,50.0000, 5000, 4, 1, 1.500, 1.500, 0.000, 1, 1, 'packing', NULL, 0.00, 99.60, 99.40, 0, 1, 0, 1.00, '2024-07-30 08:13:51.000'), + (17, 11, 1, 50, 5000, 4, 1, 1.500, 1.500, 0.000, 1, 1, 'packing', NULL, 0.00, 99.6, 99.4, 0, 1, 0, 1, util.VN_CURDATE() - INTERVAL 2 MONTH); INSERT INTO `hedera`.`order`(`id`, `date_send`, `customer_id`, `delivery_method_id`, `agency_id`, `address_id`, `company_id`, `note`, `source_app`, `confirmed`,`total`, `date_make`, `first_row_stamp`, `confirm_date`) VALUES @@ -4027,4 +4029,8 @@ INSERT IGNORE INTO vn.saySimpleCountry (countryFk, channel) (8, '1183'); INSERT IGNORE INTO vn.saySimpleConfig (url, defaultChannel) - VALUES ('saysimle-url-mock', 1320); \ No newline at end of file + VALUES ('saysimle-url-mock', 1320); + +INSERT IGNORE INTO vn.inventoryConfig + SET id = 1, + supplierFk = 4; \ No newline at end of file diff --git a/db/versions/11352-blackErica/00-firstScript.sql b/db/versions/11352-blackErica/00-firstScript.sql new file mode 100644 index 000000000..4e17c94c5 --- /dev/null +++ b/db/versions/11352-blackErica/00-firstScript.sql @@ -0,0 +1,3 @@ +-- Place your SQL code here +INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId, editorFk) + VALUES('InventoryConfig', '*', 'READ', 'ALLOW', 'ROLE', 'buyer', 100); \ No newline at end of file diff --git a/modules/entry/back/model-config.json b/modules/entry/back/model-config.json index 5c45b6e07..49c2df2db 100644 --- a/modules/entry/back/model-config.json +++ b/modules/entry/back/model-config.json @@ -28,5 +28,8 @@ }, "StockBought": { "dataSource": "vn" + }, + "InventoryConfig": { + "dataSource": "vn" } } diff --git a/modules/entry/back/models/inventory-config.json b/modules/entry/back/models/inventory-config.json new file mode 100644 index 000000000..caa39db88 --- /dev/null +++ b/modules/entry/back/models/inventory-config.json @@ -0,0 +1,18 @@ +{ + "name": "InventoryConfig", + "base": "VnModel", + "options": { + "mysql": { + "table": "inventoryConfig" + } + }, + "properties": { + "id": { + "type": "number", + "id": true + }, + "supplierFk": { + "type": "number" + } + } +} diff --git a/modules/item/back/methods/item/lastEntriesFilter.js b/modules/item/back/methods/item/lastEntriesFilter.js index 5aafbb4f6..06c60162f 100644 --- a/modules/item/back/methods/item/lastEntriesFilter.js +++ b/modules/item/back/methods/item/lastEntriesFilter.js @@ -54,7 +54,8 @@ module.exports = Self => { b.packageValue, b.packagingFk , s.id AS supplierFk, - s.name AS supplier + s.name AS supplier, + b.printedStickers FROM itemType it RIGHT JOIN (entry e LEFT JOIN supplier s ON s.id = e.supplierFk