From cf527dd8be096c0c2d828b6db3f08eec23a0debe Mon Sep 17 00:00:00 2001 From: alexandre Date: Fri, 23 Dec 2022 09:37:19 +0100 Subject: [PATCH 01/53] refs #4588 hook added --- db/changes/225201/00-lastUser.sql | 54 +++++++++++++++++++ .../entry/back/models/entry-observation.js | 26 +++++++++ modules/entry/back/models/entry.json | 8 +++ 3 files changed, 88 insertions(+) create mode 100644 db/changes/225201/00-lastUser.sql diff --git a/db/changes/225201/00-lastUser.sql b/db/changes/225201/00-lastUser.sql new file mode 100644 index 000000000..151038064 --- /dev/null +++ b/db/changes/225201/00-lastUser.sql @@ -0,0 +1,54 @@ +ALTER TABLE `vn`.`entry` ADD observationEditorFk INT(10) unsigned NULL COMMENT 'Último usuario que ha modificado el campo evaNotes'; +ALTER TABLE `vn`.`entry` ADD CONSTRAINT entry_observationEditorFk FOREIGN KEY (observationEditorFk) REFERENCES account.user(id) ON UPDATE CASCADE; + +CREATE OR REPLACE DEFINER=`root`@`localhost` +VIEW `vn2008`.`entrySource` AS +select + `e`.`gestDocFk` AS `gestdoc_id`, + `e`.`id` AS `Id_Entrada`, + `e`.`invoiceNumber` AS `invoiceNumber`, + `e`.`reference` AS `reference`, + `e`.`isExcludedFromAvailable` AS `Inventario`, + `e`.`notes` AS `observaciones`, + `e`.`isConfirmed` AS `Confirmada`, + `e`.`isOrdered` AS `Pedida`, + `e`.`isRaid` AS `Redada`, + `e`.`evaNotes` AS `notas`, + `e`.`supplierFk` AS `Id_Proveedor`, + `tr`.`shipped` AS `shipment`, + `tr`.`landed` AS `landing`, + `w2`.`name` AS `wh_in`, + `w1`.`name` AS `wh_out`, + `am`.`name` AS `Agencia`, + `e`.`commission` AS `comision`, + `tr`.`warehouseInFk` AS `warehouse_id`, + `w1`.`id` AS `warehouse_id_out`, + `e`.`isBooked` AS `anotadoencaja`, + `e`.`invoiceInFk` AS `invoiceInFk`, + `e`.`companyFk` AS `empresa_id`, + `e`.`currencyFk` AS `Id_Moneda`, + `tr`.`id` AS `TravelFk`, + `e`.`sub` AS `sub`, + `e`.`kop` AS `kop`, + `e`.`pro` AS `pro`, + `e`.`invoiceAmount` AS `invoiceAmount`, + `w`.`code` AS `buyerCode`, + `e`.`typeFk` AS `typeFk`, + `w3`.`code` AS `observationWorkerCode` +from + (((((((`vn`.`entry` `e` +left join `vn`.`travel` `tr` on + (`e`.`travelFk` = `tr`.`id`)) +left join `vn`.`agencyMode` `am` on + (`am`.`id` = `tr`.`agencyModeFk`)) +left join `vn`.`warehouse` `w1` on + (`tr`.`warehouseOutFk` = `w1`.`id`)) +left join `vn`.`warehouse` `w2` on + (`tr`.`warehouseInFk` = `w2`.`id`)) +left join `vn`.`supplier` `s` on + (`e`.`supplierFk` = `s`.`id`)) +left join `vn`.`worker` `w` on + (`w`.`id` = `e`.`buyerFk`)) +left join `vn`.`worker` `w3` on + (`w3`.`id` = `e`.`observationEditorFk`)); + diff --git a/modules/entry/back/models/entry-observation.js b/modules/entry/back/models/entry-observation.js index 77d15d85c..5a89a9e4b 100644 --- a/modules/entry/back/models/entry-observation.js +++ b/modules/entry/back/models/entry-observation.js @@ -1,4 +1,5 @@ const UserError = require('vn-loopback/util/user-error'); +const LoopBackContext = require('loopback-context'); module.exports = Self => { Self.rewriteDbError(function(err) { @@ -6,4 +7,29 @@ module.exports = Self => { return new UserError(`The observation type can't be repeated`); return err; }); + + Self.observe('before save', async function(ctx, options) { + const loopBackContext = LoopBackContext.getCurrentContext(); + const userId = loopBackContext.active.accessToken.userId; + const entryId = ctx.instance.entryFk; + let tx; + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + const entry = await Self.app.models.Entry.findOne({where: {id: entryId}}, myOptions); + await entry.updateAttribute('observationEditorFk', userId, myOptions); + if (tx) await tx.commit(); + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + }); }; diff --git a/modules/entry/back/models/entry.json b/modules/entry/back/models/entry.json index d9b7c52df..6c5e1b7d3 100644 --- a/modules/entry/back/models/entry.json +++ b/modules/entry/back/models/entry.json @@ -77,6 +77,9 @@ "companyFk": { "type": "number", "required": true + }, + "observationEditorFk": { + "type": "number" } }, "relations": { @@ -99,6 +102,11 @@ "type": "belongsTo", "model": "Currency", "foreignKey": "currencyFk" + }, + "observationEditor": { + "type": "belongsTo", + "model": "Account", + "foreignKey": "observationEditorFk" } } } From 52026376a61df33975a8df6828bc18554d084ff8 Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 13 Jan 2023 08:44:58 +0100 Subject: [PATCH 02/53] refs #4965 Added routeFk --- .../collection-label/collection-label.html | 2 +- .../collection-label/collection-label.js | 12 +++ .../collection-label/sql/labelsData.sql | 73 ++++++++++--------- 3 files changed, 50 insertions(+), 37 deletions(-) diff --git a/print/templates/reports/collection-label/collection-label.html b/print/templates/reports/collection-label/collection-label.html index 2fd77079f..a699d4ac5 100644 --- a/print/templates/reports/collection-label/collection-label.html +++ b/print/templates/reports/collection-label/collection-label.html @@ -21,7 +21,7 @@ {{labelData.code == 'V' ? (labelData.size || 0) + 'cm' : (labelData.volume || 0) + 'm³'}} -
{{labelData.agencyDescription ? labelData.agencyDescription.toUpperCase() : '---'}}
+
{{getAgencyDescripton(labelData)}}
{{labelData.lineCount || 0}} diff --git a/print/templates/reports/collection-label/collection-label.js b/print/templates/reports/collection-label/collection-label.js index e73afaeea..e7da3842f 100644 --- a/print/templates/reports/collection-label/collection-label.js +++ b/print/templates/reports/collection-label/collection-label.js @@ -61,6 +61,18 @@ module.exports = { return value; }, + getAgencyDescripton(labelData) { + let value; + if (labelData.agencyDescription) + value = labelData.agencyDescription.toUpperCase().substring(0, 11); + else + value = '---'; + + if (labelData.routeFk) + value = `${value} [${labelData.routeFk.toString().substring(0, 3)}]`; + + return value; + }, }, components: { 'report-body': reportBody.build() diff --git a/print/templates/reports/collection-label/sql/labelsData.sql b/print/templates/reports/collection-label/sql/labelsData.sql index 1846c6893..29ea36562 100644 --- a/print/templates/reports/collection-label/sql/labelsData.sql +++ b/print/templates/reports/collection-label/sql/labelsData.sql @@ -1,37 +1,38 @@ SELECT c.itemPackingTypeFk code, - tc.collectionFk, - SUBSTRING('ABCDEFGH', tc.wagon, 1) wagon, - tc.`level`, - t.id ticketFk, - COALESCE(et.description, zo.name, am.name) agencyDescription, - cc.code color, - t.clientFk, - CAST(SUM(sv.volume) AS DECIMAL(5, 2)) volume, - MAX(i.`size`) `size`, - w.code workerCode, - TIME_FORMAT(t.shipped, '%H:%i') shippedHour, - TIME_FORMAT(zo.`hour`, '%H:%i') zoneHour, - DATE_FORMAT(t.shipped, '%d/%m/%y') shipped, - tt.labelCount, - t.nickName, - COUNT(*) lineCount - FROM vn.ticket t - JOIN vn.ticketCollection tc ON tc.ticketFk = t.id - JOIN vn.collection c ON c.id = tc.collectionFk - LEFT JOIN vn.collectionColors cc ON cc.shelve = tc.`level` - AND cc.wagon = tc.wagon - AND cc.trainFk = c.trainFk - JOIN vn.sale s ON s.ticketFk = t.id - LEFT JOIN vn.saleVolume sv ON sv.saleFk = s.id - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - JOIN vn.worker w ON w.id = c.workerFk - JOIN vn.agencyMode am ON am.id = t.agencyModeFk - LEFT JOIN vn.ticketTrolley tt ON tt.ticket = t.id - LEFT JOIN vn.`zone` zo ON t.zoneFk = zo.id - LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk - LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk - WHERE t.id IN (?) - GROUP BY t.id - ORDER BY cc.`code`; \ No newline at end of file + tc.collectionFk, + SUBSTRING('ABCDEFGH', tc.wagon, 1) wagon, + tc.`level`, + t.id ticketFk, + COALESCE(et.description, zo.name, am.name) agencyDescription, + cc.code color, + t.clientFk, + CAST(SUM(sv.volume) AS DECIMAL(5, 2)) volume, + MAX(i.`size`) `size`, + w.code workerCode, + TIME_FORMAT(t.shipped, '%H:%i') shippedHour, + TIME_FORMAT(zo.`hour`, '%H:%i') zoneHour, + DATE_FORMAT(t.shipped, '%d/%m/%y') shipped, + tt.labelCount, + t.nickName, + COUNT(*) lineCount, + rm.routeFk + FROM vn.ticket t + JOIN vn.ticketCollection tc ON tc.ticketFk = t.id + JOIN vn.collection c ON c.id = tc.collectionFk + LEFT JOIN vn.collectionColors cc ON cc.shelve = tc.`level` + AND cc.wagon = tc.wagon + AND cc.trainFk = c.trainFk + JOIN vn.sale s ON s.ticketFk = t.id + LEFT JOIN vn.saleVolume sv ON sv.saleFk = s.id + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + JOIN vn.worker w ON w.id = c.workerFk + JOIN vn.agencyMode am ON am.id = t.agencyModeFk + LEFT JOIN vn.ticketTrolley tt ON tt.ticket = t.id + LEFT JOIN vn.`zone` zo ON t.zoneFk = zo.id + LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk + LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk + WHERE t.id IN (?) + GROUP BY t.id + ORDER BY cc.`code`; From 85dd7adcd8d9172a2977d6fb402739405fb4e660 Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 13 Jan 2023 08:48:33 +0100 Subject: [PATCH 03/53] refs #4965 Minor change --- print/templates/reports/collection-label/sql/labelsData.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/print/templates/reports/collection-label/sql/labelsData.sql b/print/templates/reports/collection-label/sql/labelsData.sql index 29ea36562..fef692272 100644 --- a/print/templates/reports/collection-label/sql/labelsData.sql +++ b/print/templates/reports/collection-label/sql/labelsData.sql @@ -35,4 +35,4 @@ SELECT c.itemPackingTypeFk code, LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk WHERE t.id IN (?) GROUP BY t.id - ORDER BY cc.`code`; + ORDER BY cc.`code`; \ No newline at end of file From eefafb3ac2ba7aa163beffb932d917d951b5a8ab Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 19 Jan 2023 15:14:31 +0100 Subject: [PATCH 04/53] fix: available is cero --- modules/item/back/methods/item/getSummary.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/item/back/methods/item/getSummary.js b/modules/item/back/methods/item/getSummary.js index 738976e60..0cee86955 100644 --- a/modules/item/back/methods/item/getSummary.js +++ b/modules/item/back/methods/item/getSummary.js @@ -100,7 +100,7 @@ module.exports = Self => { const userConfig = await models.UserConfig.getUserConfig(ctx, myOptions); - res = await models.Item.getVisibleAvailable(summary.item.id, userConfig.warehouseFk, null, myOptions); + res = await models.Item.getVisibleAvailable(summary.item.id, userConfig.warehouseFk, undefined, myOptions); summary.available = res.available; summary.visible = res.visible; From caf1dcd690a6d09d29817f95b4da5ce15dc774f8 Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 25 Jan 2023 15:19:33 +0100 Subject: [PATCH 05/53] =?UTF-8?q?feat:=20a=C3=B1adido=20almac=C3=A9n=20por?= =?UTF-8?q?=20defecto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/models/company.json | 6 +- modules/item/back/methods/item/getSummary.js | 4 +- modules/item/front/summary/index.html | 77 +++++++++++--------- modules/item/front/summary/locale/en.yml | 2 + modules/item/front/summary/locale/es.yml | 4 +- modules/ticket/front/summary/index.html | 60 +++++++-------- 6 files changed, 85 insertions(+), 68 deletions(-) create mode 100644 modules/item/front/summary/locale/en.yml diff --git a/back/models/company.json b/back/models/company.json index a36b43b69..6b50a1697 100644 --- a/back/models/company.json +++ b/back/models/company.json @@ -18,12 +18,14 @@ }, "expired": { "type": "date" + }, + "warehouseFk": { + "type": "number" } }, - "scope": { "where" :{ "expired": null } } -} \ No newline at end of file +} diff --git a/modules/item/back/methods/item/getSummary.js b/modules/item/back/methods/item/getSummary.js index 0cee86955..5f88ca939 100644 --- a/modules/item/back/methods/item/getSummary.js +++ b/modules/item/back/methods/item/getSummary.js @@ -99,8 +99,10 @@ module.exports = Self => { [summary.botanical] = res[2]; const userConfig = await models.UserConfig.getUserConfig(ctx, myOptions); + console.log(userConfig.warehouseFk); + const company = await models.Company.findOne({where: {code: 'VNL'}}, myOptions); - res = await models.Item.getVisibleAvailable(summary.item.id, userConfig.warehouseFk, undefined, myOptions); + res = await models.Item.getVisibleAvailable(summary.item.id, company.warehouseFk, undefined, myOptions); summary.available = res.available; summary.visible = res.visible; diff --git a/modules/item/front/summary/index.html b/modules/item/front/summary/index.html index a4d40c829..cd4d69ca3 100644 --- a/modules/item/front/summary/index.html +++ b/modules/item/front/summary/index.html @@ -11,7 +11,7 @@ @@ -20,46 +20,55 @@

Available

-

{{$ctrl.summary.available}}

-
+

{{$ctrl.summary.available}} + + +

+

- Basic data

Basic data

- - - - - - - {{$ctrl.summary.item.itemType.worker.user.name}} @@ -68,45 +77,45 @@

- Other data

Other data

- - - - - -

- Tags

-

Tags @@ -119,14 +128,14 @@

- Description

Description

@@ -136,13 +145,13 @@

- Tax

-

Tax @@ -154,33 +163,33 @@

- Botanical

-

Botanical

- -

- Barcode

-

Barcode @@ -191,6 +200,6 @@ - - \ No newline at end of file + diff --git a/modules/item/front/summary/locale/en.yml b/modules/item/front/summary/locale/en.yml new file mode 100644 index 000000000..79c19a94d --- /dev/null +++ b/modules/item/front/summary/locale/en.yml @@ -0,0 +1,2 @@ +WarehouseFk: > + Calculated on the warehouse of {{ name }} diff --git a/modules/item/front/summary/locale/es.yml b/modules/item/front/summary/locale/es.yml index a87a04857..709d22efd 100644 --- a/modules/item/front/summary/locale/es.yml +++ b/modules/item/front/summary/locale/es.yml @@ -1,3 +1,5 @@ Barcode: Códigos de barras Other data: Otros datos -Go to the item: Ir al artículo \ No newline at end of file +Go to the item: Ir al artículo +WarehouseFk: > + Calculado sobre el almacén de {{ name }} diff --git a/modules/ticket/front/summary/index.html b/modules/ticket/front/summary/index.html index fe49a301f..6565b7195 100644 --- a/modules/ticket/front/summary/index.html +++ b/modules/ticket/front/summary/index.html @@ -1,6 +1,6 @@
- - Ticket #{{$ctrl.summary.id}} - {{$ctrl.summary.client.name}} + Ticket #{{$ctrl.summary.id}} - {{$ctrl.summary.client.name}} ({{$ctrl.summary.client.id}}) - {{$ctrl.summary.nickname}} - -
- - {{$ctrl.summary.client.salesPersonUser.name}} - @@ -47,11 +47,11 @@ {{$ctrl.summary.zone.name}} - - {{$ctrl.summary.routeFk}} @@ -66,17 +66,17 @@ - - -

- Sale @@ -146,13 +146,13 @@ vn-tooltip="{{::$ctrl.$t('Claim')}}: {{::sale.claimBeginning.claimFk}}"> - - @@ -170,22 +170,22 @@ - {{sale.itemFk | zeroFill:6}} - {{::sale.visible}} - {{::sale.available}} @@ -216,7 +216,7 @@

- Packages @@ -241,7 +241,7 @@

- Service @@ -276,7 +276,7 @@

- Purchase request @@ -304,7 +304,7 @@ {{::request.quantity}} {{::request.price}} - @@ -336,9 +336,9 @@ - - - \ No newline at end of file + From 366748a13686b421f6699bd3f943e70255aad83c Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 26 Jan 2023 14:00:29 +0100 Subject: [PATCH 06/53] fix: se la pasa la fecha shipped para calcular el visible y disponible --- modules/ticket/front/sale/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index 97f6a2a81..527f55b23 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -130,7 +130,7 @@ + ng-click="itemDescriptor.show($event, sale.itemFk, sale.id, $ctrl.ticket.shipped)"> {{sale.itemFk}} Date: Tue, 31 Jan 2023 09:28:28 +0100 Subject: [PATCH 07/53] =?UTF-8?q?feat:=20el=20descriptor=20coge=20el=20war?= =?UTF-8?q?ehouseFk=20dependiendo=20de=20la=20secci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/item/back/methods/item/getSummary.js | 4 ++-- modules/item/front/card/index.html | 4 ++-- modules/item/front/card/index.js | 6 ++++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/modules/item/back/methods/item/getSummary.js b/modules/item/back/methods/item/getSummary.js index 5f88ca939..216093bf1 100644 --- a/modules/item/back/methods/item/getSummary.js +++ b/modules/item/back/methods/item/getSummary.js @@ -101,8 +101,8 @@ module.exports = Self => { const userConfig = await models.UserConfig.getUserConfig(ctx, myOptions); console.log(userConfig.warehouseFk); const company = await models.Company.findOne({where: {code: 'VNL'}}, myOptions); - - res = await models.Item.getVisibleAvailable(summary.item.id, company.warehouseFk, undefined, myOptions); + console.log(company.warehouseFk); + res = await models.Item.getVisibleAvailable(summary.item.id, 1, undefined, myOptions); summary.available = res.available; summary.visible = res.visible; diff --git a/modules/item/front/card/index.html b/modules/item/front/card/index.html index e92e1696d..f141649eb 100644 --- a/modules/item/front/card/index.html +++ b/modules/item/front/card/index.html @@ -1,6 +1,6 @@ - diff --git a/modules/item/front/card/index.js b/modules/item/front/card/index.js index 8b32e030b..ca150e880 100644 --- a/modules/item/front/card/index.js +++ b/modules/item/front/card/index.js @@ -2,6 +2,12 @@ import ngModule from '../module'; import ModuleCard from 'salix/components/module-card'; class Controller extends ModuleCard { + getWarehouseFk() { + if (this.$state.getCurrentPath()[4].state.name === 'item.card.diary') + return this.$params.warehouseFk; + return this.vnConfig.warehouseFk; + } + reload() { this.$http.get(`Items/${this.$params.id}/getCard`) .then(res => this.item = res.data); From ba5616055b38b905c9f2bc249a7608d3665fa505 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 3 Feb 2023 14:31:50 +0100 Subject: [PATCH 08/53] feat: item.descriptor en summary coge el warehouse por defecto --- back/models/company.json | 3 --- db/changes/230601/00-itemConfig_warehouseFk.sql | 4 ++++ modules/item/back/methods/item/getSummary.js | 8 +++----- modules/item/back/models/item-config.json | 3 +++ modules/item/front/card/index.html | 2 +- modules/item/front/card/index.js | 13 ++++++++++--- 6 files changed, 21 insertions(+), 12 deletions(-) create mode 100644 db/changes/230601/00-itemConfig_warehouseFk.sql diff --git a/back/models/company.json b/back/models/company.json index 6b50a1697..f16c5762f 100644 --- a/back/models/company.json +++ b/back/models/company.json @@ -18,9 +18,6 @@ }, "expired": { "type": "date" - }, - "warehouseFk": { - "type": "number" } }, "scope": { diff --git a/db/changes/230601/00-itemConfig_warehouseFk.sql b/db/changes/230601/00-itemConfig_warehouseFk.sql new file mode 100644 index 000000000..c860986d6 --- /dev/null +++ b/db/changes/230601/00-itemConfig_warehouseFk.sql @@ -0,0 +1,4 @@ +ALTER TABLE `vn`.`itemConfig` ADD warehouseFk smallint(6) unsigned NULL; +UPDATE `vn`.`itemConfig` + SET warehouseFk=60 +WHERE id=0; diff --git a/modules/item/back/methods/item/getSummary.js b/modules/item/back/methods/item/getSummary.js index 216093bf1..a74fab359 100644 --- a/modules/item/back/methods/item/getSummary.js +++ b/modules/item/back/methods/item/getSummary.js @@ -98,11 +98,9 @@ module.exports = Self => { summary.tags = res[1]; [summary.botanical] = res[2]; - const userConfig = await models.UserConfig.getUserConfig(ctx, myOptions); - console.log(userConfig.warehouseFk); - const company = await models.Company.findOne({where: {code: 'VNL'}}, myOptions); - console.log(company.warehouseFk); - res = await models.Item.getVisibleAvailable(summary.item.id, 1, undefined, myOptions); + const itemConfig = await models.ItemConfig.findOne({where: {code: 'VNL'}}, myOptions); + + res = await models.Item.getVisibleAvailable(summary.item.id, itemConfig.warehouseFk, undefined, myOptions); summary.available = res.available; summary.visible = res.visible; diff --git a/modules/item/back/models/item-config.json b/modules/item/back/models/item-config.json index 36d25e0bb..c7a0b2644 100644 --- a/modules/item/back/models/item-config.json +++ b/modules/item/back/models/item-config.json @@ -25,6 +25,9 @@ }, "defaultTag": { "type": "int" + }, + "warehouseFk": { + "type": "int" } }, "relations": { diff --git a/modules/item/front/card/index.html b/modules/item/front/card/index.html index f141649eb..330d274c0 100644 --- a/modules/item/front/card/index.html +++ b/modules/item/front/card/index.html @@ -1,6 +1,6 @@ diff --git a/modules/item/front/card/index.js b/modules/item/front/card/index.js index ca150e880..ba9e18c0b 100644 --- a/modules/item/front/card/index.js +++ b/modules/item/front/card/index.js @@ -3,14 +3,21 @@ import ModuleCard from 'salix/components/module-card'; class Controller extends ModuleCard { getWarehouseFk() { - if (this.$state.getCurrentPath()[4].state.name === 'item.card.diary') - return this.$params.warehouseFk; - return this.vnConfig.warehouseFk; + if (this.$state.getCurrentPath()[4].state.name === 'item.card.diary') { + this.warehouseFk = this.$params.warehouseFk; + return; + } + this.$http.get('ItemConfigs/findOne') + .then(res => { + this.warehouseFk = res.data.warehouseFk; + }); } reload() { this.$http.get(`Items/${this.$params.id}/getCard`) .then(res => this.item = res.data); + + this.getWarehouseFk(); } } From 4f76465246576260c8ebe0a0a2bc7fed57252402 Mon Sep 17 00:00:00 2001 From: vicent Date: Mon, 6 Feb 2023 12:24:26 +0100 Subject: [PATCH 09/53] fix: no recarga cada vez --- db/dump/fixtures.sql | 4 ++-- modules/item/front/card/index.html | 2 +- modules/item/front/card/index.js | 11 ++++------- modules/item/front/descriptor/index.js | 2 +- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index bb4f00ff5..e03619aae 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -2718,9 +2718,9 @@ INSERT INTO `vn`.`collection` (`id`, `created`, `workerFk`, `stateFk`, `itemPack VALUES (3, util.VN_NOW(), 1107, 5, NULL, 0, 0, 1, NULL, NULL); -INSERT INTO `vn`.`itemConfig` (`id`, `isItemTagTriggerDisabled`, `monthToDeactivate`, `wasteRecipients`, `validPriorities`, `defaultPriority`, `defaultTag`) +INSERT INTO `vn`.`itemConfig` (`id`, `isItemTagTriggerDisabled`, `monthToDeactivate`, `wasteRecipients`, `validPriorities`, `defaultPriority`, `defaultTag`, `warehouseFk`) VALUES - (0, 0, 24, '', '[1,2,3]', 2, 56); + (0, 0, 24, '', '[1,2,3]', 2, 56, 60); INSERT INTO `vn`.`ticketCollection` (`ticketFk`, `collectionFk`, `created`, `level`, `wagon`, `smartTagFk`, `usedShelves`, `itemCount`, `liters`) VALUES diff --git a/modules/item/front/card/index.html b/modules/item/front/card/index.html index 330d274c0..f141649eb 100644 --- a/modules/item/front/card/index.html +++ b/modules/item/front/card/index.html @@ -1,6 +1,6 @@ diff --git a/modules/item/front/card/index.js b/modules/item/front/card/index.js index ba9e18c0b..8ff9e2da6 100644 --- a/modules/item/front/card/index.js +++ b/modules/item/front/card/index.js @@ -3,21 +3,18 @@ import ModuleCard from 'salix/components/module-card'; class Controller extends ModuleCard { getWarehouseFk() { - if (this.$state.getCurrentPath()[4].state.name === 'item.card.diary') { - this.warehouseFk = this.$params.warehouseFk; - return; - } + if (this.$state.getCurrentPath()[4].state.name === 'item.card.diary') + return this.$params.warehouseFk; + this.$http.get('ItemConfigs/findOne') .then(res => { - this.warehouseFk = res.data.warehouseFk; + return res.data.warehouseFk; }); } reload() { this.$http.get(`Items/${this.$params.id}/getCard`) .then(res => this.item = res.data); - - this.getWarehouseFk(); } } diff --git a/modules/item/front/descriptor/index.js b/modules/item/front/descriptor/index.js index 133b11b48..61c8e7464 100644 --- a/modules/item/front/descriptor/index.js +++ b/modules/item/front/descriptor/index.js @@ -100,6 +100,6 @@ ngModule.vnComponent('vnItemDescriptor', { item: '<', dated: '<', cardReload: '&', - warehouseFk: ' Date: Mon, 6 Feb 2023 12:26:54 +0100 Subject: [PATCH 10/53] sql version updated --- db/changes/230601/.gitkeep | 0 db/changes/{225201 => 230601}/00-lastUser.sql | 0 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 db/changes/230601/.gitkeep rename db/changes/{225201 => 230601}/00-lastUser.sql (100%) diff --git a/db/changes/230601/.gitkeep b/db/changes/230601/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/db/changes/225201/00-lastUser.sql b/db/changes/230601/00-lastUser.sql similarity index 100% rename from db/changes/225201/00-lastUser.sql rename to db/changes/230601/00-lastUser.sql From d3564209ba9f26d88dcbfbdcf17f499e435916fb Mon Sep 17 00:00:00 2001 From: alexandre Date: Tue, 7 Feb 2023 08:05:48 +0100 Subject: [PATCH 11/53] findById --- modules/entry/back/models/entry-observation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/entry/back/models/entry-observation.js b/modules/entry/back/models/entry-observation.js index 5a89a9e4b..f4782a733 100644 --- a/modules/entry/back/models/entry-observation.js +++ b/modules/entry/back/models/entry-observation.js @@ -24,7 +24,7 @@ module.exports = Self => { } try { - const entry = await Self.app.models.Entry.findOne({where: {id: entryId}}, myOptions); + const entry = await Self.app.models.Entry.findById(entryId, null, myOptions); await entry.updateAttribute('observationEditorFk', userId, myOptions); if (tx) await tx.commit(); } catch (e) { From 6cb3930be0ab14938f81034ddb4a1e143f11a293 Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 7 Feb 2023 13:40:39 +0100 Subject: [PATCH 12/53] =?UTF-8?q?feat:=20a=C3=B1adido=20icono=20info,=20qu?= =?UTF-8?q?e=20indica=20de=20que=20almac=C3=A9n=20se=20saca=20la=20informa?= =?UTF-8?q?ci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/item/front/card/index.html | 2 +- modules/item/front/card/index.js | 10 ------- modules/item/front/descriptor/index.html | 36 +++++++++++++++--------- modules/item/front/descriptor/index.js | 21 +++++++++++++- modules/item/front/diary/index.js | 4 +++ modules/item/front/summary/index.html | 13 +++++---- modules/item/front/summary/index.js | 21 ++++++++++++++ modules/item/front/summary/locale/en.yml | 3 +- modules/item/front/summary/locale/es.yml | 3 +- modules/item/front/summary/style.scss | 8 ++++-- 10 files changed, 84 insertions(+), 37 deletions(-) diff --git a/modules/item/front/card/index.html b/modules/item/front/card/index.html index f141649eb..330d274c0 100644 --- a/modules/item/front/card/index.html +++ b/modules/item/front/card/index.html @@ -1,6 +1,6 @@ diff --git a/modules/item/front/card/index.js b/modules/item/front/card/index.js index 8ff9e2da6..8b32e030b 100644 --- a/modules/item/front/card/index.js +++ b/modules/item/front/card/index.js @@ -2,16 +2,6 @@ import ngModule from '../module'; import ModuleCard from 'salix/components/module-card'; class Controller extends ModuleCard { - getWarehouseFk() { - if (this.$state.getCurrentPath()[4].state.name === 'item.card.diary') - return this.$params.warehouseFk; - - this.$http.get('ItemConfigs/findOne') - .then(res => { - return res.data.warehouseFk; - }); - } - reload() { this.$http.get(`Items/${this.$params.id}/getCard`) .then(res => this.item = res.data); diff --git a/modules/item/front/descriptor/index.html b/modules/item/front/descriptor/index.html index 321545b38..8e85e043f 100644 --- a/modules/item/front/descriptor/index.html +++ b/modules/item/front/descriptor/index.html @@ -19,7 +19,7 @@
Available

{{$ctrl.available | dashIfEmpty}}

+ +

+ + +

+
- {{$ctrl.item.itemType.worker.user.name}} @@ -50,22 +60,22 @@
@@ -112,7 +122,7 @@ question="Do you want to clone this item?" message="All it's properties will be copied"> - @@ -120,7 +130,7 @@ - - \ No newline at end of file + diff --git a/modules/item/front/descriptor/index.js b/modules/item/front/descriptor/index.js index 61c8e7464..0acc7c8f6 100644 --- a/modules/item/front/descriptor/index.js +++ b/modules/item/front/descriptor/index.js @@ -30,7 +30,10 @@ class Controller extends Descriptor { set warehouseFk(value) { this._warehouseFk = value; - if (value) this.updateStock(); + if (value) { + this.updateStock(); + this.getWarehouseName(value); + } } loadData() { @@ -89,6 +92,22 @@ class Controller extends Descriptor { this.$.photo.setAttribute('src', newSrc); this.$.photo.setAttribute('zoom-image', newZoomSrc); } + + getWarehouseName(warehouseFk) { + this.showIcon = false; + + const filter = { + where: {id: warehouseFk} + }; + this.$http.get('Warehouses/findOne', {filter}) + .then(res => { + this.warehouseText = this.$t('WarehouseFk', { + warehouseName: res.data.name + }); + + this.showIcon = true; + }); + } } Controller.$inject = ['$element', '$scope', '$rootScope']; diff --git a/modules/item/front/diary/index.js b/modules/item/front/diary/index.js index c997ea491..cc965a76e 100644 --- a/modules/item/front/diary/index.js +++ b/modules/item/front/diary/index.js @@ -37,6 +37,7 @@ class Controller extends Section { set warehouseFk(value) { if (value && value != this._warehouseFk) { this._warehouseFk = value; + this.card.warehouseFk = value; this.$state.go(this.$state.current.name, { warehouseFk: value @@ -76,5 +77,8 @@ ngModule.vnComponent('vnItemDiary', { controller: Controller, bindings: { item: '<' + }, + require: { + card: '?^vnItemCard' } }); diff --git a/modules/item/front/summary/index.html b/modules/item/front/summary/index.html index cd4d69ca3..40e9c5aa7 100644 --- a/modules/item/front/summary/index.html +++ b/modules/item/front/summary/index.html @@ -20,17 +20,18 @@

Available

-

{{$ctrl.summary.available}} +

{{$ctrl.summary.available}}

+
+ +

- +
diff --git a/modules/item/front/summary/index.js b/modules/item/front/summary/index.js index 52753ff65..3d2517110 100644 --- a/modules/item/front/summary/index.js +++ b/modules/item/front/summary/index.js @@ -7,6 +7,24 @@ class Controller extends Summary { this.$http.get(`Items/${this.item.id}/getSummary`).then(response => { this.summary = response.data; }); + + this.$http.get('ItemConfigs/findOne') + .then(res => { + this.card.warehouseFk = res.data.warehouseFk; + this.getWarehouseName(this.card.warehouseFk); + }); + } + + getWarehouseName(warehouseFk) { + const filter = { + where: {id: warehouseFk} + }; + this.$http.get('Warehouses/findOne', {filter}) + .then(res => { + this.warehouseText = this.$t('WarehouseFk', { + warehouseName: res.data.name + }); + }); } $onChanges() { @@ -37,4 +55,7 @@ ngModule.vnComponent('vnItemSummary', { bindings: { item: '<', }, + require: { + card: '?^vnItemCard' + } }); diff --git a/modules/item/front/summary/locale/en.yml b/modules/item/front/summary/locale/en.yml index 79c19a94d..0ec208720 100644 --- a/modules/item/front/summary/locale/en.yml +++ b/modules/item/front/summary/locale/en.yml @@ -1,2 +1 @@ -WarehouseFk: > - Calculated on the warehouse of {{ name }} +WarehouseFk: Calculated on the warehouse of {{ warehouseName }} diff --git a/modules/item/front/summary/locale/es.yml b/modules/item/front/summary/locale/es.yml index 709d22efd..2e78841ae 100644 --- a/modules/item/front/summary/locale/es.yml +++ b/modules/item/front/summary/locale/es.yml @@ -1,5 +1,4 @@ Barcode: Códigos de barras Other data: Otros datos Go to the item: Ir al artículo -WarehouseFk: > - Calculado sobre el almacén de {{ name }} +WarehouseFk: Calculado sobre el almacén de {{ warehouseName }} diff --git a/modules/item/front/summary/style.scss b/modules/item/front/summary/style.scss index 7d5e3b609..d047f3e36 100644 --- a/modules/item/front/summary/style.scss +++ b/modules/item/front/summary/style.scss @@ -29,7 +29,11 @@ vn-item-summary { padding: 0; &:nth-child(1) { - border-right: 1px solid white; + border-right: 1px solid white; + } + + &:nth-child(2) { + border-right: 1px solid white; } } -} \ No newline at end of file +} From 549d530690a4db07ca91122fff695615f6f81c2b Mon Sep 17 00:00:00 2001 From: alexandre Date: Wed, 8 Feb 2023 07:35:52 +0100 Subject: [PATCH 13/53] . --- db/changes/230601/00-lastUser.sql | 54 ------------------------------- 1 file changed, 54 deletions(-) delete mode 100644 db/changes/230601/00-lastUser.sql diff --git a/db/changes/230601/00-lastUser.sql b/db/changes/230601/00-lastUser.sql deleted file mode 100644 index 151038064..000000000 --- a/db/changes/230601/00-lastUser.sql +++ /dev/null @@ -1,54 +0,0 @@ -ALTER TABLE `vn`.`entry` ADD observationEditorFk INT(10) unsigned NULL COMMENT 'Último usuario que ha modificado el campo evaNotes'; -ALTER TABLE `vn`.`entry` ADD CONSTRAINT entry_observationEditorFk FOREIGN KEY (observationEditorFk) REFERENCES account.user(id) ON UPDATE CASCADE; - -CREATE OR REPLACE DEFINER=`root`@`localhost` -VIEW `vn2008`.`entrySource` AS -select - `e`.`gestDocFk` AS `gestdoc_id`, - `e`.`id` AS `Id_Entrada`, - `e`.`invoiceNumber` AS `invoiceNumber`, - `e`.`reference` AS `reference`, - `e`.`isExcludedFromAvailable` AS `Inventario`, - `e`.`notes` AS `observaciones`, - `e`.`isConfirmed` AS `Confirmada`, - `e`.`isOrdered` AS `Pedida`, - `e`.`isRaid` AS `Redada`, - `e`.`evaNotes` AS `notas`, - `e`.`supplierFk` AS `Id_Proveedor`, - `tr`.`shipped` AS `shipment`, - `tr`.`landed` AS `landing`, - `w2`.`name` AS `wh_in`, - `w1`.`name` AS `wh_out`, - `am`.`name` AS `Agencia`, - `e`.`commission` AS `comision`, - `tr`.`warehouseInFk` AS `warehouse_id`, - `w1`.`id` AS `warehouse_id_out`, - `e`.`isBooked` AS `anotadoencaja`, - `e`.`invoiceInFk` AS `invoiceInFk`, - `e`.`companyFk` AS `empresa_id`, - `e`.`currencyFk` AS `Id_Moneda`, - `tr`.`id` AS `TravelFk`, - `e`.`sub` AS `sub`, - `e`.`kop` AS `kop`, - `e`.`pro` AS `pro`, - `e`.`invoiceAmount` AS `invoiceAmount`, - `w`.`code` AS `buyerCode`, - `e`.`typeFk` AS `typeFk`, - `w3`.`code` AS `observationWorkerCode` -from - (((((((`vn`.`entry` `e` -left join `vn`.`travel` `tr` on - (`e`.`travelFk` = `tr`.`id`)) -left join `vn`.`agencyMode` `am` on - (`am`.`id` = `tr`.`agencyModeFk`)) -left join `vn`.`warehouse` `w1` on - (`tr`.`warehouseOutFk` = `w1`.`id`)) -left join `vn`.`warehouse` `w2` on - (`tr`.`warehouseInFk` = `w2`.`id`)) -left join `vn`.`supplier` `s` on - (`e`.`supplierFk` = `s`.`id`)) -left join `vn`.`worker` `w` on - (`w`.`id` = `e`.`buyerFk`)) -left join `vn`.`worker` `w3` on - (`w3`.`id` = `e`.`observationEditorFk`)); - From b70311999d72236cb1da6c45ad84c47e3cfa650d Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 8 Feb 2023 09:41:09 +0100 Subject: [PATCH 14/53] =?UTF-8?q?refactor:=20eliminado=20codigo=20innecesa?= =?UTF-8?q?rio=20y=20quitado=20update=20que=20se=20har=C3=A1=20directament?= =?UTF-8?q?e=20en=20producci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/changes/230601/00-itemConfig_warehouseFk.sql | 3 --- modules/item/back/methods/item/getSummary.js | 3 +-- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/db/changes/230601/00-itemConfig_warehouseFk.sql b/db/changes/230601/00-itemConfig_warehouseFk.sql index c860986d6..b2e11146d 100644 --- a/db/changes/230601/00-itemConfig_warehouseFk.sql +++ b/db/changes/230601/00-itemConfig_warehouseFk.sql @@ -1,4 +1 @@ ALTER TABLE `vn`.`itemConfig` ADD warehouseFk smallint(6) unsigned NULL; -UPDATE `vn`.`itemConfig` - SET warehouseFk=60 -WHERE id=0; diff --git a/modules/item/back/methods/item/getSummary.js b/modules/item/back/methods/item/getSummary.js index a74fab359..6cd9d9511 100644 --- a/modules/item/back/methods/item/getSummary.js +++ b/modules/item/back/methods/item/getSummary.js @@ -98,8 +98,7 @@ module.exports = Self => { summary.tags = res[1]; [summary.botanical] = res[2]; - const itemConfig = await models.ItemConfig.findOne({where: {code: 'VNL'}}, myOptions); - + const itemConfig = await models.ItemConfig.findOne(null, myOptions); res = await models.Item.getVisibleAvailable(summary.item.id, itemConfig.warehouseFk, undefined, myOptions); summary.available = res.available; From 4413c8828ba423685d3d97c1c49a8ecdc8acb731 Mon Sep 17 00:00:00 2001 From: alexandre Date: Wed, 8 Feb 2023 10:54:21 +0100 Subject: [PATCH 15/53] refs #5152 added confirmation popup --- CHANGELOG.md | 2 +- modules/ticket/back/locale/ticket/es.yml | 2 ++ .../ticket/back/methods/ticket/componentUpdate.js | 5 +++++ .../ticket/front/basic-data/step-two/index.html | 14 ++++++++++---- modules/ticket/front/basic-data/step-two/index.js | 14 +++++++++++++- .../ticket/front/basic-data/step-two/locale/es.yml | 4 +++- 6 files changed, 34 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6533a84ed..ea4725448 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [2306.01] - 2023-02-23 ### Added -- +- (Tickets -> Datos Básicos) Mensaje de confirmación al intentar generar tickets con negativos ### Changed - (General -> Inicio) Ahora permite recuperar la contraseña tanto con el correo de recuperación como el usuario diff --git a/modules/ticket/back/locale/ticket/es.yml b/modules/ticket/back/locale/ticket/es.yml index 2c524a74f..15b5a39bf 100644 --- a/modules/ticket/back/locale/ticket/es.yml +++ b/modules/ticket/back/locale/ticket/es.yml @@ -21,3 +21,5 @@ companyFk: empresa agencyModeFk: agencia ticketFk: ticket mergedTicket: ticket fusionado +withWarningAccept: aviso negativos +isWithoutNegatives: sin negativos diff --git a/modules/ticket/back/methods/ticket/componentUpdate.js b/modules/ticket/back/methods/ticket/componentUpdate.js index f4a4bb98d..94b91e237 100644 --- a/modules/ticket/back/methods/ticket/componentUpdate.js +++ b/modules/ticket/back/methods/ticket/componentUpdate.js @@ -83,6 +83,11 @@ module.exports = Self => { type: 'boolean', description: 'Is whithout negatives', required: true + }, + { + arg: 'withWarningAccept', + type: 'boolean', + description: 'Has pressed in confirm message', }], returns: { type: ['object'], diff --git a/modules/ticket/front/basic-data/step-two/index.html b/modules/ticket/front/basic-data/step-two/index.html index 6be455fc9..ad0c49dbb 100644 --- a/modules/ticket/front/basic-data/step-two/index.html +++ b/modules/ticket/front/basic-data/step-two/index.html @@ -40,7 +40,7 @@ - {{::sale.movable}} @@ -64,14 +64,14 @@
-
Total
+
Total
Price {{$ctrl.totalPrice | currency: 'EUR': 2}}
New price {{$ctrl.totalNewPrice | currency: 'EUR': 2}}
Difference {{$ctrl.totalPriceDifference | currency: 'EUR': 2}}
-
Charge difference to
+
Charge difference to
- @@ -95,4 +95,10 @@ warehouse-fk="$ctrl.ticket.warehouseFk" ticket-fk="$ctrl.ticket.id"> + + diff --git a/modules/ticket/front/basic-data/step-two/index.js b/modules/ticket/front/basic-data/step-two/index.js index 4ac9f292e..74e2df074 100644 --- a/modules/ticket/front/basic-data/step-two/index.js +++ b/modules/ticket/front/basic-data/step-two/index.js @@ -83,6 +83,17 @@ class Controller extends Component { } onSubmit() { + if (this.haveNegatives && !this.ticket.withoutNegatives) + this.$.negativesConfirm.show(); + else this.applyChanges(); + } + + onConfirmAccept() { + this.ticket.withWarningAccept = true; + this.applyChanges(); + } + + applyChanges() { if (!this.ticket.option) { return this.vnApp.showError( this.$t('Choose an option') @@ -102,7 +113,8 @@ class Controller extends Component { landed: this.ticket.landed, isDeleted: this.ticket.isDeleted, option: parseInt(this.ticket.option), - isWithoutNegatives: this.ticket.withoutNegatives + isWithoutNegatives: this.ticket.withoutNegatives, + withWarningAccept: this.ticket.withWarningAccept }; this.$http.post(query, params) diff --git a/modules/ticket/front/basic-data/step-two/locale/es.yml b/modules/ticket/front/basic-data/step-two/locale/es.yml index e1f1e0bfc..71f893e1e 100644 --- a/modules/ticket/front/basic-data/step-two/locale/es.yml +++ b/modules/ticket/front/basic-data/step-two/locale/es.yml @@ -8,4 +8,6 @@ New price: Nuevo precio Price difference: Diferencia de precio Create without negatives: Crear sin negativos Clone this ticket with the changes and only sales availables: Clona este ticket con los cambios y solo las ventas disponibles. -Movable: Movible \ No newline at end of file +Movable: Movible +Negatives are going to be generated, are you sure you want to advance all the lines?: Se van a generar negativos, ¿seguro que quieres adelantar todas las líneas? +Edit basic data: Editar datos básicos From b209ecb011eb42a1514557419a9231374e3b0ad2 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 8 Feb 2023 10:56:51 +0100 Subject: [PATCH 16/53] feat: create post route for debug --- loopback/common/methods/application/post.js | 17 +++++++++++++++++ loopback/common/models/application.js | 1 + loopback/common/models/application.json | 8 +++++++- 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 loopback/common/methods/application/post.js diff --git a/loopback/common/methods/application/post.js b/loopback/common/methods/application/post.js new file mode 100644 index 000000000..9ea9a7f71 --- /dev/null +++ b/loopback/common/methods/application/post.js @@ -0,0 +1,17 @@ +module.exports = Self => { + Self.remoteMethodCtx('post', { + description: 'Returns the sent parameters', + returns: { + type: 'object', + root: true + }, + http: { + path: `/post`, + verb: 'POST' + } + }); + + Self.post = async ctx => { + return ctx.req.body; + }; +}; diff --git a/loopback/common/models/application.js b/loopback/common/models/application.js index ff7599fac..5e767fdc1 100644 --- a/loopback/common/models/application.js +++ b/loopback/common/models/application.js @@ -1,4 +1,5 @@ module.exports = function(Self) { require('../methods/application/status')(Self); + require('../methods/application/post')(Self); }; diff --git a/loopback/common/models/application.json b/loopback/common/models/application.json index 0bb489720..bc72df315 100644 --- a/loopback/common/models/application.json +++ b/loopback/common/models/application.json @@ -7,6 +7,12 @@ "principalType": "ROLE", "principalId": "$everyone", "permission": "ALLOW" - } + }, + { + "property": "post", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + } ] } From 0529d56d4ec3947aa64b45a005501498b5862d96 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 9 Feb 2023 13:30:52 +0100 Subject: [PATCH 17/53] fix(delivery-note_report): fix taxes --- print/templates/reports/delivery-note/delivery-note.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/print/templates/reports/delivery-note/delivery-note.js b/print/templates/reports/delivery-note/delivery-note.js index d9544a58c..50d5720ad 100755 --- a/print/templates/reports/delivery-note/delivery-note.js +++ b/print/templates/reports/delivery-note/delivery-note.js @@ -13,7 +13,7 @@ module.exports = { this.sales = await this.rawSqlFromDef('sales', [this.id]); this.address = await this.findOneFromDef(`address`, [this.id]); this.services = await this.rawSqlFromDef('services', [this.id]); - this.taxes = await this.rawSqlFromDef('taxes', [this.id]); + this.taxes = await this.findOneFromDef('taxes', [this.id]); this.packagings = await this.rawSqlFromDef('packagings', [this.id]); this.signature = await this.findOneFromDef('signature', [this.id]); }, From 194069c0c2911472f3cf55e7869fca4ec1cee9a1 Mon Sep 17 00:00:00 2001 From: alexandre Date: Fri, 10 Feb 2023 08:46:54 +0100 Subject: [PATCH 18/53] refs #5194 fixed stock, lines --- db/dump/fixtures.sql | 7 +- .../item/specs/getVisibleAvailable.spec.js | 2 +- modules/item/front/last-entries/index.html | 44 +++---- .../back/methods/ticket/getTicketsAdvance.js | 32 ++--- .../ticket/specs/getTicketsAdvance.spec.js | 16 +-- .../ticket/specs/priceDifference.spec.js | 2 +- .../front/advance-search-panel/index.html | 28 +---- .../front/advance-search-panel/locale/es.yml | 1 + modules/ticket/front/advance/index.html | 112 ++++++++++-------- modules/ticket/front/advance/index.js | 31 ++++- modules/ticket/front/advance/locale/es.yml | 4 + modules/ticket/front/future/index.html | 2 +- modules/ticket/front/future/index.js | 14 ++- 13 files changed, 165 insertions(+), 130 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index ece33f813..b62220a68 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -691,7 +691,8 @@ INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeF (28, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE()), (29, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE()), (30, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE()), - (31, 1, 8, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 2 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE()); + (31, 1, 8, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 2 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE()), + (32, 1, 8, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 2 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE()); INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `description`) VALUES @@ -993,7 +994,9 @@ INSERT INTO `vn`.`sale`(`id`, `itemFk`, `ticketFk`, `concept`, `quantity`, `pric (34, 4, 28, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()), (35, 4, 29, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()), (36, 4, 30, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()), - (37, 4, 31, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()); + (37, 4, 31, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()), + (38, 2, 32, 'Melee weapon combat fist 15cm', 30, 7.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH)), + (39, 1, 32, 'Ranged weapon longbow 2m', 2, 103.49, 0, 0, 0, util.VN_CURDATE()); INSERT INTO `vn`.`saleChecked`(`saleFk`, `isChecked`) VALUES diff --git a/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js b/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js index 8e4864ee8..e5f7bb81b 100644 --- a/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js +++ b/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js @@ -12,7 +12,7 @@ describe('item getVisibleAvailable()', () => { const result = await models.Item.getVisibleAvailable(itemFk, warehouseFk, dated, options); - expect(result.available).toEqual(187); + expect(result.available).toEqual(185); expect(result.visible).toEqual(92); await tx.rollback(); diff --git a/modules/item/front/last-entries/index.html b/modules/item/front/last-entries/index.html index 0348d4f66..ba0552613 100644 --- a/modules/item/front/last-entries/index.html +++ b/modules/item/front/last-entries/index.html @@ -9,15 +9,15 @@ - + @@ -35,8 +35,7 @@ Warehouse Landed Entry - P.P.U - P.P.P + PVP Label Packing Grouping @@ -51,7 +50,7 @@ - @@ -65,26 +64,27 @@ {{::entry.entryFk | dashIfEmpty}} - {{::entry.price2 | dashIfEmpty}} - {{::entry.price3 | dashIfEmpty}} + + {{::entry.price2 | currency: 'EUR':2 | dashIfEmpty}} / {{::entry.price3 | currency: 'EUR':2 | dashIfEmpty}} + {{entry.stickers | dashIfEmpty}} - + {{::entry.packing | dashIfEmpty}} - + {{::entry.grouping | dashIfEmpty}} {{::entry.stems | dashIfEmpty}} {{::entry.quantity}} - @@ -113,24 +113,24 @@ ng-click="contextmenu.filterBySelection()"> Filter by selection - Exclude selection - Remove filter - Remove all filters - Copy value - \ No newline at end of file + diff --git a/modules/ticket/back/methods/ticket/getTicketsAdvance.js b/modules/ticket/back/methods/ticket/getTicketsAdvance.js index 19571bb51..86911a477 100644 --- a/modules/ticket/back/methods/ticket/getTicketsAdvance.js +++ b/modules/ticket/back/methods/ticket/getTicketsAdvance.js @@ -50,15 +50,9 @@ module.exports = Self => { required: false }, { - arg: 'state', - type: 'string', - description: 'Origin state', - required: false - }, - { - arg: 'futureState', - type: 'string', - description: 'Destination state', + arg: 'fullMovable', + type: 'boolean', + description: 'True when lines and stock of origin are equal', required: false }, { @@ -92,13 +86,21 @@ module.exports = Self => { case 'futureId': return {'f.futureId': value}; case 'ipt': - return {'f.ipt': value}; + return {or: + [ + {'f.ipt': {like: `%${value}%`}}, + {'f.ipt': null} + ] + }; case 'futureIpt': - return {'f.futureIpt': value}; - case 'state': - return {'f.stateCode': {like: `%${value}%`}}; - case 'futureState': - return {'f.futureStateCode': {like: `%${value}%`}}; + return {or: + [ + {'f.futureIpt': {like: `%${value}%`}}, + {'f.futureIpt': null} + ] + }; + case 'fullMovable': + return {'f.fullMovable': value}; } }); diff --git a/modules/ticket/back/methods/ticket/specs/getTicketsAdvance.spec.js b/modules/ticket/back/methods/ticket/specs/getTicketsAdvance.spec.js index aab053127..cb4762549 100644 --- a/modules/ticket/back/methods/ticket/specs/getTicketsAdvance.spec.js +++ b/modules/ticket/back/methods/ticket/specs/getTicketsAdvance.spec.js @@ -1,7 +1,7 @@ const models = require('vn-loopback/server/server').models; -describe('TicketFuture getTicketsAdvance()', () => { - const today = new Date(); +describe('ticket getTicketsAdvance()', () => { + const today = Date.vnNew(); today.setHours(0, 0, 0, 0); let tomorrow = new Date(); tomorrow.setDate(today.getDate() + 1); @@ -29,7 +29,7 @@ describe('TicketFuture getTicketsAdvance()', () => { } }); - it('should return the tickets matching the origin grouped state', async() => { + it('should return the tickets matching the fullMovable true', async() => { const tx = await models.Ticket.beginTransaction({}); try { @@ -39,7 +39,7 @@ describe('TicketFuture getTicketsAdvance()', () => { dateFuture: tomorrow, dateToAdvance: today, warehouseFk: 1, - state: 'OK' + fullMovable: true }; const ctx = {req: {accessToken: {userId: 9}}, args}; @@ -54,7 +54,7 @@ describe('TicketFuture getTicketsAdvance()', () => { } }); - it('should return the tickets matching the destination grouped state', async() => { + it('should return the tickets matching the fullMovable false', async() => { const tx = await models.Ticket.beginTransaction({}); try { @@ -64,7 +64,7 @@ describe('TicketFuture getTicketsAdvance()', () => { dateFuture: tomorrow, dateToAdvance: today, warehouseFk: 1, - futureState: 'FREE' + fullMovable: false }; const ctx = {req: {accessToken: {userId: 9}}, args}; @@ -95,7 +95,7 @@ describe('TicketFuture getTicketsAdvance()', () => { const ctx = {req: {accessToken: {userId: 9}}, args}; const result = await models.Ticket.getTicketsAdvance(ctx, options); - expect(result.length).toBeLessThan(5); + expect(result.length).toBeGreaterThan(5); await tx.rollback(); } catch (e) { @@ -120,7 +120,7 @@ describe('TicketFuture getTicketsAdvance()', () => { const ctx = {req: {accessToken: {userId: 9}}, args}; const result = await models.Ticket.getTicketsAdvance(ctx, options); - expect(result.length).toBeLessThan(5); + expect(result.length).toBeGreaterThan(5); await tx.rollback(); } catch (e) { diff --git a/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js b/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js index 5470382f9..e1e93af1e 100644 --- a/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js +++ b/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js @@ -86,7 +86,7 @@ describe('sale priceDifference()', () => { const firstItem = result.items[0]; const secondtItem = result.items[1]; - expect(firstItem.movable).toEqual(410); + expect(firstItem.movable).toEqual(380); expect(secondtItem.movable).toEqual(1790); await tx.rollback(); diff --git a/modules/ticket/front/advance-search-panel/index.html b/modules/ticket/front/advance-search-panel/index.html index e8d5dc60d..233d00127 100644 --- a/modules/ticket/front/advance-search-panel/index.html +++ b/modules/ticket/front/advance-search-panel/index.html @@ -39,28 +39,12 @@ - - - {{name}} - - - - - {{name}} - - - - + + - Origin - Destination + Destination + Origin @@ -43,7 +43,30 @@ check-field="checked"> - + + + + ID + + + Date + + + IPT + + + State + + + Liters + + + Lines + + + Import + + ID @@ -58,30 +81,6 @@ Import - - ID - - - Date - - - IPT - - - State - - - Liters - - - Stock - - - Lines - - - Import - @@ -93,28 +92,11 @@ - - {{::ticket.futureId | dashIfEmpty}} - - - - - {{::ticket.futureShipped | date: 'dd/MM/yyyy'}} - - - {{::ticket.futureIpt | dashIfEmpty}} - - - {{::ticket.futureState | dashIfEmpty}} - - - - - {{::(ticket.futureTotalWithVat ? ticket.futureTotalWithVat : 0) | currency: 'EUR': 2}} - + + {{::ticket.liters | dashIfEmpty}} - {{::ticket.hasStock | dashIfEmpty}} {{::ticket.lines | dashIfEmpty}} - + {{::(ticket.totalWithVat ? ticket.totalWithVat : 0) | currency: 'EUR': 2}} + + + {{::ticket.futureId | dashIfEmpty}} + + + + + {{::ticket.futureShipped | date: 'dd/MM/yyyy'}} + + + {{::ticket.futureIpt | dashIfEmpty}} + + + {{::ticket.futureState | dashIfEmpty}} + + + + + {{::(ticket.futureTotalWithVat ? ticket.futureTotalWithVat : 0) | currency: 'EUR': 2}} + + + diff --git a/modules/ticket/front/advance/index.js b/modules/ticket/front/advance/index.js index b770440f1..0fb5119e3 100644 --- a/modules/ticket/front/advance/index.js +++ b/modules/ticket/front/advance/index.js @@ -115,9 +115,15 @@ export default class Controller extends Section { } totalPriceColor(totalWithVat) { - const total = parseInt(totalWithVat); - if (total > 0 && total < 50) - return 'warning'; + return this.isLessThan50(totalWithVat) ? 'warning' : ''; + } + + totalPriceTitle(totalWithVat) { + return this.isLessThan50(totalWithVat) ? 'Less than 50€' : ''; + } + + isLessThan50(totalWithVat) { + return (parseInt(totalWithVat) > 0 && parseInt(totalWithVat) < 50); } get confirmationMessage() { @@ -128,6 +134,11 @@ export default class Controller extends Section { }); } + agencies(futureAgency, agency) { + return this.$t(`Origin agency`, {agency: futureAgency}) + + '\n' + this.$t(`Destination agency`, {agency: agency}); + } + moveTicketsAdvance() { let ticketsToMove = []; this.checked.forEach(ticket => { @@ -158,9 +169,19 @@ export default class Controller extends Section { case 'lines': return {'lines': value}; case 'ipt': - return {'ipt': value}; + return {or: + [ + {'ipt': {like: `%${value}%`}}, + {'ipt': null} + ] + }; case 'futureIpt': - return {'futureIpt': value}; + return {or: + [ + {'futureIpt': {like: `%${value}%`}}, + {'futureIpt': null} + ] + }; case 'totalWithVat': return {'totalWithVat': value}; case 'futureTotalWithVat': diff --git a/modules/ticket/front/advance/locale/es.yml b/modules/ticket/front/advance/locale/es.yml index b444fbdd3..116a5d4f9 100644 --- a/modules/ticket/front/advance/locale/es.yml +++ b/modules/ticket/front/advance/locale/es.yml @@ -4,3 +4,7 @@ Advance confirmation: ¿Desea adelantar {{checked}} tickets? Success: Tickets movidos correctamente Lines: Líneas Liters: Litros +Item Packing Type: Encajado +Origin agency: "Agencia origen: {{agency}}" +Destination agency: "Agencia destino: {{agency}}" +Less than 50€: Menor a 50€ diff --git a/modules/ticket/front/future/index.html b/modules/ticket/front/future/index.html index c0e1decc2..8628bb34c 100644 --- a/modules/ticket/front/future/index.html +++ b/modules/ticket/front/future/index.html @@ -143,7 +143,7 @@ {{::ticket.liters}} {{::ticket.lines}} - + diff --git a/modules/ticket/front/future/index.js b/modules/ticket/front/future/index.js index 5fb2c8f82..5ca0f46a2 100644 --- a/modules/ticket/front/future/index.js +++ b/modules/ticket/front/future/index.js @@ -146,9 +146,19 @@ export default class Controller extends Section { case 'lines': return {'lines': value}; case 'ipt': - return {'ipt': value}; + return {or: + [ + {'ipt': {like: `%${value}%`}}, + {'ipt': null} + ] + }; case 'futureIpt': - return {'futureIpt': value}; + return {or: + [ + {'futureIpt': {like: `%${value}%`}}, + {'futureIpt': null} + ] + }; } } } From 9dc07d88d691fde4913df62a0cd610e1a7b55896 Mon Sep 17 00:00:00 2001 From: alexandre Date: Fri, 10 Feb 2023 08:56:30 +0100 Subject: [PATCH 19/53] fixing e2e --- db/changes/230601/00-ticket_canAdvance.sql | 114 ++++++++++++++++++ e2e/helpers/selectors.js | 2 - e2e/paths/05-ticket/22_advance.spec.js | 28 +---- .../ticket/specs/getTicketsAdvance.spec.js | 4 +- 4 files changed, 120 insertions(+), 28 deletions(-) create mode 100644 db/changes/230601/00-ticket_canAdvance.sql diff --git a/db/changes/230601/00-ticket_canAdvance.sql b/db/changes/230601/00-ticket_canAdvance.sql new file mode 100644 index 000000000..af1819c77 --- /dev/null +++ b/db/changes/230601/00-ticket_canAdvance.sql @@ -0,0 +1,114 @@ +DROP PROCEDURE IF EXISTS vn.ticket_canAdvance; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_canAdvance`(vDateFuture DATE, vDateToAdvance DATE, vWarehouseFk INT) +BEGIN +/** + * Devuelve los tickets y la cantidad de lineas de venta que se pueden adelantar. + * + * @param vDateFuture Fecha de los tickets que se quieren adelantar. + * @param vDateToAdvance Fecha a cuando se quiere adelantar. + * @param vWarehouseFk Almacén + */ + + DECLARE vDateInventory DATE; + + SELECT inventoried INTO vDateInventory FROM vn.config; + + DROP TEMPORARY TABLE IF EXISTS tmp.stock; + CREATE TEMPORARY TABLE tmp.stock + (itemFk INT PRIMARY KEY, + amount INT) + ENGINE = MEMORY; + + INSERT INTO tmp.stock(itemFk, amount) + SELECT itemFk, SUM(quantity) amount FROM + ( + SELECT itemFk, quantity + FROM vn.itemTicketOut + WHERE shipped >= vDateInventory + AND shipped < vDateFuture + AND warehouseFk = vWarehouseFk + UNION ALL + SELECT itemFk, quantity + FROM vn.itemEntryIn + WHERE landed >= vDateInventory + AND landed < vDateFuture + AND isVirtualStock = FALSE + AND warehouseInFk = vWarehouseFk + UNION ALL + SELECT itemFk, quantity + FROM vn.itemEntryOut + WHERE shipped >= vDateInventory + AND shipped < vDateFuture + AND warehouseOutFk = vWarehouseFk + ) t + GROUP BY itemFk HAVING amount != 0; + + DROP TEMPORARY TABLE IF EXISTS tmp.filter; + CREATE TEMPORARY TABLE tmp.filter + (INDEX (id)) + + SELECT + *, + CASE WHEN sub.futureLines = hasStock THEN '1' ELSE '0' END AS fullMovable + FROM (SELECT s.ticketFk futureId, + t2.ticketFk id, + count(DISTINCT s.id) saleCount, + t2.state, + st.name futureState, + GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) futureIpt, + t2.ipt, + t.workerFk, + CAST(SUM(litros) AS DECIMAL(10,0)) futureLiters, + CAST(COUNT(*) AS DECIMAL(10,0)) `futureLines`, + t2.shipped, + t.shipped futureShipped, + t2.totalWithVat, + t.totalWithVat futureTotalWithVat, + t2.agency, + am.name futureAgency, + t2.lines, + t2.liters, + SUM((s.quantity <= IFNULL(st.amount,0))) AS hasStock + FROM vn.ticket t + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.saleVolume sv ON sv.saleFk = s.id + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.ticketState ts ON ts.ticketFk = t.id + JOIN vn.state st ON st.id = ts.stateFk + JOIN vn.agencyMode am ON t.agencyModeFk = am.id + LEFT JOIN vn.itemPackingType ipt ON ipt.code = i.itemPackingTypeFk + LEFT JOIN tmp.stock st ON st.itemFk = s.itemFk + JOIN (SELECT + t2.id ticketFk, + t2.addressFk, + st.name state, + GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) ipt, + t2.shipped, + t2.totalWithVat, + am.name agency, + CAST(SUM(litros) AS DECIMAL(10,0)) liters, + CAST(COUNT(*) AS DECIMAL(10,0)) `lines` + FROM vn.ticket t2 + JOIN vn.sale s ON s.ticketFk = t2.id + JOIN vn.saleVolume sv ON sv.saleFk = s.id + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.ticketState ts ON ts.ticketFk = t2.id + JOIN vn.state st ON st.id = ts.stateFk + JOIN vn.agencyMode am ON t2.agencyModeFk = am.id + LEFT JOIN vn.itemPackingType ipt ON ipt.code = i.itemPackingTypeFk + WHERE t2.shipped BETWEEN vDateToAdvance AND util.dayend(vDateToAdvance) + AND t2.warehouseFk = vWarehouseFk + AND st.order <= 5 + GROUP BY t2.id) t2 ON t2.addressFk = t.addressFk + WHERE t.shipped BETWEEN vDateFuture AND util.dayend(vDateFuture) + AND t.warehouseFk = vWarehouseFk + GROUP BY id, futureId + ) sub + WHERE hasStock != 0; + + DROP TEMPORARY TABLE tmp.stock; +END$$ +DELIMITER ; diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index c0f10a506..c7afa8aab 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -776,8 +776,6 @@ export default { ipt: 'vn-autocomplete[label="Destination IPT"]', tableIpt: 'vn-autocomplete[name="ipt"]', tableFutureIpt: 'vn-autocomplete[name="futureIpt"]', - futureState: 'vn-autocomplete[label="Origin Grouped State"]', - state: 'vn-autocomplete[label="Destination Grouped State"]', warehouseFk: 'vn-autocomplete[label="Warehouse"]', tableButtonSearch: 'vn-button[vn-tooltip="Search"]', moveButton: 'vn-button[vn-tooltip="Advance tickets"]', diff --git a/e2e/paths/05-ticket/22_advance.spec.js b/e2e/paths/05-ticket/22_advance.spec.js index 6aaa81591..14ff11aa6 100644 --- a/e2e/paths/05-ticket/22_advance.spec.js +++ b/e2e/paths/05-ticket/22_advance.spec.js @@ -10,6 +10,10 @@ describe('Ticket Advance path', () => { page = browser.page; await page.loginAndModule('employee', 'ticket'); await page.accessToSection('ticket.advance'); + page.on('request', req => { + if (req.url().includes(`Tickets/getTicketsAdvance`)) + httpRequests.push(req.url()); + }); }); afterAll(async() => { @@ -70,30 +74,6 @@ describe('Ticket Advance path', () => { await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1); }); - it('should search with the origin grouped state', async() => { - await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); - await page.autocompleteSearch(selectors.ticketAdvance.futureState, 'Free'); - await page.waitToClick(selectors.ticketAdvance.submit); - await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1); - - await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); - await page.clearInput(selectors.ticketAdvance.futureState); - await page.waitToClick(selectors.ticketAdvance.submit); - await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1); - }); - - it('should search with the destination grouped state', async() => { - await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); - await page.autocompleteSearch(selectors.ticketAdvance.state, 'Free'); - await page.waitToClick(selectors.ticketAdvance.submit); - await page.waitForNumberOfElements(selectors.ticketAdvance.table, 0); - - await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); - await page.clearInput(selectors.ticketAdvance.state); - await page.waitToClick(selectors.ticketAdvance.submit); - await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1); - }); - it('should search in smart-table with an IPT Origin', async() => { await page.waitToClick(selectors.ticketAdvance.tableButtonSearch); await page.autocompleteSearch(selectors.ticketAdvance.tableFutureIpt, 'Vertical'); diff --git a/modules/ticket/back/methods/ticket/specs/getTicketsAdvance.spec.js b/modules/ticket/back/methods/ticket/specs/getTicketsAdvance.spec.js index cb4762549..685360115 100644 --- a/modules/ticket/back/methods/ticket/specs/getTicketsAdvance.spec.js +++ b/modules/ticket/back/methods/ticket/specs/getTicketsAdvance.spec.js @@ -1,7 +1,7 @@ const models = require('vn-loopback/server/server').models; describe('ticket getTicketsAdvance()', () => { - const today = Date.vnNew(); + const today = new Date(); today.setHours(0, 0, 0, 0); let tomorrow = new Date(); tomorrow.setDate(today.getDate() + 1); @@ -70,7 +70,7 @@ describe('ticket getTicketsAdvance()', () => { const ctx = {req: {accessToken: {userId: 9}}, args}; const result = await models.Ticket.getTicketsAdvance(ctx, options); - expect(result.length).toBeGreaterThan(0); + expect(result.length).toEqual(0); await tx.rollback(); } catch (e) { From 4787de3df5f58bec7b68673403080ea84a632c89 Mon Sep 17 00:00:00 2001 From: alexandre Date: Fri, 10 Feb 2023 09:04:49 +0100 Subject: [PATCH 20/53] fixing merge --- modules/item/front/last-entries/index.html | 4 ---- 1 file changed, 4 deletions(-) diff --git a/modules/item/front/last-entries/index.html b/modules/item/front/last-entries/index.html index f381ab63a..f6cdf8343 100644 --- a/modules/item/front/last-entries/index.html +++ b/modules/item/front/last-entries/index.html @@ -9,7 +9,6 @@ - @@ -55,7 +52,6 @@ - From d8acf45e0d9f2545062a055fa738dba7a5f970d9 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 10 Feb 2023 09:34:42 +0100 Subject: [PATCH 21/53] fix(client-debt-statment): typo --- .../reports/client-debt-statement/client-debt-statement.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/print/templates/reports/client-debt-statement/client-debt-statement.html b/print/templates/reports/client-debt-statement/client-debt-statement.html index fb7bfd625..30fbbe003 100644 --- a/print/templates/reports/client-debt-statement/client-debt-statement.html +++ b/print/templates/reports/client-debt-statement/client-debt-statement.html @@ -13,7 +13,7 @@ {{$t('date')}} - {{formatDate(new Date(), '%d-%m-%Y');}} + {{formatDate(new Date(), '%d-%m-%Y')}} @@ -44,7 +44,7 @@ - {{formatDate(sale.issued, '%d-%m-%Y');}} + {{formatDate(sale.issued, '%d-%m-%Y')}} {{sale.ref}} {{sale.debtOut}} {{sale.debtIn}} From 6cb815faafa440cc66cdd58136ed631ea06a1624 Mon Sep 17 00:00:00 2001 From: alexandre Date: Fri, 10 Feb 2023 10:13:41 +0100 Subject: [PATCH 22/53] . --- db/changes/230601/00-ticket_canAdvance.sql | 4 +- e2e/paths/05-ticket/22_advance.spec.js | 56 ++++++++++++++-------- modules/ticket/front/advance/index.html | 10 ++-- 3 files changed, 42 insertions(+), 28 deletions(-) diff --git a/db/changes/230601/00-ticket_canAdvance.sql b/db/changes/230601/00-ticket_canAdvance.sql index af1819c77..68942a286 100644 --- a/db/changes/230601/00-ticket_canAdvance.sql +++ b/db/changes/230601/00-ticket_canAdvance.sql @@ -80,7 +80,7 @@ BEGIN JOIN vn.state st ON st.id = ts.stateFk JOIN vn.agencyMode am ON t.agencyModeFk = am.id LEFT JOIN vn.itemPackingType ipt ON ipt.code = i.itemPackingTypeFk - LEFT JOIN tmp.stock st ON st.itemFk = s.itemFk + LEFT JOIN tmp.stock st ON st.itemFk = i.id JOIN (SELECT t2.id ticketFk, t2.addressFk, @@ -105,7 +105,7 @@ BEGIN GROUP BY t2.id) t2 ON t2.addressFk = t.addressFk WHERE t.shipped BETWEEN vDateFuture AND util.dayend(vDateFuture) AND t.warehouseFk = vWarehouseFk - GROUP BY id, futureId + GROUP BY t.id ) sub WHERE hasStock != 0; diff --git a/e2e/paths/05-ticket/22_advance.spec.js b/e2e/paths/05-ticket/22_advance.spec.js index e94600066..49ab5b0fc 100644 --- a/e2e/paths/05-ticket/22_advance.spec.js +++ b/e2e/paths/05-ticket/22_advance.spec.js @@ -4,6 +4,7 @@ import getBrowser from '../../helpers/puppeteer'; describe('Ticket Advance path', () => { let browser; let page; + const httpRequests = []; beforeAll(async() => { browser = await getBrowser(); @@ -47,53 +48,70 @@ describe('Ticket Advance path', () => { it('should search with the required data', async() => { await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); await page.waitToClick(selectors.ticketAdvance.submit); - await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1); + + expect(httpRequests.length).toBeGreaterThan(0); }); it('should search with the origin IPT', async() => { - await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); - await page.autocompleteSearch(selectors.ticketAdvance.ipt, 'Horizontal'); - await page.waitToClick(selectors.ticketAdvance.submit); - await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1); - - await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); - await page.clearInput(selectors.ticketAdvance.ipt); - await page.waitToClick(selectors.ticketAdvance.submit); - await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1); - }); - - it('should search with the destination IPT', async() => { await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); await page.autocompleteSearch(selectors.ticketAdvance.futureIpt, 'Horizontal'); await page.waitToClick(selectors.ticketAdvance.submit); - await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1); + + const request = httpRequests.find(req => req.includes(('futureIpt=H'))); + + expect(request).toBeDefined(); + + httpRequests.splice(httpRequests.indexOf(request), 1); await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); await page.clearInput(selectors.ticketAdvance.futureIpt); await page.waitToClick(selectors.ticketAdvance.submit); - await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1); + }); + + it('should search with the destination IPT', async() => { + await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); + await page.autocompleteSearch(selectors.ticketAdvance.ipt, 'Horizontal'); + await page.waitToClick(selectors.ticketAdvance.submit); + + const request = httpRequests.find(req => req.includes(('ipt=H'))); + + expect(request).toBeDefined(); + + httpRequests.splice(httpRequests.indexOf(request), 1); + + await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); + await page.clearInput(selectors.ticketAdvance.ipt); + await page.waitToClick(selectors.ticketAdvance.submit); }); it('should search in smart-table with an IPT Origin', async() => { await page.waitToClick(selectors.ticketAdvance.tableButtonSearch); await page.autocompleteSearch(selectors.ticketAdvance.tableFutureIpt, 'Vertical'); - await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1); + + const request = httpRequests.find(req => req.includes(('ipt'))); + + expect(request).toBeDefined(); + + httpRequests.splice(httpRequests.indexOf(request), 1); await page.waitToClick(selectors.ticketAdvance.tableButtonSearch); await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); await page.waitToClick(selectors.ticketAdvance.submit); - await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1); }); it('should search in smart-table with an IPT Destination', async() => { await page.waitToClick(selectors.ticketAdvance.tableButtonSearch); await page.autocompleteSearch(selectors.ticketAdvance.tableIpt, 'Vertical'); - await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1); + + const request = httpRequests.find(req => req.includes(('futureIpt'))); + + expect(request).toBeDefined(); + + httpRequests.splice(httpRequests.indexOf(request), 1); await page.waitToClick(selectors.ticketAdvance.tableButtonSearch); await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); await page.waitToClick(selectors.ticketAdvance.submit); - await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1); }); it('should check the one ticket and move to the present', async() => { diff --git a/modules/ticket/front/advance/index.html b/modules/ticket/front/advance/index.html index c700a1cc3..48023955e 100644 --- a/modules/ticket/front/advance/index.html +++ b/modules/ticket/front/advance/index.html @@ -100,13 +100,6 @@ vn-click-stop> - - - - + {{::ticket.futureLiters | dashIfEmpty}} + {{::ticket.hasStock | dashIfEmpty}} + {{::ticket.futureLines | dashIfEmpty}} Date: Fri, 10 Feb 2023 12:09:51 +0100 Subject: [PATCH 23/53] fix: actulizada sql intrastat y se muestra solamente cuando toca --- db/changes/230402/00-invoiceOut_getWeight.sql | 30 ++++++++++ print/templates/reports/invoice/invoice.html | 2 +- print/templates/reports/invoice/invoice.js | 3 +- .../reports/invoice/sql/hasIntrastat.sql | 4 ++ .../reports/invoice/sql/intrastat.sql | 60 +++++++++++-------- 5 files changed, 72 insertions(+), 27 deletions(-) create mode 100644 db/changes/230402/00-invoiceOut_getWeight.sql create mode 100644 print/templates/reports/invoice/sql/hasIntrastat.sql diff --git a/db/changes/230402/00-invoiceOut_getWeight.sql b/db/changes/230402/00-invoiceOut_getWeight.sql new file mode 100644 index 000000000..4ca284857 --- /dev/null +++ b/db/changes/230402/00-invoiceOut_getWeight.sql @@ -0,0 +1,30 @@ +DROP FUNCTION IF EXISTS `vn`.`invoiceOut_getWeight`; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`localhost` FUNCTION `vn`.`invoiceOut_getWeight`(vInvoice VARCHAR(15)) RETURNS decimal(10,2) + READS SQL DATA +BEGIN +/** + * Calcula el peso de una factura emitida + * + * @param vInvoice Id de la factura + * @return vTotalWeight peso de la factura + */ + DECLARE vTotalWeight DECIMAL(10,2); + + SELECT SUM(CAST(IFNULL(i.stems, 1) + * s.quantity + * IF(ic.grams, ic.grams, IFNULL(i.weightByPiece, 0)) / 1000 AS DECIMAL(10,2))) + INTO vTotalWeight + FROM ticket t + JOIN sale s ON s.ticketFk = t.id + JOIN item i ON i.id = s.itemFk + JOIN itemCost ic ON ic.itemFk = i.id + AND ic.warehouseFk = t.warehouseFk + WHERE t.refFk = vInvoice + AND i.intrastatFk; + + RETURN vTotalWeight; +END$$ +DELIMITER ; diff --git a/print/templates/reports/invoice/invoice.html b/print/templates/reports/invoice/invoice.html index 60d06d528..ffa03af45 100644 --- a/print/templates/reports/invoice/invoice.html +++ b/print/templates/reports/invoice/invoice.html @@ -203,7 +203,7 @@
-
+

{{$t('intrastat')}}

diff --git a/print/templates/reports/invoice/invoice.js b/print/templates/reports/invoice/invoice.js index 7b572d970..eaf17527d 100755 --- a/print/templates/reports/invoice/invoice.js +++ b/print/templates/reports/invoice/invoice.js @@ -10,7 +10,8 @@ module.exports = { this.checkMainEntity(this.invoice); this.client = await this.findOneFromDef('client', [this.reference]); this.taxes = await this.rawSqlFromDef(`taxes`, [this.reference]); - this.intrastat = await this.rawSqlFromDef(`intrastat`, [this.reference, this.reference, this.reference]); + this.hasIntrastat = await this.findValueFromDef(`hasIntrastat`, [this.reference]); + this.intrastat = await this.rawSqlFromDef(`intrastat`, [this.reference, this.reference, this.reference, this.reference]); this.rectified = await this.rawSqlFromDef(`rectified`, [this.reference]); this.hasIncoterms = await this.findValueFromDef(`hasIncoterms`, [this.reference]); diff --git a/print/templates/reports/invoice/sql/hasIntrastat.sql b/print/templates/reports/invoice/sql/hasIntrastat.sql new file mode 100644 index 000000000..09eda94c2 --- /dev/null +++ b/print/templates/reports/invoice/sql/hasIntrastat.sql @@ -0,0 +1,4 @@ +SELECT taxAreaFk != 'NATIONAL' + FROM vn.invoiceOutSerial ios + JOIN vn.invoiceOut io ON io.serial = ios.code + WHERE io.ref = ?; diff --git a/print/templates/reports/invoice/sql/intrastat.sql b/print/templates/reports/invoice/sql/intrastat.sql index f986a9564..211ebfe71 100644 --- a/print/templates/reports/invoice/sql/intrastat.sql +++ b/print/templates/reports/invoice/sql/intrastat.sql @@ -1,26 +1,36 @@ SELECT * - FROM invoiceOut io - JOIN invoiceOutSerial ios ON io.serial = ios.code - JOIN( - SELECT ir.id code, - ir.description, - iii.stems, - iii.net netKg, - iii.amount subtotal - FROM vn.invoiceInIntrastat iii - LEFT JOIN vn.invoiceIn ii ON ii.id = iii.invoiceInFk - LEFT JOIN vn.invoiceOut io ON io.ref = ii.supplierRef - LEFT JOIN vn.intrastat ir ON ir.id = iii.intrastatFk - WHERE io.`ref` = ? - UNION ALL - SELECT NULL code, - 'Servicios' description, - 0 stems, - 0 netKg, - IF(CAST(SUM((ts.quantity * ts.price)) AS DECIMAL(10,2)), CAST(SUM((ts.quantity * ts.price)) AS DECIMAL(10,2)), 0) subtotal - FROM vn.ticketService ts - JOIN vn.ticket t ON ts.ticketFk = t.id - WHERE t.refFk = ? - ) sub - WHERE io.ref = ? AND ios.isCEE - ORDER BY sub.code; + FROM ( + SELECT i.intrastatFk code, + it.description, + CAST(SUM(ROUND((s.quantity * s.price * (100 - s.discount) / 100 ) , 2))AS DECIMAL(10, 2)) subtotal, + SUM(IFNULL(i.stems, 1) * s.quantity) stems, + CAST(SUM(IFNULL(i.stems, 1) + * s.quantity + * IF(ic.grams, ic.grams, IFNULL(i.weightByPiece, 0)) / 1000) + * IF(sub.totalWeight, sub.totalWeight / vn.invoiceOut_getWeight(?), 1) + AS DECIMAL(10,2)) netKg + FROM sale s + JOIN ticket t ON s.ticketFk = t.id + JOIN supplier su ON su.id = t.companyFk + JOIN item i ON i.id = s.itemFk + JOIN intrastat it ON it.id = i.intrastatFk + LEFT JOIN itemCost ic ON ic.itemFk = i.id AND ic.warehouseFk = t.warehouseFk + LEFT JOIN ( + SELECT SUM(weight)totalWeight + FROM vn.ticket + WHERE refFk = ? + AND weight + ) sub ON TRUE + WHERE t.refFk =? + GROUP BY i.intrastatFk + UNION ALL + SELECT NULL , + IF((SUM((ts.quantity * ts.price))), 'Servicios', NULL), + IFNULL(CAST(SUM((ts.quantity * ts.price)) AS DECIMAL(10,2)), 0), + 0 , + 0 + FROM vn.ticketService ts + JOIN vn.ticket t ON ts.ticketFk = t.id + WHERE t.refFk = ? + ) sub2 + WHERE `description` IS NOT NULL; From 76ed4d2d4bcb0248249a7215e08d20b46a216530 Mon Sep 17 00:00:00 2001 From: alexandre Date: Mon, 13 Feb 2023 10:16:28 +0100 Subject: [PATCH 24/53] refs #5194 fixed tests --- db/changes/230402/00-ticket_canAdvance.sql | 127 ++++++++++++++++++ db/changes/230601/00-ticket_canAdvance.sql | 114 ---------------- e2e/helpers/selectors.js | 6 +- e2e/paths/05-ticket/22_advance.spec.js | 8 +- .../back/methods/ticket/getTicketsAdvance.js | 6 +- .../ticket/specs/getTicketsAdvance.spec.js | 4 +- .../front/advance-search-panel/index.html | 2 +- modules/ticket/front/advance/index.html | 6 +- modules/ticket/front/advance/index.js | 4 +- modules/ticket/front/advance/locale/es.yml | 1 + 10 files changed, 145 insertions(+), 133 deletions(-) create mode 100644 db/changes/230402/00-ticket_canAdvance.sql delete mode 100644 db/changes/230601/00-ticket_canAdvance.sql diff --git a/db/changes/230402/00-ticket_canAdvance.sql b/db/changes/230402/00-ticket_canAdvance.sql new file mode 100644 index 000000000..d7386e9d1 --- /dev/null +++ b/db/changes/230402/00-ticket_canAdvance.sql @@ -0,0 +1,127 @@ +DROP PROCEDURE IF EXISTS `vn`.`ticket_canAdvance`; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_canAdvance`(vDateFuture DATE, vDateToAdvance DATE, vWarehouseFk INT) +BEGIN +/** + * Devuelve los tickets y la cantidad de lineas de venta que se pueden adelantar. + * + * @param vDateFuture Fecha de los tickets que se quieren adelantar. + * @param vDateToAdvance Fecha a cuando se quiere adelantar. + * @param vWarehouseFk Almacén + */ + + DECLARE vDateInventory DATE; + + SELECT inventoried INTO vDateInventory FROM config; + + DROP TEMPORARY TABLE IF EXISTS tmp.stock; + CREATE TEMPORARY TABLE tmp.stock + (itemFk INT PRIMARY KEY, + amount INT) + ENGINE = MEMORY; + + INSERT INTO tmp.stock(itemFk, amount) + SELECT itemFk, SUM(quantity) amount FROM + ( + SELECT itemFk, quantity + FROM itemTicketOut + WHERE shipped >= vDateInventory + AND shipped < vDateFuture + AND warehouseFk = vWarehouseFk + UNION ALL + SELECT itemFk, quantity + FROM itemEntryIn + WHERE landed >= vDateInventory + AND landed < vDateFuture + AND isVirtualStock = FALSE + AND warehouseInFk = vWarehouseFk + UNION ALL + SELECT itemFk, quantity + FROM itemEntryOut + WHERE shipped >= vDateInventory + AND shipped < vDateFuture + AND warehouseOutFk = vWarehouseFk + ) t + GROUP BY itemFk HAVING amount != 0; + + DROP TEMPORARY TABLE IF EXISTS tmp.filter; + CREATE TEMPORARY TABLE tmp.filter + (INDEX (id)) + + SELECT + origin.ticketFk futureId, + dest.ticketFk id, + dest.state, + origin.futureState, + origin.futureIpt, + dest.ipt, + origin.workerFk, + origin.futureLiters, + origin.futureLines, + dest.shipped, + origin.shipped futureShipped, + dest.totalWithVat, + origin.totalWithVat futureTotalWithVat, + dest.agency, + origin.futureAgency, + dest.lines, + dest.liters, + origin.futureLines - origin.hasStock AS notMovableLines, + (origin.futureLines = origin.hasStock) AS isFullMovable + FROM ( + SELECT + s.ticketFk, + t.workerFk, + t.shipped, + t.totalWithVat, + st.name futureState, + t.addressFk, + am.name futureAgency, + count(s.id) futureLines, + GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) futureIpt, + CAST(SUM(litros) AS DECIMAL(10,0)) futureLiters, + SUM((s.quantity <= IFNULL(st.amount,0))) hasStock + FROM ticket t + JOIN sale s ON s.ticketFk = t.id + JOIN saleVolume sv ON sv.saleFk = s.id + JOIN item i ON i.id = s.itemFk + JOIN ticketState ts ON ts.ticketFk = t.id + JOIN state st ON st.id = ts.stateFk + JOIN agencyMode am ON t.agencyModeFk = am.id + LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk + LEFT JOIN tmp.stock st ON st.itemFk = i.id + WHERE t.shipped BETWEEN vDateFuture AND util.dayend(vDateFuture) + AND t.warehouseFk = vWarehouseFk + GROUP BY t.id + ) origin + JOIN ( + SELECT + t.id ticketFk, + t.addressFk, + st.name state, + GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) ipt, + t.shipped, + t.totalWithVat, + am.name agency, + CAST(SUM(litros) AS DECIMAL(10,0)) liters, + CAST(COUNT(*) AS DECIMAL(10,0)) `lines` + FROM ticket t + JOIN sale s ON s.ticketFk = t.id + JOIN saleVolume sv ON sv.saleFk = s.id + JOIN item i ON i.id = s.itemFk + JOIN ticketState ts ON ts.ticketFk = t.id + JOIN state st ON st.id = ts.stateFk + JOIN agencyMode am ON t.agencyModeFk = am.id + LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk + WHERE t.shipped BETWEEN vDateToAdvance AND util.dayend(vDateToAdvance) + AND t.warehouseFk = vWarehouseFk + AND st.order <= 5 + GROUP BY t.id + ) dest ON dest.addressFk = origin.addressFk + WHERE origin.hasStock != 0; + + DROP TEMPORARY TABLE tmp.stock; +END$$ +DELIMITER ; diff --git a/db/changes/230601/00-ticket_canAdvance.sql b/db/changes/230601/00-ticket_canAdvance.sql deleted file mode 100644 index 68942a286..000000000 --- a/db/changes/230601/00-ticket_canAdvance.sql +++ /dev/null @@ -1,114 +0,0 @@ -DROP PROCEDURE IF EXISTS vn.ticket_canAdvance; - -DELIMITER $$ -$$ -CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_canAdvance`(vDateFuture DATE, vDateToAdvance DATE, vWarehouseFk INT) -BEGIN -/** - * Devuelve los tickets y la cantidad de lineas de venta que se pueden adelantar. - * - * @param vDateFuture Fecha de los tickets que se quieren adelantar. - * @param vDateToAdvance Fecha a cuando se quiere adelantar. - * @param vWarehouseFk Almacén - */ - - DECLARE vDateInventory DATE; - - SELECT inventoried INTO vDateInventory FROM vn.config; - - DROP TEMPORARY TABLE IF EXISTS tmp.stock; - CREATE TEMPORARY TABLE tmp.stock - (itemFk INT PRIMARY KEY, - amount INT) - ENGINE = MEMORY; - - INSERT INTO tmp.stock(itemFk, amount) - SELECT itemFk, SUM(quantity) amount FROM - ( - SELECT itemFk, quantity - FROM vn.itemTicketOut - WHERE shipped >= vDateInventory - AND shipped < vDateFuture - AND warehouseFk = vWarehouseFk - UNION ALL - SELECT itemFk, quantity - FROM vn.itemEntryIn - WHERE landed >= vDateInventory - AND landed < vDateFuture - AND isVirtualStock = FALSE - AND warehouseInFk = vWarehouseFk - UNION ALL - SELECT itemFk, quantity - FROM vn.itemEntryOut - WHERE shipped >= vDateInventory - AND shipped < vDateFuture - AND warehouseOutFk = vWarehouseFk - ) t - GROUP BY itemFk HAVING amount != 0; - - DROP TEMPORARY TABLE IF EXISTS tmp.filter; - CREATE TEMPORARY TABLE tmp.filter - (INDEX (id)) - - SELECT - *, - CASE WHEN sub.futureLines = hasStock THEN '1' ELSE '0' END AS fullMovable - FROM (SELECT s.ticketFk futureId, - t2.ticketFk id, - count(DISTINCT s.id) saleCount, - t2.state, - st.name futureState, - GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) futureIpt, - t2.ipt, - t.workerFk, - CAST(SUM(litros) AS DECIMAL(10,0)) futureLiters, - CAST(COUNT(*) AS DECIMAL(10,0)) `futureLines`, - t2.shipped, - t.shipped futureShipped, - t2.totalWithVat, - t.totalWithVat futureTotalWithVat, - t2.agency, - am.name futureAgency, - t2.lines, - t2.liters, - SUM((s.quantity <= IFNULL(st.amount,0))) AS hasStock - FROM vn.ticket t - JOIN vn.sale s ON s.ticketFk = t.id - JOIN vn.saleVolume sv ON sv.saleFk = s.id - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.ticketState ts ON ts.ticketFk = t.id - JOIN vn.state st ON st.id = ts.stateFk - JOIN vn.agencyMode am ON t.agencyModeFk = am.id - LEFT JOIN vn.itemPackingType ipt ON ipt.code = i.itemPackingTypeFk - LEFT JOIN tmp.stock st ON st.itemFk = i.id - JOIN (SELECT - t2.id ticketFk, - t2.addressFk, - st.name state, - GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) ipt, - t2.shipped, - t2.totalWithVat, - am.name agency, - CAST(SUM(litros) AS DECIMAL(10,0)) liters, - CAST(COUNT(*) AS DECIMAL(10,0)) `lines` - FROM vn.ticket t2 - JOIN vn.sale s ON s.ticketFk = t2.id - JOIN vn.saleVolume sv ON sv.saleFk = s.id - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.ticketState ts ON ts.ticketFk = t2.id - JOIN vn.state st ON st.id = ts.stateFk - JOIN vn.agencyMode am ON t2.agencyModeFk = am.id - LEFT JOIN vn.itemPackingType ipt ON ipt.code = i.itemPackingTypeFk - WHERE t2.shipped BETWEEN vDateToAdvance AND util.dayend(vDateToAdvance) - AND t2.warehouseFk = vWarehouseFk - AND st.order <= 5 - GROUP BY t2.id) t2 ON t2.addressFk = t.addressFk - WHERE t.shipped BETWEEN vDateFuture AND util.dayend(vDateFuture) - AND t.warehouseFk = vWarehouseFk - GROUP BY t.id - ) sub - WHERE hasStock != 0; - - DROP TEMPORARY TABLE tmp.stock; -END$$ -DELIMITER ; diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 32f1de99f..e592bc123 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -778,18 +778,16 @@ export default { ipt: 'vn-autocomplete[label="Destination IPT"]', tableIpt: 'vn-autocomplete[name="ipt"]', tableFutureIpt: 'vn-autocomplete[name="futureIpt"]', - futureState: 'vn-check[label="Pending Origin"]', - state: 'vn-check[label="Pending Destination"]', + isFullMovable: 'vn-check[ng-model="filter.isFullMovable"]', warehouseFk: 'vn-autocomplete[label="Warehouse"]', tableButtonSearch: 'vn-button[vn-tooltip="Search"]', moveButton: 'vn-button[vn-tooltip="Advance tickets"]', acceptButton: '.vn-confirm.shown button[response="accept"]', - multiCheck: 'vn-multi-check', + firstCheck: 'tbody > tr:nth-child(1) > td > vn-check', tableId: 'vn-textfield[name="id"]', tableFutureId: 'vn-textfield[name="futureId"]', tableLiters: 'vn-textfield[name="liters"]', tableLines: 'vn-textfield[name="lines"]', - tableStock: 'vn-textfield[name="hasStock"]', submit: 'vn-submit[label="Search"]', table: 'tbody > tr:not(.empty-rows)' }, diff --git a/e2e/paths/05-ticket/22_advance.spec.js b/e2e/paths/05-ticket/22_advance.spec.js index 49ab5b0fc..c92cd7a20 100644 --- a/e2e/paths/05-ticket/22_advance.spec.js +++ b/e2e/paths/05-ticket/22_advance.spec.js @@ -88,7 +88,7 @@ describe('Ticket Advance path', () => { await page.waitToClick(selectors.ticketAdvance.tableButtonSearch); await page.autocompleteSearch(selectors.ticketAdvance.tableFutureIpt, 'Vertical'); - const request = httpRequests.find(req => req.includes(('ipt'))); + const request = httpRequests.find(req => req.includes(('futureIpt'))); expect(request).toBeDefined(); @@ -103,7 +103,7 @@ describe('Ticket Advance path', () => { await page.waitToClick(selectors.ticketAdvance.tableButtonSearch); await page.autocompleteSearch(selectors.ticketAdvance.tableIpt, 'Vertical'); - const request = httpRequests.find(req => req.includes(('futureIpt'))); + const request = httpRequests.find(req => req.includes(('ipt'))); expect(request).toBeDefined(); @@ -114,8 +114,8 @@ describe('Ticket Advance path', () => { await page.waitToClick(selectors.ticketAdvance.submit); }); - it('should check the one ticket and move to the present', async() => { - await page.waitToClick(selectors.ticketAdvance.multiCheck); + it('should check the first ticket and move to the present', async() => { + await page.waitToClick(selectors.ticketAdvance.firstCheck); await page.waitToClick(selectors.ticketAdvance.moveButton); await page.waitToClick(selectors.ticketAdvance.acceptButton); const message = await page.waitForSnackbar(); diff --git a/modules/ticket/back/methods/ticket/getTicketsAdvance.js b/modules/ticket/back/methods/ticket/getTicketsAdvance.js index 86911a477..ec9314db2 100644 --- a/modules/ticket/back/methods/ticket/getTicketsAdvance.js +++ b/modules/ticket/back/methods/ticket/getTicketsAdvance.js @@ -50,7 +50,7 @@ module.exports = Self => { required: false }, { - arg: 'fullMovable', + arg: 'isFullMovable', type: 'boolean', description: 'True when lines and stock of origin are equal', required: false @@ -99,8 +99,8 @@ module.exports = Self => { {'f.futureIpt': null} ] }; - case 'fullMovable': - return {'f.fullMovable': value}; + case 'isFullMovable': + return {'f.isFullMovable': value}; } }); diff --git a/modules/ticket/back/methods/ticket/specs/getTicketsAdvance.spec.js b/modules/ticket/back/methods/ticket/specs/getTicketsAdvance.spec.js index 1d1681b09..126f6b1af 100644 --- a/modules/ticket/back/methods/ticket/specs/getTicketsAdvance.spec.js +++ b/modules/ticket/back/methods/ticket/specs/getTicketsAdvance.spec.js @@ -39,7 +39,7 @@ describe('ticket getTicketsAdvance()', () => { dateFuture: tomorrow, dateToAdvance: today, warehouseFk: 1, - fullMovable: true + isFullMovable: true }; const ctx = {req: {accessToken: {userId: 9}}, args}; @@ -64,7 +64,7 @@ describe('ticket getTicketsAdvance()', () => { dateFuture: tomorrow, dateToAdvance: today, warehouseFk: 1, - fullMovable: false + isFullMovable: false }; const ctx = {req: {accessToken: {userId: 9}}, args}; diff --git a/modules/ticket/front/advance-search-panel/index.html b/modules/ticket/front/advance-search-panel/index.html index 233d00127..ee18c26f9 100644 --- a/modules/ticket/front/advance-search-panel/index.html +++ b/modules/ticket/front/advance-search-panel/index.html @@ -42,7 +42,7 @@ Liters - - + - + diff --git a/print/templates/reports/delivery-note/delivery-note.html b/print/templates/reports/delivery-note/delivery-note.html index 9f217ba22..eb133c0cd 100644 --- a/print/templates/reports/delivery-note/delivery-note.html +++ b/print/templates/reports/delivery-note/delivery-note.html @@ -66,7 +66,7 @@ - + @@ -145,7 +145,7 @@ - + diff --git a/print/templates/reports/invoice/invoice.html b/print/templates/reports/invoice/invoice.html index 60d06d528..a574961c2 100644 --- a/print/templates/reports/invoice/invoice.html +++ b/print/templates/reports/invoice/invoice.html @@ -96,7 +96,7 @@ - + From 31da648842ad114365df61f24ebe8fbcbe520d10 Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 17 Feb 2023 11:21:31 +0100 Subject: [PATCH 46/53] Updated e2e --- e2e/paths/05-ticket/16_summary.spec.js | 2 +- e2e/paths/06-claim/05_summary.spec.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/paths/05-ticket/16_summary.spec.js b/e2e/paths/05-ticket/16_summary.spec.js index 960998c7d..a6017e454 100644 --- a/e2e/paths/05-ticket/16_summary.spec.js +++ b/e2e/paths/05-ticket/16_summary.spec.js @@ -55,7 +55,7 @@ describe('Ticket Summary path', () => { let result = await page .waitToGetProperty(selectors.ticketSummary.firstSaleItemId, 'innerText'); - expect(result).toContain('000002'); + expect(result).toContain('2'); }); it(`should click on the first sale ID to make the item descriptor visible`, async() => { diff --git a/e2e/paths/06-claim/05_summary.spec.js b/e2e/paths/06-claim/05_summary.spec.js index 00b021f88..758dc2ee3 100644 --- a/e2e/paths/06-claim/05_summary.spec.js +++ b/e2e/paths/06-claim/05_summary.spec.js @@ -45,7 +45,7 @@ describe('Claim summary path', () => { it('should display the claimed line(s)', async() => { const result = await page.waitToGetProperty(selectors.claimSummary.firstSaleItemId, 'innerText'); - expect(result).toContain('000002'); + expect(result).toContain('2'); }); it(`should click on the first sale ID making the item descriptor visible`, async() => { From 853e06f5236ebfd2ebee3f986bf5ce42e1165285 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 17 Feb 2023 12:38:07 +0100 Subject: [PATCH 47/53] fix: card reload automatic --- modules/item/front/tags/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/item/front/tags/index.js b/modules/item/front/tags/index.js index bfa1f3f46..2c3b39d45 100644 --- a/modules/item/front/tags/index.js +++ b/modules/item/front/tags/index.js @@ -40,6 +40,7 @@ class Controller extends Section { this.$.model.refresh(); this.$.watcher.notifySaved(); this.$.watcher.updateOriginalData(); + this.card.reload(); }); } } From 7883723b8cae339718e87877423cdbc0938170a8 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 17 Feb 2023 12:54:59 +0100 Subject: [PATCH 48/53] move changes sql --- db/changes/{230801 => 230601}/00-itemConfig_warehouseFk.sql | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename db/changes/{230801 => 230601}/00-itemConfig_warehouseFk.sql (100%) diff --git a/db/changes/230801/00-itemConfig_warehouseFk.sql b/db/changes/230601/00-itemConfig_warehouseFk.sql similarity index 100% rename from db/changes/230801/00-itemConfig_warehouseFk.sql rename to db/changes/230601/00-itemConfig_warehouseFk.sql From 1db23b83c8747a4ae5c9e7b1d9bd8508f9b45f26 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 17 Feb 2023 12:56:47 +0100 Subject: [PATCH 49/53] delete changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 932c483c3..dfff45ecc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [2308.01] - 2023-03-09 ### Added -- (Artículos) El visible y disponible se calcula a partir de un almacén diferente dependiendo de la sección en la que te encuentres. Se ha añadido un icono que informa sobre a partir de que almacén se esta calculando. +- ### Changed - From c6304898b4fb0155379149eac579e94187de5196 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 17 Feb 2023 13:00:02 +0100 Subject: [PATCH 50/53] refactor: borrado insert, se ha hecho directamente sobre produccion --- CHANGELOG.md | 2 ++ db/changes/230601/00-itemConfig_warehouseFk.sql | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea4725448..71b9469f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - (Tickets -> Datos Básicos) Mensaje de confirmación al intentar generar tickets con negativos +- (Artículos) El visible y disponible se calcula a partir de un almacén diferente dependiendo de la sección en la que te encuentres. Se ha añadido un icono que informa sobre a partir de que almacén se esta calculando. ### Changed - (General -> Inicio) Ahora permite recuperar la contraseña tanto con el correo de recuperación como el usuario @@ -16,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - (Monitor de tickets) Cuando ordenas por columna, ya no se queda deshabilitado el botón de 'Actualizar' - (Zone -> Días de entrega) Al hacer click en un día, muestra correctamente las zonas +- (Artículos) El disponible en la vista previa se muestra correctamente ## [2304.01] - 2023-02-09 diff --git a/db/changes/230601/00-itemConfig_warehouseFk.sql b/db/changes/230601/00-itemConfig_warehouseFk.sql index 84987d512..c860986d6 100644 --- a/db/changes/230601/00-itemConfig_warehouseFk.sql +++ b/db/changes/230601/00-itemConfig_warehouseFk.sql @@ -2,5 +2,3 @@ ALTER TABLE `vn`.`itemConfig` ADD warehouseFk smallint(6) unsigned NULL; UPDATE `vn`.`itemConfig` SET warehouseFk=60 WHERE id=0; -INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) - VALUES('ItemConfig', '*', 'READ', 'ALLOW', 'ROLE', 'employee'); From c1b6d949ddc04a10e7de1908934c7589ee5676b4 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 17 Feb 2023 13:03:02 +0100 Subject: [PATCH 51/53] delete changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dfff45ecc..80fa1fb95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - ### Fixed -- (Artículos) El disponible en la vista previa se muestra correctamente +- ## [2306.01] - 2023-02-23 From b926666b25eee9732fe8590ca09702ba989333f8 Mon Sep 17 00:00:00 2001 From: alexandre Date: Mon, 20 Feb 2023 09:38:24 +0100 Subject: [PATCH 52/53] refs #5220 fonts updated --- front/core/styles/icons/salixfont.css | 6 ++++++ front/core/styles/icons/salixfont.eot | Bin 45876 -> 46420 bytes front/core/styles/icons/salixfont.svg | 7 +++++-- front/core/styles/icons/salixfont.ttf | Bin 45704 -> 46248 bytes front/core/styles/icons/salixfont.woff | Bin 45780 -> 46324 bytes 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/front/core/styles/icons/salixfont.css b/front/core/styles/icons/salixfont.css index 2dee94c3b..6f9b1fe15 100644 --- a/front/core/styles/icons/salixfont.css +++ b/front/core/styles/icons/salixfont.css @@ -32,6 +32,9 @@ .icon-100:before { content: "\e95a"; } +.icon-clientUnpaid:before { + content: "\e95b"; +} .icon-history:before { content: "\e968"; } @@ -337,6 +340,9 @@ .icon-solunion:before { content: "\e94e"; } +.icon-stowaway:before { + content: "\e94f"; +} .icon-splitline:before { content: "\e93e"; } diff --git a/front/core/styles/icons/salixfont.eot b/front/core/styles/icons/salixfont.eot index 48cc8641352306274761314e35ac182b73c95138..61a3be8b7a499b5ad3f597168c821e1139893db8 100644 GIT binary patch delta 946 zcmY*XOH5N~6h7zw|J&9=v6bF?+loZFU{L}V%B6}1AIXRy@(2wY-&N=|8JLTa5Efv` zj4_Tg6LTRfoW%DmN=Apl*0@op6DJuLlhFkmjSDv#qi!`MQ`$M#$724R@7#ON_nq%- zPUan2IV?zUn_daQ*`W5k)hK-XWz=?s(S&IkGacO!GzsCd9i?~_lDpOGfrJ&@M zB_*f)OJbbvVczMZOd^Q%09!nhbO98y!r)m5LJfpKhfUB0`ymMz;38awIk*oX>6$0f zjGM6;!+M3b9<_=Zl*1v}>z2LsnjCHj6VnjJut(zrk7gx1B`il(ufrgPR$d57oR58@3hjndjQ;_l&tS3q*8HI;tKaKMeq^;IYYFPV}NQ0t!NQAm3mr|#c z{494Gr>Lq!johtYG7AbL>fjRdITh#V=;&L*@4dZ0j*m|)CMU+n^M7SBFF(YKOon|a z>|83g75iN}6U^?iSGHGu>#dPjZC_igy7K)yjtRv0?vg4WIo5WRm$laloA9o2%`zbc z^uV%yL`*nWM#_Z5kR#qXOYe!iUUrr`onEJJ-HQB8ZWq3KzkBuaWJP;$TZmuAP{=g% zKbvNVKgz}U6~bi;n2WLJ$k=%#FUH6k%_8nN7-(F%ChWQHREqK`hH)|*KvuS4#Wm6? z8!MOo)*_{}{DQmMkBt&Piq9bruY3if!qK{FU)Pnw$opn+Bw|HT938c5=G z^3qrYXgAl%rbxi?1x!wfcy?1UnL{Aq~a5k1W0}jP|u&7 z{N%(vCm-))U|7Eb$Y;n+tSDfZ$yCO`umQ+tP{>QnO^pk`=?>(d0LsrR$S*EoU7W)NM%s4raNn~;Y6Dtt2 zY))nR(YCp?d%23zij|Ar$Mf5KW#DE38OU%i->?Wq|NrxUGYiXPyA6_(3_$iD78ao6 zP(l6Xf(^Bdn?G)JV00~VO>zC^7Us6ZozH!a2aCr7PbM!0Zx8P_A3dK7z8=0gzH|I! n{7U=|`Rn+{_%{S_1Y`v4391Wa2@MFH7J33~cKzn6&9@i - + + + @@ -96,6 +98,7 @@ + @@ -128,4 +131,4 @@ - \ No newline at end of file + diff --git a/front/core/styles/icons/salixfont.ttf b/front/core/styles/icons/salixfont.ttf index 4b090731cd5b94180ab1761a1003d2a3b0d0ae8d..89d3bd57d3429a743fb9421dd39b7ae8a38b38e7 100644 GIT binary patch delta 966 zcmXw2UrbYH6hG(tzT4K8LJPh3wv`d(f<*~fS}t{H+%RznB85OOneI;&N)y3$kr0-^ zO4JzQpO`}Spz$AU4<&vC*-Kw_mvr5`GN8U?hID zE#kfT_X~iVlt4BbnMlB8HV*L9Q)<|BJTf};`N8Myg#RG^S|Wa8jDD0(cE;d=^R-m& z93GnM!ksc#nTjeXMWvvuDS71|D#f{ZbkD7#l(~cN&Lr&s#hi%q9QdFf{Gh{!5Qa}7 z376n1%)<)Y2at5l8EVCy*or~DTHA(Nbv?>KzwC0zt|mADLEd(n`@Rwu z=&GvhY!D{l+H7BBLh|a~4TFdnvu+Gk3W*^{yfs7Txx7ubR#>ert9xsCVVRqSyUF9& zRF zt&nCIC9xr7mD|e~s7~2Yv-YzVs-WSQ9CaRSmiT8LqX3EgNSH<8Su~0b(ZW4%!0WL% zEsK)Phw04H@)YtoK&Eb`4LeTn{pOQIJ8M7EzPiu5FWuqj zSn4d@U((gzHG81-z;E6C-4osEa9wyh{7cV{o>Q9w1Ig&P^IoUCi7E1bmxnVjtPKFln`Hn6*blSV0Qnt2 zzDh=JNyR5736T66pq@WD`N@undrm&y$H1_D1yFz?H?g9CVJ1@<1H%R&pFtrnF*h|X z{H8mQe*!2!uOPp;1n5v8*pva1XJBUjGx0z-W7K3HMr%Fa z!$3X<0~1IT2!KJveBl291_l-ep!^>e7LW)EsNZ~KeJ$f=*NqO0u0^gXuHW3k+?KfW zxzF)n@mS!=aw)NL>K?vMad+vwaKog7%$w#qBq`Xyzs^)+q^MRLuP6Be#mz6KIi9opZ9rl zl5?KEVsHOs>Q|B0RzRSUdkc=0H3K;F20f`7CHdpAk?1G@#wl^tL~1zwc!po$k+tHf=u;9 zF?fH%yMH)wjC5T;6N$tk^Z)es^O5KTHO_iSwQ&XCv+?86kwM~`NORr9;r-9rMiVE; z=sr*X*Kyi$zC7c^3wUtmGHzA4#x&GGEvf}|S`8>#PYpM!nwvyu=t?OurQ~P2Q#nOdJ?i9cZpkbl5`8uAKsbQ@2zu|E`BisrePT+J{XN|H5YqkdixuRTQ4Y zVpta|{OWJ?`)qF8tmLrB)tW$do`4ch%T^0yKb)Jb?Aw0HmN>F@+dFWWe*xg-no|${ zTZ{Q(mY&W-I@?y>wV6PAhKt2T0Fj`4UL-#LJTtXArn5_PQ^*taq{rrWVf&fg-?Wal zv9_aa3w!)~GVOBv-HwvI&d$Eh^uCsTFS`1=Cb}|_>d18Darc()c=yE~PtRD-Z@uUH V<^DtcxBJaMKwV)v`_IC2{1>IC>M#HR delta 445 zcmezJlIhA*Cb4pVH#Y`G1|ZmUg@GGPcQ7zc{>UgYQA@ObRdQ}(0RsbL22f%S2v5wI zl$xGc3>0Hx0rEMZSRg&8G7Tuk!@#h50tkOOk?WI@nwY}Cuok4x420$XE)UND3IfHh z0Qo8)%zl`~CL_0`0x0$aXwM%I{=_5^o|B&pROh$;3s3;4j*(%{$;bP06DxogZvcuh zD1h-yrn0=m+*AgJjUqrb^FTN*{HA+BesKxVKU?7Hn1L*2=0B5p7`qvxCeL8B7G)A= z6lW0oFZNIDuh<{4-(tTQm?6HN#Kby@iDfe@(~q{zqTS0?lvb=<^gf>7<|_j?$ioZ_ z_wo&kVD$e#|2MO+Oun~XQj!74{=>oob}d*Pl&Iehc0?cv?#qvvzM*TXl*caEQoUy0u#e;xlA|AqjLfQ*1WL3N=lp#h=O PLQjCruHP)R`4%Gp5+r~> From 3ef0b3a68b579cf4f004ff01803abb25dbe0ae7f Mon Sep 17 00:00:00 2001 From: vicent Date: Mon, 20 Feb 2023 12:42:42 +0100 Subject: [PATCH 53/53] feat: add acl --- db/changes/230801/00-acl_itemConfig.sql | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 db/changes/230801/00-acl_itemConfig.sql diff --git a/db/changes/230801/00-acl_itemConfig.sql b/db/changes/230801/00-acl_itemConfig.sql new file mode 100644 index 000000000..8c35022b4 --- /dev/null +++ b/db/changes/230801/00-acl_itemConfig.sql @@ -0,0 +1,3 @@ +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES + ('ItemConfig', '*', '*', 'ALLOW', 'ROLE', 'employee');
- Stock + + Not Movable Lines @@ -155,7 +155,7 @@ {{::ticket.futureLiters | dashIfEmpty}}{{::ticket.hasStock | dashIfEmpty}}{{::ticket.notMovableLines | dashIfEmpty}} {{::ticket.futureLines | dashIfEmpty}} Date: Tue, 14 Feb 2023 08:08:48 +0100 Subject: [PATCH 25/53] refs #4588 moved hook from entryObservation to entry --- .../entry/back/models/entry-observation.js | 26 ------------- modules/entry/back/models/entry.js | 38 +++++++++++++++++++ 2 files changed, 38 insertions(+), 26 deletions(-) diff --git a/modules/entry/back/models/entry-observation.js b/modules/entry/back/models/entry-observation.js index f4782a733..77d15d85c 100644 --- a/modules/entry/back/models/entry-observation.js +++ b/modules/entry/back/models/entry-observation.js @@ -1,5 +1,4 @@ const UserError = require('vn-loopback/util/user-error'); -const LoopBackContext = require('loopback-context'); module.exports = Self => { Self.rewriteDbError(function(err) { @@ -7,29 +6,4 @@ module.exports = Self => { return new UserError(`The observation type can't be repeated`); return err; }); - - Self.observe('before save', async function(ctx, options) { - const loopBackContext = LoopBackContext.getCurrentContext(); - const userId = loopBackContext.active.accessToken.userId; - const entryId = ctx.instance.entryFk; - let tx; - const myOptions = {}; - - if (typeof options == 'object') - Object.assign(myOptions, options); - - if (!myOptions.transaction) { - tx = await Self.beginTransaction({}); - myOptions.transaction = tx; - } - - try { - const entry = await Self.app.models.Entry.findById(entryId, null, myOptions); - await entry.updateAttribute('observationEditorFk', userId, myOptions); - if (tx) await tx.commit(); - } catch (e) { - if (tx) await tx.rollback(); - throw e; - } - }); }; diff --git a/modules/entry/back/models/entry.js b/modules/entry/back/models/entry.js index 4854bc3d3..1980f964c 100644 --- a/modules/entry/back/models/entry.js +++ b/modules/entry/back/models/entry.js @@ -1,3 +1,4 @@ +const LoopBackContext = require('loopback-context'); module.exports = Self => { require('../methods/entry/filter')(Self); require('../methods/entry/getEntry')(Self); @@ -7,4 +8,41 @@ module.exports = Self => { require('../methods/entry/importBuysPreview')(Self); require('../methods/entry/lastItemBuys')(Self); require('../methods/entry/entryOrderPdf')(Self); + + Self.observe('before save', async function(ctx, options) { + if (ctx.isNewInstance) return; + + const changes = ctx.data || ctx.instance; + const orgData = ctx.currentInstance; + + const observation = changes.observation || orgData.observation; + const hasChanges = orgData && changes; + const observationChanged = hasChanges + && orgData.observation != observation; + + if (observationChanged) { + let tx; + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + const loopbackContext = LoopBackContext.getCurrentContext(); + const userId = loopbackContext.active.accessToken.userId; + const id = changes.id || orgData.id; + const entry = await Self.app.models.Entry.findById(id, null, myOptions); + await entry.updateAttribute('observationEditorFk', userId, myOptions); + if (tx) await tx.commit(); + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + } + }); }; From 7d5591462dbccaf2feecc1d1f558d91364191daa Mon Sep 17 00:00:00 2001 From: alexandre Date: Tue, 14 Feb 2023 09:08:49 +0100 Subject: [PATCH 26/53] refs #4588 entry sql --- db/changes/230601/00-entry.sql | 53 ++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 db/changes/230601/00-entry.sql diff --git a/db/changes/230601/00-entry.sql b/db/changes/230601/00-entry.sql new file mode 100644 index 000000000..f62433aaf --- /dev/null +++ b/db/changes/230601/00-entry.sql @@ -0,0 +1,53 @@ +ALTER TABLE `vn`.`entry` ADD observationEditorFk INT(10) unsigned NULL COMMENT 'Último usuario que ha modificado el campo evaNotes'; +ALTER TABLE `vn`.`entry` ADD CONSTRAINT entry_observationEditorFk FOREIGN KEY (observationEditorFk) REFERENCES account.user(id) ON UPDATE CASCADE; + +CREATE OR REPLACE DEFINER=`root`@`localhost` +VIEW `vn2008`.`entrySource` AS +select + `e`.`gestDocFk` AS `gestdoc_id`, + `e`.`id` AS `Id_Entrada`, + `e`.`invoiceNumber` AS `invoiceNumber`, + `e`.`reference` AS `reference`, + `e`.`isExcludedFromAvailable` AS `Inventario`, + `e`.`notes` AS `observaciones`, + `e`.`isConfirmed` AS `Confirmada`, + `e`.`isOrdered` AS `Pedida`, + `e`.`isRaid` AS `Redada`, + `e`.`evaNotes` AS `notas`, + `e`.`supplierFk` AS `Id_Proveedor`, + `tr`.`shipped` AS `shipment`, + `tr`.`landed` AS `landing`, + `w2`.`name` AS `wh_in`, + `w1`.`name` AS `wh_out`, + `am`.`name` AS `Agencia`, + `e`.`commission` AS `comision`, + `tr`.`warehouseInFk` AS `warehouse_id`, + `w1`.`id` AS `warehouse_id_out`, + `e`.`isBooked` AS `anotadoencaja`, + `e`.`invoiceInFk` AS `invoiceInFk`, + `e`.`companyFk` AS `empresa_id`, + `e`.`currencyFk` AS `Id_Moneda`, + `tr`.`id` AS `TravelFk`, + `e`.`sub` AS `sub`, + `e`.`kop` AS `kop`, + `e`.`pro` AS `pro`, + `e`.`invoiceAmount` AS `invoiceAmount`, + `w`.`code` AS `buyerCode`, + `e`.`typeFk` AS `typeFk`, + `w3`.`code` AS `observationWorkerCode` +from + (((((((`vn`.`entry` `e` +left join `vn`.`travel` `tr` on + (`e`.`travelFk` = `tr`.`id`)) +left join `vn`.`agencyMode` `am` on + (`am`.`id` = `tr`.`agencyModeFk`)) +left join `vn`.`warehouse` `w1` on + (`tr`.`warehouseOutFk` = `w1`.`id`)) +left join `vn`.`warehouse` `w2` on + (`tr`.`warehouseInFk` = `w2`.`id`)) +left join `vn`.`supplier` `s` on + (`e`.`supplierFk` = `s`.`id`)) +left join `vn`.`worker` `w` on + (`w`.`id` = `e`.`buyerFk`)) +left join `vn`.`worker` `w3` on + (`w3`.`id` = `e`.`observationEditorFk`)); From a5a0256e44490fb095c282aefb6103ce0744bb28 Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 14 Feb 2023 10:58:41 +0100 Subject: [PATCH 27/53] =?UTF-8?q?feat:=20a=C3=B1adido=20parametro=20que=20?= =?UTF-8?q?indica=20si=20genera=20uno=20o=20multiples=20ticket=20de=20abon?= =?UTF-8?q?o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../back/methods/invoiceOut/refund.js | 4 +- modules/ticket/back/methods/sale/refund.js | 105 +++++++++++++----- modules/ticket/back/methods/ticket/refund.js | 9 +- 3 files changed, 85 insertions(+), 33 deletions(-) diff --git a/modules/invoiceOut/back/methods/invoiceOut/refund.js b/modules/invoiceOut/back/methods/invoiceOut/refund.js index 7ad6b03ec..584e0939b 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/refund.js +++ b/modules/invoiceOut/back/methods/invoiceOut/refund.js @@ -35,8 +35,8 @@ module.exports = Self => { const tickets = await models.Ticket.find(filter, myOptions); const ticketsIds = tickets.map(ticket => ticket.id); - - const refundedTickets = await models.Ticket.refund(ticketsIds, myOptions); + const createSingleTicket = true; + const refundedTickets = await models.Ticket.refund(ticketsIds, createSingleTicket, myOptions); if (tx) await tx.commit(); diff --git a/modules/ticket/back/methods/sale/refund.js b/modules/ticket/back/methods/sale/refund.js index febef9730..3558be15a 100644 --- a/modules/ticket/back/methods/sale/refund.js +++ b/modules/ticket/back/methods/sale/refund.js @@ -12,6 +12,11 @@ module.exports = Self => { arg: 'servicesIds', type: ['number'] }, + { + arg: 'createSingleTicket', + type: 'boolean', + required: false + } ], returns: { type: ['number'], @@ -23,7 +28,7 @@ module.exports = Self => { } }); - Self.refund = async(salesIds, servicesIds, options) => { + Self.refund = async(salesIds, servicesIds, createSingleTicket = false, options) => { const models = Self.app.models; const myOptions = {}; let tx; @@ -63,38 +68,37 @@ module.exports = Self => { const ticketsIds = [...new Set(sales.map(sale => sale.ticketFk))]; const refundTickets = []; - - const now = Date.vnNew(); const mappedTickets = new Map(); + const now = Date.vnNew(); - for (let ticketId of ticketsIds) { - const filter = {include: {relation: 'address'}}; - const ticket = await models.Ticket.findById(ticketId, filter, myOptions); - - const refundTicket = await models.Ticket.create({ - clientFk: ticket.clientFk, - shipped: now, - addressFk: ticket.address().id, - agencyModeFk: refundAgencyMode.id, - nickname: ticket.address().nickname, - warehouseFk: ticket.warehouseFk, - companyFk: ticket.companyFk, - landed: now, - zoneFk: refoundZoneId - }, myOptions); - - refundTickets.push(refundTicket); - - mappedTickets.set(ticketId, refundTicket.id); - - await models.TicketRefund.create({ - refundTicketFk: refundTicket.id, - originalTicketFk: ticket.id, - }, myOptions); + const [firstTicketId] = ticketsIds; + if (createSingleTicket) { + await createTicketRefund( + firstTicketId, + refundTickets, + mappedTickets, + now, + refundAgencyMode, + refoundZoneId, + myOptions + ); + } else { + for (let ticketId of ticketsIds) { + await createTicketRefund( + ticketId, + refundTickets, + mappedTickets, + now, + refundAgencyMode, + refoundZoneId, + myOptions + ); + } } for (const sale of sales) { - const refundTicketId = mappedTickets.get(sale.ticketFk); + const refundTicketId = await getTicketRefundId(createSingleTicket, sale.ticketFk, refundTickets); + const createdSale = await models.Sale.create({ ticketFk: refundTicketId, itemFk: sale.itemFk, @@ -118,7 +122,7 @@ module.exports = Self => { const services = await models.TicketService.find(servicesFilter, myOptions); for (const service of services) { - const refundTicketId = mappedTickets.get(service.ticketFk); + const refundTicketId = await getTicketRefundId(createSingleTicket, service.ticketFk, refundTickets); await models.TicketService.create({ description: service.description, @@ -139,4 +143,47 @@ module.exports = Self => { throw e; } }; + + async function createTicketRefund( + ticketId, + refundTickets, + mappedTickets, + now, + refundAgencyMode, + refoundZoneId, + myOptions + ) { + const models = Self.app.models; + + const filter = {include: {relation: 'address'}}; + const ticket = await models.Ticket.findById(ticketId, filter, myOptions); + + const refundTicket = await models.Ticket.create({ + clientFk: ticket.clientFk, + shipped: now, + addressFk: ticket.address().id, + agencyModeFk: refundAgencyMode.id, + nickname: ticket.address().nickname, + warehouseFk: ticket.warehouseFk, + companyFk: ticket.companyFk, + landed: now, + zoneFk: refoundZoneId + }, myOptions); + + refundTickets.push(refundTicket); + + mappedTickets.set(ticketId, refundTicket.id); + + await models.TicketRefund.create({ + refundTicketFk: refundTicket.id, + originalTicketFk: ticket.id, + }, myOptions); + } + + async function getTicketRefundId(createSingleTicket, ticketId, refundTickets) { + if (createSingleTicket) { + const [firstRefundTicket] = refundTickets; + return firstRefundTicket.id; + } else return mappedTickets.get(ticketId); + } }; diff --git a/modules/ticket/back/methods/ticket/refund.js b/modules/ticket/back/methods/ticket/refund.js index 620c8b0c7..1f0021316 100644 --- a/modules/ticket/back/methods/ticket/refund.js +++ b/modules/ticket/back/methods/ticket/refund.js @@ -8,6 +8,11 @@ module.exports = Self => { type: ['number'], required: true }, + { + arg: 'createSingleTicket', + type: 'boolean', + required: false + } ], returns: { type: ['number'], @@ -19,7 +24,7 @@ module.exports = Self => { } }); - Self.refund = async(ticketsIds, options) => { + Self.refund = async(ticketsIds, createSingleTicket = false, options) => { const models = Self.app.models; const myOptions = {}; let tx; @@ -41,7 +46,7 @@ module.exports = Self => { const services = await models.TicketService.find(filter, myOptions); const servicesIds = services.map(service => service.id); - const refundedTickets = await models.Sale.refund(salesIds, servicesIds, myOptions); + const refundedTickets = await models.Sale.refund(salesIds, servicesIds, createSingleTicket, myOptions); if (tx) await tx.commit(); From ea2fd59cdc8e8e59ca3b6d12519ceb6a27e43166 Mon Sep 17 00:00:00 2001 From: alexandre Date: Tue, 14 Feb 2023 12:41:36 +0100 Subject: [PATCH 28/53] refs #5223 changed ref and email text --- db/changes/230402/00-clienteCompensado.sql | 3 + .../back/methods/client/createReceipt.js | 23 ++------ .../client/getClientOrSupplierReference.js | 58 +++++++++++++++++++ modules/client/back/models/client-methods.js | 1 + .../client/front/balance/create/index.html | 24 ++++---- modules/client/front/balance/create/index.js | 33 +++++++++-- .../client/front/balance/create/locale/es.yml | 4 +- .../balance-compensation.html | 4 +- .../balance-compensation/locale/es.yml | 8 +-- .../balance-compensation/sql/client.sql | 1 + 10 files changed, 115 insertions(+), 44 deletions(-) create mode 100644 db/changes/230402/00-clienteCompensado.sql create mode 100644 modules/client/back/methods/client/getClientOrSupplierReference.js diff --git a/db/changes/230402/00-clienteCompensado.sql b/db/changes/230402/00-clienteCompensado.sql new file mode 100644 index 000000000..ff1982b93 --- /dev/null +++ b/db/changes/230402/00-clienteCompensado.sql @@ -0,0 +1,3 @@ +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES + ('Client', 'getClientOrSupplierReference', 'READ', 'ALLOW', 'ROLE', 'employee'); diff --git a/modules/client/back/methods/client/createReceipt.js b/modules/client/back/methods/client/createReceipt.js index a75ee8844..b268aba35 100644 --- a/modules/client/back/methods/client/createReceipt.js +++ b/modules/client/back/methods/client/createReceipt.js @@ -67,7 +67,7 @@ module.exports = function(Self) { try { delete args.ctx; // Remove unwanted properties - const newReceipt = await models.Receipt.create(args, myOptions); + const originalClient = await models.Client.findById(args.clientFk, null, myOptions); const bank = await models.Bank.findById(args.bankFk, null, myOptions); const accountingType = await models.AccountingType.findById(bank.accountingTypeFk, null, myOptions); @@ -76,23 +76,8 @@ module.exports = function(Self) { if (!args.compensationAccount) throw new UserError('Compensation account is empty'); - const supplierCompensation = await models.Supplier.findOne({ - where: { - account: args.compensationAccount - } - }, myOptions); - - let clientCompensation = {}; - - if (!supplierCompensation) { - clientCompensation = await models.Client.findOne({ - where: { - accountingAccount: args.compensationAccount - } - }, myOptions); - } - if (!supplierCompensation && !clientCompensation) - throw new UserError('Invalid account'); + // Check compensation account exists + await models.Client.getClientOrSupplierReference(args.compensationAccount, myOptions); await Self.rawSql( `CALL vn.ledger_doCompensation(?, ?, ?, ?, ?, ?, ?)`, @@ -151,7 +136,7 @@ module.exports = function(Self) { myOptions ); } - + const newReceipt = await models.Receipt.create(args, myOptions); if (tx) await tx.commit(); return newReceipt; diff --git a/modules/client/back/methods/client/getClientOrSupplierReference.js b/modules/client/back/methods/client/getClientOrSupplierReference.js new file mode 100644 index 000000000..afb427315 --- /dev/null +++ b/modules/client/back/methods/client/getClientOrSupplierReference.js @@ -0,0 +1,58 @@ +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.remoteMethod('getClientOrSupplierReference', { + description: 'Returns the reference of a compensation providing a bank account', + accessType: 'READ', + accepts: { + arg: 'bankAccount', + type: 'number', + required: true, + description: 'The bank account of a client or a supplier', + http: {source: 'path'} + }, + returns: { + type: 'string', + root: true + }, + http: { + path: `/:bankAccount/getClientOrSupplierReference`, + verb: 'GET' + } + }); + + Self.getClientOrSupplierReference = async(bankAccount, options) => { + const models = Self.app.models; + const myOptions = {}; + let reference = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + const supplierCompensation = await models.Supplier.findOne({ + where: { + account: bankAccount + } + }, myOptions); + + reference.supplierId = supplierCompensation?.id; + reference.supplierName = supplierCompensation?.name; + + let clientCompensation = {}; + + if (!supplierCompensation) { + clientCompensation = await models.Client.findOne({ + where: { + accountingAccount: bankAccount + } + }, myOptions); + reference.clientId = clientCompensation?.id; + reference.clientName = clientCompensation?.name; + } + + if (!supplierCompensation && !clientCompensation) + throw new UserError('Invalid account'); + + return reference; + }; +}; diff --git a/modules/client/back/models/client-methods.js b/modules/client/back/models/client-methods.js index 4b20a822c..9241d80cf 100644 --- a/modules/client/back/models/client-methods.js +++ b/modules/client/back/models/client-methods.js @@ -47,4 +47,5 @@ module.exports = Self => { require('../methods/client/incotermsAuthorizationEmail')(Self); require('../methods/client/consumptionSendQueued')(Self); require('../methods/client/filter')(Self); + require('../methods/client/getClientOrSupplierReference')(Self); }; diff --git a/modules/client/front/balance/create/index.html b/modules/client/front/balance/create/index.html index 56e505463..b76c09356 100644 --- a/modules/client/front/balance/create/index.html +++ b/modules/client/front/balance/create/index.html @@ -11,7 +11,7 @@ @@ -48,6 +48,14 @@ max="$ctrl.maxAmount"> + +
Compensation
+ + +
- -
Compensation
- - -
- @@ -89,4 +89,4 @@ - \ No newline at end of file + diff --git a/modules/client/front/balance/create/index.js b/modules/client/front/balance/create/index.js index ab97a7291..b22d15936 100644 --- a/modules/client/front/balance/create/index.js +++ b/modules/client/front/balance/create/index.js @@ -60,11 +60,15 @@ class Controller extends Dialog { const accountingType = value.accountingType; this.viewReceipt = accountingType.code == 'cash'; - if (accountingType.receiptDescription != null) { - this.receipt.description = accountingType.receiptDescription; - if (this.originalDescription) this.receipt.description += `, ${this.originalDescription}`; - } else if (this.originalDescription) - this.receipt.description = this.originalDescription; + if (accountingType.code == 'compensation') + this.receipt.description = ''; + else { + if (accountingType.receiptDescription != null) { + this.receipt.description = accountingType.receiptDescription; + if (this.originalDescription) this.receipt.description += `, ${this.originalDescription}`; + } else if (this.originalDescription) + this.receipt.description = this.originalDescription; + } this.maxAmount = accountingType && accountingType.maxAmount; this.receipt.payed = new Date(); @@ -110,7 +114,24 @@ class Controller extends Dialog { } accountShortToStandard(value) { - this.receipt.compensationAccount = value.replace('.', '0'.repeat(11 - value.length)); + if (value) { + this.receipt.compensationAccount = value.replace('.', '0'.repeat(11 - value.length)); + this.$http.get(`Clients/${this.receipt.compensationAccount}/getClientOrSupplierReference`) + .then(res => { + if (res.data.clientId) { + this.receipt.description = this.$t('Client Compensation Reference', { + clientId: res.data.clientId, + clientName: res.data.clientName + }); + } else { + this.receipt.description = this.$t('Supplier Compensation Reference', { + supplierId: res.data.supplierId, + supplierName: res.data.supplierName + }); + } + }); + } else + this.receipt.description = ''; } getAmountPaid() { diff --git a/modules/client/front/balance/create/locale/es.yml b/modules/client/front/balance/create/locale/es.yml index 056590966..8c407708a 100644 --- a/modules/client/front/balance/create/locale/es.yml +++ b/modules/client/front/balance/create/locale/es.yml @@ -1,2 +1,4 @@ View receipt: Ver recibo -Amount exceeded: Según ley contra el fraude no se puede recibir cobros por importe igual o superior a {{maxAmount}} \ No newline at end of file +Amount exceeded: Según ley contra el fraude no se puede recibir cobros por importe igual o superior a {{maxAmount}} +Client Compensation Reference: "({{clientId}}) Ntro Cliente: {{clientName}}" +Supplier Compensation Reference: "({{supplierId}}) Ntro Proveedor: {{supplierName}}" diff --git a/print/templates/reports/balance-compensation/balance-compensation.html b/print/templates/reports/balance-compensation/balance-compensation.html index 1e9aa5661..d1a2788ed 100644 --- a/print/templates/reports/balance-compensation/balance-compensation.html +++ b/print/templates/reports/balance-compensation/balance-compensation.html @@ -17,8 +17,8 @@

{{$t('Agree') | uppercase}}

- {{$t('Date')}} {{formatDate(client.payed, '%d-%m-%Y')}} {{$t('Compensate')}} {{client.amountPaid}} € - {{$t('From client')}} {{client.name}} {{$t('Toclient')}} {{company.name}}. + {{$t('Date')}} {{client.payed | date('%d-%m-%Y')}} {{$t('Compensate')}} {{client.amountPaid}} € + {{$t('From client')}} {{client.name}} {{$t('Against the balance of')}}: {{client.invoiceFk}}.

{{$t('Reception')}} administracion@verdnatura.es diff --git a/print/templates/reports/balance-compensation/locale/es.yml b/print/templates/reports/balance-compensation/locale/es.yml index 546e55f06..1c76274ae 100644 --- a/print/templates/reports/balance-compensation/locale/es.yml +++ b/print/templates/reports/balance-compensation/locale/es.yml @@ -4,13 +4,13 @@ Compensation: Compensación de saldos deudores y acreedores In one hand: De una parte CIF: con CIF NIF: con NIF -Home: y domicilio sito en +Home: y domicilio sito en In other hand: De la otra Sr: Don/Doña Agree: Acuerdan Date: En fecha de -Compensate: se ha compensado el saldo de +Compensate: se ha compensado el saldo de From client: del cliente/proveedor -To client: con el cliente/proveedor +Against the balance of: contra el saldo de Reception: Por favor, rogamos confirmen la recepción de esta compensación al email -Greetings: Saludos cordiales, \ No newline at end of file +Greetings: Saludos cordiales, diff --git a/print/templates/reports/balance-compensation/sql/client.sql b/print/templates/reports/balance-compensation/sql/client.sql index b4463be23..c3679b68a 100644 --- a/print/templates/reports/balance-compensation/sql/client.sql +++ b/print/templates/reports/balance-compensation/sql/client.sql @@ -4,6 +4,7 @@ SELECT c.street, c.fi, c.city, + r.invoiceFk, r.amountPaid, r.payed FROM client c From a507f7e8fb3eea2cd3ea3f4bbbafcab8545d3c1a Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 14 Feb 2023 13:17:56 +0100 Subject: [PATCH 29/53] fix(boot_date): Date.vnUTC return new Date() --- loopback/server/boot/date.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loopback/server/boot/date.js b/loopback/server/boot/date.js index 0875b6d5f..810745562 100644 --- a/loopback/server/boot/date.js +++ b/loopback/server/boot/date.js @@ -4,7 +4,7 @@ module.exports = () => { if (!env || env === 'development') return new Date(Date.UTC(2001, 0, 1, 11)); - return new Date(Date.UTC()); + return new Date(); }; Date.vnNew = () => { From 7194e62cae4717b00804e5187d9b07386dde38cd Mon Sep 17 00:00:00 2001 From: alexandre Date: Tue, 14 Feb 2023 13:28:21 +0100 Subject: [PATCH 30/53] refs #4588 faked observationEditorFk in structure --- db/changes/230601/00-entry.sql | 53 ---------------------------------- db/dump/structure.sql | 4 ++- 2 files changed, 3 insertions(+), 54 deletions(-) delete mode 100644 db/changes/230601/00-entry.sql diff --git a/db/changes/230601/00-entry.sql b/db/changes/230601/00-entry.sql deleted file mode 100644 index f62433aaf..000000000 --- a/db/changes/230601/00-entry.sql +++ /dev/null @@ -1,53 +0,0 @@ -ALTER TABLE `vn`.`entry` ADD observationEditorFk INT(10) unsigned NULL COMMENT 'Último usuario que ha modificado el campo evaNotes'; -ALTER TABLE `vn`.`entry` ADD CONSTRAINT entry_observationEditorFk FOREIGN KEY (observationEditorFk) REFERENCES account.user(id) ON UPDATE CASCADE; - -CREATE OR REPLACE DEFINER=`root`@`localhost` -VIEW `vn2008`.`entrySource` AS -select - `e`.`gestDocFk` AS `gestdoc_id`, - `e`.`id` AS `Id_Entrada`, - `e`.`invoiceNumber` AS `invoiceNumber`, - `e`.`reference` AS `reference`, - `e`.`isExcludedFromAvailable` AS `Inventario`, - `e`.`notes` AS `observaciones`, - `e`.`isConfirmed` AS `Confirmada`, - `e`.`isOrdered` AS `Pedida`, - `e`.`isRaid` AS `Redada`, - `e`.`evaNotes` AS `notas`, - `e`.`supplierFk` AS `Id_Proveedor`, - `tr`.`shipped` AS `shipment`, - `tr`.`landed` AS `landing`, - `w2`.`name` AS `wh_in`, - `w1`.`name` AS `wh_out`, - `am`.`name` AS `Agencia`, - `e`.`commission` AS `comision`, - `tr`.`warehouseInFk` AS `warehouse_id`, - `w1`.`id` AS `warehouse_id_out`, - `e`.`isBooked` AS `anotadoencaja`, - `e`.`invoiceInFk` AS `invoiceInFk`, - `e`.`companyFk` AS `empresa_id`, - `e`.`currencyFk` AS `Id_Moneda`, - `tr`.`id` AS `TravelFk`, - `e`.`sub` AS `sub`, - `e`.`kop` AS `kop`, - `e`.`pro` AS `pro`, - `e`.`invoiceAmount` AS `invoiceAmount`, - `w`.`code` AS `buyerCode`, - `e`.`typeFk` AS `typeFk`, - `w3`.`code` AS `observationWorkerCode` -from - (((((((`vn`.`entry` `e` -left join `vn`.`travel` `tr` on - (`e`.`travelFk` = `tr`.`id`)) -left join `vn`.`agencyMode` `am` on - (`am`.`id` = `tr`.`agencyModeFk`)) -left join `vn`.`warehouse` `w1` on - (`tr`.`warehouseOutFk` = `w1`.`id`)) -left join `vn`.`warehouse` `w2` on - (`tr`.`warehouseInFk` = `w2`.`id`)) -left join `vn`.`supplier` `s` on - (`e`.`supplierFk` = `s`.`id`)) -left join `vn`.`worker` `w` on - (`w`.`id` = `e`.`buyerFk`)) -left join `vn`.`worker` `w3` on - (`w3`.`id` = `e`.`observationEditorFk`)); diff --git a/db/dump/structure.sql b/db/dump/structure.sql index 4626279e4..3186fa01f 100644 --- a/db/dump/structure.sql +++ b/db/dump/structure.sql @@ -26286,6 +26286,7 @@ CREATE TABLE `entry` ( `typeFk` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL COMMENT 'Tipo de entrada', `reference` varchar(50) COLLATE utf8mb3_unicode_ci DEFAULT NULL COMMENT 'Referencia para eti', `ref` varchar(50) GENERATED ALWAYS AS (`invoiceNumber`) VIRTUAL COMMENT 'Columna virtual provisional para Salix', + `observationEditorFk` INT(10) unsigned NULL COMMENT 'Último usuario que ha modificado el campo evaNotes', PRIMARY KEY (`id`), KEY `Id_Proveedor` (`supplierFk`), KEY `Fecha` (`dated`), @@ -26300,7 +26301,8 @@ CREATE TABLE `entry` ( CONSTRAINT `entry_FK_1` FOREIGN KEY (`typeFk`) REFERENCES `entryType` (`code`) ON UPDATE CASCADE, CONSTRAINT `entry_ibfk_1` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, CONSTRAINT `entry_ibfk_6` FOREIGN KEY (`travelFk`) REFERENCES `travel` (`id`) ON UPDATE CASCADE, - CONSTRAINT `entry_ibfk_7` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE + CONSTRAINT `entry_ibfk_7` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, + CONSTRAINT `entry_observationEditorFk` FOREIGN KEY (`observationEditorFk`) REFERENCES `account`.`user`(`id`) ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='InnoDB free: 88064 kB; (`Id_Proveedor`) REFER `vn2008/Provee'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; From e68afa316925d34e17e0e04f220604343a33638d Mon Sep 17 00:00:00 2001 From: alexandre Date: Wed, 15 Feb 2023 12:59:19 +0100 Subject: [PATCH 31/53] refs #5223 moved sql --- db/changes/{230402 => 230403}/00-clienteCompensado.sql | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename db/changes/{230402 => 230403}/00-clienteCompensado.sql (100%) diff --git a/db/changes/230402/00-clienteCompensado.sql b/db/changes/230403/00-clienteCompensado.sql similarity index 100% rename from db/changes/230402/00-clienteCompensado.sql rename to db/changes/230403/00-clienteCompensado.sql From dca5ae0f72e61720d491515ccf3f3e80894ded78 Mon Sep 17 00:00:00 2001 From: alexandre Date: Wed, 15 Feb 2023 13:14:52 +0100 Subject: [PATCH 32/53] refs #5223 added params --- .../back/methods/client/getClientOrSupplierReference.js | 5 ++--- modules/client/front/balance/create/index.js | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/client/back/methods/client/getClientOrSupplierReference.js b/modules/client/back/methods/client/getClientOrSupplierReference.js index afb427315..4c7201ee3 100644 --- a/modules/client/back/methods/client/getClientOrSupplierReference.js +++ b/modules/client/back/methods/client/getClientOrSupplierReference.js @@ -8,15 +8,14 @@ module.exports = Self => { arg: 'bankAccount', type: 'number', required: true, - description: 'The bank account of a client or a supplier', - http: {source: 'path'} + description: 'The bank account of a client or a supplier' }, returns: { type: 'string', root: true }, http: { - path: `/:bankAccount/getClientOrSupplierReference`, + path: `/getClientOrSupplierReference`, verb: 'GET' } }); diff --git a/modules/client/front/balance/create/index.js b/modules/client/front/balance/create/index.js index b22d15936..6d6e99e29 100644 --- a/modules/client/front/balance/create/index.js +++ b/modules/client/front/balance/create/index.js @@ -116,7 +116,8 @@ class Controller extends Dialog { accountShortToStandard(value) { if (value) { this.receipt.compensationAccount = value.replace('.', '0'.repeat(11 - value.length)); - this.$http.get(`Clients/${this.receipt.compensationAccount}/getClientOrSupplierReference`) + const params = {bankAccount: this.receipt.compensationAccount}; + this.$http.get(`Clients/getClientOrSupplierReference`, {params}) .then(res => { if (res.data.clientId) { this.receipt.description = this.$t('Client Compensation Reference', { From bb2eddc462f7cebfe2d3667c39c334708819fde5 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 16 Feb 2023 07:32:44 +0100 Subject: [PATCH 33/53] fix: test front --- modules/item/front/diary/index.spec.js | 1 + modules/item/front/summary/index.spec.js | 3 +++ 2 files changed, 4 insertions(+) diff --git a/modules/item/front/diary/index.spec.js b/modules/item/front/diary/index.spec.js index a80fbfc69..a6302346d 100644 --- a/modules/item/front/diary/index.spec.js +++ b/modules/item/front/diary/index.spec.js @@ -14,6 +14,7 @@ describe('Item', () => { controller = $componentController('vnItemDiary', {$element, $scope}); controller.$.model = crudModel; controller.$params = {id: 1}; + controller.card = {}; })); describe('set item()', () => { diff --git a/modules/item/front/summary/index.spec.js b/modules/item/front/summary/index.spec.js index 0b349194c..d7821bea0 100644 --- a/modules/item/front/summary/index.spec.js +++ b/modules/item/front/summary/index.spec.js @@ -14,12 +14,15 @@ describe('Item', () => { const $element = angular.element(''); controller = $componentController('vnItemSummary', {$element, $scope}); controller.item = {id: 1}; + controller.card = {}; })); describe('getSummary()', () => { it('should perform a query to set summary', () => { let data = {id: 1, name: 'Gem of mind'}; $httpBackend.expect('GET', `Items/1/getSummary`).respond(200, data); + $httpBackend.expect('GET', `ItemConfigs/findOne`).respond({}); + $httpBackend.expect('GET', `Warehouses/findOne`).respond({}); controller.getSummary(); $httpBackend.flush(); From dc2ab50f659fcd8cc29397db2ee2e6c6234d5e33 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 16 Feb 2023 09:44:06 +0100 Subject: [PATCH 34/53] fix: test e2e --- db/changes/230201/00-validPriorities_ItemConfig.sql | 4 ---- 1 file changed, 4 deletions(-) diff --git a/db/changes/230201/00-validPriorities_ItemConfig.sql b/db/changes/230201/00-validPriorities_ItemConfig.sql index a793997d0..0b32d5de8 100644 --- a/db/changes/230201/00-validPriorities_ItemConfig.sql +++ b/db/changes/230201/00-validPriorities_ItemConfig.sql @@ -3,7 +3,3 @@ ALTER TABLE `vn`.`itemConfig` ADD CONSTRAINT itemConfig_FK FOREIGN KEY (defaultT ALTER TABLE `vn`.`itemConfig` ADD validPriorities varchar(50) DEFAULT '[1,2,3]' NOT NULL; ALTER TABLE `vn`.`itemConfig` ADD defaultPriority INT DEFAULT 2 NOT NULL; ALTER TABLE `vn`.`item` MODIFY COLUMN relevancy tinyint(1) DEFAULT 0 NOT NULL COMMENT 'La web ordena de forma descendiente por este campo para mostrar los artículos'; - -INSERT INTO `salix`.`ACL` -(model, property, accessType, permission, principalType, principalId) -VALUES('ItemConfig', '*', 'READ', 'ALLOW', 'ROLE', 'buyer'); From 3dd870f7df7fe2903ebec4bb12c4958a36b2b689 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 16 Feb 2023 09:44:20 +0100 Subject: [PATCH 35/53] fix: test e2e --- db/changes/230202/00-itemConfig.sql | 4 ---- db/changes/230601/00-itemConfig_warehouseFk.sql | 2 ++ modules/item/front/summary/index.js | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/db/changes/230202/00-itemConfig.sql b/db/changes/230202/00-itemConfig.sql index a793997d0..0b32d5de8 100644 --- a/db/changes/230202/00-itemConfig.sql +++ b/db/changes/230202/00-itemConfig.sql @@ -3,7 +3,3 @@ ALTER TABLE `vn`.`itemConfig` ADD CONSTRAINT itemConfig_FK FOREIGN KEY (defaultT ALTER TABLE `vn`.`itemConfig` ADD validPriorities varchar(50) DEFAULT '[1,2,3]' NOT NULL; ALTER TABLE `vn`.`itemConfig` ADD defaultPriority INT DEFAULT 2 NOT NULL; ALTER TABLE `vn`.`item` MODIFY COLUMN relevancy tinyint(1) DEFAULT 0 NOT NULL COMMENT 'La web ordena de forma descendiente por este campo para mostrar los artículos'; - -INSERT INTO `salix`.`ACL` -(model, property, accessType, permission, principalType, principalId) -VALUES('ItemConfig', '*', 'READ', 'ALLOW', 'ROLE', 'buyer'); diff --git a/db/changes/230601/00-itemConfig_warehouseFk.sql b/db/changes/230601/00-itemConfig_warehouseFk.sql index b2e11146d..37631964a 100644 --- a/db/changes/230601/00-itemConfig_warehouseFk.sql +++ b/db/changes/230601/00-itemConfig_warehouseFk.sql @@ -1 +1,3 @@ ALTER TABLE `vn`.`itemConfig` ADD warehouseFk smallint(6) unsigned NULL; +INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) + VALUES('ItemConfig', '*', 'READ', 'ALLOW', 'ROLE', 'employee'); diff --git a/modules/item/front/summary/index.js b/modules/item/front/summary/index.js index 3d2517110..e17a6a8c4 100644 --- a/modules/item/front/summary/index.js +++ b/modules/item/front/summary/index.js @@ -10,8 +10,8 @@ class Controller extends Summary { this.$http.get('ItemConfigs/findOne') .then(res => { - this.card.warehouseFk = res.data.warehouseFk; - this.getWarehouseName(this.card.warehouseFk); + if (this.card) this.card.warehouseFk = res.data.warehouseFk; + this.getWarehouseName(res.data.warehouseFk); }); } From 76f203012574c025b346cfdf8d3e5d224c64d83a Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 16 Feb 2023 09:50:25 +0100 Subject: [PATCH 36/53] feat: add update sql --- db/changes/230601/00-itemConfig_warehouseFk.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/db/changes/230601/00-itemConfig_warehouseFk.sql b/db/changes/230601/00-itemConfig_warehouseFk.sql index 37631964a..84987d512 100644 --- a/db/changes/230601/00-itemConfig_warehouseFk.sql +++ b/db/changes/230601/00-itemConfig_warehouseFk.sql @@ -1,3 +1,6 @@ ALTER TABLE `vn`.`itemConfig` ADD warehouseFk smallint(6) unsigned NULL; +UPDATE `vn`.`itemConfig` + SET warehouseFk=60 +WHERE id=0; INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) VALUES('ItemConfig', '*', 'READ', 'ALLOW', 'ROLE', 'employee'); From b5d2d534350b4281c2b581415197130531ea0f23 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 16 Feb 2023 10:45:13 +0100 Subject: [PATCH 37/53] fix: test back --- .../back/methods/invoiceOut/specs/refund.spec.js | 2 +- modules/ticket/back/methods/sale/refund.js | 6 +++--- modules/ticket/back/methods/sale/specs/refund.spec.js | 7 ++++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/modules/invoiceOut/back/methods/invoiceOut/specs/refund.spec.js b/modules/invoiceOut/back/methods/invoiceOut/specs/refund.spec.js index 628318d42..c5a1ac603 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/specs/refund.spec.js +++ b/modules/invoiceOut/back/methods/invoiceOut/specs/refund.spec.js @@ -17,7 +17,7 @@ describe('InvoiceOut refund()', () => { try { const result = await models.InvoiceOut.refund('T1111111', options); - expect(result.length).toEqual(2); + expect(result.length).toEqual(1); await tx.rollback(); } catch (e) { diff --git a/modules/ticket/back/methods/sale/refund.js b/modules/ticket/back/methods/sale/refund.js index 3558be15a..7b63fd66e 100644 --- a/modules/ticket/back/methods/sale/refund.js +++ b/modules/ticket/back/methods/sale/refund.js @@ -97,7 +97,7 @@ module.exports = Self => { } for (const sale of sales) { - const refundTicketId = await getTicketRefundId(createSingleTicket, sale.ticketFk, refundTickets); + const refundTicketId = await getTicketRefundId(createSingleTicket, sale.ticketFk, refundTickets, mappedTickets); const createdSale = await models.Sale.create({ ticketFk: refundTicketId, @@ -122,7 +122,7 @@ module.exports = Self => { const services = await models.TicketService.find(servicesFilter, myOptions); for (const service of services) { - const refundTicketId = await getTicketRefundId(createSingleTicket, service.ticketFk, refundTickets); + const refundTicketId = await getTicketRefundId(createSingleTicket, service.ticketFk, refundTickets, mappedTickets); await models.TicketService.create({ description: service.description, @@ -180,7 +180,7 @@ module.exports = Self => { }, myOptions); } - async function getTicketRefundId(createSingleTicket, ticketId, refundTickets) { + async function getTicketRefundId(createSingleTicket, ticketId, refundTickets, mappedTickets) { if (createSingleTicket) { const [firstRefundTicket] = refundTickets; return firstRefundTicket.id; diff --git a/modules/ticket/back/methods/sale/specs/refund.spec.js b/modules/ticket/back/methods/sale/specs/refund.spec.js index 74077cf29..403b4b477 100644 --- a/modules/ticket/back/methods/sale/specs/refund.spec.js +++ b/modules/ticket/back/methods/sale/specs/refund.spec.js @@ -1,7 +1,7 @@ const models = require('vn-loopback/server/server').models; const LoopBackContext = require('loopback-context'); -describe('sale refund()', () => { +describe('Sale refund()', () => { const userId = 5; const activeCtx = { accessToken: {userId: userId}, @@ -22,7 +22,7 @@ describe('sale refund()', () => { try { const options = {transaction: tx}; - const response = await models.Sale.refund(salesIds, servicesIds, options); + const response = await models.Sale.refund(salesIds, servicesIds, false, options); expect(response.length).toBeGreaterThanOrEqual(1); @@ -40,7 +40,8 @@ describe('sale refund()', () => { try { const options = {transaction: tx}; - const tickets = await models.Sale.refund(salesIds, servicesIds, options); + const createSingleTicket = false; + const tickets = await models.Sale.refund(salesIds, servicesIds, createSingleTicket, options); const ticketsIds = tickets.map(ticket => ticket.id); From 3031ae251172f29f9bdf36942f2eb32138346dfe Mon Sep 17 00:00:00 2001 From: joan Date: Thu, 16 Feb 2023 14:28:33 +0100 Subject: [PATCH 38/53] Updated version --- db/changes/{230401 => 230601}/00-acl_notifications.sql | 0 .../{230401 => 230601}/00-uniqueKeyNotificationSubscription.sql | 0 db/changes/{230401 => 230601}/01-alter_notSubs.sql | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename db/changes/{230401 => 230601}/00-acl_notifications.sql (100%) rename db/changes/{230401 => 230601}/00-uniqueKeyNotificationSubscription.sql (100%) rename db/changes/{230401 => 230601}/01-alter_notSubs.sql (100%) diff --git a/db/changes/230401/00-acl_notifications.sql b/db/changes/230601/00-acl_notifications.sql similarity index 100% rename from db/changes/230401/00-acl_notifications.sql rename to db/changes/230601/00-acl_notifications.sql diff --git a/db/changes/230401/00-uniqueKeyNotificationSubscription.sql b/db/changes/230601/00-uniqueKeyNotificationSubscription.sql similarity index 100% rename from db/changes/230401/00-uniqueKeyNotificationSubscription.sql rename to db/changes/230601/00-uniqueKeyNotificationSubscription.sql diff --git a/db/changes/230401/01-alter_notSubs.sql b/db/changes/230601/01-alter_notSubs.sql similarity index 100% rename from db/changes/230401/01-alter_notSubs.sql rename to db/changes/230601/01-alter_notSubs.sql From 457fd3f5f914005ad359cafcbf0c114f7d665b0e Mon Sep 17 00:00:00 2001 From: alexandre Date: Thu, 16 Feb 2023 14:35:03 +0100 Subject: [PATCH 39/53] refs #5194 sql moved to 230404 --- db/changes/{230402 => 230404}/00-ticket_canAdvance.sql | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename db/changes/{230402 => 230404}/00-ticket_canAdvance.sql (100%) diff --git a/db/changes/230402/00-ticket_canAdvance.sql b/db/changes/230404/00-ticket_canAdvance.sql similarity index 100% rename from db/changes/230402/00-ticket_canAdvance.sql rename to db/changes/230404/00-ticket_canAdvance.sql From 4cae4448f6004cc398a1bafb655c32a040a67259 Mon Sep 17 00:00:00 2001 From: alexandre Date: Thu, 16 Feb 2023 14:45:11 +0100 Subject: [PATCH 40/53] refs #5194 moved invoiceOut to 230402 --- db/changes/{230404 => 230402}/00-invoiceOut_getWeight.sql | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename db/changes/{230404 => 230402}/00-invoiceOut_getWeight.sql (100%) diff --git a/db/changes/230404/00-invoiceOut_getWeight.sql b/db/changes/230402/00-invoiceOut_getWeight.sql similarity index 100% rename from db/changes/230404/00-invoiceOut_getWeight.sql rename to db/changes/230402/00-invoiceOut_getWeight.sql From 874f45995621281214b74b19c8e1a0ce7110c25b Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 17 Feb 2023 09:49:47 +0100 Subject: [PATCH 41/53] refactor: borrada variable innecesaria --- modules/invoiceOut/back/methods/invoiceOut/refund.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/invoiceOut/back/methods/invoiceOut/refund.js b/modules/invoiceOut/back/methods/invoiceOut/refund.js index 584e0939b..ba1fdfedd 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/refund.js +++ b/modules/invoiceOut/back/methods/invoiceOut/refund.js @@ -35,8 +35,7 @@ module.exports = Self => { const tickets = await models.Ticket.find(filter, myOptions); const ticketsIds = tickets.map(ticket => ticket.id); - const createSingleTicket = true; - const refundedTickets = await models.Ticket.refund(ticketsIds, createSingleTicket, myOptions); + const refundedTickets = await models.Ticket.refund(ticketsIds, true, myOptions); if (tx) await tx.commit(); From a59dac2b9f093b5f28a7a979f761a733ac2689f8 Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 17 Feb 2023 10:12:29 +0100 Subject: [PATCH 42/53] Added version 230801 --- CHANGELOG.md | 11 +++++++++++ db/changes/230801/.gitkeep | 0 package.json | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 db/changes/230801/.gitkeep diff --git a/CHANGELOG.md b/CHANGELOG.md index ea4725448..80fa1fb95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2308.01] - 2023-03-09 + +### Added +- + +### Changed +- + +### Fixed +- + ## [2306.01] - 2023-02-23 ### Added diff --git a/db/changes/230801/.gitkeep b/db/changes/230801/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/package.json b/package.json index 89bd1a3e8..4cf53911c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-back", - "version": "23.06.01", + "version": "23.08.01", "author": "Verdnatura Levante SL", "description": "Salix backend", "license": "GPL-3.0", From 5285ad9242fc780afe50d8b4afaaca557eac9489 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 17 Feb 2023 10:19:12 +0100 Subject: [PATCH 43/53] move sql changes --- db/changes/{230601 => 230801}/00-itemConfig_warehouseFk.sql | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename db/changes/{230601 => 230801}/00-itemConfig_warehouseFk.sql (100%) diff --git a/db/changes/230601/00-itemConfig_warehouseFk.sql b/db/changes/230801/00-itemConfig_warehouseFk.sql similarity index 100% rename from db/changes/230601/00-itemConfig_warehouseFk.sql rename to db/changes/230801/00-itemConfig_warehouseFk.sql From d869cccdb9d1b19ba46fbdf6f078bc1cb102e57f Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 17 Feb 2023 10:39:12 +0100 Subject: [PATCH 44/53] add changelog --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 80fa1fb95..932c483c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,13 +8,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [2308.01] - 2023-03-09 ### Added -- +- (Artículos) El visible y disponible se calcula a partir de un almacén diferente dependiendo de la sección en la que te encuentres. Se ha añadido un icono que informa sobre a partir de que almacén se esta calculando. ### Changed - ### Fixed -- +- (Artículos) El disponible en la vista previa se muestra correctamente ## [2306.01] - 2023-02-23 From 527caf9ca0a0e26bc17f3db78c99ab9338b876c7 Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 17 Feb 2023 11:19:35 +0100 Subject: [PATCH 45/53] refactor(zerofill): deprecated zerofill and removed function Refs: #5207 --- front/core/filters/index.js | 1 - front/core/filters/specs/zero-fill.spec.js | 25 ------------------- front/core/filters/zero-fill.js | 17 ------------- modules/claim/front/action/index.html | 2 +- modules/claim/front/summary/index.html | 4 +-- modules/entry/front/buy/index/index.html | 2 +- modules/entry/front/summary/index.html | 2 +- modules/invoiceIn/front/intrastat/index.html | 2 +- modules/invoiceIn/front/summary/index.html | 2 +- modules/order/front/line/index.html | 2 +- modules/order/front/summary/index.html | 2 +- .../front/basic-data/step-two/index.html | 2 +- modules/ticket/front/component/index.html | 2 +- modules/ticket/front/expedition/index.html | 2 +- modules/ticket/front/request/index/index.html | 2 +- modules/ticket/front/sale/index.html | 2 +- modules/ticket/front/summary/index.html | 4 +-- modules/ticket/front/volume/index.html | 2 +- print/core/filters/index.js | 1 - print/core/filters/specs/zerofill.spec.js | 9 ------- print/core/filters/zerofill.js | 10 -------- .../campaign-metrics/campaign-metrics.html | 2 +- .../reports/delivery-note/delivery-note.html | 4 +-- print/templates/reports/invoice/invoice.html | 2 +- 24 files changed, 21 insertions(+), 84 deletions(-) delete mode 100644 front/core/filters/specs/zero-fill.spec.js delete mode 100644 front/core/filters/zero-fill.js delete mode 100644 print/core/filters/specs/zerofill.spec.js delete mode 100644 print/core/filters/zerofill.js diff --git a/front/core/filters/index.js b/front/core/filters/index.js index 2c3f77ebe..6097a18a1 100644 --- a/front/core/filters/index.js +++ b/front/core/filters/index.js @@ -3,5 +3,4 @@ import './ucwords'; import './dash-if-empty'; import './percentage'; import './currency'; -import './zero-fill'; import './id'; diff --git a/front/core/filters/specs/zero-fill.spec.js b/front/core/filters/specs/zero-fill.spec.js deleted file mode 100644 index 97f04c655..000000000 --- a/front/core/filters/specs/zero-fill.spec.js +++ /dev/null @@ -1,25 +0,0 @@ -describe('ZeroFill filter', () => { - let zeroFillFilter; - - beforeEach(ngModule('vnCore')); - - beforeEach(inject(_zeroFillFilter_ => { - zeroFillFilter = _zeroFillFilter_; - })); - - it('should return null for a input null', () => { - expect(zeroFillFilter(null, null)).toBeNull(); - }); - - it('should return a positive number pads a number with five zeros', () => { - expect(zeroFillFilter(1, 5)).toBe('00001'); - }); - - it('should return negative number pads a number with five zeros', () => { - expect(zeroFillFilter(-1, 5)).toBe('-00001'); - }); - - it('should return zero number with zero zeros', () => { - expect(zeroFillFilter(0, 1)).toBe('0'); - }); -}); diff --git a/front/core/filters/zero-fill.js b/front/core/filters/zero-fill.js deleted file mode 100644 index c4d76b96f..000000000 --- a/front/core/filters/zero-fill.js +++ /dev/null @@ -1,17 +0,0 @@ -import ngModule from '../module'; - -/** - * Pads a number with zeros. - * - * @param {Number} input The number to pad - * @param {Number} padLength The resulting number of digits - * @return {String} The zero-filled number - */ -export default function zeroFill() { - return function(input, padLength) { - if (input == null) return input; - let sign = Math.sign(input) === -1 ? '-' : ''; - return sign + new Array(padLength).concat([Math.abs(input)]).join('0').slice(-padLength); - }; -} -ngModule.filter('zeroFill', zeroFill); diff --git a/modules/claim/front/action/index.html b/modules/claim/front/action/index.html index 35e788290..81b14d3a7 100644 --- a/modules/claim/front/action/index.html +++ b/modules/claim/front/action/index.html @@ -101,7 +101,7 @@ - {{::saleClaimed.itemFk | zeroFill:6}} + {{::saleClaimed.itemFk}}

diff --git a/modules/claim/front/summary/index.html b/modules/claim/front/summary/index.html index 6adbfd684..3115cb451 100644 --- a/modules/claim/front/summary/index.html +++ b/modules/claim/front/summary/index.html @@ -115,7 +115,7 @@ - {{::saleClaimed.sale.itemFk | zeroFill:6}} + {{::saleClaimed.sale.itemFk}} {{::saleClaimed.sale.ticket.landed | date: 'dd/MM/yyyy'}} @@ -241,7 +241,7 @@ - {{::action.sale.itemFk | zeroFill:6}} + {{::action.sale.itemFk}} diff --git a/modules/entry/front/buy/index/index.html b/modules/entry/front/buy/index/index.html index ae67e208b..de784198c 100644 --- a/modules/entry/front/buy/index/index.html +++ b/modules/entry/front/buy/index/index.html @@ -60,7 +60,7 @@ ng-if="buy.id" ng-click="itemDescriptor.show($event, buy.item.id)" class="link"> - {{::buy.item.id | zeroFill:6}} + {{::buy.item.id}} - {{::line.item.id | zeroFill:6}} + {{::line.item.id}} diff --git a/modules/invoiceIn/front/intrastat/index.html b/modules/invoiceIn/front/intrastat/index.html index cb447132d..fc0139303 100644 --- a/modules/invoiceIn/front/intrastat/index.html +++ b/modules/invoiceIn/front/intrastat/index.html @@ -47,7 +47,7 @@ show-field="description" rule vn-focus> - {{id | zeroFill:8}}: {{description}} + {{id}}: {{description}} - {{::intrastat.intrastatFk | zeroFill:8}}: {{::intrastat.intrastat.description}} + {{::intrastat.intrastatFk}}: {{::intrastat.intrastat.description}} {{::intrastat.amount | currency: 'EUR':2}} {{::intrastat.net}} {{::intrastat.stems}} diff --git a/modules/order/front/line/index.html b/modules/order/front/line/index.html index f0a2f2bdf..7be5a00af 100644 --- a/modules/order/front/line/index.html +++ b/modules/order/front/line/index.html @@ -39,7 +39,7 @@ - {{::row.itemFk | zeroFill:6}} + {{::row.itemFk}} diff --git a/modules/order/front/summary/index.html b/modules/order/front/summary/index.html index 2813aeb9b..3622ae932 100644 --- a/modules/order/front/summary/index.html +++ b/modules/order/front/summary/index.html @@ -95,7 +95,7 @@ - {{::row.itemFk | zeroFill:6}} + {{::row.itemFk}} diff --git a/modules/ticket/front/basic-data/step-two/index.html b/modules/ticket/front/basic-data/step-two/index.html index ad0c49dbb..fc57a354a 100644 --- a/modules/ticket/front/basic-data/step-two/index.html +++ b/modules/ticket/front/basic-data/step-two/index.html @@ -23,7 +23,7 @@ title="{{::sale.item.name}}" vn-click-stop="itemDescriptor.show($event, sale.itemFk, sale.id)" class="link"> - {{::sale.itemFk | zeroFill:6}} + {{::sale.itemFk}} diff --git a/modules/ticket/front/component/index.html b/modules/ticket/front/component/index.html index 1236059ae..39b54b461 100644 --- a/modules/ticket/front/component/index.html +++ b/modules/ticket/front/component/index.html @@ -27,7 +27,7 @@ - {{sale.itemFk | zeroFill:6}} + {{sale.itemFk}} diff --git a/modules/ticket/front/expedition/index.html b/modules/ticket/front/expedition/index.html index ec6dc7ee2..447411f3a 100644 --- a/modules/ticket/front/expedition/index.html +++ b/modules/ticket/front/expedition/index.html @@ -55,7 +55,7 @@ ng-model="expedition.checked"> - {{expedition.id | zeroFill:6}} + {{expedition.id}} - {{::request.saleFk | zeroFill:6}} + {{::request.saleFk}} - {{::sale.itemFk | zeroFill:6}} + {{::sale.itemFk}} {{::sale.concept}} diff --git a/modules/ticket/front/summary/index.html b/modules/ticket/front/summary/index.html index a7441dcf1..97055208b 100644 --- a/modules/ticket/front/summary/index.html +++ b/modules/ticket/front/summary/index.html @@ -177,7 +177,7 @@ - {{sale.itemFk | zeroFill:6}} + {{sale.itemFk}} @@ -312,7 +312,7 @@ ng-show="::request.saleFk" ng-click="itemDescriptor.show($event, request.sale.itemFk, request.sale.id)" class="link"> - {{request.sale.itemFk | zeroFill:6}} + {{request.sale.itemFk}} diff --git a/modules/ticket/front/volume/index.html b/modules/ticket/front/volume/index.html index 8f17a9475..f5dd18033 100644 --- a/modules/ticket/front/volume/index.html +++ b/modules/ticket/front/volume/index.html @@ -35,7 +35,7 @@ - {{sale.itemFk | zeroFill:6}} + {{sale.itemFk}} diff --git a/print/core/filters/index.js b/print/core/filters/index.js index efc398508..bfd99c504 100644 --- a/print/core/filters/index.js +++ b/print/core/filters/index.js @@ -4,5 +4,4 @@ require('./uppercase'); require('./currency'); require('./percentage'); require('./number'); -require('./zerofill'); diff --git a/print/core/filters/specs/zerofill.spec.js b/print/core/filters/specs/zerofill.spec.js deleted file mode 100644 index 1c00ff4a7..000000000 --- a/print/core/filters/specs/zerofill.spec.js +++ /dev/null @@ -1,9 +0,0 @@ -import zerofill from '../zerofill.js'; - -describe('zerofill filter', () => { - const superDuperNumber = 1984; - - it('should filter the number filling it with zeros up to 6 characters length', () => { - expect(zerofill(superDuperNumber, '000000')).toEqual('001984'); - }); -}); diff --git a/print/core/filters/zerofill.js b/print/core/filters/zerofill.js deleted file mode 100644 index c3d18079b..000000000 --- a/print/core/filters/zerofill.js +++ /dev/null @@ -1,10 +0,0 @@ -const Vue = require('vue'); - -const zerofill = function(value, pad) { - const valueStr = String(value); - return pad.substring(0, pad.length - valueStr.length) + valueStr; -}; - -Vue.filter('zerofill', zerofill); - -module.exports = zerofill; diff --git a/print/templates/reports/campaign-metrics/campaign-metrics.html b/print/templates/reports/campaign-metrics/campaign-metrics.html index 57d616a29..ad60c511c 100644 --- a/print/templates/reports/campaign-metrics/campaign-metrics.html +++ b/print/templates/reports/campaign-metrics/campaign-metrics.html @@ -45,7 +45,7 @@
{{sale.itemFk | zerofill('000000')}}{{sale.itemFk}} {{Math.trunc(sale.subtotal)}} {{sale.concept}}
{{sale.itemFk | zerofill('000000')}}{{sale.itemFk}} {{sale.quantity}} {{sale.concept}} {{sale.price | currency('EUR', $i18n.locale)}}
{{packaging.itemFk | zerofill('000000')}}{{packaging.itemFk}} {{packaging.quantity}} {{packaging.name}}
{{sale.itemFk | zerofill('000000')}}{{sale.itemFk}} {{sale.quantity}} {{sale.concept}} {{sale.price | currency('EUR', $i18n.locale)}}