7199-devToTest_2316 #2287
|
@ -3068,18 +3068,16 @@ INSERT INTO `vn`.`cmr` (id,truckPlate,observations,senderInstruccions,paymentIns
|
||||||
UPDATE vn.department
|
UPDATE vn.department
|
||||||
SET workerFk = null;
|
SET workerFk = null;
|
||||||
|
|
||||||
-- NEW WAREHOUSE
|
|
||||||
|
|
||||||
INSERT INTO vn.packaging
|
INSERT INTO vn.packaging
|
||||||
VALUES('--', 2745600.00, 100.00, 120.00, 220.00, 0.00, 1, '2001-01-01 00:00:00.000', NULL, NULL, NULL, 0.00, 16, 0.00, 0, NULL, 0.00, NULL, NULL, 0, NULL, 0, 0);
|
VALUES('--', 2745600.00, 100.00, 120.00, 220.00, 0.00, 1, '2001-01-01 00:00:00.000', NULL, NULL, NULL, 0.00, 16, 0.00, 0, NULL, 0.00, NULL, NULL, 0, NULL, 0, 0);
|
||||||
|
|
||||||
|
|
||||||
INSERT IGNORE INTO vn.intrastat
|
INSERT IGNORE INTO vn.intrastat
|
||||||
SET id = 44219999,
|
SET id = 44219999,
|
||||||
description = 'Manufacturas de madera',
|
description = 'Manufacturas de madera',
|
||||||
taxClassFk = 1,
|
taxClassFk = 1,
|
||||||
taxCodeFk = 1;
|
taxCodeFk = 1;
|
||||||
|
|
||||||
INSERT IGNORE INTO vn.warehouse
|
INSERT IGNORE INTO vn.warehouse
|
||||||
SET id = 999,
|
SET id = 999,
|
||||||
name = 'TestingWarehouse',
|
name = 'TestingWarehouse',
|
||||||
|
@ -3090,33 +3088,33 @@ INSERT IGNORE INTO vn.warehouse
|
||||||
hasProduction = TRUE;
|
hasProduction = TRUE;
|
||||||
|
|
||||||
INSERT IGNORE INTO vn.sector
|
INSERT IGNORE INTO vn.sector
|
||||||
SET id = 9991,
|
SET id = 9991,
|
||||||
description = 'NormalSector',
|
description = 'NormalSector',
|
||||||
warehouseFk = 999,
|
warehouseFk = 999,
|
||||||
code = 'NS',
|
code = 'NS',
|
||||||
isPackagingArea = FALSE,
|
isPackagingArea = FALSE,
|
||||||
sonFk = NULL,
|
sonFk = NULL,
|
||||||
isMain = TRUE,
|
isMain = TRUE,
|
||||||
itemPackingTypeFk = NULL;
|
itemPackingTypeFk = NULL;
|
||||||
|
|
||||||
INSERT IGNORE INTO vn.sector
|
INSERT IGNORE INTO vn.sector
|
||||||
SET id = 9992,
|
SET id = 9992,
|
||||||
description = 'PreviousSector',
|
description = 'PreviousSector',
|
||||||
warehouseFk = 999,
|
warehouseFk = 999,
|
||||||
code = 'PS',
|
code = 'PS',
|
||||||
isPackagingArea = FALSE,
|
isPackagingArea = FALSE,
|
||||||
sonFk = NULL,
|
sonFk = NULL,
|
||||||
isMain = TRUE,
|
isMain = TRUE,
|
||||||
itemPackingTypeFk = NULL;
|
itemPackingTypeFk = NULL;
|
||||||
|
|
||||||
INSERT IGNORE INTO vn.sector
|
INSERT IGNORE INTO vn.sector
|
||||||
SET id = 9993,
|
SET id = 9993,
|
||||||
description = 'MezaninneSector',
|
description = 'MezaninneSector',
|
||||||
warehouseFk = 999,
|
warehouseFk = 999,
|
||||||
code = 'MS',
|
code = 'MS',
|
||||||
isPackagingArea = FALSE,
|
isPackagingArea = FALSE,
|
||||||
sonFk = 9991,
|
sonFk = 9991,
|
||||||
isMain = TRUE,
|
isMain = TRUE,
|
||||||
itemPackingTypeFk = NULL;
|
itemPackingTypeFk = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
@ -3150,58 +3148,58 @@ INSERT IGNORE INTO vn.itemType
|
||||||
SET id = 999,
|
SET id = 999,
|
||||||
code = 'WOO',
|
code = 'WOO',
|
||||||
name = 'Wood Objects',
|
name = 'Wood Objects',
|
||||||
categoryFk = 3,
|
categoryFk = 3,
|
||||||
workerFk = 103,
|
workerFk = 103,
|
||||||
isInventory = TRUE,
|
isInventory = TRUE,
|
||||||
life = 10,
|
life = 10,
|
||||||
density = 250,
|
density = 250,
|
||||||
itemPackingTypeFk = NULL,
|
itemPackingTypeFk = NULL,
|
||||||
temperatureFk = 'warm';
|
temperatureFk = 'warm';
|
||||||
|
|
||||||
INSERT IGNORE INTO vn.travel
|
INSERT IGNORE INTO vn.travel
|
||||||
SET id = 99,
|
SET id = 99,
|
||||||
shipped = CURDATE(),
|
shipped = CURDATE(),
|
||||||
landed = CURDATE(),
|
landed = CURDATE(),
|
||||||
warehouseInFk = 999,
|
warehouseInFk = 999,
|
||||||
warehouseOutFk = 1,
|
warehouseOutFk = 1,
|
||||||
isReceived = TRUE;
|
isReceived = TRUE;
|
||||||
|
|
||||||
INSERT INTO vn.entry
|
INSERT INTO vn.entry
|
||||||
SET id = 999,
|
SET id = 999,
|
||||||
supplierFk = 791,
|
supplierFk = 791,
|
||||||
isConfirmed = TRUE,
|
isConfirmed = TRUE,
|
||||||
dated = CURDATE(),
|
dated = CURDATE(),
|
||||||
travelFk = 99,
|
travelFk = 99,
|
||||||
companyFk = 442;
|
companyFk = 442;
|
||||||
|
|
||||||
INSERT INTO vn.ticket
|
INSERT INTO vn.ticket
|
||||||
SET id = 999999,
|
SET id = 999999,
|
||||||
clientFk = 2,
|
clientFk = 2,
|
||||||
warehouseFk = 999,
|
warehouseFk = 999,
|
||||||
shipped = CURDATE(),
|
shipped = CURDATE(),
|
||||||
nickname = 'Cliente',
|
nickname = 'Cliente',
|
||||||
addressFk = 1,
|
addressFk = 1,
|
||||||
companyFk = 442,
|
companyFk = 442,
|
||||||
agencyModeFk = 10,
|
agencyModeFk = 10,
|
||||||
landed = CURDATE();
|
landed = CURDATE();
|
||||||
|
|
||||||
INSERT INTO vn.collection
|
INSERT INTO vn.collection
|
||||||
SET id = 10101010,
|
SET id = 10101010,
|
||||||
workerFk = 9;
|
workerFk = 9;
|
||||||
|
|
||||||
INSERT IGNORE INTO vn.ticketCollection
|
INSERT IGNORE INTO vn.ticketCollection
|
||||||
SET id = 10101010,
|
SET id = 10101010,
|
||||||
ticketFk = 999999,
|
ticketFk = 999999,
|
||||||
collectionFk = 10101010;
|
collectionFk = 10101010;
|
||||||
|
|
||||||
INSERT INTO vn.item
|
INSERT INTO vn.item
|
||||||
SET id = 999991,
|
SET id = 999991,
|
||||||
name = 'Palito para pinchos',
|
name = 'Palito para pinchos',
|
||||||
`size` = 25,
|
`size` = 25,
|
||||||
stems = NULL,
|
stems = NULL,
|
||||||
category = 'EXT',
|
category = 'EXT',
|
||||||
typeFk = 999,
|
typeFk = 999,
|
||||||
longName = 'Palito para pinchos',
|
longName = 'Palito para pinchos',
|
||||||
itemPackingTypeFk = NULL,
|
itemPackingTypeFk = NULL,
|
||||||
originFk = 1,
|
originFk = 1,
|
||||||
weightByPiece = 6,
|
weightByPiece = 6,
|
||||||
|
@ -3228,19 +3226,19 @@ INSERT INTO vn.sale
|
||||||
SET id = 99991,
|
SET id = 99991,
|
||||||
itemFk = 999991,
|
itemFk = 999991,
|
||||||
ticketFk = 999999,
|
ticketFk = 999999,
|
||||||
concept = 'Palito para pinchos',
|
concept = 'Palito para pinchos',
|
||||||
quantity = 3,
|
quantity = 3,
|
||||||
price = 1,
|
price = 1,
|
||||||
discount = 0;
|
discount = 0;
|
||||||
|
|
||||||
INSERT INTO vn.item
|
INSERT INTO vn.item
|
||||||
SET id = 999992,
|
SET id = 999992,
|
||||||
name = 'Madera verde',
|
name = 'Madera verde',
|
||||||
`size` = 10,
|
`size` = 10,
|
||||||
stems = NULL,
|
stems = NULL,
|
||||||
category = 'EXT',
|
category = 'EXT',
|
||||||
typeFk = 999,
|
typeFk = 999,
|
||||||
longName = 'Madera verde',
|
longName = 'Madera verde',
|
||||||
itemPackingTypeFk = NULL,
|
itemPackingTypeFk = NULL,
|
||||||
originFk = 1,
|
originFk = 1,
|
||||||
weightByPiece = 50,
|
weightByPiece = 50,
|
||||||
|
@ -3267,19 +3265,19 @@ INSERT INTO vn.sale
|
||||||
SET id = 99992,
|
SET id = 99992,
|
||||||
itemFk = 999992,
|
itemFk = 999992,
|
||||||
ticketFk = 999999,
|
ticketFk = 999999,
|
||||||
concept = 'Madera Verde',
|
concept = 'Madera Verde',
|
||||||
quantity = 10,
|
quantity = 10,
|
||||||
price = 1,
|
price = 1,
|
||||||
discount = 0;
|
discount = 0;
|
||||||
|
|
||||||
INSERT INTO vn.item
|
INSERT INTO vn.item
|
||||||
SET id = 999993,
|
SET id = 999993,
|
||||||
name = 'Madera Roja/Morada',
|
name = 'Madera Roja/Morada',
|
||||||
`size` = 12,
|
`size` = 12,
|
||||||
stems = 2,
|
stems = 2,
|
||||||
category = 'EXT',
|
category = 'EXT',
|
||||||
typeFk = 999,
|
typeFk = 999,
|
||||||
longName = 'Madera Roja/Morada',
|
longName = 'Madera Roja/Morada',
|
||||||
itemPackingTypeFk = NULL,
|
itemPackingTypeFk = NULL,
|
||||||
originFk = 1,
|
originFk = 1,
|
||||||
weightByPiece = 35,
|
weightByPiece = 35,
|
||||||
|
@ -3303,30 +3301,30 @@ INSERT INTO vn.buy
|
||||||
weight = 25;
|
weight = 25;
|
||||||
|
|
||||||
INSERT INTO vn.itemShelving
|
INSERT INTO vn.itemShelving
|
||||||
SET id = 9931,
|
SET id = 9931,
|
||||||
itemFk = 999993,
|
itemFk = 999993,
|
||||||
shelvingFk = 'NCC',
|
shelvingFk = 'NCC',
|
||||||
visible = 10,
|
visible = 10,
|
||||||
`grouping` = 5,
|
`grouping` = 5,
|
||||||
packing = 10;
|
packing = 10;
|
||||||
|
|
||||||
INSERT INTO vn.sale
|
INSERT INTO vn.sale
|
||||||
SET id = 99993,
|
SET id = 99993,
|
||||||
itemFk = 999993,
|
itemFk = 999993,
|
||||||
ticketFk = 999999,
|
ticketFk = 999999,
|
||||||
concept = 'Madera Roja/Morada',
|
concept = 'Madera Roja/Morada',
|
||||||
quantity = 15,
|
quantity = 15,
|
||||||
price = 1,
|
price = 1,
|
||||||
discount = 0;
|
discount = 0;
|
||||||
|
|
||||||
INSERT INTO vn.item
|
INSERT INTO vn.item
|
||||||
SET id = 999994,
|
SET id = 999994,
|
||||||
name = 'Madera Naranja',
|
name = 'Madera Naranja',
|
||||||
`size` = 18,
|
`size` = 18,
|
||||||
stems = 1,
|
stems = 1,
|
||||||
category = 'EXT',
|
category = 'EXT',
|
||||||
typeFk = 999,
|
typeFk = 999,
|
||||||
longName = 'Madera Naranja',
|
longName = 'Madera Naranja',
|
||||||
itemPackingTypeFk = NULL,
|
itemPackingTypeFk = NULL,
|
||||||
originFk = 1,
|
originFk = 1,
|
||||||
weightByPiece = 160,
|
weightByPiece = 160,
|
||||||
|
@ -3353,19 +3351,19 @@ INSERT INTO vn.sale
|
||||||
SET id = 99994,
|
SET id = 99994,
|
||||||
itemFk = 999994,
|
itemFk = 999994,
|
||||||
ticketFk = 999999,
|
ticketFk = 999999,
|
||||||
concept = 'Madera Naranja',
|
concept = 'Madera Naranja',
|
||||||
quantity = 4,
|
quantity = 4,
|
||||||
price = 1,
|
price = 1,
|
||||||
discount = 0;
|
discount = 0;
|
||||||
|
|
||||||
INSERT INTO vn.item
|
INSERT INTO vn.item
|
||||||
SET id = 999995,
|
SET id = 999995,
|
||||||
name = 'Madera Amarilla',
|
name = 'Madera Amarilla',
|
||||||
`size` = 11,
|
`size` = 11,
|
||||||
stems = 5,
|
stems = 5,
|
||||||
category = 'EXT',
|
category = 'EXT',
|
||||||
typeFk = 999,
|
typeFk = 999,
|
||||||
longName = 'Madera Amarilla',
|
longName = 'Madera Amarilla',
|
||||||
itemPackingTypeFk = NULL,
|
itemPackingTypeFk = NULL,
|
||||||
originFk = 1,
|
originFk = 1,
|
||||||
weightByPiece = 78,
|
weightByPiece = 78,
|
||||||
|
@ -3392,20 +3390,20 @@ INSERT INTO vn.sale
|
||||||
SET id = 99995,
|
SET id = 99995,
|
||||||
itemFk = 999995,
|
itemFk = 999995,
|
||||||
ticketFk = 999999,
|
ticketFk = 999999,
|
||||||
concept = 'Madera Amarilla',
|
concept = 'Madera Amarilla',
|
||||||
quantity = 5,
|
quantity = 5,
|
||||||
price = 1,
|
price = 1,
|
||||||
discount = 0;
|
discount = 0;
|
||||||
|
|
||||||
-- Palito naranja
|
-- Palito naranja
|
||||||
INSERT INTO vn.item
|
INSERT INTO vn.item
|
||||||
SET id = 999998,
|
SET id = 999998,
|
||||||
name = 'Palito naranja',
|
name = 'Palito naranja',
|
||||||
`size` = 11,
|
`size` = 11,
|
||||||
stems = 1,
|
stems = 1,
|
||||||
category = 'EXT',
|
category = 'EXT',
|
||||||
typeFk = 999,
|
typeFk = 999,
|
||||||
longName = 'Palito naranja',
|
longName = 'Palito naranja',
|
||||||
itemPackingTypeFk = NULL,
|
itemPackingTypeFk = NULL,
|
||||||
originFk = 1,
|
originFk = 1,
|
||||||
weightByPiece = 78,
|
weightByPiece = 78,
|
||||||
|
@ -3432,20 +3430,20 @@ INSERT INTO vn.sale
|
||||||
SET id = 99998,
|
SET id = 99998,
|
||||||
itemFk = 999998,
|
itemFk = 999998,
|
||||||
ticketFk = 999999,
|
ticketFk = 999999,
|
||||||
concept = 'Palito naranja',
|
concept = 'Palito naranja',
|
||||||
quantity = 60,
|
quantity = 60,
|
||||||
price = 1,
|
price = 1,
|
||||||
discount = 0;
|
discount = 0;
|
||||||
|
|
||||||
-- Palito amarillo
|
-- Palito amarillo
|
||||||
INSERT INTO vn.item
|
INSERT INTO vn.item
|
||||||
SET id = 999999,
|
SET id = 999999,
|
||||||
name = 'Palito amarillo',
|
name = 'Palito amarillo',
|
||||||
`size` = 11,
|
`size` = 11,
|
||||||
stems = 1,
|
stems = 1,
|
||||||
category = 'EXT',
|
category = 'EXT',
|
||||||
typeFk = 999,
|
typeFk = 999,
|
||||||
longName = 'Palito amarillo',
|
longName = 'Palito amarillo',
|
||||||
itemPackingTypeFk = NULL,
|
itemPackingTypeFk = NULL,
|
||||||
originFk = 1,
|
originFk = 1,
|
||||||
weightByPiece = 78,
|
weightByPiece = 78,
|
||||||
|
@ -3472,20 +3470,20 @@ INSERT INTO vn.sale
|
||||||
SET id = 99999,
|
SET id = 99999,
|
||||||
itemFk = 999999,
|
itemFk = 999999,
|
||||||
ticketFk = 999999,
|
ticketFk = 999999,
|
||||||
concept = 'Palito amarillo',
|
concept = 'Palito amarillo',
|
||||||
quantity = 50,
|
quantity = 50,
|
||||||
price = 1,
|
price = 1,
|
||||||
discount = 0;
|
discount = 0;
|
||||||
|
|
||||||
-- Palito azul
|
-- Palito azul
|
||||||
INSERT INTO vn.item
|
INSERT INTO vn.item
|
||||||
SET id = 1000000,
|
SET id = 1000000,
|
||||||
name = 'Palito azul',
|
name = 'Palito azul',
|
||||||
`size` = 10,
|
`size` = 10,
|
||||||
stems = 1,
|
stems = 1,
|
||||||
category = 'EXT',
|
category = 'EXT',
|
||||||
typeFk = 999,
|
typeFk = 999,
|
||||||
longName = 'Palito azul',
|
longName = 'Palito azul',
|
||||||
itemPackingTypeFk = NULL,
|
itemPackingTypeFk = NULL,
|
||||||
originFk = 1,
|
originFk = 1,
|
||||||
weightByPiece = 78,
|
weightByPiece = 78,
|
||||||
|
@ -3512,20 +3510,20 @@ INSERT INTO vn.sale
|
||||||
SET id = 100000,
|
SET id = 100000,
|
||||||
itemFk = 1000000,
|
itemFk = 1000000,
|
||||||
ticketFk = 999999,
|
ticketFk = 999999,
|
||||||
concept = 'Palito azul',
|
concept = 'Palito azul',
|
||||||
quantity = 50,
|
quantity = 50,
|
||||||
price = 1,
|
price = 1,
|
||||||
discount = 0;
|
discount = 0;
|
||||||
|
|
||||||
-- Palito rojo
|
-- Palito rojo
|
||||||
INSERT INTO vn.item
|
INSERT INTO vn.item
|
||||||
SET id = 1000001,
|
SET id = 1000001,
|
||||||
name = 'Palito rojo',
|
name = 'Palito rojo',
|
||||||
`size` = 10,
|
`size` = 10,
|
||||||
stems = NULL,
|
stems = NULL,
|
||||||
category = 'EXT',
|
category = 'EXT',
|
||||||
typeFk = 999,
|
typeFk = 999,
|
||||||
longName = 'Palito rojo',
|
longName = 'Palito rojo',
|
||||||
itemPackingTypeFk = NULL,
|
itemPackingTypeFk = NULL,
|
||||||
originFk = 1,
|
originFk = 1,
|
||||||
weightByPiece = 78,
|
weightByPiece = 78,
|
||||||
|
@ -3553,20 +3551,20 @@ INSERT INTO vn.sale
|
||||||
SET id = 100001,
|
SET id = 100001,
|
||||||
itemFk = 1000001,
|
itemFk = 1000001,
|
||||||
ticketFk = 999999,
|
ticketFk = 999999,
|
||||||
concept = 'Palito rojo',
|
concept = 'Palito rojo',
|
||||||
quantity = 10,
|
quantity = 10,
|
||||||
price = 1,
|
price = 1,
|
||||||
discount = 0;
|
discount = 0;
|
||||||
|
|
||||||
-- Previa
|
-- Previa
|
||||||
INSERT IGNORE INTO vn.item
|
INSERT IGNORE INTO vn.item
|
||||||
SET id = 999996,
|
SET id = 999996,
|
||||||
name = 'Bolas de madera',
|
name = 'Bolas de madera',
|
||||||
`size` = 2,
|
`size` = 2,
|
||||||
stems = 4,
|
stems = 4,
|
||||||
category = 'EXT',
|
category = 'EXT',
|
||||||
typeFk = 999,
|
typeFk = 999,
|
||||||
longName = 'Bolas de madera',
|
longName = 'Bolas de madera',
|
||||||
itemPackingTypeFk = NULL,
|
itemPackingTypeFk = NULL,
|
||||||
originFk = 1,
|
originFk = 1,
|
||||||
weightByPiece = 20,
|
weightByPiece = 20,
|
||||||
|
@ -3593,20 +3591,20 @@ INSERT vn.sale
|
||||||
SET id = 99996,
|
SET id = 99996,
|
||||||
itemFk = 999996,
|
itemFk = 999996,
|
||||||
ticketFk = 999999,
|
ticketFk = 999999,
|
||||||
concept = 'Bolas de madera',
|
concept = 'Bolas de madera',
|
||||||
quantity = 4,
|
quantity = 4,
|
||||||
price = 7,
|
price = 7,
|
||||||
discount = 0,
|
discount = 0,
|
||||||
isPicked = TRUE;
|
isPicked = TRUE;
|
||||||
|
|
||||||
INSERT IGNORE INTO vn.item
|
INSERT IGNORE INTO vn.item
|
||||||
SET id = 999997,
|
SET id = 999997,
|
||||||
name = 'Palitos de polo MIX',
|
name = 'Palitos de polo MIX',
|
||||||
`size` = 14,
|
`size` = 14,
|
||||||
stems = NULL,
|
stems = NULL,
|
||||||
category = 'EXT',
|
category = 'EXT',
|
||||||
typeFk = 999,
|
typeFk = 999,
|
||||||
longName = 'Palitos de polo MIX',
|
longName = 'Palitos de polo MIX',
|
||||||
itemPackingTypeFk = NULL,
|
itemPackingTypeFk = NULL,
|
||||||
originFk = 1,
|
originFk = 1,
|
||||||
weightByPiece = 20,
|
weightByPiece = 20,
|
||||||
|
@ -3633,9 +3631,9 @@ INSERT vn.sale
|
||||||
SET id = 99997,
|
SET id = 99997,
|
||||||
itemFk = 999997,
|
itemFk = 999997,
|
||||||
ticketFk = 999999,
|
ticketFk = 999999,
|
||||||
concept = 'Palitos de polo MIX',
|
concept = 'Palitos de polo MIX',
|
||||||
quantity = 5,
|
quantity = 5,
|
||||||
price = 7,
|
price = 7,
|
||||||
discount = 0;
|
discount = 0;
|
||||||
|
|
||||||
USE vn;
|
USE vn;
|
||||||
|
@ -3668,38 +3666,38 @@ VALUES
|
||||||
|
|
||||||
-- Previous for Bolas de madera
|
-- Previous for Bolas de madera
|
||||||
INSERT IGNORE INTO vn.sectorCollection
|
INSERT IGNORE INTO vn.sectorCollection
|
||||||
SET id = 99,
|
SET id = 99,
|
||||||
userFk = 1,
|
userFk = 1,
|
||||||
sectorFk = 9992;
|
sectorFk = 9992;
|
||||||
|
|
||||||
INSERT IGNORE INTO vn.saleGroup
|
INSERT IGNORE INTO vn.saleGroup
|
||||||
SET id = 4,
|
SET id = 4,
|
||||||
userFk = 1,
|
userFk = 1,
|
||||||
parkingFk = 9,
|
parkingFk = 9,
|
||||||
sectorFk = 9992;
|
sectorFk = 9992;
|
||||||
|
|
||||||
INSERT IGNORE INTO vn.sectorCollectionSaleGroup
|
INSERT IGNORE INTO vn.sectorCollectionSaleGroup
|
||||||
SET id = 9999,
|
SET id = 9999,
|
||||||
sectorCollectionFk = 99,
|
sectorCollectionFk = 99,
|
||||||
saleGroupFk = 999;
|
saleGroupFk = 999;
|
||||||
|
|
||||||
INSERT vn.saleGroupDetail
|
INSERT vn.saleGroupDetail
|
||||||
SET id = 99991,
|
SET id = 99991,
|
||||||
saleFk = 99996,
|
saleFk = 99996,
|
||||||
saleGroupFk = 999;
|
saleGroupFk = 999;
|
||||||
|
|
||||||
INSERT INTO vn.saleTracking
|
INSERT INTO vn.saleTracking
|
||||||
SET id = 7,
|
SET id = 7,
|
||||||
saleFk = 99996,
|
saleFk = 99996,
|
||||||
isChecked = TRUE,
|
isChecked = TRUE,
|
||||||
workerFk = 103,
|
workerFk = 103,
|
||||||
stateFk = 28;
|
stateFk = 28;
|
||||||
|
|
||||||
INSERT IGNORE INTO vn.itemShelvingSale
|
INSERT IGNORE INTO vn.itemShelvingSale
|
||||||
SET id = 991,
|
SET id = 991,
|
||||||
itemShelvingFk = 9962,
|
itemShelvingFk = 9962,
|
||||||
saleFk = 99996,
|
saleFk = 99996,
|
||||||
quantity = 5,
|
quantity = 5,
|
||||||
userFk = 1;
|
userFk = 1;
|
||||||
|
|
||||||
UPDATE vn.ticket
|
UPDATE vn.ticket
|
||||||
|
@ -3734,6 +3732,9 @@ INSERT INTO vn.report (name) VALUES ('LabelCollection');
|
||||||
INSERT INTO vn.parkingLog(originFk, userFk, `action`, creationDate, description, changedModel,oldInstance, newInstance, changedModelId, changedModelValue)
|
INSERT INTO vn.parkingLog(originFk, userFk, `action`, creationDate, description, changedModel,oldInstance, newInstance, changedModelId, changedModelValue)
|
||||||
VALUES(1, 18, 'update', util.VN_CURDATE(), NULL, 'SaleGroup', '{"parkingFk":null}', '{"parkingFk":1}', 1, NULL);
|
VALUES(1, 18, 'update', util.VN_CURDATE(), NULL, 'SaleGroup', '{"parkingFk":null}', '{"parkingFk":1}', 1, NULL);
|
||||||
|
|
||||||
|
INSERT INTO vn.ticketLog (originFk,userFk,`action`,creationDate,changedModel,newInstance,changedModelId,changedModelValue)
|
||||||
|
VALUES (18,9,'insert','2001-01-01 11:01:00.000','Ticket','{"isDeleted":true}',45,'Super Man');
|
||||||
|
|
||||||
INSERT INTO `vn`.`accountReconciliation` (
|
INSERT INTO `vn`.`accountReconciliation` (
|
||||||
supplierAccountFk,
|
supplierAccountFk,
|
||||||
operationDated,
|
operationDated,
|
||||||
|
|
|
@ -9,8 +9,8 @@ describe('ticketLog getChanges()', () => {
|
||||||
it('should return the changes in the sales of a ticket', async() => {
|
it('should return the changes in the sales of a ticket', async() => {
|
||||||
const ticketId = 16;
|
const ticketId = 16;
|
||||||
|
|
||||||
const changues = await models.TicketLog.getChanges(ctx, ticketId);
|
const changes = await models.TicketLog.getChanges(ctx, ticketId);
|
||||||
|
|
||||||
expect(changues).toContain(`Change quantity`);
|
expect(changes).toContain(`Change quantity`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -29,6 +29,15 @@ module.exports = Self => {
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
|
const ticketLog = await models.TicketLog.findOne({
|
||||||
|
fields: ['originFk', 'creationDate', 'newInstance'],
|
||||||
|
where: {
|
||||||
|
originFk: id,
|
||||||
|
newInstance: {like: '%"isDeleted":true%'}
|
||||||
|
},
|
||||||
|
order: 'creationDate DESC'
|
||||||
|
}, myOptions);
|
||||||
|
|
||||||
const ticket = await models.Ticket.findById(id, {
|
const ticket = await models.Ticket.findById(id, {
|
||||||
include: [{
|
include: [{
|
||||||
relation: 'client',
|
relation: 'client',
|
||||||
|
@ -39,10 +48,9 @@ module.exports = Self => {
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
const now = Date.vnNew();
|
const now = Date.vnNew();
|
||||||
const maxDate = new Date(ticket.updated);
|
const maxDate = new Date(ticketLog?.creationDate);
|
||||||
maxDate.setHours(maxDate.getHours() + 1);
|
maxDate.setHours(maxDate.getHours() + 1);
|
||||||
|
if (!ticketLog || now > maxDate)
|
||||||
if (now > maxDate)
|
|
||||||
throw new UserError(`You can only restore a ticket within the first hour after deletion`);
|
throw new UserError(`You can only restore a ticket within the first hour after deletion`);
|
||||||
|
|
||||||
// Send notification to salesPerson
|
// Send notification to salesPerson
|
||||||
|
|
|
@ -4,7 +4,7 @@ const models = app.models;
|
||||||
|
|
||||||
describe('ticket restore()', () => {
|
describe('ticket restore()', () => {
|
||||||
const employeeUser = 1110;
|
const employeeUser = 1110;
|
||||||
const ticketId = 18;
|
const ticketId = 9;
|
||||||
const activeCtx = {
|
const activeCtx = {
|
||||||
accessToken: {userId: employeeUser},
|
accessToken: {userId: employeeUser},
|
||||||
headers: {
|
headers: {
|
||||||
|
@ -30,10 +30,21 @@ describe('ticket restore()', () => {
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
const ticket = await models.Ticket.findById(ticketId, null, options);
|
const ticket = await models.Ticket.findById(ticketId, null, options);
|
||||||
|
|
||||||
await ticket.updateAttributes({
|
await ticket.updateAttributes({
|
||||||
isDeleted: true,
|
isDeleted: true,
|
||||||
updated: now
|
updated: now
|
||||||
}, options);
|
}, options);
|
||||||
|
|
||||||
|
await models.TicketLog.create({
|
||||||
|
originFk: ticketId,
|
||||||
|
userFk: employeeUser,
|
||||||
|
action: 'update',
|
||||||
|
changedModel: 'Ticket',
|
||||||
|
creationDate: new Date('2001-01-01 10:59:00'),
|
||||||
|
newInstance: '{"isDeleted":true}'
|
||||||
|
}, options);
|
||||||
|
|
||||||
await app.models.Ticket.restore(ctx, ticketId, options);
|
await app.models.Ticket.restore(ctx, ticketId, options);
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -52,11 +63,21 @@ describe('ticket restore()', () => {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
const ticketBeforeUpdate = await models.Ticket.findById(ticketId, null, options);
|
const ticketBeforeUpdate = await models.Ticket.findById(ticketId, null, options);
|
||||||
|
|
||||||
await ticketBeforeUpdate.updateAttributes({
|
await ticketBeforeUpdate.updateAttributes({
|
||||||
isDeleted: true,
|
isDeleted: true,
|
||||||
updated: now
|
updated: now
|
||||||
}, options);
|
}, options);
|
||||||
|
|
||||||
|
await models.TicketLog.create({
|
||||||
|
originFk: ticketId,
|
||||||
|
userFk: employeeUser,
|
||||||
|
action: 'update',
|
||||||
|
changedModel: 'Ticket',
|
||||||
|
creationDate: new Date('2001-01-01 11:01:00'),
|
||||||
|
newInstance: '{"isDeleted":true}'
|
||||||
|
}, options);
|
||||||
|
|
||||||
const ticketAfterUpdate = await models.Ticket.findById(ticketId, null, options);
|
const ticketAfterUpdate = await models.Ticket.findById(ticketId, null, options);
|
||||||
|
|
||||||
expect(ticketAfterUpdate.isDeleted).toBeTruthy();
|
expect(ticketAfterUpdate.isDeleted).toBeTruthy();
|
||||||
|
@ -65,7 +86,9 @@ describe('ticket restore()', () => {
|
||||||
const ticketAfterRestore = await models.Ticket.findById(ticketId, null, options);
|
const ticketAfterRestore = await models.Ticket.findById(ticketId, null, options);
|
||||||
|
|
||||||
const fullYear = now.getFullYear();
|
const fullYear = now.getFullYear();
|
||||||
|
|
||||||
const shippedFullYear = ticketAfterRestore.shipped.getFullYear();
|
const shippedFullYear = ticketAfterRestore.shipped.getFullYear();
|
||||||
|
|
||||||
const landedFullYear = ticketAfterRestore.landed.getFullYear();
|
const landedFullYear = ticketAfterRestore.landed.getFullYear();
|
||||||
|
|
||||||
expect(ticketAfterRestore.isDeleted).toBeFalsy();
|
expect(ticketAfterRestore.isDeleted).toBeFalsy();
|
||||||
|
|
|
@ -5,5 +5,40 @@
|
||||||
"mysql": {
|
"mysql": {
|
||||||
"table": "ticketLog"
|
"table": "ticketLog"
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"originFk": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"userFk": {
|
||||||
|
"type":"number"
|
||||||
|
},
|
||||||
|
"action": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"creationDate": {
|
||||||
|
"type": "date"
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"changedModel": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"oldInstance": {
|
||||||
|
"type": "any"
|
||||||
|
},
|
||||||
|
"newInstance": {
|
||||||
|
"type": "any"
|
||||||
|
},
|
||||||
|
"changedModelId": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"changedModelValue": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,29 @@ class Controller extends Section {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const filter = {
|
||||||
|
fields: ['originFk', 'creationDate', 'newInstance'],
|
||||||
|
where: {
|
||||||
|
originFk: value,
|
||||||
|
newInstance: {like: '%"isDeleted":true%'}
|
||||||
|
},
|
||||||
|
order: 'creationDate DESC'
|
||||||
|
};
|
||||||
|
this.$http.get(`TicketLogs/findOne`, {filter})
|
||||||
|
.then(res => {
|
||||||
|
if (res && res.data) {
|
||||||
|
const now = Date.vnNew();
|
||||||
|
const maxDate = new Date(res.data.creationDate);
|
||||||
|
maxDate.setHours(maxDate.getHours() + 1);
|
||||||
|
if (now <= maxDate)
|
||||||
|
return this.canRestoreTicket = true;
|
||||||
|
}
|
||||||
|
this.canRestoreTicket = false;
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.canRestoreTicket = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
get isInvoiced() {
|
get isInvoiced() {
|
||||||
|
@ -171,15 +194,6 @@ class Controller extends Section {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
get canRestoreTicket() {
|
|
||||||
const isDeleted = this.ticket.isDeleted;
|
|
||||||
const now = Date.vnNew();
|
|
||||||
const maxDate = new Date(this.ticket.updated);
|
|
||||||
maxDate.setHours(maxDate.getHours() + 1);
|
|
||||||
|
|
||||||
return isDeleted && (now <= maxDate);
|
|
||||||
}
|
|
||||||
|
|
||||||
restoreTicket() {
|
restoreTicket() {
|
||||||
return this.$http.post(`Tickets/${this.id}/restore`)
|
return this.$http.post(`Tickets/${this.id}/restore`)
|
||||||
.then(() => this.reload())
|
.then(() => this.reload())
|
||||||
|
|
|
@ -40,29 +40,6 @@ describe('Ticket Component vnTicketDescriptorMenu', () => {
|
||||||
controller.ticket = ticket;
|
controller.ticket = ticket;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('canRestoreTicket() getter', () => {
|
|
||||||
it('should return true for a ticket deleted within the last hour', () => {
|
|
||||||
controller.ticket.isDeleted = true;
|
|
||||||
controller.ticket.updated = Date.vnNew();
|
|
||||||
|
|
||||||
const result = controller.canRestoreTicket;
|
|
||||||
|
|
||||||
expect(result).toBeTruthy();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return false for a ticket deleted more than one hour ago', () => {
|
|
||||||
const pastHour = Date.vnNew();
|
|
||||||
pastHour.setHours(pastHour.getHours() - 2);
|
|
||||||
|
|
||||||
controller.ticket.isDeleted = true;
|
|
||||||
controller.ticket.updated = pastHour;
|
|
||||||
|
|
||||||
const result = controller.canRestoreTicket;
|
|
||||||
|
|
||||||
expect(result).toBeFalsy();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('addTurn()', () => {
|
describe('addTurn()', () => {
|
||||||
it('should make a query and call $.addTurn.hide() and vnApp.showSuccess()', () => {
|
it('should make a query and call $.addTurn.hide() and vnApp.showSuccess()', () => {
|
||||||
controller.$.addTurn = {hide: () => {}};
|
controller.$.addTurn = {hide: () => {}};
|
||||||
|
@ -105,20 +82,6 @@ describe('Ticket Component vnTicketDescriptorMenu', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('restoreTicket()', () => {
|
|
||||||
it('should make a query to restore the ticket and call vnApp.showSuccess()', () => {
|
|
||||||
jest.spyOn(controller, 'reload').mockReturnThis();
|
|
||||||
jest.spyOn(controller.vnApp, 'showSuccess');
|
|
||||||
|
|
||||||
$httpBackend.expectPOST(`Tickets/${ticket.id}/restore`).respond();
|
|
||||||
controller.restoreTicket();
|
|
||||||
$httpBackend.flush();
|
|
||||||
|
|
||||||
expect(controller.reload).toHaveBeenCalled();
|
|
||||||
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('showPdfDeliveryNote()', () => {
|
describe('showPdfDeliveryNote()', () => {
|
||||||
it('should open a new window showing a delivery note PDF document', () => {
|
it('should open a new window showing a delivery note PDF document', () => {
|
||||||
jest.spyOn(window, 'open').mockReturnThis();
|
jest.spyOn(window, 'open').mockReturnThis();
|
||||||
|
|
Loading…
Reference in New Issue