From ca48ad9777f6043300c237017d5267e1db72cb92 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Thu, 11 Jul 2024 19:55:19 +0200 Subject: [PATCH 1/8] feat(salix): refs #7648 #7648 add new entries and travels --- db/dump/fixtures.after.sql | 29 +++++++++++++++++++ .../item/specs/lastEntriesFilter.spec.js | 2 +- .../travel/specs/extraCommunityFilter.spec.js | 2 +- .../back/methods/travel/specs/filter.spec.js | 2 +- 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/db/dump/fixtures.after.sql b/db/dump/fixtures.after.sql index 562ea02d8..dd07b24c0 100644 --- a/db/dump/fixtures.after.sql +++ b/db/dump/fixtures.after.sql @@ -315,4 +315,33 @@ INSERT INTO mysql.roles_mapping (`User`, `Host`, `Role`, `Admin_option`) FROM mysql.roles_mapping WHERE `User` LIKE @prefixedLike AND `Host` = @genRoleHost; +UPDATE account.`user` + SET `role`=131 + WHERE id=1102; + +UPDATE vn.travel + SET shipped='2001-01-02',landed='2001-01-05' + WHERE id=4; +UPDATE vn.travel + SET shipped='2001-01-01',landed='2001-01-05' + WHERE id=5; +UPDATE vn.travel + SET landed='2001-01-05',shipped='2001-01-03' + WHERE id=6; +UPDATE vn.travel + SET shipped='2001-01-04',landed='2001-01-05' + WHERE id=7; + +UPDATE vn.travel + SET shipped='2001-01-05',landed='2001-01-05' + WHERE id=8; + +INSERT INTO vn.entry (supplierFk,invoiceNumber,isBooked,isExcludedFromAvailable,isConfirmed,isOrdered,isRaid,commission,created,evaNotes,travelFk,currencyFk,companyFk,isBlocked__,reference,editorFk,locked) + VALUES + (2,'IN2008',0,1,0,0,1,0.0,'2000-12-01 00:00:00.000','',7,1,442,0,'Movement 8',100,'2024-07-11 09:24:48.000'), + (2,'IN2008',0,1,0,0,1,0.0,'2000-12-01 00:00:00.000','',7,1,442,0,'Movement 8',100,'2024-07-11 09:24:48.000'), + (2,'IN2008',0,1,0,0,1,0.0,'2000-12-04 00:00:00.000','',7,1,442,0,'Movement 8',100,'2024-07-11 09:24:48.000'), + (2,'IN2008',0,1,0,0,1,0.0,'2000-12-02 00:00:00.000','',7,1,442,0,'Movement 8',100,'2024-07-11 09:24:48.000'), + (2,'IN2008',0,1,0,0,1,0.0,'2000-12-03 00:00:00.000','',8,1,442,0,'Movement 8',100,'2024-07-11 09:24:48.000'); + FLUSH PRIVILEGES; diff --git a/modules/item/back/methods/item/specs/lastEntriesFilter.spec.js b/modules/item/back/methods/item/specs/lastEntriesFilter.spec.js index 00488e534..a99402266 100644 --- a/modules/item/back/methods/item/specs/lastEntriesFilter.spec.js +++ b/modules/item/back/methods/item/specs/lastEntriesFilter.spec.js @@ -37,7 +37,7 @@ describe('item lastEntriesFilter()', () => { const filter = {where: {itemFk: 1, landed: {between: [minDate, maxDate]}}}; const result = await models.Item.lastEntriesFilter(filter, options); - expect(result.length).toEqual(5); + expect(result.length).toEqual(3); await tx.rollback(); } catch (e) { diff --git a/modules/travel/back/methods/travel/specs/extraCommunityFilter.spec.js b/modules/travel/back/methods/travel/specs/extraCommunityFilter.spec.js index 599851b55..0553aa58a 100644 --- a/modules/travel/back/methods/travel/specs/extraCommunityFilter.spec.js +++ b/modules/travel/back/methods/travel/specs/extraCommunityFilter.spec.js @@ -110,6 +110,6 @@ describe('Travel extraCommunityFilter()', () => { const result = await app.models.Travel.extraCommunityFilter(ctx, filter); - expect(result.length).toEqual(1); + expect(result.length).toEqual(6); }); }); diff --git a/modules/travel/back/methods/travel/specs/filter.spec.js b/modules/travel/back/methods/travel/specs/filter.spec.js index 1a6ee895c..3f8179c30 100644 --- a/modules/travel/back/methods/travel/specs/filter.spec.js +++ b/modules/travel/back/methods/travel/specs/filter.spec.js @@ -68,7 +68,7 @@ describe('Travel filter()', () => { const result = await app.models.Travel.filter(ctx); - expect(result.length).toEqual(1); + expect(result.length).toEqual(3); }); it('should return the travel matching "continent"', async() => { -- 2.40.1 From b28a8a34dc6445e12d5c2f46fac6c78b31c5d520 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Thu, 11 Jul 2024 19:55:36 +0200 Subject: [PATCH 2/8] feat(salix): refs #7648 #7648 add new filter --- modules/entry/back/methods/entry/filter.js | 21 +++++++++++++++++-- .../back/methods/entry/specs/filter.spec.js | 10 ++++----- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/modules/entry/back/methods/entry/filter.js b/modules/entry/back/methods/entry/filter.js index f21d9dbc4..0981247ee 100644 --- a/modules/entry/back/methods/entry/filter.js +++ b/modules/entry/back/methods/entry/filter.js @@ -2,6 +2,7 @@ const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; const buildFilter = require('vn-loopback/util/filter').buildFilter; const mergeFilters = require('vn-loopback/util/filter').mergeFilters; +const DEFAULT_INTERVAL_DAYS = 3; module.exports = Self => { Self.remoteMethodCtx('filter', { @@ -95,6 +96,11 @@ module.exports = Self => { arg: 'to', type: 'date', description: `The to date filter` + }, + { + arg: 'days', + type: 'number', + description: `N days interval` } ], returns: { @@ -183,15 +189,26 @@ module.exports = Self => { t.landed, t.ref AS travelRef, t.warehouseInFk, - w.name warehouseInName + w.name warehouseInName, + util.VN_CURDATE() FROM vn.entry e JOIN vn.supplier s ON s.id = e.supplierFk JOIN vn.travel t ON t.id = e.travelFk JOIN vn.warehouse w ON w.id = t.warehouseInFk JOIN vn.company co ON co.id = e.companyFk - JOIN vn.currency cu ON cu.id = e.currencyFk` + JOIN vn.currency cu ON cu.id = e.currencyFk + ` ); + if (supplier) { + stmt.merge({ + sql: ` + AND t.shipped < util.VN_CURDATE() + INTERVAL ? + 1 DAY + AND t.shipped >= util.VN_CURDATE() + `, + params: Array(1).fill(ctx.args.days ?? DEFAULT_INTERVAL_DAYS) + }); + } stmt.merge(conn.makeSuffix(filter)); const itemsIndex = stmts.push(stmt) - 1; diff --git a/modules/entry/back/methods/entry/specs/filter.spec.js b/modules/entry/back/methods/entry/specs/filter.spec.js index c8a5bd94f..d08400184 100644 --- a/modules/entry/back/methods/entry/specs/filter.spec.js +++ b/modules/entry/back/methods/entry/specs/filter.spec.js @@ -39,7 +39,7 @@ describe('Entry filter()', () => { const result = await models.Entry.filter(ctx, options); - expect(result.length).toEqual(9); + expect(result.length).toEqual(14); await tx.rollback(); } catch (e) { @@ -61,7 +61,7 @@ describe('Entry filter()', () => { const result = await models.Entry.filter(ctx, options); - expect(result.length).toEqual(6); + expect(result.length).toEqual(8); await tx.rollback(); } catch (e) { @@ -84,7 +84,7 @@ describe('Entry filter()', () => { const result = await models.Entry.filter(ctx, options); - expect(result.length).toEqual(6); + expect(result.length).toEqual(8); await tx.rollback(); } catch (e) { @@ -107,7 +107,7 @@ describe('Entry filter()', () => { const result = await models.Entry.filter(ctx, options); - expect(result.length).toEqual(6); + expect(result.length).toEqual(11); await tx.rollback(); } catch (e) { @@ -131,7 +131,7 @@ describe('Entry filter()', () => { const result = await models.Entry.filter(ctx, options); - expect(result.length).toEqual(8); + expect(result.length).toEqual(13); await tx.rollback(); } catch (e) { -- 2.40.1 From 47cff3f8946d29d7b714da549fde55eee7a23612 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Fri, 12 Jul 2024 08:52:03 +0200 Subject: [PATCH 3/8] feat(ssalix): refs #7648 remove select field --- modules/entry/back/methods/entry/filter.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/entry/back/methods/entry/filter.js b/modules/entry/back/methods/entry/filter.js index 0981247ee..77e5f2e67 100644 --- a/modules/entry/back/methods/entry/filter.js +++ b/modules/entry/back/methods/entry/filter.js @@ -189,8 +189,7 @@ module.exports = Self => { t.landed, t.ref AS travelRef, t.warehouseInFk, - w.name warehouseInName, - util.VN_CURDATE() + w.name warehouseInName FROM vn.entry e JOIN vn.supplier s ON s.id = e.supplierFk JOIN vn.travel t ON t.id = e.travelFk @@ -201,12 +200,13 @@ module.exports = Self => { ); if (supplier) { + const days = ctx.args.days ?? DEFAULT_INTERVAL_DAYS; stmt.merge({ sql: ` AND t.shipped < util.VN_CURDATE() + INTERVAL ? + 1 DAY AND t.shipped >= util.VN_CURDATE() `, - params: Array(1).fill(ctx.args.days ?? DEFAULT_INTERVAL_DAYS) + params: [days] }); } stmt.merge(conn.makeSuffix(filter)); -- 2.40.1 From c70824535a347a334dc62470ba79629aaeba9fd4 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Fri, 12 Jul 2024 20:52:00 +0200 Subject: [PATCH 4/8] feat(ssalix): refs #7648 clean fixtures --- db/dump/fixtures.after.sql | 26 -------------------------- db/dump/fixtures.before.sql | 7 +++++-- 2 files changed, 5 insertions(+), 28 deletions(-) diff --git a/db/dump/fixtures.after.sql b/db/dump/fixtures.after.sql index dd07b24c0..bc2c86b95 100644 --- a/db/dump/fixtures.after.sql +++ b/db/dump/fixtures.after.sql @@ -318,30 +318,4 @@ INSERT INTO mysql.roles_mapping (`User`, `Host`, `Role`, `Admin_option`) UPDATE account.`user` SET `role`=131 WHERE id=1102; - -UPDATE vn.travel - SET shipped='2001-01-02',landed='2001-01-05' - WHERE id=4; -UPDATE vn.travel - SET shipped='2001-01-01',landed='2001-01-05' - WHERE id=5; -UPDATE vn.travel - SET landed='2001-01-05',shipped='2001-01-03' - WHERE id=6; -UPDATE vn.travel - SET shipped='2001-01-04',landed='2001-01-05' - WHERE id=7; - -UPDATE vn.travel - SET shipped='2001-01-05',landed='2001-01-05' - WHERE id=8; - -INSERT INTO vn.entry (supplierFk,invoiceNumber,isBooked,isExcludedFromAvailable,isConfirmed,isOrdered,isRaid,commission,created,evaNotes,travelFk,currencyFk,companyFk,isBlocked__,reference,editorFk,locked) - VALUES - (2,'IN2008',0,1,0,0,1,0.0,'2000-12-01 00:00:00.000','',7,1,442,0,'Movement 8',100,'2024-07-11 09:24:48.000'), - (2,'IN2008',0,1,0,0,1,0.0,'2000-12-01 00:00:00.000','',7,1,442,0,'Movement 8',100,'2024-07-11 09:24:48.000'), - (2,'IN2008',0,1,0,0,1,0.0,'2000-12-04 00:00:00.000','',7,1,442,0,'Movement 8',100,'2024-07-11 09:24:48.000'), - (2,'IN2008',0,1,0,0,1,0.0,'2000-12-02 00:00:00.000','',7,1,442,0,'Movement 8',100,'2024-07-11 09:24:48.000'), - (2,'IN2008',0,1,0,0,1,0.0,'2000-12-03 00:00:00.000','',8,1,442,0,'Movement 8',100,'2024-07-11 09:24:48.000'); - FLUSH PRIVILEGES; diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 7446342c0..16c785bc6 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -1500,7 +1500,8 @@ INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseO (5, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 3, 1, 50.00, 500, 'fifth travel', 1, 1, 5), (6, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 4, 4, 1, 50.00, 500, 'sixth travel', 1, 2, 6), (7, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 4, 1, 50.00, 500, 'seventh travel', 2, 1, 7), - (8, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 1, 1, 50.00, 500, 'eight travel', 1, 2, 10); + (8, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 1, 1, 50.00, 500, 'eight travel', 1, 2, 10), + (10, DATE_ADD(util.VN_CURDATE(), INTERVAL + 5 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 5 DAY), 5, 1, 1, 50.00, 500, 'nineth travel', 1, 2, 10); INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `invoiceNumber`, `reference`, `isExcludedFromAvailable`, `isRaid`, `evaNotes`) VALUES @@ -1511,7 +1512,9 @@ INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed (5, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 0, 442, 'IN2005', 'Movement 5', 0, 0, 'observation five'), (6, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 6, 0, 442, 'IN2006', 'Movement 6', 0, 0, 'observation six'), (7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2007', 'Movement 7', 0, 0, 'observation seven'), - (8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2008', 'Movement 8', 1, 1, ''); + (8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2008', 'Movement 8', 1, 1, ''), + (9, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 9', 1, 1, ''), + (10, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 9', 1, 1, ''); INSERT INTO `bs`.`waste`(`buyer`, `year`, `week`, `family`, `itemFk`, `itemTypeFk`, `saleTotal`, `saleWaste`, `rate`) VALUES -- 2.40.1 From 5dcabd687e1eb3a68231193cec90b9e60311733c Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Fri, 12 Jul 2024 20:52:26 +0200 Subject: [PATCH 5/8] feat(ssalix): refs #7648 clean test !entry.filter --- .../item/back/methods/item/specs/lastEntriesFilter.spec.js | 2 +- .../back/methods/travel/specs/extraCommunityFilter.spec.js | 4 ++-- modules/travel/back/methods/travel/specs/filter.spec.js | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/item/back/methods/item/specs/lastEntriesFilter.spec.js b/modules/item/back/methods/item/specs/lastEntriesFilter.spec.js index a99402266..00488e534 100644 --- a/modules/item/back/methods/item/specs/lastEntriesFilter.spec.js +++ b/modules/item/back/methods/item/specs/lastEntriesFilter.spec.js @@ -37,7 +37,7 @@ describe('item lastEntriesFilter()', () => { const filter = {where: {itemFk: 1, landed: {between: [minDate, maxDate]}}}; const result = await models.Item.lastEntriesFilter(filter, options); - expect(result.length).toEqual(3); + expect(result.length).toEqual(5); await tx.rollback(); } catch (e) { diff --git a/modules/travel/back/methods/travel/specs/extraCommunityFilter.spec.js b/modules/travel/back/methods/travel/specs/extraCommunityFilter.spec.js index 0553aa58a..7e90c7681 100644 --- a/modules/travel/back/methods/travel/specs/extraCommunityFilter.spec.js +++ b/modules/travel/back/methods/travel/specs/extraCommunityFilter.spec.js @@ -79,7 +79,7 @@ describe('Travel extraCommunityFilter()', () => { const result = await app.models.Travel.extraCommunityFilter(ctx, filter); - expect(result.length).toEqual(8); + expect(result.length).toEqual(9); }); it('should return the travel matching "cargoSupplierFk"', async() => { @@ -110,6 +110,6 @@ describe('Travel extraCommunityFilter()', () => { const result = await app.models.Travel.extraCommunityFilter(ctx, filter); - expect(result.length).toEqual(6); + expect(result.length).toEqual(2); }); }); diff --git a/modules/travel/back/methods/travel/specs/filter.spec.js b/modules/travel/back/methods/travel/specs/filter.spec.js index 3f8179c30..a608a980e 100644 --- a/modules/travel/back/methods/travel/specs/filter.spec.js +++ b/modules/travel/back/methods/travel/specs/filter.spec.js @@ -50,7 +50,7 @@ describe('Travel filter()', () => { const result = await app.models.Travel.filter(ctx); - expect(result.length).toEqual(5); + expect(result.length).toEqual(6); }); it('should return the routes matching "shipped from" and "shipped to"', async() => { @@ -68,7 +68,7 @@ describe('Travel filter()', () => { const result = await app.models.Travel.filter(ctx); - expect(result.length).toEqual(3); + expect(result.length).toEqual(1); }); it('should return the travel matching "continent"', async() => { @@ -80,6 +80,6 @@ describe('Travel filter()', () => { const result = await app.models.Travel.filter(ctx); - expect(result.length).toEqual(5); + expect(result.length).toEqual(6); }); }); -- 2.40.1 From 1d23554508e2d58539a56d5c8059f1f794b974a8 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Fri, 12 Jul 2024 20:52:52 +0200 Subject: [PATCH 6/8] perf(ssalix): refs #7648 remove default value --- modules/entry/back/methods/entry/filter.js | 9 +++------ modules/entry/back/methods/entry/specs/filter.spec.js | 10 +++++----- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/modules/entry/back/methods/entry/filter.js b/modules/entry/back/methods/entry/filter.js index 77e5f2e67..2e2b8e467 100644 --- a/modules/entry/back/methods/entry/filter.js +++ b/modules/entry/back/methods/entry/filter.js @@ -2,7 +2,6 @@ const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; const buildFilter = require('vn-loopback/util/filter').buildFilter; const mergeFilters = require('vn-loopback/util/filter').mergeFilters; -const DEFAULT_INTERVAL_DAYS = 3; module.exports = Self => { Self.remoteMethodCtx('filter', { @@ -195,18 +194,16 @@ module.exports = Self => { JOIN vn.travel t ON t.id = e.travelFk JOIN vn.warehouse w ON w.id = t.warehouseInFk JOIN vn.company co ON co.id = e.companyFk - JOIN vn.currency cu ON cu.id = e.currencyFk - ` + JOIN vn.currency cu ON cu.id = e.currencyFk` ); - if (supplier) { - const days = ctx.args.days ?? DEFAULT_INTERVAL_DAYS; + if (supplier && ctx.args.days) { stmt.merge({ sql: ` AND t.shipped < util.VN_CURDATE() + INTERVAL ? + 1 DAY AND t.shipped >= util.VN_CURDATE() `, - params: [days] + params: [ctx.args.days] }); } stmt.merge(conn.makeSuffix(filter)); diff --git a/modules/entry/back/methods/entry/specs/filter.spec.js b/modules/entry/back/methods/entry/specs/filter.spec.js index d08400184..c7156062a 100644 --- a/modules/entry/back/methods/entry/specs/filter.spec.js +++ b/modules/entry/back/methods/entry/specs/filter.spec.js @@ -39,7 +39,7 @@ describe('Entry filter()', () => { const result = await models.Entry.filter(ctx, options); - expect(result.length).toEqual(14); + expect(result.length).toEqual(11); await tx.rollback(); } catch (e) { @@ -55,13 +55,13 @@ describe('Entry filter()', () => { try { const ctx = { - args: {}, + args: {days: 6}, req: {accessToken: {userId: 1102}} }; const result = await models.Entry.filter(ctx, options); - expect(result.length).toEqual(8); + expect(result.length).toEqual(2); await tx.rollback(); } catch (e) { @@ -107,7 +107,7 @@ describe('Entry filter()', () => { const result = await models.Entry.filter(ctx, options); - expect(result.length).toEqual(11); + expect(result.length).toEqual(8); await tx.rollback(); } catch (e) { @@ -131,7 +131,7 @@ describe('Entry filter()', () => { const result = await models.Entry.filter(ctx, options); - expect(result.length).toEqual(13); + expect(result.length).toEqual(10); await tx.rollback(); } catch (e) { -- 2.40.1 From 0ca4bffaf0e0541ab18a96d3bc99bb54c29320d1 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Sat, 13 Jul 2024 18:07:46 +0000 Subject: [PATCH 7/8] Perf: improve condition days filter --- modules/entry/back/methods/entry/filter.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/entry/back/methods/entry/filter.js b/modules/entry/back/methods/entry/filter.js index 2e2b8e467..4b47c625e 100644 --- a/modules/entry/back/methods/entry/filter.js +++ b/modules/entry/back/methods/entry/filter.js @@ -1,4 +1,3 @@ - const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; const buildFilter = require('vn-loopback/util/filter').buildFilter; const mergeFilters = require('vn-loopback/util/filter').mergeFilters; @@ -197,7 +196,7 @@ module.exports = Self => { JOIN vn.currency cu ON cu.id = e.currencyFk` ); - if (supplier && ctx.args.days) { + if (ctx.args.days) { stmt.merge({ sql: ` AND t.shipped < util.VN_CURDATE() + INTERVAL ? + 1 DAY -- 2.40.1 From fb8b31b397292c737b5e5980a2ab4aa08ae0ec4f Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 15 Jul 2024 09:59:52 +0200 Subject: [PATCH 8/8] perf: refs #7648 #7648 clean fixtures and SQL filter --- db/dump/fixtures.after.sql | 4 ---- db/dump/fixtures.before.sql | 2 +- modules/entry/back/methods/entry/filter.js | 4 ++-- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/db/dump/fixtures.after.sql b/db/dump/fixtures.after.sql index bc2c86b95..84ce0d940 100644 --- a/db/dump/fixtures.after.sql +++ b/db/dump/fixtures.after.sql @@ -314,8 +314,4 @@ INSERT INTO mysql.roles_mapping (`User`, `Host`, `Role`, `Admin_option`) SELECT SUBSTR(`User`, @prefixLen + 1), `Host`, `Role`, `Admin_option` FROM mysql.roles_mapping WHERE `User` LIKE @prefixedLike AND `Host` = @genRoleHost; - -UPDATE account.`user` - SET `role`=131 - WHERE id=1102; FLUSH PRIVILEGES; diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 16c785bc6..db0fab77f 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -121,7 +121,7 @@ INSERT INTO hedera.orderConfig (`id`, `employeeFk`, `defaultAgencyFk`, `guestMet INSERT INTO `account`.`user`(`id`,`name`,`nickname`, `password`,`role`,`active`,`email`,`lang`, `image`) VALUES (1101, 'brucewayne', 'Bruce Wayne', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'BruceWayne@mydomain.com', 'es','1101'), - (1102, 'petterparker', 'Petter Parker', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'PetterParker@mydomain.com', 'en','1102'), + (1102, 'petterparker', 'Petter Parker', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 131, 1, 'PetterParker@mydomain.com', 'en','1102'), (1103, 'clarkkent', 'Clark Kent', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'ClarkKent@mydomain.com', 'fr','1103'), (1104, 'tonystark', 'Tony Stark', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'TonyStark@mydomain.com', 'es','1104'), (1105, 'maxeisenhardt', 'Max Eisenhardt', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'MaxEisenhardt@mydomain.com', 'pt','1105'), diff --git a/modules/entry/back/methods/entry/filter.js b/modules/entry/back/methods/entry/filter.js index 2e2b8e467..5fbfd2d0f 100644 --- a/modules/entry/back/methods/entry/filter.js +++ b/modules/entry/back/methods/entry/filter.js @@ -197,10 +197,10 @@ module.exports = Self => { JOIN vn.currency cu ON cu.id = e.currencyFk` ); - if (supplier && ctx.args.days) { + if (ctx.args.days) { stmt.merge({ sql: ` - AND t.shipped < util.VN_CURDATE() + INTERVAL ? + 1 DAY + AND t.shipped <= util.VN_CURDATE() + INTERVAL ? DAY AND t.shipped >= util.VN_CURDATE() `, params: [ctx.args.days] -- 2.40.1