') td
- FROM tmp.zoneNodes zn
- JOIN zone z ON z.id = zn.zoneFk
- JOIN geoCollision gc ON gc.agencyModeFk = z.agencyModeFk AND zn.geoFk = gc.geoFk
- JOIN warehouse w ON w.id = gc.warehouseFk) sub;
-
- DROP TEMPORARY TABLE
- geoCollision,
+
+ -- Recojo los datos de la zona que ha dado conflicto
+ SELECT JSON_ARRAYAGG(
+ JSON_OBJECT(
+ 'zoneFk', zoneFk,
+ 'zn', JSON_OBJECT('name', zn.name),
+ 'z', JSON_OBJECT('name', z.name,'price', z.price),
+ 'w', JSON_OBJECT('name', w.name)
+ )
+ ) FROM tmp.zoneNodes zn
+ JOIN zone z ON z.id = zn.zoneFk
+ JOIN geoCollision gc ON gc.agencyModeFk = z.agencyModeFk AND zn.geoFk = gc.geoFk
+ JOIN warehouse w ON w.id = gc.warehouseFk
+ INTO json_data;
+
+ -- Creo un registro de la notificacion 'zone-included' para reportar via email
+ SELECT util.notification_send(
+ 'zone-included',
+ JSON_OBJECT('zoneCollisions',json_data),
+ account.myUser_getId()
+ );
+
+ DROP TEMPORARY TABLE
+ geoCollision,
tmp.zone,
tmp.zoneNodes;
END$$
diff --git a/db/routines/vn/triggers/buy_beforeDelete.sql b/db/routines/vn/triggers/buy_beforeDelete.sql
index eb7c0ef70..85f1cf298 100644
--- a/db/routines/vn/triggers/buy_beforeDelete.sql
+++ b/db/routines/vn/triggers/buy_beforeDelete.sql
@@ -3,6 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`buy_beforeDelete`
BEFORE DELETE ON `buy`
FOR EACH ROW
BEGIN
+ CALL entry_checkBooked(OLD.entryFk);
IF OLD.printedStickers <> 0 THEN
CALL util.throw("it is not possible to delete buys with printed labels ");
END IF;
diff --git a/db/routines/vn/triggers/buy_beforeInsert.sql b/db/routines/vn/triggers/buy_beforeInsert.sql
index c88bef05a..bc51ac852 100644
--- a/db/routines/vn/triggers/buy_beforeInsert.sql
+++ b/db/routines/vn/triggers/buy_beforeInsert.sql
@@ -9,17 +9,26 @@ trig: BEGIN
DECLARE vGroupingMode TINYINT;
DECLARE vGenericFk INT;
DECLARE vGenericInDate BOOL;
+ DECLARE vBuyerFk INT;
IF @isModeInventory THEN
LEAVE trig;
END IF;
+ CALL entry_checkBooked(NEW.entryFk);
IF NEW.printedStickers <> 0 THEN
CALL util.throw('it is not possible to create buy lines with printedstickers other than 0');
END IF;
SET NEW.editorFk = account.myUser_getId();
+ SELECT it.workerFk INTO vBuyerFk
+ FROM item i
+ JOIN itemType it ON it.id = i.typeFk
+ WHERE i.id = NEW.itemFk;
+
+ SET NEW.buyerFk = vBuyerFk;
+
CALL buy_checkGrouping(NEW.`grouping`);
SELECT t.warehouseInFk, t.landed
diff --git a/db/routines/vn/triggers/buy_beforeUpdate.sql b/db/routines/vn/triggers/buy_beforeUpdate.sql
index fc03c456f..2403091c6 100644
--- a/db/routines/vn/triggers/buy_beforeUpdate.sql
+++ b/db/routines/vn/triggers/buy_beforeUpdate.sql
@@ -7,11 +7,13 @@ trig:BEGIN
DECLARE vGenericInDate BOOL;
DECLARE vIsInventory BOOL;
DECLARE vDefaultEntry INT;
+ DECLARE vBuyerFk INT;
IF @isTriggerDisabled THEN
LEAVE trig;
END IF;
+ CALL entry_checkBooked(OLD.entryFk);
SET NEW.editorFk = account.myUser_getId();
SELECT defaultEntry INTO vDefaultEntry
@@ -65,6 +67,15 @@ trig:BEGIN
SET NEW.isIgnored = TRUE;
END IF;
+ IF NOT (NEW.itemFk <=> OLD.itemFk) THEN
+ SELECT it.workerFk INTO vBuyerFk
+ FROM item i
+ JOIN itemType it ON it.id = i.typeFk
+ WHERE i.id = NEW.itemFk;
+
+ SET NEW.buyerFk = vBuyerFk;
+ END IF;
+
IF NOT (NEW.itemFk <=> OLD.itemFk) OR
NOT (OLD.entryFk <=> NEW.entryFk) THEN
CREATE OR REPLACE TEMPORARY TABLE tmp.buysToCheck
diff --git a/db/routines/vn/triggers/entryDms_afterDelete.sql b/db/routines/vn/triggers/entryDms_afterDelete.sql
new file mode 100644
index 000000000..9ae8e7058
--- /dev/null
+++ b/db/routines/vn/triggers/entryDms_afterDelete.sql
@@ -0,0 +1,12 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`entryDms_afterDelete`
+ AFTER DELETE ON `entryDms`
+ FOR EACH ROW
+BEGIN
+ INSERT INTO entryLog
+ SET `action` = 'delete',
+ `changedModel` = 'EntryDms',
+ `changedModelId` = OLD.entryFk,
+ `userFk` = account.myUser_getId();
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/triggers/entryDms_beforeInsert.sql b/db/routines/vn/triggers/entryDms_beforeInsert.sql
new file mode 100644
index 000000000..4f9550f48
--- /dev/null
+++ b/db/routines/vn/triggers/entryDms_beforeInsert.sql
@@ -0,0 +1,8 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`entryDms_beforeInsert`
+ BEFORE INSERT ON `entryDms`
+ FOR EACH ROW
+BEGIN
+ SET NEW.editorFk = account.myUser_getId();
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/triggers/entryDms_beforeUpdate.sql b/db/routines/vn/triggers/entryDms_beforeUpdate.sql
new file mode 100644
index 000000000..ecc047029
--- /dev/null
+++ b/db/routines/vn/triggers/entryDms_beforeUpdate.sql
@@ -0,0 +1,8 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`entryDms_beforeUpdate`
+ BEFORE UPDATE ON `entryDms`
+ FOR EACH ROW
+BEGIN
+ SET NEW.editorFk = account.myUser_getId();
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/triggers/entry_beforeDelete.sql b/db/routines/vn/triggers/entry_beforeDelete.sql
index 82a3dabd5..1d2c84b9e 100644
--- a/db/routines/vn/triggers/entry_beforeDelete.sql
+++ b/db/routines/vn/triggers/entry_beforeDelete.sql
@@ -3,6 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`entry_beforeDelete`
BEFORE DELETE ON `entry`
FOR EACH ROW
BEGIN
+ CALL entry_checkBooked(OLD.id);
DELETE FROM buy WHERE entryFk = OLD.id;
END$$
DELIMITER ;
diff --git a/db/routines/vn/triggers/entry_beforeInsert.sql b/db/routines/vn/triggers/entry_beforeInsert.sql
index f475630db..c0c0aa28c 100644
--- a/db/routines/vn/triggers/entry_beforeInsert.sql
+++ b/db/routines/vn/triggers/entry_beforeInsert.sql
@@ -7,6 +7,8 @@ BEGIN
CALL supplier_checkIsActive(NEW.supplierFk);
SET NEW.currencyFk = entry_getCurrency(NEW.currencyFk, NEW.supplierFk);
SET NEW.commission = entry_getCommission(NEW.travelFk, NEW.currencyFk,NEW.supplierFk);
-
+ IF NEW.travelFk IS NOT NULL AND NOT travel_hasUniqueAwb(NEW.travelFk) THEN
+ CALL util.throw('The travel is incorrect, there is a different AWB in the associated entries');
+ END IF;
END$$
DELIMITER ;
diff --git a/db/routines/vn/triggers/entry_beforeUpdate.sql b/db/routines/vn/triggers/entry_beforeUpdate.sql
index 91d490b21..98ebe1364 100644
--- a/db/routines/vn/triggers/entry_beforeUpdate.sql
+++ b/db/routines/vn/triggers/entry_beforeUpdate.sql
@@ -6,15 +6,24 @@ BEGIN
DECLARE vIsVirtual BOOL;
DECLARE vPrintedCount INT;
DECLARE vHasDistinctWarehouses BOOL;
+
+ IF NEW.isBooked = OLD.isBooked THEN
+ CALL entry_checkBooked(OLD.id);
+ END IF;
SET NEW.editorFk = account.myUser_getId();
- IF !(NEW.travelFk <=> OLD.travelFk) THEN
+ IF NOT (NEW.travelFk <=> OLD.travelFk) THEN
+
+ IF NEW.travelFk IS NOT NULL AND NOT travel_hasUniqueAwb(NEW.travelFk) THEN
+ CALL util.throw('The travel is incorrect, there is a different AWB in the associated entries');
+ END IF;
+
SELECT COUNT(*) > 0 INTO vIsVirtual
FROM entryVirtual WHERE entryFk = NEW.id;
- SELECT !(o.warehouseInFk <=> n.warehouseInFk)
- OR !(o.warehouseOutFk <=> n.warehouseOutFk)
+ SELECT NOT (o.warehouseInFk <=> n.warehouseInFk)
+ OR NOT (o.warehouseOutFk <=> n.warehouseOutFk)
INTO vHasDistinctWarehouses
FROM travel o, travel n
WHERE o.id = OLD.travelFk
@@ -43,9 +52,8 @@ BEGIN
SET NEW.currencyFk = entry_getCurrency(NEW.currencyFk, NEW.supplierFk);
END IF;
- IF NOT (NEW.travelFk <=> OLD.travelFk)
- OR NOT (NEW.currencyFk <=> OLD.currencyFk) THEN
- SET NEW.commission = entry_getCommission(NEW.travelFk, NEW.currencyFk,NEW.supplierFk);
+ IF NOT (NEW.travelFk <=> OLD.travelFk) OR NOT (NEW.currencyFk <=> OLD.currencyFk) THEN
+ SET NEW.commission = entry_getCommission(NEW.travelFk, NEW.currencyFk, NEW.supplierFk);
END IF;
END$$
DELIMITER ;
diff --git a/db/routines/vn/triggers/invoiceIn_beforeInsert.sql b/db/routines/vn/triggers/invoiceIn_beforeInsert.sql
index c09e71ba1..2b80f2534 100644
--- a/db/routines/vn/triggers/invoiceIn_beforeInsert.sql
+++ b/db/routines/vn/triggers/invoiceIn_beforeInsert.sql
@@ -9,6 +9,10 @@ BEGIN
DECLARE vActive TINYINT;
DECLARE vWithholdingSageFk INT;
+ IF NOT util.checkPrintableChars(NEW.supplierRef) THEN
+ CALL util.throw('The invoiceIn reference contains invalid characters');
+ END IF;
+
SET NEW.editorFk = account.myUser_getId();
SELECT withholdingSageFk INTO vWithholdingSageFk
diff --git a/db/routines/vn/triggers/invoiceIn_beforeUpdate.sql b/db/routines/vn/triggers/invoiceIn_beforeUpdate.sql
index ae69ad379..4503c7dbd 100644
--- a/db/routines/vn/triggers/invoiceIn_beforeUpdate.sql
+++ b/db/routines/vn/triggers/invoiceIn_beforeUpdate.sql
@@ -3,9 +3,12 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceIn_beforeUpdat
BEFORE UPDATE ON `invoiceIn`
FOR EACH ROW
BEGIN
-
DECLARE vWithholdingSageFk INT;
+ IF NOT (NEW.supplierRef <=> OLD.supplierRef) AND NOT util.checkPrintableChars(NEW.supplierRef) THEN
+ CALL util.throw('The invoiceIn reference contains invalid characters');
+ END IF;
+
SET NEW.editorFk = account.myUser_getId();
IF (SELECT COUNT(*) FROM vn.invoiceIn
diff --git a/db/routines/vn/triggers/parking_afterDelete.sql b/db/routines/vn/triggers/parking_afterDelete.sql
new file mode 100644
index 000000000..1ec96c24d
--- /dev/null
+++ b/db/routines/vn/triggers/parking_afterDelete.sql
@@ -0,0 +1,12 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`parking_afterDelete`
+ AFTER DELETE ON `parking`
+ FOR EACH ROW
+BEGIN
+ INSERT INTO parkingLog
+ SET `action` = 'delete',
+ `changedModel` = 'Parking',
+ `changedModelId` = OLD.id,
+ `userFk` = account.myUser_getId();
+END$$
+DELIMITER ;
\ No newline at end of file
diff --git a/db/routines/vn/triggers/parking_beforeInsert.sql b/db/routines/vn/triggers/parking_beforeInsert.sql
index 9cf0bd42a..cdec4c759 100644
--- a/db/routines/vn/triggers/parking_beforeInsert.sql
+++ b/db/routines/vn/triggers/parking_beforeInsert.sql
@@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`parking_beforeInsert`
BEFORE INSERT ON `parking`
FOR EACH ROW
BEGIN
-
+ SET NEW.editorFk = account.myUser_getId();
-- SET new.`code` = CONCAT(new.`column`,' - ',new.`row`) ;
END$$
diff --git a/db/routines/vn/triggers/parking_beforeUpdate.sql b/db/routines/vn/triggers/parking_beforeUpdate.sql
index 38238daa1..3e808f505 100644
--- a/db/routines/vn/triggers/parking_beforeUpdate.sql
+++ b/db/routines/vn/triggers/parking_beforeUpdate.sql
@@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`parking_beforeUpdate`
BEFORE UPDATE ON `parking`
FOR EACH ROW
BEGIN
-
+ SET NEW.editorFk = account.myUser_getId();
-- SET new.`code` = CONCAT(new.`column`,' - ',new.`row`) ;
END$$
diff --git a/db/routines/vn/triggers/payment_beforeInsert.sql b/db/routines/vn/triggers/payment_beforeInsert.sql
index 6a28a1382..1b343712f 100644
--- a/db/routines/vn/triggers/payment_beforeInsert.sql
+++ b/db/routines/vn/triggers/payment_beforeInsert.sql
@@ -10,21 +10,21 @@ BEGIN
-- PAK 10/02/15 No se asientan los pagos directamente, salvo en el caso de las cajas de CASH
SELECT (at2.code = 'cash') INTO bolCASH
- FROM vn.bank b
- JOIN vn.accountingType at2 ON at2.id = b.cash
- WHERE b.id = NEW.bankFk;
+ FROM accounting a
+ JOIN accountingType at2 ON at2.id = a.accountingTypeFk
+ WHERE a.id = NEW.bankFk;
IF bolCASH THEN
SELECT account INTO cuenta_banco
- FROM bank
+ FROM accounting
WHERE id = NEW.bankFk;
SELECT account INTO cuenta_proveedor
FROM supplier
WHERE id = NEW.supplierFk;
- CALL vn.ledger_next(vNewBookEntry);
+ CALL ledger_next(vNewBookEntry);
INSERT INTO XDiario ( ASIEN,
FECHA,
diff --git a/db/routines/vn/triggers/saleLabel_afterUpdate.sql b/db/routines/vn/triggers/saleLabel_afterUpdate.sql
new file mode 100644
index 000000000..ff3787358
--- /dev/null
+++ b/db/routines/vn/triggers/saleLabel_afterUpdate.sql
@@ -0,0 +1,8 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`saleLabel_afterUpdate`
+ AFTER UPDATE ON `vn`.`saleLabel`
+ FOR EACH ROW
+IF NEW.stem >= (SELECT s.quantity FROM sale s WHERE s.id = NEW.saleFk) THEN
+ UPDATE sale s SET s.isPicked = TRUE WHERE s.id = NEW.saleFk;
+END IF$$
+DELIMITER ;
\ No newline at end of file
diff --git a/db/routines/vn/triggers/supplierDms_afterDelete.sql b/db/routines/vn/triggers/supplierDms_afterDelete.sql
new file mode 100644
index 000000000..482decbb6
--- /dev/null
+++ b/db/routines/vn/triggers/supplierDms_afterDelete.sql
@@ -0,0 +1,12 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`supplierDms_afterDelete`
+ AFTER DELETE ON `supplierDms`
+ FOR EACH ROW
+BEGIN
+ INSERT INTO clientLog
+ SET `action` = 'delete',
+ `changedModel` = 'supplierDms',
+ `changedModelId` = OLD.dmsFk,
+ `userFk` = account.myUser_getId();
+END$$
+DELIMITER ;
\ No newline at end of file
diff --git a/db/routines/vn/triggers/supplierDms_beforeInsert.sql b/db/routines/vn/triggers/supplierDms_beforeInsert.sql
new file mode 100644
index 000000000..130428d1e
--- /dev/null
+++ b/db/routines/vn/triggers/supplierDms_beforeInsert.sql
@@ -0,0 +1,8 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`supplierDms_beforeInsert`
+ BEFORE INSERT ON `supplierDms`
+ FOR EACH ROW
+BEGIN
+ SET NEW.editorFk = account.myUser_getId();
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/triggers/supplierDms_beforeUpdate.sql b/db/routines/vn/triggers/supplierDms_beforeUpdate.sql
new file mode 100644
index 000000000..54dcef049
--- /dev/null
+++ b/db/routines/vn/triggers/supplierDms_beforeUpdate.sql
@@ -0,0 +1,8 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`supplierDms_beforeUpdate`
+ BEFORE UPDATE ON `supplierDms`
+ FOR EACH ROW
+BEGIN
+ SET NEW.editorFk = account.myUser_getId();
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/triggers/travel_afterUpdate.sql b/db/routines/vn/triggers/travel_afterUpdate.sql
index b4e40ae41..38cd3ba13 100644
--- a/db/routines/vn/triggers/travel_afterUpdate.sql
+++ b/db/routines/vn/triggers/travel_afterUpdate.sql
@@ -5,7 +5,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`travel_afterUpdate`
BEGIN
CALL stock.log_add('travel', NEW.id, OLD.id);
- IF !(NEW.shipped <=> OLD.shipped) THEN
+ IF NOT(NEW.shipped <=> OLD.shipped) THEN
UPDATE entry
SET commission = entry_getCommission(travelFk, currencyFk,supplierFk)
WHERE travelFk = NEW.id;
diff --git a/db/routines/vn/triggers/travel_beforeInsert.sql b/db/routines/vn/triggers/travel_beforeInsert.sql
index 4e1dae3ef..817bd69bb 100644
--- a/db/routines/vn/triggers/travel_beforeInsert.sql
+++ b/db/routines/vn/triggers/travel_beforeInsert.sql
@@ -8,5 +8,9 @@ BEGIN
CALL travel_checkDates(NEW.shipped, NEW.landed);
CALL travel_checkWarehouseIsFeedStock(NEW.warehouseInFk);
+
+ IF NEW.awbFk IS NOT NULL AND NOT travel_hasUniqueAwb(NEW.id) THEN
+ CALL util.throw('The AWB is incorrect, there is a different AWB in the associated entries');
+ END IF;
END$$
DELIMITER ;
diff --git a/db/routines/vn/triggers/travel_beforeUpdate.sql b/db/routines/vn/triggers/travel_beforeUpdate.sql
index 2079cd21e..5e43c8761 100644
--- a/db/routines/vn/triggers/travel_beforeUpdate.sql
+++ b/db/routines/vn/triggers/travel_beforeUpdate.sql
@@ -3,9 +3,11 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`travel_beforeUpdate`
BEFORE UPDATE ON `travel`
FOR EACH ROW
BEGIN
+ DECLARE vHasAnyInvoiceBooked BOOL;
+
SET NEW.editorFk = account.myUser_getId();
- IF NOT (NEW.landed <=> OLD.landed)
+ IF NOT (NEW.landed <=> OLD.landed)
OR NOT (NEW.shipped <=> OLD.shipped) THEN
CALL travel_checkDates(NEW.shipped, NEW.landed);
END IF;
@@ -17,5 +19,22 @@ BEGIN
IF NOT (NEW.warehouseInFk <=> OLD.warehouseInFk) THEN
CALL travel_checkWarehouseIsFeedStock(NEW.warehouseInFk);
END IF;
+
+ IF NOT (NEW.awbFk <=> OLD.awbFk)THEN
+ SELECT COUNT(*) INTO vHasAnyInvoiceBooked
+ FROM travel t
+ JOIN entry e ON e.travelFk = t.id
+ JOIN invoiceIn ii ON ii.id = e.invoiceInFk
+ WHERE t.id = NEW.id
+ AND ii.isBooked;
+
+ IF vHasAnyInvoiceBooked THEN
+ CALL util.throw('The travel has entries with booked invoices');
+ END IF;
+ END IF;
+
+ IF (NOT(NEW.awbFk <=> OLD.awbFk)) AND NEW.awbFk IS NOT NULL AND NOT travel_hasUniqueAwb(NEW.id) THEN
+ CALL util.throw('The AWB is incorrect, there is a different AWB in the associated entries');
+ END IF;
END$$
DELIMITER ;
diff --git a/db/routines/vn/triggers/zoneIncluded_afterDelete.sql b/db/routines/vn/triggers/zoneIncluded_afterDelete.sql
index 6d184bb12..18332bb55 100644
--- a/db/routines/vn/triggers/zoneIncluded_afterDelete.sql
+++ b/db/routines/vn/triggers/zoneIncluded_afterDelete.sql
@@ -8,5 +8,6 @@ BEGIN
`changedModel` = 'zoneIncluded',
`changedModelId` = OLD.zoneFk,
`userFk` = account.myUser_getId();
+
END$$
DELIMITER ;
diff --git a/db/routines/vn/triggers/zoneIncluded_beforeInsert.sql b/db/routines/vn/triggers/zoneIncluded_beforeInsert.sql
index 5eff33efa..18895c9a5 100644
--- a/db/routines/vn/triggers/zoneIncluded_beforeInsert.sql
+++ b/db/routines/vn/triggers/zoneIncluded_beforeInsert.sql
@@ -4,5 +4,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`zoneIncluded_beforeIn
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
+
END$$
DELIMITER ;
diff --git a/db/routines/vn/triggers/zoneIncluded_beforeUpdate.sql b/db/routines/vn/triggers/zoneIncluded_beforeUpdate.sql
index 445f37699..e3f0a27e2 100644
--- a/db/routines/vn/triggers/zoneIncluded_beforeUpdate.sql
+++ b/db/routines/vn/triggers/zoneIncluded_beforeUpdate.sql
@@ -4,5 +4,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`zoneIncluded_beforeUp
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
+
END$$
DELIMITER ;
diff --git a/db/routines/vn/views/bank.sql b/db/routines/vn/views/bank.sql
deleted file mode 100644
index fa0d9a4f0..000000000
--- a/db/routines/vn/views/bank.sql
+++ /dev/null
@@ -1,12 +0,0 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
- SQL SECURITY DEFINER
- VIEW `vn`.`bank`
-AS SELECT `a`.`id` AS `id`,
- `a`.`bank` AS `bank`,
- `a`.`account` AS `account`,
- `a`.`accountingTypeFk` AS `cash`,
- `a`.`entityFk` AS `entityFk`,
- `a`.`isActive` AS `isActive`,
- `a`.`currencyFk` AS `currencyFk`,
- `a`.`code` AS `code`
-FROM `vn`.`accounting` `a`
diff --git a/db/routines/vn/views/doc.sql b/db/routines/vn/views/doc.sql
deleted file mode 100644
index 31ac20640..000000000
--- a/db/routines/vn/views/doc.sql
+++ /dev/null
@@ -1,14 +0,0 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
- SQL SECURITY DEFINER
- VIEW `vn`.`doc`
-AS SELECT `g`.`id` AS `id`,
- `g`.`sref` AS `sref`,
- `g`.`brief` AS `brief`,
- `g`.`emp_id` AS `companyFk`,
- `g`.`orden` AS `order`,
- `g`.`file` AS `file`,
- `g`.`original` AS `original`,
- `g`.`trabajador_id` AS `workerFk`,
- `g`.`odbc_date` AS `created`,
- `g`.`warehouse_id` AS `warehouseFk`
-FROM `vn2008`.`gestdoc` `g`
diff --git a/db/routines/vn/views/exchangeInsuranceInPrevious.sql b/db/routines/vn/views/exchangeInsuranceInPrevious.sql
index 097728bc7..3f997e8bf 100644
--- a/db/routines/vn/views/exchangeInsuranceInPrevious.sql
+++ b/db/routines/vn/views/exchangeInsuranceInPrevious.sql
@@ -1,7 +1,7 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`exchangeInsuranceInPrevious`
-AS SELECT `ei`.`finished` AS `dated`,
+AS SELECT `ei`.`dueDated` AS `dated`,
`ei`.`amount` AS `amount`,
`ei`.`rate` AS `rate`
FROM `vn`.`exchangeInsurance` `ei`
diff --git a/db/routines/vn/views/exchangeInsuranceOut.sql b/db/routines/vn/views/exchangeInsuranceOut.sql
index f93b65331..5c41dbb24 100644
--- a/db/routines/vn/views/exchangeInsuranceOut.sql
+++ b/db/routines/vn/views/exchangeInsuranceOut.sql
@@ -7,9 +7,9 @@ AS SELECT `p`.`received` AS `received`,
FROM (
(
`vn`.`payment` `p`
- JOIN `vn`.`bank` `b` ON(`b`.`id` = `p`.`bankFk`)
+ JOIN `vn`.`accounting` `a` ON(`a`.`id` = `p`.`bankFk`)
)
- JOIN `vn`.`accountingType` `at2` ON(`at2`.`id` = `b`.`cash`)
+ JOIN `vn`.`accountingType` `at2` ON(`at2`.`id` = `a`.`accountingTypeFk`)
)
WHERE `p`.`currencyFk` = 2
AND `at2`.`code` = 'wireTransfer'
diff --git a/db/routines/vn/views/preparationException.sql b/db/routines/vn/views/preparationException.sql
deleted file mode 100644
index ba624ad27..000000000
--- a/db/routines/vn/views/preparationException.sql
+++ /dev/null
@@ -1,7 +0,0 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
- SQL SECURITY DEFINER
- VIEW `vn`.`preparationException`
-AS SELECT `p`.`exception_day` AS `exceptionDay`,
- `p`.`warehouse_id` AS `warehouseFk`,
- `p`.`percentage` AS `percentage`
-FROM `vn2008`.`preparation_exception` `p`
diff --git a/db/routines/vn/views/saleValue.sql b/db/routines/vn/views/saleValue.sql
index 4394769d1..2dee4695e 100644
--- a/db/routines/vn/views/saleValue.sql
+++ b/db/routines/vn/views/saleValue.sql
@@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost`
VIEW `vn`.`saleValue`
AS SELECT `wh`.`name` AS `warehouse`,
`c`.`name` AS `client`,
- `c`.`typeFk` AS `clientTypeFk`,
+ `c`.`typeFk` AS `typeFk`,
`u`.`name` AS `buyer`,
`it`.`id` AS `itemTypeFk`,
`it`.`name` AS `family`,
diff --git a/db/routines/vn/views/salesPersonSince.sql b/db/routines/vn/views/salesPersonSince.sql
index 43c45adc0..4234ecac4 100644
--- a/db/routines/vn/views/salesPersonSince.sql
+++ b/db/routines/vn/views/salesPersonSince.sql
@@ -12,5 +12,5 @@ FROM (
`pc`.`id` = `b`.`workerBusinessProfessionalCategoryFk`
)
)
-WHERE `pc`.`name` = 'Aux ventas'
+WHERE `pc`.`description` = 'Aux ventas'
GROUP BY `b`.`workerFk`
diff --git a/db/routines/vn/views/unary.sql b/db/routines/vn/views/unary.sql
deleted file mode 100644
index 7f4c0d8c5..000000000
--- a/db/routines/vn/views/unary.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
- SQL SECURITY DEFINER
- VIEW `vn`.`unary`
-AS SELECT `a`.`id` AS `id`,
- `a`.`parent` AS `parent`
-FROM `vn2008`.`unary` `a`
diff --git a/db/routines/vn/views/unaryScan.sql b/db/routines/vn/views/unaryScan.sql
deleted file mode 100644
index 18428dd62..000000000
--- a/db/routines/vn/views/unaryScan.sql
+++ /dev/null
@@ -1,8 +0,0 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
- SQL SECURITY DEFINER
- VIEW `vn`.`unaryScan`
-AS SELECT `u`.`unary_id` AS `unaryFk`,
- `u`.`name` AS `name`,
- `u`.`odbc_date` AS `created`,
- `u`.`type` AS `type`
-FROM `vn2008`.`unary_scan` `u`
diff --git a/db/routines/vn/views/unaryScanLine.sql b/db/routines/vn/views/unaryScanLine.sql
deleted file mode 100644
index 75aec7fed..000000000
--- a/db/routines/vn/views/unaryScanLine.sql
+++ /dev/null
@@ -1,8 +0,0 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
- SQL SECURITY DEFINER
- VIEW `vn`.`unaryScanLine`
-AS SELECT `u`.`id` AS `id`,
- `u`.`code` AS `code`,
- `u`.`odbc_date` AS `created`,
- `u`.`unary_id` AS `unaryScanFk`
-FROM `vn2008`.`unary_scan_line` `u`
diff --git a/db/routines/vn/views/unaryScanLineBuy.sql b/db/routines/vn/views/unaryScanLineBuy.sql
deleted file mode 100644
index 26f178a45..000000000
--- a/db/routines/vn/views/unaryScanLineBuy.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
- SQL SECURITY DEFINER
- VIEW `vn`.`unaryScanLineBuy`
-AS SELECT `u`.`scan_line_id` AS `unaryScanLineFk`,
- `u`.`Id_Article` AS `itemFk`
-FROM `vn2008`.`unary_scan_line_buy` `u`
diff --git a/db/routines/vn/views/unaryScanLineExpedition.sql b/db/routines/vn/views/unaryScanLineExpedition.sql
deleted file mode 100644
index e71c2423e..000000000
--- a/db/routines/vn/views/unaryScanLineExpedition.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
- SQL SECURITY DEFINER
- VIEW `vn`.`unaryScanLineExpedition`
-AS SELECT `u`.`scan_line_id` AS `unaryScanLineFk`,
- `u`.`expedition_id` AS `expeditionFk`
-FROM `vn2008`.`unary_scan_line_expedition` `u`
diff --git a/db/routines/vn2008/procedures/CalculoRemesas.sql b/db/routines/vn2008/procedures/CalculoRemesas.sql
deleted file mode 100644
index a4c191a80..000000000
--- a/db/routines/vn2008/procedures/CalculoRemesas.sql
+++ /dev/null
@@ -1,66 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`CalculoRemesas`(IN vFechaRemesa DATE)
-BEGIN
-
- DROP TEMPORARY TABLE IF EXISTS TMP_REMESAS;
- CREATE TEMPORARY TABLE TMP_REMESAS
- SELECT
- CONCAT(p.NIF,REPEAT('0', 12-LENGTH(p.NIF))) as CIF1,
- cli.Id_Cliente,
- cli.Cliente,
- cli.`IF` as NIF,
- c.PaymentDate as Vencimiento,
- 0 ImporteFac,
- cast(c.Recibo as decimal(10,2)) as ImporteRec,
- 0 as ImporteActual,
- c.companyFk empresa_id,
- cli.RazonSocial,
- cast(c.Recibo as decimal(10,2)) as ImporteTotal,
- cast(c.Recibo as decimal(10,2)) as Saldo,
- p.Proveedor as Empresa,
- e.abbreviation as EMP,
- cli.cuenta,
- iban AS Iban,
- CONVERT(SUBSTRING(iban,5,4),UNSIGNED INT) AS nrbe,
- sepavnl as SEPA,
- corevnl as RecibidoCORE,
- hasLcr,
- be.bic,
- be.`name` entityName
- FROM Clientes cli
- JOIN
- (SELECT risk.companyFk,
- c.Id_Cliente,
- sum(risk.amount) as Recibo,
- IF((c.Vencimiento + graceDays) mod 30.001 <= day(vFechaRemesa)
- ,TIMESTAMPADD(DAY, (c.Vencimiento + graceDays) MOD 30.001, LAST_DAY(TIMESTAMPADD(MONTH,-1,vFechaRemesa)))
- ,TIMESTAMPADD(DAY, (c.Vencimiento + graceDays) MOD 30.001, LAST_DAY(TIMESTAMPADD(MONTH,-2,vFechaRemesa)))
- ) as PaymentDate
- FROM Clientes c
- JOIN pay_met pm on pm.id = pay_met_id
- JOIN
- (
- SELECT companyFk, clientFk, amount
- FROM Clientes c
- JOIN vn.clientRisk cr ON cr.clientFk = c.Id_Cliente
- WHERE pay_met_id = 4
-
- UNION ALL
-
- SELECT io.companyFk, io.clientFk Id_Cliente, - io.amount
- FROM vn.invoiceOut io
- JOIN Clientes c ON c.Id_Cliente = io.clientFk
- JOIN pay_met pm on pm.id = pay_met_id
- WHERE io.dued > vFechaRemesa
- AND pay_met_id = 4 AND pm.deudaviva
- AND io.amount > 0
-
- ) risk ON c.Id_Cliente = risk.clientFk
- GROUP BY risk.companyFk, Id_Cliente
- HAVING Recibo > 10
- ) c on c.Id_Cliente = cli.Id_Cliente
- JOIN Proveedores p on p.Id_Proveedor = c.companyFk
- JOIN empresa e on e.id = c.companyFk
- LEFT JOIN vn.bankEntity be ON be.id = cli.bankEntityFk;
-END$$
-DELIMITER ;
diff --git a/db/routines/vn2008/procedures/ListaTicketsEncajados.sql b/db/routines/vn2008/procedures/ListaTicketsEncajados.sql
deleted file mode 100644
index ce99916ee..000000000
--- a/db/routines/vn2008/procedures/ListaTicketsEncajados.sql
+++ /dev/null
@@ -1,25 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`ListaTicketsEncajados`(IN intId_Trabajador int)
-BEGIN
-
-SELECT Agencia,
- Consignatario,
- ti.Id_Ticket,
- ts.userFk Id_Trabajador,
- IFNULL(ncajas,0) AS ncajas,
- IFNULL(nbultos,0) AS nbultos,
- IFNULL(notros,0) AS notros,
- ts.code AS Estado
- FROM Tickets ti
- INNER JOIN Consignatarios ON ti.Id_Consigna = Consignatarios.Id_consigna
- INNER JOIN Agencias ON ti.Id_Agencia = Agencias.Id_Agencia
- LEFT JOIN (SELECT ticketFk,count(*) AS ncajas FROM vn.expedition WHERE packagingFk=94 GROUP BY ticketFk) sub1 ON ti.Id_Ticket=sub1.ticketFk
- LEFT JOIN (SELECT ticketFk,count(*) AS nbultos FROM vn.expedition WHERE packagingFk IS NULL GROUP BY ticketFk) sub2 ON ti.Id_Ticket=sub2.ticketFk
- LEFT JOIN (SELECT ticketFk,count(*) AS notros FROM vn.expedition WHERE packagingFk >0 GROUP BY ticketFk) sub3 ON ti.Id_Ticket=sub3.ticketFk
- INNER JOIN vn.ticketState ts ON ti.Id_ticket = ts.ticketFk
- WHERE ti.Fecha=util.VN_CURDATE() AND
- ts.userFk=intId_Trabajador
- GROUP BY ti.Id_Ticket;
-
-END$$
-DELIMITER ;
diff --git a/db/routines/vn2008/procedures/add_awb_component.sql b/db/routines/vn2008/procedures/add_awb_component.sql
deleted file mode 100644
index e75290b4b..000000000
--- a/db/routines/vn2008/procedures/add_awb_component.sql
+++ /dev/null
@@ -1,61 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`add_awb_component`(IN vAwbFk SMALLINT)
-BEGIN
-
- DECLARE vShipped DATE;
- DECLARE vHasStems BOOLEAN;
-
- SELECT t.shipped, IF(a.stems, TRUE, FALSE)
- INTO vShipped, vHasStems
- FROM vn.travel t
- JOIN vn.awb a ON a.id = t.awbFk
- WHERE awbFk = vAwbFk
- LIMIT 1;
-
- INSERT IGNORE INTO awb_component (awb_id,Id_Proveedor,awb_component_type_id,awb_role_id,awb_unit_id,value,Id_Moneda)
- SELECT id, Id_Proveedor, awb_component_type_id, awb_role_id,awb_unit_id, LEAST(GREATEST(value1, IFNULL(min_value, value1)), IFNULL(max_value, value1)), Id_Moneda
- FROM (
- SELECT a.id,
- IFNULL(act.carguera_id,
- CASE awb_role_id
- WHEN 1 THEN a.carguera_id
- WHEN 2 THEN a.transitario_id
- WHEN 3 THEN f.airline_id
- END
- ) Id_Proveedor,
- act.awb_component_type_id,
- act.awb_role_id,
- act.awb_unit_id,
- value *
- CASE awb_unit_id
- WHEN '1000Tj-20' THEN ((CAST(stems AS SIGNED) - 20000)/1000) + (min_value / value)
- WHEN '1000Tj-10' THEN ((CAST(stems AS SIGNED) - 10000)/1000) + (min_value / value)
- WHEN '100GW' THEN peso/100
- WHEN 'AWB' THEN 1 -- No action
- WHEN 'FB' THEN hb/2
- WHEN 'GW' THEN peso
- WHEN 'TW' THEN GREATEST(peso,volume_weight)
- WHEN 'PN' THEN LEAST(90, value + a.propertyNumber * 10)
- END value1,
- value,
- act.Id_Moneda,
- act.min_value,
- act.max_value
- FROM awb a
- JOIN flight f ON f.flight_id = a.flight_id
- LEFT JOIN awb_component_template act ON
- ((IFNULL(act.carguera_id, a.carguera_id) = a.carguera_id AND awb_role_id = 1)
- OR (IFNULL(act.carguera_id, a.transitario_id) = a.transitario_id AND awb_role_id = 2)
- OR (IFNULL(act.airline_id, f.airline_id) = f.airline_id AND awb_role_id = 3)
- OR (awb_role_id = 4))
- AND IFNULL(act.airport_out, f.airport_out) = f.airport_out
- AND IFNULL(act.airport_in, f.airport_in) = f.airport_in
- AND IFNULL(act.airline_id, f.airline_id) = f.airline_id
- AND INSTR(IFNULL(act.days, WEEKDAY(vShipped) + 1),WEEKDAY(vShipped) + 1)
- JOIN awb_component_type acty ON acty.awb_component_type_id = act.awb_component_type_id
- WHERE a.id = vAwbFk AND Fecha <= vShipped
- AND (vHasStems = TRUE OR acty.hasStems)
- ORDER BY Fecha DESC, act.days DESC LIMIT 10000000000000000000
- ) t;
-END$$
-DELIMITER ;
diff --git a/db/routines/vn2008/procedures/agencyModeImbalance.sql b/db/routines/vn2008/procedures/agencyModeImbalance.sql
deleted file mode 100644
index 89706f0d2..000000000
--- a/db/routines/vn2008/procedures/agencyModeImbalance.sql
+++ /dev/null
@@ -1,50 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`agencyModeImbalance`(vStarted DATE, vEnded DATE)
-BEGIN
-/**
- * Devuelve el valor de los precios teorico, practico de las agencias
- * y si ademas es de mrw lo compara con su fichero previamente procesado
- *
- * @param vEktFk Identificador de edi.ekt
- */
- DECLARE vEndedDayEnd DATETIME;
-
- SET vEndedDayEnd = util.dayEnd(vEnded);
-
- SELECT t.id ticketFk,t.addressFk,
- CAST(v.amount AS DECIMAL (10,2)) AS VN,
- CAST(v.amount - e.shipping_charge AS DECIMAL (10,2)) AS Difer,
- CAST(mrwPrice AS DECIMAL (10,2)) mrwPrice,
- CAST(e.shipping_charge - mrwPrice AS DECIMAL (10,2)) mrwDifference,
- CAST(e.shipping_charge AS DECIMAL (10,2)) AS teorico,
- CAST(e.extraCharge AS DECIMAL (10,2)) AS extraCharge,
- t.packages, t.clientFk,
- t.zoneFk, a.provinceFk, mrwCount
- FROM vn.ticket t
- LEFT JOIN
- (SELECT ticketFk, SUM(amount) amount, fc.shipped
- FROM vn.sale_freightComponent fc
- JOIN vn.ticket t ON t.id = fc.ticketFk
- JOIN tmp.agencyMode am ON am.agencyModeFk = t.agencyModeFk
- WHERE fc.shipped BETWEEN vStarted AND vEndedDayEnd
- GROUP BY ticketFk) v ON t.id = v.ticketFk
- LEFT JOIN (SELECT t.id,
- SUM(t.zonePrice) shipping_charge,
- SUM(IFNULL(aex.price,0)) extraCharge
- FROM vn.ticket t
- LEFT JOIN vn.expedition e ON e.ticketFk = t.id
- LEFT JOIN vn.packaging p ON p.id = e.packagingFk
- JOIN tmp.agencyMode amc ON amc.agencyModeFk = t.agencyModeFk
- JOIN vn.agencyMode am ON am.id = amc.agencyModeFk
- LEFT JOIN vn.agencyExtraCharge aex ON p.width+p.depth+p.height BETWEEN aex.sizeMin AND aex.sizeMax AND aex.agencyFk = am.agencyFk
- WHERE t.shipped BETWEEN vStarted AND vEndedDayEnd
- GROUP BY t.id
- ) e ON t.id = e.id
- LEFT JOIN (SELECT ticketFk, SUM(price) mrwPrice, COUNT(*) mrwCount
- FROM vn.mrw
- GROUP BY ticketFk) mrw ON mrw.ticketFk = t.id
- JOIN vn.address a ON a.id = t.addressFk
- JOIN tmp.agencyMode am ON am.agencyModeFk = t.agencyModeFk
- WHERE t.shipped BETWEEN vStarted AND vEndedDayEnd;
-END$$
-DELIMITER ;
diff --git a/db/routines/vn2008/procedures/cacheReset.sql b/db/routines/vn2008/procedures/cacheReset.sql
deleted file mode 100644
index f36169fda..000000000
--- a/db/routines/vn2008/procedures/cacheReset.sql
+++ /dev/null
@@ -1,11 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`cacheReset`(vCacheName VARCHAR(10), vParams VARCHAR(15))
-BEGIN
-
- UPDATE cache.cache_calc
- SET expires = util.VN_NOW()
- WHERE cacheName = vCacheName collate utf8_unicode_ci
- AND params = vParams collate utf8_unicode_ci;
-
-END$$
-DELIMITER ;
diff --git a/db/routines/vn2008/procedures/camiones.sql b/db/routines/vn2008/procedures/camiones.sql
deleted file mode 100644
index 4c37cf9da..000000000
--- a/db/routines/vn2008/procedures/camiones.sql
+++ /dev/null
@@ -1,23 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`camiones`(vWarehouse INT, vDate DATE)
-BEGIN
- SELECT Temperatura
- ,ROUND(SUM(Etiquetas * volume)) AS cm3
- ,ROUND(SUM(IF(scanned, Etiquetas, 0) * volume)) AS cm3s
- ,ROUND(SUM(Vida * volume)) AS cm3e
- FROM (
- SELECT t.Temperatura, c.Etiquetas, b.scanned, c.Vida,
- IF(cu.Volumen > 0, cu.Volumen, cu.x * cu.y * IF(cu.z > 0, cu.z, a.Medida + 10)) volume
- FROM Compres c
- LEFT JOIN buy_edi b ON b.id = c.buy_edi_id
- JOIN Articles a ON a.Id_Article = c.Id_Article
- JOIN Tipos t ON t.tipo_id = a.tipo_id
- JOIN Entradas e ON e.Id_Entrada = c.Id_Entrada
- JOIN travel tr ON tr.id = e.travel_id
- JOIN Cubos cu ON cu.Id_Cubo = c.Id_Cubo
- WHERE tr.warehouse_id = vWarehouse
- AND tr.landing = vDate
- ) sub
- GROUP BY Temperatura;
-END$$
-DELIMITER ;
diff --git a/db/routines/vn2008/procedures/clean.sql b/db/routines/vn2008/procedures/clean.sql
deleted file mode 100644
index 0ff185c46..000000000
--- a/db/routines/vn2008/procedures/clean.sql
+++ /dev/null
@@ -1,85 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`clean`(IN `v_full` TINYINT(1))
-proc: BEGIN
- DECLARE vDate DATETIME;
- DECLARE vDate18 DATETIME;
- DECLARE vDate26 DATETIME;
- DECLARE vDate8 DATE;
- DECLARE vDate6 DATE;
- DECLARE vDate3 DATE;
- DECLARE vDate2000 DATE;
- DECLARE vRangeDeleteTicket INT;
- DECLARE vStrtable VARCHAR(15) DEFAULT NULL;
-
- SET vDate = util.VN_CURDATE() - INTERVAL 2 MONTH;
- SET vDate18 = util.VN_CURDATE() - INTERVAL 18 MONTH;
- SET vDate26 = util.VN_CURDATE() - INTERVAL 26 MONTH;
- SET vDate3 = util.VN_CURDATE() - INTERVAL 3 MONTH;
- SET vDate8 = util.VN_CURDATE() - INTERVAL 8 DAY;
- SET vDate6 = util.VN_CURDATE() - INTERVAL 6 DAY;
- SET vDate2000 = util.VN_CURDATE() + INTERVAL (2000 - YEAR(util.VN_CURDATE())) YEAR;
- SET vRangeDeleteTicket = 60;
-
- DELETE FROM cdr WHERE calldate < vDate18;
- DELETE FROM mail WHERE DATE_ODBC < vDate;
- DELETE FROM Movimientos_mark WHERE odbc_date < vDate;
- DELETE FROM Splits WHERE Fecha < vDate18;
-
- DELETE tobs
- FROM ticket_observation tobs
- JOIN Tickets t ON tobs.Id_Ticket = t.Id_Ticket
- WHERE t.Fecha < vDate;
-
- DELETE tobs
- FROM movement_label tobs
- JOIN Movimientos m ON tobs.Id_Movimiento = m.Id_Movimiento
- JOIN Tickets t ON m.Id_Ticket = t.Id_Ticket WHERE t.Fecha < vDate;
-
- DELETE FROM Remesas WHERE `Fecha Remesa` < vDate18;
-
- DELETE tt.*
- FROM Tickets_turno tt
- LEFT JOIN Movimientos m USING(Id_Ticket)
- WHERE m.Id_Article IS NULL;
-
- DELETE FROM cl_main WHERE Fecha < vDate18;
- DELETE FROM hedera.`order` WHERE date_send < vDate18;
- DELETE FROM vn.message WHERE sendDate < vDate;
- DELETE FROM travel_reserve WHERE odbc_date < vDate;
-
- DELETE FROM cache.departure_limit WHERE Fecha < util.VN_CURDATE() - INTERVAL 1 MONTH;
-
- DELETE cm
- FROM Compres_mark cm
- JOIN Compres c ON c.Id_Compra = cm.Id_Compra
- JOIN Entradas e ON e.Id_Entrada = c.Id_Entrada
- JOIN travel t ON t.id = e.travel_id
- WHERE t.landing <= vDate;
-
- IF v_full THEN
- CREATE OR REPLACE TEMPORARY TABLE tTicketDelete
- SELECT DISTINCT tl.originFk ticketFk
- FROM vn.ticketLog tl
- JOIN (SELECT MAX(tl.id)ids
- FROM vn.ticket t
- JOIN vn.ticketLog tl ON tl.originFk = t.id
- WHERE t.shipped BETWEEN '2000-01-01' AND '2000-12-31'
- AND t.isDeleted
- GROUP BY t.id
- )sub ON sub.ids = tl.id
- WHERE tl.creationDate <= util.VN_CURDATE() - INTERVAL 60 DAY;
-
- DELETE t
- FROM vn.ticket t
- JOIN tTicketDelete tmp ON tmp.ticketFk = t.id;
-
- DROP TEMPORARY TABLE tTicketDelete;
- END IF;
-
- -- Tickets Nulos PAK 11/10/2016
- UPDATE Tickets
- SET empresa_id = 965
- WHERE Id_Cliente = 31
- AND empresa_id != 965;
-END$$
-DELIMITER ;
diff --git a/db/routines/vn2008/procedures/clean_launcher.sql b/db/routines/vn2008/procedures/clean_launcher.sql
deleted file mode 100644
index 63c23e8cf..000000000
--- a/db/routines/vn2008/procedures/clean_launcher.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`clean_launcher`()
-BEGIN
- CALL clean(TRUE);
-END$$
-DELIMITER ;
diff --git a/db/routines/vn2008/procedures/cobro.sql b/db/routines/vn2008/procedures/cobro.sql
deleted file mode 100644
index 26d906813..000000000
--- a/db/routines/vn2008/procedures/cobro.sql
+++ /dev/null
@@ -1,79 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`cobro`(IN datFEC DATE
- , IN idCLI INT
- , IN dblIMPORTE DOUBLE
- , IN idCAJA INT
- , IN idPAYMET INT
- , IN strCONCEPTO VARCHAR(40)
- , IN idEMP INT
- , IN idWH INT
- , IN idTRABAJADOR INT)
-BEGIN
-
- DECLARE bolCASH BOOLEAN;
- DECLARE cuenta_banco BIGINT;
- DECLARE cuenta_cliente BIGINT;
- DECLARE max_asien INT;
- -- XDIARIO
- -- No se asientan los cobros directamente, salvo en el caso de las cajas de CASH
- SELECT (at2.code = 'cash') INTO bolCASH FROM Bancos b JOIN vn.accountingType at2 ON at2.id = b.cash WHERE b.Id_Banco = idCAJA;
- IF bolCASH THEN
- SELECT Cuenta INTO cuenta_banco
- FROM Bancos
- WHERE Id_Banco = idCAJA;
- SELECT Cuenta INTO cuenta_cliente
- FROM Clientes
- WHERE Id_Cliente = idCLI;
- CALL vn.ledger_next(max_asien);
- INSERT INTO vn.XDiario (ASIEN,FECHA,SUBCTA,CONTRA,CONCEPTO,EURODEBE,EUROHABER,empresa_id)
- SELECT max_asien,datFEC,SUBCTA,CONTRA,strCONCEPTO,EURODEBE,EUROHABER,idEMP
- FROM(SELECT cuenta_banco SUBCTA, cuenta_cliente CONTRA, 0 EURODEBE, dblIMPORTE EUROHABER
- UNION ALL
- SELECT cuenta_cliente SUBCTA, cuenta_banco CONTRA, dblIMPORTE EURODEBE, 0 EUROHABER
- ) gf;
- END IF;
-
- -- CAJERA
- INSERT INTO Cajas(Id_Trabajador,
- Id_Banco,
- Entrada,
- Concepto,
- Cajafecha,
- Serie,
- Partida,
- Numero,
- empresa_id,
- warehouse_id
- )
- VALUES (idTRABAJADOR,
- idCAJA,
- dblIMPORTE,
- strCONCEPTO,
- datFEC,
- 'A',
- TRUE,
- idCLI,
- idEMP,
- idWH
- );
-
- -- RECIBO
- INSERT INTO Recibos(Entregado,
- Fechacobro,
- Id_Trabajador,
- Id_Banco,
- Id_Cliente,
- Id_Factura,
- empresa_id
- )
- VALUES ( dblIMPORTE,
- datFEC,
- idTRABAJADOR,
- idCAJA,
- idCLI,
- strCONCEPTO,
- idEMP
- );
-
-END$$
-DELIMITER ;
diff --git a/db/routines/vn2008/procedures/confection_control_source.sql b/db/routines/vn2008/procedures/confection_control_source.sql
deleted file mode 100644
index 77b4df5f3..000000000
--- a/db/routines/vn2008/procedures/confection_control_source.sql
+++ /dev/null
@@ -1,105 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`confection_control_source`(vDated DATE, vScopeDays TINYINT)
-BEGIN
-
- DECLARE vMidnight DATETIME DEFAULT TIMESTAMP(vDated,'23:59:59');
- DECLARE vEndingDate DATETIME DEFAULT TIMESTAMPADD(DAY,vScopeDays,vMidnight);
- DECLARE maxAlertLevel INT DEFAULT 2;
-
- DROP TEMPORARY TABLE IF EXISTS tmp.production_buffer;
-
- CREATE TEMPORARY TABLE tmp.production_buffer
- ENGINE = MEMORY
- SELECT
- date(t.Fecha) as Fecha,
- hour(t.Fecha) as Hora,
- hour(t.Fecha) as Departure,
- t.Id_Ticket,
- m.Id_Movimiento,
- m.Cantidad,
- m.Concepte,
- ABS(m.Reservado) Reservado,
- i.Categoria,
- tp.Tipo,
- t.Alias as Cliente,
- wh.name as Almacen,
- t.warehouse_id,
- cs.province_id,
- a.agency_id,
- ct.description as Taller,
- stock.visible,
- stock.available
- FROM vn2008.Tickets t
- JOIN vn2008.Agencias a ON a.Id_Agencia = t.Id_Agencia
- JOIN vn.warehouse wh ON wh.id = t.warehouse_id
- JOIN vn2008.Movimientos m ON m.Id_Ticket = t.Id_Ticket
- JOIN vn2008.Articles i ON i.Id_Article = m.Id_Article
- JOIN vn2008.Tipos tp ON tp.tipo_id = i.tipo_id
- JOIN vn.confectionType ct ON ct.id = tp.confeccion
- JOIN vn2008.Consignatarios cs on cs.Id_Consigna = t.Id_Consigna
- LEFT JOIN vn.ticketState tls on tls.ticketFk = t.Id_Ticket
- LEFT JOIN
- (
- SELECT item_id, sum(visible) visible, sum(available) available
- FROM
- (
- SELECT a.item_id, 0 as visible, a.available
- FROM cache.cache_calc cc
- LEFT JOIN cache.available a ON a.calc_id = cc.id
- WHERE cc.cache_id IN (2,8)
- AND cc.params IN (concat("1/", util.VN_CURDATE()),concat("44/", util.VN_CURDATE()))
-
- UNION ALL
-
- SELECT v.item_id, v.visible, 0 as available
- FROM cache.cache_calc cc
- LEFT JOIN cache.visible v ON v.calc_id = cc.id
- where cc.cache_id IN (2,8) and cc.params IN ("1","44")
- ) sub
- GROUP BY item_id
- ) stock ON stock.item_id = m.Id_Article
- WHERE tp.confeccion
- AND tls.alertLevel < maxAlertLevel
- AND wh.hasConfectionTeam
- AND t.Fecha BETWEEN vDated AND vEndingDate
- AND m.Cantidad > 0;
-
- -- Entradas
-
- INSERT INTO tmp.production_buffer(
- Fecha,
- Id_Ticket,
- Cantidad,
- Concepte,
- Categoria,
- Cliente,
- Almacen,
- Taller
- )
- SELECT
- tr.shipment AS Fecha,
- e.Id_Entrada AS Id_Ticket,
- c.Cantidad,
- a.Article,
- a.Categoria,
- whi.name as Cliente,
- who.name as Almacen,
- ct.description as Taller
- FROM vn2008.Compres c
- JOIN vn2008.Entradas e ON e.Id_Entrada = c.Id_Entrada
- JOIN vn2008.travel tr ON tr.id = e.travel_id
- JOIN vn.warehouse whi ON whi.id = tr.warehouse_id
- JOIN vn.warehouse who ON who.id = tr.warehouse_id_out
- JOIN vn2008.Articles a ON a.Id_Article = c.Id_Article
- JOIN vn2008.Tipos tp ON tp.tipo_id = a.tipo_id
- JOIN vn.confectionType ct ON ct.id = tp.confeccion
- WHERE who.hasConfectionTeam
- AND tp.confeccion
- AND tr.shipment BETWEEN vDated AND vEndingDate;
-
-
- SELECT * FROM tmp.production_buffer;
-
-
-END$$
-DELIMITER ;
diff --git a/db/routines/vn2008/procedures/customerDebtEvolution.sql b/db/routines/vn2008/procedures/customerDebtEvolution.sql
deleted file mode 100644
index b9763b985..000000000
--- a/db/routines/vn2008/procedures/customerDebtEvolution.sql
+++ /dev/null
@@ -1,49 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`customerDebtEvolution`(IN vCustomer INT)
-BEGIN
-
-SELECT * FROM
-(
- SELECT day, date, @s:= round(IFNULL(Euros,0) + @s,2) as Saldo, Euros, Credito, 0 as Cero
- FROM
- (
- SELECT day, date, IFNULL(Euros,0) as Euros, Credito
- FROM time
- JOIN (SELECT @s:= 0, - Credito as Credito FROM Clientes WHERE Id_Cliente = vCustomer) c
- LEFT JOIN
- (SELECT Euros, date(Fecha) as Fecha FROM
- (
- SELECT Fechacobro as Fecha, Entregado as Euros
- FROM Recibos
- WHERE Id_Cliente = vCustomer
- AND Fechacobro >= '2017-01-01'
- UNION ALL
- SELECT vn.getDueDate(io.issued,c.Vencimiento), - io.amount
- FROM vn.invoiceOut io
- JOIN Clientes c ON io.clientFk = c.Id_Cliente
- WHERE io.clientFk = vCustomer
- AND io.issued >= '2017-01-01'
- UNION ALL
- SELECT '2016-12-31', Debt
- FROM bi.customerDebtInventory
- WHERE Id_Cliente = vCustomer
- UNION ALL
- SELECT Fecha, - SUM(Cantidad * Preu * (100 - Descuento ) * 1.10 / 100)
- FROM Tickets t
- JOIN Movimientos m on m.Id_Ticket = t.Id_Ticket
- WHERE Id_Cliente = vCustomer
- AND Factura IS NULL
- AND Fecha >= '2017-01-01'
- GROUP BY Fecha
- ) sub2
- ORDER BY Fecha
- )sub ON time.date = sub.Fecha
- WHERE time.date BETWEEN '2016-12-31' AND util.VN_CURDATE()
- ORDER BY date
- ) sub3
-)sub4
-;
-
-
-END$$
-DELIMITER ;
diff --git a/db/routines/vn2008/procedures/emailYesterdayPurchasesByConsigna.sql b/db/routines/vn2008/procedures/emailYesterdayPurchasesByConsigna.sql
deleted file mode 100644
index 439eba5ad..000000000
--- a/db/routines/vn2008/procedures/emailYesterdayPurchasesByConsigna.sql
+++ /dev/null
@@ -1,100 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`emailYesterdayPurchasesByConsigna`(IN v_Date DATE, IN v_Client_Id INT)
-BEGIN
-
- DECLARE MyIdTicket BIGINT;
- DECLARE MyAlias VARCHAR(50);
- DECLARE MyDomicilio VARCHAR(255);
- DECLARE MyPoblacion VARCHAR(25);
- DECLARE MyImporte DOUBLE;
- DECLARE MyMailTo VARCHAR(250);
- DECLARE MyMailReplyTo VARCHAR(250);
- DECLARE done INT DEFAULT FALSE;
- DECLARE emptyList INT DEFAULT 0;
- DECLARE txt TEXT;
-
- DECLARE rs CURSOR FOR
- SELECT t.Id_Ticket, Alias, cast(amount as decimal(10,2)) Importe, Domicilio, POBLACION
- FROM Tickets t
- JOIN Consignatarios cs ON t.Id_Consigna = cs.Id_Consigna
- JOIN (
- SELECT `Movimientos`.`Id_Ticket` AS `Id_Ticket`,
- sum(
- `Movimientos`.`Cantidad` * `Movimientos`.`Preu` * (100 - `Movimientos`.`Descuento`) / 100
- ) AS `amount`
- FROM (
- `vn2008`.`Movimientos`
- JOIN `vn2008`.`Tickets` ON(
- `Movimientos`.`Id_Ticket` = `Tickets`.`Id_Ticket`
- )
- )
- WHERE `Tickets`.`Fecha` >= `util`.`VN_CURDATE`() + INTERVAL -6 MONTH
- GROUP BY `Movimientos`.`Id_Ticket`
- ) v ON v.Id_Ticket = t.Id_Ticket
- WHERE t.Fecha BETWEEN v_Date AND util.dayEnd(v_Date)
- AND t.Id_Cliente = v_Client_Id;
-
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
-
- SET v_Date = IFNULL(v_Date, util.yesterday());
-
- OPEN rs;
-
- FETCH rs INTO MyIdTicket, MyAlias, MyImporte, MyDomicilio, MyPoblacion;
-
- SET emptyList = done;
-
- SET txt = CONCAT('
',
- '
Relación de envíos.
',
- '
Dia: ', v_Date, '
');
-
- WHILE NOT done DO
-
- SET txt = CONCAT(txt, '
Puede acceder al detalle de los albaranes haciendo click sobre el número de Ticket',
- '
Muchas gracias por su confianza
',
- '
');
-
- -- Envío del email
- IF emptyList = 0 THEN
-
- SELECT CONCAT(`e-mail`,',pako@verdnatura.es') INTO MyMailTo
- FROM Clientes
- WHERE Id_Cliente = v_Client_Id AND `e-mail`>'';
-
- IF v_Client_Id = 7818 THEN -- LOEWE
- SET MyMailTo = 'isabel@elisabethblumen.com,emunozca@loewe.es,pako@verdnatura.es';
- END IF;
-
- CALL vn.mail_insert(
- IFNULL(MyMailTo,'pako.natek@gmail.com'),
- 'pako@verdnatura.es',
- 'Resumen de pedidos preparados',
- txt
- );
-
- END IF;
-
-END$$
-DELIMITER ;
diff --git a/db/routines/vn2008/procedures/emailYesterdayPurchasesLauncher.sql b/db/routines/vn2008/procedures/emailYesterdayPurchasesLauncher.sql
deleted file mode 100644
index c414cf1c4..000000000
--- a/db/routines/vn2008/procedures/emailYesterdayPurchasesLauncher.sql
+++ /dev/null
@@ -1,27 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`emailYesterdayPurchasesLauncher`()
-BEGIN
-
-DECLARE done INT DEFAULT 0;
-DECLARE vMyClientId INT;
-
-DECLARE rs CURSOR FOR
-SELECT Id_Cliente
-FROM Clientes
-WHERE EYPBC != 0;
-
-DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
-
-OPEN rs;
-
-FETCH rs INTO vMyClientId;
-
-WHILE NOT done DO
-
- CALL emailYesterdayPurchasesByConsigna(util.yesterday(), vMyClientId);
-
- FETCH rs INTO vMyClientId;
-
-END WHILE;
-END$$
-DELIMITER ;
diff --git a/db/routines/vn2008/procedures/embalajes_stocks.sql b/db/routines/vn2008/procedures/embalajes_stocks.sql
deleted file mode 100644
index b20e44c79..000000000
--- a/db/routines/vn2008/procedures/embalajes_stocks.sql
+++ /dev/null
@@ -1,51 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`embalajes_stocks`(IN idPEOPLE INT, IN bolCLIENT BOOLEAN)
-BEGIN
-
-if bolCLIENT then
-
- select m.Id_Article, Article, - cast(sum(m.Cantidad) as decimal) as Saldo
- from Movimientos m
- join Articles a on m.Id_Article = a.Id_Article
- join Tipos tp on tp.tipo_id = a.tipo_id
- join Tickets t using(Id_Ticket)
- join Consignatarios cs using(Id_Consigna)
- where cs.Id_Cliente = idPEOPLE
- and Tipo = 'Contenedores'
- and t.Fecha > '2010-01-01'
- group by m.Id_Article;
-
-else
-
-select Id_Article, Article, sum(Cantidad) as Saldo
-from
-(select Id_Article, Cantidad
-from Compres c
-join Articles a using(Id_Article)
-join Tipos tp using(tipo_id)
-join Entradas e using(Id_Entrada)
-join travel tr on tr.id = travel_id
-where Id_Proveedor = idPEOPLE
-and landing >= '2010-01-01'
-and reino_id = 6
-
-union all
-
-select Id_Article, - Cantidad
-from Movimientos m
-join Articles a using(Id_Article)
-join Tipos tp using(tipo_id)
-join Tickets t using(Id_Ticket)
-join Consignatarios cs using(Id_Consigna)
-join proveedores_clientes pc on pc.Id_Cliente = cs.Id_Cliente
-where Id_Proveedor = idPEOPLE
-and reino_id = 6
-and t.Fecha > '2010-01-01') mov
-
-join Articles a using(Id_Article)
-group by Id_Article;
-
-end if;
-
-END$$
-DELIMITER ;
diff --git a/db/routines/vn2008/procedures/embalajes_stocks_detalle.sql b/db/routines/vn2008/procedures/embalajes_stocks_detalle.sql
deleted file mode 100644
index c49d1b88a..000000000
--- a/db/routines/vn2008/procedures/embalajes_stocks_detalle.sql
+++ /dev/null
@@ -1,78 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`embalajes_stocks_detalle`(IN idPEOPLE INT, IN idARTICLE INT, IN bolCLIENT BOOLEAN)
-BEGIN
-
-
-if bolCLIENT then
-
- select m.Id_Article
- , Article
- , IF(Cantidad < 0, - Cantidad, NULL) as Entrada
- , IF(Cantidad < 0, NULL, Cantidad) as Salida
- , 'T' as Tabla
- , t.Id_Ticket as Registro
- , t.Fecha
- , w.name as Almacen
- , cast(Preu as Decimal(5,2)) Precio
- , c.Cliente as Proveedor
- , abbreviation as Empresa
- from Movimientos m
- join Articles a using(Id_Article)
- join Tickets t using(Id_Ticket)
- join empresa e on e.id = t.empresa_id
- join warehouse w on w.id = t.warehouse_id
- join Consignatarios cs using(Id_Consigna)
- join Clientes c on c.Id_Cliente = cs.Id_Cliente
- where cs.Id_Cliente = idPEOPLE
- and m.Id_Article = idARTICLE
- and t.Fecha > '2010-01-01';
-
-else
-
-select Id_Article, Tabla, Registro, Fecha, Article
-, w.name as Almacen, Entrada, Salida, Proveedor, cast(Precio as Decimal(5,2)) Precio
-
-from
-
-(select Id_Article
- , IF(Cantidad > 0, Cantidad, NULL) as Entrada
- , IF(Cantidad > 0, NULL,- Cantidad) as Salida
- , 'E' as Tabla
- , Id_Entrada as Registro
- , landing as Fecha
- , tr.warehouse_id
- , Costefijo as Precio
-from Compres c
-join Entradas e using(Id_Entrada)
-join travel tr on tr.id = travel_id
-where Id_Proveedor = idPEOPLE
-and Id_Article = idARTICLE
-and landing >= '2010-01-01'
-
-union all
-
-select Id_Article
- , IF(Cantidad < 0, - Cantidad, NULL) as Entrada
- , IF(Cantidad < 0, NULL, Cantidad) as Salida
- , 'T'
- , Id_Ticket
- , Fecha
- , t.warehouse_id
- , Preu
-from Movimientos m
-join Tickets t using(Id_Ticket)
-join Consignatarios cs using(Id_Consigna)
-join proveedores_clientes pc on pc.Id_Cliente = cs.Id_Cliente
-where Id_Proveedor = idPEOPLE
-and Id_Article = idARTICLE
-and t.Fecha > '2010-01-01') mov
-
-join Articles a using(Id_Article)
-join Proveedores p on Id_Proveedor = idPEOPLE
-join warehouse w on w.id = mov.warehouse_id
-;
-
-end if;
-
-END$$
-DELIMITER ;
diff --git a/db/routines/vn2008/procedures/historico_absoluto.sql b/db/routines/vn2008/procedures/historico_absoluto.sql
deleted file mode 100644
index 1a7e1dbfa..000000000
--- a/db/routines/vn2008/procedures/historico_absoluto.sql
+++ /dev/null
@@ -1,91 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`historico_absoluto`(IN idART INT, IN wh INT, IN datfecha DATETIME)
-BEGIN
-
- DECLARE inv_calculado INT;
- DECLARE inv INT;
- DECLARE today DATETIME;
- DECLARE fecha_inv DATETIME;
-
- SET today = util.VN_CURDATE();
-
- CREATE OR REPLACE TEMPORARY TABLE historico_pasado
- SELECT *
- FROM (
- SELECT TR.landing Fecha,
- C.Cantidad Entrada,
- NULL Salida,
- (TR.received != FALSE) OK,
- P.Proveedor Alias,
- E.Referencia Referencia,
- E.Id_Entrada id,
- TR.delivered F5
- FROM Compres C -- mirar perque no entra en received
- INNER JOIN Entradas E USING (Id_Entrada)
- INNER JOIN travel TR ON TR.id = E.travel_id
- INNER JOIN Proveedores P USING (Id_Proveedor)
- WHERE TR.landing >= '2001-01-01'
- AND Id_proveedor <> 4
- AND wh IN (TR.warehouse_id , 0)
- AND C.Id_Article = idART
- AND E.Inventario = 0
- AND E.Redada = 0
- UNION ALL
- SELECT TR.shipment Fecha,
- NULL Entrada,
- C.Cantidad Salida,
- TR.delivered OK,
- P.Proveedor Alias,
- E.Referencia Referencia,
- E.Id_Entrada id,
- TR.delivered F5
- FROM Compres C
- INNER JOIN Entradas E USING (Id_Entrada)
- INNER JOIN travel TR ON TR.id = E.travel_id
- INNER JOIN Proveedores P USING (Id_Proveedor)
- WHERE TR.shipment >= '2001-01-01'
- AND wh = TR.warehouse_id_out
- AND Id_Proveedor <> 4
- AND C.Id_Article = idART
- AND E.Inventario = 0
- AND E.Redada = 0
- UNION ALL
- SELECT T.Fecha Fecha,
- NULL Entrada,
- M.Cantidad Salida,
- (M.OK <> 0 OR T.Etiquetasemitidas <> 0 OR T.Factura IS NOT NULL) OK,
- T.Alias Alias,
- T.Factura Referencia,
- T.Id_Ticket,
- T.PedidoImpreso
- FROM Movimientos M
- INNER JOIN Tickets T USING (Id_Ticket)
- JOIN Clientes C ON C.Id_Cliente = T.Id_Cliente
- WHERE T.Fecha >= '2001-01-01'
- AND M.Id_Article = idART
- AND wh IN (T.warehouse_id , 0)
- ) t1
- ORDER BY Fecha, Entrada DESC, OK DESC;
-
- SELECT sum(Entrada) - sum(Salida) INTO inv_calculado
- FROM historico_pasado
- WHERE Fecha < datfecha;
-
- SELECT p1.*, NULL v_virtual
- FROM(
- SELECT datfecha Fecha,
- inv_calculado Entrada,
- NULL Salida,
- 1 OK,
- 'Inventario calculado' Alias,
- '' Referencia, 0 id,
- 1 F5
- UNION ALL
- SELECT *
- FROM historico_pasado
- WHERE Fecha >= datfecha
- ) p1;
-
- DROP TEMPORARY TABLE historico_pasado;
-END$$
-DELIMITER ;
diff --git a/db/routines/vn2008/procedures/historico_multiple.sql b/db/routines/vn2008/procedures/historico_multiple.sql
deleted file mode 100644
index ae4045a34..000000000
--- a/db/routines/vn2008/procedures/historico_multiple.sql
+++ /dev/null
@@ -1,206 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`historico_multiple`(IN vItemFk INT)
-BEGIN
-
- DECLARE vDateInventory DATETIME;
-
- SELECT Fechainventario INTO vDateInventory FROM tblContadores;
-
- SET @a = 0;
-
- DROP TEMPORARY TABLE IF EXISTS hm1;
-
- CREATE TEMPORARY TABLE hm1
- SELECT DATE(Fecha) as Fecha,
- Entrada,
- Salida,
- OK,
- Referencia,
- Historia.id,
-
- wh,
-
- `name` as wh_name
-
- FROM
-
- ( SELECT TR.landing as Fecha,
- C.Cantidad as Entrada,
- NULL as Salida,
-
- IF(warehouse_id = 44, 1, warehouse_id) as wh,
- (TR.received != FALSE) as OK,
- E.Referencia as Referencia,
- E.Id_Entrada as id
-
-
-
- FROM Compres C
- INNER JOIN Entradas E USING (Id_Entrada)
- INNER JOIN travel TR ON TR.id = E.travel_id
- WHERE TR.landing >= vDateInventory
- AND C.Id_Article = vItemFk
- AND E.Redada = 0
-
- AND C.Cantidad <> 0
-
- UNION ALL
-
- SELECT TR.shipment as Fecha,
- NULL as Entrada,
- C.Cantidad as Salida,
- warehouse_id_out as wh,
- TR.delivered as OK,
- E.Referencia as Referencia,
- E.Id_Entrada as id
-
- FROM Compres C
- INNER JOIN Entradas E USING (Id_Entrada)
- INNER JOIN travel TR ON TR.id = E.travel_id
- WHERE TR.shipment >= vDateInventory
- AND C.Id_Article = vItemFk
-
- AND E.Redada = 0
-
- AND C.Cantidad <> 0
-
- UNION ALL
-
- SELECT T.Fecha as Fecha,
- NULL as Entrada,
- M.Cantidad as Salida,
- warehouse_id as wh,
- (M.OK <> 0 OR T.Etiquetasemitidas <> 0 OR T.Factura IS NOT NULL) as OK,
- T.Factura as Referencia,
- T.Id_Ticket as id
-
- FROM Movimientos M
- INNER JOIN Tickets T USING (Id_Ticket)
- WHERE T.Fecha >= vDateInventory
- AND M.Id_Article = vItemFk
-
- ) AS Historia
-
- INNER JOIN warehouse ON warehouse.id = Historia.wh
- ORDER BY Fecha, Entrada DESC, OK DESC;
-
-
- DROP TEMPORARY TABLE IF EXISTS hm2;
- DROP TEMPORARY TABLE IF EXISTS hm3;
- DROP TEMPORARY TABLE IF EXISTS hm4;
- DROP TEMPORARY TABLE IF EXISTS hm5;
- DROP TEMPORARY TABLE IF EXISTS hm6;
- DROP TEMPORARY TABLE IF EXISTS hm7;
- DROP TEMPORARY TABLE IF EXISTS hm8;
- CREATE TEMPORARY TABLE hm2 SELECT * FROM hm1 WHERE wh = 19;
- CREATE TEMPORARY TABLE hm3 SELECT * FROM hm1 WHERE wh = 7;
- CREATE TEMPORARY TABLE hm4 SELECT * FROM hm1 WHERE wh = 60;
- CREATE TEMPORARY TABLE hm5 SELECT * FROM hm1 WHERE wh = 5;
- CREATE TEMPORARY TABLE hm6 SELECT * FROM hm1 WHERE wh = 17;
- CREATE TEMPORARY TABLE hm7 SELECT * FROM hm1 WHERE wh = 37;
- CREATE TEMPORARY TABLE hm8 SELECT * FROM hm1 WHERE wh = 55;
-
- SELECT * FROM
-
- (
-
- SELECT Fecha, Entrada as BOGEntrada, Salida as BOGSalida, OK as BOGOK, Referencia as BOGReferencia, id as BOGid,
-
- NULL AS VNHEntrada, NULL AS VNHSalida, NULL AS VNHOK, NULL AS VNHReferencia, NULL AS VNHid,
-
- NULL AS ALGEntrada, NULL AS ALGSalida, NULL AS ALGOK, NULL AS ALGReferencia, NULL AS ALGid,
-
- NULL AS MADEntrada, NULL AS MADSalida, NULL AS MADOK, NULL AS MADReferencia, NULL AS MADid,
-
- NULL AS MCFEntrada, NULL AS MCFSalida, NULL AS MCFOK, NULL AS MCFReferencia, NULL AS MCFid,
-
- NULL AS VILEntrada, NULL AS VILSalida, NULL AS VILOK, NULL AS VILReferencia, NULL AS VILid,
-
- NULL AS BAREntrada, NULL AS BARSalida, NULL AS BAROK, NULL AS BARReferencia, NULL AS BARid
-
- FROM hm2
-
-
- UNION ALL
-
- SELECT Fecha
- , NULL, NULL, NULL, NULL, NULL
- ,Entrada, Salida, OK, Referencia, id
- , NULL, NULL, NULL, NULL, NULL
- , NULL, NULL, NULL, NULL, NULL
- , NULL, NULL, NULL, NULL, NULL
- , NULL, NULL, NULL, NULL, NULL
- , NULL, NULL, NULL, NULL, NULL
- FROM hm3
-
-
-
- UNION ALL
-
- SELECT Fecha
- , NULL, NULL, NULL, NULL, NULL
- , NULL, NULL, NULL, NULL, NULL
- , Entrada, Salida, OK, Referencia, id
- , NULL, NULL, NULL, NULL, NULL
- , NULL, NULL, NULL, NULL, NULL
- , NULL, NULL, NULL, NULL, NULL
- , NULL, NULL, NULL, NULL, NULL
- FROM hm4
-
- UNION ALL
-
- SELECT Fecha
- , NULL, NULL, NULL, NULL, NULL
- , NULL, NULL, NULL, NULL, NULL
- , NULL, NULL, NULL, NULL, NULL
- , Entrada, Salida, OK, Referencia, id
- , NULL, NULL, NULL, NULL, NULL
- , NULL, NULL, NULL, NULL, NULL
- , NULL, NULL, NULL, NULL, NULL
- FROM hm5
-
- UNION ALL
-
- SELECT Fecha
- , NULL, NULL, NULL, NULL, NULL
- , NULL, NULL, NULL, NULL, NULL
- , NULL, NULL, NULL, NULL, NULL
- , NULL, NULL, NULL, NULL, NULL
- , Entrada, Salida, OK, Referencia, id
- , NULL, NULL, NULL, NULL, NULL
- , NULL, NULL, NULL, NULL, NULL
- FROM hm6
-
- UNION ALL
-
- SELECT Fecha
- , NULL, NULL, NULL, NULL, NULL
- , NULL, NULL, NULL, NULL, NULL
- , NULL, NULL, NULL, NULL, NULL
- , NULL, NULL, NULL, NULL, NULL
- , NULL, NULL, NULL, NULL, NULL
- , Entrada, Salida, OK, Referencia, id
- , NULL, NULL, NULL, NULL, NULL
-
-
- FROM hm7
-
- UNION ALL
-
- SELECT Fecha
- , NULL, NULL, NULL, NULL, NULL
- , NULL, NULL, NULL, NULL, NULL
- , NULL, NULL, NULL, NULL, NULL
- , NULL, NULL, NULL, NULL, NULL
- , NULL, NULL, NULL, NULL, NULL
- , NULL, NULL, NULL, NULL, NULL
- , Entrada, Salida, OK, Referencia, id
-
- FROM hm8
-
- ) sub
-
- ORDER BY Fecha, BOGEntrada IS NULL, VNHEntrada IS NULL, ALGEntrada IS NULL, MADEntrada IS NULL, MCFEntrada IS NULL, VILEntrada IS NULL, BAREntrada IS NULL;
-
-END$$
-DELIMITER ;
diff --git a/db/routines/vn2008/procedures/nest_child_add.sql b/db/routines/vn2008/procedures/nest_child_add.sql
deleted file mode 100644
index 5b45a9d07..000000000
--- a/db/routines/vn2008/procedures/nest_child_add.sql
+++ /dev/null
@@ -1,48 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`nest_child_add`(
- vTable VARCHAR(45)
- ,vChild VARCHAR(45)
- ,vFatherId INT
-)
-BEGIN
- DECLARE vMyLeft INT;
-
- SET vTable = util.quoteIdentifier(vTable);
-
- DROP TEMPORARY TABLE IF EXISTS aux;
- CREATE TEMPORARY TABLE aux
- SELECT 0 as lft;
-
- EXECUTE IMMEDIATE CONCAT(
- 'UPDATE aux
- SET lft = (SELECT lft
- FROM ', vTable,
- ' WHERE id = ?)')
- USING vFatherId;
-
- SELECT lft INTO vMyLeft FROM aux;
- DROP TEMPORARY TABLE aux;
-
- EXECUTE IMMEDIATE CONCAT(
- 'UPDATE ', vTable, '
- SET rgt = rgt + 2
- WHERE rgt > ?
- ORDER BY rgt DESC')
- USING vMyLeft;
-
- EXECUTE IMMEDIATE CONCAT(
- 'UPDATE ', vTable, '
- SET lft = lft + 2
- WHERE lft > ?
- ORDER BY lft DESC')
- USING vMyLeft;
-
- EXECUTE IMMEDIATE CONCAT(
- 'INSERT INTO ', vTable, ' (name, lft, rgt)
- VALUES(?, ? + 1, ? + 2)')
- USING vChild,
- vMyLeft,
- vMyLeft;
-
-END$$
-DELIMITER ;
diff --git a/db/routines/vn2008/procedures/nest_delete.sql b/db/routines/vn2008/procedures/nest_delete.sql
deleted file mode 100644
index 84f75294b..000000000
--- a/db/routines/vn2008/procedures/nest_delete.sql
+++ /dev/null
@@ -1,51 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`nest_delete`(
- vTable VARCHAR(45)
- ,vNodeId INT
-)
-BEGIN
- DECLARE vMyRight INT;
- DECLARE vMyLeft INT;
- DECLARE vMyWidth INT;
-
- DROP TEMPORARY TABLE IF EXISTS aux;
- CREATE TEMPORARY TABLE aux
- SELECT 0 rgt, 0 lft, 0 wdt;
-
- SET vTable = util.quoteIdentifier(vTable);
-
- EXECUTE IMMEDIATE CONCAT(
- 'UPDATE aux a
- JOIN ', vTable, ' t
- SET a.rgt = t.rgt,
- a.lft = t.lft,
- a.wdt = t.rgt - t.lft + 1
- WHERE t.id = ?')
- USING vNodeId;
-
- SELECT rgt, lft, wdt
- INTO vMyRight, vMyLeft, vMyWidth
- FROM aux;
-
- DROP TEMPORARY TABLE aux;
-
- EXECUTE IMMEDIATE CONCAT(
- 'DELETE FROM ', vTable,
- ' WHERE lft BETWEEN ? AND ?')
- USING vMyLeft, vMyRight;
-
- EXECUTE IMMEDIATE CONCAT(
- 'UPDATE ', vTable,
- ' SET rgt = rgt - ?
- WHERE rgt > ?
- ORDER BY rgt')
- USING vMyWidth,vMyRight;
-
- EXECUTE IMMEDIATE CONCAT(
- 'UPDATE ', vTable,
- ' SET lft = lft - ?
- WHERE lft > ?
- ORDER BY lft')
- USING vMyWidth, vMyRight;
-END$$
-DELIMITER ;
diff --git a/db/routines/vn2008/procedures/nest_move.sql b/db/routines/vn2008/procedures/nest_move.sql
deleted file mode 100644
index 950d46e68..000000000
--- a/db/routines/vn2008/procedures/nest_move.sql
+++ /dev/null
@@ -1,108 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`nest_move`(
- vTable VARCHAR(45)
- ,idNODE INT
- ,idFATHER INT
-)
-BEGIN
- DECLARE myRight INT;
- DECLARE myLeft INT;
- DECLARE myWidth INT;
- DECLARE fatherRight INT;
- DECLARE fatherLeft INT;
- DECLARE gap INT;
-
- SET vTable = util.quoteIdentifier(vTable);
-
- DROP TEMPORARY TABLE IF EXISTS aux;
- CREATE TEMPORARY TABLE aux
- SELECT 0 as rgt, 0 as lft, 0 as wdt, 0 as frg, 0 as flf;
-
- -- Averiguamos el ancho de la rama
- EXECUTE IMMEDIATE CONCAT(
- 'UPDATE aux a
- JOIN ', vTable, ' t
- SET a.wdt = t.rgt - t.lft + 1
- WHERE t.id = ?')
- USING idNODE;
-
- -- Averiguamos la posicion del nuevo padre
- EXECUTE IMMEDIATE CONCAT(
- 'UPDATE aux a
- JOIN ', vTable, ' t
- SET a.frg = t.rgt,
- a.flf = t.lft
- WHERE t.id = ?')
- USING idFATHER;
-
- SELECT wdt, frg, flf INTO myWidth, fatherRight, fatherLeft
- FROM aux;
-
- -- 1º Incrementamos los valores de todos los nodos a la derecha del punto de inserción (fatherRight) , para hacer sitio
- EXECUTE IMMEDIATE CONCAT(
- 'UPDATE ', vTable,
- 'SET rgt = rgt + ?
- WHERE rgt >= ?
- ORDER BY rgt DESC')
- USING myWidth,
- fatherRight;
-
- EXECUTE IMMEDIATE CONCAT(
- 'UPDATE ', vTable,
- 'SET lft = lft + ?
- WHERE lft >= ?
- ORDER BY lft DESC')
- USING myWidth,
- fatherRight;
-
- -- Es preciso recalcular los valores del nodo en el caso de que estuviera a la derecha del nuevo padre
- EXECUTE IMMEDIATE CONCAT(
- 'UPDATE aux a
- JOIN ', vTable, ' t
- SET a.rgt = t.rgt,
- a.lft = t.lft
- WHERE t.id = ?')
- USING idNODE;
-
- SELECT lft, rgt, frg - lft INTO myLeft, myRight, gap
- FROM aux;
-
- -- 2º Incrementamos el valor de todos los nodos a trasladar hasta alcanzar su nueva posicion
- EXECUTE IMMEDIATE CONCAT(
- 'UPDATE ', vTable,
- 'SET lft = lft + ?
- WHERE lft BETWEEN ? AND ?
- ORDER BY lft DESC')
- USING gap,
- myLeft,
- myRight;
-
- EXECUTE IMMEDIATE CONCAT(
- 'UPDATE ', vTable,
- 'SET rgt = rgt + ?
- WHERE rgt BETWEEN ? AND ?
- ORDER BY rgt DESC')
- USING gap,
- myLeft,
- myRight;
-
- -- 3º Restaremos a todos los nodos resultantes, a la derecha de la posicion arrancada el ancho de la rama escindida
- EXECUTE IMMEDIATE CONCAT(
- 'UPDATE ', vTable,
- 'SET lft = lft - ?
- WHERE lft > ?
- ORDER BY lft')
- USING myWidth,
- myLeft;
-
- EXECUTE IMMEDIATE CONCAT(
- 'UPDATE ', vTable,
- 'SET rgt = rgt - ?
- WHERE rgt > ?
- ORDER BY rgt')
- USING myWidth,
- myRight;
-
- DROP TEMPORARY TABLE aux;
-END$$
-DELIMITER ;
diff --git a/db/routines/vn2008/procedures/pay.sql b/db/routines/vn2008/procedures/pay.sql
deleted file mode 100644
index ec73ee696..000000000
--- a/db/routines/vn2008/procedures/pay.sql
+++ /dev/null
@@ -1,67 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`pay`(IN datFEC DATE
- , IN idPROV INT
- , IN dblIMPORTE DOUBLE
- , IN idMONEDA INT
- , IN dblDIVISA DOUBLE
- , IN idCAJA INT
- , IN idPAYMET INT
- , IN dblGASTOS DOUBLE
- , IN strCONCEPTO VARCHAR(40)
- , IN idEMP INT)
-BEGIN
-
- -- Registro en la tabla Cajas
- INSERT INTO Cajas ( Concepto
- , Serie
- , Numero
- , Salida
- , Cajafecha
- , Partida
- , Id_Banco
- , Id_Trabajador
- ,empresa_id
- ,conciliado)
-
- SELECT CONCAT('n/pago a ', Proveedor)
- , 'R'
- , idPROV
- , dblIMPORTE
- , datFEC
- , 1
- , idCAJA
- , account.myUser_getId()
- , idEMP
- , 1
- FROM Proveedores
- WHERE Id_Proveedor = idPROV;
-
- -- Registro en la tabla pago
- INSERT INTO pago(fecha
- , dueDated
- , id_proveedor
- , importe
- , id_moneda
- , divisa
- , id_banco
- , pay_met_id
- , g_bancarios
- , concepte
- , empresa_id)
-
- VALUES(datFEC
- , datFEC
- , idPROV
- , dblIMPORTE
- , idMONEDA
- , IF(dblDIVISA = 0, NULL, dblDIVISA)
- , idCAJA
- , idPAYMET
- , dblGASTOS
- , strCONCEPTO
- , idEMP);
-
- SELECT LAST_INSERT_ID() as pago_id;
-
-END$$
-DELIMITER ;
diff --git a/db/routines/vn2008/procedures/preOrdenarRuta.sql b/db/routines/vn2008/procedures/preOrdenarRuta.sql
deleted file mode 100644
index b5fd2b24b..000000000
--- a/db/routines/vn2008/procedures/preOrdenarRuta.sql
+++ /dev/null
@@ -1,22 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`preOrdenarRuta`(IN vRutaId INT)
-BEGIN
-/* Usa los valores del ultimo año para adivinar el orden de los tickets en la ruta
- * vRutaId id ruta
- * DEPRECATED use vn.routeGressPriority
-*/
-
-UPDATE Tickets mt
-JOIN (
- SELECT tt.Id_Consigna, round(ifnull(avg(t.Prioridad),0),0) as Prioridad
- from Tickets t
- JOIN Tickets tt on tt.Id_Consigna = t.Id_Consigna
- where t.Fecha > TIMESTAMPADD(YEAR,-1,util.VN_CURDATE())
- AND tt.Id_Ruta = vRutaId
- GROUP BY Id_Consigna
- ) sub ON sub.Id_Consigna = mt.Id_Consigna
- SET mt.Prioridad = sub.Prioridad
- WHERE mt.Id_Ruta = vRutaId;
-
-END$$
-DELIMITER ;
diff --git a/db/routines/vn2008/procedures/prepare_ticket_list.sql b/db/routines/vn2008/procedures/prepare_ticket_list.sql
deleted file mode 100644
index e407a91b7..000000000
--- a/db/routines/vn2008/procedures/prepare_ticket_list.sql
+++ /dev/null
@@ -1,22 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`prepare_ticket_list`(vStartingDate DATETIME, vEndingDate DATETIME)
-BEGIN
- DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list;
- CREATE TEMPORARY TABLE tmp.ticket_list
- (PRIMARY KEY (Id_Ticket))
- ENGINE = MEMORY
- SELECT t.Id_Ticket, c.Id_Cliente
- FROM Tickets t
- LEFT JOIN vn.ticketState ts ON ts.ticketFk = t.Id_Ticket
- JOIN Clientes c ON c.Id_Cliente = t.Id_Cliente
- WHERE c.typeFk IN ('normal','handMaking','internalUse')
- AND (
- Fecha BETWEEN util.today() AND vEndingDate
- OR (
- ts.alertLevel < 3
- AND t.Fecha >= vStartingDate
- AND t.Fecha < util.today()
- )
- );
-END$$
-DELIMITER ;
diff --git a/db/routines/vn2008/procedures/recibidaIvaInsert.sql b/db/routines/vn2008/procedures/recibidaIvaInsert.sql
deleted file mode 100644
index e2aba0a35..000000000
--- a/db/routines/vn2008/procedures/recibidaIvaInsert.sql
+++ /dev/null
@@ -1,39 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`recibidaIvaInsert`(IN vId INT)
-BEGIN
-
- DECLARE vRate DOUBLE DEFAULT 1;
- DECLARE vDated DATE;
-
- SELECT MAX(rr.date) INTO vDated
- FROM reference_rate rr
- JOIN recibida r ON r.id = vId
- WHERE rr.date <= r.fecha
- AND rr.moneda_id = r.moneda_id ;
-
- IF vDated THEN
-
- SELECT rate INTO vRate
- FROM reference_rate
- WHERE `date` = vDated;
- END IF;
-
- DELETE FROM recibida_iva WHERE recibida_id = vId;
-
- INSERT INTO recibida_iva(recibida_id, bi, gastos_id, divisa, taxTypeSageFk, transactionTypeSageFk)
- SELECT r.id,
- SUM(Costefijo * Cantidad) / IFNULL(vRate,1) bi,
- 6003000000,
- IF(r.moneda_id = 1,NULL,SUM(Costefijo * Cantidad )) divisa,
- taxTypeSageFk,
- transactionTypeSageFk
- FROM recibida r
- JOIN Entradas e ON e.recibida_id = r.id
- JOIN Proveedores p ON p.Id_Proveedor = e.Id_Proveedor
- JOIN Compres c ON c.Id_Entrada = e.Id_Entrada
- LEFT JOIN reference_rate rr ON rr.moneda_id = r.moneda_id AND rr.date = r.fecha
- WHERE r.id = vId
- HAVING bi IS NOT NULL;
-
-END$$
-DELIMITER ;
diff --git a/db/routines/vn2008/procedures/unary_leaves.sql b/db/routines/vn2008/procedures/unary_leaves.sql
deleted file mode 100644
index 28b5baa76..000000000
--- a/db/routines/vn2008/procedures/unary_leaves.sql
+++ /dev/null
@@ -1,58 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`unary_leaves`(v_top INT)
-BEGIN
-/**
- * A partir de un nodo devuelve todos sus descendientes.
- *
- * @table tmp.tree Tabla con los ids de los nodos descendientes;
- **/
- DECLARE v_count INT;
- DECLARE v_parent INT;
- DECLARE v_depth INT DEFAULT 0;
-
- DROP TEMPORARY TABLE IF EXISTS tmp.tree;
- CREATE TEMPORARY TABLE tmp.tree
- (INDEX (id))
- ENGINE = MEMORY
- SELECT v_top id, v_parent parent, v_depth depth;
-
- DROP TEMPORARY TABLE IF EXISTS tmp.parent;
- CREATE TEMPORARY TABLE tmp.parent
- ENGINE = MEMORY
- SELECT v_top id;
-
- l: LOOP
-
- SET v_depth = v_depth + 1;
-
- DROP TEMPORARY TABLE IF EXISTS tmp.child;
- CREATE TEMPORARY TABLE tmp.child
- ENGINE = MEMORY
- SELECT c.`id`, c.parent
- FROM `unary` c
- JOIN tmp.parent p ON c.`parent` = p.id;
-
- DROP TEMPORARY TABLE tmp.parent;
- CREATE TEMPORARY TABLE tmp.parent
- ENGINE = MEMORY
- SELECT c.id, c.parent
- FROM tmp.child c
- LEFT JOIN tmp.tree t ON t.id = c.id
- WHERE t.id IS NULL;
-
- INSERT INTO tmp.tree
- SELECT id, parent, v_depth FROM tmp.parent;
-
- SELECT COUNT(*) INTO v_count
- FROM tmp.parent;
-
- IF v_count = 0 THEN
- LEAVE l;
- END IF;
- END LOOP;
-
- DROP TEMPORARY TABLE
- tmp.parent,
- tmp.child;
-END$$
-DELIMITER ;
diff --git a/db/routines/vn2008/procedures/unary_tops.sql b/db/routines/vn2008/procedures/unary_tops.sql
deleted file mode 100644
index b3a7cf11d..000000000
--- a/db/routines/vn2008/procedures/unary_tops.sql
+++ /dev/null
@@ -1,19 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`unary_tops`()
-BEGIN
-/**
- * Devuelve todos los nodos que no tienen padre.
- *
- * @table tmp.tree Tabla con los ids de los nodos que no tienen padre;
- **/
-
- DROP TEMPORARY TABLE IF EXISTS tmp.tree;
- CREATE TEMPORARY TABLE tmp.tree
- ENGINE = MEMORY
- SELECT s.`unary_id` AS id, s.name, s.odbc_date, s.type
- FROM `unary_scan` s
- INNER JOIN `unary` u ON s.unary_id = u.id
- WHERE u.parent IS NULL;
-
-END$$
-DELIMITER ;
diff --git a/db/routines/vn2008/triggers/movement_label_afterUpdate.sql b/db/routines/vn2008/triggers/movement_label_afterUpdate.sql
deleted file mode 100644
index 364568fb3..000000000
--- a/db/routines/vn2008/triggers/movement_label_afterUpdate.sql
+++ /dev/null
@@ -1,8 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn2008`.`movement_label_afterUpdate`
- AFTER UPDATE ON `movement_label`
- FOR EACH ROW
-IF NEW.stem >= (SELECT Cantidad FROM Movimientos WHERE Id_Movimiento = NEW.Id_Movimiento) THEN
- UPDATE Movimientos SET OK = 1 WHERE Id_Movimiento = NEW.Id_Movimiento;
-END IF$$
-DELIMITER ;
diff --git a/db/routines/vn2008/views/Bancos.sql b/db/routines/vn2008/views/Bancos.sql
index 0c6f8d1bd..6e850f365 100644
--- a/db/routines/vn2008/views/Bancos.sql
+++ b/db/routines/vn2008/views/Bancos.sql
@@ -1,11 +1,11 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`Bancos`
-AS SELECT `b`.`id` AS `Id_Banco`,
- `b`.`bank` AS `Banco`,
- `b`.`account` AS `Cuenta`,
- `b`.`cash` AS `cash`,
- `b`.`entityFk` AS `entity_id`,
- `b`.`isActive` AS `activo`,
- `b`.`currencyFk` AS `currencyFk`
-FROM `vn`.`bank` `b`
+AS SELECT `a`.`id` AS `Id_Banco`,
+ `a`.`bank` AS `Banco`,
+ `a`.`account` AS `Cuenta`,
+ `a`.`accountingTypeFk` AS `cash`,
+ `a`.`entityFk` AS `entity_id`,
+ `a`.`isActive` AS `activo`,
+ `a`.`currencyFk` AS `currencyFk`
+FROM `vn`.`accounting` `a`
diff --git a/db/routines/vn2008/views/Clientes.sql b/db/routines/vn2008/views/Clientes.sql
index 12583915a..a696cb6e0 100644
--- a/db/routines/vn2008/views/Clientes.sql
+++ b/db/routines/vn2008/views/Clientes.sql
@@ -34,7 +34,6 @@ AS SELECT `c`.`id` AS `id_cliente`,
`c`.`hasLcr` AS `hasLcr`,
`c`.`defaultAddressFk` AS `default_address`,
`c`.`riskCalculated` AS `risk_calculated`,
- `c`.`clientTypeFk` AS `clientes_tipo_id`,
`c`.`hasToInvoiceByAddress` AS `invoiceByAddress`,
`c`.`isTaxDataChecked` AS `contabilizado`,
`c`.`isFreezed` AS `congelado`,
diff --git a/db/routines/vn2008/views/Proveedores_cargueras.sql b/db/routines/vn2008/views/Proveedores_cargueras.sql
new file mode 100644
index 000000000..c1dc6ad23
--- /dev/null
+++ b/db/routines/vn2008/views/Proveedores_cargueras.sql
@@ -0,0 +1,5 @@
+CREATE OR REPLACE DEFINER=`root`@`localhost`
+ SQL SECURITY DEFINER
+ VIEW `vn2008`.`Proveedores_cargueras`
+AS SELECT `fs`.`supplierFk` AS `Id_Proveedor`
+FROM `vn`.`supplierFreight` `fs`
diff --git a/db/routines/vn2008/views/Tramos.sql b/db/routines/vn2008/views/Tramos.sql
new file mode 100644
index 000000000..6919a610b
--- /dev/null
+++ b/db/routines/vn2008/views/Tramos.sql
@@ -0,0 +1,6 @@
+CREATE OR REPLACE DEFINER=`root`@`localhost`
+ SQL SECURITY DEFINER
+ VIEW `vn2008`.`Tramos`
+AS SELECT `s`.`id` AS `id`,
+ `s`.`section` AS `Tramo`
+FROM `vn`.`timeSlots` `s`
\ No newline at end of file
diff --git a/db/routines/vn2008/views/credit.sql b/db/routines/vn2008/views/credit.sql
index 4bd3cef39..0de60b967 100644
--- a/db/routines/vn2008/views/credit.sql
+++ b/db/routines/vn2008/views/credit.sql
@@ -1,9 +1,11 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
- SQL SECURITY DEFINER
- VIEW `vn2008`.`credit`
-AS SELECT `c`.`id` AS `id`,
- `c`.`clientFk` AS `Id_Cliente`,
- `c`.`workerFk` AS `Id_Trabajador`,
- `c`.`amount` AS `amount`,
- `c`.`created` AS `odbc_date`
-FROM `vn`.`clientCredit` `c`
\ No newline at end of file
+ SQL SECURITY DEFINER
+ VIEW `vn2008`.`credit`
+AS SELECT
+ `c`.`id` AS `id`,
+ `c`.`clientFk` AS `Id_Cliente`,
+ `c`.`workerFk` AS `Id_Trabajador`,
+ `c`.`amount` AS `amount`,
+ `c`.`created` AS `odbc_date`
+FROM
+ `vn`.`clientCredit` `c`
diff --git a/db/routines/vn2008/views/empresa.sql b/db/routines/vn2008/views/empresa.sql
index 3b43ee574..8c80a06e8 100644
--- a/db/routines/vn2008/views/empresa.sql
+++ b/db/routines/vn2008/views/empresa.sql
@@ -5,7 +5,6 @@ AS SELECT `c`.`id` AS `id`,
`c`.`code` AS `abbreviation`,
`c`.`supplierAccountFk` AS `Id_Proveedores_account`,
`c`.`workerManagerFk` AS `gerente_id`,
- `c`.`sage200Company` AS `digito_factura`,
`c`.`phytosanitary` AS `phytosanitary`,
`c`.`companyCode` AS `CodigoEmpresa`,
`c`.`companyGroupFk` AS `empresa_grupo`,
diff --git a/db/routines/vn2008/views/financialProductType.sql b/db/routines/vn2008/views/financialProductType.sql
new file mode 100644
index 000000000..89a063856
--- /dev/null
+++ b/db/routines/vn2008/views/financialProductType.sql
@@ -0,0 +1,4 @@
+CREATE OR REPLACE DEFINER=`root`@`localhost`
+ SQL SECURITY DEFINER
+VIEW `vn2008`.`financialProductType`AS
+ SELECT * FROM vn.financialProductType;
\ No newline at end of file
diff --git a/db/routines/vn2008/views/flight.sql b/db/routines/vn2008/views/flight.sql
new file mode 100644
index 000000000..2df5362f7
--- /dev/null
+++ b/db/routines/vn2008/views/flight.sql
@@ -0,0 +1,13 @@
+CREATE OR REPLACE DEFINER=`root`@`localhost`
+ SQL SECURITY DEFINER
+ VIEW `vn2008`.`flight`
+AS SELECT
+ `f`.`id` AS `flight_id`,
+ `f`.`duration` AS `duration`,
+ `f`.`flightPath` AS `route`,
+ `f`.`days` AS `days`,
+ `f`.`airlineFk` AS `airline_id`,
+ `f`.`airportArrivalFk` AS `airport_out`,
+ `f`.`airportDepartureFk` AS `airport_in`
+FROM
+ `vn`.`flight` `f`;
\ No newline at end of file
diff --git a/db/routines/vn2008/views/gastos_resumen.sql b/db/routines/vn2008/views/gastos_resumen.sql
new file mode 100644
index 000000000..02231bcbf
--- /dev/null
+++ b/db/routines/vn2008/views/gastos_resumen.sql
@@ -0,0 +1,11 @@
+CREATE OR REPLACE DEFINER=`root`@`localhost`
+ SQL SECURITY DEFINER
+ VIEW `vn2008`.`gastos_resumen`
+AS SELECT
+ `es`.`expenseFk` AS `Id_Gasto`,
+ `es`.`year` AS `year`,
+ `es`.`month` AS `month`,
+ `es`.`amount` AS `importe`,
+ `es`.`companyFk` AS `empresa_id`
+FROM
+ `vn`.`expenseManual` `es`;
\ No newline at end of file
diff --git a/db/routines/vn2008/views/integra2.sql b/db/routines/vn2008/views/integra2.sql
new file mode 100644
index 000000000..05840d6bb
--- /dev/null
+++ b/db/routines/vn2008/views/integra2.sql
@@ -0,0 +1,9 @@
+CREATE OR REPLACE DEFINER=`root`@`localhost`
+ SQL SECURITY DEFINER
+ VIEW `vn2008`.`integra2`
+AS SELECT
+ `i2`.`postCode` AS `postal_code`,
+ `i2`.`frequency` AS `frequency`,
+ `i2`.`warehouseFk` AS `warehouse_id`
+FROM
+ `vn`.`integra2` `i2`;
\ No newline at end of file
diff --git a/db/routines/vn2008/views/integra2_province.sql b/db/routines/vn2008/views/integra2_province.sql
new file mode 100644
index 000000000..bc099adb3
--- /dev/null
+++ b/db/routines/vn2008/views/integra2_province.sql
@@ -0,0 +1,8 @@
+CREATE OR REPLACE DEFINER=`root`@`localhost`
+ SQL SECURITY DEFINER
+ VIEW `vn2008`.`integra2_province`
+AS SELECT
+ `ip`.`provinceFk` AS `province_id`,
+ `ip`.`franchise` AS `franquicia`
+FROM
+ `vn`.`integra2Province` `ip`;
\ No newline at end of file
diff --git a/db/routines/vn2008/views/pago_sdc.sql b/db/routines/vn2008/views/pago_sdc.sql
new file mode 100644
index 000000000..29480e376
--- /dev/null
+++ b/db/routines/vn2008/views/pago_sdc.sql
@@ -0,0 +1,16 @@
+CREATE OR REPLACE DEFINER=`root`@`localhost`
+ SQL SECURITY DEFINER
+ VIEW `vn2008`.`pago_sdc`
+AS SELECT `ei`.`id` AS `pago_sdc_id`,
+ `ei`.`amount` AS `importe`,
+ `ei`.`dated` AS `fecha`,
+ `ei`.`dueDated` AS `vencimiento`,
+ `ei`.`entityFk` AS `entity_id`,
+ `ei`.`ref` AS `ref`,
+ `ei`.`rate` AS `rate`,
+ `ei`.`companyFk` AS `empresa_id`,
+ `ei`.`financialProductTypefk` AS `financialProductTypefk`,
+ `ei`.`upperBarrier` AS `upperBarrier`,
+ `ei`.`lowerBarrier` AS `lowerBarrier`,
+ `ei`.`strike` AS `strike`
+FROM `vn`.`exchangeInsurance` `ei`
\ No newline at end of file
diff --git a/db/routines/vn2008/views/payrollWorker.sql b/db/routines/vn2008/views/payrollWorker.sql
new file mode 100644
index 000000000..d4ada9aa0
--- /dev/null
+++ b/db/routines/vn2008/views/payrollWorker.sql
@@ -0,0 +1,6 @@
+CREATE OR REPLACE DEFINER=`root`@`localhost`
+ SQL SECURITY DEFINER
+ VIEW `vn2008`.`payroll_employee`
+AS SELECT `pw`.`workerFkA3` AS `CodTrabajador`,
+ `pw`.`companyFkA3` AS `codempresa`
+FROM `vn`.`payrollWorker` `pw`
diff --git a/db/routines/vn2008/views/payroll_centros.sql b/db/routines/vn2008/views/payroll_centros.sql
new file mode 100644
index 000000000..b7e162f90
--- /dev/null
+++ b/db/routines/vn2008/views/payroll_centros.sql
@@ -0,0 +1,6 @@
+CREATE OR REPLACE DEFINER=`root`@`localhost`
+ SQL SECURITY DEFINER
+ VIEW `vn2008`.`payroll_centros`
+AS SELECT `pwc`.`workCenterFkA3` AS `cod_centro`,
+ `pwc`.`companyFkA3` AS `codempresa`
+FROM `vn`.`payrollWorkCenter` `pwc`
diff --git a/db/routines/vn2008/views/payroll_conceptos.sql b/db/routines/vn2008/views/payroll_conceptos.sql
new file mode 100644
index 000000000..a7c6ece5b
--- /dev/null
+++ b/db/routines/vn2008/views/payroll_conceptos.sql
@@ -0,0 +1,9 @@
+CREATE OR REPLACE DEFINER=`root`@`localhost`
+ SQL SECURITY DEFINER
+ VIEW `vn2008`.`payroll_conceptos`
+AS SELECT `pc`.`id` AS `conceptoid`,
+ `pc`.`name` AS `concepto`,
+ `pc`.`isSalaryAgreed` AS `isSalaryAgreed`,
+ `pc`.`isVariable` AS `isVariable`,
+ `pc`.`isException` AS `isException`
+FROM `vn`.`payrollComponent` `pc`
diff --git a/db/routines/vn2008/views/v_jerarquia.sql b/db/routines/vn2008/views/v_jerarquia.sql
deleted file mode 100644
index 6938a1fdf..000000000
--- a/db/routines/vn2008/views/v_jerarquia.sql
+++ /dev/null
@@ -1,10 +0,0 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
- SQL SECURITY DEFINER
- VIEW `vn2008`.`v_jerarquia`
-AS SELECT `vn2008`.`jerarquia`.`worker_id` AS `Id_Trabajador`,
- `vn2008`.`jerarquia`.`boss_id` AS `boss_id`
-FROM `vn2008`.`jerarquia`
-UNION ALL
-SELECT DISTINCT `vn2008`.`jerarquia`.`boss_id` AS `Id_Trabajador`,
- `vn2008`.`jerarquia`.`boss_id` AS `boss_id`
-FROM `vn2008`.`jerarquia`
diff --git a/db/routines/vn2008/views/versiones.sql b/db/routines/vn2008/views/versiones.sql
new file mode 100644
index 000000000..3d27f4f92
--- /dev/null
+++ b/db/routines/vn2008/views/versiones.sql
@@ -0,0 +1,8 @@
+CREATE OR REPLACE DEFINER=`root`@`localhost`
+ SQL SECURITY DEFINER
+ VIEW `vn2008`.`versiones`
+AS SELECT `m`.`app` AS `programa`,
+ `m`.`version` AS `version`,
+ 0 AS `critical`
+FROM `vn`.`mdbVersion` `m`
+WHERE `m`.`branchFk` = 'master'
\ No newline at end of file
diff --git a/db/routines/vn2008/views/warehouse_pickup.sql b/db/routines/vn2008/views/warehouse_pickup.sql
new file mode 100644
index 000000000..c3a7268a1
--- /dev/null
+++ b/db/routines/vn2008/views/warehouse_pickup.sql
@@ -0,0 +1,9 @@
+
+CREATE OR REPLACE DEFINER=`root`@`localhost`
+ SQL SECURITY DEFINER
+ VIEW `vn2008`.`warehouse_pickup`
+AS SELECT
+ `wp`.`warehouseFk` AS `warehouse_id`,
+ `wp`.`agencyModeFk` AS `agency_id`
+FROM
+ `vn`.`warehousePickup` `wp`;
\ No newline at end of file
diff --git a/db/versions/10832-purpleAralia/00-newWareHouse.sql b/db/versions/10832-purpleAralia/00-newWareHouse.sql
new file mode 100644
index 000000000..dd2c16bdb
--- /dev/null
+++ b/db/versions/10832-purpleAralia/00-newWareHouse.sql
@@ -0,0 +1,12 @@
+INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId)
+ VALUES
+ ('Collection', 'assign', 'WRITE', 'ALLOW', 'ROLE', 'production'),
+ ('ExpeditionPallet', 'getPallet', 'READ', 'ALLOW', 'ROLE', 'production'),
+ ('MachineWorker','updateInTime','WRITE','ALLOW','ROLE','production'),
+ ('MobileAppVersionControl','getVersion','READ','ALLOW','ROLE','production'),
+ ('SaleTracking','delete','WRITE','ALLOW','ROLE','production'),
+ ('SaleTracking','updateTracking','WRITE','ALLOW','ROLE','production'),
+ ('SaleTracking','setPicked','WRITE','ALLOW','ROLE','production'),
+ ('ExpeditionPallet', '*', 'READ', 'ALLOW', 'ROLE', 'production'),
+ ('Sale', 'getFromSectorCollection', 'READ', 'ALLOW', 'ROLE', 'production'),
+ ('ItemBarcode', 'delete', 'WRITE', 'ALLOW', 'ROLE', 'production');
\ No newline at end of file
diff --git a/db/versions/10835-brownCarnation/00-firstScript.sql b/db/versions/10835-brownCarnation/00-firstScript.sql
index 977e20905..be53d866c 100644
--- a/db/versions/10835-brownCarnation/00-firstScript.sql
+++ b/db/versions/10835-brownCarnation/00-firstScript.sql
@@ -81,10 +81,6 @@ ALTER TABLE IF EXISTS vn2008.MovimienRENAMEs_avisar__ COMMENT='refs #6371 deprec
ALTER TABLE IF EXISTS vn2008.MovimienRENAMEs_revisar RENAME vn2008.MovimienRENAMEs_revisar__;
ALTER TABLE IF EXISTS vn2008.MovimienRENAMEs_revisar__ COMMENT='refs #6371 deprecated 2024-01-11';
--- Para la tabla Proveedores_cargueras
-ALTER TABLE IF EXISTS vn2008.Proveedores_cargueras RENAME vn2008.Proveedores_cargueras__;
-ALTER TABLE IF EXISTS vn2008.Proveedores_cargueras__ COMMENT='refs #6371 deprecated 2024-01-11';
-
-- Para la tabla Proveedores_comunicados
ALTER TABLE IF EXISTS vn2008.Proveedores_comunicados RENAME vn2008.Proveedores_comunicados__;
ALTER TABLE IF EXISTS vn2008.Proveedores_comunicados__ COMMENT='refs #6371 deprecated 2024-01-11';
@@ -101,10 +97,6 @@ ALTER TABLE IF EXISTS vn2008.Tickets_stack__ COMMENT='refs #6371 deprecated 2024
ALTER TABLE IF EXISTS vn2008.Tipos_f11 RENAME vn2008.Tipos_f11__;
ALTER TABLE IF EXISTS vn2008.Tipos_f11__ COMMENT='refs #6371 deprecated 2024-01-11';
--- Para la tabla Tramos
-ALTER TABLE IF EXISTS vn2008.Tramos RENAME vn2008.Tramos__;
-ALTER TABLE IF EXISTS vn2008.Tramos__ COMMENT='refs #6371 deprecated 2024-01-11';
-
-- Para la tabla accion_dits
ALTER TABLE IF EXISTS vn2008.accion_dits RENAME vn2008.accion_dits__;
ALTER TABLE IF EXISTS vn2008.accion_dits__ COMMENT='refs #6371 deprecated 2024-01-11';
@@ -165,10 +157,6 @@ ALTER TABLE IF EXISTS vn2008.cyc__ COMMENT='refs #6371 deprecated 2024-01-11';
ALTER TABLE IF EXISTS vn2008.cyc_declaration RENAME vn2008.cyc_declaration__;
ALTER TABLE IF EXISTS vn2008.cyc_declaration__ COMMENT='refs #6371 deprecated 2024-01-11';
--- Para la tabla dock
-ALTER TABLE IF EXISTS vn2008.dock RENAME vn2008.dock__;
-ALTER TABLE IF EXISTS vn2008.dock__ COMMENT='refs #6371 deprecated 2024-01-11';
-
-- Para la tabla edi_testigos
ALTER TABLE IF EXISTS vn2008.edi_testigos RENAME vn2008.edi_testigos__;
ALTER TABLE IF EXISTS vn2008.edi_testigos__ COMMENT='refs #6371 deprecated 2024-01-11';
diff --git a/db/versions/10841-orangeGalax/00-entryDms.sql b/db/versions/10841-orangeGalax/00-entryDms.sql
new file mode 100644
index 000000000..33ec1e3af
--- /dev/null
+++ b/db/versions/10841-orangeGalax/00-entryDms.sql
@@ -0,0 +1,15 @@
+CREATE OR REPLACE TABLE `vn`.`entryDms` (
+ `entryFk` int(11) NOT NULL,
+ `dmsFk` int(11) NOT NULL,
+ `editorFk` int(10) unsigned DEFAULT NULL,
+ PRIMARY KEY (`entryFk`,`dmsFk`),
+ KEY `gestdoc_id` (`dmsFk`),
+ KEY `entryDms_editor` (`editorFk`),
+ CONSTRAINT `entryDms_dms` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `entryDms_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`),
+ CONSTRAINT `entryDms_entry` FOREIGN KEY (`entryFk`) REFERENCES `entry` (`id`) ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
+
+INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
+ VALUES
+ ('EntryDms', '*', '*', 'ALLOW', 'ROLE', 'employee');
diff --git a/db/versions/10841-orangeGalax/00-entryDmsType.vn.sql b/db/versions/10841-orangeGalax/00-entryDmsType.vn.sql
new file mode 100644
index 000000000..d408ab827
--- /dev/null
+++ b/db/versions/10841-orangeGalax/00-entryDmsType.vn.sql
@@ -0,0 +1,2 @@
+INSERT INTO `vn`.`dmsType` (code, name, path__, writeRoleFk, readRoleFk, monthToDelete)
+ VALUES('entry', 'Entrada', '', 1, 1, NULL);
diff --git a/db/versions/10880-salmonHydrangea/00-firstScript.sql b/db/versions/10880-salmonHydrangea/00-firstScript.sql
new file mode 100644
index 000000000..934fc2020
--- /dev/null
+++ b/db/versions/10880-salmonHydrangea/00-firstScript.sql
@@ -0,0 +1 @@
+ALTER TABLE vn.buy ADD buyerFk int(10) unsigned DEFAULT NULL NULL;
diff --git a/db/versions/10881-greenHydrangea/00-alterTableNotification.sql b/db/versions/10881-greenHydrangea/00-alterTableNotification.sql
new file mode 100644
index 000000000..068d77839
--- /dev/null
+++ b/db/versions/10881-greenHydrangea/00-alterTableNotification.sql
@@ -0,0 +1 @@
+ALTER TABLE util.notification MODIFY COLUMN id int(11) auto_increment NOT NULL;
diff --git a/db/versions/10881-greenHydrangea/01-notification.sql b/db/versions/10881-greenHydrangea/01-notification.sql
new file mode 100644
index 000000000..ab5480548
--- /dev/null
+++ b/db/versions/10881-greenHydrangea/01-notification.sql
@@ -0,0 +1,15 @@
+INSERT IGNORE INTO util.notification ( `name`,`description`)
+ VALUES
+ ( 'zone-included','An email to notify zoneCollisions');
+
+-- Change value if destionation user should be different
+SET @DESTINATION_USER = "pepe";
+
+SET @MaxId = LAST_INSERT_ID();
+
+INSERT IGNORE INTO util.notificationSubscription (notificationFk,userFk)
+ VALUES(
+ @MaxId, (SELECT id from `account`.`user` where name = @DESTINATION_USER));
+
+INSERT IGNORE INTO util.notificationAcl (notificationFk,roleFk)
+ SELECT @MaxId, (SELECT role from `account`.`user` where name = @DESTINATION_USER) FROM util.notification WHERE name= "zone-included";
diff --git a/db/versions/10887-floranet/00-schemaAndUser.sql b/db/versions/10887-floranet/00-schemaAndUser.sql
new file mode 100644
index 000000000..34da92550
--- /dev/null
+++ b/db/versions/10887-floranet/00-schemaAndUser.sql
@@ -0,0 +1,14 @@
+
+CREATE SCHEMA IF NOT EXISTS `floranet`;
+
+CREATE ROLE IF NOT EXISTS 'floranet' ;
+
+GRANT Create temporary tables ON floranet.* TO 'floranet';
+
+GRANT Execute ON floranet.* TO 'floranet';
+
+GRANT Lock tables ON floranet.* TO 'floranet';
+
+CREATE USER IF NOT EXISTS 'floranet'@'%';
+
+GRANT floranet TO floranet@'%';
\ No newline at end of file
diff --git a/db/versions/10887-floranet/01-tables.sql b/db/versions/10887-floranet/01-tables.sql
new file mode 100644
index 000000000..b63c81c21
--- /dev/null
+++ b/db/versions/10887-floranet/01-tables.sql
@@ -0,0 +1,61 @@
+CREATE OR REPLACE TABLE floranet.`builder` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `itemFk` int(11) NOT NULL,
+ `elementFk` int(11) NOT NULL,
+ `quantity` int(10) unsigned NOT NULL DEFAULT 1,
+ PRIMARY KEY (`id`),
+ KEY `builder_FK` (`itemFk`),
+ KEY `builder_FK_1` (`elementFk`),
+ CONSTRAINT `builder_FK` FOREIGN KEY (`itemFk`) REFERENCES `vn`.`item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='Links handmade products with their elements';
+
+CREATE OR REPLACE TABLE floranet.`element` (
+ `itemFk` int(11) NOT NULL,
+ `typeFk` smallint(5) unsigned DEFAULT NULL,
+ `size` int(11) DEFAULT NULL,
+ `inkFk` char(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL,
+ `originFk` tinyint(2) unsigned DEFAULT NULL,
+ `name` varchar(30) DEFAULT NULL,
+ `quantity` int(11) NOT NULL DEFAULT 1,
+ PRIMARY KEY (`itemFk`),
+ KEY `element_FK` (`itemFk`),
+ KEY `element_FK_1` (`typeFk`),
+ KEY `element_FK_2` (`inkFk`),
+ KEY `element_FK_3` (`originFk`),
+ CONSTRAINT `element_FK` FOREIGN KEY (`itemFk`) REFERENCES `vn`.`item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `element_FK_1` FOREIGN KEY (`typeFk`) REFERENCES `vn`.`itemType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `element_FK_2` FOREIGN KEY (`inkFk`) REFERENCES `vn`.`ink` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `element_FK_3` FOREIGN KEY (`originFk`) REFERENCES `vn`.`origin` (`id`) ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='Filtro para localizar posibles items que coincidan con la descripción';
+
+ALTER TABLE floranet.builder ADD CONSTRAINT `builder_FK_1` FOREIGN KEY (`elementFk`) REFERENCES `element` (`itemFk`) ON UPDATE CASCADE;
+
+CREATE OR REPLACE TABLE floranet.catalogue
+(id INT AUTO_INCREMENT PRIMARY KEY,
+ name VARCHAR(50),
+ price DECIMAL(10,2) NOT NULL,
+ itemFk INT NOT NULL,
+ dated DATE,
+ postalCode VARCHAR(12),
+ `type` VARCHAR(50),
+ image VARCHAR(255),
+ description TEXT,
+ created TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ payed DATETIME,
+ FOREIGN KEY (itemFk) REFERENCES vn.item(id) ON DELETE RESTRICT ON UPDATE CASCADE);
+
+
+CREATE OR REPLACE TABLE floranet.`order`
+(id INT AUTO_INCREMENT PRIMARY KEY,
+ catalogueFk INT UNIQUE,
+ customerName VARCHAR(100),
+ email VARCHAR(100),
+ customerPhone VARCHAR(15),
+ message VARCHAR(255),
+ deliveryName VARCHAR(100),
+ address VARCHAR(200),
+ deliveryPhone VARCHAR(100),
+ isPaid BOOL NOT NULL DEFAULT FALSE,
+ payed DATETIME,
+ created TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ FOREIGN KEY (catalogueFk) REFERENCES catalogue(id) ON DELETE RESTRICT ON UPDATE CASCADE);
\ No newline at end of file
diff --git a/db/versions/10888-brownBirch/00-firstScript.sql b/db/versions/10888-brownBirch/00-firstScript.sql
new file mode 100644
index 000000000..7c8f96339
--- /dev/null
+++ b/db/versions/10888-brownBirch/00-firstScript.sql
@@ -0,0 +1,6 @@
+CREATE OR REPLACE DEFINER=`root`@`localhost`
+ SQL SECURITY DEFINER
+VIEW `vn2008`.`credit`AS
+ SELECT 1;
+
+GRANT SELECT ON TABLE vn2008.credit TO financialBoss;
diff --git a/db/versions/10889-redMedeola/00-firstScript.sql b/db/versions/10889-redMedeola/00-firstScript.sql
new file mode 100644
index 000000000..ecae0234f
--- /dev/null
+++ b/db/versions/10889-redMedeola/00-firstScript.sql
@@ -0,0 +1,24 @@
+-- Place your SQL code here
+CREATE TABLE IF NOT EXISTS `vn`.`mrwConfig` (
+ `id` INT auto_increment NULL,
+ `url` varchar(100) NULL,
+ `user` varchar(100) NULL,
+ `password` varchar(100) NULL,
+ `franchiseCode` varchar(100) NULL,
+ `subscriberCode` varchar(100) NULL,
+ CONSTRAINT mrwConfig_pk PRIMARY KEY (id)
+)
+ENGINE=InnoDB
+DEFAULT CHARSET=utf8mb3
+COLLATE=utf8mb3_unicode_ci;
+
+ALTER TABLE `vn`.`packingSite` ADD `hasNewLabelMrwMethod` BOOL NULL;
+
+INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
+ VALUES('MrwConfig', 'cancelShipment', 'WRITE', 'ALLOW', 'ROLE', 'employee');
+
+INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalType`,`principalId`)
+ VALUES ('MrwConfig','createShipment','WRITE','ALLOW','ROLE','employee');
+
+
+
diff --git a/db/versions/10891-chocolateRuscus/00-firstScript.sql b/db/versions/10891-chocolateRuscus/00-firstScript.sql
new file mode 100644
index 000000000..711850323
--- /dev/null
+++ b/db/versions/10891-chocolateRuscus/00-firstScript.sql
@@ -0,0 +1,6 @@
+ALTER TABLE vn.client DROP FOREIGN KEY tipos_de_cliente;
+ALTER TABLE vn.client CHANGE COLUMN clientTypeFk clientTypeFk__ INT NOT NULL DEFAULT 1 COMMENT '@deprecated 2024-02-20 refs #6784';
+ALTER TABLE vn.clientType CHANGE COLUMN id id__ INT NOT NULL COMMENT '@deprecated 2024-02-20 refs #6784';
+ALTER TABLE vn.clientType DROP PRIMARY KEY;
+ALTER TABLE vn.clientType ADD PRIMARY KEY (code);
+
diff --git a/db/versions/10892-yellowGerbera/00-firstScript.sql b/db/versions/10892-yellowGerbera/00-firstScript.sql
new file mode 100644
index 000000000..52dbdbee1
--- /dev/null
+++ b/db/versions/10892-yellowGerbera/00-firstScript.sql
@@ -0,0 +1,19 @@
+SET @isTriggerDisabled := TRUE;
+
+UPDATE vn.buy
+ SET packing = 1
+ WHERE packing IS NULL
+ OR packing <= 0;
+
+UPDATE vn.itemShelving
+ SET packing = 1
+ WHERE packing IS NULL
+ OR NOT packing;
+
+SET @isTriggerDisabled := FALSE;
+
+ALTER TABLE vn.buy MODIFY COLUMN packing int(11) NOT NULL DEFAULT 1 CHECK(packing > 0);
+ALTER TABLE vn.itemShelving MODIFY COLUMN packing int(11) NOT NULL DEFAULT 1 CHECK(packing > 0);
+
+-- Antes tenia '0=sin obligar 1=groping 2=packing' (groping → grouping)
+ALTER TABLE vn.buy MODIFY COLUMN groupingMode tinyint(4) DEFAULT 0 NOT NULL COMMENT '0=sin obligar 1=grouping 2=packing';
diff --git a/db/versions/10893-limeFern/00-sage.sql b/db/versions/10893-limeFern/00-sage.sql
new file mode 100644
index 000000000..d4c7e6221
--- /dev/null
+++ b/db/versions/10893-limeFern/00-sage.sql
@@ -0,0 +1,73 @@
+-- Auto-generated SQL script #202403061303
+UPDATE vn.company
+ SET companyCode=0
+ WHERE id=69;
+UPDATE vn.company
+ SET companyCode=1
+ WHERE id=442;
+UPDATE vn.company
+ SET companyCode=4
+ WHERE id=567;
+UPDATE vn.company
+ SET companyCode=2
+ WHERE id=791;
+UPDATE vn.company
+ SET companyCode=3
+ WHERE id=792;
+UPDATE vn.company
+ SET companyCode=5
+ WHERE id=965;
+UPDATE vn.company
+ SET companyCode=7
+ WHERE id=1381;
+UPDATE vn.company
+ SET companyCode=3
+ WHERE id=1463;
+UPDATE vn.company
+ SET companyCode=8
+ WHERE id=2142;
+UPDATE vn.company
+ SET companyCode=6
+ WHERE id=2393;
+UPDATE vn.company
+ SET companyCode=9
+ WHERE id=3869;
+
+-- Auto-generated SQL script #202403061311
+UPDATE vn.company
+ SET sage200Company=NULL
+ WHERE id=69;
+UPDATE vn.company
+ SET sage200Company=NULL
+ WHERE id=442;
+UPDATE vn.company
+ SET sage200Company=NULL
+ WHERE id=567;
+UPDATE vn.company
+ SET sage200Company=NULL
+ WHERE id=791;
+UPDATE vn.company
+ SET sage200Company=NULL
+ WHERE id=792;
+UPDATE vn.company
+ SET sage200Company=NULL
+ WHERE id=965;
+UPDATE vn.company
+ SET sage200Company=NULL
+ WHERE id=1381;
+UPDATE vn.company
+ SET sage200Company=NULL
+ WHERE id=1463;
+UPDATE vn.company
+ SET sage200Company=NULL
+ WHERE id=2142;
+UPDATE vn.company
+ SET sage200Company=NULL
+ WHERE id=2393;
+UPDATE vn.company
+ SET sage200Company=NULL
+ WHERE id=3869;
+
+
+ALTER TABLE vn.company CHANGE sage200Company sage200Company__ int(2) DEFAULT NULL NULL COMMENT '@deprecated 06/03/2024';
+ALTER TABLE vn.company MODIFY COLUMN sage200Company__ int(2) DEFAULT NULL NULL COMMENT '@deprecated 06/03/2024';
diff --git a/db/versions/10896-salmonOrchid/01-financialProductType.sql b/db/versions/10896-salmonOrchid/01-financialProductType.sql
new file mode 100644
index 000000000..c5d51e015
--- /dev/null
+++ b/db/versions/10896-salmonOrchid/01-financialProductType.sql
@@ -0,0 +1 @@
+ALTER TABLE IF EXISTS `vn2008`.`financialProductType` RENAME `vn`.`financialProductType`;
diff --git a/db/versions/10896-salmonOrchid/02-flight.sql b/db/versions/10896-salmonOrchid/02-flight.sql
new file mode 100644
index 000000000..657fa2aa1
--- /dev/null
+++ b/db/versions/10896-salmonOrchid/02-flight.sql
@@ -0,0 +1,8 @@
+ALTER TABLE IF EXISTS `vn2008`.`flight` RENAME `vn`.`flight`;
+
+ALTER TABLE IF EXISTS `vn`.`flight`
+CHANGE COLUMN IF EXISTS `flight_id` `id` varchar(10) NOT NULL,
+CHANGE COLUMN IF EXISTS `airline_id` `airlineFk` smallint(2) unsigned DEFAULT NULL,
+CHANGE COLUMN IF EXISTS `route` `flightPath` varchar(20) DEFAULT NULL,
+CHANGE COLUMN IF EXISTS `airport_out` `airportArrivalFk` varchar(3) NOT NULL,
+CHANGE COLUMN IF EXISTS `airport_in` `airportDepartureFk` varchar(3) NOT NULL;
\ No newline at end of file
diff --git a/db/versions/10896-salmonOrchid/03-gastos_resumen.sql b/db/versions/10896-salmonOrchid/03-gastos_resumen.sql
new file mode 100644
index 000000000..1f5101df5
--- /dev/null
+++ b/db/versions/10896-salmonOrchid/03-gastos_resumen.sql
@@ -0,0 +1,32 @@
+DELETE FROM vn2008.gastos_resumen
+ WHERE Id_Gasto IN (
+ SELECT DISTINCT g.Id_Gasto
+ FROM vn2008.gastos_resumen g
+ LEFT JOIN vn.expense e ON e.id = g.Id_Gasto COLLATE utf8mb3_general_ci
+ WHERE e.id IS NULL
+ );
+
+ALTER TABLE `vn2008`.`gastos_resumen` DROP FOREIGN KEY gastos_resumen_expense_FK;
+ALTER TABLE IF EXISTS `vn2008`.`gastos_resumen` RENAME `vn`.`expenseManual`;
+ALTER TABLE `vn`.`expenseManual`
+CHANGE COLUMN IF EXISTS `Id_Gasto` `expenseFk` varchar(10) NOT NULL,
+CHANGE COLUMN IF EXISTS `importe` `amount` decimal(10,2) DEFAULT NULL,
+CHANGE COLUMN IF EXISTS `empresa_id` `companyFk` int(11) NOT NULL;
+
+ALTER TABLE `vn`.`expenseManual` MODIFY COLUMN IF EXISTS expenseFk varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL;
+
+ALTER TABLE `vn`.`expenseManual` DROP PRIMARY KEY;
+
+ALTER TABLE `vn`.`expenseManual` MODIFY COLUMN companyFk int(10) unsigned NULL;
+
+ALTER TABLE `vn`.`expenseManual` ADD CONSTRAINT expenseManual_expense_FK FOREIGN KEY IF NOT EXISTS (expenseFk) REFERENCES vn.expense(id) ON DELETE CASCADE ON UPDATE CASCADE;
+
+UPDATE `vn`.`expenseManual`
+ SET companyFK= NULL
+ WHERE companyFk= 0;
+
+ALTER TABLE `vn`.`expenseManual` ADD CONSTRAINT expenseManual_company_FK FOREIGN KEY IF NOT EXISTS (companyFk) REFERENCES vn.company(id) ON DELETE CASCADE ON UPDATE CASCADE;
+
+ALTER TABLE `vn`.`expenseManual` ADD COLUMN id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY FIRST;
+
+ALTER TABLE `vn`.`expenseManual` ADD CONSTRAINT expenseManual_unique UNIQUE KEY IF NOT EXISTS (expenseFk,`year`,`month`,companyFk);
\ No newline at end of file
diff --git a/db/versions/10896-salmonOrchid/04-integra2.sql b/db/versions/10896-salmonOrchid/04-integra2.sql
new file mode 100644
index 000000000..663b28d78
--- /dev/null
+++ b/db/versions/10896-salmonOrchid/04-integra2.sql
@@ -0,0 +1,10 @@
+ALTER TABLE IF EXISTS `vn2008`.`integra2` RENAME `vn`.`integra2`;
+
+ALTER TABLE IF EXISTS `vn`.`integra2`
+CHANGE COLUMN IF EXISTS `postal_code` `postCode` varchar(10) NOT NULL,
+CHANGE COLUMN IF EXISTS `frequency` `frequency` decimal(10,2) DEFAULT NULL,
+CHANGE COLUMN IF EXISTS `warehouse_id` `warehouseFk` smallint(6) unsigned NOT NULL;
+
+ALTER TABLE IF EXISTS vn.integra2 ADD CONSTRAINT integra2_warehouse_FK
+FOREIGN KEY (warehouseFk) REFERENCES vn.warehouse(id) ON DELETE CASCADE ON UPDATE CASCADE;
+
diff --git a/db/versions/10896-salmonOrchid/05-integra2_province.sql b/db/versions/10896-salmonOrchid/05-integra2_province.sql
new file mode 100644
index 000000000..31f8f4156
--- /dev/null
+++ b/db/versions/10896-salmonOrchid/05-integra2_province.sql
@@ -0,0 +1,4 @@
+ALTER TABLE IF EXISTS `vn2008`.`integra2_province` RENAME `vn`.`integra2Province`;
+ALTER TABLE IF EXISTS `vn`.`integra2Province`
+CHANGE COLUMN IF EXISTS `franquicia` `franchise` varchar(65) NOT NULL,
+CHANGE COLUMN IF EXISTS `province_id` `provinceFk` smallint(6) unsigned NOT NULL;
diff --git a/db/versions/10896-salmonOrchid/06-intervalos__delete.sql b/db/versions/10896-salmonOrchid/06-intervalos__delete.sql
new file mode 100644
index 000000000..18d4f57ca
--- /dev/null
+++ b/db/versions/10896-salmonOrchid/06-intervalos__delete.sql
@@ -0,0 +1 @@
+DROP TABLE IF EXISTS vn2008.intervalos__;
\ No newline at end of file
diff --git a/db/versions/10896-salmonOrchid/10-mail_templates__delete.sql b/db/versions/10896-salmonOrchid/10-mail_templates__delete.sql
new file mode 100644
index 000000000..e30aae925
--- /dev/null
+++ b/db/versions/10896-salmonOrchid/10-mail_templates__delete.sql
@@ -0,0 +1 @@
+DROP TABLE IF EXISTS vn2008.mail_templates__;
diff --git a/db/versions/10896-salmonOrchid/12-ticket_location__delete.sql b/db/versions/10896-salmonOrchid/12-ticket_location__delete.sql
new file mode 100644
index 000000000..a7dbbfb95
--- /dev/null
+++ b/db/versions/10896-salmonOrchid/12-ticket_location__delete.sql
@@ -0,0 +1 @@
+DROP TABLE IF EXISTS vn2008.ticket_location__;
\ No newline at end of file
diff --git a/db/versions/10896-salmonOrchid/13-turn__delete.sql b/db/versions/10896-salmonOrchid/13-turn__delete.sql
new file mode 100644
index 000000000..7aa69e57d
--- /dev/null
+++ b/db/versions/10896-salmonOrchid/13-turn__delete.sql
@@ -0,0 +1 @@
+DROP TABLE IF EXISTS vn2008.turn__;
\ No newline at end of file
diff --git a/db/versions/10896-salmonOrchid/14-movement_label.sql b/db/versions/10896-salmonOrchid/14-movement_label.sql
new file mode 100644
index 000000000..194df6e1e
--- /dev/null
+++ b/db/versions/10896-salmonOrchid/14-movement_label.sql
@@ -0,0 +1,12 @@
+DROP TRIGGER IF EXISTS `vn2008`.`movement_label_afterUpdate`;
+
+ALTER TABLE vn2008.movement_label DROP FOREIGN KEY movement_label_ibfk_1;
+
+DROP VIEW IF EXISTS `vn`.`saleLabel`;
+
+ALTER TABLE IF EXISTS `vn2008`.`movement_label` RENAME `vn`.`saleLabel`;
+
+ALTER TABLE IF EXISTS `vn`.`saleLabel`
+CHANGE COLUMN IF EXISTS `Id_movimiento` `saleFk` int(11) NOT NULL;
+
+ALTER TABLE `vn`.`saleLabel` ADD CONSTRAINT saleLabel_sale_FK FOREIGN KEY (saleFk) REFERENCES vn.sale(id) ON DELETE CASCADE ON UPDATE CASCADE;
diff --git a/db/versions/10896-salmonOrchid/15-pago_sdc.sql b/db/versions/10896-salmonOrchid/15-pago_sdc.sql
new file mode 100644
index 000000000..1b63b9c54
--- /dev/null
+++ b/db/versions/10896-salmonOrchid/15-pago_sdc.sql
@@ -0,0 +1,11 @@
+DROP VIEW IF EXISTS `vn`.`exchangeInsurance`;
+
+ALTER TABLE IF EXISTS `vn2008`.`pago_sdc` RENAME `vn`.`exchangeInsurance`;
+
+ALTER TABLE IF EXISTS `vn`.`exchangeInsurance`
+CHANGE COLUMN IF EXISTS `pago_sdc_id` `id` int(11) NOT NULL AUTO_INCREMENT,
+CHANGE COLUMN IF EXISTS `importe` `amount` decimal(10,2) NOT NULL,
+CHANGE COLUMN IF EXISTS `fecha` `dated` date NOT NULL,
+CHANGE COLUMN IF EXISTS `vencimiento` `dueDated` date NOT NULL,
+CHANGE COLUMN IF EXISTS `entity_id` `entityFk` int(10) unsigned NOT NULL,
+CHANGE COLUMN IF EXISTS `empresa_id` `companyFk`int(10) unsigned NOT NULL DEFAULT 442;
diff --git a/db/versions/10896-salmonOrchid/25-warehouse_pickup.sql b/db/versions/10896-salmonOrchid/25-warehouse_pickup.sql
new file mode 100644
index 000000000..d6f2ae18d
--- /dev/null
+++ b/db/versions/10896-salmonOrchid/25-warehouse_pickup.sql
@@ -0,0 +1,7 @@
+ALTER TABLE IF EXISTS `vn2008`.`warehouse_pickup` RENAME `vn`.`warehousePickup`;
+
+ALTER TABLE IF EXISTS `vn`.`warehousePickup`
+CHANGE COLUMN IF EXISTS `warehouse_id` `warehouseFk` smallint(5) unsigned NOT NULL,
+CHANGE COLUMN IF EXISTS `agency_id` `agencyModeFk` int(11) DEFAULT NULL;
+
+ALTER TABLE `vn`.`warehousePickup` COMMENT='Agencia de recogida para cada almacén';
diff --git a/db/versions/10896-salmonOrchid/29-kk.sql b/db/versions/10896-salmonOrchid/29-kk.sql
new file mode 100644
index 000000000..201a1c806
--- /dev/null
+++ b/db/versions/10896-salmonOrchid/29-kk.sql
@@ -0,0 +1,155 @@
+ALTER TABLE IF EXISTS vn2008.template_bionic_component RENAME vn2008.template_bionic_component__;
+ALTER TABLE IF EXISTS vn2008.template_bionic_component__ COMMENT='refs #6372 @deprecated 2023-11-28;';
+
+ALTER TABLE IF EXISTS vn2008.template_bionic_lot RENAME vn2008.template_bionic_lot__;
+ALTER TABLE IF EXISTS vn2008.template_bionic_lot__ COMMENT='refs #6372 @deprecated 2023-11-28;';
+
+ALTER TABLE IF EXISTS vn2008.template_bionic_price RENAME vn2008.template_bionic_price__;
+ALTER TABLE IF EXISTS vn2008.template_bionic_price__ COMMENT='refs #6372 @deprecated 2023-11-28;';
+
+ALTER TABLE IF EXISTS vn2008.tmpNEWTARIFAS RENAME vn2008.tmpNEWTARIFAS__;
+ALTER TABLE IF EXISTS vn2008.tmpNEWTARIFAS__ COMMENT='refs #6372 @deprecated 2023-11-28;';
+
+ALTER TABLE IF EXISTS vn2008.unaryScanFilter RENAME vn2008.unaryScanFilter__;
+ALTER TABLE IF EXISTS vn2008.unaryScanFilter__ COMMENT='refs #6372 @deprecated 2023-11-28;';
+
+ALTER TABLE IF EXISTS vn2008.unary_source RENAME vn2008.unary_source__;
+ALTER TABLE IF EXISTS vn2008.unary_source__ COMMENT='refs #6372 @deprecated 2023-11-28;';
+
+ALTER TABLE IF EXISTS vn2008.viaxpress RENAME vn2008.viaxpress__;
+ALTER TABLE IF EXISTS vn2008.viaxpress__ COMMENT='refs #6372 @deprecated 2023-11-28;';
+
+ALTER TABLE IF EXISTS vn2008.warehouse_filtro RENAME vn2008.warehouse_filtro__;
+ALTER TABLE IF EXISTS vn2008.warehouse_filtro__ COMMENT='refs #6372 @deprecated 2023-11-28;';
+
+ALTER TABLE IF EXISTS vn2008.warehouse_group RENAME vn2008.warehouse_group__;
+ALTER TABLE IF EXISTS vn2008.warehouse_group__ COMMENT='refs #6372 @deprecated 2023-11-28;';
+
+ALTER TABLE IF EXISTS vn2008.warehouse_joined RENAME vn2008.warehouse_joined__;
+ALTER TABLE IF EXISTS vn2008.warehouse_joined__ COMMENT='refs #6372 @deprecated 2023-11-28;';
+
+ALTER TABLE IF EXISTS vn2008.warehouse_lc RENAME vn2008.warehouse_lc__;
+ALTER TABLE IF EXISTS vn2008.warehouse_lc__ COMMENT='refs #6372 @deprecated 2023-11-28;';
+
+ALTER TABLE IF EXISTS vn2008.wh_selection RENAME vn2008.wh_selection__;
+ALTER TABLE IF EXISTS vn2008.wh_selection__ COMMENT='refs #6372 @deprecated 2023-11-28;';
+
+ALTER TABLE IF EXISTS vn2008.trolley RENAME vn2008.trolley__;
+ALTER TABLE IF EXISTS vn2008.trolley__ COMMENT='refs #6372 @deprecated 2023-12-13;';
+
+ALTER TABLE IF EXISTS vn2008.zones RENAME vn2008.zones__;
+ALTER TABLE IF EXISTS vn2008.zones__ COMMENT='refs #6372 @deprecated 2023-12-13;';
+
+ALTER TABLE IF EXISTS vn2008.tblIVA RENAME vn2008.tblIVA__;
+ALTER TABLE IF EXISTS vn2008.tblIVA__ COMMENT='refs #6372 @deprecated 2023-12-13;';
+
+ALTER TABLE IF EXISTS vn2008.filtros RENAME vn2008.filtros__;
+ALTER TABLE IF EXISTS vn2008.filtros__ COMMENT='refs #6372 @deprecated 2023-11-21;';
+
+ALTER TABLE IF EXISTS vn2008.form_query RENAME vn2008.form_query__;
+ALTER TABLE IF EXISTS vn2008.form_query__ COMMENT='refs #6372 @deprecated 2023-11-21;';
+
+ALTER TABLE IF EXISTS vn2008.guillen RENAME vn2008.guillen__;
+ALTER TABLE IF EXISTS vn2008.guillen__ COMMENT='refs #6372 @deprecated 2023-11-28;';
+
+ALTER TABLE IF EXISTS vn2008.guillen_carry RENAME vn2008.guillen_carry__;
+ALTER TABLE IF EXISTS vn2008.guillen_carry__ COMMENT='refs #6372 @deprecated 2023-11-28;';
+
+ALTER TABLE IF EXISTS vn2008.integra2_escala RENAME vn2008.integra2_escala__;
+ALTER TABLE IF EXISTS vn2008.integra2_escala__ COMMENT='refs #6372 @deprecated 2023-11-28;';
+
+ALTER TABLE IF EXISTS vn2008.invoice_observation RENAME vn2008.invoice_observation__;
+ALTER TABLE IF EXISTS vn2008.invoice_observation__ COMMENT='refs #6372 @deprecated 2023-11-28;';
+
+ALTER TABLE IF EXISTS vn2008.nichos RENAME vn2008.nichos__;
+ALTER TABLE IF EXISTS vn2008.nichos__ COMMENT='refs #6372 @deprecated 2023-11-28;';
+
+ALTER TABLE IF EXISTS vn2008.payroll_bonificaciones RENAME vn2008.payroll_bonificaciones__;
+ALTER TABLE IF EXISTS vn2008.payroll_bonificaciones__ COMMENT='refs #6372 @deprecated 2023-11-28;';
+
+ALTER TABLE IF EXISTS vn2008.payroll_datos RENAME vn2008.payroll_datos__;
+ALTER TABLE IF EXISTS vn2008.payroll_datos__ COMMENT='refs #6372 @deprecated 2023-11-28;';
+
+ALTER TABLE IF EXISTS vn2008.payroll_embargos RENAME vn2008.payroll_embargos__;
+ALTER TABLE IF EXISTS vn2008.payroll_embargos__ COMMENT='refs #6372 @deprecated 2023-11-28;';
+
+ALTER TABLE IF EXISTS vn2008.payroll_tipobasess RENAME vn2008.payroll_tipobasess__;
+ALTER TABLE IF EXISTS vn2008.payroll_tipobasess__ COMMENT='refs #6372 @deprecated 2023-11-28;';
+
+ALTER TABLE IF EXISTS vn2008.preparation_exception RENAME vn2008.preparation_exception__;
+ALTER TABLE IF EXISTS vn2008.preparation_exception__ COMMENT='refs #6372 @deprecated 2023-11-28;';
+
+ALTER TABLE IF EXISTS vn2008.payrroll_apEmpresarial RENAME vn2008.payrroll_apEmpresarial__;
+ALTER TABLE IF EXISTS vn2008.payrroll_apEmpresarial__ COMMENT='refs #6372 @deprecated 2023-11-28;';
+
+ALTER TABLE IF EXISTS vn2008.rec_translator RENAME vn2008.rec_translator__;
+ALTER TABLE IF EXISTS vn2008.rec_translator__ COMMENT='refs #6372 @deprecated 2023-11-28;';
+
+ALTER TABLE IF EXISTS vn2008.recibida_agricola RENAME vn2008.recibida_agricola__;
+ALTER TABLE IF EXISTS vn2008.recibida_agricola__ COMMENT='refs #6372 @deprecated 2023-11-28;';
+
+ALTER TABLE IF EXISTS vn2008.rounding RENAME vn2008.rounding__;
+ALTER TABLE IF EXISTS vn2008.rounding__ COMMENT='refs #6372 @deprecated 2023-11-28;';
+
+ALTER TABLE IF EXISTS vn2008.scanTree RENAME vn2008.scanTree__;
+ALTER TABLE IF EXISTS vn2008.scanTree__ COMMENT='refs #6372 @deprecated 2023-11-28;';
+
+ALTER TABLE IF EXISTS vn2008.sort_merge_results_ernesto RENAME vn2008.sort_merge_results_ernesto__;
+ALTER TABLE IF EXISTS vn2008.sort_merge_results_ernesto__ COMMENT='refs #6372 @deprecated 2023-11-28;';
+
+ALTER TABLE IF EXISTS vn2008.route RENAME vn2008.route__;
+ALTER TABLE IF EXISTS vn2008.route__ COMMENT='refs #6372 @deprecated 2023-11-28;';
+
+ALTER TABLE IF EXISTS vn2008.travel_reserve RENAME vn2008.travel_reserve__;
+ALTER TABLE IF EXISTS vn2008.travel_reserve__ COMMENT='refs #6372 @deprecated 2023-12-13;';
+
+ALTER TABLE IF EXISTS vn2008.wks RENAME vn2008.wks__;
+ALTER TABLE IF EXISTS vn2008.wks__ COMMENT='refs #6372 @deprecated 2023-12-13;';
+
+ALTER TABLE IF EXISTS vn2008.unary RENAME vn2008.unary__;
+ALTER TABLE IF EXISTS vn2008.unary__ COMMENT='refs #6372 @deprecated 2023-12-13;';
+
+ALTER TABLE IF EXISTS vn2008.unary_scan RENAME vn2008.unary_scan__;
+ALTER TABLE IF EXISTS vn2008.unary_scan__ COMMENT='refs #6372 @deprecated 2023-12-13;';
+
+ALTER TABLE IF EXISTS vn2008.unary_scan_line RENAME vn2008.unary_scan_line__;
+ALTER TABLE IF EXISTS vn2008.unary_scan_line__ COMMENT='refs #6372 @deprecated 2023-12-13;';
+
+ALTER TABLE IF EXISTS vn2008.unary_scan_line_buy RENAME vn2008.unary_scan_line_buy__;
+ALTER TABLE IF EXISTS vn2008.unary_scan_line_buy__ COMMENT='refs #6372 @deprecated 2023-12-13;';
+
+ALTER TABLE IF EXISTS vn2008.unary_scan_line_expedition RENAME vn2008.unary_scan_line_expedition__;
+ALTER TABLE IF EXISTS vn2008.unary_scan_line_expedition__ COMMENT='refs #6372 @deprecated 2023-12-13;';
+
+ALTER TABLE IF EXISTS vn2008.widget RENAME vn2008.widget__;
+ALTER TABLE IF EXISTS vn2008.widget__ COMMENT='refs #6372 @deprecated 2023-12-13;';
+
+ALTER TABLE IF EXISTS vn2008.scan RENAME vn2008.scan__;
+ALTER TABLE IF EXISTS vn2008.scan__ COMMENT='refs #6372 @deprecated 2023-12-13;';
+
+ALTER TABLE IF EXISTS vn2008.scan_line RENAME vn2008.scan_line__;
+ALTER TABLE IF EXISTS vn2008.scan_line__ COMMENT='refs #6372 @deprecated 2023-12-13;';
+
+ALTER TABLE IF EXISTS vn2008.tipsa RENAME vn2008.tipsa__;
+ALTER TABLE IF EXISTS vn2008.tipsa__ COMMENT='refs #6372 @deprecated 2023-12-13;';
+
+ALTER TABLE IF EXISTS vn2008.payroll_basess RENAME vn2008.payroll_basess__;
+ALTER TABLE IF EXISTS vn2008.payroll_basess__ COMMENT='refs #6372 @deprecated 2023-12-13;';
+
+ALTER TABLE IF EXISTS vn2008.pago_sdc RENAME vn2008.pago_sdc__;
+ALTER TABLE IF EXISTS vn2008.pago_sdc__ COMMENT='refs #6372 @deprecated 2023-12-13;';
+
+ALTER TABLE IF EXISTS vn2008.transport RENAME vn2008.transport__;
+ALTER TABLE IF EXISTS vn2008.transport__ COMMENT='refs #6372 @deprecated 2023-12-13;';
+
+ALTER TABLE IF EXISTS vn2008.travel_pattern RENAME vn2008.travel_pattern__;
+ALTER TABLE IF EXISTS vn2008.travel_pattern__ COMMENT='refs #6372 @deprecated 2023-12-13;';
+
+ALTER TABLE IF EXISTS vn2008.jerarquia RENAME vn2008.jerarquia__;
+ALTER TABLE IF EXISTS vn2008.jerarquia__ COMMENT='refs #6372 @deprecated 2023-12-13;';
+
+ALTER TABLE IF EXISTS vn2008.language RENAME vn2008.language__;
+ALTER TABLE IF EXISTS vn2008.language__ COMMENT='refs #6372 @deprecated 2023-12-13;';
+
+ALTER TABLE IF EXISTS vn2008.link RENAME vn2008.link__;
+ALTER TABLE IF EXISTS vn2008.link__ COMMENT='refs #6372 @deprecated 2023-12-13;';
diff --git a/db/versions/10896-salmonOrchid/30-permissions.sql b/db/versions/10896-salmonOrchid/30-permissions.sql
new file mode 100644
index 000000000..fd7c6c58e
--- /dev/null
+++ b/db/versions/10896-salmonOrchid/30-permissions.sql
@@ -0,0 +1,32 @@
+-- flight
+CREATE OR REPLACE DEFINER=`root`@`localhost`
+ SQL SECURITY DEFINER
+VIEW `vn2008`.`flight` AS
+ SELECT 1;
+GRANT SELECT, INSERT, UPDATE ON TABLE vn2008.flight TO `logistic`;
+GRANT SELECT, INSERT, UPDATE ON TABLE vn.flight TO `logistic`;
+-- integra2_province
+CREATE OR REPLACE DEFINER=`root`@`localhost`
+ SQL SECURITY DEFINER
+VIEW `vn2008`.`integra2_province` AS
+ SELECT 1;
+GRANT SELECT ON TABLE vn2008.integra2_province TO `employee`;
+GRANT SELECT ON TABLE vn.integra2Province TO `employee`;
+-- link
+
+GRANT SELECT ON TABLE vn.company TO `administrative`;
+GRANT SELECT ON TABLE vn.company TO `hr`;
+
+-- warehouse_pickup
+CREATE OR REPLACE DEFINER=`root`@`localhost`
+ SQL SECURITY DEFINER
+VIEW `vn2008`.`warehouse_pickup` AS
+ SELECT 1;
+GRANT SELECT ON TABLE vn2008.warehouse_pickup TO `logistic`;
+GRANT SELECT ON TABLE vn.warehousePickup TO `logistic`;
+GRANT SELECT ON TABLE vn2008.warehouse_pickup TO `claimManager`;
+GRANT SELECT ON TABLE vn.warehousePickup TO `claimManager`;
+GRANT SELECT ON TABLE vn2008.warehouse_pickup TO `employee`;
+GRANT SELECT ON TABLE vn.warehousePickup TO `employee`;
+GRANT SELECT ON TABLE vn2008.warehouse_pickup TO `deliveryAssistant`;
+GRANT SELECT ON TABLE vn.warehousePickup TO `deliveryAssistant`;
diff --git a/db/versions/10898-workerActivity/00-table.sql b/db/versions/10898-workerActivity/00-table.sql
new file mode 100644
index 000000000..ec517b929
--- /dev/null
+++ b/db/versions/10898-workerActivity/00-table.sql
@@ -0,0 +1,13 @@
+-- Place your SQL code here
+CREATE TABLE vn.workerActivity (
+id INT PRIMARY KEY AUTO_INCREMENT,
+created TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+model ENUM('COM', 'ENT', 'TPV', 'ENC', 'LAB', 'ETI') NOT NULL,
+workerFk INT(10) UNSIGNED NOT NULL,
+event ENUM('open', 'close', 'insert', 'delete', 'update', 'refresh') NOT NULL,
+description VARCHAR(255) DEFAULT NULL,
+CONSTRAINT fk_workerActivity_worker FOREIGN KEY (workerFk)
+ REFERENCES vn.worker (id)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE
+);
\ No newline at end of file
diff --git a/db/versions/10903-pinkIvy/00-professionalCategoryAddCode.sql b/db/versions/10903-pinkIvy/00-professionalCategoryAddCode.sql
new file mode 100644
index 000000000..7caa42f32
--- /dev/null
+++ b/db/versions/10903-pinkIvy/00-professionalCategoryAddCode.sql
@@ -0,0 +1,6 @@
+ALTER TABLE vn.professionalCategory DROP COLUMN IF EXISTS code;
+ALTER TABLE IF EXISTS vn.professionalCategory ADD COLUMN code VARCHAR(25) DEFAULT NULL;
+
+UPDATE vn.professionalCategory
+ SET code = 'driverCE'
+ WHERE name = 'Conductor C + E';
\ No newline at end of file
diff --git a/db/versions/10905-grayIvy/00-firstScript.sql b/db/versions/10905-grayIvy/00-firstScript.sql
new file mode 100644
index 000000000..cca41cd48
--- /dev/null
+++ b/db/versions/10905-grayIvy/00-firstScript.sql
@@ -0,0 +1,36 @@
+USE vn;
+
+CREATE OR REPLACE TABLE vn.workerActivityType (
+ `code` varchar(20) NOT NULL,
+ `description` varchar(45) NOT NULL,
+ PRIMARY KEY (`code`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
+
+ALTER TABLE vn.department ADD workerActivityTypeFk varchar(20) NULL COMMENT 'Indica la actitividad que desempeña por defecto ese departamento';
+ALTER TABLE vn.department ADD CONSTRAINT department_workerActivityType_FK FOREIGN KEY (workerActivityTypeFk) REFERENCES vn.workerActivityType(code) ON DELETE CASCADE ON UPDATE CASCADE;
+
+
+
+INSERT INTO vn.workerActivityType (code, description) VALUES('ON_CHECKING', 'REVISION');
+INSERT INTO vn.workerActivityType (code, description) VALUES('PREVIOUS_CAM', 'CAMARA');
+INSERT INTO vn.workerActivityType (code, description) VALUES('PREVIOUS_ART', 'ARTIFICIAL');
+INSERT INTO vn.workerActivityType (code, description) VALUES('ON_PREPARATION', 'SACADO');
+INSERT INTO vn.workerActivityType (code, description) VALUES('PACKING', 'ENCAJADO');
+INSERT INTO vn.workerActivityType (code, description) VALUES('FIELD', 'CAMPOS');
+INSERT INTO vn.workerActivityType (code, description) VALUES('DELIVERY', 'REPARTO');
+INSERT INTO vn.workerActivityType (code, description) VALUES('STORAGE', 'ALMACENAJE');
+INSERT INTO vn.workerActivityType (code, description) VALUES('PALLETIZING', 'PALETIZADO');
+INSERT INTO vn.workerActivityType (code, description) VALUES('STOP', 'PARADA');
+
+
+INSERT INTO salix.ACL ( model, property, accessType, permission, principalType, principalId) VALUES('WorkerActivityType', '*', 'READ', 'ALLOW', 'ROLE', 'production');
+INSERT INTO salix.ACL ( model, property, accessType, permission, principalType, principalId) VALUES('WorkerActivity', '*', '*', 'ALLOW', 'ROLE', 'production');
+
+
+ALTER TABLE vn.workerActivity MODIFY COLUMN event enum('open','close','insert','delete','update','refresh') CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NULL;
+ALTER TABLE vn.workerActivity MODIFY COLUMN model enum('COM','ENT','TPV','ENC','LAB','ETI','APP') CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL;
+
+
+ALTER TABLE vn.workerActivity ADD workerActivityTypeFk varchar(20) NULL;
+ALTER TABLE vn.workerActivity ADD CONSTRAINT workerActivity_workerActivityType_FK FOREIGN KEY (workerActivityTypeFk) REFERENCES vn.workerActivityType(code) ON DELETE CASCADE ON UPDATE CASCADE;
+
diff --git a/db/versions/10906-limeIvy/00-firstScript.sql b/db/versions/10906-limeIvy/00-firstScript.sql
new file mode 100644
index 000000000..6ce187d20
--- /dev/null
+++ b/db/versions/10906-limeIvy/00-firstScript.sql
@@ -0,0 +1,6 @@
+ALTER TABLE vn.professionalCategory DROP COLUMN IF EXISTS code;
+ALTER TABLE IF EXISTS vn.professionalCategory ADD COLUMN code VARCHAR(25) UNIQUE DEFAULT NULL;
+
+UPDATE vn.professionalCategory
+ SET code = 'driverCE'
+ WHERE name = 'Conductor C + E';
\ No newline at end of file
diff --git a/db/versions/10908-blueAsparagus/00-createSupplierDms.sql b/db/versions/10908-blueAsparagus/00-createSupplierDms.sql
new file mode 100644
index 000000000..bc0a40f11
--- /dev/null
+++ b/db/versions/10908-blueAsparagus/00-createSupplierDms.sql
@@ -0,0 +1,25 @@
+DELETE FROM vn.supplierDms
+ WHERE dmsFk IN (
+ SELECT sd.dmsFk
+ FROM vn.supplierDms sd
+ LEFT JOIN vn.dms d ON d.id = sd.dmsFk
+ WHERE d.id IS NULL
+ );
+
+DELETE FROM vn.supplierDms
+ WHERE supplierFk IN (
+ SELECT sd.supplierFk
+ FROM vn.supplierDms sd
+ LEFT JOIN vn.supplier s ON s.id = sd.supplierFk
+ WHERE s.id IS NULL
+ );
+
+ALTER TABLE `vn`.`supplierDms`
+ MODIFY COLUMN supplierFk int(10) unsigned NOT NULL,
+ ADD editorFk INT UNSIGNED NULL,
+ ADD CONSTRAINT user_Fk FOREIGN KEY (editorFk) REFERENCES account.`user`(id),
+ ADD CONSTRAINT dms_Fk FOREIGN KEY (dmsFk) REFERENCES vn.dms(id) ON DELETE CASCADE ON UPDATE CASCADE,
+ ADD CONSTRAINT supplier_Fk FOREIGN KEY (supplierFk) REFERENCES vn.supplier(id) ON UPDATE CASCADE;
+
+ALTER TABLE `vn`.`supplierLog`
+ MODIFY COLUMN `changedModel` ENUM('Supplier','SupplierAddress','SupplierAccount','SupplierContact','SupplierDms') NOT NULL DEFAULT 'Supplier';
\ No newline at end of file
diff --git a/db/versions/10909-crimsonLaurel/00-firstScript.sql b/db/versions/10909-crimsonLaurel/00-firstScript.sql
new file mode 100644
index 000000000..58e679dff
--- /dev/null
+++ b/db/versions/10909-crimsonLaurel/00-firstScript.sql
@@ -0,0 +1,5 @@
+DELETE FROM vn.entryObservation
+ WHERE observationTypeFk IS NULL;
+
+ALTER TABLE vn.entryObservation
+ MODIFY COLUMN observationTypeFk tinyint(3) unsigned NOT NULL;
diff --git a/db/versions/10912-brownCataractarum/00-firstScript.sql b/db/versions/10912-brownCataractarum/00-firstScript.sql
new file mode 100644
index 000000000..51aea42a1
--- /dev/null
+++ b/db/versions/10912-brownCataractarum/00-firstScript.sql
@@ -0,0 +1,12 @@
+ALTER TABLE vn.country
+ MODIFY COLUMN code varchar(2) NOT NULL;
+
+ALTER TABLE vn.country
+ ADD CONSTRAINT country_unique UNIQUE KEY (code);
+
+ALTER TABLE vn.transitoryDuaUnified
+ ADD countryCodeFk varchar(2) DEFAULT 'EC' NOT NULL;
+
+ALTER TABLE vn.transitoryDuaUnified
+ ADD CONSTRAINT transitoryDuaUnified_country_FK FOREIGN KEY (countryCodeFk)
+ REFERENCES vn.country(code);
diff --git a/db/versions/10913-bronzeGalax/00-firstScript.sql b/db/versions/10913-bronzeGalax/00-firstScript.sql
new file mode 100644
index 000000000..aef0c8738
--- /dev/null
+++ b/db/versions/10913-bronzeGalax/00-firstScript.sql
@@ -0,0 +1,4 @@
+-- Place your SQL code here
+RENAME TABLE IF EXISTS vn.claimRma TO vn.claimRma__;
+ALTER TABLE IF EXISTS vn.claimRma__ COMMENT='kkeada el 2024-02-26 por Pablo';
+ALTER TABLE vn.claim CHANGE IF EXISTS rma rma__ varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL NULL;
diff --git a/db/versions/10914-aquaBirch/00-firstScript.sql b/db/versions/10914-aquaBirch/00-firstScript.sql
new file mode 100644
index 000000000..a182d5407
--- /dev/null
+++ b/db/versions/10914-aquaBirch/00-firstScript.sql
@@ -0,0 +1,6 @@
+-- Place your SQL code here
+ALTER TABLE IF EXISTS vn2008.dock__ RENAME vn2008.dock;
+ALTER TABLE IF EXISTS vn2008.dock COMMENT='';
+
+ALTER TABLE IF EXISTS vn2008.Tramos__ RENAME vn2008.Tramos;
+ALTER TABLE IF EXISTS vn2008.Tramos COMMENT='';
\ No newline at end of file
diff --git a/db/versions/10915-limeMastic/00-firstScript.sql b/db/versions/10915-limeMastic/00-firstScript.sql
new file mode 100644
index 000000000..be83a4984
--- /dev/null
+++ b/db/versions/10915-limeMastic/00-firstScript.sql
@@ -0,0 +1,2 @@
+DELETE IGNORE FROM bs.nightTask
+ WHERE `procedure` = 'clean_launcher';
diff --git a/db/versions/10918-wheatRose/00-firstScript.sql b/db/versions/10918-wheatRose/00-firstScript.sql
new file mode 100644
index 000000000..5d0fb1c32
--- /dev/null
+++ b/db/versions/10918-wheatRose/00-firstScript.sql
@@ -0,0 +1,2 @@
+DELETE FROM bs.nightTask
+ WHERE `procedure` = 'emailYesterdayPurchasesLauncher';
diff --git a/db/versions/10919-brownMoss/00-firstScript.sql b/db/versions/10919-brownMoss/00-firstScript.sql
new file mode 100644
index 000000000..640d2180a
--- /dev/null
+++ b/db/versions/10919-brownMoss/00-firstScript.sql
@@ -0,0 +1,3 @@
+-- Place your SQL code here
+
+
diff --git a/db/versions/10922-salmonCordyline/00-firstScript.sql b/db/versions/10922-salmonCordyline/00-firstScript.sql
new file mode 100644
index 000000000..37557d326
--- /dev/null
+++ b/db/versions/10922-salmonCordyline/00-firstScript.sql
@@ -0,0 +1 @@
+ALTER TABLE vn.warehouse AUTO_INCREMENT=92;
diff --git a/db/versions/10923-pinkOak/00-createParkingLog.sql b/db/versions/10923-pinkOak/00-createParkingLog.sql
new file mode 100644
index 000000000..f31f58196
--- /dev/null
+++ b/db/versions/10923-pinkOak/00-createParkingLog.sql
@@ -0,0 +1,60 @@
+CREATE OR REPLACE TABLE vn.parkingLog (
+
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+
+ `originFk` int(11) DEFAULT NULL,
+
+ `userFk` int(10) unsigned DEFAULT NULL,
+
+ `action` set('insert','update','delete','select') NOT NULL,
+
+ `creationDate` timestamp NULL DEFAULT current_timestamp(),
+
+ `description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
+
+ `changedModel` enum('Parking','SaleGroup','SaleGroupDetail') NOT NULL DEFAULT 'Parking',
+
+ `oldInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`oldInstance`)),
+
+ `newInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`newInstance`)),
+
+ `changedModelId` int(11) NOT NULL,
+
+ `changedModelValue` varchar(45) DEFAULT NULL,
+
+ PRIMARY KEY (`id`),
+
+ KEY `logParkinguserFk` (`userFk`),
+
+ KEY `parkingLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`),
+
+ KEY `parkingLog_originFk` (`originFk`,`creationDate`),
+
+ CONSTRAINT `parkingOriginFk` FOREIGN KEY (`originFk`) REFERENCES `parking` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
+
+ CONSTRAINT `parkingUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+
+) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
+
+ALTER TABLE vn.parking DROP COLUMN IF EXISTS editorFk;
+ALTER TABLE IF EXISTS vn.parking ADD COLUMN editorFk INT;
+
+ALTER TABLE vn.saleGroupDetail DROP COLUMN IF EXISTS editorFk;
+ALTER TABLE IF EXISTS vn.saleGroupDetail ADD COLUMN editorFk INT;
+
+
+ALTER TABLE vn.ticketLog
+ MODIFY COLUMN changedModel ENUM(
+ 'Ticket',
+ 'Sale',
+ 'TicketWeekly',
+ 'TicketTracking',
+ 'TicketService',
+ 'TicketRequest',
+ 'TicketRefund',
+ 'TicketPackaging',
+ 'TicketObservation',
+ 'TicketDms',
+ 'Expedition',
+ 'Sms'
+ ) NOT NULL DEFAULT 'Ticket';
diff --git a/db/versions/10923-pinkOak/01-aclParkingLog.sql b/db/versions/10923-pinkOak/01-aclParkingLog.sql
new file mode 100644
index 000000000..8f7e55d63
--- /dev/null
+++ b/db/versions/10923-pinkOak/01-aclParkingLog.sql
@@ -0,0 +1,2 @@
+INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
+ VALUES ('ParkingLog', '*', 'READ', 'ALLOW', 'ROLE', 'employee');
\ No newline at end of file
diff --git a/db/versions/10924-pinkCordyline/00-firstScript.sql b/db/versions/10924-pinkCordyline/00-firstScript.sql
new file mode 100644
index 000000000..1c6c1c0f8
--- /dev/null
+++ b/db/versions/10924-pinkCordyline/00-firstScript.sql
@@ -0,0 +1,31 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`balanceNestTree_addChild`()
+BEGIN
+ SELECT 1;
+END$$
+DELIMITER ;
+GRANT EXECUTE ON PROCEDURE vn.balanceNestTree_addChild TO adminBoss;
+
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`balanceNestTree_delete`()
+BEGIN
+ SELECT 1;
+END$$
+DELIMITER ;
+GRANT EXECUTE ON PROCEDURE vn.balanceNestTree_delete TO adminBoss;
+
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`balanceNestTree_move`()
+BEGIN
+ SELECT 1;
+END$$
+DELIMITER ;
+GRANT EXECUTE ON PROCEDURE vn.balanceNestTree_move TO adminBoss;
+
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`payment_add`()
+BEGIN
+ SELECT 1;
+END$$
+DELIMITER ;
+GRANT EXECUTE ON PROCEDURE vn.payment_add TO financial;
diff --git a/db/versions/10925-orangeLaurel/00-firstScript.sql b/db/versions/10925-orangeLaurel/00-firstScript.sql
new file mode 100644
index 000000000..049627082
--- /dev/null
+++ b/db/versions/10925-orangeLaurel/00-firstScript.sql
@@ -0,0 +1,15 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`confection_controlSource`()
+BEGIN
+ SELECT 1;
+END$$
+DELIMITER ;
+GRANT EXECUTE ON PROCEDURE vn.confection_controlSource TO handmadeBoss, productionAssi, artificialBoss;
+
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`remittance_calc`()
+BEGIN
+ SELECT 1;
+END$$
+DELIMITER ;
+GRANT EXECUTE ON PROCEDURE vn.remittance_calc TO financial;
\ No newline at end of file
diff --git a/db/versions/10926-limeFern/00-refactorClaimState.sql b/db/versions/10926-limeFern/00-refactorClaimState.sql
new file mode 100644
index 000000000..bb2dc349a
--- /dev/null
+++ b/db/versions/10926-limeFern/00-refactorClaimState.sql
@@ -0,0 +1,8 @@
+UPDATE vn.claim c
+ JOIN vn.claimState cs ON cs.id = c.claimStateFk
+ JOIN vn.claimState ns ON ns.code = 'resolved'
+ SET c.claimStateFk = ns.id
+ WHERE cs.code IN ('managed', 'mana', 'lack', 'relocation');
+
+DELETE FROM vn.claimState
+ WHERE code IN ('managed', 'mana', 'lack', 'relocation');
diff --git a/db/versions/10928-orangeEucalyptus/00-firstScript.sql b/db/versions/10928-orangeEucalyptus/00-firstScript.sql
new file mode 100644
index 000000000..58d3605de
--- /dev/null
+++ b/db/versions/10928-orangeEucalyptus/00-firstScript.sql
@@ -0,0 +1,5 @@
+REVOKE SELECT ON TABLE vn.bank FROM administrative, hr;
+GRANT SELECT ON TABLE vn.accounting TO administrative, hr;
+UPDATE salix.ACL
+ SET model = 'Accounting'
+ WHERE model = 'Bank';
diff --git a/db/versions/10929-orangeAnthurium/00-firstScript.sql b/db/versions/10929-orangeAnthurium/00-firstScript.sql
new file mode 100644
index 000000000..299ac63c7
--- /dev/null
+++ b/db/versions/10929-orangeAnthurium/00-firstScript.sql
@@ -0,0 +1,2 @@
+-- Place your SQL code here
+ALTER TABLE dipole.expedition_PrintOut MODIFY COLUMN street varchar(42) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT ' ' NOT NULL;
\ No newline at end of file
diff --git a/db/versions/10930-wheatDendro/00-firstScript.sql b/db/versions/10930-wheatDendro/00-firstScript.sql
new file mode 100644
index 000000000..167c38f70
--- /dev/null
+++ b/db/versions/10930-wheatDendro/00-firstScript.sql
@@ -0,0 +1,3 @@
+-- Place your SQL code here
+ALTER TABLE IF EXISTS vn.flight ADD CONSTRAINT flight_airline_FK FOREIGN KEY (airlineFk)
+ REFERENCES vn.airline(id) ON DELETE CASCADE ON UPDATE CASCADE;
\ No newline at end of file
diff --git a/db/versions/10930-wheatDendro/01-Tramos.sql b/db/versions/10930-wheatDendro/01-Tramos.sql
new file mode 100644
index 000000000..595aa5dcb
--- /dev/null
+++ b/db/versions/10930-wheatDendro/01-Tramos.sql
@@ -0,0 +1,5 @@
+-- Place your SQL code here
+ALTER TABLE IF EXISTS `vn2008`.`Tramos` RENAME `vn`.`timeSlots`;
+
+ALTER TABLE IF EXISTS `vn`.`timeSlots`
+CHANGE COLUMN IF EXISTS `Tramo` `section` time NOT NULL;
\ No newline at end of file
diff --git a/db/versions/10930-wheatDendro/02-dock.sql b/db/versions/10930-wheatDendro/02-dock.sql
new file mode 100644
index 000000000..acce9f37c
--- /dev/null
+++ b/db/versions/10930-wheatDendro/02-dock.sql
@@ -0,0 +1,3 @@
+-- Place your SQL code here
+ALTER TABLE IF EXISTS `vn2008`.`dock` RENAME `vn2008`.`dock__`;
+ALTER TABLE IF EXISTS vn2008.dock__ COMMENT='refs #6371 deprecated 2024-03-05';
\ No newline at end of file
diff --git a/db/versions/10930-wheatDendro/03-Proveedores_cargueras.sql b/db/versions/10930-wheatDendro/03-Proveedores_cargueras.sql
new file mode 100644
index 000000000..148174215
--- /dev/null
+++ b/db/versions/10930-wheatDendro/03-Proveedores_cargueras.sql
@@ -0,0 +1,5 @@
+-- Place your SQL code here
+ALTER TABLE IF EXISTS `vn2008`.`Proveedores_cargueras` RENAME `vn`.`supplierFreight`;
+
+ALTER TABLE IF EXISTS `vn`.`supplierFreight`
+CHANGE COLUMN IF EXISTS `Id_Proveedor` `supplierFk` int(10) unsigned NOT NULL;
\ No newline at end of file
diff --git a/db/versions/10930-wheatDendro/04-payroll_employee.sql b/db/versions/10930-wheatDendro/04-payroll_employee.sql
new file mode 100644
index 000000000..c346fbf8d
--- /dev/null
+++ b/db/versions/10930-wheatDendro/04-payroll_employee.sql
@@ -0,0 +1,13 @@
+-- Place your SQL code here
+ALTER TABLE IF EXISTS `vn2008`.`payroll_employee` RENAME `vn`.`payrollWorker`;
+
+ALTER TABLE IF EXISTS `vn`.`payrollWorker`
+CHANGE COLUMN IF EXISTS `CodTrabajador` `workerFkA3` int(11) NOT NULL COMMENT 'Columna que hace referencia a A3.',
+CHANGE COLUMN IF EXISTS `nss` `nss__` varchar(23) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024',
+CHANGE COLUMN IF EXISTS `codpuesto` `codpuesto__` int(10) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024',
+CHANGE COLUMN IF EXISTS `codempresa` `companyFkA3` int(10) NOT NULL COMMENT 'Columna que hace referencia a A3.',
+CHANGE COLUMN IF EXISTS `codcontrato` `codcontrato__` int(10) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024',
+CHANGE COLUMN IF EXISTS `FAntiguedad` `FAntiguedad__` date NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024',
+CHANGE COLUMN IF EXISTS `grupotarifa` `grupotarifa__` int(10) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024',
+CHANGE COLUMN IF EXISTS `codcategoria` `codcategoria__` int(10) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024',
+CHANGE COLUMN IF EXISTS `ContratoTemporal` `ContratoTemporal__` tinyint(1) NOT NULL DEFAULT 0 COMMENT '@Deprecated refs #6738 15/03/2024';
\ No newline at end of file
diff --git a/db/versions/10930-wheatDendro/05-payroll_centros.sql b/db/versions/10930-wheatDendro/05-payroll_centros.sql
new file mode 100644
index 000000000..4911c8707
--- /dev/null
+++ b/db/versions/10930-wheatDendro/05-payroll_centros.sql
@@ -0,0 +1,13 @@
+-- Place your SQL code here
+ALTER TABLE IF EXISTS `vn2008`.`payroll_centros` RENAME `vn`.`payrollWorkCenter`;
+
+ALTER TABLE IF EXISTS `vn`.`payrollWorkCenter`
+CHANGE COLUMN IF EXISTS `cod_centro` `workCenterFkA3` int(11) NOT NULL COMMENT 'Columna que hace referencia a A3.',
+CHANGE COLUMN IF EXISTS `Centro` `Centro__` varchar(255) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024',
+CHANGE COLUMN IF EXISTS `nss_cotizacion` `nss_cotizacion__` varchar(15) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024',
+CHANGE COLUMN IF EXISTS `domicilio` `domicilio__` varchar(255) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024',
+CHANGE COLUMN IF EXISTS `poblacion` `poblacion__` varchar(45) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024',
+CHANGE COLUMN IF EXISTS `cp` `cp__` varchar(5) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024',
+CHANGE COLUMN IF EXISTS `empresa_id` `empresa_id__` int(10) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024',
+CHANGE COLUMN IF EXISTS `codempresa` `companyFkA3` int(11) DEFAULT NULL COMMENT 'Columna que hace referencia a A3.';
+;
\ No newline at end of file
diff --git a/db/versions/10930-wheatDendro/06-payroll_conceptos.sql b/db/versions/10930-wheatDendro/06-payroll_conceptos.sql
new file mode 100644
index 000000000..1803dc2a3
--- /dev/null
+++ b/db/versions/10930-wheatDendro/06-payroll_conceptos.sql
@@ -0,0 +1,6 @@
+-- Place your SQL code here
+ALTER TABLE IF EXISTS `vn2008`.`payroll_conceptos` RENAME `vn`.`payrollComponent`;
+
+ALTER TABLE IF EXISTS `vn`.`payrollComponent`
+CHANGE COLUMN IF EXISTS `conceptoid` `id` int(11) NOT NULL,
+CHANGE COLUMN IF EXISTS `concepto` `name` varchar(255) DEFAULT NULL;
\ No newline at end of file
diff --git a/db/versions/10930-wheatDendro/07-Permisos.sql b/db/versions/10930-wheatDendro/07-Permisos.sql
new file mode 100644
index 000000000..5a3dc1413
--- /dev/null
+++ b/db/versions/10930-wheatDendro/07-Permisos.sql
@@ -0,0 +1,40 @@
+CREATE OR REPLACE DEFINER=`root`@`localhost`
+ SQL SECURITY DEFINER
+ VIEW `vn2008`.`Tramos` AS
+SELECT 1;
+
+GRANT SELECT ON TABLE vn2008.Tramos TO `employee`;
+GRANT SELECT ON TABLE vn.timeSlots TO `employee`;
+
+CREATE OR REPLACE DEFINER=`root`@`localhost`
+ SQL SECURITY DEFINER
+ VIEW `vn2008`.`Proveedores_cargueras` AS
+SELECT 1;
+
+GRANT SELECT ON TABLE vn2008.Proveedores_cargueras TO `buyer`;
+GRANT SELECT ON TABLE vn.supplierFreight TO `buyer`;
+
+CREATE OR REPLACE DEFINER=`root`@`localhost`
+ SQL SECURITY DEFINER
+ VIEW `vn2008`.`payroll_employee` AS
+SELECT 1;
+
+GRANT SELECT,INSERT ON TABLE vn2008.payroll_employee TO `hr`;
+GRANT SELECT,INSERT ON TABLE vn.payrollWorker TO `hr`;
+
+
+CREATE OR REPLACE DEFINER=`root`@`localhost`
+ SQL SECURITY DEFINER
+ VIEW `vn2008`.`payroll_centros` AS
+SELECT 1;
+
+GRANT SELECT ON TABLE vn2008.payroll_centros TO `hr`;
+GRANT SELECT ON TABLE vn.payrollWorkCenter TO `hr`;
+
+CREATE OR REPLACE DEFINER=`root`@`localhost`
+ SQL SECURITY DEFINER
+ VIEW `vn2008`.`payroll_conceptos` AS
+SELECT 1;
+
+GRANT SELECT,UPDATE ON TABLE vn2008.payroll_conceptos TO `hr`;
+GRANT SELECT,UPDATE ON TABLE vn.payrollComponent TO `hr`;
\ No newline at end of file
diff --git a/db/versions/10932-azureEucalyptus/00-firstScript.sql b/db/versions/10932-azureEucalyptus/00-firstScript.sql
new file mode 100644
index 000000000..399819cc4
--- /dev/null
+++ b/db/versions/10932-azureEucalyptus/00-firstScript.sql
@@ -0,0 +1,22 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`multipleInventoryHistory`(
+ vItemFk INT)
+BEGIN
+ DECLARE vDateInventory DATETIME;
+ SELECT inventoried INTO vDateInventory FROM config;
+
+END$$
+DELIMITER ;
+
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`absoluteInventoryHistory`(
+ vItemFk INT, vWarehouse INT, vDate DATETIME)
+BEGIN
+ DECLARE vCalculatedInventory INT;
+ SET vCalculatedInventory = 0;
+
+END$$
+DELIMITER ;
+
+GRANT EXECUTE ON PROCEDURE vn.absoluteInventoryHistory TO buyer;
+GRANT EXECUTE ON PROCEDURE vn.multipleInventoryHistory TO buyer;
diff --git a/db/versions/10940-aquaLilium/00-firstScript.sql b/db/versions/10940-aquaLilium/00-firstScript.sql
new file mode 100644
index 000000000..fb4fa33ff
--- /dev/null
+++ b/db/versions/10940-aquaLilium/00-firstScript.sql
@@ -0,0 +1,8 @@
+
+ ALTER TABLE vn.department
+ ADD COLUMN pbxQueue varchar(128) CHARACTER
+ SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL NULL;
+
+ ALTER TABLE vn.department
+ ADD CONSTRAINT department_queue_FK
+ FOREIGN KEY (pbxQueue) REFERENCES pbx.queue(name) ON DELETE RESTRICT ON UPDATE CASCADE;
diff --git a/db/versions/10941-limePaniculata/00-restoreVn2008Jerarquia.sql b/db/versions/10941-limePaniculata/00-restoreVn2008Jerarquia.sql
new file mode 100644
index 000000000..3f6a52bef
--- /dev/null
+++ b/db/versions/10941-limePaniculata/00-restoreVn2008Jerarquia.sql
@@ -0,0 +1 @@
+ALTER TABLE IF EXISTS vn2008.jerarquia__ RENAME vn2008.jerarquia;
diff --git a/db/versions/10946-blueChrysanthemum/00-firstScript.sql b/db/versions/10946-blueChrysanthemum/00-firstScript.sql
new file mode 100644
index 000000000..c73903f65
--- /dev/null
+++ b/db/versions/10946-blueChrysanthemum/00-firstScript.sql
@@ -0,0 +1,4 @@
+ALTER TABLE IF EXISTS vn2008.unary_scan RENAME vn2008.unary_scan__;
+ALTER TABLE IF EXISTS vn2008.unary_scan_line RENAME vn2008.unary_scan_line__;
+ALTER TABLE IF EXISTS vn2008.unary_scan_line_buy RENAME vn2008.unary_scan_line_buy__;
+ALTER TABLE IF EXISTS vn2008.unary_scan_line_expedition RENAME vn2008.unary_scan_line_expedition__;
diff --git a/db/versions/10949-limeLaurel/00-firstScript.sql b/db/versions/10949-limeLaurel/00-firstScript.sql
new file mode 100644
index 000000000..cc0bcc96b
--- /dev/null
+++ b/db/versions/10949-limeLaurel/00-firstScript.sql
@@ -0,0 +1,15 @@
+ INSERT INTO util.notification ( name, description)
+ SELECT 'invoice-ticket-closure',
+ 'Tickets not invoiced during the nightly closure ticket process';
+
+ SET @notificationFk =LAST_INSERT_ID();
+
+ INSERT IGNORE INTO util.notificationAcl (notificationFk, roleFk)
+ SELECT @notificationFk,id
+ FROM account.role
+ WHERE name ='administrative';
+
+ INSERT IGNORE INTO util.notificationSubscription (notificationFk, userFk)
+ SELECT @notificationFk, id
+ FROM account.`user`
+ WHERE `name` = 'admon';
diff --git a/db/versions/10953-redChico/00-account.sql b/db/versions/10953-redChico/00-account.sql
new file mode 100644
index 000000000..e6944a686
--- /dev/null
+++ b/db/versions/10953-redChico/00-account.sql
@@ -0,0 +1,23 @@
+-- account.accountConfig
+ALTER TABLE account.accountConfig MODIFY COLUMN id tinyint(3) unsigned NOT NULL;
+ALTER TABLE account.accountConfig ADD CONSTRAINT accountConfig_check CHECK (id = 1);
+
+-- account.ldapConfig
+ALTER TABLE account.ldapConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE account.ldapConfig ADD CONSTRAINT ldapConfig_check CHECK (id = 1);
+
+-- account.mailConfig
+ALTER TABLE account.mailConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE account.mailConfig ADD CONSTRAINT mailConfig_check CHECK (id = 1);
+
+-- account.roleConfig
+ALTER TABLE account.roleConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE account.roleConfig ADD CONSTRAINT roleConfig_check CHECK (id = 1);
+
+-- account.sambaConfig
+ALTER TABLE account.sambaConfig MODIFY COLUMN id tinyint(3) unsigned NOT NULL;
+ALTER TABLE account.sambaConfig ADD CONSTRAINT sambaConfig_check CHECK (id = 1);
+
+-- account.userConfig
+ALTER TABLE account.userConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE account.userConfig ADD CONSTRAINT userConfig_check CHECK (id = 1);
diff --git a/db/versions/10953-redChico/01-bs.sql b/db/versions/10953-redChico/01-bs.sql
new file mode 100644
index 000000000..e451c8205
--- /dev/null
+++ b/db/versions/10953-redChico/01-bs.sql
@@ -0,0 +1,7 @@
+-- bs.nightTaskConfig
+ALTER TABLE bs.nightTaskConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE bs.nightTaskConfig ADD CONSTRAINT nightTaskConfig_check CHECK (id = 1);
+
+-- bs.workerProductivityConfig
+ALTER TABLE bs.workerProductivityConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE bs.workerProductivityConfig ADD CONSTRAINT workerProductivityConfig_check CHECK (id = 1);
diff --git a/db/versions/10953-redChico/02-edi.sql b/db/versions/10953-redChico/02-edi.sql
new file mode 100644
index 000000000..e97cfcec8
--- /dev/null
+++ b/db/versions/10953-redChico/02-edi.sql
@@ -0,0 +1,15 @@
+-- edi.exchangeConfig
+ALTER TABLE edi.exchangeConfig MODIFY COLUMN id tinyint(3) unsigned NOT NULL;
+ALTER TABLE edi.exchangeConfig ADD CONSTRAINT exchangeConfig_check CHECK (id = 1);
+
+-- edi.ftpConfig
+ALTER TABLE edi.ftpConfig MODIFY COLUMN id tinyint(3) unsigned NOT NULL;
+ALTER TABLE edi.ftpConfig ADD CONSTRAINT ftpConfig_check CHECK (id = 1);
+
+-- edi.imapConfig (Tiene más de 1 registro en producción)
+-- ALTER TABLE edi.imapConfig MODIFY COLUMN id tinyint(3) unsigned NOT NULL;
+-- ALTER TABLE edi.imapConfig ADD CONSTRAINT imapConfig_check CHECK (id = 1);
+
+-- edi.offerRefreshConfig
+ALTER TABLE edi.offerRefreshConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE edi.offerRefreshConfig ADD CONSTRAINT offerRefreshConfig_check CHECK (id = 1);
\ No newline at end of file
diff --git a/db/versions/10953-redChico/03-hedera.sql b/db/versions/10953-redChico/03-hedera.sql
new file mode 100644
index 000000000..3c86fb593
--- /dev/null
+++ b/db/versions/10953-redChico/03-hedera.sql
@@ -0,0 +1,27 @@
+-- hedera.config
+ALTER TABLE hedera.config MODIFY COLUMN id tinyint(3) unsigned NOT NULL;
+ALTER TABLE hedera.config ADD CONSTRAINT config_check CHECK (id = 1);
+
+-- hedera.imageConfig
+ALTER TABLE hedera.imageConfig MODIFY COLUMN id tinyint(3) unsigned NOT NULL;
+ALTER TABLE hedera.imageConfig ADD CONSTRAINT imageConfig_check CHECK (id = 1);
+
+-- hedera.mailConfig
+ALTER TABLE hedera.mailConfig MODIFY COLUMN id tinyint(3) unsigned NOT NULL;
+ALTER TABLE hedera.mailConfig ADD CONSTRAINT mailConfig_check CHECK (id = 1);
+
+-- hedera.orderConfig
+ALTER TABLE hedera.orderConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE hedera.orderConfig ADD CONSTRAINT orderConfig_check CHECK (id = 1);
+
+-- hedera.shelfConfig (Tiene más de 1 registro en producción)
+-- ALTER TABLE hedera.shelfConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+-- ALTER TABLE hedera.shelfConfig ADD CONSTRAINT shelfConfig_check CHECK (id = 1);
+
+-- hedera.tpvConfig
+ALTER TABLE hedera.tpvConfig MODIFY COLUMN id tinyint(3) unsigned NOT NULL;
+ALTER TABLE hedera.tpvConfig ADD CONSTRAINT tpvConfig_check CHECK (id = 1);
+
+-- hedera.tpvImapConfig
+ALTER TABLE hedera.tpvImapConfig MODIFY COLUMN id tinyint(3) unsigned NOT NULL;
+ALTER TABLE hedera.tpvImapConfig ADD CONSTRAINT tpvImapConfig_check CHECK (id = 1);
diff --git a/db/versions/10953-redChico/04-pbx.sql b/db/versions/10953-redChico/04-pbx.sql
new file mode 100644
index 000000000..49f4172c4
--- /dev/null
+++ b/db/versions/10953-redChico/04-pbx.sql
@@ -0,0 +1,15 @@
+-- pbx.config
+ALTER TABLE pbx.config MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE pbx.config ADD CONSTRAINT config_check CHECK (id = 1);
+
+-- pbx.followmeConfig
+ALTER TABLE pbx.followmeConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE pbx.followmeConfig ADD CONSTRAINT followmeConfig_check CHECK (id = 1);
+
+-- pbx.queueConfig (Tiene más de 1 registro en producción)
+-- ALTER TABLE pbx.queueConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+-- ALTER TABLE pbx.queueConfig ADD CONSTRAINT queueConfig_check CHECK (id = 1);
+
+-- pbx.sipConfig
+ALTER TABLE pbx.sipConfig MODIFY COLUMN id mediumint(8) unsigned NOT NULL;
+ALTER TABLE pbx.sipConfig ADD CONSTRAINT sipConfig_check CHECK (id = 1);
diff --git a/db/versions/10953-redChico/05-sage.sql b/db/versions/10953-redChico/05-sage.sql
new file mode 100644
index 000000000..ee60f5f7d
--- /dev/null
+++ b/db/versions/10953-redChico/05-sage.sql
@@ -0,0 +1,3 @@
+-- sage.config
+ALTER TABLE sage.config MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE sage.config ADD CONSTRAINT config_check CHECK (id = 1);
diff --git a/db/versions/10953-redChico/06-salix.sql b/db/versions/10953-redChico/06-salix.sql
new file mode 100644
index 000000000..d6a248f0d
--- /dev/null
+++ b/db/versions/10953-redChico/06-salix.sql
@@ -0,0 +1,7 @@
+-- salix.accessTokenConfig
+ALTER TABLE salix.accessTokenConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE salix.accessTokenConfig ADD CONSTRAINT accessTokenConfig_check CHECK (id = 1);
+
+-- salix.printConfig
+ALTER TABLE salix.printConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE salix.printConfig ADD CONSTRAINT printConfig_check CHECK (id = 1);
diff --git a/db/versions/10953-redChico/06-srt.sql b/db/versions/10953-redChico/06-srt.sql
new file mode 100644
index 000000000..53000eee6
--- /dev/null
+++ b/db/versions/10953-redChico/06-srt.sql
@@ -0,0 +1,3 @@
+-- srt.config
+ALTER TABLE srt.config MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE srt.config ADD CONSTRAINT config_check CHECK (id = 1);
diff --git a/db/versions/10953-redChico/07-util.sql b/db/versions/10953-redChico/07-util.sql
new file mode 100644
index 000000000..152dce3d1
--- /dev/null
+++ b/db/versions/10953-redChico/07-util.sql
@@ -0,0 +1,11 @@
+-- util.config
+ALTER TABLE util.config MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE util.config ADD CONSTRAINT config_check CHECK (id = 1);
+
+-- util.notificationConfig
+ALTER TABLE util.notificationConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE util.notificationConfig ADD CONSTRAINT notificationConfig_check CHECK (id = 1);
+
+-- util.versionConfig
+ALTER TABLE util.versionConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE util.versionConfig ADD CONSTRAINT versionConfig_check CHECK (id = 1);
diff --git a/db/versions/10953-redChico/08-vn.sql b/db/versions/10953-redChico/08-vn.sql
new file mode 100644
index 000000000..14bd3b13f
--- /dev/null
+++ b/db/versions/10953-redChico/08-vn.sql
@@ -0,0 +1,87 @@
+-- vn.accountingConfig
+ALTER TABLE vn.accountingConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.accountingConfig ADD CONSTRAINT accountingConfig_check CHECK (id = 1);
+
+-- vn.auctionConfig
+ALTER TABLE vn.auctionConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.auctionConfig ADD CONSTRAINT auctionConfig_check CHECK (id = 1);
+
+-- vn.autoRadioConfig
+ALTER TABLE vn.autoRadioConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.autoRadioConfig ADD CONSTRAINT autoRadioConfig_check CHECK (id = 1);
+
+-- vn.bankEntityConfig
+ALTER TABLE vn.bankEntityConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.bankEntityConfig ADD CONSTRAINT bankEntityConfig_check CHECK (id = 1);
+
+-- vn.bionicConfig
+ALTER TABLE vn.bionicConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.bionicConfig ADD CONSTRAINT bionicConfig_check CHECK (id = 1);
+
+-- vn.buyConfig
+ALTER TABLE vn.buyConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.buyConfig ADD CONSTRAINT buyConfig_check CHECK (id = 1);
+
+-- vn.chatConfig
+ALTER TABLE vn.chatConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.chatConfig ADD CONSTRAINT chatConfig_check CHECK (id = 1);
+
+-- vn.claimConfig
+ALTER TABLE vn.claimConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.claimConfig ADD CONSTRAINT claimConfig_check CHECK (id = 1);
+
+-- vn.clientConfig
+ALTER TABLE vn.clientConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.clientConfig ADD CONSTRAINT clientConfig_check CHECK (id = 1);
+
+-- vn.comparativeAddConfig
+ALTER TABLE vn.comparativeAddConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.comparativeAddConfig ADD CONSTRAINT comparativeAddConfig_check CHECK (id = 1);
+
+-- vn.comparativeConfig
+ALTER TABLE vn.comparativeConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.comparativeConfig ADD CONSTRAINT comparativeConfig_check CHECK (id = 1);
+
+-- vn.config
+ALTER TABLE vn.config MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.config ADD CONSTRAINT config_check CHECK (id = 1);
+
+-- vn.conveyorConfig (Tiene más de 1 registro en producción)
+-- ALTER TABLE vn.conveyorConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+-- ALTER TABLE vn.conveyorConfig ADD CONSTRAINT conveyorConfig_check CHECK (id = 1);
+
+-- vn.deviceProductionConfig
+ALTER TABLE vn.deviceProductionConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.deviceProductionConfig ADD CONSTRAINT deviceProductionConfig_check CHECK (id = 1);
+
+-- vn.docuwareConfig
+ALTER TABLE vn.docuwareConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.docuwareConfig ADD CONSTRAINT docuwareConfig_check CHECK (id = 1);
+
+-- vn.floramondoConfig
+ALTER TABLE vn.floramondoConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.floramondoConfig ADD CONSTRAINT floramondoConfig_check CHECK (id = 1);
+
+-- vn.franceExpressConfig
+ALTER TABLE vn.franceExpressConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.franceExpressConfig ADD CONSTRAINT franceExpressConfig_check CHECK (id = 1);
+
+-- vn.glsConfig
+ALTER TABLE vn.glsConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.glsConfig ADD CONSTRAINT glsConfig_check CHECK (id = 1);
+
+-- vn.greugeConfig
+ALTER TABLE vn.greugeConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.greugeConfig ADD CONSTRAINT greugeConfig_check CHECK (id = 1);
+
+-- vn.inventoryConfig
+ALTER TABLE vn.inventoryConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.inventoryConfig ADD CONSTRAINT inventoryConfig_check CHECK (id = 1);
+
+-- vn.invoiceInConfig
+ALTER TABLE vn.invoiceInConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.invoiceInConfig ADD CONSTRAINT invoiceInConfig_check CHECK (id = 1);
+
+-- vn.invoiceOutConfig
+ALTER TABLE vn.invoiceOutConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.invoiceOutConfig ADD CONSTRAINT invoiceOutConfig_check CHECK (id = 1);
diff --git a/db/versions/10953-redChico/08-vn2.sql b/db/versions/10953-redChico/08-vn2.sql
new file mode 100644
index 000000000..42985365e
--- /dev/null
+++ b/db/versions/10953-redChico/08-vn2.sql
@@ -0,0 +1,91 @@
+-- vn.invoiceOutTaxConfig (Tiene más de 1 registro en producción)
+-- ALTER TABLE vn.invoiceOutTaxConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+-- ALTER TABLE vn.invoiceOutTaxConfig ADD CONSTRAINT invoiceOutTaxConfig_check CHECK (id = 1);
+
+-- vn.itemConfig
+ALTER TABLE vn.itemConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.itemConfig ADD CONSTRAINT itemConfig_check CHECK (id = 1);
+
+-- vn.machineWorkerConfig
+ALTER TABLE vn.machineWorkerConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.machineWorkerConfig ADD CONSTRAINT machineWorkerConfig_check CHECK (id = 1);
+
+-- vn.mdbConfig
+ALTER TABLE vn.mdbConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.mdbConfig ADD CONSTRAINT mdbConfig_check CHECK (id = 1);
+
+-- vn.mrwConfig
+ALTER TABLE vn.mrwConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.mrwConfig ADD CONSTRAINT mrwConfig_check CHECK (id = 1);
+
+-- vn.osTicketConfig
+ALTER TABLE vn.osTicketConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.osTicketConfig ADD CONSTRAINT osTicketConfig_check CHECK (id = 1);
+
+-- vn.packagingConfig
+ALTER TABLE vn.packagingConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.packagingConfig ADD CONSTRAINT packagingConfig_check CHECK (id = 1);
+
+-- vn.packingSiteConfig
+ALTER TABLE vn.packingSiteConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.packingSiteConfig ADD CONSTRAINT packingSiteConfig_check CHECK (id = 1);
+
+-- vn.productionConfig
+ALTER TABLE vn.productionConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.productionConfig ADD CONSTRAINT productionConfig_check CHECK (id = 1);
+
+-- vn.rateConfig
+ALTER TABLE vn.rateConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.rateConfig ADD CONSTRAINT rateConfig_check CHECK (id = 1);
+
+-- vn.routeConfig
+ALTER TABLE vn.routeConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.routeConfig ADD CONSTRAINT routeConfig_check CHECK (id = 1);
+
+-- vn.salespersonConfig
+ALTER TABLE vn.salespersonConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.salespersonConfig ADD CONSTRAINT salespersonConfig_check CHECK (id = 1);
+
+-- vn.sendingConfig
+ALTER TABLE vn.sendingConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.sendingConfig ADD CONSTRAINT sendingConfig_check CHECK (id = 1);
+
+-- vn.smsConfig
+ALTER TABLE vn.smsConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.smsConfig ADD CONSTRAINT smsConfig_check CHECK (id = 1);
+
+-- vn.ticketConfig
+ALTER TABLE vn.ticketConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.ticketConfig ADD CONSTRAINT ticketConfig_check CHECK (id = 1);
+
+-- vn.tillConfig
+ALTER TABLE vn.tillConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.tillConfig ADD CONSTRAINT tillConfig_check CHECK (id = 1);
+
+-- vn.travelConfig
+ALTER TABLE vn.travelConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.travelConfig ADD CONSTRAINT travelConfig_check CHECK (id = 1);
+
+-- vn.viaexpressConfig
+ALTER TABLE vn.viaexpressConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.viaexpressConfig ADD CONSTRAINT viaexpressConfig_check CHECK (id = 1);
+
+-- vn.wagonConfig
+ALTER TABLE vn.wagonConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.wagonConfig ADD CONSTRAINT wagonConfig_check CHECK (id = 1);
+
+-- vn.workerConfig
+ALTER TABLE vn.workerConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.workerConfig ADD CONSTRAINT workerConfig_check CHECK (id = 1);
+
+-- vn.workerTimeControlConfig
+ALTER TABLE vn.workerTimeControlConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.workerTimeControlConfig ADD CONSTRAINT workerTimeControlConfig_check CHECK (id = 1);
+
+-- vn.zipConfig
+ALTER TABLE vn.zipConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.zipConfig ADD CONSTRAINT zipConfig_check CHECK (id = 1);
+
+-- vn.zoneConfig
+ALTER TABLE vn.zoneConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
+ALTER TABLE vn.zoneConfig ADD CONSTRAINT zoneConfig_check CHECK (id = 1);
diff --git a/db/versions/10956-brownBirch/00-firstScript.sql b/db/versions/10956-brownBirch/00-firstScript.sql
new file mode 100644
index 000000000..bcd15432c
--- /dev/null
+++ b/db/versions/10956-brownBirch/00-firstScript.sql
@@ -0,0 +1,12 @@
+CREATE TABLE floranet.`addressPostCode` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `addressFk` int(11) NOT NULL,
+ `postCode` varchar(30) NOT NULL,
+ `hoursInAdvance` int(10) unsigned NOT NULL DEFAULT 24,
+ `dayOfWeek` int(10) unsigned NOT NULL,
+ `deliveryCost` decimal(10,2) NOT NULL DEFAULT 0.00,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `addressPostCode_unique` (`postCode`,`addressFk`,`dayOfWeek`),
+ KEY `addressPostCode_address_FK` (`addressFk`),
+ CONSTRAINT `addressPostCode_address_FK` FOREIGN KEY (`addressFk`) REFERENCES `vn`.`address` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='Client''s address registered for floranet network';
\ No newline at end of file
diff --git a/db/versions/10957-goldenAnthurium/00-aclTicketClone.sql b/db/versions/10957-goldenAnthurium/00-aclTicketClone.sql
new file mode 100644
index 000000000..6387b77b0
--- /dev/null
+++ b/db/versions/10957-goldenAnthurium/00-aclTicketClone.sql
@@ -0,0 +1,2 @@
+INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId)
+ VALUES('Ticket', 'clone', 'WRITE', 'ALLOW', 'ROLE', 'administrative');
\ No newline at end of file
diff --git a/db/versions/10959-bronzePalmetto/00-firstScript.sql b/db/versions/10959-bronzePalmetto/00-firstScript.sql
new file mode 100644
index 000000000..323238d2e
--- /dev/null
+++ b/db/versions/10959-bronzePalmetto/00-firstScript.sql
@@ -0,0 +1 @@
+ALTER TABLE util.debug MODIFY COLUMN value text CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL NULL;
diff --git a/db/versions/10962-greenOrchid/00-firstScript.sql b/db/versions/10962-greenOrchid/00-firstScript.sql
new file mode 100644
index 000000000..c34f5d00b
--- /dev/null
+++ b/db/versions/10962-greenOrchid/00-firstScript.sql
@@ -0,0 +1,7 @@
+-- Place your SQL code here
+USE vn;
+
+INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId)
+ VALUES
+ ('ExpeditionPallet', '*', 'READ', 'ALLOW', 'ROLE', 'production'),
+ ('Ticket', 'addSaleByCode', 'WRITE', 'ALLOW', 'ROLE', 'production');
\ No newline at end of file
diff --git a/db/versions/10964-silverDracena/00-firstScript.sql b/db/versions/10964-silverDracena/00-firstScript.sql
new file mode 100644
index 000000000..dbc4ba8a0
--- /dev/null
+++ b/db/versions/10964-silverDracena/00-firstScript.sql
@@ -0,0 +1,2 @@
+-- Place your SQL code here
+ALTER TABLE vn.entry CHANGE isBlocked isBlocked__ tinyint(4) DEFAULT 0 NOT NULL COMMENT '@deprecated 27/03/2024';
diff --git a/db/versions/10967-wheatLilium/00-firstScript.sql b/db/versions/10967-wheatLilium/00-firstScript.sql
new file mode 100644
index 000000000..40cfe45bd
--- /dev/null
+++ b/db/versions/10967-wheatLilium/00-firstScript.sql
@@ -0,0 +1,4 @@
+-- Place your SQL code here
+
+INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
+ VALUES('ItemShelving', 'hasItemOlder', 'READ', 'ALLOW', 'ROLE', 'production');
diff --git a/db/versions/10968-salmonBamboo/00-firstScript.sql b/db/versions/10968-salmonBamboo/00-firstScript.sql
new file mode 100644
index 000000000..b79201071
--- /dev/null
+++ b/db/versions/10968-salmonBamboo/00-firstScript.sql
@@ -0,0 +1,3 @@
+ALTER TABLE vn.professionalCategory DROP COLUMN dayBreak, DROP COLUMN `level`;
+ALTER TABLE vn.professionalCategory
+ CHANGE name description varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL;
diff --git a/db/versions/10969-silverCataractarum/00-aclSupplierDms.sql b/db/versions/10969-silverCataractarum/00-aclSupplierDms.sql
new file mode 100644
index 000000000..48c7438f1
--- /dev/null
+++ b/db/versions/10969-silverCataractarum/00-aclSupplierDms.sql
@@ -0,0 +1,3 @@
+-- Place your SQL code here
+INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
+ VALUES('SupplierDms', '*', '*', 'ALLOW', 'ROLE', 'employee');
\ No newline at end of file
diff --git a/db/versions/10970-bronzeGerbera/00-specialPrice.sql b/db/versions/10970-bronzeGerbera/00-specialPrice.sql
new file mode 100644
index 000000000..e2e46fb1f
--- /dev/null
+++ b/db/versions/10970-bronzeGerbera/00-specialPrice.sql
@@ -0,0 +1,10 @@
+ALTER TABLE vn.specialPrice MODIFY COLUMN clientFk int(11) NULL;
+ALTER TABLE vn.specialPrice ADD started date NOT NULL DEFAULT '2024-01-01';
+ALTER TABLE vn.specialPrice ADD ended date NULL;
+ALTER TABLE vn.specialPrice MODIFY COLUMN itemFk int(11) NOT NULL;
+ALTER TABLE vn.specialPrice MODIFY COLUMN value DECIMAL(10,2) NOT NULL;
+
+
+ALTER TABLE vn.`specialPrice`
+ ADD CONSTRAINT `check_date_range`
+ CHECK (`ended` IS NULL OR `ended` >= `started`);
diff --git a/db/versions/10973-purpleAsparagus/00-firstScript.sql b/db/versions/10973-purpleAsparagus/00-firstScript.sql
new file mode 100644
index 000000000..f5b838529
--- /dev/null
+++ b/db/versions/10973-purpleAsparagus/00-firstScript.sql
@@ -0,0 +1,2 @@
+-- Place your SQL code here
+ALTER TABLE vn.productionConfig ADD defaultFreightItemFk INT UNSIGNED DEFAULT 71 NOT NULL COMMENT 'Default value for expedition table';
diff --git a/db/versions/10975-whiteIvy/00-action.sql b/db/versions/10975-whiteIvy/00-action.sql
new file mode 100644
index 000000000..3f9cf9d8b
--- /dev/null
+++ b/db/versions/10975-whiteIvy/00-action.sql
@@ -0,0 +1 @@
+CREATE INDEX expeditionLog_action_IDX USING BTREE ON srt.expeditionLog (`action`);
diff --git a/db/versions/10975-whiteIvy/01-expeditionFk.sql b/db/versions/10975-whiteIvy/01-expeditionFk.sql
new file mode 100644
index 000000000..ac1e01e6f
--- /dev/null
+++ b/db/versions/10975-whiteIvy/01-expeditionFk.sql
@@ -0,0 +1 @@
+CREATE INDEX expeditionLog_expeditionFk_IDX USING BTREE ON srt.expeditionLog (expeditionFk);
diff --git a/db/versions/10976-greenCamellia/00-firstScript.sql b/db/versions/10976-greenCamellia/00-firstScript.sql
new file mode 100644
index 000000000..0fd944021
--- /dev/null
+++ b/db/versions/10976-greenCamellia/00-firstScript.sql
@@ -0,0 +1,20 @@
+CREATE OR REPLACE TEMPORARY TABLE tmp.claimsWithHasToPickUp
+ SELECT id
+ FROM vn.claim
+ WHERE hasToPickUp;
+
+ALTER TABLE vn.claim CHANGE hasToPickUp pickup ENUM('agency', 'delivery') DEFAULT NULL;
+
+UPDATE vn.claim c
+ JOIN tmp.claimsWithHasToPickUp tmp ON tmp.id = c.id
+ SET c.pickup = 'delivery';
+
+-- Solved bug empty value
+UPDATE vn.claim
+ SET pickup = NULL
+ WHERE pickup = '';
+
+DROP TEMPORARY TABLE tmp.claimsWithHasToPickUp;
+
+INSERT INTO salix.ACL (model,property,accessType,principalId)
+ VALUES ('Application','getEnumValues','*','employee');
\ No newline at end of file
diff --git a/db/versions/10977-wheatFern/00-firstScript.sql b/db/versions/10977-wheatFern/00-firstScript.sql
new file mode 100644
index 000000000..53c1a4fa6
--- /dev/null
+++ b/db/versions/10977-wheatFern/00-firstScript.sql
@@ -0,0 +1,2 @@
+-- Place your SQL code here
+ALTER TABLE vn.buy DROP COLUMN packageFk;
diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js
index dba430e66..daaa17c71 100644
--- a/e2e/helpers/selectors.js
+++ b/e2e/helpers/selectors.js
@@ -762,7 +762,6 @@ export default {
claimBasicData: {
claimState: 'vn-claim-basic-data vn-autocomplete[ng-model="$ctrl.claim.claimStateFk"]',
packages: 'vn-input-number[ng-model="$ctrl.claim.packages"]',
- hasToPickUpCheckbox: 'vn-claim-basic-data vn-check[ng-model="$ctrl.claim.hasToPickUp"]',
saveButton: `button[type=submit]`
},
claimDetail: {
diff --git a/e2e/paths/05-ticket/09_weekly.spec.js b/e2e/paths/05-ticket/09_weekly.spec.js
index 74febfd01..20cfa0d13 100644
--- a/e2e/paths/05-ticket/09_weekly.spec.js
+++ b/e2e/paths/05-ticket/09_weekly.spec.js
@@ -24,7 +24,7 @@ describe('Ticket descriptor path', () => {
it('should go back to the ticket index then search and access a ticket summary', async() => {
await page.accessToSection('ticket.index');
- await page.accessToSearchResult('11');
+ await page.accessToSearchResult('33');
});
it('should add the ticket to thursday turn using the descriptor more menu', async() => {
@@ -33,7 +33,7 @@ describe('Ticket descriptor path', () => {
await page.waitToClick(selectors.ticketDescriptor.thursdayButton);
const message = await page.waitForSnackbar();
- expect(message.text).toContain('Data saved!');
+ expect(message.text).toContain('Current ticket deleted and added to shift');
});
it('should again click on the Tickets button of the top bar menu', async() => {
@@ -43,7 +43,7 @@ describe('Ticket descriptor path', () => {
await page.waitForState('ticket.index');
});
- it('should confirm the ticket 11 was added to thursday', async() => {
+ it('should confirm the ticket 33 was added to thursday', async() => {
await page.accessToSection('ticket.weekly.index');
const result = await page.waitToGetProperty(selectors.ticketsIndex.thirdWeeklyTicket, 'value');
@@ -57,8 +57,8 @@ describe('Ticket descriptor path', () => {
await page.waitForState('ticket.index');
});
- it('should now search for the ticket 11', async() => {
- await page.accessToSearchResult('11');
+ it('should now search for the ticket 33', async() => {
+ await page.accessToSearchResult('33');
await page.waitForState('ticket.card.summary');
});
@@ -68,7 +68,7 @@ describe('Ticket descriptor path', () => {
await page.waitToClick(selectors.ticketDescriptor.saturdayButton);
const message = await page.waitForSnackbar();
- expect(message.text).toContain('Data saved!');
+ expect(message.text).toContain('Current ticket deleted and added to shift');
});
it('should click on the Tickets button of the top bar menu once again', async() => {
@@ -78,7 +78,7 @@ describe('Ticket descriptor path', () => {
await page.waitForState('ticket.index');
});
- it('should confirm the ticket 11 was added on saturday', async() => {
+ it('should confirm the ticket 33 was added on saturday', async() => {
await page.accessToSection('ticket.weekly.index');
await page.waitForTimeout(5000);
@@ -87,14 +87,14 @@ describe('Ticket descriptor path', () => {
expect(result).toEqual('Saturday');
});
- it('should now search for the weekly ticket 11', async() => {
- await page.doSearch('11');
+ it('should now search for the weekly ticket 33', async() => {
+ await page.doSearch('33');
const nResults = await page.countElement(selectors.ticketsIndex.searchWeeklyResult);
expect(nResults).toEqual(2);
});
- it('should delete the weekly ticket 11', async() => {
+ it('should delete the weekly ticket 33', async() => {
await page.waitToClick(selectors.ticketsIndex.firstWeeklyTicketDeleteIcon);
await page.waitToClick(selectors.ticketsIndex.acceptDeleteTurn);
const message = await page.waitForSnackbar();
diff --git a/e2e/paths/06-claim/01_basic_data.spec.js b/e2e/paths/06-claim/01_basic_data.spec.js
index 0a08cad9f..8133ee9f2 100644
--- a/e2e/paths/06-claim/01_basic_data.spec.js
+++ b/e2e/paths/06-claim/01_basic_data.spec.js
@@ -21,7 +21,7 @@ describe('Claim edit basic data path', () => {
});
it(`should edit claim state and observation fields`, async() => {
- await page.autocompleteSearch(selectors.claimBasicData.claimState, 'Gestionado');
+ await page.autocompleteSearch(selectors.claimBasicData.claimState, 'Resuelto');
await page.clearInput(selectors.claimBasicData.packages);
await page.write(selectors.claimBasicData.packages, '2');
await page.waitToClick(selectors.claimBasicData.saveButton);
@@ -36,7 +36,6 @@ describe('Claim edit basic data path', () => {
it('should check the "Pick up" checkbox', async() => {
await page.reloadSection('claim.card.basicData');
- await page.waitToClick(selectors.claimBasicData.hasToPickUpCheckbox);
await page.waitToClick(selectors.claimBasicData.saveButton);
const message = await page.waitForSnackbar();
@@ -48,13 +47,7 @@ describe('Claim edit basic data path', () => {
await page.waitForSelector(selectors.claimBasicData.claimState);
const result = await page.waitToGetProperty(selectors.claimBasicData.claimState, 'value');
- expect(result).toEqual('Gestionado');
- });
-
- it('should confirm the "is paid with mana" and "Pick up" checkbox are checked', async() => {
- const hasToPickUpCheckbox = await page.checkboxState(selectors.claimBasicData.hasToPickUpCheckbox);
-
- expect(hasToPickUpCheckbox).toBe('checked');
+ expect(result).toEqual('Resuelto');
});
it('should confirm the claim packages was edited', async() => {
diff --git a/e2e/paths/14-account/02_alias_create_and_basic_data.spec.js b/e2e/paths/14-account/02_alias_create_and_basic_data.spec.js
index dd35dd740..840fb8afe 100644
--- a/e2e/paths/14-account/02_alias_create_and_basic_data.spec.js
+++ b/e2e/paths/14-account/02_alias_create_and_basic_data.spec.js
@@ -8,7 +8,7 @@ describe('Account Alias create and basic data path', () => {
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
- await page.loginAndModule('developer', 'account');
+ await page.loginAndModule('itManagement', 'account');
await page.accessToSection('account.alias');
});
diff --git a/e2e/paths/14-account/05_connections.spec.js b/e2e/paths/14-account/05_connections.spec.js
index 89b286101..49d5f612d 100644
--- a/e2e/paths/14-account/05_connections.spec.js
+++ b/e2e/paths/14-account/05_connections.spec.js
@@ -22,12 +22,4 @@ describe('Account Connections path', () => {
expect(firstResult).toContain(account);
});
-
- it('should kill this connection and then get redirected to the login page', async() => {
- await page.waitToClick(selectors.accountConnections.deleteFirstConnection);
- await page.waitToClick(selectors.globalItems.acceptButton);
- const message = await page.waitForSnackbar();
-
- expect(message.text).toContain('Your session has expired, please login again');
- });
});
diff --git a/front/core/components/link-phone/index.html b/front/core/components/link-phone/index.html
index 2789ab75c..58724b0a1 100644
--- a/front/core/components/link-phone/index.html
+++ b/front/core/components/link-phone/index.html
@@ -5,7 +5,6 @@
flat
round
icon="phone"
- title="MicroSIP"
ng-click="$event.stopPropagation();"
>
diff --git a/front/core/components/searchbar/style.scss b/front/core/components/searchbar/style.scss
index eab9c126b..b8dff9474 100644
--- a/front/core/components/searchbar/style.scss
+++ b/front/core/components/searchbar/style.scss
@@ -61,10 +61,10 @@ vn-searchbar {
}
vn-icon[icon="info"] {
- position: absolute;
+ position: absolute;
top: 2px;
right: 2px
}
}
}
-}
\ No newline at end of file
+}
diff --git a/front/core/components/watcher/locale/es.yml b/front/core/components/watcher/locale/es.yml
index 5d25752b4..83553d20d 100644
--- a/front/core/components/watcher/locale/es.yml
+++ b/front/core/components/watcher/locale/es.yml
@@ -1,4 +1,4 @@
Are you sure exit without saving?: ¿Seguro que quieres salir sin guardar?
Unsaved changes will be lost: Los cambios que no hayas guardado se perderán
No changes to save: No hay cambios que guardar
-Some fields are invalid: Algunos campos no son válidos
\ No newline at end of file
+Some fields are invalid: Algunos campos no son válidos
diff --git a/front/core/services/auth.js b/front/core/services/auth.js
index 844a5145d..753bc3fba 100644
--- a/front/core/services/auth.js
+++ b/front/core/services/auth.js
@@ -83,22 +83,27 @@ export default class Auth {
}
onLoginOk(json, now, remember) {
- this.vnToken.set(json.data.token, now, json.data.ttl, remember);
-
- return this.loadAcls().then(() => {
- let continueHash = this.$state.params.continue;
- if (continueHash)
- this.$window.location = continueHash;
- else
- this.$state.go('home');
- });
+ return this.$http.get('VnUsers/ShareToken', {
+ headers: {Authorization: json.data.token}
+ }).then(({data}) => {
+ this.vnToken.set(json.data.token, data.multimediaToken.id, now, json.data.ttl, remember);
+ this.loadAcls().then(() => {
+ let continueHash = this.$state.params.continue;
+ if (continueHash)
+ this.$window.location = continueHash;
+ else
+ this.$state.go('home');
+ });
+ }).catch(() => {});
}
logout() {
+ this.$http.post('Accounts/logout', null, {headers: {'Authorization': this.vnToken.tokenMultimedia},
+ }).catch(() => {});
+
let promise = this.$http.post('VnUsers/logout', null, {
headers: {Authorization: this.vnToken.token}
}).catch(() => {});
-
this.vnToken.unset();
this.loggedIn = false;
this.vnModules.reset();
diff --git a/front/core/services/file.js b/front/core/services/file.js
index 25ace4470..dfd2ebc83 100644
--- a/front/core/services/file.js
+++ b/front/core/services/file.js
@@ -14,7 +14,7 @@ class File {
*/
getPath(dmsUrl) {
const serializedParams = this.$httpParamSerializer({
- access_token: this.vnToken.token
+ access_token: this.vnToken.tokenMultimedia
});
return `${dmsUrl}?${serializedParams}`;
diff --git a/front/core/services/interceptor.js b/front/core/services/interceptor.js
index 0c3253c69..90d813ed4 100644
--- a/front/core/services/interceptor.js
+++ b/front/core/services/interceptor.js
@@ -19,7 +19,7 @@ function interceptor($q, vnApp, $translate) {
if (config.url.charAt(0) !== '/' && apiPath)
config.url = `${apiPath}${config.url}`;
- if (token)
+ if (token && !config.headers.Authorization)
config.headers.Authorization = token;
if ($translate.use())
config.headers['Accept-Language'] = $translate.use();
diff --git a/front/core/services/report.js b/front/core/services/report.js
index d6eb28ea4..e3579dd5a 100644
--- a/front/core/services/report.js
+++ b/front/core/services/report.js
@@ -15,7 +15,7 @@ class Report {
*/
show(path, params) {
params = Object.assign({
- access_token: this.vnToken.token
+ access_token: this.vnToken.tokenMultimedia
}, params);
const serializedParams = this.$httpParamSerializer(params);
const query = serializedParams ? `?${serializedParams}` : '';
diff --git a/front/core/services/token.js b/front/core/services/token.js
index c8cb4f6bb..028ebd841 100644
--- a/front/core/services/token.js
+++ b/front/core/services/token.js
@@ -24,21 +24,22 @@ export default class Token {
} catch (e) {}
}
- set(token, created, ttl, remember) {
+ set(token, tokenMultimedia, created, ttl, remember) {
this.unset();
Object.assign(this, {
token,
+ tokenMultimedia,
created,
ttl,
remember
});
- this.vnInterceptor.setToken(token);
+ this.vnInterceptor.setToken(token, tokenMultimedia);
try {
if (remember)
- this.setStorage(localStorage, token, created, ttl);
+ this.setStorage(localStorage, token, tokenMultimedia, created, ttl);
else
- this.setStorage(sessionStorage, token, created, ttl);
+ this.setStorage(sessionStorage, token, tokenMultimedia, created, ttl);
} catch (err) {
console.error(err);
}
@@ -46,6 +47,7 @@ export default class Token {
unset() {
this.token = null;
+ this.tokenMultimedia = null;
this.created = null;
this.ttl = null;
this.remember = null;
@@ -57,13 +59,16 @@ export default class Token {
getStorage(storage) {
this.token = storage.getItem('vnToken');
+ // Cambio realizado temporalmente
+ this.tokenMultimedia = this.token; // storage.getItem('vnTokenMultimedia');
if (!this.token) return;
const created = storage.getItem('vnTokenCreated');
this.created = created && new Date(created);
this.ttl = storage.getItem('vnTokenTtl');
}
- setStorage(storage, token, created, ttl) {
+ setStorage(storage, token, tokenMultimedia, created, ttl) {
+ storage.setItem('vnTokenMultimedia', tokenMultimedia);
storage.setItem('vnToken', token);
storage.setItem('vnTokenCreated', created.toJSON());
storage.setItem('vnTokenTtl', ttl);
@@ -71,6 +76,7 @@ export default class Token {
removeStorage(storage) {
storage.removeItem('vnToken');
+ storage.removeItem('vnTokenMultimedia');
storage.removeItem('vnTokenCreated');
storage.removeItem('vnTokenTtl');
}
diff --git a/front/salix/components/layout/index.js b/front/salix/components/layout/index.js
index 89912d4e3..e935c6d99 100644
--- a/front/salix/components/layout/index.js
+++ b/front/salix/components/layout/index.js
@@ -23,8 +23,7 @@ export class Layout extends Component {
if (!this.$.$root.user) return;
const userId = this.$.$root.user.id;
- const token = this.vnToken.token;
- return `/api/Images/user/160x160/${userId}/download?access_token=${token}`;
+ return `/api/Images/user/160x160/${userId}/download?access_token=${this.vnToken.tokenMultimedia}`;
}
refresh() {
diff --git a/front/salix/components/log/index.html b/front/salix/components/log/index.html
index c75030100..a3aaf0011 100644
--- a/front/salix/components/log/index.html
+++ b/front/salix/components/log/index.html
@@ -31,7 +31,7 @@
ng-click="$ctrl.showDescriptor($event, userLog)">
+ ng-src="/api/Images/user/160x160/{{::userLog.userFk}}/download?access_token={{::$ctrl.vnToken.tokenMultimedia}}">
@@ -181,7 +181,7 @@
val="{{::nickname}}">
+ ng-src="/api/Images/user/160x160/{{::id}}/download?access_token={{::$ctrl.vnToken.tokenMultimedia}}">
diff --git a/front/salix/components/user-popover/index.html b/front/salix/components/user-popover/index.html
index 0fa6800c5..06a4af1e0 100644
--- a/front/salix/components/user-popover/index.html
+++ b/front/salix/components/user-popover/index.html
@@ -58,7 +58,7 @@
label="Local bank"
id="localBank"
ng-model="$ctrl.localBankFk"
- url="Banks"
+ url="Accountings"
select-fields="['id','bank']"
show-field="bank"
order="id"
diff --git a/front/salix/module.js b/front/salix/module.js
index 0ce855308..53b718427 100644
--- a/front/salix/module.js
+++ b/front/salix/module.js
@@ -13,7 +13,7 @@ export function run($window, $rootScope, vnAuth, vnApp, vnToken, $state) {
if (!collection || !size || !id) return;
const basePath = `/api/Images/${collection}/${size}/${id}`;
- return `${basePath}/download?access_token=${vnToken.token}`;
+ return `${basePath}/download?access_token=${vnToken.tokenMultimedia}`;
};
$window.validations = {};
diff --git a/jest.front.config.js b/jest.front.config.js
index a843832ea..4b292801e 100644
--- a/jest.front.config.js
+++ b/jest.front.config.js
@@ -1,6 +1,8 @@
// For a detailed explanation regarding each configuration property, visit:
// https://jestjs.io/docs/en/configuration.html
/* eslint max-len: ["error", { "code": 150 }]*/
+const cpus = require('os').cpus().length;
+const maxCpus = Math.floor(cpus * 0.45);
module.exports = {
name: 'front end',
@@ -12,6 +14,7 @@ module.exports = {
setupFilesAfterEnv: [
'./front/jest-setup.js'
],
+ maxWorkers: maxCpus,
testMatch: [
'**/front/**/*.spec.js',
'**/print/**/*.spec.js',
diff --git a/loopback/common/methods/application/getEnumValues.js b/loopback/common/methods/application/getEnumValues.js
new file mode 100644
index 000000000..5e36e60be
--- /dev/null
+++ b/loopback/common/methods/application/getEnumValues.js
@@ -0,0 +1,56 @@
+const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
+const UserError = require('vn-loopback/util/user-error');
+
+module.exports = Self => {
+ Self.remoteMethod('getEnumValues', {
+ description: 'Return enum values of column',
+ accessType: 'EXECUTE',
+ accepts: [
+ {
+ arg: 'schema',
+ type: 'string',
+ description: 'The schema of db',
+ required: true,
+ },
+ {
+ arg: 'table',
+ type: 'string',
+ description: 'The table of schema',
+ required: true,
+ },
+ {
+ arg: 'column',
+ type: 'string',
+ description: 'The column of table',
+ required: true,
+ },
+ ],
+ returns: {
+ type: 'any',
+ root: true
+ },
+ http: {
+ path: `/get-enum-values`,
+ verb: 'GET'
+ }
+ });
+
+ Self.getEnumValues = async(schema, table, column) => {
+ const stmt = new ParameterizedSQL(`
+ SELECT COLUMN_TYPE
+ FROM information_schema.COLUMNS
+ WHERE TABLE_SCHEMA = ?
+ AND TABLE_NAME = ?
+ AND COLUMN_NAME = ?
+ AND DATA_TYPE = 'enum';`,
+ [schema, table, column]);
+
+ const conn = Self.dataSource.connector;
+ const [result] = await conn.executeStmt(stmt);
+
+ if (!result) throw new UserError(`No results found`);
+
+ const regex = /'([^']*)'/g;
+ return result.COLUMN_TYPE.match(regex).map(match => match.slice(1, -1));
+ };
+};
diff --git a/loopback/common/methods/application/spec/getEnumValues.spec.js b/loopback/common/methods/application/spec/getEnumValues.spec.js
new file mode 100644
index 000000000..edb2e76f7
--- /dev/null
+++ b/loopback/common/methods/application/spec/getEnumValues.spec.js
@@ -0,0 +1,35 @@
+const models = require('vn-loopback/server/server').models;
+
+describe('Application getEnumValues()', () => {
+ let tx;
+
+ beforeEach(async() => {
+ tx = await models.Application.beginTransaction({});
+ const options = {transaction: tx};
+
+ await models.Application.rawSql(`
+ CREATE TABLE tableWithEnum (
+ direction enum('in', 'out', 'middle'),
+ PRIMARY KEY (direction)
+ ) ENGINE=InnoDB;
+ `, null, options);
+ });
+
+ it('should return three if is ok', async() => {
+ try {
+ const options = {transaction: tx};
+ const response = await models.Application.getEnumValues(
+ 'vn',
+ 'tableWithEnum',
+ 'direction',
+ options
+ );
+
+ expect(response.length).toEqual(3);
+ await tx.rollback();
+ } catch (e) {
+ await tx.rollback();
+ throw e;
+ }
+ });
+});
diff --git a/loopback/common/mixins/loggable.js b/loopback/common/mixins/loggable.js
index 760fdf60a..24243ba68 100644
--- a/loopback/common/mixins/loggable.js
+++ b/loopback/common/mixins/loggable.js
@@ -1,6 +1,7 @@
const LoopBackContext = require('loopback-context');
async function handleObserve(ctx) {
- ctx.options.httpCtx = LoopBackContext.getCurrentContext();
+ const httpCtx = LoopBackContext.getCurrentContext();
+ ctx.options.userId = httpCtx?.active?.accessToken?.userId;
}
module.exports = function(Self) {
let Mixin = {
diff --git a/loopback/common/models/application.js b/loopback/common/models/application.js
index ac8ae78f0..6bdc2c13a 100644
--- a/loopback/common/models/application.js
+++ b/loopback/common/models/application.js
@@ -5,4 +5,5 @@ module.exports = function(Self) {
require('../methods/application/execute')(Self);
require('../methods/application/executeProc')(Self);
require('../methods/application/executeFunc')(Self);
+ require('../methods/application/getEnumValues')(Self);
};
diff --git a/loopback/locale/en.json b/loopback/locale/en.json
index 2187371cd..a0e60550f 100644
--- a/loopback/locale/en.json
+++ b/loopback/locale/en.json
@@ -68,7 +68,7 @@
"Changed client paymethod": "I have changed the pay method for client [{{clientName}} ({{clientId}})]({{{url}}})",
"Sent units from ticket": "I sent *{{quantity}}* units of [{{concept}} ({{itemId}})]({{{itemUrl}}}) to *\"{{nickname}}\"* coming from ticket id [{{ticketId}}]({{{ticketUrl}}})",
"Change quantity": "{{concept}} change of {{oldQuantity}} to {{newQuantity}}",
- "Claim will be picked": "The product from the claim [({{claimId}})]({{{claimUrl}}}) from the client *{{clientName}}* will be picked",
+ "Claim will be picked": "The product from the claim [({{claimId}})]({{{claimUrl}}}) from the client *{{clientName}}* will be picked, with the pickup type *{{claimPickup}}*",
"Claim state has changed to": "The state of the claim [({{claimId}})]({{{claimUrl}}}) from client *{{clientName}}* has changed to *{{newState}}*",
"Customs agent is required for a non UEE member": "Customs agent is required for a non UEE member",
"Incoterms is required for a non UEE member": "Incoterms is required for a non UEE member",
@@ -89,6 +89,8 @@
"landed": "Landed",
"addressFk": "Address",
"companyFk": "Company",
+ "agency": "Agency",
+ "delivery": "Delivery",
"You need to fill sage information before you check verified data": "You need to fill sage information before you check verified data",
"The social name cannot be empty": "The social name cannot be empty",
"The nif cannot be empty": "The nif cannot be empty",
@@ -209,5 +211,18 @@
"You cannot update these fields": "You cannot update these fields",
"CountryFK cannot be empty": "Country cannot be empty",
"You are not allowed to modify the alias": "You are not allowed to modify the alias",
- "You already have the mailAlias": "You already have the mailAlias"
+ "You already have the mailAlias": "You already have the mailAlias",
+ "This machine is already in use.": "This machine is already in use.",
+ "the plate does not exist": "The plate {{plate}} does not exist",
+ "We do not have availability for the selected item": "We do not have availability for the selected item",
+ "You are already using a machine": "You are already using a machine",
+ "this state does not exist": "This state does not exist",
+ "The line could not be marked": "The line could not be marked",
+ "The sale cannot be tracked": "The sale cannot be tracked",
+ "Shelving not valid": "Shelving not valid",
+ "printerNotExists": "The printer does not exist",
+ "There are not picking tickets": "There are not picking tickets",
+ "ticketCommercial": "The ticket {{ ticket }} for the salesperson {{ salesMan }} is in preparation. (automatically generated message)",
+ "This password can only be changed by the user themselves": "This password can only be changed by the user themselves",
+ "They're not your subordinate": "They're not your subordinate"
}
diff --git a/loopback/locale/es.json b/loopback/locale/es.json
index aea0c311c..8b02f3048 100644
--- a/loopback/locale/es.json
+++ b/loopback/locale/es.json
@@ -1,348 +1,356 @@
{
- "Phone format is invalid": "El formato del teléfono no es correcto",
- "You are not allowed to change the credit": "No tienes privilegios para modificar el crédito",
- "Unable to mark the equivalence surcharge": "No se puede marcar el recargo de equivalencia",
- "The default consignee can not be unchecked": "No se puede desmarcar el consignatario predeterminado",
- "Unable to default a disabled consignee": "No se puede poner predeterminado un consignatario desactivado",
- "Can't be blank": "No puede estar en blanco",
- "Invalid TIN": "NIF/CIF inválido",
- "TIN must be unique": "El NIF/CIF debe ser único",
- "A client with that Web User name already exists": "Ya existe un cliente con ese Usuario Web",
- "Is invalid": "Es inválido",
- "Quantity cannot be zero": "La cantidad no puede ser cero",
- "Enter an integer different to zero": "Introduce un entero distinto de cero",
- "Package cannot be blank": "El embalaje no puede estar en blanco",
- "The company name must be unique": "La razón social debe ser única",
- "Invalid email": "Correo electrónico inválido",
- "The IBAN does not have the correct format": "El IBAN no tiene el formato correcto",
- "That payment method requires an IBAN": "El método de pago seleccionado requiere un IBAN",
- "That payment method requires a BIC": "El método de pago seleccionado requiere un BIC",
- "State cannot be blank": "El estado no puede estar en blanco",
- "Worker cannot be blank": "El trabajador no puede estar en blanco",
- "Cannot change the payment method if no salesperson": "No se puede cambiar la forma de pago si no hay comercial asignado",
- "can't be blank": "El campo no puede estar vacío",
- "Observation type must be unique": "El tipo de observación no puede repetirse",
- "The credit must be an integer greater than or equal to zero": "The credit must be an integer greater than or equal to zero",
- "The grade must be similar to the last one": "El grade debe ser similar al último",
- "Only manager can change the credit": "Solo el gerente puede cambiar el credito de este cliente",
- "Name cannot be blank": "El nombre no puede estar en blanco",
- "Phone cannot be blank": "El teléfono no puede estar en blanco",
- "Period cannot be blank": "El periodo no puede estar en blanco",
- "Choose a company": "Selecciona una empresa",
- "Se debe rellenar el campo de texto": "Se debe rellenar el campo de texto",
- "Description should have maximum of 45 characters": "La descripción debe tener maximo 45 caracteres",
- "Cannot be blank": "El campo no puede estar en blanco",
- "The grade must be an integer greater than or equal to zero": "El grade debe ser un entero mayor o igual a cero",
- "Sample type cannot be blank": "El tipo de plantilla no puede quedar en blanco",
- "Description cannot be blank": "Se debe rellenar el campo de texto",
- "The price of the item changed": "El precio del artículo cambió",
- "The value should not be greater than 100%": "El valor no debe de ser mayor de 100%",
- "The value should be a number": "El valor debe ser un numero",
- "This order is not editable": "Esta orden no se puede modificar",
- "You can't create an order for a frozen client": "No puedes crear una orden para un cliente congelado",
- "You can't create an order for a client that has a debt": "No puedes crear una orden para un cliente con deuda",
- "is not a valid date": "No es una fecha valida",
- "Barcode must be unique": "El código de barras debe ser único",
- "The warehouse can't be repeated": "El almacén no puede repetirse",
- "The tag or priority can't be repeated for an item": "El tag o prioridad no puede repetirse para un item",
- "The observation type can't be repeated": "El tipo de observación no puede repetirse",
- "A claim with that sale already exists": "Ya existe una reclamación para esta línea",
- "You don't have enough privileges to change that field": "No tienes permisos para cambiar ese campo",
- "Warehouse cannot be blank": "El almacén no puede quedar en blanco",
- "Agency cannot be blank": "La agencia no puede quedar en blanco",
- "Not enough privileges to edit a client with verified data": "No tienes permisos para hacer cambios en un cliente con datos comprobados",
- "This address doesn't exist": "Este consignatario no existe",
- "You must delete the claim id %d first": "Antes debes borrar la reclamación %d",
- "You don't have enough privileges": "No tienes suficientes permisos",
- "Cannot check Equalization Tax in this NIF/CIF": "No se puede marcar RE en este NIF/CIF",
- "You can't make changes on the basic data of an confirmed order or with rows": "No puedes cambiar los datos básicos de una orden con artículos",
- "INVALID_USER_NAME": "El nombre de usuario solo debe contener letras minúsculas o, a partir del segundo carácter, números o subguiones, no está permitido el uso de la letra ñ",
- "You can't create a ticket for a frozen client": "No puedes crear un ticket para un cliente congelado",
- "You can't create a ticket for an inactive client": "No puedes crear un ticket para un cliente inactivo",
- "Tag value cannot be blank": "El valor del tag no puede quedar en blanco",
- "ORDER_EMPTY": "Cesta vacía",
- "You don't have enough privileges to do that": "No tienes permisos para cambiar esto",
- "NO SE PUEDE DESACTIVAR EL CONSIGNAT": "NO SE PUEDE DESACTIVAR EL CONSIGNAT",
- "Error. El NIF/CIF está repetido": "Error. El NIF/CIF está repetido",
- "Street cannot be empty": "Dirección no puede estar en blanco",
- "City cannot be empty": "Ciudad no puede estar en blanco",
- "Code cannot be blank": "Código no puede estar en blanco",
- "You cannot remove this department": "No puedes eliminar este departamento",
- "The extension must be unique": "La extensión debe ser unica",
- "The secret can't be blank": "La contraseña no puede estar en blanco",
- "We weren't able to send this SMS": "No hemos podido enviar el SMS",
- "This client can't be invoiced": "Este cliente no puede ser facturado",
- "You must provide the correction information to generate a corrective invoice": "Debes informar la información de corrección para generar una factura rectificativa",
- "This ticket can't be invoiced": "Este ticket no puede ser facturado",
- "You cannot add or modify services to an invoiced ticket": "No puedes añadir o modificar servicios a un ticket facturado",
- "This ticket can not be modified": "Este ticket no puede ser modificado",
- "The introduced hour already exists": "Esta hora ya ha sido introducida",
- "INFINITE_LOOP": "Existe una dependencia entre dos Jefes",
- "The sales of the receiver ticket can't be modified": "Las lineas del ticket al que envias no pueden ser modificadas",
- "NO_AGENCY_AVAILABLE": "No hay una zona de reparto disponible con estos parámetros",
- "ERROR_PAST_SHIPMENT": "No puedes seleccionar una fecha de envío en pasado",
- "The current ticket can't be modified": "El ticket actual no puede ser modificado",
- "The current claim can't be modified": "La reclamación actual no puede ser modificada",
- "The sales of this ticket can't be modified": "Las lineas de este ticket no pueden ser modificadas",
- "The sales do not exists": "La(s) línea(s) seleccionada(s) no existe(n)",
- "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",
- "NO_ZONE_FOR_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada",
- "This item doesn't exists": "El artículo no existe",
- "NOT_ZONE_WITH_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada",
- "Extension format is invalid": "El formato de la extensión es inválido",
- "Invalid parameters to create a new ticket": "Parámetros inválidos para crear un nuevo ticket",
- "This item is not available": "Este artículo no está disponible",
- "This postcode already exists": "Este código postal ya existe",
- "Concept cannot be blank": "El concepto no puede quedar en blanco",
- "File doesn't exists": "El archivo no existe",
- "You don't have privileges to change the zone": "No tienes permisos para cambiar la zona o para esos parámetros hay más de una opción de envío, hable con las agencias",
- "This ticket is already on weekly tickets": "Este ticket ya está en tickets programados",
- "Ticket id cannot be blank": "El id de ticket no puede quedar en blanco",
- "Weekday cannot be blank": "El día de la semana no puede quedar en blanco",
- "You can't delete a confirmed order": "No puedes borrar un pedido confirmado",
- "The social name has an invalid format": "El nombre fiscal tiene un formato incorrecto",
- "Invalid quantity": "Cantidad invalida",
- "This postal code is not valid": "Este código postal no es válido",
- "is invalid": "es inválido",
- "The postcode doesn't exist. Please enter a correct one": "El código postal no existe. Por favor, introduce uno correcto",
- "The department name can't be repeated": "El nombre del departamento no puede repetirse",
- "This phone already exists": "Este teléfono ya existe",
- "You cannot move a parent to its own sons": "No puedes mover un elemento padre a uno de sus hijos",
- "You can't create a claim for a removed ticket": "No puedes crear una reclamación para un ticket eliminado",
- "You cannot delete a ticket that part of it is being prepared": "No puedes eliminar un ticket en el que una parte que está siendo preparada",
- "You must delete all the buy requests first": "Debes eliminar todas las peticiones de compra primero",
- "You should specify a date": "Debes especificar una fecha",
- "You should specify at least a start or end date": "Debes especificar al menos una fecha de inicio o de fin",
- "Start date should be lower than end date": "La fecha de inicio debe ser menor que la fecha de fin",
- "You should mark at least one week day": "Debes marcar al menos un día de la semana",
- "Swift / BIC can't be empty": "Swift / BIC no puede estar vacío",
- "Customs agent is required for a non UEE member": "El agente de aduanas es requerido para los clientes extracomunitarios",
- "Incoterms is required for a non UEE member": "El incoterms es requerido para los clientes extracomunitarios",
- "Deleted sales from ticket": "He eliminado las siguientes lineas del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{deletions}}}",
- "Added sale to ticket": "He añadido la siguiente linea al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}",
- "Changed sale discount": "He cambiado el descuento de las siguientes lineas al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
- "Created claim": "He creado la reclamación [{{claimId}}]({{{claimUrl}}}) de las siguientes lineas del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
- "Changed sale price": "He cambiado el precio de [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) de {{oldPrice}}€ ➔ *{{newPrice}}€* del ticket [{{ticketId}}]({{{ticketUrl}}})",
- "Changed sale quantity": "He cambiado la cantidad de [{{itemId}} {{concept}}]({{{itemUrl}}}) de {{oldQuantity}} ➔ *{{newQuantity}}* del ticket [{{ticketId}}]({{{ticketUrl}}})",
- "State": "Estado",
- "regular": "normal",
- "reserved": "reservado",
- "Changed sale reserved state": "He cambiado el estado reservado de las siguientes lineas al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
- "Bought units from buy request": "Se ha comprado {{quantity}} unidades de [{{itemId}} {{concept}}]({{{urlItem}}}) para el ticket id [{{ticketId}}]({{{url}}})",
- "Deny buy request": "Se ha rechazado la petición de compra para el ticket id [{{ticketId}}]({{{url}}}). Motivo: {{observation}}",
- "MESSAGE_INSURANCE_CHANGE": "He cambiado el crédito asegurado del cliente [{{clientName}} ({{clientId}})]({{{url}}}) a *{{credit}} €*",
- "Changed client paymethod": "He cambiado la forma de pago del cliente [{{clientName}} ({{clientId}})]({{{url}}})",
- "Sent units from ticket": "Envio *{{quantity}}* unidades de [{{concept}} ({{itemId}})]({{{itemUrl}}}) a *\"{{nickname}}\"* provenientes del ticket id [{{ticketId}}]({{{ticketUrl}}})",
- "Change quantity": "{{concept}} cambia de {{oldQuantity}} a {{newQuantity}}",
- "Claim will be picked": "Se recogerá el género de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}*",
- "Claim state has changed to": "Se ha cambiado el estado de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}* a *{{newState}}*",
- "Client checked as validated despite of duplication": "Cliente comprobado a pesar de que existe el cliente id {{clientId}}",
- "ORDER_ROW_UNAVAILABLE": "No hay disponibilidad de este producto",
- "Distance must be lesser than 4000": "La distancia debe ser inferior a 4000",
- "This ticket is deleted": "Este ticket está eliminado",
- "Unable to clone this travel": "No ha sido posible clonar este travel",
- "This thermograph id already exists": "La id del termógrafo ya existe",
- "Choose a date range or days forward": "Selecciona un rango de fechas o días en adelante",
- "ORDER_ALREADY_CONFIRMED": "ORDEN YA CONFIRMADA",
- "Invalid password": "Invalid password",
- "Password does not meet requirements": "La contraseña no cumple los requisitos",
- "Role already assigned": "Rol ya asignado",
- "Invalid role name": "Nombre de rol no válido",
- "Role name must be written in camelCase": "El nombre del rol debe escribirse en camelCase",
- "Email already exists": "El correo ya existe",
- "User already exists": "El/La usuario/a ya existe",
- "Absence change notification on the labour calendar": "Notificación de cambio de ausencia en el calendario laboral",
- "Record of hours week": "Registro de horas semana {{week}} año {{year}} ",
- "Created absence": "El empleado {{author}} ha añadido una ausencia de tipo '{{absenceType}}' a {{employee}} para el día {{dated}}.",
- "Deleted absence": "El empleado {{author}} ha eliminado una ausencia de tipo '{{absenceType}}' a {{employee}} del día {{dated}}.",
- "I have deleted the ticket id": "He eliminado el ticket id [{{id}}]({{{url}}})",
- "I have restored the ticket id": "He restaurado el ticket id [{{id}}]({{{url}}})",
- "You can only restore a ticket within the first hour after deletion": "Únicamente puedes restaurar el ticket dentro de la primera hora después de su eliminación",
- "Changed this data from the ticket": "He cambiado estos datos del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
- "agencyModeFk": "Agencia",
- "clientFk": "Cliente",
- "zoneFk": "Zona",
- "warehouseFk": "Almacén",
- "shipped": "F. envío",
- "landed": "F. entrega",
- "addressFk": "Consignatario",
- "companyFk": "Empresa",
- "The social name cannot be empty": "La razón social no puede quedar en blanco",
- "The nif cannot be empty": "El NIF no puede quedar en blanco",
- "You need to fill sage information before you check verified data": "Debes rellenar la información de sage antes de marcar datos comprobados",
- "ASSIGN_ZONE_FIRST": "Asigna una zona primero",
- "Amount cannot be zero": "El importe no puede ser cero",
- "Company has to be official": "Empresa inválida",
- "You can not select this payment method without a registered bankery account": "No se puede utilizar este método de pago si no has registrado una cuenta bancaria",
- "Action not allowed on the test environment": "Esta acción no está permitida en el entorno de pruebas",
- "The selected ticket is not suitable for this route": "El ticket seleccionado no es apto para esta ruta",
- "New ticket request has been created with price": "Se ha creado una nueva petición de compra '{{description}}' para el día *{{shipped}}*, con una cantidad de *{{quantity}}* y un precio de *{{price}} €*",
- "New ticket request has been created": "Se ha creado una nueva petición de compra '{{description}}' para el día *{{shipped}}*, con una cantidad de *{{quantity}}*",
- "Swift / BIC cannot be empty": "Swift / BIC no puede estar vacío",
- "This BIC already exist.": "Este BIC ya existe.",
- "That item doesn't exists": "Ese artículo no existe",
- "There's a new urgent ticket:": "Hay un nuevo ticket urgente:",
- "Invalid account": "Cuenta inválida",
- "Compensation account is empty": "La cuenta para compensar está vacia",
- "This genus already exist": "Este genus ya existe",
- "This specie already exist": "Esta especie ya existe",
- "Client assignment has changed": "He cambiado el comercial ~*\"<{{previousWorkerName}}>\"*~ por *\"<{{currentWorkerName}}>\"* del cliente [{{clientName}} ({{clientId}})]({{{url}}})",
- "None": "Ninguno",
- "The contract was not active during the selected date": "El contrato no estaba activo durante la fecha seleccionada",
- "Cannot add more than one '1/2 day vacation'": "No puedes añadir más de un 'Vacaciones 1/2 dia'",
- "This document already exists on this ticket": "Este documento ya existe en el ticket",
- "Some of the selected tickets are not billable": "Algunos de los tickets seleccionados no son facturables",
- "You can't invoice tickets from multiple clients": "No puedes facturar tickets de multiples clientes",
- "nickname": "nickname",
- "INACTIVE_PROVIDER": "Proveedor inactivo",
- "This client is not invoiceable": "Este cliente no es facturable",
- "serial non editable": "Esta serie no permite asignar la referencia",
- "Max shipped required": "La fecha límite es requerida",
- "Can't invoice to future": "No se puede facturar a futuro",
- "Can't invoice to past": "No se puede facturar a pasado",
- "This ticket is already invoiced": "Este ticket ya está facturado",
- "A ticket with an amount of zero can't be invoiced": "No se puede facturar un ticket con importe cero",
- "A ticket with a negative base can't be invoiced": "No se puede facturar un ticket con una base negativa",
- "Global invoicing failed": "[Facturación global] No se han podido facturar algunos clientes",
- "Wasn't able to invoice the following clients": "No se han podido facturar los siguientes clientes",
- "Can't verify data unless the client has a business type": "No se puede verificar datos de un cliente que no tiene tipo de negocio",
- "You don't have enough privileges to set this credit amount": "No tienes suficientes privilegios para establecer esta cantidad de crédito",
- "You can't change the credit set to zero from a financialBoss": "No puedes cambiar el cŕedito establecido a cero por un jefe de finanzas",
- "Amounts do not match": "Las cantidades no coinciden",
- "The PDF document does not exist": "El documento PDF no existe. Prueba a regenerarlo desde la opción 'Regenerar PDF factura'",
- "The type of business must be filled in basic data": "El tipo de negocio debe estar rellenado en datos básicos",
- "You can't create a claim from a ticket delivered more than seven days ago": "No puedes crear una reclamación de un ticket entregado hace más de siete días",
- "The worker has hours recorded that day": "El trabajador tiene horas fichadas ese día",
- "The worker has a marked absence that day": "El trabajador tiene marcada una ausencia ese día",
- "You can not modify is pay method checked": "No se puede modificar el campo método de pago validado",
- "The account size must be exactly 10 characters": "El tamaño de la cuenta debe ser exactamente de 10 caracteres",
- "Can't transfer claimed sales": "No puedes transferir lineas reclamadas",
- "You don't have privileges to create refund": "No tienes permisos para crear un abono",
- "The item is required": "El artículo es requerido",
- "The agency is already assigned to another autonomous": "La agencia ya está asignada a otro autónomo",
- "date in the future": "Fecha en el futuro",
- "reference duplicated": "Referencia duplicada",
- "This ticket is already a refund": "Este ticket ya es un abono",
- "isWithoutNegatives": "Sin negativos",
- "routeFk": "routeFk",
- "Can't change the password of another worker": "No se puede cambiar la contraseña de otro trabajador",
- "No hay un contrato en vigor": "No hay un contrato en vigor",
- "No se permite fichar a futuro": "No se permite fichar a futuro",
- "No está permitido trabajar": "No está permitido trabajar",
- "Fichadas impares": "Fichadas impares",
- "Descanso diario 12h.": "Descanso diario 12h.",
- "Descanso semanal 36h. / 72h.": "Descanso semanal 36h. / 72h.",
- "Dirección incorrecta": "Dirección incorrecta",
- "Modifiable user details only by an administrator": "Detalles de usuario modificables solo por un administrador",
- "Modifiable password only via recovery or by an administrator": "Contraseña modificable solo a través de la recuperación o por un administrador",
- "Not enough privileges to edit a client": "No tienes suficientes privilegios para editar un cliente",
- "This route does not exists": "Esta ruta no existe",
- "Claim pickup order sent": "Reclamación Orden de recogida enviada [{{claimId}}]({{{claimUrl}}}) al cliente *{{clientName}}*",
- "You don't have grant privilege": "No tienes privilegios para dar privilegios",
- "You don't own the role and you can't assign it to another user": "No eres el propietario del rol y no puedes asignarlo a otro usuario",
- "Ticket merged": "Ticket [{{originId}}]({{{originFullPath}}}) ({{{originDated}}}) fusionado con [{{destinationId}}]({{{destinationFullPath}}}) ({{{destinationDated}}})",
- "Already has this status": "Ya tiene este estado",
- "There aren't records for this week": "No existen registros para esta semana",
- "Empty data source": "Origen de datos vacio",
- "App locked": "Aplicación bloqueada por el usuario {{userId}}",
- "Email verify": "Correo de verificación",
- "Landing cannot be lesser than shipment": "Landing cannot be lesser than shipment",
- "Receipt's bank was not found": "No se encontró el banco del recibo",
- "This receipt was not compensated": "Este recibo no ha sido compensado",
- "Client's email was not found": "No se encontró el email del cliente",
- "Negative basis": "Base negativa",
- "This worker code already exists": "Este codigo de trabajador ya existe",
- "This personal mail already exists": "Este correo personal ya existe",
- "This worker already exists": "Este trabajador ya existe",
- "App name does not exist": "El nombre de aplicación no es válido",
- "Try again": "Vuelve a intentarlo",
- "Aplicación bloqueada por el usuario 9": "Aplicación bloqueada por el usuario 9",
- "Failed to upload delivery note": "Error al subir albarán {{id}}",
- "The DOCUWARE PDF document does not exists": "El documento PDF Docuware no existe",
- "It is not possible to modify tracked sales": "No es posible modificar líneas de pedido que se hayan empezado a preparar",
- "It is not possible to modify sales that their articles are from Floramondo": "No es posible modificar líneas de pedido cuyos artículos sean de Floramondo",
- "It is not possible to modify cloned sales": "No es posible modificar líneas de pedido clonadas",
- "A supplier with the same name already exists. Change the country.": "Un proveedor con el mismo nombre ya existe. Cambie el país.",
- "There is no assigned email for this client": "No hay correo asignado para este cliente",
- "Exists an invoice with a future date": "Existe una factura con fecha posterior",
- "Invoice date can't be less than max date": "La fecha de factura no puede ser inferior a la fecha límite",
- "Warehouse inventory not set": "El almacén inventario no está establecido",
- "This locker has already been assigned": "Esta taquilla ya ha sido asignada",
- "Tickets with associated refunds": "No se pueden borrar tickets con abonos asociados. Este ticket está asociado al abono Nº %d",
- "Not exist this branch": "La rama no existe",
- "This ticket cannot be signed because it has not been boxed": "Este ticket no puede firmarse porque no ha sido encajado",
- "Collection does not exist": "La colección no existe",
- "Cannot obtain exclusive lock": "No se puede obtener un bloqueo exclusivo",
- "Insert a date range": "Inserte un rango de fechas",
- "Added observation": "{{user}} añadió esta observacion: {{text}}",
- "Comment added to client": "Observación añadida al cliente {{clientFk}}",
- "Invalid auth code": "Código de verificación incorrecto",
- "Invalid or expired verification code": "Código de verificación incorrecto o expirado",
- "Cannot create a new claimBeginning from a different ticket": "No se puede crear una línea de reclamación de un ticket diferente al origen",
- "company": "Compañía",
- "country": "País",
- "clientId": "Id cliente",
- "clientSocialName": "Cliente",
- "amount": "Importe",
- "taxableBase": "Base",
- "ticketFk": "Id ticket",
- "isActive": "Activo",
- "hasToInvoice": "Facturar",
- "isTaxDataChecked": "Datos comprobados",
- "comercialId": "Id comercial",
- "comercialName": "Comercial",
- "Pass expired": "La contraseña ha caducado, cambiela desde Salix",
- "Invalid NIF for VIES": "Invalid NIF for VIES",
- "Ticket does not exist": "Este ticket no existe",
- "Ticket is already signed": "Este ticket ya ha sido firmado",
- "Authentication failed": "Autenticación fallida",
- "You can't use the same password": "No puedes usar la misma contraseña",
- "You can only add negative amounts in refund tickets": "Solo se puede añadir cantidades negativas en tickets abono",
- "Fecha fuera de rango": "Fecha fuera de rango",
- "Error while generating PDF": "Error al generar PDF",
- "Error when sending mail to client": "Error al enviar el correo al cliente",
- "Mail not sent": "Se ha producido un fallo al enviar la factura al cliente [{{clientId}}]({{{clientUrl}}}), por favor revisa la dirección de correo electrónico",
- "The renew period has not been exceeded": "El periodo de renovación no ha sido superado",
- "Valid priorities": "Prioridades válidas: %d",
- "hasAnyNegativeBase": "Base negativa para los tickets: {{ticketsIds}}",
- "hasAnyPositiveBase": "Base positivas para los tickets: {{ticketsIds}}",
- "You cannot assign an alias that you are not assigned to": "No puede asignar un alias que no tenga asignado",
- "This ticket cannot be left empty.": "Este ticket no se puede dejar vacío. %s",
- "The company has not informed the supplier account for bank transfers": "La empresa no tiene informado la cuenta de proveedor para transferencias bancarias",
- "You cannot assign/remove an alias that you are not assigned to": "No puede asignar/eliminar un alias que no tenga asignado",
- "This invoice has a linked vehicle.": "Esta factura tiene un vehiculo vinculado",
- "You don't have enough privileges.": "No tienes suficientes permisos.",
- "This ticket is locked": "Este ticket está bloqueado.",
- "This ticket is not editable.": "Este ticket no es editable.",
- "The ticket doesn't exist.": "No existe el ticket.",
- "Social name should be uppercase": "La razón social debe ir en mayúscula",
- "Street should be uppercase": "La dirección fiscal debe ir en mayúscula",
- "Ticket without Route": "Ticket sin ruta",
- "Select a different client": "Seleccione un cliente distinto",
- "Fill all the fields": "Rellene todos los campos",
- "The response is not a PDF": "La respuesta no es un PDF",
- "Booking completed": "Reserva completada",
- "The ticket is in preparation": "El ticket [{{ticketId}}]({{{ticketUrl}}}) del comercial {{salesPersonId}} está en preparación",
- "Incoterms data for consignee is missing": "Faltan los datos de los Incoterms para el consignatario",
- "The notification subscription of this worker cant be modified": "La subscripción a la notificación de este trabajador no puede ser modificada",
- "User disabled": "Usuario desactivado",
- "The amount cannot be less than the minimum": "La cantidad no puede ser menor que la cantidad mínima",
- "quantityLessThanMin": "La cantidad no puede ser menor que la cantidad mínima",
- "Cannot past travels with entries": "No se pueden pasar envíos con entradas",
- "It was not able to remove the next expeditions:": "No se pudo eliminar las siguientes expediciones: {{expeditions}}",
- "This claim has been updated": "La reclamación con Id: {{claimId}}, ha sido actualizada",
- "This user does not have an assigned tablet": "Este usuario no tiene tablet asignada",
- "Incorrect pin": "Pin incorrecto",
- "You already have the mailAlias": "Ya tienes este alias de correo",
- "The alias cant be modified": "Este alias de correo no puede ser modificado",
- "This ticket already has a cmr saved": "Este ticket ya tiene un cmr guardado",
- "Name should be uppercase": "El nombre debe ir en mayúscula",
- "Bank entity must be specified": "La entidad bancaria es obligatoria",
- "An email is necessary": "Es necesario un email",
- "You cannot update these fields": "No puedes actualizar estos campos",
- "CountryFK cannot be empty": "El país no puede estar vacío",
- "Cmr file does not exist": "El archivo del cmr no existe",
- "You are not allowed to modify the alias": "No estás autorizado a modificar el alias",
- "No tickets to invoice": "No hay tickets para facturar"
-}
+ "Phone format is invalid": "El formato del teléfono no es correcto",
+ "You are not allowed to change the credit": "No tienes privilegios para modificar el crédito",
+ "Unable to mark the equivalence surcharge": "No se puede marcar el recargo de equivalencia",
+ "The default consignee can not be unchecked": "No se puede desmarcar el consignatario predeterminado",
+ "Unable to default a disabled consignee": "No se puede poner predeterminado un consignatario desactivado",
+ "Can't be blank": "No puede estar en blanco",
+ "Invalid TIN": "NIF/CIF inválido",
+ "TIN must be unique": "El NIF/CIF debe ser único",
+ "A client with that Web User name already exists": "Ya existe un cliente con ese Usuario Web",
+ "Is invalid": "Es inválido",
+ "Quantity cannot be zero": "La cantidad no puede ser cero",
+ "Enter an integer different to zero": "Introduce un entero distinto de cero",
+ "Package cannot be blank": "El embalaje no puede estar en blanco",
+ "The company name must be unique": "La razón social debe ser única",
+ "Invalid email": "Correo electrónico inválido",
+ "The IBAN does not have the correct format": "El IBAN no tiene el formato correcto",
+ "That payment method requires an IBAN": "El método de pago seleccionado requiere un IBAN",
+ "That payment method requires a BIC": "El método de pago seleccionado requiere un BIC",
+ "State cannot be blank": "El estado no puede estar en blanco",
+ "Worker cannot be blank": "El trabajador no puede estar en blanco",
+ "Cannot change the payment method if no salesperson": "No se puede cambiar la forma de pago si no hay comercial asignado",
+ "can't be blank": "El campo no puede estar vacío",
+ "Observation type must be unique": "El tipo de observación no puede repetirse",
+ "The credit must be an integer greater than or equal to zero": "The credit must be an integer greater than or equal to zero",
+ "The grade must be similar to the last one": "El grade debe ser similar al último",
+ "Only manager can change the credit": "Solo el gerente puede cambiar el credito de este cliente",
+ "Name cannot be blank": "El nombre no puede estar en blanco",
+ "Phone cannot be blank": "El teléfono no puede estar en blanco",
+ "Period cannot be blank": "El periodo no puede estar en blanco",
+ "Choose a company": "Selecciona una empresa",
+ "Se debe rellenar el campo de texto": "Se debe rellenar el campo de texto",
+ "Description should have maximum of 45 characters": "La descripción debe tener maximo 45 caracteres",
+ "Cannot be blank": "El campo no puede estar en blanco",
+ "The grade must be an integer greater than or equal to zero": "El grade debe ser un entero mayor o igual a cero",
+ "Sample type cannot be blank": "El tipo de plantilla no puede quedar en blanco",
+ "Description cannot be blank": "Se debe rellenar el campo de texto",
+ "The price of the item changed": "El precio del artículo cambió",
+ "The value should not be greater than 100%": "El valor no debe de ser mayor de 100%",
+ "The value should be a number": "El valor debe ser un numero",
+ "This order is not editable": "Esta orden no se puede modificar",
+ "You can't create an order for a frozen client": "No puedes crear una orden para un cliente congelado",
+ "You can't create an order for a client that has a debt": "No puedes crear una orden para un cliente con deuda",
+ "is not a valid date": "No es una fecha valida",
+ "Barcode must be unique": "El código de barras debe ser único",
+ "The warehouse can't be repeated": "El almacén no puede repetirse",
+ "The tag or priority can't be repeated for an item": "El tag o prioridad no puede repetirse para un item",
+ "The observation type can't be repeated": "El tipo de observación no puede repetirse",
+ "A claim with that sale already exists": "Ya existe una reclamación para esta línea",
+ "You don't have enough privileges to change that field": "No tienes permisos para cambiar ese campo",
+ "Warehouse cannot be blank": "El almacén no puede quedar en blanco",
+ "Agency cannot be blank": "La agencia no puede quedar en blanco",
+ "Not enough privileges to edit a client with verified data": "No tienes permisos para hacer cambios en un cliente con datos comprobados",
+ "This address doesn't exist": "Este consignatario no existe",
+ "You must delete the claim id %d first": "Antes debes borrar la reclamación %d",
+ "You don't have enough privileges": "No tienes suficientes permisos",
+ "Cannot check Equalization Tax in this NIF/CIF": "No se puede marcar RE en este NIF/CIF",
+ "You can't make changes on the basic data of an confirmed order or with rows": "No puedes cambiar los datos básicos de una orden con artículos",
+ "INVALID_USER_NAME": "El nombre de usuario solo debe contener letras minúsculas o, a partir del segundo carácter, números o subguiones, no está permitido el uso de la letra ñ",
+ "You can't create a ticket for a frozen client": "No puedes crear un ticket para un cliente congelado",
+ "You can't create a ticket for an inactive client": "No puedes crear un ticket para un cliente inactivo",
+ "Tag value cannot be blank": "El valor del tag no puede quedar en blanco",
+ "ORDER_EMPTY": "Cesta vacía",
+ "You don't have enough privileges to do that": "No tienes permisos para cambiar esto",
+ "NO SE PUEDE DESACTIVAR EL CONSIGNAT": "NO SE PUEDE DESACTIVAR EL CONSIGNAT",
+ "Error. El NIF/CIF está repetido": "Error. El NIF/CIF está repetido",
+ "Street cannot be empty": "Dirección no puede estar en blanco",
+ "City cannot be empty": "Ciudad no puede estar en blanco",
+ "Code cannot be blank": "Código no puede estar en blanco",
+ "You cannot remove this department": "No puedes eliminar este departamento",
+ "The extension must be unique": "La extensión debe ser unica",
+ "The secret can't be blank": "La contraseña no puede estar en blanco",
+ "We weren't able to send this SMS": "No hemos podido enviar el SMS",
+ "This client can't be invoiced": "Este cliente no puede ser facturado",
+ "You must provide the correction information to generate a corrective invoice": "Debes informar la información de corrección para generar una factura rectificativa",
+ "This ticket can't be invoiced": "Este ticket no puede ser facturado",
+ "You cannot add or modify services to an invoiced ticket": "No puedes añadir o modificar servicios a un ticket facturado",
+ "This ticket can not be modified": "Este ticket no puede ser modificado",
+ "The introduced hour already exists": "Esta hora ya ha sido introducida",
+ "INFINITE_LOOP": "Existe una dependencia entre dos Jefes",
+ "The sales of the receiver ticket can't be modified": "Las lineas del ticket al que envias no pueden ser modificadas",
+ "NO_AGENCY_AVAILABLE": "No hay una zona de reparto disponible con estos parámetros",
+ "ERROR_PAST_SHIPMENT": "No puedes seleccionar una fecha de envío en pasado",
+ "The current ticket can't be modified": "El ticket actual no puede ser modificado",
+ "The current claim can't be modified": "La reclamación actual no puede ser modificada",
+ "The sales of this ticket can't be modified": "Las lineas de este ticket no pueden ser modificadas",
+ "The sales do not exists": "La(s) línea(s) seleccionada(s) no existe(n)",
+ "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",
+ "NO_ZONE_FOR_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada",
+ "This item doesn't exists": "El artículo no existe",
+ "NOT_ZONE_WITH_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada",
+ "Extension format is invalid": "El formato de la extensión es inválido",
+ "Invalid parameters to create a new ticket": "Parámetros inválidos para crear un nuevo ticket",
+ "This item is not available": "Este artículo no está disponible",
+ "This postcode already exists": "Este código postal ya existe",
+ "Concept cannot be blank": "El concepto no puede quedar en blanco",
+ "File doesn't exists": "El archivo no existe",
+ "You don't have privileges to change the zone": "No tienes permisos para cambiar la zona o para esos parámetros hay más de una opción de envío, hable con las agencias",
+ "This ticket is already on weekly tickets": "Este ticket ya está en tickets programados",
+ "Ticket id cannot be blank": "El id de ticket no puede quedar en blanco",
+ "Weekday cannot be blank": "El día de la semana no puede quedar en blanco",
+ "You can't delete a confirmed order": "No puedes borrar un pedido confirmado",
+ "The social name has an invalid format": "El nombre fiscal tiene un formato incorrecto",
+ "Invalid quantity": "Cantidad invalida",
+ "This postal code is not valid": "Este código postal no es válido",
+ "is invalid": "es inválido",
+ "The postcode doesn't exist. Please enter a correct one": "El código postal no existe. Por favor, introduce uno correcto",
+ "The department name can't be repeated": "El nombre del departamento no puede repetirse",
+ "This phone already exists": "Este teléfono ya existe",
+ "You cannot move a parent to its own sons": "No puedes mover un elemento padre a uno de sus hijos",
+ "You can't create a claim for a removed ticket": "No puedes crear una reclamación para un ticket eliminado",
+ "You cannot delete a ticket that part of it is being prepared": "No puedes eliminar un ticket en el que una parte que está siendo preparada",
+ "You must delete all the buy requests first": "Debes eliminar todas las peticiones de compra primero",
+ "You should specify a date": "Debes especificar una fecha",
+ "You should specify at least a start or end date": "Debes especificar al menos una fecha de inicio o de fin",
+ "Start date should be lower than end date": "La fecha de inicio debe ser menor que la fecha de fin",
+ "You should mark at least one week day": "Debes marcar al menos un día de la semana",
+ "Swift / BIC can't be empty": "Swift / BIC no puede estar vacío",
+ "Customs agent is required for a non UEE member": "El agente de aduanas es requerido para los clientes extracomunitarios",
+ "Incoterms is required for a non UEE member": "El incoterms es requerido para los clientes extracomunitarios",
+ "Deleted sales from ticket": "He eliminado las siguientes lineas del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{deletions}}}",
+ "Added sale to ticket": "He añadido la siguiente linea al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}",
+ "Changed sale discount": "He cambiado el descuento de las siguientes lineas al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
+ "Created claim": "He creado la reclamación [{{claimId}}]({{{claimUrl}}}) de las siguientes lineas del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
+ "Changed sale price": "He cambiado el precio de [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) de {{oldPrice}}€ ➔ *{{newPrice}}€* del ticket [{{ticketId}}]({{{ticketUrl}}})",
+ "Changed sale quantity": "He cambiado la cantidad de [{{itemId}} {{concept}}]({{{itemUrl}}}) de {{oldQuantity}} ➔ *{{newQuantity}}* del ticket [{{ticketId}}]({{{ticketUrl}}})",
+ "State": "Estado",
+ "regular": "normal",
+ "reserved": "reservado",
+ "Changed sale reserved state": "He cambiado el estado reservado de las siguientes lineas al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
+ "Bought units from buy request": "Se ha comprado {{quantity}} unidades de [{{itemId}} {{concept}}]({{{urlItem}}}) para el ticket id [{{ticketId}}]({{{url}}})",
+ "Deny buy request": "Se ha rechazado la petición de compra para el ticket id [{{ticketId}}]({{{url}}}). Motivo: {{observation}}",
+ "MESSAGE_INSURANCE_CHANGE": "He cambiado el crédito asegurado del cliente [{{clientName}} ({{clientId}})]({{{url}}}) a *{{credit}} €*",
+ "Changed client paymethod": "He cambiado la forma de pago del cliente [{{clientName}} ({{clientId}})]({{{url}}})",
+ "Sent units from ticket": "Envio *{{quantity}}* unidades de [{{concept}} ({{itemId}})]({{{itemUrl}}}) a *\"{{nickname}}\"* provenientes del ticket id [{{ticketId}}]({{{ticketUrl}}})",
+ "Change quantity": "{{concept}} cambia de {{oldQuantity}} a {{newQuantity}}",
+ "Claim will be picked": "Se recogerá el género de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}*, con el tipo de recogida *{{claimPickup}}*",
+ "Claim state has changed to": "Se ha cambiado el estado de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}* a *{{newState}}*",
+ "Client checked as validated despite of duplication": "Cliente comprobado a pesar de que existe el cliente id {{clientId}}",
+ "ORDER_ROW_UNAVAILABLE": "No hay disponibilidad de este producto",
+ "Distance must be lesser than 4000": "La distancia debe ser inferior a 4000",
+ "This ticket is deleted": "Este ticket está eliminado",
+ "Unable to clone this travel": "No ha sido posible clonar este travel",
+ "This thermograph id already exists": "La id del termógrafo ya existe",
+ "Choose a date range or days forward": "Selecciona un rango de fechas o días en adelante",
+ "ORDER_ALREADY_CONFIRMED": "ORDEN YA CONFIRMADA",
+ "Invalid password": "Invalid password",
+ "Password does not meet requirements": "La contraseña no cumple los requisitos",
+ "Role already assigned": "Rol ya asignado",
+ "Invalid role name": "Nombre de rol no válido",
+ "Role name must be written in camelCase": "El nombre del rol debe escribirse en camelCase",
+ "Email already exists": "El correo ya existe",
+ "User already exists": "El/La usuario/a ya existe",
+ "Absence change notification on the labour calendar": "Notificación de cambio de ausencia en el calendario laboral",
+ "Record of hours week": "Registro de horas semana {{week}} año {{year}} ",
+ "Created absence": "El empleado {{author}} ha añadido una ausencia de tipo '{{absenceType}}' a {{employee}} para el día {{dated}}.",
+ "Deleted absence": "El empleado {{author}} ha eliminado una ausencia de tipo '{{absenceType}}' a {{employee}} del día {{dated}}.",
+ "I have deleted the ticket id": "He eliminado el ticket id [{{id}}]({{{url}}})",
+ "I have restored the ticket id": "He restaurado el ticket id [{{id}}]({{{url}}})",
+ "You can only restore a ticket within the first hour after deletion": "Únicamente puedes restaurar el ticket dentro de la primera hora después de su eliminación",
+ "Changed this data from the ticket": "He cambiado estos datos del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
+ "agencyModeFk": "Agencia",
+ "clientFk": "Cliente",
+ "zoneFk": "Zona",
+ "warehouseFk": "Almacén",
+ "shipped": "F. envío",
+ "landed": "F. entrega",
+ "addressFk": "Consignatario",
+ "companyFk": "Empresa",
+ "agency": "Agencia",
+ "delivery": "Reparto",
+ "The social name cannot be empty": "La razón social no puede quedar en blanco",
+ "The nif cannot be empty": "El NIF no puede quedar en blanco",
+ "You need to fill sage information before you check verified data": "Debes rellenar la información de sage antes de marcar datos comprobados",
+ "ASSIGN_ZONE_FIRST": "Asigna una zona primero",
+ "Amount cannot be zero": "El importe no puede ser cero",
+ "Company has to be official": "Empresa inválida",
+ "You can not select this payment method without a registered bankery account": "No se puede utilizar este método de pago si no has registrado una cuenta bancaria",
+ "Action not allowed on the test environment": "Esta acción no está permitida en el entorno de pruebas",
+ "The selected ticket is not suitable for this route": "El ticket seleccionado no es apto para esta ruta",
+ "New ticket request has been created with price": "Se ha creado una nueva petición de compra '{{description}}' para el día *{{shipped}}*, con una cantidad de *{{quantity}}* y un precio de *{{price}} €*",
+ "New ticket request has been created": "Se ha creado una nueva petición de compra '{{description}}' para el día *{{shipped}}*, con una cantidad de *{{quantity}}*",
+ "Swift / BIC cannot be empty": "Swift / BIC no puede estar vacío",
+ "This BIC already exist.": "Este BIC ya existe.",
+ "That item doesn't exists": "Ese artículo no existe",
+ "There's a new urgent ticket:": "Hay un nuevo ticket urgente:",
+ "Invalid account": "Cuenta inválida",
+ "Compensation account is empty": "La cuenta para compensar está vacia",
+ "This genus already exist": "Este genus ya existe",
+ "This specie already exist": "Esta especie ya existe",
+ "Client assignment has changed": "He cambiado el comercial ~*\"<{{previousWorkerName}}>\"*~ por *\"<{{currentWorkerName}}>\"* del cliente [{{clientName}} ({{clientId}})]({{{url}}})",
+ "None": "Ninguno",
+ "The contract was not active during the selected date": "El contrato no estaba activo durante la fecha seleccionada",
+ "Cannot add more than one '1/2 day vacation'": "No puedes añadir más de un 'Vacaciones 1/2 dia'",
+ "This document already exists on this ticket": "Este documento ya existe en el ticket",
+ "Some of the selected tickets are not billable": "Algunos de los tickets seleccionados no son facturables",
+ "You can't invoice tickets from multiple clients": "No puedes facturar tickets de multiples clientes",
+ "nickname": "nickname",
+ "INACTIVE_PROVIDER": "Proveedor inactivo",
+ "This client is not invoiceable": "Este cliente no es facturable",
+ "serial non editable": "Esta serie no permite asignar la referencia",
+ "Max shipped required": "La fecha límite es requerida",
+ "Can't invoice to future": "No se puede facturar a futuro",
+ "Can't invoice to past": "No se puede facturar a pasado",
+ "This ticket is already invoiced": "Este ticket ya está facturado",
+ "A ticket with an amount of zero can't be invoiced": "No se puede facturar un ticket con importe cero",
+ "A ticket with a negative base can't be invoiced": "No se puede facturar un ticket con una base negativa",
+ "Global invoicing failed": "[Facturación global] No se han podido facturar algunos clientes",
+ "Wasn't able to invoice the following clients": "No se han podido facturar los siguientes clientes",
+ "Can't verify data unless the client has a business type": "No se puede verificar datos de un cliente que no tiene tipo de negocio",
+ "You don't have enough privileges to set this credit amount": "No tienes suficientes privilegios para establecer esta cantidad de crédito",
+ "You can't change the credit set to zero from a financialBoss": "No puedes cambiar el cŕedito establecido a cero por un jefe de finanzas",
+ "Amounts do not match": "Las cantidades no coinciden",
+ "The PDF document does not exist": "El documento PDF no existe. Prueba a regenerarlo desde la opción 'Regenerar PDF factura'",
+ "The type of business must be filled in basic data": "El tipo de negocio debe estar rellenado en datos básicos",
+ "You can't create a claim from a ticket delivered more than seven days ago": "No puedes crear una reclamación de un ticket entregado hace más de siete días",
+ "The worker has hours recorded that day": "El trabajador tiene horas fichadas ese día",
+ "The worker has a marked absence that day": "El trabajador tiene marcada una ausencia ese día",
+ "You can not modify is pay method checked": "No se puede modificar el campo método de pago validado",
+ "The account size must be exactly 10 characters": "El tamaño de la cuenta debe ser exactamente de 10 caracteres",
+ "Can't transfer claimed sales": "No puedes transferir lineas reclamadas",
+ "You don't have privileges to create refund": "No tienes permisos para crear un abono",
+ "The item is required": "El artículo es requerido",
+ "The agency is already assigned to another autonomous": "La agencia ya está asignada a otro autónomo",
+ "date in the future": "Fecha en el futuro",
+ "reference duplicated": "Referencia duplicada",
+ "This ticket is already a refund": "Este ticket ya es un abono",
+ "isWithoutNegatives": "Sin negativos",
+ "routeFk": "routeFk",
+ "Can't change the password of another worker": "No se puede cambiar la contraseña de otro trabajador",
+ "No hay un contrato en vigor": "No hay un contrato en vigor",
+ "No se permite fichar a futuro": "No se permite fichar a futuro",
+ "No está permitido trabajar": "No está permitido trabajar",
+ "Fichadas impares": "Fichadas impares",
+ "Descanso diario 12h.": "Descanso diario 12h.",
+ "Descanso semanal 36h. / 72h.": "Descanso semanal 36h. / 72h.",
+ "Dirección incorrecta": "Dirección incorrecta",
+ "Modifiable user details only by an administrator": "Detalles de usuario modificables solo por un administrador",
+ "Modifiable password only via recovery or by an administrator": "Contraseña modificable solo a través de la recuperación o por un administrador",
+ "Not enough privileges to edit a client": "No tienes suficientes privilegios para editar un cliente",
+ "This route does not exists": "Esta ruta no existe",
+ "Claim pickup order sent": "Reclamación Orden de recogida enviada [{{claimId}}]({{{claimUrl}}}) al cliente *{{clientName}}*",
+ "You don't have grant privilege": "No tienes privilegios para dar privilegios",
+ "You don't own the role and you can't assign it to another user": "No eres el propietario del rol y no puedes asignarlo a otro usuario",
+ "Ticket merged": "Ticket [{{originId}}]({{{originFullPath}}}) ({{{originDated}}}) fusionado con [{{destinationId}}]({{{destinationFullPath}}}) ({{{destinationDated}}})",
+ "Already has this status": "Ya tiene este estado",
+ "There aren't records for this week": "No existen registros para esta semana",
+ "Empty data source": "Origen de datos vacio",
+ "App locked": "Aplicación bloqueada por el usuario {{userId}}",
+ "Email verify": "Correo de verificación",
+ "Landing cannot be lesser than shipment": "Landing cannot be lesser than shipment",
+ "Receipt's bank was not found": "No se encontró el banco del recibo",
+ "This receipt was not compensated": "Este recibo no ha sido compensado",
+ "Client's email was not found": "No se encontró el email del cliente",
+ "Negative basis": "Base negativa",
+ "This worker code already exists": "Este codigo de trabajador ya existe",
+ "This personal mail already exists": "Este correo personal ya existe",
+ "This worker already exists": "Este trabajador ya existe",
+ "App name does not exist": "El nombre de aplicación no es válido",
+ "Try again": "Vuelve a intentarlo",
+ "Aplicación bloqueada por el usuario 9": "Aplicación bloqueada por el usuario 9",
+ "Failed to upload delivery note": "Error al subir albarán {{id}}",
+ "The DOCUWARE PDF document does not exists": "El documento PDF Docuware no existe",
+ "It is not possible to modify tracked sales": "No es posible modificar líneas de pedido que se hayan empezado a preparar",
+ "It is not possible to modify sales that their articles are from Floramondo": "No es posible modificar líneas de pedido cuyos artículos sean de Floramondo",
+ "It is not possible to modify cloned sales": "No es posible modificar líneas de pedido clonadas",
+ "A supplier with the same name already exists. Change the country.": "Un proveedor con el mismo nombre ya existe. Cambie el país.",
+ "There is no assigned email for this client": "No hay correo asignado para este cliente",
+ "Exists an invoice with a future date": "Existe una factura con fecha posterior",
+ "Invoice date can't be less than max date": "La fecha de factura no puede ser inferior a la fecha límite",
+ "Warehouse inventory not set": "El almacén inventario no está establecido",
+ "This locker has already been assigned": "Esta taquilla ya ha sido asignada",
+ "Tickets with associated refunds": "No se pueden borrar tickets con abonos asociados. Este ticket está asociado al abono Nº %d",
+ "Not exist this branch": "La rama no existe",
+ "This ticket cannot be signed because it has not been boxed": "Este ticket no puede firmarse porque no ha sido encajado",
+ "Collection does not exist": "La colección no existe",
+ "Cannot obtain exclusive lock": "No se puede obtener un bloqueo exclusivo",
+ "Insert a date range": "Inserte un rango de fechas",
+ "Added observation": "{{user}} añadió esta observacion: {{text}}",
+ "Comment added to client": "Observación añadida al cliente {{clientFk}}",
+ "Invalid auth code": "Código de verificación incorrecto",
+ "Invalid or expired verification code": "Código de verificación incorrecto o expirado",
+ "Cannot create a new claimBeginning from a different ticket": "No se puede crear una línea de reclamación de un ticket diferente al origen",
+ "company": "Compañía",
+ "country": "País",
+ "clientId": "Id cliente",
+ "clientSocialName": "Cliente",
+ "amount": "Importe",
+ "taxableBase": "Base",
+ "ticketFk": "Id ticket",
+ "isActive": "Activo",
+ "hasToInvoice": "Facturar",
+ "isTaxDataChecked": "Datos comprobados",
+ "comercialId": "Id comercial",
+ "comercialName": "Comercial",
+ "Pass expired": "La contraseña ha caducado, cambiela desde Salix",
+ "Invalid NIF for VIES": "Invalid NIF for VIES",
+ "Ticket does not exist": "Este ticket no existe",
+ "Ticket is already signed": "Este ticket ya ha sido firmado",
+ "Authentication failed": "Autenticación fallida",
+ "You can't use the same password": "No puedes usar la misma contraseña",
+ "You can only add negative amounts in refund tickets": "Solo se puede añadir cantidades negativas en tickets abono",
+ "Fecha fuera de rango": "Fecha fuera de rango",
+ "Error while generating PDF": "Error al generar PDF",
+ "Error when sending mail to client": "Error al enviar el correo al cliente",
+ "Mail not sent": "Se ha producido un fallo al enviar la factura al cliente [{{clientId}}]({{{clientUrl}}}), por favor revisa la dirección de correo electrónico",
+ "The renew period has not been exceeded": "El periodo de renovación no ha sido superado",
+ "Valid priorities": "Prioridades válidas: %d",
+ "hasAnyNegativeBase": "Base negativa para los tickets: {{ticketsIds}}",
+ "hasAnyPositiveBase": "Base positivas para los tickets: {{ticketsIds}}",
+ "You cannot assign an alias that you are not assigned to": "No puede asignar un alias que no tenga asignado",
+ "This ticket cannot be left empty.": "Este ticket no se puede dejar vacío. %s",
+ "The company has not informed the supplier account for bank transfers": "La empresa no tiene informado la cuenta de proveedor para transferencias bancarias",
+ "You cannot assign/remove an alias that you are not assigned to": "No puede asignar/eliminar un alias que no tenga asignado",
+ "This invoice has a linked vehicle.": "Esta factura tiene un vehiculo vinculado",
+ "You don't have enough privileges.": "No tienes suficientes permisos.",
+ "This ticket is locked": "Este ticket está bloqueado.",
+ "This ticket is not editable.": "Este ticket no es editable.",
+ "The ticket doesn't exist.": "No existe el ticket.",
+ "Social name should be uppercase": "La razón social debe ir en mayúscula",
+ "Street should be uppercase": "La dirección fiscal debe ir en mayúscula",
+ "Ticket without Route": "Ticket sin ruta",
+ "Select a different client": "Seleccione un cliente distinto",
+ "Fill all the fields": "Rellene todos los campos",
+ "The response is not a PDF": "La respuesta no es un PDF",
+ "Booking completed": "Reserva completada",
+ "The ticket is in preparation": "El ticket [{{ticketId}}]({{{ticketUrl}}}) del comercial {{salesPersonId}} está en preparación",
+ "The notification subscription of this worker cant be modified": "La subscripción a la notificación de este trabajador no puede ser modificada",
+ "User disabled": "Usuario desactivado",
+ "The amount cannot be less than the minimum": "La cantidad no puede ser menor que la cantidad mínima",
+ "quantityLessThanMin": "La cantidad no puede ser menor que la cantidad mínima",
+ "Cannot past travels with entries": "No se pueden pasar envíos con entradas",
+ "It was not able to remove the next expeditions:": "No se pudo eliminar las siguientes expediciones: {{expeditions}}",
+ "This claim has been updated": "La reclamación con Id: {{claimId}}, ha sido actualizada",
+ "This user does not have an assigned tablet": "Este usuario no tiene tablet asignada",
+ "Field are invalid": "El campo '{{tag}}' no es válido",
+ "Incorrect pin": "Pin incorrecto.",
+ "You already have the mailAlias": "Ya tienes este alias de correo",
+ "The alias cant be modified": "Este alias de correo no puede ser modificado",
+ "No tickets to invoice": "No hay tickets para facturar",
+ "this warehouse has not dms": "El Almacén no acepta documentos",
+ "This ticket already has a cmr saved": "Este ticket ya tiene un cmr guardado",
+ "Name should be uppercase": "El nombre debe ir en mayúscula",
+ "Bank entity must be specified": "La entidad bancaria es obligatoria",
+ "An email is necessary": "Es necesario un email",
+ "You cannot update these fields": "No puedes actualizar estos campos",
+ "CountryFK cannot be empty": "El país no puede estar vacío",
+ "Cmr file does not exist": "El archivo del cmr no existe",
+ "You are not allowed to modify the alias": "No estás autorizado a modificar el alias",
+ "The address of the customer must have information about Incoterms and Customs Agent": "El consignatario del cliente debe tener informado Incoterms y Agente de aduanas",
+ "The line could not be marked": "La linea no puede ser marcada",
+ "This password can only be changed by the user themselves": "Esta contraseña solo puede ser modificada por el propio usuario",
+ "They're not your subordinate": "No es tu subordinado/a.",
+ "No results found": "No se han encontrado resultados"
+}
\ No newline at end of file
diff --git a/loopback/server/connectors/vn-mysql.js b/loopback/server/connectors/vn-mysql.js
index 737fd94d5..5edef4395 100644
--- a/loopback/server/connectors/vn-mysql.js
+++ b/loopback/server/connectors/vn-mysql.js
@@ -275,7 +275,7 @@ class VnMySQL extends MySQL {
}
invokeMethod(method, args, model, ctx, opts, cb) {
- if (!this.isLoggable(model))
+ if (!this.isLoggable(model) && !opts?.userId)
return super[method].apply(this, args);
this.invokeMethodP(method, [...args], model, ctx, opts)
@@ -287,11 +287,11 @@ class VnMySQL extends MySQL {
let tx;
if (!opts.transaction) {
tx = await Transaction.begin(this, {});
- opts = Object.assign({transaction: tx, httpCtx: opts.httpCtx}, opts);
+ opts = Object.assign({transaction: tx}, opts);
}
try {
- const userId = opts.httpCtx && opts.httpCtx.active?.accessToken?.userId;
+ const {userId} = opts;
if (userId) {
const user = await Model.app.models.VnUser.findById(userId, {fields: ['name']}, opts);
await this.executeP(`CALL account.myUser_loginWithName(?)`, [user.name], opts);
diff --git a/loopback/server/datasources.json b/loopback/server/datasources.json
index aadee048c..341d5d578 100644
--- a/loopback/server/datasources.json
+++ b/loopback/server/datasources.json
@@ -103,6 +103,35 @@
"video/mp4"
]
},
+ "entryStorage": {
+ "name": "entryStorage",
+ "connector": "loopback-component-storage",
+ "provider": "filesystem",
+ "root": "./storage/dms",
+ "maxFileSize": "31457280",
+ "allowedContentTypes": [
+ "image/png",
+ "image/jpeg",
+ "image/jpg",
+ "image/webp",
+ "video/mp4"
+ ]
+ },
+ "supplierStorage": {
+ "name": "supplierStorage",
+ "connector": "loopback-component-storage",
+ "provider": "filesystem",
+ "root": "./storage/dms",
+ "maxFileSize": "31457280",
+ "allowedContentTypes": [
+ "image/png",
+ "image/jpeg",
+ "image/jpg",
+ "image/webp",
+ "video/mp4",
+ "application/pdf"
+ ]
+ },
"accessStorage": {
"name": "accessStorage",
"connector": "loopback-component-storage",
diff --git a/loopback/util/validateIban.js b/loopback/util/validateIban.js
index ed3e00426..2386538b5 100644
--- a/loopback/util/validateIban.js
+++ b/loopback/util/validateIban.js
@@ -3,7 +3,6 @@ module.exports = function(iban, countryCode) {
if (typeof iban != 'string') return false;
if (countryCode?.toLowerCase() != 'es') return true;
- iban = iban.toUpperCase();
iban = trim(iban);
iban = iban.replace(/\s/g, '');
diff --git a/modules/account/back/methods/account/logout.js b/modules/account/back/methods/account/logout.js
index 5db3efa33..7d2e8153e 100644
--- a/modules/account/back/methods/account/logout.js
+++ b/modules/account/back/methods/account/logout.js
@@ -15,7 +15,8 @@ module.exports = Self => {
http: {
path: `/logout`,
verb: 'POST'
- }
+ },
+ accessScopes: ['DEFAULT', 'read:multimedia']
});
Self.logout = async ctx => Self.app.models.VnUser.logout(ctx.req.accessToken.id);
diff --git a/modules/account/back/models/account.js b/modules/account/back/models/account.js
index 5021a5d94..ceb26053c 100644
--- a/modules/account/back/models/account.js
+++ b/modules/account/back/models/account.js
@@ -1,4 +1,7 @@
+const ForbiddenError = require('vn-loopback/util/forbiddenError');
+const {models} = require('vn-loopback/server/server');
+
module.exports = Self => {
require('../methods/account/sync')(Self);
require('../methods/account/sync-by-id')(Self);
@@ -7,4 +10,11 @@ module.exports = Self => {
require('../methods/account/logout')(Self);
require('../methods/account/change-password')(Self);
require('../methods/account/set-password')(Self);
+
+ Self.setUnverifiedPassword = async(id, pass, options) => {
+ const {emailVerified} = await models.VnUser.findById(id, {fields: ['emailVerified']}, options);
+ if (emailVerified) throw new ForbiddenError('This password can only be changed by the user themselves');
+
+ await models.VnUser.setPassword(id, pass, options);
+ };
};
diff --git a/modules/account/back/models/mail-alias-account.json b/modules/account/back/models/mail-alias-account.json
index 416c2acd8..54e986ef7 100644
--- a/modules/account/back/models/mail-alias-account.json
+++ b/modules/account/back/models/mail-alias-account.json
@@ -23,5 +23,20 @@
"model": "VnUser",
"foreignKey": "account"
}
- }
+ },
+ "acls": [
+ {
+ "property": "create",
+ "accessType": "WRITE",
+ "principalType": "ROLE",
+ "principalId": "$authenticated",
+ "permission": "ALLOW"
+ }, {
+ "property": "deleteById",
+ "accessType": "WRITE",
+ "principalType": "ROLE",
+ "principalId": "$authenticated",
+ "permission": "ALLOW"
+ }
+ ]
}
diff --git a/modules/claim/back/locale/claim/en.yml b/modules/claim/back/locale/claim/en.yml
index 7c3ee7555..75416938a 100644
--- a/modules/claim/back/locale/claim/en.yml
+++ b/modules/claim/back/locale/claim/en.yml
@@ -6,7 +6,6 @@ columns:
isChargedToMana: charged to mana
created: created
responsibility: responsibility
- hasToPickUp: has to pickUp
ticketFk: ticket
claimStateFk: claim state
workerFk: worker
diff --git a/modules/claim/back/locale/claim/es.yml b/modules/claim/back/locale/claim/es.yml
index 27fd76ceb..e61c6a396 100644
--- a/modules/claim/back/locale/claim/es.yml
+++ b/modules/claim/back/locale/claim/es.yml
@@ -6,7 +6,6 @@ columns:
isChargedToMana: cargado al maná
created: creado
responsibility: responsabilidad
- hasToPickUp: es recogida
ticketFk: ticket
claimStateFk: estado reclamación
workerFk: trabajador
diff --git a/modules/claim/back/methods/claim-state/specs/isEditable.spec.js b/modules/claim/back/methods/claim-state/specs/isEditable.spec.js
index 1fb8e1536..6d97eed06 100644
--- a/modules/claim/back/methods/claim-state/specs/isEditable.spec.js
+++ b/modules/claim/back/methods/claim-state/specs/isEditable.spec.js
@@ -64,7 +64,7 @@ describe('claimstate isEditable()', () => {
const options = {transaction: tx};
const ctx = {req: {accessToken: {userId: claimManagerId}}};
- const result = await app.models.ClaimState.isEditable(ctx, 7, options);
+ const result = await app.models.ClaimState.isEditable(ctx, 5, options);
expect(result).toEqual(true);
diff --git a/modules/claim/back/methods/claim/claimPickupPdf.js b/modules/claim/back/methods/claim/claimPickupPdf.js
index 4927efa0f..390be33b9 100644
--- a/modules/claim/back/methods/claim/claimPickupPdf.js
+++ b/modules/claim/back/methods/claim/claimPickupPdf.js
@@ -34,7 +34,8 @@ module.exports = Self => {
http: {
path: '/:id/claim-pickup-pdf',
verb: 'GET'
- }
+ },
+ //accessScopes: ['read:multimedia']
});
Self.claimPickupPdf = (ctx, id) => Self.printReport(ctx, id, 'claim-pickup-order');
diff --git a/modules/claim/back/methods/claim/downloadFile.js b/modules/claim/back/methods/claim/downloadFile.js
index 750356b0b..7e49708f5 100644
--- a/modules/claim/back/methods/claim/downloadFile.js
+++ b/modules/claim/back/methods/claim/downloadFile.js
@@ -32,7 +32,8 @@ module.exports = Self => {
http: {
path: `/:id/downloadFile`,
verb: 'GET'
- }
+ },
+ //accessScopes: ['read:multimedia']
});
Self.downloadFile = async function(ctx, id) {
diff --git a/modules/claim/back/methods/claim/specs/log.spec.js b/modules/claim/back/methods/claim/specs/log.spec.js
index 0ae534f1e..cef91b873 100644
--- a/modules/claim/back/methods/claim/specs/log.spec.js
+++ b/modules/claim/back/methods/claim/specs/log.spec.js
@@ -11,7 +11,7 @@ describe('claim log()', () => {
model: 'Claim',
action: 'update',
changes: [
- {property: 'hasToPickUp', before: false, after: true}
+ {property: 'pickup', before: null, after: 'agency'}
]
};
diff --git a/modules/claim/back/methods/claim/specs/updateClaim.spec.js b/modules/claim/back/methods/claim/specs/updateClaim.spec.js
index e2d5fcfeb..b7725e7f8 100644
--- a/modules/claim/back/methods/claim/specs/updateClaim.spec.js
+++ b/modules/claim/back/methods/claim/specs/updateClaim.spec.js
@@ -21,12 +21,13 @@ describe('Update Claim', () => {
claimStatesMap = claimStates.reduce((acc, state) => ({...acc, [state.code]: state.id}), {});
});
const newDate = Date.vnNew();
+ const claimManagerId = 72;
const originalData = {
ticketFk: 3,
clientFk: 1101,
ticketCreated: newDate,
workerFk: 18,
- claimStateFk: 2,
+ claimStateFk: 5,
isChargedToMana: true,
responsibility: 4,
observation: 'observation'
@@ -77,7 +78,6 @@ describe('Update Claim', () => {
spyOn(chatModel, 'sendCheckingPresence').and.callThrough();
const pendingState = claimStatesMap.pending;
- const claimManagerId = 72;
const ctx = {
req: {
accessToken: {userId: claimManagerId},
@@ -86,7 +86,7 @@ describe('Update Claim', () => {
args: {
observation: 'valid observation',
claimStateFk: pendingState,
- hasToPickUp: false
+ pickup: null
}
};
ctx.req.__ = i18n.__;
@@ -104,85 +104,7 @@ describe('Update Claim', () => {
}
});
- it(`should success to update the claimState to 'managed' and send a rocket message`, async() => {
- const tx = await app.models.Claim.beginTransaction({});
-
- try {
- const options = {transaction: tx};
-
- const newClaim = await app.models.Claim.create(originalData, options);
-
- const chatModel = app.models.Chat;
- spyOn(chatModel, 'sendCheckingPresence').and.callThrough();
-
- const managedState = claimStatesMap.managed;
- const claimManagerId = 72;
- const ctx = {
- req: {
- accessToken: {userId: claimManagerId},
- headers: {origin: url}
- },
- args: {
- observation: 'valid observation',
- claimStateFk: managedState,
- hasToPickUp: false
- }
- };
- ctx.req.__ = i18n.__;
- await app.models.Claim.updateClaim(ctx, newClaim.id, options);
-
- let updatedClaim = await app.models.Claim.findById(newClaim.id, null, options);
-
- expect(updatedClaim.observation).toEqual(ctx.args.observation);
- expect(chatModel.sendCheckingPresence).toHaveBeenCalled();
-
- await tx.rollback();
- } catch (e) {
- await tx.rollback();
- throw e;
- }
- });
-
- it(`should success to update the claimState to 'resolved' and send a rocket message`, async() => {
- const tx = await app.models.Claim.beginTransaction({});
-
- try {
- const options = {transaction: tx};
-
- const newClaim = await app.models.Claim.create(originalData, options);
-
- const chatModel = app.models.Chat;
- spyOn(chatModel, 'sendCheckingPresence').and.callThrough();
-
- const resolvedState = claimStatesMap.resolved;
- const claimManagerId = 72;
- const ctx = {
- req: {
- accessToken: {userId: claimManagerId},
- headers: {origin: url}
- },
- args: {
- observation: 'valid observation',
- claimStateFk: resolvedState,
- hasToPickUp: false
- }
- };
- ctx.req.__ = i18n.__;
- await app.models.Claim.updateClaim(ctx, newClaim.id, options);
-
- let updatedClaim = await app.models.Claim.findById(newClaim.id, null, options);
-
- expect(updatedClaim.observation).toEqual(ctx.args.observation);
- expect(chatModel.sendCheckingPresence).toHaveBeenCalled();
-
- await tx.rollback();
- } catch (e) {
- await tx.rollback();
- throw e;
- }
- });
-
- it(`should success to update the claimState to 'canceled' and send a rocket message`, async() => {
+ it(`should success to update the claimState to 'canceled' and send two rocket message`, async() => {
const tx = await app.models.Claim.beginTransaction({});
try {
@@ -194,7 +116,6 @@ describe('Update Claim', () => {
spyOn(chatModel, 'sendCheckingPresence').and.callThrough();
const canceledState = claimStatesMap.canceled;
- const claimManagerId = 72;
const ctx = {
req: {
accessToken: {userId: claimManagerId},
@@ -203,7 +124,7 @@ describe('Update Claim', () => {
args: {
observation: 'valid observation',
claimStateFk: canceledState,
- hasToPickUp: false
+ pickup: null
}
};
ctx.req.__ = i18n.__;
@@ -212,46 +133,7 @@ describe('Update Claim', () => {
let updatedClaim = await app.models.Claim.findById(newClaim.id, null, options);
expect(updatedClaim.observation).toEqual(ctx.args.observation);
- expect(chatModel.sendCheckingPresence).toHaveBeenCalled();
-
- await tx.rollback();
- } catch (e) {
- await tx.rollback();
- throw e;
- }
- });
-
- it(`should success to update the claimState to 'incomplete' and send a rocket message`, async() => {
- const tx = await app.models.Claim.beginTransaction({});
-
- try {
- const options = {transaction: tx};
-
- const newClaim = await app.models.Claim.create(originalData, options);
-
- const chatModel = app.models.Chat;
- spyOn(chatModel, 'sendCheckingPresence').and.callThrough();
-
- const incompleteState = 5;
- const claimManagerId = 72;
- const ctx = {
- req: {
- accessToken: {userId: claimManagerId},
- headers: {origin: url}
- },
- args: {
- observation: 'valid observation',
- claimStateFk: incompleteState,
- hasToPickUp: false
- }
- };
- ctx.req.__ = i18n.__;
- await app.models.Claim.updateClaim(ctx, newClaim.id, options);
-
- let updatedClaim = await app.models.Claim.findById(newClaim.id, null, options);
-
- expect(updatedClaim.observation).toEqual(ctx.args.observation);
- expect(chatModel.sendCheckingPresence).toHaveBeenCalled();
+ expect(chatModel.sendCheckingPresence).toHaveBeenCalledTimes(2);
await tx.rollback();
} catch (e) {
@@ -281,7 +163,7 @@ describe('Update Claim', () => {
claimStateFk: 3,
workerFk: 5,
observation: 'another valid observation',
- hasToPickUp: true
+ pickup: 'agency'
}
};
ctx.req.__ = i18n.__;
diff --git a/modules/claim/back/methods/claim/specs/updateClaimAction.spec.js b/modules/claim/back/methods/claim/specs/updateClaimAction.spec.js
index 2f16d002c..99436fed6 100644
--- a/modules/claim/back/methods/claim/specs/updateClaimAction.spec.js
+++ b/modules/claim/back/methods/claim/specs/updateClaimAction.spec.js
@@ -21,7 +21,7 @@ describe('Update Claim', () => {
clientFk: 1101,
ticketCreated: newDate,
workerFk: 18,
- claimStateFk: 2,
+ claimStateFk: 1,
isChargedToMana: true,
responsibility: 4,
observation: 'observation'
diff --git a/modules/claim/back/methods/claim/updateClaim.js b/modules/claim/back/methods/claim/updateClaim.js
index 68fff7846..a206d7f3e 100644
--- a/modules/claim/back/methods/claim/updateClaim.js
+++ b/modules/claim/back/methods/claim/updateClaim.js
@@ -27,8 +27,8 @@ module.exports = Self => {
type: 'string'
},
{
- arg: 'hasToPickUp',
- type: 'boolean'
+ arg: 'pickup',
+ type: 'any'
},
{
arg: 'packages',
@@ -72,9 +72,7 @@ module.exports = Self => {
// Get sales person from claim client
const salesPerson = claim.client().salesPersonUser();
- let changedHasToPickUp = false;
- if (args.hasToPickUp)
- changedHasToPickUp = true;
+ const changedPickup = args.pickup != claim.pickup;
// Validate when claimState has been changed
if (args.claimStateFk) {
@@ -82,23 +80,23 @@ module.exports = Self => {
const canEditNewState = await models.ClaimState.isEditable(ctx, args.claimStateFk, myOptions);
const canEditState = await models.ACL.checkAccessAcl(ctx, 'Claim', 'editState', 'WRITE');
- if (!canEditOldState || !canEditNewState || changedHasToPickUp && !canEditState)
+ if (!canEditOldState || !canEditNewState || changedPickup && !canEditState)
throw new UserError(`You don't have enough privileges to change that field`);
}
delete args.ctx;
const updatedClaim = await claim.updateAttributes(args, myOptions);
- // When hasToPickUp has been changed
- if (salesPerson && changedHasToPickUp && updatedClaim.hasToPickUp)
+ // When pickup has been changed
+ if (salesPerson && changedPickup && updatedClaim.pickup)
await notifyPickUp(ctx, salesPerson.id, claim);
// When claimState has been changed
if (args.claimStateFk) {
const newState = await models.ClaimState.findById(args.claimStateFk, null, myOptions);
- await notifyStateChange(ctx, salesPerson.id, claim, newState.code);
+ await notifyStateChange(ctx, salesPerson.id, claim, newState.description);
if (newState.code == 'canceled')
- await notifyStateChange(ctx, claim.workerFk, claim, newState.code);
+ await notifyStateChange(ctx, claim.workerFk, claim, newState.description);
}
if (tx) await tx.commit();
@@ -132,7 +130,8 @@ module.exports = Self => {
const message = $t('Claim will be picked', {
claimId: claim.id,
clientName: claim.client().name,
- claimUrl: `${url}claim/${claim.id}/summary`
+ claimUrl: `${url}claim/${claim.id}/summary`,
+ claimPickup: $t(claim.pickup)
});
await models.Chat.sendCheckingPresence(ctx, workerId, message);
}
diff --git a/modules/claim/back/model-config.json b/modules/claim/back/model-config.json
index 83d88039c..d90ed4c1e 100644
--- a/modules/claim/back/model-config.json
+++ b/modules/claim/back/model-config.json
@@ -43,8 +43,5 @@
},
"ClaimObservation": {
"dataSource": "vn"
- },
- "ClaimRma": {
- "dataSource": "vn"
- }
+ }
}
diff --git a/modules/claim/back/models/claim-rma.js b/modules/claim/back/models/claim-rma.js
deleted file mode 100644
index 6a93613bd..000000000
--- a/modules/claim/back/models/claim-rma.js
+++ /dev/null
@@ -1,9 +0,0 @@
-const LoopBackContext = require('loopback-context');
-
-module.exports = Self => {
- Self.observe('before save', async function(ctx) {
- const changes = ctx.data || ctx.instance;
- const loopBackContext = LoopBackContext.getCurrentContext();
- changes.workerFk = loopBackContext.active.accessToken.userId;
- });
-};
diff --git a/modules/claim/back/models/claim.json b/modules/claim/back/models/claim.json
index b85b9e073..1fc88df1c 100644
--- a/modules/claim/back/models/claim.json
+++ b/modules/claim/back/models/claim.json
@@ -31,8 +31,8 @@
"responsibility": {
"type": "number"
},
- "hasToPickUp": {
- "type": "boolean"
+ "pickup": {
+ "type": "string"
},
"ticketFk": {
"type": "number"
@@ -45,9 +45,6 @@
},
"packages": {
"type": "number"
- },
- "rma": {
- "type": "string"
}
},
"relations": {
@@ -56,12 +53,6 @@
"model": "ClaimState",
"foreignKey": "claimStateFk"
},
- "rmas": {
- "type": "hasMany",
- "model": "ClaimRma",
- "foreignKey": "code",
- "primaryKey": "rma"
- },
"client": {
"type": "belongsTo",
"model": "Client",
diff --git a/modules/claim/front/action/index.spec.js b/modules/claim/front/action/index.spec.js
index 458d5e831..e773511bf 100644
--- a/modules/claim/front/action/index.spec.js
+++ b/modules/claim/front/action/index.spec.js
@@ -85,7 +85,7 @@ describe('claim', () => {
it('should perform a patch query and show a success message', () => {
jest.spyOn(controller.vnApp, 'showSuccess');
- const data = {hasToPickUp: true};
+ const data = {pickup: 'agency'};
$httpBackend.expect('PATCH', `Claims/1/updateClaimAction`, data).respond({});
controller.save(data);
$httpBackend.flush();
diff --git a/modules/claim/front/basic-data/index.html b/modules/claim/front/basic-data/index.html
index 10aa7623a..45bc1823d 100644
--- a/modules/claim/front/basic-data/index.html
+++ b/modules/claim/front/basic-data/index.html
@@ -49,13 +49,6 @@
label="Packages received"
ng-model="$ctrl.claim.packages">
-
-
diff --git a/modules/claim/front/summary/index.html b/modules/claim/front/summary/index.html
index 3115cb451..b5225e6f4 100644
--- a/modules/claim/front/summary/index.html
+++ b/modules/claim/front/summary/index.html
@@ -49,13 +49,6 @@
label="Attended by"
value="{{$ctrl.summary.claim.worker.user.nickname}}">
-
-