From 86631c84d0aec4c2fc509af13ff5f50ce7a9d51a Mon Sep 17 00:00:00 2001 From: carlosjr Date: Wed, 2 Jun 2021 17:35:30 +0200 Subject: [PATCH 1/7] moved transferor from fiscal data to basic data + e2e --- e2e/helpers/selectors.js | 2 +- e2e/paths/02-client/02_edit_basic_data.spec.js | 8 ++++++++ e2e/paths/02-client/03_edit_fiscal_data.spec.js | 7 ------- modules/client/front/basic-data/index.html | 13 +++++++++++++ modules/client/front/basic-data/index.js | 10 +++++++++- modules/client/front/fiscal-data/index.html | 11 ----------- modules/client/front/fiscal-data/index.js | 6 ------ 7 files changed, 31 insertions(+), 26 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 7b50935cc7..5060a8921c 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -151,6 +151,7 @@ export default { mobile: 'vn-client-basic-data vn-textfield[ng-model="$ctrl.client.mobile"]', salesPerson: 'vn-client-basic-data vn-autocomplete[ng-model="$ctrl.client.salesPersonFk"]', channel: 'vn-client-basic-data vn-autocomplete[ng-model="$ctrl.client.contactChannelFk"]', + transferor: 'vn-client-basic-data vn-autocomplete[ng-model="$ctrl.client.transferorFk"]', saveButton: 'vn-client-basic-data button[type=submit]' }, clientFiscalData: { @@ -162,7 +163,6 @@ export default { postcode: 'vn-client-fiscal-data vn-datalist[ng-model="$ctrl.client.postcode"]', sageTax: 'vn-client-fiscal-data vn-autocomplete[ng-model="$ctrl.client.sageTaxTypeFk"]', sageTransaction: 'vn-client-fiscal-data vn-autocomplete[ng-model="$ctrl.client.sageTransactionTypeFk"]', - transferor: 'vn-client-fiscal-data vn-autocomplete[ng-model="$ctrl.client.transferorFk"]', city: 'vn-client-fiscal-data vn-datalist[ng-model="$ctrl.client.city"]', province: 'vn-client-fiscal-data vn-autocomplete[ng-model="$ctrl.client.provinceFk"]', country: 'vn-client-fiscal-data vn-autocomplete[ng-model="$ctrl.client.countryFk"]', diff --git a/e2e/paths/02-client/02_edit_basic_data.spec.js b/e2e/paths/02-client/02_edit_basic_data.spec.js index d770e7523f..f35483edfc 100644 --- a/e2e/paths/02-client/02_edit_basic_data.spec.js +++ b/e2e/paths/02-client/02_edit_basic_data.spec.js @@ -34,6 +34,7 @@ describe('Client Edit basicData path', () => { await page.clearInput(selectors.clientBasicData.email); await page.write(selectors.clientBasicData.email, 'PWallace@verdnatura.es'); await page.autocompleteSearch(selectors.clientBasicData.channel, 'Rumors on the streets'); + await page.autocompleteSearch(selectors.clientBasicData.transferor, 'Max Eisenhardt'); await page.waitToClick(selectors.clientBasicData.saveButton); const message = await page.waitForSnackbar(); @@ -67,6 +68,13 @@ describe('Client Edit basicData path', () => { expect(result).toEqual('Rumors on the streets'); }); + + it('should confirm the previous client have been selected', async() => { + const result = await page + .waitToGetProperty(selectors.clientBasicData.transferor, 'value'); + + expect(result).toEqual('Max Eisenhardt'); + }); }); describe('as salesAssistant', () => { diff --git a/e2e/paths/02-client/03_edit_fiscal_data.spec.js b/e2e/paths/02-client/03_edit_fiscal_data.spec.js index d57cd968e3..ab0a61ddc9 100644 --- a/e2e/paths/02-client/03_edit_fiscal_data.spec.js +++ b/e2e/paths/02-client/03_edit_fiscal_data.spec.js @@ -68,7 +68,6 @@ describe('Client Edit fiscalData path', () => { await page.write(selectors.clientFiscalData.city, 'Valencia'); await page.autocompleteSearch(selectors.clientFiscalData.sageTax, 'operaciones no sujetas'); await page.autocompleteSearch(selectors.clientFiscalData.sageTransaction, 'regularización de inversiones'); - await page.autocompleteSearch(selectors.clientFiscalData.transferor, 'Max Eisenhardt'); await page.clearInput(selectors.clientFiscalData.postcode); await page.write(selectors.clientFiscalData.postcode, '46000'); await page.waitToClick(selectors.clientFiscalData.activeCheckbox); @@ -202,12 +201,6 @@ describe('Client Edit fiscalData path', () => { expect(result).toEqual('36: Regularización de inversiones'); }); - it('should confirm the transferor have been edited', async() => { - const result = await page.waitToGetProperty(selectors.clientFiscalData.transferor, 'value'); - - expect(result).toEqual('Max Eisenhardt'); - }); - it('should confirm the city have been autocompleted', async() => { const result = await page.waitToGetProperty(selectors.clientFiscalData.city, 'value'); diff --git a/modules/client/front/basic-data/index.html b/modules/client/front/basic-data/index.html index e4debac16e..4a705c3842 100644 --- a/modules/client/front/basic-data/index.html +++ b/modules/client/front/basic-data/index.html @@ -69,6 +69,19 @@ label="Channel"> + + + + {{id}}: {{transaction}} - - Date: Thu, 3 Jun 2021 11:40:39 +0200 Subject: [PATCH 2/7] Updated ticketGetProblems() --- db/changes/10320-monitors/00-ticketGetProblems.sql | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/db/changes/10320-monitors/00-ticketGetProblems.sql b/db/changes/10320-monitors/00-ticketGetProblems.sql index 85d6e40182..06d0275b31 100644 --- a/db/changes/10320-monitors/00-ticketGetProblems.sql +++ b/db/changes/10320-monitors/00-ticketGetProblems.sql @@ -120,7 +120,7 @@ BEGIN GROUP BY tl.ticketFk ON DUPLICATE KEY UPDATE isAvailable = 0; -/* + INSERT INTO tmp.ticketProblems(ticketFk, itemShortage) SELECT ticketFk, problem FROM ( @@ -142,10 +142,10 @@ BEGIN AND NOT i.generic AND CURDATE() = vDate AND t.warehouseFk = vWarehouse - GROUP BY tl.ticketFk LIMIT 1) sub + GROUP BY tl.ticketFk) sub ON DUPLICATE KEY UPDATE itemShortage = sub.problem; -*/ + INSERT INTO tmp.ticketProblems(ticketFk, itemDelay) SELECT ticketFk, problem FROM ( @@ -165,7 +165,7 @@ BEGIN AND NOT i.generic AND CURDATE() = vDate AND t.warehouseFk = vWarehouse - GROUP BY tl.ticketFk LIMIT 1) sub + GROUP BY tl.ticketFk) sub ON DUPLICATE KEY UPDATE itemDelay = sub.problem; END WHILE; @@ -182,7 +182,6 @@ BEGIN DROP TEMPORARY TABLE tmp.clientGetDebt, - tmp.ticketList; - + tmp.ticketList; END;;$$ DELIMITER ; From 5962a68d1521d4db3115c03eaec8696e6d35506f Mon Sep 17 00:00:00 2001 From: joan Date: Thu, 3 Jun 2021 12:40:27 +0200 Subject: [PATCH 3/7] HOTFIX: Sort by zone hour --- modules/monitor/front/index/tickets/index.html | 2 +- modules/ticket/front/index/index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/monitor/front/index/tickets/index.html b/modules/monitor/front/index/tickets/index.html index dffc1ee8d0..6a9f15e82f 100644 --- a/modules/monitor/front/index/tickets/index.html +++ b/modules/monitor/front/index/tickets/index.html @@ -38,7 +38,7 @@ Salesperson Date Hour - Closure + Closure Province State Zone diff --git a/modules/ticket/front/index/index.html b/modules/ticket/front/index/index.html index b86aaba9d4..4865c8c62d 100644 --- a/modules/ticket/front/index/index.html +++ b/modules/ticket/front/index/index.html @@ -18,7 +18,7 @@ Salesperson Date Hour - Closure + Closure Alias Province State From 523f9c6df08bb57fdd609c3af6b532f85cf077f6 Mon Sep 17 00:00:00 2001 From: joan Date: Thu, 3 Jun 2021 13:45:57 +0200 Subject: [PATCH 4/7] Added new sql version folder --- db/changes/10330-jun2021/deleteMe.keep | 1 + 1 file changed, 1 insertion(+) create mode 100644 db/changes/10330-jun2021/deleteMe.keep diff --git a/db/changes/10330-jun2021/deleteMe.keep b/db/changes/10330-jun2021/deleteMe.keep new file mode 100644 index 0000000000..5b815cc653 --- /dev/null +++ b/db/changes/10330-jun2021/deleteMe.keep @@ -0,0 +1 @@ +Delete me!! \ No newline at end of file From b0bed3c1c4974f03b599eb31efba049fbec0d14f Mon Sep 17 00:00:00 2001 From: carlosjr Date: Thu, 3 Jun 2021 16:14:52 +0200 Subject: [PATCH 5/7] invoiceInLog section, model and table --- db/changes/10330-jun2021/00-invoiceInLog.sql | 18 ++++++ db/changes/10330-jun2021/deleteMe.keep | 1 - modules/entry/back/models/entry.json | 2 +- modules/entry/front/routes.json | 24 +++++--- modules/invoiceIn/back/model-config.json | 3 + .../invoiceIn/back/models/invoice-in-log.json | 61 +++++++++++++++++++ modules/invoiceIn/back/models/invoice-in.json | 5 +- modules/invoiceIn/front/index.js | 1 + modules/invoiceIn/front/log/index.html | 1 + modules/invoiceIn/front/log/index.js | 7 +++ modules/invoiceIn/front/routes.json | 14 ++++- 11 files changed, 125 insertions(+), 12 deletions(-) create mode 100644 db/changes/10330-jun2021/00-invoiceInLog.sql delete mode 100644 db/changes/10330-jun2021/deleteMe.keep create mode 100644 modules/invoiceIn/back/models/invoice-in-log.json create mode 100644 modules/invoiceIn/front/log/index.html create mode 100644 modules/invoiceIn/front/log/index.js diff --git a/db/changes/10330-jun2021/00-invoiceInLog.sql b/db/changes/10330-jun2021/00-invoiceInLog.sql new file mode 100644 index 0000000000..899c6c63f9 --- /dev/null +++ b/db/changes/10330-jun2021/00-invoiceInLog.sql @@ -0,0 +1,18 @@ +CREATE TABLE `vn`.`invoiceInLog` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `originFk` MEDIUMINT UNSIGNED NOT NULL, + `userFk` int(10) unsigned DEFAULT NULL, + `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, + `creationDate` timestamp NULL DEFAULT current_timestamp(), + `description` text CHARACTER SET utf8 DEFAULT NULL, + `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `oldInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, + `newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, + `changedModelId` int(11) DEFAULT NULL, + `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `originFk` (`originFk`), + KEY `userFk` (`userFk`), + CONSTRAINT `invoiceInLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `vn`.`invoiceIn` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `invoiceInLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; \ No newline at end of file diff --git a/db/changes/10330-jun2021/deleteMe.keep b/db/changes/10330-jun2021/deleteMe.keep deleted file mode 100644 index 5b815cc653..0000000000 --- a/db/changes/10330-jun2021/deleteMe.keep +++ /dev/null @@ -1 +0,0 @@ -Delete me!! \ No newline at end of file diff --git a/modules/entry/back/models/entry.json b/modules/entry/back/models/entry.json index 78d3c5e4ff..d8bd079a2a 100644 --- a/modules/entry/back/models/entry.json +++ b/modules/entry/back/models/entry.json @@ -6,7 +6,7 @@ }, "options": { "mysql": { - "table": "entry" + "table": "entry" } }, "properties": { diff --git a/modules/entry/front/routes.json b/modules/entry/front/routes.json index c9f0efffd1..37dda7584c 100644 --- a/modules/entry/front/routes.json +++ b/modules/entry/front/routes.json @@ -26,30 +26,35 @@ "abstract": true, "component": "vn-entry", "description": "Entries" - }, { + }, + { "url": "/index?q", "state": "entry.index", "component": "vn-entry-index", "description": "Entries", "acl": ["buyer", "administrative"] - }, { + }, + { "url": "/latest-buys?q", "state": "entry.latestBuys", "component": "vn-entry-latest-buys", "description": "Latest buys", "acl": ["buyer", "administrative"] - }, { + }, + { "url": "/create?supplierFk&travelFk&companyFk", "state": "entry.create", "component": "vn-entry-create", "description": "New entry", "acl": ["buyer", "administrative"] - }, { + }, + { "url": "/:id", "state": "entry.card", "abstract": true, "component": "vn-entry-card" - }, { + }, + { "url": "/summary", "state": "entry.card.summary", "component": "vn-entry-summary", @@ -58,7 +63,8 @@ "entry": "$ctrl.entry" }, "acl": ["buyer", "administrative"] - }, { + }, + { "url": "/basic-data", "state": "entry.card.basicData", "component": "vn-entry-basic-data", @@ -67,7 +73,8 @@ "entry": "$ctrl.entry" }, "acl": ["buyer", "administrative"] - },{ + }, + { "url": "/observation", "state": "entry.card.observation", "component": "vn-entry-observation", @@ -76,7 +83,8 @@ "entry": "$ctrl.entry" }, "acl": ["buyer", "administrative"] - },{ + }, + { "url" : "/log", "state": "entry.card.log", "component": "vn-entry-log", diff --git a/modules/invoiceIn/back/model-config.json b/modules/invoiceIn/back/model-config.json index 88d227ba38..467d6f7f93 100644 --- a/modules/invoiceIn/back/model-config.json +++ b/modules/invoiceIn/back/model-config.json @@ -4,5 +4,8 @@ }, "InvoiceInDueDay": { "dataSource": "vn" + }, + "InvoiceInLog": { + "dataSource": "vn" } } diff --git a/modules/invoiceIn/back/models/invoice-in-log.json b/modules/invoiceIn/back/models/invoice-in-log.json new file mode 100644 index 0000000000..a5d0cba565 --- /dev/null +++ b/modules/invoiceIn/back/models/invoice-in-log.json @@ -0,0 +1,61 @@ +{ + "name": "InvoiceInLog", + "base": "VnModel", + "options": { + "mysql": { + "table": "invoiceInLog" + } + }, + "properties": { + "id": { + "id": true, + "type": "number", + "forceId": false + }, + "originFk": { + "type": "number", + "required": true + }, + "userFk": { + "type": "number" + }, + "action": { + "type": "string", + "required": true + }, + "changedModel": { + "type": "string" + }, + "oldInstance": { + "type": "object" + }, + "newInstance": { + "type": "object" + }, + "creationDate": { + "type": "date" + }, + "changedModelId": { + "type": "string" + }, + "changedModelValue": { + "type": "string" + }, + "description": { + "type": "string" + } + }, + "relations": { + "user": { + "type": "belongsTo", + "model": "Account", + "foreignKey": "userFk" + } + }, + "scope": { + "order": [ + "creationDate DESC", + "id DESC" + ] + } +} \ No newline at end of file diff --git a/modules/invoiceIn/back/models/invoice-in.json b/modules/invoiceIn/back/models/invoice-in.json index ad14fb511f..7b0c3315a3 100644 --- a/modules/invoiceIn/back/models/invoice-in.json +++ b/modules/invoiceIn/back/models/invoice-in.json @@ -1,6 +1,9 @@ { "name": "InvoiceIn", - "base": "VnModel", + "base": "Loggable", + "log": { + "model": "InvoiceInLog" + }, "options": { "mysql": { "table": "invoiceIn" diff --git a/modules/invoiceIn/front/index.js b/modules/invoiceIn/front/index.js index 6c175d9a00..2102b338f2 100644 --- a/modules/invoiceIn/front/index.js +++ b/modules/invoiceIn/front/index.js @@ -8,3 +8,4 @@ import './descriptor'; import './descriptor-popover'; import './summary'; import './basic-data'; +import './log'; diff --git a/modules/invoiceIn/front/log/index.html b/modules/invoiceIn/front/log/index.html new file mode 100644 index 0000000000..2cfc9dfb1c --- /dev/null +++ b/modules/invoiceIn/front/log/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/modules/invoiceIn/front/log/index.js b/modules/invoiceIn/front/log/index.js new file mode 100644 index 0000000000..7a018de0fe --- /dev/null +++ b/modules/invoiceIn/front/log/index.js @@ -0,0 +1,7 @@ +import ngModule from '../module'; +import Section from 'salix/components/section'; + +ngModule.vnComponent('vnInvoiceInLog', { + template: require('./index.html'), + controller: Section, +}); diff --git a/modules/invoiceIn/front/routes.json b/modules/invoiceIn/front/routes.json index 05eff347b2..5f842f760c 100644 --- a/modules/invoiceIn/front/routes.json +++ b/modules/invoiceIn/front/routes.json @@ -12,6 +12,10 @@ { "state": "invoiceIn.card.basicData", "icon": "settings" + }, + { + "state": "invoiceIn.card.log", + "icon": "history" } ] }, @@ -53,7 +57,15 @@ "description": "Basic data", "params": { "invoice-in": "$ctrl.invoiceIn" - } + }, + "acl": ["administrative"] + }, + { + "url": "/log", + "state": "invoiceIn.card.log", + "component": "vn-invoice-in-log", + "description": "Log", + "acl": ["administrative"] } ] } \ No newline at end of file From edf18938a6fb7af06d3a3c0f35f09c665aac7689 Mon Sep 17 00:00:00 2001 From: joan Date: Thu, 3 Jun 2021 16:21:43 +0200 Subject: [PATCH 6/7] HOTFIX: clientGetDebt --- modules/ticket/back/methods/ticket/filter.js | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/ticket/back/methods/ticket/filter.js b/modules/ticket/back/methods/ticket/filter.js index 6826f55ecc..5d7c014f75 100644 --- a/modules/ticket/back/methods/ticket/filter.js +++ b/modules/ticket/back/methods/ticket/filter.js @@ -304,7 +304,6 @@ module.exports = Self => { stmts.push( `DROP TEMPORARY TABLE tmp.filter, - tmp.ticket, tmp.ticket_problems`); let sql = ParameterizedSQL.join(stmts, ';'); From 8bb254e93f72f8ca10d2a35666b8602cc7e1aafe Mon Sep 17 00:00:00 2001 From: joan Date: Thu, 3 Jun 2021 16:29:45 +0200 Subject: [PATCH 7/7] HOTFIX: Ticket monitor clientGetDebt --- modules/monitor/back/methods/sales-monitor/salesFilter.js | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/monitor/back/methods/sales-monitor/salesFilter.js b/modules/monitor/back/methods/sales-monitor/salesFilter.js index ecbdc48958..b84dff8a07 100644 --- a/modules/monitor/back/methods/sales-monitor/salesFilter.js +++ b/modules/monitor/back/methods/sales-monitor/salesFilter.js @@ -304,7 +304,6 @@ module.exports = Self => { stmts.push( `DROP TEMPORARY TABLE tmp.filter, - tmp.ticket, tmp.ticket_problems`); let sql = ParameterizedSQL.join(stmts, ';');