From 44f2cd4efc0abe6877eee71889bb1b0b29c0abb9 Mon Sep 17 00:00:00 2001 From: robert Date: Mon, 22 Apr 2024 14:04:07 +0200 Subject: [PATCH 01/12] feat: refs #7247 clientSupplier_add --- db/routines/sage/procedures/clientSupplier_add.sql | 4 ++-- db/versions/11006-chocolateCataractarum/00-firstScript.sql | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 db/versions/11006-chocolateCataractarum/00-firstScript.sql diff --git a/db/routines/sage/procedures/clientSupplier_add.sql b/db/routines/sage/procedures/clientSupplier_add.sql index 7a0aec6e2..70f3ef3d0 100644 --- a/db/routines/sage/procedures/clientSupplier_add.sql +++ b/db/routines/sage/procedures/clientSupplier_add.sql @@ -53,7 +53,7 @@ BEGIN IFNULL(c.street, ''), c.accountingAccount, @fi := IF(cu.code = LEFT(TRIM(c.fi), 2) AND c.isVies, MID(TRIM(c.fi), 3, LENGTH(TRIM(c.fi))-1), TRIM(c.fi)), - IF(c.isVies, CONCAT(cu.code, @fi ), TRIM(c.fi)), + IF(c.isVies, CONCAT(IFNULL(cu.viesCode,cu.code), @fi ), TRIM(c.fi)), IFNULL(c.postcode, ''), IFNULL(c.city, ''), IFNULL(pr.CodigoProvincia, ''), @@ -91,7 +91,7 @@ BEGIN IFNULL(s.street, ''), s.account, @nif := IF(co.code = LEFT(TRIM(s.nif), 2), MID(TRIM(s.nif), 3, LENGTH(TRIM(s.nif))-1), TRIM(s.nif)), - IF(s.isVies, CONCAT(co.code, @nif), TRIM(s.nif)), + IF(s.isVies, CONCAT(IFNULL(co.viesCode,co.code), @nif), TRIM(s.nif)), IFNULL(s.postCode,''), IFNULL(s.city, ''), IFNULL(pr.CodigoProvincia, ''), diff --git a/db/versions/11006-chocolateCataractarum/00-firstScript.sql b/db/versions/11006-chocolateCataractarum/00-firstScript.sql new file mode 100644 index 000000000..7eaaa101e --- /dev/null +++ b/db/versions/11006-chocolateCataractarum/00-firstScript.sql @@ -0,0 +1,7 @@ +-- Place your SQL code here +ALTER TABLE vn.country + ADD IF NOT EXISTS viesCode varchar(2) DEFAULT NULL NULL AFTER code; + +UPDATE vn.country + SET viesCode='FR' + WHERE country = 'Mónaco'; \ No newline at end of file From 30e927d7222655b9159f5626de050935933b1f79 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 26 Apr 2024 12:10:05 +0200 Subject: [PATCH 02/12] feat: refs #6202 dbWatcher script --- db/dbWatcher.js | 31 +++++++++++++++++++++++++++++++ gulpfile.js | 2 ++ package.json | 3 ++- 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 db/dbWatcher.js diff --git a/db/dbWatcher.js b/db/dbWatcher.js new file mode 100644 index 000000000..b3520450f --- /dev/null +++ b/db/dbWatcher.js @@ -0,0 +1,31 @@ +const fs = require('fs'); +const {spawn} = require('child_process'); + +function watchDatabaseChanges() { + console.log('Watching for changes in db/routines and db/versions'); + + fs.watch('db', {recursive: true}, (eventType, filename) => { + if (filename.endsWith('.sql')) { + let command; + + if (filename.startsWith('routines')) command = 'push'; + else if (filename.startsWith('versions')) command = 'run'; + + if (command) { + const process = spawn('myt', [command]); + + process.stdout.on('data', data => console.log(data.toString())); + + process.stderr.on('data', data => console.error(`stderr: ${data}`)); + + process.on('error', error => console.error(`error: ${error.message}`)); + + process.on('close', () => console.log('Watching for changes in db/routines and db/versions')); + } + } + }); +} + +if (require.main === module) watchDatabaseChanges(); + +module.exports = watchDatabaseChanges; diff --git a/gulpfile.js b/gulpfile.js index aa2b65bc1..045d3ac41 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -6,6 +6,7 @@ const log = require('fancy-log'); const Myt = require('@verdnatura/myt/myt'); const Run = require('@verdnatura/myt/myt-run'); const Start = require('@verdnatura/myt/myt-start'); +const watchDatabaseChanges = require('./db/dbWatcher'); // Configuration @@ -245,6 +246,7 @@ routes.description = 'Merges all module routes file into one file'; function watch(done) { gulp.watch(routeFiles, gulp.series(routes)); gulp.watch(localeFiles, gulp.series(locales)); + watchDatabaseChanges(); done(); } watch.description = `Watches for changes in routes and locale files`; diff --git a/package.json b/package.json index 033eafc40..2a5c06c3d 100644 --- a/package.json +++ b/package.json @@ -113,7 +113,8 @@ "test:e2e": "node e2e/tests.js", "test:front": "jest --watch", "back": "nodemon --inspect -w modules ./node_modules/gulp/bin/gulp.js back", - "lint": "eslint ./ --cache --ignore-pattern .gitignore" + "lint": "eslint ./ --cache --ignore-pattern .gitignore", + "watch:db": "node ./db/dbWatcher.js" }, "jest": { "projects": [ From 4e78307a8de2d494e423f205a2b57eebcf976237 Mon Sep 17 00:00:00 2001 From: Jon Date: Mon, 6 May 2024 14:51:53 +0200 Subject: [PATCH 03/12] feat: refs #6739 transferInvoice new functionality --- .../methods/invoiceOut/transferInvoice.js | 13 +++++-- .../front/descriptor-menu/index.html | 10 +++++ .../invoiceOut/front/descriptor-menu/index.js | 37 ++++++++++++++++--- .../front/descriptor-menu/locale/en.yml | 5 ++- .../front/descriptor-menu/locale/es.yml | 3 ++ 5 files changed, 58 insertions(+), 10 deletions(-) diff --git a/modules/invoiceOut/back/methods/invoiceOut/transferInvoice.js b/modules/invoiceOut/back/methods/invoiceOut/transferInvoice.js index 8e234d7cc..b5eb9bed5 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/transferInvoice.js +++ b/modules/invoiceOut/back/methods/invoiceOut/transferInvoice.js @@ -36,6 +36,11 @@ module.exports = Self => { type: 'number', required: true }, + { + arg: 'checked', + type: 'boolean', + required: true + }, ], returns: { type: 'boolean', @@ -51,6 +56,7 @@ module.exports = Self => { const models = Self.app.models; const myOptions = {userId: ctx.req.accessToken.userId}; const {id, refFk, newClientFk, cplusRectificationTypeFk, siiTypeInvoiceOutFk, invoiceCorrectionTypeFk} = ctx.args; + const checked = ctx.args.checked; let tx; if (typeof options == 'object') Object.assign(myOptions, options); @@ -96,9 +102,10 @@ module.exports = Self => { await models.Ticket.invoiceTickets(ctx, refundTicketIds, invoiceCorrection, myOptions); - const [invoiceId] = await models.Ticket.invoiceTicketsAndPdf(ctx, clonedTicketIds, null, myOptions); - - return invoiceId; + if (!checked) { + const [invoiceId] = await models.Ticket.invoiceTicketsAndPdf(ctx, clonedTicketIds, null, myOptions); + return invoiceId; + } } catch (e) { if (tx) await tx.rollback(); throw e; diff --git a/modules/invoiceOut/front/descriptor-menu/index.html b/modules/invoiceOut/front/descriptor-menu/index.html index 1bf34831e..18ebdda3c 100644 --- a/modules/invoiceOut/front/descriptor-menu/index.html +++ b/modules/invoiceOut/front/descriptor-menu/index.html @@ -215,6 +215,7 @@ show-field="description" value-field="id" ng-model="$ctrl.cplusRectificationType" + ng-init="$ctrl.cplusRectificationType = (cplusRectificationTypes.length > 0 ? cplusRectificationTypes[1].id : null)" search-function="{or: [{id: $search}, {description: {like: '%'+ $search +'%'}}]}" label="Rectificative type"> @@ -232,6 +233,7 @@ fields="['id','code','description']" required="true" ng-model="$ctrl.siiTypeInvoiceOut" + ng-init="$ctrl.siiTypeInvoiceOut = (siiTypeInvoiceOuts.length > 0 ? siiTypeInvoiceOuts[3].id : null)" label="Class"> {{::code}} - {{::description}} @@ -248,6 +250,14 @@ label="Type"> + + + + diff --git a/modules/invoiceOut/front/descriptor-menu/index.js b/modules/invoiceOut/front/descriptor-menu/index.js index 5184c137e..746e42522 100644 --- a/modules/invoiceOut/front/descriptor-menu/index.js +++ b/modules/invoiceOut/front/descriptor-menu/index.js @@ -7,6 +7,7 @@ class Controller extends Section { super($element, $); this.vnReport = vnReport; this.vnEmail = vnEmail; + this.checked = true; } get invoiceOut() { @@ -23,6 +24,14 @@ class Controller extends Section { return this.aclService.hasAny(['invoicing']); } + get isChecked() { + return this.checked; + } + + set isChecked(value) { + this.checked = value; + } + loadData() { const filter = { include: [ @@ -34,7 +43,7 @@ class Controller extends Section { }, { relation: 'client', scope: { - fields: ['id', 'name', 'email'] + fields: ['id', 'name', 'email', 'hasToInvoiceByAddress'] } } ] @@ -136,12 +145,28 @@ class Controller extends Section { newClientFk: this.clientId, cplusRectificationTypeFk: this.cplusRectificationType, siiTypeInvoiceOutFk: this.siiTypeInvoiceOut, - invoiceCorrectionTypeFk: this.invoiceCorrectionType + invoiceCorrectionTypeFk: this.invoiceCorrectionType, + checked: this.checked }; - this.$http.post(`InvoiceOuts/transferInvoice`, params).then(res => { - const invoiceId = res.data; - this.vnApp.showSuccess(this.$t('Transferred invoice')); - this.$state.go('invoiceOut.card.summary', {id: invoiceId}); + this.$http.get(`Clients/${this.clientId}`).then(response => { + const clientData = response.data; + const hasToInvoiceByAddress = clientData.hasToInvoiceByAddress; + + if (this.checked && hasToInvoiceByAddress) { + if (window.confirm('El cliente destino tiene marcado facturar por consignatario, ¿desea continuar?')) { + this.$http.post(`InvoiceOuts/transferInvoice`, params).then(res => { + const invoiceId = res.data; + this.vnApp.showSuccess(this.$t('Transferred invoice')); + this.$state.go('invoiceOut.card.summary', {id: invoiceId}); + }); + } + } else { + this.$http.post(`InvoiceOuts/transferInvoice`, params).then(res => { + const invoiceId = res.data; + this.vnApp.showSuccess(this.$t('Transferred invoice')); + this.$state.go('invoiceOut.card.summary', {id: invoiceId}); + }); + } }); } } diff --git a/modules/invoiceOut/front/descriptor-menu/locale/en.yml b/modules/invoiceOut/front/descriptor-menu/locale/en.yml index 8fad5f25e..5470424cf 100644 --- a/modules/invoiceOut/front/descriptor-menu/locale/en.yml +++ b/modules/invoiceOut/front/descriptor-menu/locale/en.yml @@ -1,3 +1,6 @@ The following refund tickets have been created: "The following refund tickets have been created: {{ticketIds}}" Transfer invoice to...: Transfer invoice to... -Cplus Type: Cplus Type \ No newline at end of file +Cplus Type: Cplus Type +transferInvoice: Transfer Invoice +destinationClient: Bill destination client +checkinfo: New tickets from the destination customer will be generated in the consignee by default. \ No newline at end of file diff --git a/modules/invoiceOut/front/descriptor-menu/locale/es.yml b/modules/invoiceOut/front/descriptor-menu/locale/es.yml index 9285fafa7..75f1ab2c7 100644 --- a/modules/invoiceOut/front/descriptor-menu/locale/es.yml +++ b/modules/invoiceOut/front/descriptor-menu/locale/es.yml @@ -24,3 +24,6 @@ Refund...: Abono... Transfer invoice to...: Transferir factura a... Rectificative type: Tipo rectificativa Transferred invoice: Factura transferida +transferInvoice: Transferir factura +destinationClient: Facturar cliente destino +checkinfo: Los nuevos tickets del cliente destino, serán generados en el consignatario por defecto. \ No newline at end of file From d4f734455d3163040e5e662a2db2de44d66a2623 Mon Sep 17 00:00:00 2001 From: Jon Date: Tue, 7 May 2024 11:35:05 +0200 Subject: [PATCH 04/12] refactor: refs #6739 transferInvoice() refactor --- .../methods/invoiceOut/makePdfAndNotify.js | 1 - .../invoiceOut/front/descriptor-menu/index.js | 27 +++++++++---------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/modules/invoiceOut/back/methods/invoiceOut/makePdfAndNotify.js b/modules/invoiceOut/back/methods/invoiceOut/makePdfAndNotify.js index 4bba2498f..e2dc15993 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/makePdfAndNotify.js +++ b/modules/invoiceOut/back/methods/invoiceOut/makePdfAndNotify.js @@ -33,7 +33,6 @@ module.exports = Self => { try { await Self.makePdf(id, options); } catch (err) { - console.error(err); throw new UserError('Error while generating PDF', 'pdfError'); } diff --git a/modules/invoiceOut/front/descriptor-menu/index.js b/modules/invoiceOut/front/descriptor-menu/index.js index 746e42522..c29e4b788 100644 --- a/modules/invoiceOut/front/descriptor-menu/index.js +++ b/modules/invoiceOut/front/descriptor-menu/index.js @@ -148,25 +148,24 @@ class Controller extends Section { invoiceCorrectionTypeFk: this.invoiceCorrectionType, checked: this.checked }; + + const transferInvoiceRequest = () => { + this.$http.post(`InvoiceOuts/transferInvoice`, params).then(res => { + const invoiceId = res.data; + this.vnApp.showSuccess(this.$t('Transferred invoice')); + this.$state.go('invoiceOut.card.summary', {id: invoiceId}); + }); + }; + this.$http.get(`Clients/${this.clientId}`).then(response => { const clientData = response.data; const hasToInvoiceByAddress = clientData.hasToInvoiceByAddress; if (this.checked && hasToInvoiceByAddress) { - if (window.confirm('El cliente destino tiene marcado facturar por consignatario, ¿desea continuar?')) { - this.$http.post(`InvoiceOuts/transferInvoice`, params).then(res => { - const invoiceId = res.data; - this.vnApp.showSuccess(this.$t('Transferred invoice')); - this.$state.go('invoiceOut.card.summary', {id: invoiceId}); - }); - } - } else { - this.$http.post(`InvoiceOuts/transferInvoice`, params).then(res => { - const invoiceId = res.data; - this.vnApp.showSuccess(this.$t('Transferred invoice')); - this.$state.go('invoiceOut.card.summary', {id: invoiceId}); - }); - } + if (window.confirm('El cliente destino tiene marcado facturar por consignatario, ¿desea continuar?')) + transferInvoiceRequest(); + } else + transferInvoiceRequest(); }); } } From 5e8e09cbae19a5935cdb487b0b1945fc8f8c900d Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 7 May 2024 13:42:58 +0200 Subject: [PATCH 05/12] refs #6877 add attenderFk --- modules/ticket/back/methods/ticket-request/confirm.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/ticket/back/methods/ticket-request/confirm.js b/modules/ticket/back/methods/ticket-request/confirm.js index 00310f33c..7c709fb82 100644 --- a/modules/ticket/back/methods/ticket-request/confirm.js +++ b/modules/ticket/back/methods/ticket-request/confirm.js @@ -19,6 +19,10 @@ module.exports = Self => { type: 'number', required: true, description: 'The requested item quantity', + }, { + arg: 'attenderFk', + type: 'number', + required: true }], returns: { type: 'object', @@ -73,12 +77,14 @@ module.exports = Self => { ticketFk: request.ticketFk, itemFk: ctx.args.itemFk, quantity: ctx.args.quantity, + attenderFk: ctx.args.attenderFk, concept: item.name }, myOptions); await request.updateAttributes({ saleFk: sale.id, itemFk: sale.itemFk, - isOk: true + isOk: true, + attenderFk: sale.attenderFk, }, myOptions); const query = `CALL vn.sale_calculateComponent(?, NULL)`; From 9a235838d8c8ee285c9d3aa91ed05a82f70674cc Mon Sep 17 00:00:00 2001 From: Sergio De la torre Date: Wed, 8 May 2024 09:04:08 +0200 Subject: [PATCH 06/12] refs #7161 feat:setVisibleDiscard by itemTrash --- db/routines/vn/procedures/itemTrash.sql | 56 ------------------------- 1 file changed, 56 deletions(-) delete mode 100644 db/routines/vn/procedures/itemTrash.sql diff --git a/db/routines/vn/procedures/itemTrash.sql b/db/routines/vn/procedures/itemTrash.sql deleted file mode 100644 index bbb30b78a..000000000 --- a/db/routines/vn/procedures/itemTrash.sql +++ /dev/null @@ -1,56 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemTrash`( - vItemFk INT, - vWarehouseFk INT, - vQuantity INT, - vIsTrash BOOLEAN) -BEGIN - DECLARE vTicketFk INT; - DECLARE vClientFk INT; - DECLARE vCompanyVnlFk INT DEFAULT 442; - DECLARE vCalc INT; - - SELECT barcodeToItem(vItemFk) INTO vItemFk; - - SELECT IF(vIsTrash, 200, 400) INTO vClientFk; - - SELECT t.id INTO vTicketFk - FROM ticket t - JOIN address a ON a.id=t.addressFk - WHERE t.warehouseFk = vWarehouseFk - AND t.clientFk = vClientFk - AND DATE(t.shipped) = util.VN_CURDATE() - AND a.isDefaultAddress - LIMIT 1; - - CALL cache.visible_refresh(vCalc, TRUE, vWarehouseFk); - - IF vTicketFk IS NULL THEN - CALL ticket_add( - vClientFk, - util.VN_CURDATE(), - vWarehouseFk, - vCompanyVnlFk, - NULL, - NULL, - NULL, - util.VN_CURDATE(), - account.myUser_getId(), - FALSE, - vTicketFk); - END IF; - - INSERT INTO sale(ticketFk, itemFk, concept, quantity) - SELECT vTicketFk, - vItemFk, - CONCAT(longName,' ',worker_getCode(), ' ', LEFT(CAST(util.VN_NOW() AS TIME),5)), - vQuantity - FROM item - WHERE id = vItemFk; - - UPDATE cache.visible - SET visible = visible - vQuantity - WHERE calc_id = vCalc - AND item_id = vItemFk; -END$$ -DELIMITER ; From 0d43d9a982af966d93a463712ec584e3dbc27f93 Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 8 May 2024 13:20:45 +0200 Subject: [PATCH 07/12] refs #6877 remove restriction --- modules/ticket/back/methods/ticket-request/confirm.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/ticket/back/methods/ticket-request/confirm.js b/modules/ticket/back/methods/ticket-request/confirm.js index 7c709fb82..7c17d0010 100644 --- a/modules/ticket/back/methods/ticket-request/confirm.js +++ b/modules/ticket/back/methods/ticket-request/confirm.js @@ -21,8 +21,7 @@ module.exports = Self => { description: 'The requested item quantity', }, { arg: 'attenderFk', - type: 'number', - required: true + type: 'number' }], returns: { type: 'object', From 9d75ba0bc56bfe17aa8ab4c849200deff2785ce4 Mon Sep 17 00:00:00 2001 From: Jon Date: Wed, 8 May 2024 14:12:10 +0200 Subject: [PATCH 08/12] refactor: refs #6739 default params --- .../front/descriptor-menu/index.html | 20 ++---------- .../invoiceOut/front/descriptor-menu/index.js | 31 ++++++++++++------- 2 files changed, 22 insertions(+), 29 deletions(-) diff --git a/modules/invoiceOut/front/descriptor-menu/index.html b/modules/invoiceOut/front/descriptor-menu/index.html index 18ebdda3c..573694807 100644 --- a/modules/invoiceOut/front/descriptor-menu/index.html +++ b/modules/invoiceOut/front/descriptor-menu/index.html @@ -1,15 +1,3 @@ - - - - - {{::description}} + {{ ::description}} @@ -227,13 +214,12 @@ {{::code}} - {{::description}} diff --git a/modules/invoiceOut/front/descriptor-menu/index.js b/modules/invoiceOut/front/descriptor-menu/index.js index c29e4b788..8047e1c14 100644 --- a/modules/invoiceOut/front/descriptor-menu/index.js +++ b/modules/invoiceOut/front/descriptor-menu/index.js @@ -8,6 +8,16 @@ class Controller extends Section { this.vnReport = vnReport; this.vnEmail = vnEmail; this.checked = true; + this.$http.get(`CplusRectificationTypes`, {filter: {order: 'description'}}) + .then(res => { + this.cplusRectificationTypes = res.data; + this.cplusRectificationType = res.data.filter(type => type.description == 'I – Por diferencias')[0].id; + }); + this.$http.get(`SiiTypeInvoiceOuts`, {filter: {where: {code: {like: 'R%'}}}}) + .then(res => { + this.siiTypeInvoiceOuts = res.data; + this.siiTypeInvoiceOut = res.data.filter(type => type.code == 'R4')[0].id; + }); } get invoiceOut() { @@ -149,23 +159,20 @@ class Controller extends Section { checked: this.checked }; - const transferInvoiceRequest = () => { - this.$http.post(`InvoiceOuts/transferInvoice`, params).then(res => { - const invoiceId = res.data; - this.vnApp.showSuccess(this.$t('Transferred invoice')); - this.$state.go('invoiceOut.card.summary', {id: invoiceId}); - }); - }; - this.$http.get(`Clients/${this.clientId}`).then(response => { const clientData = response.data; const hasToInvoiceByAddress = clientData.hasToInvoiceByAddress; if (this.checked && hasToInvoiceByAddress) { - if (window.confirm('El cliente destino tiene marcado facturar por consignatario, ¿desea continuar?')) - transferInvoiceRequest(); - } else - transferInvoiceRequest(); + if (!window.confirm('El cliente destino tiene marcado facturar por consignatario, ¿desea continuar?')) + return; + } + + this.$http.post(`InvoiceOuts/transferInvoice`, params).then(res => { + const invoiceId = res.data; + this.vnApp.showSuccess(this.$t('Transferred invoice')); + this.$state.go('invoiceOut.card.summary', {id: invoiceId}); + }); }); } } From 77c2f61f47cd25f79d2c13cea4f021cd66548774 Mon Sep 17 00:00:00 2001 From: Jon Date: Wed, 8 May 2024 14:30:20 +0200 Subject: [PATCH 09/12] refs #6739 move petitions --- .../invoiceOut/front/descriptor-menu/index.js | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/modules/invoiceOut/front/descriptor-menu/index.js b/modules/invoiceOut/front/descriptor-menu/index.js index 8047e1c14..927fec955 100644 --- a/modules/invoiceOut/front/descriptor-menu/index.js +++ b/modules/invoiceOut/front/descriptor-menu/index.js @@ -8,16 +8,6 @@ class Controller extends Section { this.vnReport = vnReport; this.vnEmail = vnEmail; this.checked = true; - this.$http.get(`CplusRectificationTypes`, {filter: {order: 'description'}}) - .then(res => { - this.cplusRectificationTypes = res.data; - this.cplusRectificationType = res.data.filter(type => type.description == 'I – Por diferencias')[0].id; - }); - this.$http.get(`SiiTypeInvoiceOuts`, {filter: {where: {code: {like: 'R%'}}}}) - .then(res => { - this.siiTypeInvoiceOuts = res.data; - this.siiTypeInvoiceOut = res.data.filter(type => type.code == 'R4')[0].id; - }); } get invoiceOut() { @@ -42,6 +32,18 @@ class Controller extends Section { this.checked = value; } + $onInit() { + this.$http.get(`CplusRectificationTypes`, {filter: {order: 'description'}}) + .then(res => { + this.cplusRectificationTypes = res.data; + this.cplusRectificationType = res.data.filter(type => type.description == 'I – Por diferencias')[0].id; + }); + this.$http.get(`SiiTypeInvoiceOuts`, {filter: {where: {code: {like: 'R%'}}}}) + .then(res => { + this.siiTypeInvoiceOuts = res.data; + this.siiTypeInvoiceOut = res.data.filter(type => type.code == 'R4')[0].id; + }); + } loadData() { const filter = { include: [ From c4a66b42bb411d37497a1a9cb33769558b0c82f9 Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 8 May 2024 14:56:51 +0200 Subject: [PATCH 10/12] feat: refs #7247 Minor changes --- db/versions/11006-chocolateCataractarum/00-firstScript.sql | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/db/versions/11006-chocolateCataractarum/00-firstScript.sql b/db/versions/11006-chocolateCataractarum/00-firstScript.sql index 7eaaa101e..8cc86a78f 100644 --- a/db/versions/11006-chocolateCataractarum/00-firstScript.sql +++ b/db/versions/11006-chocolateCataractarum/00-firstScript.sql @@ -1,7 +1,6 @@ --- Place your SQL code here ALTER TABLE vn.country ADD IF NOT EXISTS viesCode varchar(2) DEFAULT NULL NULL AFTER code; -UPDATE vn.country - SET viesCode='FR' - WHERE country = 'Mónaco'; \ No newline at end of file +UPDATE IGNORE vn.country + SET viesCode = 'FR' + WHERE code = 'MC'; -- Mónaco \ No newline at end of file From 58aedf160b3557f61cb40aec1a827cab7006ffc9 Mon Sep 17 00:00:00 2001 From: Jon Date: Thu, 9 May 2024 08:05:23 +0200 Subject: [PATCH 11/12] refactor: refs #6739 changed translations' keys --- modules/invoiceOut/front/descriptor-menu/index.html | 2 +- modules/invoiceOut/front/descriptor-menu/index.js | 2 +- modules/invoiceOut/front/descriptor-menu/locale/en.yml | 3 ++- modules/invoiceOut/front/descriptor-menu/locale/es.yml | 3 ++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/invoiceOut/front/descriptor-menu/index.html b/modules/invoiceOut/front/descriptor-menu/index.html index 573694807..da04c8e72 100644 --- a/modules/invoiceOut/front/descriptor-menu/index.html +++ b/modules/invoiceOut/front/descriptor-menu/index.html @@ -240,7 +240,7 @@ diff --git a/modules/invoiceOut/front/descriptor-menu/index.js b/modules/invoiceOut/front/descriptor-menu/index.js index 927fec955..0d7fb32dd 100644 --- a/modules/invoiceOut/front/descriptor-menu/index.js +++ b/modules/invoiceOut/front/descriptor-menu/index.js @@ -166,7 +166,7 @@ class Controller extends Section { const hasToInvoiceByAddress = clientData.hasToInvoiceByAddress; if (this.checked && hasToInvoiceByAddress) { - if (!window.confirm('El cliente destino tiene marcado facturar por consignatario, ¿desea continuar?')) + if (!window.confirm(this.$t('confirmTransferInvoice'))) return; } diff --git a/modules/invoiceOut/front/descriptor-menu/locale/en.yml b/modules/invoiceOut/front/descriptor-menu/locale/en.yml index 5470424cf..32ea03442 100644 --- a/modules/invoiceOut/front/descriptor-menu/locale/en.yml +++ b/modules/invoiceOut/front/descriptor-menu/locale/en.yml @@ -3,4 +3,5 @@ Transfer invoice to...: Transfer invoice to... Cplus Type: Cplus Type transferInvoice: Transfer Invoice destinationClient: Bill destination client -checkinfo: New tickets from the destination customer will be generated in the consignee by default. \ No newline at end of file +transferInvoiceInfo: New tickets from the destination customer will be generated in the default consignee. +confirmTransferInvoice: Destination customer has marked to bill by consignee, do you want to continue? \ No newline at end of file diff --git a/modules/invoiceOut/front/descriptor-menu/locale/es.yml b/modules/invoiceOut/front/descriptor-menu/locale/es.yml index 75f1ab2c7..92c109878 100644 --- a/modules/invoiceOut/front/descriptor-menu/locale/es.yml +++ b/modules/invoiceOut/front/descriptor-menu/locale/es.yml @@ -26,4 +26,5 @@ Rectificative type: Tipo rectificativa Transferred invoice: Factura transferida transferInvoice: Transferir factura destinationClient: Facturar cliente destino -checkinfo: Los nuevos tickets del cliente destino, serán generados en el consignatario por defecto. \ No newline at end of file +transferInvoiceInfo: Los nuevos tickets del cliente destino serán generados en el consignatario por defecto. +confirmTransferInvoice: El cliente destino tiene marcado facturar por consignatario, ¿desea continuar? \ No newline at end of file From bf0db8928610429d4f1874d392523977dec7766b Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 9 May 2024 12:02:44 +0200 Subject: [PATCH 12/12] refactor: refs #6202 remove blanks --- db/dbWatcher.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/db/dbWatcher.js b/db/dbWatcher.js index b3520450f..e9389132d 100644 --- a/db/dbWatcher.js +++ b/db/dbWatcher.js @@ -3,23 +3,17 @@ const {spawn} = require('child_process'); function watchDatabaseChanges() { console.log('Watching for changes in db/routines and db/versions'); - fs.watch('db', {recursive: true}, (eventType, filename) => { if (filename.endsWith('.sql')) { let command; - if (filename.startsWith('routines')) command = 'push'; else if (filename.startsWith('versions')) command = 'run'; if (command) { const process = spawn('myt', [command]); - process.stdout.on('data', data => console.log(data.toString())); - process.stderr.on('data', data => console.error(`stderr: ${data}`)); - process.on('error', error => console.error(`error: ${error.message}`)); - process.on('close', () => console.log('Watching for changes in db/routines and db/versions')); } } @@ -27,5 +21,4 @@ function watchDatabaseChanges() { } if (require.main === module) watchDatabaseChanges(); - module.exports = watchDatabaseChanges;