Bug/Test #1515 Dump structure de production a dev

This commit is contained in:
Bernat 2019-06-11 12:23:55 +02:00
parent a8b9e2c374
commit 2504d06bab
22 changed files with 7187 additions and 5117 deletions

View File

@ -953,7 +953,7 @@ BEGIN
WHERE landed = vlanded;
IF vCount IS NULL OR vCount = 0 THEN
CALL util.throw ('NOT_ZONE_WITH_THIS_PARAMETERS');
CALL util.throw ('NO_ZONE_FOR_THIS_PARAMETERS');
END IF;
INSERT INTO vn2008.Tickets (

View File

@ -1,10 +0,0 @@
ALTER TABLE `vn2008`.`Tickets`
ADD COLUMN `zoneFk` INT(11) NULL DEFAULT NULL AFTER `isDeleted`,
ADD INDEX `Tickets_zoneFk_fk_idx` (`zoneFk` ASC);
ALTER TABLE `vn2008`.`Tickets`
ADD CONSTRAINT `Tickets_zoneFk_fk`
FOREIGN KEY (`zoneFk`)
REFERENCES `vn`.`zone` (`id`)
ON DELETE RESTRICT
ON UPDATE CASCADE;

View File

@ -1,5 +0,0 @@
ALTER TABLE `vn`.`zone`
DROP PRIMARY KEY,
ADD PRIMARY KEY (`id`),
ADD INDEX `zone_name_idx` (`name` ASC);

View File

@ -10,3 +10,8 @@ INSERT INTO `salix`.`ACL` ( `model`, `property`, `accessType`, `permission`, `pr
('TicketDms', 'removeFile', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
('TicketDms', '*', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Route', 'updateVolume', 'WRITE', 'ALLOW', 'ROLE', 'deliveryBoss');
INSERT INTO `salix`.`ACL` (`id`, `model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('', 'Agency', 'getLanded', 'READ', 'ALLOW', 'ROLE', 'employee');
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('Agency', 'getShipped', 'READ', 'ALLOW', 'ROLE', 'employee');

View File

@ -1,9 +0,0 @@
ALTER TABLE `vn2008`.`clientes_gestdoc`
ADD INDEX `fk_clientes_gestdoc_1_idx` (`Id_Cliente` ASC);
ALTER TABLE `vn2008`.`clientes_gestdoc`
ADD CONSTRAINT `fk_clientes_gestdoc_3`
FOREIGN KEY (`Id_Cliente`)
REFERENCES `vn2008`.`Clientes` (`id_cliente`)
ON DELETE RESTRICT
ON UPDATE CASCADE;

View File

@ -0,0 +1,28 @@
DROP TRIGGER IF EXISTS `vn2008`.`expeditionsBeforeInsert`;
DELIMITER $$
CREATE DEFINER=`root`@`%` TRIGGER `vn2008`.`expeditionsBeforeInsert`
BEFORE INSERT ON `expeditions` FOR EACH ROW
-- Edit trigger body code below this line. Do not edit lines above this one
BEGIN
DECLARE intcounter INT;
DECLARE vShipFk INT;
IF NEW.EsBulto > 0 THEN
UPDATE Tickets SET Bultos = nz(Bultos) + 1 WHERE Id_Ticket = NEW.ticket_id;
SELECT IFNULL(MAX(counter),0) +1 INTO intcounter FROM expeditions e
INNER JOIN Tickets t1 ON e.ticket_id = t1.Id_Ticket
LEFT JOIN vn.ticketState ts ON ts.ticket = t1.Id_Ticket
INNER JOIN Tickets t2 ON t2.Id_Consigna = t1.Id_Consigna AND DATE(t2.Fecha) = DATE(t1.Fecha) AND t1.warehouse_id = t2.warehouse_id
WHERE t2.Id_Ticket = NEW.ticket_id AND ts.alertLevel < 3 AND t1.empresa_id = t2.empresa_id AND t1.Id_Agencia = t2.Id_Agencia;
SET NEW.`counter` = intcounter;
END IF;
-- JGF 14/01/19 si existe un polizon queda anulado
SELECT shipFk INTO vShipFk FROM vn.stowaway WHERE id = NEW.ticket_id;
IF vShipFk THEN
CALL vn.stowawayUnBoarding(vShipFk, NEW.ticket_id);
END IF;
END$$
DELIMITER ;

View File

@ -0,0 +1,49 @@
DROP procedure IF EXISTS `vn`.`zoneGetWarehouse`;
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`zoneGetWarehouse`(vAddress INT, vLanded DATE, vWarehouse INT)
BEGIN
/**
* Devuelve el listado de agencias disponibles para la fecha,
* dirección y warehouse pasadas
*
* @param vAddress
* @param vWarehouse warehouse
* @param vLanded Fecha de recogida
* @select Listado de agencias disponibles
*/
DECLARE vPostalCode varchar(10);
SELECT postalCode INTO vPostalCode
FROM address WHERE id = vAddress;
SELECT * FROM (
SELECT * FROM (
SELECT am.id agencyModeFk,
am.name agencyMode,
am.description,
am.deliveryMethodFk,
TIMESTAMPADD(DAY,-z.travelingDays, vLanded) shipped,
z.warehouseFk,
zi.isIncluded,
z.id zoneFk
FROM zoneGeo zgSon
JOIN zoneGeo zgFather ON zgSon.lft BETWEEN zgFather.lft AND zgFather.rgt
JOIN zoneIncluded zi ON zi.geoFk = zgFather.id
JOIN zone z ON z.id = zi.zoneFk
JOIN zoneCalendar zc ON zc.zoneFk = z.id
JOIN agencyMode am ON am.id = z.agencyModeFk
WHERE zgSon.`name` LIKE vPostalCode
AND delivered = vLanded
AND z.warehouseFk = vWarehouse
AND IF(TIMESTAMPADD(DAY,-z.travelingDays, vLanded) = CURDATE(), hour(now()) < hour(z.`hour`),TRUE)
ORDER BY z.id, zgFather.depth DESC) t
GROUP BY zoneFk
HAVING isIncluded > 0) t
GROUP BY agencyModeFk;
END$$
DELIMITER ;

File diff suppressed because one or more lines are too long

View File

@ -273,12 +273,6 @@ CREATE TEMPORARY TABLE tmp.address
WHERE `defaultAddressFk` IS NULL;
DROP TEMPORARY TABLE tmp.address;
UPDATE `vn`.`client` `c`
JOIN `tmp`.`clientAddress` `a` ON `a`.`clientFk` = `c`.`id`
SET `c`.`defaultAddressFk` = `a`.`addressFk`;
DROP TEMPORARY TABLE `tmp`.`clientAddress`;
INSERT INTO `vn`.`clientCredit`(`id`, `clientFk`, `workerFk`, `amount`, `created`)
VALUES
(1 , 101, 5, 300, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
@ -422,7 +416,7 @@ INSERT INTO `vn`.`ticket`(`id`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped
(5 , 3, 3, 3, DATE_ADD(CURDATE(), INTERVAL -3 DAY) , DATE_ADD(CURDATE(), INTERVAL -3 DAY) , 103, 'address 23', 123, 'T3333333', 0, DATE_ADD(CURDATE(), INTERVAL -3 DAY) ),
(6 , 3, 3, 4, DATE_ADD(CURDATE(), INTERVAL -2 DAY) , DATE_ADD(CURDATE(), INTERVAL -2 DAY) , 103, 'address 23', 123, 'T4444444', 0, DATE_ADD(CURDATE(), INTERVAL -2 DAY) ),
(7 , 4, 4, 4, DATE_ADD(CURDATE(), INTERVAL -1 DAY) , DATE_ADD(CURDATE(), INTERVAL -1 DAY) , 104, 'address 24', 124, 'T4444444', 0, DATE_ADD(CURDATE(), INTERVAL -1 DAY) ),
(8 , 1, 1, 4, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 104, 'address 24', 124, NULL, 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH) ),
(8 , 1, 1, 4, CURDATE(), CURDATE(), 104, 'address 24', 124, NULL, 0, CURDATE()),
(9 , 5, 5, 4, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 105, 'address 25', 125, 'A1111111', 0, DATE_ADD(CURDATE(), INTERVAL -2 MONTH) ),
(10, 6, 5, 5, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH), 105, 'address 25', 125, 'A1111111', 0, DATE_ADD(CURDATE(), INTERVAL -3 MONTH) ),
(11, 7, 1, 1, CURDATE() , DATE_ADD(CURDATE(), INTERVAL +1 DAY) , 101, 'address 21', 121, NULL, 0, CURDATE() ),
@ -600,12 +594,12 @@ INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `d
INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `isBox`, `created`, `itemFk`, `counter`, `checked`, `workerFk`)
VALUES
(1, 1, 1, 0, CURDATE(), 1, 0, 2, 1),
(2, 1, 1, 1, CURDATE(), 2, 1, 0, 2),
(3, 2, 1, 2, CURDATE(), 3, 2, 0, NULL),
(4, 1, 1, 0, CURDATE(), 1, 0, 2, 1),
(5, 1, 1, 1, CURDATE(), 2, 1, 0, 2),
(6, 2, 1, 2, CURDATE(), 3, 2, 0, NULL);
(1, 1, 1, 71, CURDATE(), 1, 0, 1, 18),
(2, 1, 1, 71, CURDATE(), 2, 1, 0, 18),
(3, 2, 1, 71, CURDATE(), 3, 2, 0, 18),
(4, 1, 1, 71, CURDATE(), 1, 0, 1, 18),
(5, 1, 1, 71, CURDATE(), 2, 1, 0, 18),
(6, 2, 1, 71, CURDATE(), 3, 2, 0, 18);
INSERT INTO `vn`.`packaging`(`id`, `volume`, `width`, `height`, `depth`, `isPackageReturnable`, `created`, `itemFk`, `price`)
VALUES
@ -1037,7 +1031,7 @@ INSERT INTO `hedera`.`order`(`id`, `date_send`, `customer_id`, `delivery_method_
(13, DATE_ADD(CURDATE(), INTERVAL +2 MONTH), 101, 1, 2, 121, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL +2 MONTH), DATE_ADD(CURDATE(), INTERVAL +2 MONTH), DATE_ADD(CURDATE(), INTERVAL +2 MONTH)),
(14, DATE_ADD(CURDATE(), INTERVAL +3 MONTH), 101, 2, 2, 121, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL +3 MONTH), DATE_ADD(CURDATE(), INTERVAL +3 MONTH), DATE_ADD(CURDATE(), INTERVAL +3 MONTH)),
(15, DATE_ADD(CURDATE(), INTERVAL +4 MONTH), 101, 3, 3, 121, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL +4 MONTH), DATE_ADD(CURDATE(), INTERVAL +4 MONTH), DATE_ADD(CURDATE(), INTERVAL +4 MONTH)),
(16, DATE_ADD(CURDATE(), INTERVAL +4 DAY), 101, 1, 1, 121, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
(16, DATE_ADD(CURDATE(), INTERVAL +2 DAY), 101, 1, 7, 121, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
(17, CURDATE(), 106, 2, 4, 126, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
(18, CURDATE(), 107, 3, 4, 127, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
(19, CURDATE(), 108, 1, 5, 128, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
@ -1347,14 +1341,14 @@ INSERT INTO `vn`.`sharingCart`(`id`, `workerFk`, `started`, `ended`, `workerSubs
INSERT INTO `vn`.`zone` (`id`, `name`, `hour`, `warehouseFk`, `agencyModeFk`, `travelingDays`, `price`, `bonus`)
VALUES
(1, 'Zone pickup A', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 1, 0, '0', '0'),
(2, 'Zone pickup B', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 2, 1, 0, '0', '0'),
(3, 'Zone 247 A', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 7, 1, '2', '0'),
(4, 'Zone 247 B', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 2, 7, 1, '2', '0'),
(5, 'Zone expensive A', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 8, 1, '5', '-1'),
(6, 'Zone expensive B', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 2, 8, 1, '5', '-1'),
(7, 'Zone refund', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 10, 0, 0, 0),
(8, 'Zone others', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 23, 0, 0, 0);
(1, 'Zone pickup A', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 1, 0, '0', '0'),
(2, 'Zone pickup B', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 2, 1, 0, '0', '0'),
(3, 'Zone 247 A', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 7, 1, '2', '0'),
(4, 'Zone 247 B', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 2, 7, 1, '2', '0'),
(5, 'Zone expensive A', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 8, 1, '5', '-1'),
(6, 'Zone expensive B', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 2, 8, 1, '5', '-1'),
(7, 'Zone refund', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 10, 0, 0, 0),
(8, 'Zone others', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 23, 0, 0, 0);
INSERT INTO `vn`.`zoneIncluded` (`zoneFk`, `geoFk`, `isIncluded`)
VALUES

File diff suppressed because it is too large Load Diff

View File

@ -18,7 +18,7 @@ describe('Worker pbx path', () => {
.waitToClick(selectors.workerPbx.saveButton)
.waitForLastSnackbar();
expect(result).toEqual('Invalid extension');
expect(result).toEqual('Extension format is invalid');
});
it('should sucessfully save the changes', async() => {

View File

@ -21,7 +21,7 @@ describe('Ticket expeditions and log path', () => {
.wait(selectors.ticketExpedition.expeditionRow)
.countElement(selectors.ticketExpedition.expeditionRow);
expect(result).toEqual(3);
expect(result).toEqual(5);
});
it(`should confirm the expedition deleted is shown now in the ticket log`, async() => {
@ -35,6 +35,6 @@ describe('Ticket expeditions and log path', () => {
expect(changedBy).toEqual('production');
expect(actionTaken).toEqual('Deletes');
expect(id).toEqual('3');
expect(id).toEqual('2');
});
});

View File

@ -25,6 +25,7 @@ describe('Ticket create path', () => {
.datePicker(selectors.createTicketView.deliveryDateInput, 1, null)
.autocompleteSearch(selectors.createTicketView.warehouseAutocomplete, 'Warehouse One')
.autocompleteSearch(selectors.createTicketView.agencyAutocomplete, 'Silla247')
.wait(1999)
.waitToClick(selectors.createTicketView.createButton)
.waitForLastSnackbar();

View File

@ -44,5 +44,7 @@
"Invalid TIN": "Invalid Tax number",
"This ticket can't be invoiced": "This ticket can't be invoiced",
"The value should be a number": "The value should be a number",
"The current ticket can't be modified": "The current ticket can't be modified"
"The current ticket can't be modified": "The current ticket can't be modified",
"Extension format is invalid": "Extension format is invalid",
"NO_ZONE_FOR_THIS_PARAMETERS": "NO_ZONE_FOR_THIS_PARAMETERS"
}

View File

@ -90,5 +90,5 @@
"The sales of this ticket can't be modified": "Las lineas de este ticket no pueden ser modificadas",
"Please select at least one sale": "Por favor selecciona al menos una linea",
"All sales must belong to the same ticket": "Todas las lineas deben pertenecer al mismo ticket",
"NOT_ZONE_WITH_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada"
"NO_ZONE_FOR_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada"
}

View File

@ -1,7 +1,6 @@
const app = require('vn-loopback/server/server');
// #1515 Dump structure de production a dev
xdescribe('Agency getFirstShipped()', () => {
describe('Agency getFirstShipped()', () => {
it('should return the first shipped and landed possible for the filter', async() => {
let filter = {
agencyModeFk: 1,

View File

@ -1,7 +1,6 @@
const app = require('vn-loopback/server/server');
// #1515 Dump structure de production a dev
xdescribe('agency getShipped()', () => {
describe('agency getShipped()', () => {
it('should return a shipment date', async() => {
let data = {
landed: new Date(),

View File

@ -42,10 +42,7 @@ module.exports = Self => {
if (!params.receiverTicket.id) {
let travelDates = await models.Agency.getFirstShipped(params.currentTicket);
let shipped = new Date(travelDates.shipped);
shipped.setMinutes(shipped.getMinutes() + shipped.getTimezoneOffset());
let landed = new Date(travelDates.landed);
landed.setMinutes(landed.getMinutes() + landed.getTimezoneOffset());
newTicketData = {
clientFk: params.currentTicket.clientFk,

View File

@ -1,7 +1,6 @@
const app = require('vn-loopback/server/server');
// #1515 Dump structure de production a dev
xdescribe('sale moveToTicket()', () => {
describe('sale moveToTicket()', () => {
let createdTicketId;
afterAll(async done => {

View File

@ -1,7 +1,6 @@
const app = require('vn-loopback/server/server');
// #1515 Dump structure de production a dev
xdescribe('sale updatePrice()', () => {
describe('sale updatePrice()', () => {
let originalSale;
let originalSalesPersonMana;
let createdSaleComponent;

View File

@ -1,7 +1,6 @@
const app = require('vn-loopback/server/server');
// #1515 Dump structure de production a dev
xdescribe('ticket getSalesPersonMana()', () => {
describe('ticket getSalesPersonMana()', () => {
it('should get the mana of a salesperson of a given ticket', async() => {
let mana = await app.models.Ticket.getSalesPersonMana(1);

View File

@ -38,6 +38,6 @@
data="$ctrl._availableAgencies"
label="Agency"
show-field="agencyMode"
value-field="id"
value-field="agencyModeFk"
field="$ctrl.ticket.agencyModeFk">
</vn-autocomplete>
</vn-autocomplete>