From 44f2cd4efc0abe6877eee71889bb1b0b29c0abb9 Mon Sep 17 00:00:00 2001 From: robert Date: Mon, 22 Apr 2024 14:04:07 +0200 Subject: [PATCH 01/24] 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/24] 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 9af3c17a1ffccbf60a1f2ce1736a5ccda31f78fe Mon Sep 17 00:00:00 2001 From: robert Date: Mon, 29 Apr 2024 09:58:58 +0200 Subject: [PATCH 03/24] feat: refs #7291 sale_getProblems --- db/routines/vn/procedures/sale_getProblems.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/sale_getProblems.sql b/db/routines/vn/procedures/sale_getProblems.sql index bf02e2401..c17eefbf9 100644 --- a/db/routines/vn/procedures/sale_getProblems.sql +++ b/db/routines/vn/procedures/sale_getProblems.sql @@ -34,7 +34,7 @@ BEGIN ticketFk INT(11), saleFk INT(11), isFreezed INTEGER(1) DEFAULT 0, - risk DECIMAL(10,2) DEFAULT 0, + risk DECIMAL(10,1) DEFAULT 0, hasHighRisk TINYINT(1) DEFAULT 0, hasTicketRequest INTEGER(1) DEFAULT 0, itemShortage VARCHAR(255), From 4e78307a8de2d494e423f205a2b57eebcf976237 Mon Sep 17 00:00:00 2001 From: Jon Date: Mon, 6 May 2024 14:51:53 +0200 Subject: [PATCH 04/24] 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 e44568ff4b0a415953335437aeeaacaf0b1d09ba Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 7 May 2024 08:00:26 +0200 Subject: [PATCH 05/24] feat: refs #6585 Added call ticket_afterUpdate --- db/routines/vn/triggers/ticket_afterUpdate.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/db/routines/vn/triggers/ticket_afterUpdate.sql b/db/routines/vn/triggers/ticket_afterUpdate.sql index f1ad394ef..0ce13e0a5 100644 --- a/db/routines/vn/triggers/ticket_afterUpdate.sql +++ b/db/routines/vn/triggers/ticket_afterUpdate.sql @@ -7,6 +7,8 @@ BEGIN UPDATE expedition SET hasNewRoute = TRUE WHERE ticketFk = NEW.id; + + CALL ticket_doCmr(NEW.id); END IF; END$$ DELIMITER ; From d4f734455d3163040e5e662a2db2de44d66a2623 Mon Sep 17 00:00:00 2001 From: Jon Date: Tue, 7 May 2024 11:35:05 +0200 Subject: [PATCH 06/24] 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 2adf96cb379ded5aaf2be24be1b75e8b2fd87dae Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 7 May 2024 13:03:50 +0200 Subject: [PATCH 07/24] refactor: #6585 Deleted transaction ticket_doCmr --- db/routines/vn/procedures/ticket_doCmr.sql | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/db/routines/vn/procedures/ticket_doCmr.sql b/db/routines/vn/procedures/ticket_doCmr.sql index 61d8da5f9..40af388c7 100644 --- a/db/routines/vn/procedures/ticket_doCmr.sql +++ b/db/routines/vn/procedures/ticket_doCmr.sql @@ -7,7 +7,7 @@ BEGIN * * @param vSelf El id del ticket */ - DECLARE vCmrFk, vPreviousCmrFk, vCurrentCmrFk INT; + DECLARE vCmrFk INT; SELECT cmrFk INTO vCmrFk FROM ticket WHERE id = vSelf; @@ -44,8 +44,6 @@ BEGIN AND t.id = vSelf GROUP BY t.id; - START TRANSACTION; - IF vCmrFk THEN UPDATE cmr c JOIN tTicket t @@ -57,9 +55,7 @@ BEGIN c.supplierFk = t.supplierFk, c.ead = t.landed WHERE id = vCmrFk; - ELSE - SELECT MAX(id) INTO vPreviousCmrFk FROM cmr; - + ELSE INSERT INTO cmr ( senderInstruccions, truckPlate, @@ -70,17 +66,14 @@ BEGIN ead ) SELECT * FROM tTicket; - - SELECT MAX(id) INTO vCurrentCmrFk FROM cmr; - IF vPreviousCmrFk <> vCurrentCmrFk THEN + IF (SELECT EXISTS(SELECT * FROM tTicket)) THEN UPDATE ticket SET cmrFk = vCurrentCmrFk - WHERE id = vSelf; + WHERE id = LAST_INSERT_ID(); END IF; END IF; - COMMIT; DROP TEMPORARY TABLE tTicket; END$$ DELIMITER ; From 5e8e09cbae19a5935cdb487b0b1945fc8f8c900d Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 7 May 2024 13:42:58 +0200 Subject: [PATCH 08/24] 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 6c6ae412bd5fdfa48bbf6ae8324274b61e053399 Mon Sep 17 00:00:00 2001 From: robert Date: Tue, 7 May 2024 14:19:11 +0200 Subject: [PATCH 09/24] feat: refs #182001 packaging --- db/routines/vn/procedures/fv_pca.sql | 101 ------------------ .../11034-purpleHydrangea/00-firstScript.sql | 5 + 2 files changed, 5 insertions(+), 101 deletions(-) delete mode 100644 db/routines/vn/procedures/fv_pca.sql create mode 100644 db/versions/11034-purpleHydrangea/00-firstScript.sql diff --git a/db/routines/vn/procedures/fv_pca.sql b/db/routines/vn/procedures/fv_pca.sql deleted file mode 100644 index b8e7343ef..000000000 --- a/db/routines/vn/procedures/fv_pca.sql +++ /dev/null @@ -1,101 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`fv_pca`() -BEGIN - -DECLARE done INT DEFAULT FALSE; - -DECLARE vTicketFk INT; -DECLARE vSaleFk INT; -DECLARE vClonTicket INT DEFAULT 0; - -DECLARE cur1 CURSOR FOR -SELECT s.ticketFk, s.id - FROM vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.itemType it ON it.id = i.typeFk - WHERE t.shipped BETWEEN '2020-10-18' AND '2020-10-31' - AND it.code IN ('ANT','ANS','ORQ','TRO') - and t.warehouseFk = 1; - -DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - -OPEN cur1; - -FETCH cur1 INTO vTicketFk, vSaleFk; - - WHILE done = 0 DO - - SELECT t.id INTO vClonTicket - FROM vn.ticket t - JOIN (SELECT addressFk, shipped FROM vn.ticket WHERE id = vTicketFk) sub USING(addressFk, shipped) - WHERE t.warehouseFk = 44 - LIMIT 1; - - SELECT vTicketFk, vClonTicket; - - IF vClonTicket = 0 THEN - - INSERT INTO ticket ( - clientFk, - shipped, - addressFk, - agencyModeFk, - nickname, - warehouseFk, - companyFk, - landed, - zoneFk, - zonePrice, - zoneBonus, - routeFk - ) - SELECT - clientFk, - shipped, - addressFk, - agencyModeFk, - nickname, - 44, - companyFk, - landed, - zoneFk, - zonePrice, - zoneBonus, - routeFk - - FROM ticket - WHERE id = vTicketFk; - - SET vClonTicket = LAST_INSERT_ID(); - - SELECT 'lstID', vClonTicket; - /* - INSERT INTO ticketObservation(ticketFk, observationTypeFk, description) - SELECT vTicketFk, ao.observationTypeFk, ao.description - FROM addressObservation ao - JOIN ticket t ON t.addressFk = ao.addressFk - WHERE t.id = vClonTicket; -*/ - INSERT INTO ticketLog - SET originFk = vTicketFk, userFk = account.myUser_getId(), `action` = 'insert', - description = CONCAT('Ha creado el ticket:', ' ', vClonTicket, ' clonando el ', vTicketFk); - - END IF; - - UPDATE vn.sale - SET ticketFk = vClonTicket - WHERE id = vSaleFk; - - SET vClonTicket = 0; - - SET done = 0; - FETCH cur1 INTO vTicketFk, vSaleFk; - - END WHILE; - - CLOSE cur1; - - -END$$ -DELIMITER ; diff --git a/db/versions/11034-purpleHydrangea/00-firstScript.sql b/db/versions/11034-purpleHydrangea/00-firstScript.sql new file mode 100644 index 000000000..c8c2cc7f9 --- /dev/null +++ b/db/versions/11034-purpleHydrangea/00-firstScript.sql @@ -0,0 +1,5 @@ +-- Place your SQL code here +ALTER TABLE vn.packaging +MODIFY COLUMN height decimal(10,2) DEFAULT NULL NULL, +MODIFY COLUMN `depth` decimal(10,2) DEFAULT NULL NULL, +MODIFY COLUMN width decimal(10,2) DEFAULT NULL NULL; From f529a7f5b42f136c795a351212b0ea9355b352a0 Mon Sep 17 00:00:00 2001 From: robert Date: Tue, 7 May 2024 14:25:26 +0200 Subject: [PATCH 10/24] feat : refs #182001 --- db/routines/vn/procedures/fv_pca.sql | 101 +++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 db/routines/vn/procedures/fv_pca.sql diff --git a/db/routines/vn/procedures/fv_pca.sql b/db/routines/vn/procedures/fv_pca.sql new file mode 100644 index 000000000..d0c37acd1 --- /dev/null +++ b/db/routines/vn/procedures/fv_pca.sql @@ -0,0 +1,101 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`fv_pca`() +BEGIN + +DECLARE done INT DEFAULT FALSE; + +DECLARE vTicketFk INT; +DECLARE vSaleFk INT; +DECLARE vClonTicket INT DEFAULT 0; + +DECLARE cur1 CURSOR FOR +SELECT s.ticketFk, s.id + FROM vn.sale s + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it ON it.id = i.typeFk + WHERE t.shipped BETWEEN '2020-10-18' AND '2020-10-31' + AND it.code IN ('ANT','ANS','ORQ','TRO') + and t.warehouseFk = 1; + +DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + +OPEN cur1; + +FETCH cur1 INTO vTicketFk, vSaleFk; + + WHILE done = 0 DO + + SELECT t.id INTO vClonTicket + FROM vn.ticket t + JOIN (SELECT addressFk, shipped FROM vn.ticket WHERE id = vTicketFk) sub USING(addressFk, shipped) + WHERE t.warehouseFk = 44 + LIMIT 1; + + SELECT vTicketFk, vClonTicket; + + IF vClonTicket = 0 THEN + + INSERT INTO ticket ( + clientFk, + shipped, + addressFk, + agencyModeFk, + nickname, + warehouseFk, + companyFk, + landed, + zoneFk, + zonePrice, + zoneBonus, + routeFk + ) + SELECT + clientFk, + shipped, + addressFk, + agencyModeFk, + nickname, + 44, + companyFk, + landed, + zoneFk, + zonePrice, + zoneBonus, + routeFk + + FROM ticket + WHERE id = vTicketFk; + + SET vClonTicket = LAST_INSERT_ID(); + + SELECT 'lstID', vClonTicket; + /* + INSERT INTO ticketObservation(ticketFk, observationTypeFk, description) + SELECT vTicketFk, ao.observationTypeFk, ao.description + FROM addressObservation ao + JOIN ticket t ON t.addressFk = ao.addressFk + WHERE t.id = vClonTicket; +*/ + INSERT INTO ticketLog + SET originFk = vTicketFk, userFk = account.myUser_getId(), `action` = 'insert', + description = CONCAT('Ha creado el ticket:', ' ', vClonTicket, ' clonando el ', vTicketFk); + + END IF; + + UPDATE vn.sale + SET ticketFk = vClonTicket + WHERE id = vSaleFk; + + SET vClonTicket = 0; + + SET done = 0; + FETCH cur1 INTO vTicketFk, vSaleFk; + + END WHILE; + + CLOSE cur1; + + +END$$ +DELIMITER ; \ No newline at end of file From f70f2949ec8882247ce1e5c3aba2377c96662205 Mon Sep 17 00:00:00 2001 From: robert Date: Tue, 7 May 2024 14:30:38 +0200 Subject: [PATCH 11/24] feat: refs #182001 --- db/routines/vn/procedures/fv_pca.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/fv_pca.sql b/db/routines/vn/procedures/fv_pca.sql index d0c37acd1..b8e7343ef 100644 --- a/db/routines/vn/procedures/fv_pca.sql +++ b/db/routines/vn/procedures/fv_pca.sql @@ -98,4 +98,4 @@ FETCH cur1 INTO vTicketFk, vSaleFk; END$$ -DELIMITER ; \ No newline at end of file +DELIMITER ; From 6cde2e81700858c4fb8b8f5bb54724208c4c6ff8 Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 8 May 2024 08:48:08 +0200 Subject: [PATCH 12/24] fix: refs #6585 Requested changes --- db/routines/vn/procedures/ticket_doCmr.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/routines/vn/procedures/ticket_doCmr.sql b/db/routines/vn/procedures/ticket_doCmr.sql index 40af388c7..2da8464b4 100644 --- a/db/routines/vn/procedures/ticket_doCmr.sql +++ b/db/routines/vn/procedures/ticket_doCmr.sql @@ -69,8 +69,8 @@ BEGIN IF (SELECT EXISTS(SELECT * FROM tTicket)) THEN UPDATE ticket - SET cmrFk = vCurrentCmrFk - WHERE id = LAST_INSERT_ID(); + SET cmrFk = LAST_INSERT_ID() + WHERE id = vSelf; END IF; END IF; 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 13/24] 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 393d57f078c27a553773581acab1a25987b4507b Mon Sep 17 00:00:00 2001 From: jgallego Date: Wed, 8 May 2024 10:51:35 +0200 Subject: [PATCH 14/24] fix: #7344 getSupplierDebt agrupa por pago --- db/routines/vn/procedures/company_getSuppliersDebt.sql | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/db/routines/vn/procedures/company_getSuppliersDebt.sql b/db/routines/vn/procedures/company_getSuppliersDebt.sql index 6335ccbe3..83043f337 100644 --- a/db/routines/vn/procedures/company_getSuppliersDebt.sql +++ b/db/routines/vn/procedures/company_getSuppliersDebt.sql @@ -188,11 +188,12 @@ BEGIN FROM tPendingDuedates vp LEFT JOIN supplier s ON s.id = vp.supplierFk LEFT JOIN client c ON c.fi = s.nif - LEFT JOIN clientRisk cr ON cr.clientFk = c.id + LEFT JOIN clientRisk cr ON cr.clientFk = c.id AND cr.companyFk = vp.companyFk LEFT JOIN supplierAccount sa ON sa.supplierFk = s.id LEFT JOIN bankEntity be ON be.id = sa.bankEntityFk - LEFT JOIN country co ON co.id = be.countryFk; + LEFT JOIN country co ON co.id = be.countryFk + GROUP BY vp.id; DROP TEMPORARY TABLE tOpeningBalances; DROP TEMPORARY TABLE tPendingDuedates; From 84e90bb91b8dbe2a6f2d384b8670239ef61da033 Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 8 May 2024 12:43:46 +0200 Subject: [PATCH 15/24] hotfix: rollback tmp item_getSimilar --- db/routines/vn/procedures/item_getSimilar.sql | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/db/routines/vn/procedures/item_getSimilar.sql b/db/routines/vn/procedures/item_getSimilar.sql index 6f275de86..b0f3ca40e 100644 --- a/db/routines/vn/procedures/item_getSimilar.sql +++ b/db/routines/vn/procedures/item_getSimilar.sql @@ -21,9 +21,6 @@ BEGIN CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vDated); - -- Añadido temporalmente para ver si ya no sucede el cuelgue de db - SET vShowType = TRUE; - WITH itemTags AS ( SELECT i.id, typeFk, @@ -82,7 +79,7 @@ BEGIN AND iss.warehouseFk = vWarehouseFk JOIN itemTags its WHERE a.available > 0 - AND IF(vShowType, i.typeFk = its.typeFk, TRUE) + AND (i.typeFk = its.typeFk OR NOT vShowType) AND i.id <> vSelf ORDER BY `counter` DESC, (t.name = its.name) DESC, From 0d43d9a982af966d93a463712ec584e3dbc27f93 Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 8 May 2024 13:20:45 +0200 Subject: [PATCH 16/24] 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 53b58104c719bfe4461e47063a4f6d95933533e1 Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 8 May 2024 13:52:52 +0200 Subject: [PATCH 17/24] refactor: refs #6230 Revoke item: `size`, longName, name --- db/versions/11037-redPhormium/00-firstScript.sql | 1 + 1 file changed, 1 insertion(+) create mode 100644 db/versions/11037-redPhormium/00-firstScript.sql diff --git a/db/versions/11037-redPhormium/00-firstScript.sql b/db/versions/11037-redPhormium/00-firstScript.sql new file mode 100644 index 000000000..5492a86cd --- /dev/null +++ b/db/versions/11037-redPhormium/00-firstScript.sql @@ -0,0 +1 @@ +REVOKE UPDATE (`size`, longName, name) ON item FROM buyer; From 7d92b514c57e04b7038b130fc8eb9bf1cb1a4e83 Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 8 May 2024 13:59:37 +0200 Subject: [PATCH 18/24] refactor: refs #6230 Revoke item: `size`, longName, name --- db/versions/11037-redPhormium/00-firstScript.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/versions/11037-redPhormium/00-firstScript.sql b/db/versions/11037-redPhormium/00-firstScript.sql index 5492a86cd..fd09d31d9 100644 --- a/db/versions/11037-redPhormium/00-firstScript.sql +++ b/db/versions/11037-redPhormium/00-firstScript.sql @@ -1 +1 @@ -REVOKE UPDATE (`size`, longName, name) ON item FROM buyer; +REVOKE UPDATE (`size`, longName, name) ON vn.item FROM buyer; From 9d75ba0bc56bfe17aa8ab4c849200deff2785ce4 Mon Sep 17 00:00:00 2001 From: Jon Date: Wed, 8 May 2024 14:12:10 +0200 Subject: [PATCH 19/24] 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 20/24] 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 21/24] 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 22/24] 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 494b46e7ec175a9b3df3e6c35e32ec680b4ad5de Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 9 May 2024 11:33:57 +0200 Subject: [PATCH 23/24] fix: refs #6493 Fix buy_recalcPricesByBuy & buy_recalcPricesByEntry --- db/routines/vn/procedures/balance_create.sql | 11 ++++++----- db/routines/vn/procedures/buy_recalcPricesByBuy.sql | 6 ++++-- db/routines/vn/procedures/buy_recalcPricesByEntry.sql | 6 ++++-- db/versions/10859-pinkGerbera/00-firstScript.sql | 2 -- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/db/routines/vn/procedures/balance_create.sql b/db/routines/vn/procedures/balance_create.sql index 1b3b2162c..366707e58 100644 --- a/db/routines/vn/procedures/balance_create.sql +++ b/db/routines/vn/procedures/balance_create.sql @@ -1,10 +1,11 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`balance_create`( - IN vStartingMonth INT, - IN vEndingMonth INT, - IN vCompany INT, - IN vIsConsolidated BOOLEAN, - IN vInterGroupSalesIncluded BOOLEAN) + vStartingMonth INT, + vEndingMonth INT, + vCompany INT, + vIsConsolidated BOOLEAN, + vInterGroupSalesIncluded BOOLEAN +) BEGIN /** * Crea un balance financiero para una empresa durante diff --git a/db/routines/vn/procedures/buy_recalcPricesByBuy.sql b/db/routines/vn/procedures/buy_recalcPricesByBuy.sql index b963bae14..4fff4d313 100644 --- a/db/routines/vn/procedures/buy_recalcPricesByBuy.sql +++ b/db/routines/vn/procedures/buy_recalcPricesByBuy.sql @@ -1,11 +1,13 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_recalcPricesByBuy`(IN vBuyFk INT(11)) +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_recalcPricesByBuy`( + vBuyFk INT(11) +) BEGIN /** * Recalcula los precios de una compra * * @param vBuyFk - */ + */ DROP TEMPORARY TABLE IF EXISTS tmp.buyRecalc; CREATE TEMPORARY TABLE tmp.buyRecalc diff --git a/db/routines/vn/procedures/buy_recalcPricesByEntry.sql b/db/routines/vn/procedures/buy_recalcPricesByEntry.sql index db0fc0690..8d70d3626 100644 --- a/db/routines/vn/procedures/buy_recalcPricesByEntry.sql +++ b/db/routines/vn/procedures/buy_recalcPricesByEntry.sql @@ -1,11 +1,13 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_recalcPricesByEntry`(IN vEntryFk INT(11)) +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_recalcPricesByEntry`( + vEntryFk INT(11) +) BEGIN /** * Recalcula los precios de una entrada * * @param vEntryFk - */ + */ DROP TEMPORARY TABLE IF EXISTS tmp.buyRecalc; CREATE TEMPORARY TABLE tmp.buyRecalc diff --git a/db/versions/10859-pinkGerbera/00-firstScript.sql b/db/versions/10859-pinkGerbera/00-firstScript.sql index 1aed01319..723ddda5e 100644 --- a/db/versions/10859-pinkGerbera/00-firstScript.sql +++ b/db/versions/10859-pinkGerbera/00-firstScript.sql @@ -1,6 +1,4 @@ CREATE OR REPLACE PROCEDURE `vn`.`balance_create`() BEGIN END; -CREATE OR REPLACE PROCEDURE `vn`.`buy_recalcPricesByEntry`() BEGIN END; -CREATE OR REPLACE PROCEDURE `vn`.`buy_recalcPricesByBuy`() BEGIN END; GRANT EXECUTE ON PROCEDURE vn.balance_create TO `financialBoss`, `hrBoss`; GRANT EXECUTE ON PROCEDURE vn.buy_recalcPricesByEntry TO `buyer`, `claimManager`, `employee`; From bf0db8928610429d4f1874d392523977dec7766b Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 9 May 2024 12:02:44 +0200 Subject: [PATCH 24/24] 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;