3586-claim_filter and non ECMA compatible bugs #870
|
@ -94,7 +94,7 @@ describe('Ticket Edit basic data path', () => {
|
||||||
it(`should split ticket without negatives`, async() => {
|
it(`should split ticket without negatives`, async() => {
|
||||||
const newAgency = 'Silla247';
|
const newAgency = 'Silla247';
|
||||||
const newDate = new Date();
|
const newDate = new Date();
|
||||||
newDate.setDate(newDate.getDate() + 1);
|
newDate.setDate(newDate.getDate() - 1);
|
||||||
|
|
||||||
await page.accessToSearchResult('14');
|
await page.accessToSearchResult('14');
|
||||||
await page.accessToSection('ticket.card.basicData.stepOne');
|
await page.accessToSection('ticket.card.basicData.stepOne');
|
||||||
|
|
|
@ -82,6 +82,7 @@ module.exports = Self => {
|
||||||
Self.filter = async(ctx, filter, options) => {
|
Self.filter = async(ctx, filter, options) => {
|
||||||
const conn = Self.dataSource.connector;
|
const conn = Self.dataSource.connector;
|
||||||
const myOptions = {};
|
const myOptions = {};
|
||||||
|
let to;
|
||||||
|
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
@ -109,7 +110,11 @@ module.exports = Self => {
|
||||||
case 'attenderFk':
|
case 'attenderFk':
|
||||||
return {'cl.workerFk': value};
|
return {'cl.workerFk': value};
|
||||||
case 'created':
|
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]}};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -138,9 +138,8 @@ module.exports = Self => {
|
||||||
const params = [args.id, args.shipped, args.warehouseFk];
|
const params = [args.id, args.shipped, args.warehouseFk];
|
||||||
const [salesMovable] = await Self.rawSql(query, params, myOptions);
|
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) {
|
if (salesNewTicket.length) {
|
||||||
const newTicket = await models.Ticket.transferSales(ctx, args.id, null, salesNewTicket, myOptions);
|
const newTicket = await models.Ticket.transferSales(ctx, args.id, null, salesNewTicket, myOptions);
|
||||||
args.id = newTicket.id;
|
args.id = newTicket.id;
|
||||||
|
|
|
@ -112,7 +112,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
// Get items movable
|
// Get items movable
|
||||||
const ticketOrigin = await models.Ticket.findById(args.id, null, myOptions);
|
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;
|
const differenceWarehouse = ticketOrigin.warehouseFk != args.warehouseId;
|
||||||
|
|
||||||
salesObj.haveDifferences = differenceShipped || differenceWarehouse;
|
salesObj.haveDifferences = differenceShipped || differenceWarehouse;
|
||||||
|
|
Loading…
Reference in New Issue