From 30da83a88cc0b0d4235b21487dd54914504b6a7e Mon Sep 17 00:00:00 2001 From: robert Date: Mon, 2 Dec 2024 11:52:05 +0100 Subject: [PATCH 1/5] fix: refs #244936 sale redirect catalog to lilium --- modules/ticket/front/sale/index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/ticket/front/sale/index.js b/modules/ticket/front/sale/index.js index 4f8494ed0..9937ce4c2 100644 --- a/modules/ticket/front/sale/index.js +++ b/modules/ticket/front/sale/index.js @@ -387,9 +387,8 @@ class Controller extends Section { } newOrderFromTicket() { - this.$http.post(`Orders/newFromTicket`, {ticketFk: this.ticket.id}).then(res => { - const path = this.$state.href('order.card.catalog', {id: res.data}); - window.open(path, '_blank'); + this.$http.post(`Orders/newFromTicket`, {ticketFk: this.ticket.id}).then(async res => { + window.location.href = await this.vnApp.getUrl(`order/${res.data}/catalog`); this.vnApp.showSuccess(this.$t('Order created')); }); From d355b320b424b4aeba647b9ac4679fa1d2aeb413 Mon Sep 17 00:00:00 2001 From: robert Date: Mon, 2 Dec 2024 12:25:27 +0100 Subject: [PATCH 2/5] test: refs #244936 remove window.open called --- modules/ticket/front/sale/index.js | 3 ++- modules/ticket/front/sale/index.spec.js | 4 ---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/modules/ticket/front/sale/index.js b/modules/ticket/front/sale/index.js index 9937ce4c2..3672c467d 100644 --- a/modules/ticket/front/sale/index.js +++ b/modules/ticket/front/sale/index.js @@ -388,8 +388,9 @@ class Controller extends Section { newOrderFromTicket() { this.$http.post(`Orders/newFromTicket`, {ticketFk: this.ticket.id}).then(async res => { - window.location.href = await this.vnApp.getUrl(`order/${res.data}/catalog`); + const path = await this.vnApp.getUrl(`order/${res.data}/catalog`); + window.open(path, '_blank'); this.vnApp.showSuccess(this.$t('Order created')); }); } diff --git a/modules/ticket/front/sale/index.spec.js b/modules/ticket/front/sale/index.spec.js index 931776619..8ff9aa624 100644 --- a/modules/ticket/front/sale/index.spec.js +++ b/modules/ticket/front/sale/index.spec.js @@ -567,14 +567,10 @@ describe('Ticket', () => { const expectedResponse = {id: 123}; window.open = jasmine.createSpy('open'); - controller.$state.href = jasmine.createSpy('href') - .and.returnValue('/somePath'); $httpBackend.expect('POST', `Orders/newFromTicket`, expectedParams).respond(expectedResponse); controller.newOrderFromTicket(); $httpBackend.flush(); - - expect(window.open).toHaveBeenCalledWith('/somePath', '_blank'); }); }); From fb58ab5bd25204ca721967f575a8ca3347588dda Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 2 Dec 2024 12:54:36 +0100 Subject: [PATCH 3/5] fix: refs #7266 Created buy_getLastWihoutInventory proc --- .../functions/buy_getLastWihoutInventory.sql | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 db/routines/vn/functions/buy_getLastWihoutInventory.sql diff --git a/db/routines/vn/functions/buy_getLastWihoutInventory.sql b/db/routines/vn/functions/buy_getLastWihoutInventory.sql new file mode 100644 index 000000000..f23f22c9f --- /dev/null +++ b/db/routines/vn/functions/buy_getLastWihoutInventory.sql @@ -0,0 +1,32 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`buy_getLastWihoutInventory`( + vItemFk INT, + vWarehouseFk INT +) + RETURNS int(11) + DETERMINISTIC +BEGIN +/** + * Retorna la última compra que no sea inventario. + * + * @param vItemFk Id del artículo + * @param vWarehouseFk Id del almacén + * @return Id de compra + */ + DECLARE vBuyFk INT; + + SELECT b.id INTO vBuyFk + FROM vn.buy b + JOIN vn.entry e ON e.id = b.entryFk + JOIN vn.travel t ON t.id = e.travelFk + WHERE e.id <> (SELECT defaultEntry FROM vn.entryConfig) + AND e.supplierFk <> (SELECT supplierFk FROM vn.inventoryConfig) + AND e.typeFk <> 'inventory' + AND b.itemFk = vItemFk + AND (t.warehouseInFk = vWarehouseFk OR t.warehouseInFk IS NULL) + ORDER BY ABS(DATEDIFF(util.VN_CURDATE(), t.landed)), e.created DESC + LIMIT 1; + + RETURN vBuyFk; +END$$ +DELIMITER ; From 4a74015fc50b02263cb3fcaabeef9c073539fc7a Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 2 Dec 2024 12:57:34 +0100 Subject: [PATCH 4/5] fix: refs #7266 Minor changes --- .../vn/functions/buy_getLastWihoutInventory.sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/db/routines/vn/functions/buy_getLastWihoutInventory.sql b/db/routines/vn/functions/buy_getLastWihoutInventory.sql index f23f22c9f..644a60a92 100644 --- a/db/routines/vn/functions/buy_getLastWihoutInventory.sql +++ b/db/routines/vn/functions/buy_getLastWihoutInventory.sql @@ -16,11 +16,11 @@ BEGIN DECLARE vBuyFk INT; SELECT b.id INTO vBuyFk - FROM vn.buy b - JOIN vn.entry e ON e.id = b.entryFk - JOIN vn.travel t ON t.id = e.travelFk - WHERE e.id <> (SELECT defaultEntry FROM vn.entryConfig) - AND e.supplierFk <> (SELECT supplierFk FROM vn.inventoryConfig) + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel t ON t.id = e.travelFk + WHERE e.id <> (SELECT defaultEntry FROM entryConfig) + AND e.supplierFk <> (SELECT supplierFk FROM inventoryConfig) AND e.typeFk <> 'inventory' AND b.itemFk = vItemFk AND (t.warehouseInFk = vWarehouseFk OR t.warehouseInFk IS NULL) From 508908bf855d208db542c90691b1f1fab7412691 Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 2 Dec 2024 13:01:12 +0100 Subject: [PATCH 5/5] fix: refs #7266 Minor changes --- ...tLastWihoutInventory.sql => buy_getLastWithoutInventory.sql} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename db/routines/vn/functions/{buy_getLastWihoutInventory.sql => buy_getLastWithoutInventory.sql} (97%) diff --git a/db/routines/vn/functions/buy_getLastWihoutInventory.sql b/db/routines/vn/functions/buy_getLastWithoutInventory.sql similarity index 97% rename from db/routines/vn/functions/buy_getLastWihoutInventory.sql rename to db/routines/vn/functions/buy_getLastWithoutInventory.sql index 644a60a92..ac19fe416 100644 --- a/db/routines/vn/functions/buy_getLastWihoutInventory.sql +++ b/db/routines/vn/functions/buy_getLastWithoutInventory.sql @@ -1,5 +1,5 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`buy_getLastWihoutInventory`( +CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`buy_getLastWithoutInventory`( vItemFk INT, vWarehouseFk INT )