From 87d0dc3cece9d674ff70e65894bf70d02932e7d8 Mon Sep 17 00:00:00 2001 From: alexandre Date: Tue, 28 Mar 2023 08:25:41 +0200 Subject: [PATCH] refs #5092 changed name to negative bases --- db/changes/231201/00-negativeBases.sql | 4 ++++ db/changes/231201/00-unbilledClients.sql | 4 ---- ...d_clients.spec.js => 05_negative_bases.spec.js} | 8 ++++---- .../{unbilledClients.js => negativeBases.js} | 12 ++++++------ .../{unbilledClientsCsv.js => negativeBasesCsv.js} | 14 +++++++------- ...billedClients.spec.js => negativeBases.spec.js} | 8 ++++---- modules/invoiceIn/back/models/invoice-in.js | 4 ++-- modules/invoiceIn/front/index.js | 2 +- modules/invoiceIn/front/locale/es.yml | 2 +- .../index.html | 2 +- .../{unbilled-clients => negative-bases}/index.js | 6 +++--- .../locale/es.yml | 0 .../style.scss | 2 +- modules/invoiceIn/front/routes.json | 10 +++++----- 14 files changed, 39 insertions(+), 39 deletions(-) create mode 100644 db/changes/231201/00-negativeBases.sql delete mode 100644 db/changes/231201/00-unbilledClients.sql rename e2e/paths/09-invoice-in/{05_unbilled_clients.spec.js => 05_negative_bases.spec.js} (70%) rename modules/invoiceIn/back/methods/invoice-in/{unbilledClients.js => negativeBases.js} (92%) rename modules/invoiceIn/back/methods/invoice-in/{unbilledClientsCsv.js => negativeBasesCsv.js} (69%) rename modules/invoiceIn/back/methods/invoice-in/specs/{unbilledClients.spec.js => negativeBases.spec.js} (79%) rename modules/invoiceIn/front/{unbilled-clients => negative-bases}/index.html (99%) rename modules/invoiceIn/front/{unbilled-clients => negative-bases}/index.js (94%) rename modules/invoiceIn/front/{unbilled-clients => negative-bases}/locale/es.yml (100%) rename modules/invoiceIn/front/{unbilled-clients => negative-bases}/style.scss (85%) diff --git a/db/changes/231201/00-negativeBases.sql b/db/changes/231201/00-negativeBases.sql new file mode 100644 index 000000000..0bdc6f2dc --- /dev/null +++ b/db/changes/231201/00-negativeBases.sql @@ -0,0 +1,4 @@ +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES + ('InvoiceIn', 'negativeBases', 'READ', 'ALLOW', 'ROLE', 'administrative'), + ('InvoiceIn', 'negativeBasesCsv', 'READ', 'ALLOW', 'ROLE', 'administrative'); diff --git a/db/changes/231201/00-unbilledClients.sql b/db/changes/231201/00-unbilledClients.sql deleted file mode 100644 index 16127dd18..000000000 --- a/db/changes/231201/00-unbilledClients.sql +++ /dev/null @@ -1,4 +0,0 @@ -INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) - VALUES - ('InvoiceIn', 'unbilledClients', 'READ', 'ALLOW', 'ROLE', 'administrative'), - ('InvoiceIn', 'unbilledClientsCsv', 'READ', 'ALLOW', 'ROLE', 'administrative'); diff --git a/e2e/paths/09-invoice-in/05_unbilled_clients.spec.js b/e2e/paths/09-invoice-in/05_negative_bases.spec.js similarity index 70% rename from e2e/paths/09-invoice-in/05_unbilled_clients.spec.js rename to e2e/paths/09-invoice-in/05_negative_bases.spec.js index 629f24404..4c9fe651f 100644 --- a/e2e/paths/09-invoice-in/05_unbilled_clients.spec.js +++ b/e2e/paths/09-invoice-in/05_negative_bases.spec.js @@ -1,6 +1,6 @@ import getBrowser from '../../helpers/puppeteer'; -describe('InvoiceIn unbilled clients path', () => { +describe('InvoiceIn negative bases path', () => { let browser; let page; const httpRequests = []; @@ -9,18 +9,18 @@ describe('InvoiceIn unbilled clients path', () => { browser = await getBrowser(); page = browser.page; page.on('request', req => { - if (req.url().includes(`InvoiceIns/unbilledClients`)) + if (req.url().includes(`InvoiceIns/negativeBases`)) httpRequests.push(req.url()); }); await page.loginAndModule('administrative', 'invoiceIn'); - await page.accessToSection('invoiceIn.unbilled-clients'); + await page.accessToSection('invoiceIn.negative-bases'); }); afterAll(async() => { await browser.close(); }); - it('should show unbilled clients in a date range', async() => { + it('should show negative bases in a date range', async() => { const request = httpRequests.find(req => req.includes(`from`) && req.includes(`to`)); diff --git a/modules/invoiceIn/back/methods/invoice-in/unbilledClients.js b/modules/invoiceIn/back/methods/invoice-in/negativeBases.js similarity index 92% rename from modules/invoiceIn/back/methods/invoice-in/unbilledClients.js rename to modules/invoiceIn/back/methods/invoice-in/negativeBases.js index 216af4d48..4d5975fab 100644 --- a/modules/invoiceIn/back/methods/invoice-in/unbilledClients.js +++ b/modules/invoiceIn/back/methods/invoice-in/negativeBases.js @@ -2,8 +2,8 @@ const UserError = require('vn-loopback/util/user-error'); const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; module.exports = Self => { - Self.remoteMethodCtx('unbilledClients', { - description: 'Find all unbilled clients', + Self.remoteMethodCtx('negativeBases', { + description: 'Find all negative bases', accessType: 'READ', accepts: [ { @@ -27,12 +27,12 @@ module.exports = Self => { root: true }, http: { - path: `/unbilledClients`, + path: `/negativeBases`, verb: 'GET' } }); - Self.unbilledClients = async(ctx, options) => { + Self.negativeBases = async(ctx, options) => { const conn = Self.dataSource.connector; const args = ctx.args; @@ -99,14 +99,14 @@ module.exports = Self => { stmt.merge(conn.makeWhere(args.filter.where)); stmt.merge(conn.makeOrderBy(args.filter.order)); - const clientsIndex = stmts.push(stmt) - 1; + const negativeBasesIndex = stmts.push(stmt) - 1; stmts.push(`DROP TEMPORARY TABLE tmp.filter, tmp.ticket, tmp.ticketTax, tmp.ticketAmount`); const sql = ParameterizedSQL.join(stmts, ';'); const result = await conn.executeStmt(sql, myOptions); - return clientsIndex === 0 ? result : result[clientsIndex]; + return negativeBasesIndex === 0 ? result : result[negativeBasesIndex]; }; }; diff --git a/modules/invoiceIn/back/methods/invoice-in/unbilledClientsCsv.js b/modules/invoiceIn/back/methods/invoice-in/negativeBasesCsv.js similarity index 69% rename from modules/invoiceIn/back/methods/invoice-in/unbilledClientsCsv.js rename to modules/invoiceIn/back/methods/invoice-in/negativeBasesCsv.js index f9b30d83b..963151b7d 100644 --- a/modules/invoiceIn/back/methods/invoice-in/unbilledClientsCsv.js +++ b/modules/invoiceIn/back/methods/invoice-in/negativeBasesCsv.js @@ -1,11 +1,11 @@ const {toCSV} = require('vn-loopback/util/csv'); module.exports = Self => { - Self.remoteMethodCtx('unbilledClientsCsv', { - description: 'Returns the unbilled clients as .csv', + Self.remoteMethodCtx('negativeBasesCsv', { + description: 'Returns the negative bases as .csv', accessType: 'READ', accepts: [{ - arg: 'unbilledClients', + arg: 'negativeBases', type: ['object'], required: true }, @@ -35,19 +35,19 @@ module.exports = Self => { } ], http: { - path: '/unbilledClientsCsv', + path: '/negativeBasesCsv', verb: 'GET' } }); - Self.unbilledClientsCsv = async ctx => { + Self.negativeBasesCsv = async ctx => { const args = ctx.args; - const content = toCSV(args.unbilledClients); + const content = toCSV(args.negativeBases); return [ content, 'text/csv', - `attachment; filename="unbilled-clients-${new Date(args.from).toLocaleDateString()}-${new Date(args.to).toLocaleDateString()}.csv"` + `attachment; filename="negative-bases-${new Date(args.from).toLocaleDateString()}-${new Date(args.to).toLocaleDateString()}.csv"` ]; }; }; diff --git a/modules/invoiceIn/back/methods/invoice-in/specs/unbilledClients.spec.js b/modules/invoiceIn/back/methods/invoice-in/specs/negativeBases.spec.js similarity index 79% rename from modules/invoiceIn/back/methods/invoice-in/specs/unbilledClients.spec.js rename to modules/invoiceIn/back/methods/invoice-in/specs/negativeBases.spec.js index fcb3173ab..a5c6e3102 100644 --- a/modules/invoiceIn/back/methods/invoice-in/specs/unbilledClients.spec.js +++ b/modules/invoiceIn/back/methods/invoice-in/specs/negativeBases.spec.js @@ -1,7 +1,7 @@ const models = require('vn-loopback/server/server').models; -describe('invoiceIn unbilledClients()', () => { - it('should return all unbilled clients in a date range', async() => { +describe('invoiceIn negativeBases()', () => { + it('should return all negative bases in a date range', async() => { const tx = await models.InvoiceIn.beginTransaction({}); const options = {transaction: tx}; const ctx = { @@ -13,7 +13,7 @@ describe('invoiceIn unbilledClients()', () => { }; try { - const result = await models.InvoiceIn.unbilledClients(ctx, options); + const result = await models.InvoiceIn.negativeBases(ctx, options); expect(result.length).toBeGreaterThan(0); @@ -35,7 +35,7 @@ describe('invoiceIn unbilledClients()', () => { }; try { - await models.InvoiceIn.unbilledClients(ctx, options); + await models.InvoiceIn.negativeBases(ctx, options); await tx.rollback(); } catch (e) { error = e; diff --git a/modules/invoiceIn/back/models/invoice-in.js b/modules/invoiceIn/back/models/invoice-in.js index ebb2981e1..d87b8c111 100644 --- a/modules/invoiceIn/back/models/invoice-in.js +++ b/modules/invoiceIn/back/models/invoice-in.js @@ -6,6 +6,6 @@ module.exports = Self => { require('../methods/invoice-in/getTotals')(Self); require('../methods/invoice-in/invoiceInPdf')(Self); require('../methods/invoice-in/invoiceInEmail')(Self); - require('../methods/invoice-in/unbilledClients')(Self); - require('../methods/invoice-in/unbilledClientsCsv')(Self); + require('../methods/invoice-in/negativeBases')(Self); + require('../methods/invoice-in/negativeBasesCsv')(Self); }; diff --git a/modules/invoiceIn/front/index.js b/modules/invoiceIn/front/index.js index 7576848bf..69593dd5b 100644 --- a/modules/invoiceIn/front/index.js +++ b/modules/invoiceIn/front/index.js @@ -13,4 +13,4 @@ import './dueDay'; import './intrastat'; import './create'; import './log'; -import './unbilled-clients'; +import './negative-bases'; diff --git a/modules/invoiceIn/front/locale/es.yml b/modules/invoiceIn/front/locale/es.yml index 2b444f75b..71fd3b87b 100644 --- a/modules/invoiceIn/front/locale/es.yml +++ b/modules/invoiceIn/front/locale/es.yml @@ -22,4 +22,4 @@ Total stems: Total tallos Show agricultural receipt as PDF: Ver recibo agrícola como PDF Send agricultural receipt as PDF: Enviar recibo agrícola como PDF New InvoiceIn: Nueva Factura -Unbilled clients: Clientes sin facturar +Negative bases: Bases negativas diff --git a/modules/invoiceIn/front/unbilled-clients/index.html b/modules/invoiceIn/front/negative-bases/index.html similarity index 99% rename from modules/invoiceIn/front/unbilled-clients/index.html rename to modules/invoiceIn/front/negative-bases/index.html index c4c561191..368f44461 100644 --- a/modules/invoiceIn/front/unbilled-clients/index.html +++ b/modules/invoiceIn/front/negative-bases/index.html @@ -1,6 +1,6 @@ diff --git a/modules/invoiceIn/front/unbilled-clients/index.js b/modules/invoiceIn/front/negative-bases/index.js similarity index 94% rename from modules/invoiceIn/front/unbilled-clients/index.js rename to modules/invoiceIn/front/negative-bases/index.js index b1f55abac..0f6f04692 100644 --- a/modules/invoiceIn/front/unbilled-clients/index.js +++ b/modules/invoiceIn/front/negative-bases/index.js @@ -68,8 +68,8 @@ export default class Controller extends Section { return result; }, {})); }); - this.vnReport.show('InvoiceIns/unbilledClientsCsv', { - unbilledClients: data, + this.vnReport.show('InvoiceIns/negativeBasesCsv', { + negativeBases: data, from: this.params.from, to: this.params.to }); @@ -78,7 +78,7 @@ export default class Controller extends Section { Controller.$inject = ['$element', '$scope', 'vnReport']; -ngModule.vnComponent('vnUnbilledClients', { +ngModule.vnComponent('vnNegativeBases', { template: require('./index.html'), controller: Controller }); diff --git a/modules/invoiceIn/front/unbilled-clients/locale/es.yml b/modules/invoiceIn/front/negative-bases/locale/es.yml similarity index 100% rename from modules/invoiceIn/front/unbilled-clients/locale/es.yml rename to modules/invoiceIn/front/negative-bases/locale/es.yml diff --git a/modules/invoiceIn/front/unbilled-clients/style.scss b/modules/invoiceIn/front/negative-bases/style.scss similarity index 85% rename from modules/invoiceIn/front/unbilled-clients/style.scss rename to modules/invoiceIn/front/negative-bases/style.scss index dbed8b967..2d628cb94 100644 --- a/modules/invoiceIn/front/unbilled-clients/style.scss +++ b/modules/invoiceIn/front/negative-bases/style.scss @@ -1,6 +1,6 @@ @import "./variables"; -vn-unbilled-clients { +vn-negative-bases { vn-date-picker{ padding-right: 5%; } diff --git a/modules/invoiceIn/front/routes.json b/modules/invoiceIn/front/routes.json index 567323571..0d95c7e80 100644 --- a/modules/invoiceIn/front/routes.json +++ b/modules/invoiceIn/front/routes.json @@ -10,7 +10,7 @@ "menus": { "main": [ { "state": "invoiceIn.index", "icon": "icon-invoice-in"}, - { "state": "invoiceIn.unbilled-clients", "icon": "person"} + { "state": "invoiceIn.negative-bases", "icon": "icon-ticket"} ], "card": [ { @@ -53,10 +53,10 @@ ] }, { - "url": "/unbilled-clients", - "state": "invoiceIn.unbilled-clients", - "component": "vn-unbilled-clients", - "description": "Unbilled clients", + "url": "/negative-bases", + "state": "invoiceIn.negative-bases", + "component": "vn-negative-bases", + "description": "Negative bases", "acl": [ "administrative" ]