diff --git a/modules/claim/back/methods/claim-beginning/importToNewRefundTicket.js b/modules/claim/back/methods/claim-beginning/importToNewRefundTicket.js index dbbf94927..9c2409124 100644 --- a/modules/claim/back/methods/claim-beginning/importToNewRefundTicket.js +++ b/modules/claim/back/methods/claim-beginning/importToNewRefundTicket.js @@ -61,7 +61,7 @@ module.exports = Self => { ], transaction); } - Self.importToNewRefundTicket = async (ctx, id) => { + Self.importToNewRefundTicket = async(ctx, id) => { let models = Self.app.models; let token = ctx.req.accessToken; let userId = token.userId; diff --git a/modules/client/front/log/index.js b/modules/client/front/log/index.js index 9c591052e..4552588e4 100644 --- a/modules/client/front/log/index.js +++ b/modules/client/front/log/index.js @@ -30,9 +30,13 @@ class Controller { } getInstance(instance) { + let validDate = /^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(.[0-9]+)?(Z)?$/; const properties = []; if (typeof instance == 'object' && instance != null) { Object.keys(instance).forEach(property => { + if (validDate.test(instance[property])) + instance[property] = new Date(instance[property]).toLocaleString('es-ES'); + properties.push({key: property, value: instance[property]}); }); return properties; diff --git a/modules/ticket/back/methods/ticket/new.js b/modules/ticket/back/methods/ticket/new.js index afb890415..c41362804 100644 --- a/modules/ticket/back/methods/ticket/new.js +++ b/modules/ticket/back/methods/ticket/new.js @@ -44,12 +44,12 @@ module.exports = Self => { let clientFk = address.clientFk; let agency; - if (params.agency) + if (params.agencyModeFk) agency = await Self.app.models.AgencyMode.findById(params.agencyModeFk); else agency = {code: null}; - if (agency.code != 'refund') { + if (agency.name != 'ABONO') { let query = `SELECT vn.clientGetDebt(?, CURDATE()) AS debt`; let clientDebt = await Self.rawSql(query, [clientFk]); diff --git a/modules/ticket/back/methods/ticket/summary.js b/modules/ticket/back/methods/ticket/summary.js index e67b438ff..b951b8f5c 100644 --- a/modules/ticket/back/methods/ticket/summary.js +++ b/modules/ticket/back/methods/ticket/summary.js @@ -120,8 +120,22 @@ module.exports = Self => { ticketFk: ticketFk }, include: [ - {relation: 'requester'}, - {relation: 'atender'} + { + relation: 'requester', + scope: { + include: { + relation: 'user' + } + } + }, + { + relation: 'atender', + scope: { + include: { + relation: 'user' + } + } + } ] }; return await Self.app.models.TicketRequest.find(filter); diff --git a/modules/ticket/front/log/index.js b/modules/ticket/front/log/index.js index 9b1ff55d3..fb1177162 100644 --- a/modules/ticket/front/log/index.js +++ b/modules/ticket/front/log/index.js @@ -31,8 +31,13 @@ class Controller { getInstance(instance) { const properties = []; + let validDate = /^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(.[0-9]+)?(Z)?$/; + if (typeof instance == 'object' && instance != null) { Object.keys(instance).forEach(property => { + if (validDate.test(instance[property])) + instance[property] = new Date(instance[property]).toLocaleString('es-ES'); + properties.push({key: property, value: instance[property]}); }); return properties; diff --git a/modules/ticket/front/summary/index.html b/modules/ticket/front/summary/index.html index d09490a57..9631af22e 100644 --- a/modules/ticket/front/summary/index.html +++ b/modules/ticket/front/summary/index.html @@ -161,7 +161,6 @@ - Id Description Created Requester @@ -174,17 +173,16 @@ - {{::request.id}} {{::request.description}} {{::request.created | dateTime: 'dd/MM/yyyy'}} - {{::request.requester.firstName}} {{::request.requester.name}} - {{::request.atender.firstName}} {{::request.atender.name}} + {{::request.requester.user.name}} + {{::request.atender.user.name}} {{::request.quantity}} {{::request.price}} {{("000000"+request.saleFk).slice(-6)}}