diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index eb3ae97ef..1d668adcd 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -4034,3 +4034,10 @@ INSERT IGNORE INTO vn.saySimpleConfig (url, defaultChannel) INSERT INTO vn.workerIrpf (workerFk,spouseNif, geographicMobilityDate) VALUES (1106,'26493101E','2019-09-20'); + +INSERT INTO vn.supplier (name, account, street, city, provinceFk, countryFk, nif, isOfficial, retAccount, phone, commission, nickname, payMethodFk, payDay, payDemFk, created, isReal, note, postcodeFk, postCode, isActive, taxTypeSageFk, withholdingSageFk, transactionTypeSageFk, isTrucker, workerFk, supplierActivityFk, healthRegister, isPayMethodChecked, isVies, stamp, companySize, geoFk, editorFk) + VALUES('TEST', '7185001382', 'supplier address 4', 'GOTHAM', 1, 1, '99999999A', 1, NULL, NULL, 0.0, 'Test', 1, 15, 2, '2001-01-01 00:00:00.000', 0, NULL, NULL, '46000', 1, 6, 9, 3, 0, 18, 'complements', '400664487V', 1, 0, NULL, NULL, NULL, 100); + +UPDATE vn.supplierAgencyTerm + SET supplierFk=1382 + WHERE agencyFk=3; diff --git a/modules/route/back/methods/route/getTickets.js b/modules/route/back/methods/route/getTickets.js index 86f3d9bf0..8517c287e 100644 --- a/modules/route/back/methods/route/getTickets.js +++ b/modules/route/back/methods/route/getTickets.js @@ -99,10 +99,12 @@ module.exports = Self => { const where = filter.where; where['r.id'] = filter.id; + console.log('filter', filter); stmt.merge(conn.makeWhere(filter.where)); stmt.merge(conn.makeGroupBy('t.id')); stmt.merge(conn.makeOrderBy(filter.order)); + console.log('stmt: ', stmt); return conn.executeStmt(stmt, myOptions); }; diff --git a/modules/route/back/methods/route/specs/getTickets.spec.js b/modules/route/back/methods/route/specs/getTickets.spec.js index 2f5453b3c..9edf525c0 100644 --- a/modules/route/back/methods/route/specs/getTickets.spec.js +++ b/modules/route/back/methods/route/specs/getTickets.spec.js @@ -18,7 +18,7 @@ fdescribe('route getTickets()', () => { id: 1101 // ID del proveedor ficticio }); - let result = await app.models.Route.getTickets(ctx, filter, options); + let result = await app.models.Route.getTickets(ctx, filter); console.log('ctx: ', ctx); // Verifica que todas las rutas pertenecen al proveedor simulado diff --git a/modules/supplier/back/models/supplier.js b/modules/supplier/back/models/supplier.js index 7daa42387..588e7c25a 100644 --- a/modules/supplier/back/models/supplier.js +++ b/modules/supplier/back/models/supplier.js @@ -171,7 +171,10 @@ module.exports = Self => { Object.assign(myOptions, options); const client = await Self.app.models.Client.findById(userId, null, myOptions); + console.log('client: ', client); + const supplier = await Self.app.models.Supplier.findOne({where: {nif: client.fi}}, myOptions); + console.log('supplier: ', supplier); return supplier; }; };