diff --git a/e2e/paths/05-ticket/06_basic_data_steps.spec.js b/e2e/paths/05-ticket/06_basic_data_steps.spec.js index 7a09edf06..fa118c25d 100644 --- a/e2e/paths/05-ticket/06_basic_data_steps.spec.js +++ b/e2e/paths/05-ticket/06_basic_data_steps.spec.js @@ -94,7 +94,7 @@ describe('Ticket Edit basic data path', () => { it(`should split ticket without negatives`, async() => { const newAgency = 'Silla247'; const newDate = new Date(); - newDate.setDate(newDate.getDate() + 1); + newDate.setDate(newDate.getDate() - 1); await page.accessToSearchResult('14'); await page.accessToSection('ticket.card.basicData.stepOne'); diff --git a/modules/claim/back/methods/claim/filter.js b/modules/claim/back/methods/claim/filter.js index 16f23433b..f4b0c26a2 100644 --- a/modules/claim/back/methods/claim/filter.js +++ b/modules/claim/back/methods/claim/filter.js @@ -82,6 +82,7 @@ module.exports = Self => { Self.filter = async(ctx, filter, options) => { const conn = Self.dataSource.connector; const myOptions = {}; + let to; if (typeof options == 'object') Object.assign(myOptions, options); @@ -109,7 +110,11 @@ module.exports = Self => { case 'attenderFk': return {'cl.workerFk': value}; case 'created': - return {'cl.created': value}; + value.setHours(0, 0, 0, 0); + to = new Date(value); + to.setHours(23, 59, 59, 999); + + return {'cl.created': {between: [value, to]}}; } }); diff --git a/modules/ticket/back/methods/ticket/componentUpdate.js b/modules/ticket/back/methods/ticket/componentUpdate.js index 0fa26c9ea..2294e6d25 100644 --- a/modules/ticket/back/methods/ticket/componentUpdate.js +++ b/modules/ticket/back/methods/ticket/componentUpdate.js @@ -138,9 +138,8 @@ module.exports = Self => { const params = [args.id, args.shipped, args.warehouseFk]; const [salesMovable] = await Self.rawSql(query, params, myOptions); - const saleMovable = sale.movable ? sale.movable : 0; + const salesNewTicket = salesMovable.filter(sale => (sale.movable ? sale.movable : 0) >= sale.quantity); - const salesNewTicket = salesMovable.filter(sale => saleMovable >= sale.quantity); if (salesNewTicket.length) { const newTicket = await models.Ticket.transferSales(ctx, args.id, null, salesNewTicket, myOptions); args.id = newTicket.id; diff --git a/modules/ticket/back/methods/ticket/priceDifference.js b/modules/ticket/back/methods/ticket/priceDifference.js index d47fabd51..e0ffac55a 100644 --- a/modules/ticket/back/methods/ticket/priceDifference.js +++ b/modules/ticket/back/methods/ticket/priceDifference.js @@ -112,7 +112,7 @@ module.exports = Self => { // Get items movable const ticketOrigin = await models.Ticket.findById(args.id, null, myOptions); - const differenceShipped = ticketOrigin.shipped.getTime() != args.shipped.getTime(); + const differenceShipped = ticketOrigin.shipped.getTime() > args.shipped.getTime(); const differenceWarehouse = ticketOrigin.warehouseFk != args.warehouseId; salesObj.haveDifferences = differenceShipped || differenceWarehouse;