From f871879ee5f4e253d06c0b98120069361f7ff54c Mon Sep 17 00:00:00 2001 From: jgallego Date: Tue, 7 May 2019 09:50:52 +0200 Subject: [PATCH] merge fixtures dinamicas para zoneCalendar --- db/dump/fixtures.sql | 24 +++++++++++++---------- modules/ticket/back/methods/ticket/new.js | 8 +++++--- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index bc2ffdcd0..5aa78a40b 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -1455,16 +1455,20 @@ INSERT INTO `vn`.`zoneCalendar`(`zoneFk`, `delivered`) (2, DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=4, 4, 11) - DAYOFWEEK(CURDATE())) DAY)), (2, DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=5, 5, 12) - DAYOFWEEK(CURDATE())) DAY)), (2, DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=6, 6, 13) - DAYOFWEEK(CURDATE())) DAY)), - (3, DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=2, 2, 9 ) - DAYOFWEEK(CURDATE())) DAY)), - (3, DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=3, 3, 10) - DAYOFWEEK(CURDATE())) DAY)), - (3, DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=4, 4, 11) - DAYOFWEEK(CURDATE())) DAY)), - (3, DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=5, 5, 12) - DAYOFWEEK(CURDATE())) DAY)), - (3, DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=6, 6, 13) - DAYOFWEEK(CURDATE())) DAY)), - (4, DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=2, 2, 9) - DAYOFWEEK(CURDATE())) DAY)), - (4, DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=3, 3, 10) - DAYOFWEEK(CURDATE())) DAY)), - (4, DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=4, 4, 11) - DAYOFWEEK(CURDATE())) DAY)), - (4, DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=5, 5, 12) - DAYOFWEEK(CURDATE())) DAY)), - (4, DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=6, 6, 13) - DAYOFWEEK(CURDATE())) DAY)), + (3, CURDATE()), + (3, DATE_ADD(CURDATE(), INTERVAL +1 DAY)), + (3, DATE_ADD(CURDATE(), INTERVAL +2 DAY)), + (3, DATE_ADD(CURDATE(), INTERVAL +3 DAY)), + (3, DATE_ADD(CURDATE(), INTERVAL +4 DAY)), + (3, DATE_ADD(CURDATE(), INTERVAL +5 DAY)), + (3, DATE_ADD(CURDATE(), INTERVAL +6 DAY)), + (4, CURDATE()), + (4, DATE_ADD(CURDATE(), INTERVAL +1 DAY)), + (4, DATE_ADD(CURDATE(), INTERVAL +2 DAY)), + (4, DATE_ADD(CURDATE(), INTERVAL +3 DAY)), + (4, DATE_ADD(CURDATE(), INTERVAL +4 DAY)), + (4, DATE_ADD(CURDATE(), INTERVAL +5 DAY)), + (4, DATE_ADD(CURDATE(), INTERVAL +6 DAY)), (5, CURDATE()), (5, DATE_ADD(CURDATE(), INTERVAL +1 DAY)), (5, DATE_ADD(CURDATE(), INTERVAL +2 DAY)), diff --git a/modules/ticket/back/methods/ticket/new.js b/modules/ticket/back/methods/ticket/new.js index 9ec27c0d8..156d0a33d 100644 --- a/modules/ticket/back/methods/ticket/new.js +++ b/modules/ticket/back/methods/ticket/new.js @@ -8,7 +8,7 @@ module.exports = Self => { arg: 'params', type: 'object', required: true, - description: 'ClientFk, Shipped, WharehouseFk, CompanyFk, AddressFk, AgencyModeFk, RouteFk, Landed, userId', + description: 'ClientFk, Shipped, WarehouseFk, CompanyFk, AddressFk, AgencyModeFk, RouteFk, Landed, userId', http: {source: 'body'} }], returns: { @@ -59,7 +59,8 @@ module.exports = Self => { params.shipped = await Self.app.models.Agency.getShipped({ landed: params.landed, addressFk: address.id, - agencyModeFk: agency.agencyModeFk + agencyModeFk: agency.agencyModeFk, + warehouseFk: params.warehouseFk }); } @@ -67,7 +68,8 @@ module.exports = Self => { params.landed = await Self.app.models.Agency.getLanded({ shipped: params.shipped, addressFk: address.id, - agencyModeFk: params.agencyModeFk + agencyModeFk: params.agencyModeFk, + warehouseFk: params.warehouseFk }); }