')
FROM printQueue pq
LEFT JOIN worker w ON w.id = pq.workerFk
LEFT JOIN printer p ON p.id = pq.printerFk
@@ -42133,15 +42300,7 @@ DELIMITER ;;
vIsAlreadyNotified = FALSE AND vCurrentCount > 0
THEN
- SELECT '
-
-
Id Cola
-
Ruta Impresora
-
Informe
-
Estado
-
Trabajador
-
Error
-
' INTO vTableQueue;
+ SELECT '
\n\t\t\t\t\t
\n\t\t\t\t\t\t
Id Cola
\n\t\t\t\t\t\t
Ruta Impresora
\n\t\t\t\t\t\t
Informe
\n\t\t\t\t\t\t
Estado
\n\t\t\t\t\t\t
Trabajador
\n\t\t\t\t\t\t
Error
\n\t\t\t\t\t
' INTO vTableQueue;
OPEN vCur;
@@ -42199,7 +42358,7 @@ DELIMITER ;;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;;
/*!50003 SET @saved_time_zone = @@time_zone */ ;;
/*!50003 SET time_zone = 'SYSTEM' */ ;;
-/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `raidUpdate` ON SCHEDULE EVERY 1 DAY STARTS '2017-12-29 00:05:00' ON COMPLETION PRESERVE ENABLE DO CALL raidUpdate */ ;;
+/*!50106 CREATE*/ /*!50117 DEFINER=`vn`@`localhost`*/ /*!50106 EVENT `raidUpdate` ON SCHEDULE EVERY 1 DAY STARTS '2017-12-29 00:05:00' ON COMPLETION PRESERVE ENABLE DO CALL raidUpdate */ ;;
/*!50003 SET time_zone = @saved_time_zone */ ;;
/*!50003 SET sql_mode = @saved_sql_mode */ ;;
/*!50003 SET character_set_client = @saved_cs_client */ ;;
@@ -42210,14 +42369,14 @@ DELIMITER ;;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;;
-/*!50003 SET character_set_client = utf8mb3 */ ;;
-/*!50003 SET character_set_results = utf8mb3 */ ;;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;;
+/*!50003 SET character_set_client = utf8mb4 */ ;;
+/*!50003 SET character_set_results = utf8mb4 */ ;;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;;
/*!50003 SET @saved_time_zone = @@time_zone */ ;;
/*!50003 SET time_zone = 'SYSTEM' */ ;;
-/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `route_doRecalc` ON SCHEDULE EVERY 10 SECOND STARTS '2021-07-08 07:32:23' ON COMPLETION PRESERVE ENABLE DO CALL route_doRecalc */ ;;
+/*!50106 CREATE*/ /*!50117 DEFINER=`vn`@`localhost`*/ /*!50106 EVENT `route_doRecalc` ON SCHEDULE EVERY 10 SECOND STARTS '2021-07-08 07:32:23' ON COMPLETION PRESERVE ENABLE DO CALL route_doRecalc */ ;;
/*!50003 SET time_zone = @saved_time_zone */ ;;
/*!50003 SET sql_mode = @saved_sql_mode */ ;;
/*!50003 SET character_set_client = @saved_cs_client */ ;;
@@ -42250,14 +42409,14 @@ DELIMITER ;;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;;
-/*!50003 SET character_set_client = utf8mb3 */ ;;
-/*!50003 SET character_set_results = utf8mb3 */ ;;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;;
+/*!50003 SET character_set_client = utf8mb4 */ ;;
+/*!50003 SET character_set_results = utf8mb4 */ ;;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;;
/*!50003 SET @saved_time_zone = @@time_zone */ ;;
/*!50003 SET time_zone = 'SYSTEM' */ ;;
-/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `vehicle_notify` ON SCHEDULE EVERY 1 DAY STARTS '2022-01-01 00:07:00' ON COMPLETION NOT PRESERVE ENABLE COMMENT 'Notifies subscribed users of events in vehicles that are about t' DO CALL vn.vehicle_notifyEvents */ ;;
+/*!50106 CREATE*/ /*!50117 DEFINER=`vn`@`localhost`*/ /*!50106 EVENT `vehicle_notify` ON SCHEDULE EVERY 1 DAY STARTS '2022-01-01 00:07:00' ON COMPLETION NOT PRESERVE ENABLE COMMENT 'Notifies subscribed users of events in vehicles that are about t' DO CALL vn.vehicle_notifyEvents */ ;;
/*!50003 SET time_zone = @saved_time_zone */ ;;
/*!50003 SET sql_mode = @saved_sql_mode */ ;;
/*!50003 SET character_set_client = @saved_cs_client */ ;;
@@ -42268,14 +42427,14 @@ DELIMITER ;;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;;
-/*!50003 SET character_set_client = utf8mb3 */ ;;
-/*!50003 SET character_set_results = utf8mb3 */ ;;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;;
+/*!50003 SET character_set_client = utf8mb4 */ ;;
+/*!50003 SET character_set_results = utf8mb4 */ ;;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;;
/*!50003 SET @saved_time_zone = @@time_zone */ ;;
/*!50003 SET time_zone = 'SYSTEM' */ ;;
-/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `workerJourney_doRecalc` ON SCHEDULE EVERY 1 DAY STARTS '2023-07-22 04:00:00' ON COMPLETION PRESERVE ENABLE DO CALL workerJourney_replace(util.VN_CURDATE() - INTERVAL 1 WEEK, util.VN_CURDATE(), NULL) */ ;;
+/*!50106 CREATE*/ /*!50117 DEFINER=`vn`@`localhost`*/ /*!50106 EVENT `workerJourney_doRecalc` ON SCHEDULE EVERY 1 DAY STARTS '2023-07-22 04:00:00' ON COMPLETION PRESERVE ENABLE DO CALL workerJourney_replace(util.VN_CURDATE() - INTERVAL 1 WEEK, util.VN_CURDATE(), NULL) */ ;;
/*!50003 SET time_zone = @saved_time_zone */ ;;
/*!50003 SET sql_mode = @saved_sql_mode */ ;;
/*!50003 SET character_set_client = @saved_cs_client */ ;;
@@ -42286,14 +42445,14 @@ DELIMITER ;;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;;
-/*!50003 SET character_set_client = utf8mb3 */ ;;
-/*!50003 SET character_set_results = utf8mb3 */ ;;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;;
+/*!50003 SET character_set_client = utf8mb4 */ ;;
+/*!50003 SET character_set_results = utf8mb4 */ ;;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;;
/*!50003 SET @saved_time_zone = @@time_zone */ ;;
/*!50003 SET time_zone = 'SYSTEM' */ ;;
-/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `worker_updateChangedBusiness` ON SCHEDULE EVERY 1 DAY STARTS '2000-01-01 00:00:05' ON COMPLETION NOT PRESERVE ENABLE DO CALL worker_updateChangedBusiness */ ;;
+/*!50106 CREATE*/ /*!50117 DEFINER=`vn`@`localhost`*/ /*!50106 EVENT `worker_updateChangedBusiness` ON SCHEDULE EVERY 1 DAY STARTS '2000-01-01 00:00:05' ON COMPLETION NOT PRESERVE ENABLE DO CALL worker_updateChangedBusiness */ ;;
/*!50003 SET time_zone = @saved_time_zone */ ;;
/*!50003 SET sql_mode = @saved_sql_mode */ ;;
/*!50003 SET character_set_client = @saved_cs_client */ ;;
@@ -42322,14 +42481,14 @@ DELIMITER ;;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;;
-/*!50003 SET character_set_client = utf8mb3 */ ;;
-/*!50003 SET character_set_results = utf8mb3 */ ;;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;;
+/*!50003 SET character_set_client = utf8mb4 */ ;;
+/*!50003 SET character_set_results = utf8mb4 */ ;;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;;
/*!50003 SET @saved_time_zone = @@time_zone */ ;;
/*!50003 SET time_zone = 'SYSTEM' */ ;;
-/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `zoneGeo_doCalc` ON SCHEDULE EVERY 15 SECOND STARTS '2019-09-13 15:30:47' ON COMPLETION PRESERVE ENABLE DO CALL vn.zoneGeo_doCalc */ ;;
+/*!50106 CREATE*/ /*!50117 DEFINER=`vn`@`localhost`*/ /*!50106 EVENT `zoneGeo_doCalc` ON SCHEDULE EVERY 15 SECOND STARTS '2019-09-13 15:30:47' ON COMPLETION PRESERVE ENABLE DO CALL vn.zoneGeo_doCalc */ ;;
/*!50003 SET time_zone = @saved_time_zone */ ;;
/*!50003 SET sql_mode = @saved_sql_mode */ ;;
/*!50003 SET character_set_client = @saved_cs_client */ ;;
@@ -42351,7 +42510,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `addressTaxArea`(vAddresId INT, vCompanyId INT) RETURNS varchar(25) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
+CREATE DEFINER=`vn`@`localhost` FUNCTION `addressTaxArea`(vAddresId INT, vCompanyId INT) RETURNS varchar(25) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
DETERMINISTIC
BEGIN
/**
@@ -42393,7 +42552,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `address_getGeo`(vSelf INT) RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `address_getGeo`(vSelf INT) RETURNS int(11)
DETERMINISTIC
BEGIN
/**
@@ -42420,16 +42579,16 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP FUNCTION IF EXISTS `barcodeToItem` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `barcodeToItem`(vBarcode VARCHAR(22)) RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `barcodeToItem`(vBarcode VARCHAR(22)) RETURNS int(11)
DETERMINISTIC
BEGIN
@@ -42483,16 +42642,16 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP FUNCTION IF EXISTS `buy_getUnitVolume` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `buy_getUnitVolume`(vSelf INT) RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `buy_getUnitVolume`(vSelf INT) RETURNS int(11)
DETERMINISTIC
BEGIN
/**
@@ -42527,7 +42686,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `buy_getVolume`(vSelf INT) RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `buy_getVolume`(vSelf INT) RETURNS int(11)
DETERMINISTIC
BEGIN
/**
@@ -42560,7 +42719,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `catalog_componentReverse`(vWarehouse INT,
+CREATE DEFINER=`vn`@`localhost` FUNCTION `catalog_componentReverse`(vWarehouse INT,
vCost DECIMAL(10,3),
vM3 DECIMAL(10,3),
vAddressFk INT,
@@ -42667,7 +42826,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `clientGetMana`(vClient INT) RETURNS decimal(10,2)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `clientGetMana`(vClient INT) RETURNS decimal(10,2)
DETERMINISTIC
BEGIN
/**
@@ -42707,7 +42866,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `clientGetSalesPerson`(vClientFk INT, vDated DATE) RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `clientGetSalesPerson`(vClientFk INT, vDated DATE) RETURNS int(11)
DETERMINISTIC
BEGIN
/**
@@ -42730,7 +42889,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `clientTaxArea`(vClientId INT, vCompanyId INT) RETURNS varchar(25) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
+CREATE DEFINER=`vn`@`localhost` FUNCTION `clientTaxArea`(vClientId INT, vCompanyId INT) RETURNS varchar(25) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
READS SQL DATA
BEGIN
/**
@@ -42765,7 +42924,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `client_getDebt`(`vClient` INT, `vDate` DATE) RETURNS decimal(10,2)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `client_getDebt`(`vClient` INT, `vDate` DATE) RETURNS decimal(10,2)
READS SQL DATA
BEGIN
/**
@@ -42814,7 +42973,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `client_getFromPhone`(vPhone VARCHAR(255)) RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `client_getFromPhone`(vPhone VARCHAR(255)) RETURNS int(11)
DETERMINISTIC
BEGIN
/**
@@ -42867,7 +43026,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `client_getSalesPerson`(vClientFk INT, vDated DATE) RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `client_getSalesPerson`(vClientFk INT, vDated DATE) RETURNS int(11)
DETERMINISTIC
BEGIN
/**
@@ -42953,7 +43112,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `client_getSalesPersonByTicket`(vTicketFk INT) RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `client_getSalesPersonByTicket`(vTicketFk INT) RETURNS int(11)
DETERMINISTIC
BEGIN
/**
@@ -42988,7 +43147,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `client_getSalesPersonCode`(vClientFk INT, vDated DATE) RETURNS varchar(3) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
+CREATE DEFINER=`vn`@`localhost` FUNCTION `client_getSalesPersonCode`(vClientFk INT, vDated DATE) RETURNS varchar(3) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
DETERMINISTIC
BEGIN
/**
@@ -43026,7 +43185,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `client_getSalesPersonCodeByTicket`(vTicketFk INT) RETURNS varchar(3) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
+CREATE DEFINER=`vn`@`localhost` FUNCTION `client_getSalesPersonCodeByTicket`(vTicketFk INT) RETURNS varchar(3) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
DETERMINISTIC
BEGIN
/**
@@ -43061,7 +43220,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `client_hasDifferentCountries`(vClientFk INT) RETURNS tinyint(1)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `client_hasDifferentCountries`(vClientFk INT) RETURNS tinyint(1)
READS SQL DATA
BEGIN
/**
@@ -43093,7 +43252,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `collection_isPacked`(vSelf INT) RETURNS tinyint(1)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `collection_isPacked`(vSelf INT) RETURNS tinyint(1)
DETERMINISTIC
BEGIN
/**
@@ -43127,7 +43286,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `currency_getCommission`(vSelf INT) RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `currency_getCommission`(vSelf INT) RETURNS int(11)
DETERMINISTIC
BEGIN
/**
@@ -43162,7 +43321,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `currentRate`(vCurrencyFk INT, vDated DATE) RETURNS decimal(10,4)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `currentRate`(vCurrencyFk INT, vDated DATE) RETURNS decimal(10,4)
READS SQL DATA
BEGIN
@@ -43193,7 +43352,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `deviceProductionUser_accessGranted`(vUserFK INT(10) , android_id VARCHAR(50)) RETURNS tinyint(1)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `deviceProductionUser_accessGranted`(vUserFK INT(10) , android_id VARCHAR(50)) RETURNS tinyint(1)
DETERMINISTIC
BEGIN
/*
@@ -43234,7 +43393,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `duaTax_getRate`(vDuaFk INT, vTaxClassFk INT) RETURNS decimal(5,2)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `duaTax_getRate`(vDuaFk INT, vTaxClassFk INT) RETURNS decimal(5,2)
DETERMINISTIC
BEGIN
/**
@@ -43269,7 +43428,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `ekt_getEntry`(vEktFk INT) RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `ekt_getEntry`(vEktFk INT) RETURNS int(11)
READS SQL DATA
BEGIN
/**
@@ -43351,7 +43510,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `ekt_getTravel`(vEntryAssignFk INT, vEktFk INT) RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `ekt_getTravel`(vEntryAssignFk INT, vEktFk INT) RETURNS int(11)
READS SQL DATA
BEGIN
/**
@@ -43407,7 +43566,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `entry_getCommission`(vTravelFk INT,
+CREATE DEFINER=`vn`@`localhost` FUNCTION `entry_getCommission`(vTravelFk INT,
vCurrencyFk INT,
vSupplierFk INT
) RETURNS int(11)
@@ -43476,7 +43635,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `entry_getCurrency`(vCurrency INT,
+CREATE DEFINER=`vn`@`localhost` FUNCTION `entry_getCurrency`(vCurrency INT,
vSupplierFk INT
) RETURNS int(11)
READS SQL DATA
@@ -43507,7 +43666,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `entry_getForLogiflora`(vLanded DATE, vWarehouseFk INT) RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `entry_getForLogiflora`(vLanded DATE, vWarehouseFk INT) RETURNS int(11)
READS SQL DATA
BEGIN
@@ -43582,7 +43741,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `entry_isIntrastat`(vSelf INT) RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `entry_isIntrastat`(vSelf INT) RETURNS int(11)
READS SQL DATA
BEGIN
/**
@@ -43632,7 +43791,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `entry_isInventoryOrPrevious`(vSelf INT) RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `entry_isInventoryOrPrevious`(vSelf INT) RETURNS int(11)
DETERMINISTIC
BEGIN
DECLARE vIsInventoryOrPrevious BOOL;
@@ -43662,7 +43821,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `expedition_checkRoute`(vPalletFk INT,vExpeditionFk INT) RETURNS tinyint(1)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `expedition_checkRoute`(vPalletFk INT,vExpeditionFk INT) RETURNS tinyint(1)
DETERMINISTIC
BEGIN
/**
@@ -43706,7 +43865,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `firstDayOfWeek`(vYear INT, vWeek INT) RETURNS date
+CREATE DEFINER=`vn`@`localhost` FUNCTION `firstDayOfWeek`(vYear INT, vWeek INT) RETURNS date
DETERMINISTIC
BEGIN
/**
@@ -43742,7 +43901,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `getAlert3State`(vTicket INT) RETURNS varchar(45) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci
+CREATE DEFINER=`vn`@`localhost` FUNCTION `getAlert3State`(vTicket INT) RETURNS varchar(45) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci
READS SQL DATA
BEGIN
DECLARE vDeliveryType INTEGER DEFAULT 0;
@@ -43792,7 +43951,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `getDueDate`(vDated DATE, vDayToPay INT) RETURNS date
+CREATE DEFINER=`vn`@`localhost` FUNCTION `getDueDate`(vDated DATE, vDayToPay INT) RETURNS date
NO SQL
BEGIN
DECLARE vDued DATE;
@@ -43820,10 +43979,10 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `getInventoryDate`() RETURNS date
+CREATE DEFINER=`vn`@`localhost` FUNCTION `getInventoryDate`() RETURNS date
DETERMINISTIC
-BEGIN
- RETURN (SELECT inventoried FROM config LIMIT 1);
+BEGIN
+ RETURN (SELECT inventoried FROM config LIMIT 1);
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -43840,7 +43999,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `getNewItemId`() RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `getNewItemId`() RETURNS int(11)
READS SQL DATA
BEGIN
DECLARE newItemId INT;
@@ -43869,7 +44028,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `getNextDueDate`(vDated DATE, vGapDays INT, vPayDay INT) RETURNS date
+CREATE DEFINER=`vn`@`localhost` FUNCTION `getNextDueDate`(vDated DATE, vGapDays INT, vPayDay INT) RETURNS date
NO SQL
BEGIN
@@ -43911,7 +44070,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `getShipmentHour`(vTicket INT) RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `getShipmentHour`(vTicket INT) RETURNS int(11)
READS SQL DATA
BEGIN
DECLARE vShipmentHour INT;
@@ -43956,7 +44115,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `getSpecialPrice`(vItemFk int(11),vClientFk int(11)) RETURNS decimal(10,2)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `getSpecialPrice`(vItemFk int(11),vClientFk int(11)) RETURNS decimal(10,2)
READS SQL DATA
BEGIN
DECLARE price DECIMAL(10,2);
@@ -43990,7 +44149,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `getTicketTrolleyLabelCount`(vTicket INT) RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `getTicketTrolleyLabelCount`(vTicket INT) RETURNS int(11)
READS SQL DATA
BEGIN
DECLARE vLabelCount INT DEFAULT 0;
@@ -44021,7 +44180,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `getUser`() RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `getUser`() RETURNS int(11)
DETERMINISTIC
BEGIN
/**
@@ -44044,7 +44203,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `getUserId`(userName varchar(30)) RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `getUserId`(userName varchar(30)) RETURNS int(11)
READS SQL DATA
BEGIN
DECLARE vUser INT;
@@ -44062,16 +44221,16 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP FUNCTION IF EXISTS `hasAnyNegativeBase` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `hasAnyNegativeBase`() RETURNS tinyint(1)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `hasAnyNegativeBase`() RETURNS tinyint(1)
DETERMINISTIC
BEGIN
@@ -44104,16 +44263,16 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP FUNCTION IF EXISTS `hasAnyPositiveBase` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `hasAnyPositiveBase`() RETURNS tinyint(1)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `hasAnyPositiveBase`() RETURNS tinyint(1)
DETERMINISTIC
BEGIN
@@ -44155,7 +44314,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `hasItemsInSector`(vTicketFk INT, vSectorFk INT) RETURNS tinyint(1)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `hasItemsInSector`(vTicketFk INT, vSectorFk INT) RETURNS tinyint(1)
DETERMINISTIC
BEGIN
@@ -44187,7 +44346,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `hasSomeNegativeBase`(vTicket INT) RETURNS tinyint(1)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `hasSomeNegativeBase`(vTicket INT) RETURNS tinyint(1)
READS SQL DATA
BEGIN
DECLARE vCountry INT;
@@ -44228,7 +44387,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `intrastat_estimateNet`(vSelf INT,
+CREATE DEFINER=`vn`@`localhost` FUNCTION `intrastat_estimateNet`(vSelf INT,
vStems INT
) RETURNS double
DETERMINISTIC
@@ -44271,7 +44430,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `invoiceOutAmount`(vInvoiceRef VARCHAR(15)) RETURNS decimal(10,2)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `invoiceOutAmount`(vInvoiceRef VARCHAR(15)) RETURNS decimal(10,2)
READS SQL DATA
BEGIN
DECLARE totalAmount DECIMAL(10,2);
@@ -44297,16 +44456,16 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP FUNCTION IF EXISTS `invoiceOut_getMaxIssued` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `invoiceOut_getMaxIssued`(vSerial VARCHAR(2),
+CREATE DEFINER=`vn`@`localhost` FUNCTION `invoiceOut_getMaxIssued`(vSerial VARCHAR(2),
vCompanyFk INT,
vYear INT
) RETURNS date
@@ -44349,7 +44508,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `invoiceOut_getPath`(vSelf INT) RETURNS varchar(255) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
+CREATE DEFINER=`vn`@`localhost` FUNCTION `invoiceOut_getPath`(vSelf INT) RETURNS varchar(255) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
DETERMINISTIC
BEGIN
DECLARE vIssued DATE;
@@ -44373,16 +44532,16 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP FUNCTION IF EXISTS `invoiceOut_getWeight` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `invoiceOut_getWeight`(vInvoiceRef VARCHAR(15)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `invoiceOut_getWeight`(vInvoiceRef VARCHAR(15)
) RETURNS decimal(10,2)
READS SQL DATA
BEGIN
@@ -44423,73 +44582,43 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `invoiceSerial`(vClientFk INT, vCompanyFk INT, vType CHAR(1)) RETURNS char(1) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
+CREATE DEFINER=`vn`@`localhost` FUNCTION `invoiceSerial`(vClientFk INT,
+ vCompanyFk INT,
+ vType CHAR(15)
+) RETURNS char(2) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
DETERMINISTIC
BEGIN
- /**
- * Obtiene la serie de de una factura
- * dependiendo del area del cliente.
- *
- * @param vClientFk Id del cliente
- * @param vCompanyFk Id de la empresa
- * @param vType Tipo de factura ["R", "M", "G"]
- * @return Serie de la factura
- */
- DECLARE vTaxArea VARCHAR(25);
- DECLARE vSerie CHAR(1);
+/**
+* Obtiene la serie de una factura
+* dependiendo del area del cliente.
+*
+* @param vClientFk Id del cliente
+* @param vCompanyFk Id de la empresa
+* @param vType Tipo de factura (vn.invoiceOutSerial.type[ENUM])
+* @return vSerie de la factura
+*/
+ DECLARE vTaxArea VARCHAR(25) COLLATE utf8mb3_general_ci;
+ DECLARE vTransactionCode INT(2);
+ DECLARE vSerie CHAR(2);
IF (SELECT hasInvoiceSimplified FROM client WHERE id = vClientFk) THEN
RETURN 'S';
END IF;
- SELECT clientTaxArea(vClientFk, vCompanyFk) INTO vTaxArea;
- SELECT invoiceSerialArea(vType,vTaxArea) INTO vSerie;
- RETURN vSerie;
-END ;;
-DELIMITER ;
-/*!50003 SET sql_mode = @saved_sql_mode */ ;
-/*!50003 SET character_set_client = @saved_cs_client */ ;
-/*!50003 SET character_set_results = @saved_cs_results */ ;
-/*!50003 SET collation_connection = @saved_col_connection */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
-/*!50003 DROP FUNCTION IF EXISTS `invoiceSerialArea` */;
-/*!50003 SET @saved_cs_client = @@character_set_client */ ;
-/*!50003 SET @saved_cs_results = @@character_set_results */ ;
-/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb4 */ ;
-/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
-DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `invoiceSerialArea`(vType CHAR(1), vTaxArea VARCHAR(25)) RETURNS char(1) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci
- DETERMINISTIC
-BEGIN
- DECLARE vSerie CHAR(1);
+ SELECT addressTaxArea(defaultAddressFk, vCompanyFk) INTO vTaxArea
+ FROM client
+ WHERE id = vClientFk;
+
+ SELECT CodigoTransaccion INTO vTransactionCode
+ FROM taxArea
+ WHERE code = vTaxArea;
+
+ SELECT ios.code INTO vSerie
+ FROM invoiceOutSerial ios
+ JOIN taxArea ta ON ta.code = ios.taxAreaFk
+ WHERE ios.`type` = vType
+ AND ta.CodigoTransaccion = vTransactionCode;
- IF vType = 'R' THEN
- SELECT
- CASE vTaxArea
- WHEN 'CEE' THEN 'H'
- WHEN 'WORLD' THEN 'E'
- ELSE 'T'
- END INTO vSerie;
- -- Factura multiple
- ELSEIF vType = 'M' THEN
- SELECT
- CASE vTaxArea
- WHEN 'CEE' THEN 'H'
- WHEN 'WORLD' THEN 'E'
- ELSE 'M'
- END INTO vSerie;
- -- Factura global
- ELSEIF vType = 'G' THEN
- SELECT
- CASE vTaxArea
- WHEN 'CEE' THEN 'V'
- WHEN 'WORLD' THEN 'X'
- ELSE 'A'
- END INTO vSerie;
- END IF;
RETURN vSerie;
END ;;
DELIMITER ;
@@ -44507,7 +44636,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `isLogifloraDay`(vShipped DATE, vWarehouse INT) RETURNS tinyint(1)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `isLogifloraDay`(vShipped DATE, vWarehouse INT) RETURNS tinyint(1)
DETERMINISTIC
BEGIN
@@ -44538,7 +44667,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `itemPacking`(vBarcode VARCHAR(22), vWarehouseFk INT) RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `itemPacking`(vBarcode VARCHAR(22), vWarehouseFk INT) RETURNS int(11)
DETERMINISTIC
BEGIN
@@ -44591,7 +44720,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `itemShelvingPlacementSupply_ClosestGet`(vParkingFk INT) RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `itemShelvingPlacementSupply_ClosestGet`(vParkingFk INT) RETURNS int(11)
READS SQL DATA
BEGIN
@@ -44635,7 +44764,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `itemsInSector_get`(vTicketFk INT, vSectorFk INT) RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `itemsInSector_get`(vTicketFk INT, vSectorFk INT) RETURNS int(11)
READS SQL DATA
BEGIN
@@ -44667,7 +44796,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `itemTag_getIntValue`(vValue VARCHAR(255)) RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `itemTag_getIntValue`(vValue VARCHAR(255)) RETURNS int(11)
DETERMINISTIC
BEGIN
IF vValue NOT REGEXP '^-?[0-9]+' THEN
@@ -44691,7 +44820,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `item_getFhImage`(itemFk INT) RETURNS varchar(255) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci
+CREATE DEFINER=`vn`@`localhost` FUNCTION `item_getFhImage`(itemFk INT) RETURNS varchar(255) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci
DETERMINISTIC
BEGIN
DECLARE vImageUrl VARCHAR(255);
@@ -44720,7 +44849,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `item_getPackage`(vItemFk INT) RETURNS varchar(50) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci
+CREATE DEFINER=`vn`@`localhost` FUNCTION `item_getPackage`(vItemFk INT) RETURNS varchar(50) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci
DETERMINISTIC
BEGIN
@@ -44762,7 +44891,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `item_getVolume`(vSelf INT, vPackaging VARCHAR(10)) RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `item_getVolume`(vSelf INT, vPackaging VARCHAR(10)) RETURNS int(11)
DETERMINISTIC
BEGIN
/**
@@ -44801,7 +44930,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `lastDayOfWeek`(vYear INT, vWeek INT) RETURNS date
+CREATE DEFINER=`vn`@`localhost` FUNCTION `lastDayOfWeek`(vYear INT, vWeek INT) RETURNS date
DETERMINISTIC
BEGIN
/**
@@ -44837,7 +44966,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `machine_checkPlate`(vPlate VARCHAR(10)) RETURNS tinyint(1)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `machine_checkPlate`(vPlate VARCHAR(10)) RETURNS tinyint(1)
READS SQL DATA
BEGIN
/**
@@ -44872,7 +45001,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `messageSend`(vRecipient VARCHAR(255) CHARSET utf8, vMessage TEXT CHARSET utf8) RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `messageSend`(vRecipient VARCHAR(255) CHARSET utf8, vMessage TEXT CHARSET utf8) RETURNS int(11)
READS SQL DATA
BEGIN
DECLARE result INT;
@@ -44898,7 +45027,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `messageSendWithUser`(vSenderFK INT, vRecipient VARCHAR(255) CHARSET utf8, vMessage TEXT CHARSET utf8) RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `messageSendWithUser`(vSenderFK INT, vRecipient VARCHAR(255) CHARSET utf8, vMessage TEXT CHARSET utf8) RETURNS int(11)
DETERMINISTIC
BEGIN
@@ -44963,7 +45092,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `MIDNIGHT`(vDate DATE) RETURNS datetime
+CREATE DEFINER=`vn`@`localhost` FUNCTION `MIDNIGHT`(vDate DATE) RETURNS datetime
DETERMINISTIC
BEGIN
RETURN TIMESTAMP(vDate,'23:59:59');
@@ -44983,7 +45112,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `orderTotalVolume`(vOrderId INT) RETURNS decimal(10,3)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `orderTotalVolume`(vOrderId INT) RETURNS decimal(10,3)
READS SQL DATA
BEGIN
-- Devuelte el volumen total de la orden sumada
@@ -45014,7 +45143,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `orderTotalVolumeBoxes`(vOrderId INT) RETURNS decimal(10,3)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `orderTotalVolumeBoxes`(vOrderId INT) RETURNS decimal(10,3)
READS SQL DATA
BEGIN
/**
@@ -45050,7 +45179,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `packaging_calculate`(isPackageReturnable TINYINT(1),
+CREATE DEFINER=`vn`@`localhost` FUNCTION `packaging_calculate`(isPackageReturnable TINYINT(1),
packagingReturnFk INT(11),
base DECIMAL(10,2),
price DECIMAL(10,2),
@@ -45089,7 +45218,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `priceFixed_getRate2`(vFixedPriceFk INT, vRate3 DOUBLE) RETURNS double
+CREATE DEFINER=`vn`@`localhost` FUNCTION `priceFixed_getRate2`(vFixedPriceFk INT, vRate3 DOUBLE) RETURNS double
BEGIN
DECLARE vWarehouse INT;
@@ -45121,7 +45250,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `routeProposal`(vTicketFk INT) RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `routeProposal`(vTicketFk INT) RETURNS int(11)
READS SQL DATA
BEGIN
@@ -45187,7 +45316,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `routeProposal_`(vTicketFk INT) RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `routeProposal_`(vTicketFk INT) RETURNS int(11)
READS SQL DATA
BEGIN
@@ -45228,7 +45357,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `routeProposal_beta`(vTicketFk INT) RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `routeProposal_beta`(vTicketFk INT) RETURNS int(11)
READS SQL DATA
BEGIN
@@ -45294,7 +45423,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `sale_hasComponentLack`(vSelf INT
+CREATE DEFINER=`vn`@`localhost` FUNCTION `sale_hasComponentLack`(vSelf INT
) RETURNS tinyint(1)
READS SQL DATA
BEGIN
@@ -45334,7 +45463,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `sectorCollection_hasSalesReserved`(vSelf INT) RETURNS tinyint(1)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `sectorCollection_hasSalesReserved`(vSelf INT) RETURNS tinyint(1)
DETERMINISTIC
BEGIN
/**
@@ -45372,7 +45501,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `specie_IsForbidden`(vItemFk INT, vAddressFk INT) RETURNS tinyint(1)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `specie_IsForbidden`(vItemFk INT, vAddressFk INT) RETURNS tinyint(1)
READS SQL DATA
BEGIN
@@ -45411,7 +45540,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `testCIF`(vCIF VARCHAR(9)) RETURNS varchar(10) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci
+CREATE DEFINER=`vn`@`localhost` FUNCTION `testCIF`(vCIF VARCHAR(9)) RETURNS varchar(10) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci
DETERMINISTIC
BEGIN
@@ -45496,7 +45625,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `testNIE`(vNIE VARCHAR(9)) RETURNS tinyint(1)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `testNIE`(vNIE VARCHAR(9)) RETURNS tinyint(1)
DETERMINISTIC
BEGIN
@@ -45563,7 +45692,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `testNIF`(vNIF VARCHAR(9)) RETURNS tinyint(1)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `testNIF`(vNIF VARCHAR(9)) RETURNS tinyint(1)
DETERMINISTIC
BEGIN
@@ -45604,7 +45733,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `ticketCollection_getNoPacked`(vCollectionFk INT) RETURNS varchar(100) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci
+CREATE DEFINER=`vn`@`localhost` FUNCTION `ticketCollection_getNoPacked`(vCollectionFk INT) RETURNS varchar(100) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci
DETERMINISTIC
BEGIN
@@ -45643,7 +45772,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `ticketGetTotal`(vTicketId INT) RETURNS decimal(10,2)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `ticketGetTotal`(vTicketId INT) RETURNS decimal(10,2)
READS SQL DATA
DETERMINISTIC
BEGIN
@@ -45686,7 +45815,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `ticketPositionInPath`(vTicketId INT) RETURNS varchar(10) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
+CREATE DEFINER=`vn`@`localhost` FUNCTION `ticketPositionInPath`(vTicketId INT) RETURNS varchar(10) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
DETERMINISTIC
BEGIN
@@ -45777,7 +45906,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `ticketSplitCounter`(vTicketFk INT) RETURNS varchar(15) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
+CREATE DEFINER=`vn`@`localhost` FUNCTION `ticketSplitCounter`(vTicketFk INT) RETURNS varchar(15) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
READS SQL DATA
BEGIN
DECLARE vSplitCounter VARCHAR(15);
@@ -45809,7 +45938,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `ticketTotalVolume`(vTicketId INT) RETURNS decimal(10,3)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `ticketTotalVolume`(vTicketId INT) RETURNS decimal(10,3)
READS SQL DATA
BEGIN
-- Devuelte el volumen total del ticket sumado
@@ -45837,7 +45966,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `ticketTotalVolumeBoxes`(vTicketId INT) RETURNS decimal(10,1)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `ticketTotalVolumeBoxes`(vTicketId INT) RETURNS decimal(10,1)
DETERMINISTIC
BEGIN
@@ -45874,7 +46003,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `ticketWarehouseGet`(vTicketFk INT) RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `ticketWarehouseGet`(vTicketFk INT) RETURNS int(11)
READS SQL DATA
BEGIN
DECLARE vWarehouseFk INT;
@@ -45900,7 +46029,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `ticket_CC_volume`(vTicketFk INT) RETURNS decimal(10,1)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `ticket_CC_volume`(vTicketFk INT) RETURNS decimal(10,1)
READS SQL DATA
BEGIN
@@ -45933,7 +46062,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `ticket_get`(vParamFk INT) RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `ticket_get`(vParamFk INT) RETURNS int(11)
READS SQL DATA
BEGIN
/**
@@ -45988,7 +46117,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `ticket_getFreightCost`(vTicketFk INT) RETURNS decimal(10,2)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `ticket_getFreightCost`(vTicketFk INT) RETURNS decimal(10,2)
DETERMINISTIC
BEGIN
/**
@@ -46028,7 +46157,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `ticket_getWeight`(vTicketFk INT) RETURNS decimal(10,3)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `ticket_getWeight`(vTicketFk INT) RETURNS decimal(10,3)
READS SQL DATA
BEGIN
/**
@@ -46061,7 +46190,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `ticket_HasUbication`(vTicketFk INT) RETURNS tinyint(1)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `ticket_HasUbication`(vTicketFk INT) RETURNS tinyint(1)
READS SQL DATA
BEGIN
@@ -46091,7 +46220,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `ticket_isOutClosureZone`(vSelf INT) RETURNS tinyint(1)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `ticket_isOutClosureZone`(vSelf INT) RETURNS tinyint(1)
DETERMINISTIC
BEGIN
/**
@@ -46126,7 +46255,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `ticket_isProblemCalcNeeded`(vSelf INT
+CREATE DEFINER=`vn`@`localhost` FUNCTION `ticket_isProblemCalcNeeded`(vSelf INT
) RETURNS tinyint(1)
DETERMINISTIC
BEGIN
@@ -46164,7 +46293,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `ticket_isTooLittle`(vSelf INT
+CREATE DEFINER=`vn`@`localhost` FUNCTION `ticket_isTooLittle`(vSelf INT
) RETURNS tinyint(1)
READS SQL DATA
BEGIN
@@ -46174,14 +46303,21 @@ BEGIN
* @param vSelf Id ticket
* @return BOOL
*/
- DECLARE vIsTooLittle TINYINT(1);
-
+ DECLARE vIsTooLittle BOOL;
+
+ WITH ticketData AS (
+ SELECT addressFk, DATE(shipped) dated
+ FROM vn.ticket
+ WHERE id = vSelf
+ )
SELECT (SUM(IFNULL(sv.litros, 0)) < vc.minTicketVolume
- AND IFNULL(t.totalWithoutVat, 0) < vc.minTicketValue) INTO vIsTooLittle
- FROM ticket t
- LEFT JOIN saleVolume sv ON sv.ticketFk = t.id
- JOIN volumeConfig vc
- WHERE t.id = vSelf;
+ AND SUM(IFNULL(t.totalWithoutVat, 0)) < vc.minTicketValue) INTO vIsTooLittle
+ FROM ticketData td
+ JOIN vn.ticket t ON t.addressFk = td.addressFk
+ LEFT JOIN vn.saleVolume sv ON sv.ticketFk = t.id
+ JOIN vn.volumeConfig vc
+ WHERE t.shipped BETWEEN td.dated AND util.dayEnd(td.dated)
+ AND ticket_isProblemCalcNeeded(t.id);
RETURN vIsTooLittle;
END ;;
@@ -46291,7 +46427,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `timeWorkerControl_getDirection`(vUserFk INT, vTimed DATETIME) RETURNS varchar(6) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci
+CREATE DEFINER=`vn`@`localhost` FUNCTION `timeWorkerControl_getDirection`(vUserFk INT, vTimed DATETIME) RETURNS varchar(6) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci
READS SQL DATA
BEGIN
/**
@@ -46367,7 +46503,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `time_getSalesYear`(vMonth INT, vYear INT) RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `time_getSalesYear`(vMonth INT, vYear INT) RETURNS int(11)
DETERMINISTIC
BEGIN
DECLARE vSalesYear INT;
@@ -46392,7 +46528,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `travel_getForLogiflora`(vLanded DATE, vWarehouseFk INT) RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `travel_getForLogiflora`(vLanded DATE, vWarehouseFk INT) RETURNS int(11)
READS SQL DATA
BEGIN
@@ -46455,7 +46591,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `travel_hasUniqueAwb`(vSelf INT
+CREATE DEFINER=`vn`@`localhost` FUNCTION `travel_hasUniqueAwb`(vSelf INT
) RETURNS tinyint(1)
READS SQL DATA
BEGIN
@@ -46494,7 +46630,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `validationCode`(vString VARCHAR(255)) RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `validationCode`(vString VARCHAR(255)) RETURNS int(11)
DETERMINISTIC
BEGIN
@@ -46535,7 +46671,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `validationCode_beta`(vString VARCHAR(255)) RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `validationCode_beta`(vString VARCHAR(255)) RETURNS int(11)
DETERMINISTIC
BEGIN
@@ -46576,7 +46712,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `workerMachinery_isRegistered`(vWorkerFk VARCHAR(10)) RETURNS tinyint(1)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `workerMachinery_isRegistered`(vWorkerFk VARCHAR(10)) RETURNS tinyint(1)
READS SQL DATA
BEGIN
/**
@@ -46610,7 +46746,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `workerNigthlyHours_calculate`(vTimeIn DATETIME, vTimeOut DATETIME) RETURNS decimal(5,2)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `workerNigthlyHours_calculate`(vTimeIn DATETIME, vTimeOut DATETIME) RETURNS decimal(5,2)
READS SQL DATA
BEGIN
/**
@@ -46649,7 +46785,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `worker_getCode`() RETURNS varchar(3) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
+CREATE DEFINER=`vn`@`localhost` FUNCTION `worker_getCode`() RETURNS varchar(3) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
READS SQL DATA
BEGIN
DECLARE vUserCode VARCHAR(3) CHARSET utf8 COLLATE utf8_unicode_ci;
@@ -46675,7 +46811,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `worker_isBoss`(vUserId INT) RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `worker_isBoss`(vUserId INT) RETURNS int(11)
DETERMINISTIC
BEGIN
/**
@@ -46734,7 +46870,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `worker_isInDepartment`(vDepartmentCode VARCHAR(255)) RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `worker_isInDepartment`(vDepartmentCode VARCHAR(255)) RETURNS int(11)
DETERMINISTIC
BEGIN
/**
@@ -46773,7 +46909,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `worker_isWorking`(vWorkerFk INT) RETURNS tinyint(1)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `worker_isWorking`(vWorkerFk INT) RETURNS tinyint(1)
READS SQL DATA
BEGIN
/**
@@ -46812,7 +46948,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `zoneGeo_new`(vType VARCHAR(255), vName VARCHAR(255), vParentFk INT) RETURNS int(11)
+CREATE DEFINER=`vn`@`localhost` FUNCTION `zoneGeo_new`(vType VARCHAR(255), vName VARCHAR(255), vParentFk INT) RETURNS int(11)
NO SQL
BEGIN
/**
@@ -46852,7 +46988,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `absoluteInventoryHistory`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `absoluteInventoryHistory`(
vItemFk INT,
vWarehouseFk INT,
vDate DATETIME
@@ -46967,7 +47103,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `addAccountReconciliation`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `addAccountReconciliation`()
BEGIN
/**
* Updates duplicate records in the accountReconciliation table,
@@ -47046,7 +47182,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `addNoteFromDelivery`(idTicket INT,nota TEXT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `addNoteFromDelivery`(idTicket INT,nota TEXT)
BEGIN
DECLARE observationTypeFk INT DEFAULT 3; /*3 = REPARTIDOR*/
@@ -47072,7 +47208,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `addressTaxArea`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `addressTaxArea`()
READS SQL DATA
BEGIN
/**
@@ -47123,7 +47259,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `address_updateCoordinates`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `address_updateCoordinates`(
vTicketFk INT,
vLongitude DECIMAL(11,7),
vLatitude DECIMAL(11,7))
@@ -47161,7 +47297,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `agencyHourGetFirstShipped`(vAgencyMode INT, vAddress INT, vWarehouse INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `agencyHourGetFirstShipped`(vAgencyMode INT, vAddress INT, vWarehouse INT)
BEGIN
/**
* DEPRECATED usar zoneGetFirstShipped
@@ -47209,7 +47345,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `agencyHourGetLanded`(vDated DATE, vAddress INT, vAgency INT, vWarehouse INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `agencyHourGetLanded`(vDated DATE, vAddress INT, vAgency INT, vWarehouse INT)
BEGIN
/**
* DEPRECATED usar zoneGetLanded
@@ -47259,7 +47395,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `agencyHourGetWarehouse`(vAddress INT, vDate DATE, vWarehouse INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `agencyHourGetWarehouse`(vAddress INT, vDate DATE, vWarehouse INT)
BEGIN
/**
* DEPRECATED usar zoneGetWarehouse
@@ -47350,7 +47486,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `agencyHourListGetShipped`(vDate DATE, vAddress INT, vAgency INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `agencyHourListGetShipped`(vDate DATE, vAddress INT, vAgency INT)
BEGIN
/* * DEPRECATED usar zoneGetShipped
*/
@@ -47376,7 +47512,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `agencyVolume`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `agencyVolume`()
BEGIN
/**
* Calculates and presents information on shipment and packaging volumes
@@ -47427,7 +47563,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `available_calc`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `available_calc`(
vDate DATE,
vAddress INT,
vAgencyMode INT)
@@ -47497,7 +47633,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `available_traslate`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `available_traslate`(
vWarehouseLanding INT,
vDated DATE,
vWarehouseShipment INT)
@@ -47648,7 +47784,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `balanceNestTree_addChild`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `balanceNestTree_addChild`(
vSelf INT,
vName VARCHAR(45)
)
@@ -47713,7 +47849,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `balanceNestTree_delete`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `balanceNestTree_delete`(
vSelf INT
)
BEGIN
@@ -47779,7 +47915,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `balanceNestTree_move`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `balanceNestTree_move`(
vSelf INT,
vFather INT
)
@@ -47909,7 +48045,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `balance_create`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `balance_create`(
vStartingMonth INT,
vEndingMonth INT,
vCompany INT,
@@ -48140,7 +48276,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `bankEntity_checkBic`(vBic VARCHAR(255))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `bankEntity_checkBic`(vBic VARCHAR(255))
BEGIN
/**
* If the bic length is Incorrect throw exception
@@ -48172,7 +48308,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `bankPolicy_notifyExpired`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `bankPolicy_notifyExpired`()
BEGIN
/**
*
@@ -48197,70 +48333,6 @@ DELIMITER ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
-/*!50003 DROP PROCEDURE IF EXISTS `buyUltimate` */;
-/*!50003 SET @saved_cs_client = @@character_set_client */ ;
-/*!50003 SET @saved_cs_results = @@character_set_results */ ;
-/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb4 */ ;
-/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
-DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `buyUltimate`(
- vWarehouseFk SMALLINT,
- vDated DATE
-)
-BEGIN
-/**
- * @deprecated Usar buy_getUltimate
- * Calcula las últimas compras realizadas hasta una fecha.
- *
- * @param vItemFk Id del artículo
- * @param vWarehouseFk Id del almacén
- * @param vDated Compras hasta fecha
- * @return tmp.buyUltimate
- */
- CALL buy_getUltimate(NULL, vWarehouseFk, vDated);
-END ;;
-DELIMITER ;
-/*!50003 SET sql_mode = @saved_sql_mode */ ;
-/*!50003 SET character_set_client = @saved_cs_client */ ;
-/*!50003 SET character_set_results = @saved_cs_results */ ;
-/*!50003 SET collation_connection = @saved_col_connection */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
-/*!50003 DROP PROCEDURE IF EXISTS `buyUltimateFromInterval` */;
-/*!50003 SET @saved_cs_client = @@character_set_client */ ;
-/*!50003 SET @saved_cs_results = @@character_set_results */ ;
-/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb4 */ ;
-/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
-DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `buyUltimateFromInterval`(
- vWarehouseFk SMALLINT,
- vStarted DATE,
- vEnded DATE
-)
-BEGIN
-/**
- * @deprecated Usar buy_getUltimateFromInterval
- * Calcula las últimas compras realizadas
- * desde un rango de fechas.
- *
- * @param vWarehouseFk Id del almacén si es NULL se actualizan todos
- * @param vStarted Fecha inicial
- * @param vEnded Fecha fin
- * @return tmp.buyUltimateFromInterval
- */
- CALL vn.buy_getUltimateFromInterval(NULL, vWarehouseFk, vStarted, vEnded);
-END ;;
-DELIMITER ;
-/*!50003 SET sql_mode = @saved_sql_mode */ ;
-/*!50003 SET character_set_client = @saved_cs_client */ ;
-/*!50003 SET character_set_results = @saved_cs_results */ ;
-/*!50003 SET collation_connection = @saved_col_connection */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `buy_afterUpsert` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -48269,7 +48341,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_afterUpsert`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `buy_afterUpsert`(
vSelf INT
)
BEGIN
@@ -48368,7 +48440,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_checkGrouping`(vGrouping INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `buy_checkGrouping`(vGrouping INT)
BEGIN
/**
* Checks the buy grouping, throws an error if it's invalid.
@@ -48395,16 +48467,17 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_checkItem`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `buy_checkItem`()
BEGIN
/**
* Checks if the item has weightByPiece or size null on any buy.
*
* @param tmp.buysToCheck(id as INT).
*/
- DECLARE hasVolumetricAgency INT;
+ DECLARE vHasVolumetricAgency INT;
+ DECLARE vItemFk INT;
- SELECT a.hasWeightVolumetric INTO hasVolumetricAgency
+ SELECT a.hasWeightVolumetric, i.id INTO vHasVolumetricAgency, vItemFk
FROM entry e
JOIN travel t ON t.id = e.travelFk
JOIN agencyMode a ON a.id = t.agencyModeFk
@@ -48415,11 +48488,11 @@ BEGIN
AND a.hasWeightVolumetric
LIMIT 1;
- DROP TEMPORARY TABLE tmp.buysToCheck;
+ DROP TEMPORARY TABLE tmp.buysToCheck;
- IF hasVolumetricAgency THEN
- CALL util.throw('Item lacks size/weight in purchase line at agency');
- END IF;
+ IF vHasVolumetricAgency THEN
+ CALL util.throw(CONCAT('Missing size/weight in buy line at agency, item: ', vItemFk));
+ END IF;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -48436,7 +48509,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_clone`(vEntryFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `buy_clone`(vEntryFk INT)
BEGIN
/**
* Clone buys to an entry
@@ -48506,7 +48579,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_getSplit`(vSelf INT, vDated DATE)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `buy_getSplit`(vSelf INT, vDated DATE)
BEGIN
/**
* Devuelve tantos registros como etiquetas se necesitan para cada uno de los cubos o cajas de
@@ -48886,16 +48959,16 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `buy_getVolume` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_getVolume`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `buy_getVolume`()
BEGIN
/**
* Cálculo de volumen en líneas de compra
@@ -48929,7 +49002,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_getVolumeByAgency`(vDated DATE, vAgencyFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `buy_getVolumeByAgency`(vDated DATE, vAgencyFk INT)
BEGIN
DROP TEMPORARY TABLE IF EXISTS tmp.buy;
@@ -48962,7 +49035,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_getVolumeByEntry`(vEntryFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `buy_getVolumeByEntry`(vEntryFk INT)
BEGIN
DROP TEMPORARY TABLE IF EXISTS tmp.buy;
@@ -48993,55 +49066,62 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_recalcPrices`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `buy_recalcPrices`()
BEGIN
/**
- * Recalcula los precios para las compras insertadas en tmp.buyRecalc
+ * Recalcula los precios para las compras insertadas en tmp.buyRecalc.
*
* @param tmp.buyRecalc (id)
*/
DECLARE vLanded DATE;
DECLARE vWarehouseFk INT;
- DECLARE vHasNotPrice BOOL;
- DECLARE vBuyingValue DECIMAL(10,4);
- DECLARE vPackagingFk VARCHAR(10);
DECLARE vIsWarehouseFloramondo BOOL;
+ DECLARE vDone BOOL;
+ DECLARE vTravels CURSOR FOR
+ SELECT t.landed, t.warehouseInFk, (w.code = 'flm')
+ FROM tmp.buyRecalc br
+ JOIN buy b ON b.id = br.id
+ JOIN entry e ON e.id = b.entryFk
+ JOIN travel t ON t.id = e.travelFk
+ JOIN warehouse w ON w.id = t.warehouseInFk
+ GROUP BY t.landed, t.warehouseInFk;
- SELECT t.landed, t.warehouseInFk, (w.`name` = 'Floramondo')
- INTO vLanded, vWarehouseFk, vIsWarehouseFloramondo
- FROM tmp.buyRecalc br
- JOIN buy b ON b.id = br.id
- JOIN entry e ON e.id = b.entryFk
- JOIN travel t ON t.id = e.travelFk
- JOIN warehouse w ON w.id = t.warehouseInFk
- LIMIT 1;
+ DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
- CALL rate_getPrices(vLanded, vWarehouseFk);
+ OPEN vTravels;
+ l: LOOP
+ SET vDone = FALSE;
+ FETCH vTravels INTO vLanded, vWarehouseFk, vIsWarehouseFloramondo;
- UPDATE buy b
- JOIN tmp.buyRecalc br ON br.id = b.id AND (@buyId := b.id)
- LEFT JOIN packaging p ON p.id = b.packagingFk
- JOIN item i ON i.id = b.itemFk
- JOIN entry e ON e.id = b.entryFk
- JOIN itemType it ON it.id = i.typeFk
- JOIN travel tr ON tr.id = e.travelFk
- JOIN agencyMode am ON am.id = tr.agencyModeFk
- JOIN tmp.rate r
- JOIN volumeConfig vc
- SET b.freightValue = @PF:= IFNULL(((am.m3 * @m3:= item_getVolume(b.itemFk, b.packagingFk) / 1000000)
- / b.packing) * IF(am.hasWeightVolumetric, GREATEST(b.weight / @m3 / vc.aerealVolumetricDensity, 1), 1), 0),
- b.comissionValue = @CF:= ROUND(IFNULL(e.commission * b.buyingValue / 100, 0), 3),
- b.packageValue = @EF:= IF(vIsWarehouseFloramondo, 0, IFNULL(ROUND(IF(p.isPackageReturnable, p.returnCost / b.packing , p.`value` / b.packing), 3),0)),
- b.price3 = @t3:= IF(r.rate3 = 0, b.buyingValue,ROUND((b.buyingValue + @CF + @EF + @PF) / ((100 - r.rate3 - it.promo ) /100) ,2)), -- He añadido que el coste sea igual a tarifa3 si t3 = 0
- b.price2 = @t2:= round(@t3 * (1 + ((r.rate2 - r.rate3)/100)),2),
- b.price2 = @t2:= IF(@t2 <= @t3,@t3 , @t2);
+ IF vDone THEN
+ LEAVE l;
+ END IF;
- SELECT (b.buyingValue = b.price2), b.buyingValue, b.packagingFk
- INTO vHasNotPrice, vBuyingValue, vPackagingFk
- FROM vn.buy b
- WHERE b.id = @buyId AND b.buyingValue <> 0.01;
+ CALL rate_getPrices(vLanded, vWarehouseFk);
- DROP TEMPORARY TABLE tmp.rate;
+ UPDATE buy b
+ JOIN tmp.buyRecalc br ON br.id = b.id AND (@buyId := b.id)
+ LEFT JOIN packaging p ON p.id = b.packagingFk
+ JOIN item i ON i.id = b.itemFk
+ JOIN entry e ON e.id = b.entryFk
+ JOIN itemType it ON it.id = i.typeFk
+ JOIN travel tr ON tr.id = e.travelFk
+ JOIN agencyMode am ON am.id = tr.agencyModeFk
+ JOIN tmp.rate r
+ JOIN volumeConfig vc
+ SET b.freightValue = @PF:= IFNULL(((am.m3 * @m3:= item_getVolume(b.itemFk, b.packagingFk) / 1000000)
+ / b.packing) * IF(am.hasWeightVolumetric, GREATEST(b.weight / @m3 / vc.aerealVolumetricDensity, 1), 1), 0),
+ b.comissionValue = @CF:= ROUND(IFNULL(e.commission * b.buyingValue / 100, 0), 3),
+ b.packageValue = @EF:= IF(vIsWarehouseFloramondo, 0, IFNULL(ROUND(IF(p.isPackageReturnable, p.returnCost / b.packing , p.`value` / b.packing), 3),0)),
+ b.price3 = @t3:= IF(r.rate3 = 0, b.buyingValue,ROUND((b.buyingValue + @CF + @EF + @PF) / ((100 - r.rate3 - it.promo ) /100) ,2)), -- He añadido que el coste sea igual a tarifa3 si t3 = 0
+ b.price2 = @t2:= round(@t3 * (1 + ((r.rate2 - r.rate3)/100)),2),
+ b.price2 = @t2:= IF(@t2 <= @t3,@t3 , @t2)
+ WHERE tr.landed = vLanded
+ AND tr.warehouseInFk = vWarehouseFk;
+
+ DROP TEMPORARY TABLE tmp.rate;
+ END LOOP;
+ CLOSE vTravels;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -49058,7 +49138,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_recalcPricesByAwb`(IN awbFk varchar(18))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `buy_recalcPricesByAwb`(IN awbFk varchar(18))
BEGIN
/**
* inserta en tmp.buyRecalc las compras de un awb
@@ -49094,7 +49174,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_recalcPricesByBuy`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `buy_recalcPricesByBuy`(
vBuyFk INT(11)
)
BEGIN
@@ -49127,7 +49207,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_recalcPricesByEntry`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `buy_recalcPricesByEntry`(
vEntryFk INT(11)
)
BEGIN
@@ -49162,7 +49242,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_scan`(vBarcode VARCHAR(512))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `buy_scan`(vBarcode VARCHAR(512))
BEGIN
/**
* Busca compras a partir de un código de barras de subasta, las marca como
@@ -49214,7 +49294,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_updateGrouping`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `buy_updateGrouping`(
vWarehouseFk INT,
vItemFk INT,
vGrouping INT
@@ -49252,7 +49332,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_updatePacking`(vWarehouseFk INT, vItemFk INT, vPacking INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `buy_updatePacking`(vWarehouseFk INT, vItemFk INT, vPacking INT)
BEGIN
/**
* Actualiza packing
@@ -49287,7 +49367,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `catalog_calcFromItem`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `catalog_calcFromItem`(
vLanded DATE,
vAddressFk INT,
vAgencyModeFk INT,
@@ -49326,7 +49406,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `catalog_calculate`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `catalog_calculate`(
vLanded DATE,
vAddressFk INT,
vAgencyModeFk INT,
@@ -49545,7 +49625,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `catalog_componentCalculate`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `catalog_componentCalculate`(
vZoneFk INT,
vAddressFk INT,
vShipped DATE,
@@ -49866,7 +49946,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `catalog_componentPrepare`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `catalog_componentPrepare`()
BEGIN
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponent;
@@ -49906,7 +49986,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `catalog_componentPurge`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `catalog_componentPurge`()
BEGIN
DROP TEMPORARY TABLE
tmp.ticketComponentPrice,
@@ -49928,7 +50008,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `claimRatio_add`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `claimRatio_add`()
BEGIN
/*
* Añade a la tabla greuges todos los cargos necesario y
@@ -50131,7 +50211,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `clean`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `clean`()
BEGIN
/**
* Purges outdated data to optimize performance.
@@ -50151,14 +50231,12 @@ BEGIN
DELETE FROM workerActivity WHERE created < v2Years;
DELETE FROM ticketParking WHERE created < v2Months;
DELETE FROM routesMonitor WHERE dated < v2Months;
- DELETE FROM workerTimeControlLog WHERE created < v2Months;
DELETE FROM `message` WHERE sendDate < v2Months;
DELETE FROM messageInbox WHERE sendDate < v2Months;
DELETE FROM messageInbox WHERE sendDate < v2Months;
DELETE FROM workerTimeControl WHERE timed < v4Years;
DELETE FROM itemShelving WHERE created < util.VN_CURDATE() AND visible = 0;
DELETE FROM ticketDown WHERE created < util.yesterday();
- DELETE FROM entryLog WHERE creationDate < v2Months;
DELETE IGNORE FROM expedition WHERE created < v26Months;
DELETE cs
FROM sms s
@@ -50193,11 +50271,8 @@ BEGIN
DELETE b FROM buy b
JOIN entryConfig e ON e.defaultEntry = b.entryFk
WHERE b.created < v2Months;
- DELETE FROM itemShelvingLog WHERE created < v2Months;
DELETE FROM stockBuyed WHERE creationDate < v2Months;
- DELETE FROM itemCleanLog WHERE created < util.VN_NOW() - INTERVAL 1 YEAR;
DELETE FROM printQueue WHERE statusCode = 'printed' AND created < v2Months;
- DELETE FROM ticketLog WHERE creationDate <= v5Years;
-- Equipos duplicados
DELETE w.*
FROM workerTeam w
@@ -50306,7 +50381,6 @@ BEGIN
-- Borra los registros de collection y ticketcollection
DELETE FROM collection WHERE created < v2Months;
- DELETE FROM travelLog WHERE creationDate < v3Months;
CALL shelving_clean();
@@ -50375,7 +50449,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `clean_logiflora`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `clean_logiflora`()
BEGIN
/**
* Elimina las compras y los artículos residuales de logiflora.
@@ -50469,7 +50543,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `clearShelvingList`(vShelvingFk VARCHAR(8))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `clearShelvingList`(vShelvingFk VARCHAR(8))
BEGIN
UPDATE vn.itemShelving
SET visible = 0
@@ -50490,7 +50564,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `clientDebtSpray`(vClientFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `clientDebtSpray`(vClientFk INT)
BEGIN
/* Reparte el saldo de un cliente en greuge en la cartera que corresponde, y desasigna el comercial
@@ -50532,7 +50606,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `clientFreeze`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `clientFreeze`()
BEGIN
/**
* Congela diariamente aquellos clientes que son morosos sin recobro,
@@ -50589,7 +50663,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `clientGetDebtDiary`(vClientFK INT, vCompanyFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `clientGetDebtDiary`(vClientFK INT, vCompanyFk INT)
BEGIN
/**
* Devuelve el registro de deuda
@@ -50719,7 +50793,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `clientGreugeSpray`(IN vClientFk INT, IN onlyForHisOwner BOOL, IN vWorkerCode VARCHAR(3), IN vWithMana BOOLEAN)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `clientGreugeSpray`(IN vClientFk INT, IN onlyForHisOwner BOOL, IN vWorkerCode VARCHAR(3), IN vWithMana BOOLEAN)
BEGIN
DECLARE vGreuge DECIMAL(10,2);
@@ -50805,7 +50879,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `clientPackagingOverstock`(vClientFk INT, vGraceDays INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `clientPackagingOverstock`(vClientFk INT, vGraceDays INT)
BEGIN
DROP TEMPORARY TABLE IF EXISTS tmp.clientPackagingOverstock;
CREATE TEMPORARY TABLE tmp.clientPackagingOverstock
@@ -50910,7 +50984,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `clientPackagingOverstockReturn`(vClientFk INT, vGraceDays INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `clientPackagingOverstockReturn`(vClientFk INT, vGraceDays INT)
BEGIN
DECLARE vNewTicket INT DEFAULT 0;
DECLARE vWarehouseFk INT;
@@ -50963,7 +51037,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `clientRemoveWorker`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `clientRemoveWorker`()
BEGIN
DECLARE vDone BOOL DEFAULT FALSE;
DECLARE vClientFk INT;
@@ -51016,7 +51090,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `clientRisk_update`(vClientId INT, vCompanyId INT, vAmount DECIMAL(10,2))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `clientRisk_update`(vClientId INT, vCompanyId INT, vAmount DECIMAL(10,2))
BEGIN
IF vAmount IS NOT NULL
THEN
@@ -51044,7 +51118,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `client_checkBalance`(IN vDateTo DATETIME, IN vIsConciliated BOOL)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `client_checkBalance`(IN vDateTo DATETIME, IN vIsConciliated BOOL)
BEGIN
/**
* Compara los datos de nuestros clientes con
@@ -51125,7 +51199,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `client_create`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `client_create`(
vFirstname VARCHAR(50),
vSurnames VARCHAR(50),
vFi VARCHAR(9),
@@ -51231,7 +51305,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `client_getDebt`(vDate DATE)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `client_getDebt`(vDate DATE)
BEGIN
/**
* Calculates the risk for active clients
@@ -51306,7 +51380,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `client_getMana`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `client_getMana`()
BEGIN
/**
* Devuelve el mana de los clientes de la tabla tmp.client(id)
@@ -51376,7 +51450,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `client_getRisk`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `client_getRisk`(
vDate DATE
)
BEGIN
@@ -51424,7 +51498,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `client_RandomList`(vNumber INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `client_RandomList`(vNumber INT)
BEGIN
DECLARE i INT DEFAULT 0;
@@ -51496,7 +51570,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `client_unassignSalesPerson`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `client_unassignSalesPerson`()
BEGIN
/**
* Elimina la asignación de salesPersonFk de la ficha del clientes
@@ -51561,7 +51635,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `client_userDisable`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `client_userDisable`()
BEGIN
/**
* Desactiva los clientes inactivos en los últimos X meses.
@@ -51608,7 +51682,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `cmrPallet_add`(vExpeditionPalletFk INT, vCmrFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `cmrPallet_add`(vExpeditionPalletFk INT, vCmrFk INT)
BEGIN
/**
* Añade registro a tabla cmrPallet.
@@ -51658,7 +51732,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `collectionPlacement_get`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `collectionPlacement_get`(
vParamFk INT(11),
vIsPicker bool)
BEGIN
@@ -51821,7 +51895,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_addItem`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `collection_addItem`(
vBarccodeFk INT,
vQuantity INT,
vTicketFk INT
@@ -51895,7 +51969,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_addWithReservation`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `collection_addWithReservation`(
vItemFk INT,
vQuantity INT,
vTicketFk INT,
@@ -51998,7 +52072,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_assign`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `collection_assign`(
vUserFk INT,
OUT vCollectionFk INT
)
@@ -52012,39 +52086,42 @@ BEGIN
* @param vCollectionFk Id de colección
*/
DECLARE vHasTooMuchCollections BOOL;
- DECLARE vItemPackingTypeFk VARCHAR(1);
- DECLARE vWarehouseFk INT;
- DECLARE vLockName VARCHAR(215);
- DECLARE vLockTime INT DEFAULT 30;
- DECLARE vErrorNumber INT;
- DECLARE vErrorMsg TEXT;
+ DECLARE vDone BOOL DEFAULT FALSE;
+ DECLARE vCollectionWorker INT;
+ DECLARE vMaxNotAssignedCollectionLifeTime TIME;
- DECLARE EXIT HANDLER FOR SQLEXCEPTION
- BEGIN
- GET DIAGNOSTICS CONDITION 1
- vErrorNumber = MYSQL_ERRNO,
- vErrorMsg = MESSAGE_TEXT;
-
- CALL util.debugAdd('collection_assign', JSON_OBJECT(
- 'errorNumber', vErrorNumber,
- 'errorMsg', vErrorMsg,
- 'lockName', vLockName,
- 'userFk', vUserFk
- )); -- Tmp
-
- IF vLockName IS NOT NULL THEN
- DO RELEASE_LOCK(vLockName);
- END IF;
- RESIGNAL;
- END;
+ DECLARE vCollections CURSOR FOR
+ WITH collections AS (
+ SELECT tc.collectionFk,
+ SUM(sv.volume) volume,
+ c.saleTotalCount,
+ c.itemPackingTypeFk,
+ c.trainFk,
+ c.warehouseFk,
+ c.wagons
+ FROM vn.ticketCollection tc
+ JOIN vn.collection c ON c.id = tc.collectionFk
+ JOIN vn.saleVolume sv ON sv.ticketFk = tc.ticketFk
+ WHERE c.workerFk IS NULL
+ AND sv.shipped >= util.VN_CURDATE()
+ GROUP BY tc.collectionFk
+ ) SELECT c.collectionFk
+ FROM collections c
+ JOIN vn.operator o
+ WHERE o.workerFk = vUserFk
+ AND (c.saleTotalCount <= o.linesLimit OR o.linesLimit IS NULL)
+ AND (c.itemPackingTypeFk = o.itemPackingTypeFk OR o.itemPackingTypeFk IS NULL)
+ AND o.numberOfWagons = c.wagons
+ AND o.trainFk = c.trainFk
+ AND o.warehouseFk = c.warehouseFk;
+ DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
-- Si hay colecciones sin terminar, sale del proceso
+
CALL collection_get(vUserFk);
- SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0,
- collection_assign_lockname
- INTO vHasTooMuchCollections,
- vLockName
+ SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0, pc.maxNotAssignedCollectionLifeTime
+ INTO vHasTooMuchCollections, vMaxNotAssignedCollectionLifeTime
FROM productionConfig pc
LEFT JOIN tmp.collection ON TRUE;
@@ -52054,70 +52131,70 @@ BEGIN
CALL util.throw('Hay colecciones pendientes');
END IF;
- SELECT warehouseFk, itemPackingTypeFk
- INTO vWarehouseFk, vItemPackingTypeFk
- FROM operator
- WHERE workerFk = vUserFk;
-
- SET vLockName = CONCAT_WS('/',
- vLockName,
- vWarehouseFk,
- vItemPackingTypeFk
- );
-
- IF NOT GET_LOCK(vLockName, vLockTime) THEN
- CALL util.throw(CONCAT('Cannot get lock: ', vLockName));
- END IF;
-
-- Se eliminan las colecciones sin asignar que estan obsoletas
- INSERT INTO ticketTracking(stateFk, ticketFk)
- SELECT s.id, tc.ticketFk
- FROM `collection` c
- JOIN ticketCollection tc ON tc.collectionFk = c.id
- JOIN `state` s ON s.code = 'PRINTED_AUTO'
- JOIN productionConfig pc
- WHERE c.workerFk IS NULL
- AND TIMEDIFF(util.VN_NOW(), c.created) > pc.maxNotAssignedCollectionLifeTime;
- DELETE c.*
- FROM `collection` c
- JOIN productionConfig pc
- WHERE c.workerFk IS NULL
- AND TIMEDIFF(util.VN_NOW(), c.created) > pc.maxNotAssignedCollectionLifeTime;
+ INSERT INTO ticketTracking(stateFk, ticketFk)
+ SELECT s.id, tc.ticketFk
+ FROM `collection` c
+ JOIN ticketCollection tc ON tc.collectionFk = c.id
+ JOIN `state` s ON s.code = 'PRINTED_AUTO'
+ WHERE c.workerFk IS NULL
+ AND TIMEDIFF(util.VN_NOW(), c.created) > vMaxNotAssignedCollectionLifeTime;
+
+ DELETE FROM `collection`
+ WHERE workerFk IS NULL
+ AND TIMEDIFF(util.VN_NOW(), created) > vMaxNotAssignedCollectionLifeTime;
-- Se añade registro al semillero
- INSERT INTO collectionHotbed(userFk)
- VALUES(vUserFk);
+
+ INSERT INTO collectionHotbed(userFk) VALUES(vUserFk);
-- Comprueba si hay colecciones disponibles que se ajustan a su configuracion
- SELECT MIN(c.id) INTO vCollectionFk
- FROM `collection` c
- JOIN operator o
- ON (o.itemPackingTypeFk = c.itemPackingTypeFk OR c.itemPackingTypeFk IS NULL)
- AND o.numberOfWagons = c.wagons
- AND o.trainFk = c.trainFk
- AND o.warehouseFk = c.warehouseFk
- AND c.workerFk IS NULL
- AND (c.saleTotalCount <= o.linesLimit OR o.linesLimit IS NULL)
- JOIN (
- SELECT tc.collectionFk, SUM(sv.volume) volume
- FROM ticketCollection tc
- JOIN saleVolume sv ON sv.ticketFk = tc.ticketFk
- WHERE sv.shipped >= util.VN_CURDATE()
- GROUP BY tc.collectionFk
- ) sub ON sub.collectionFk = c.id
- AND (volume <= o.volumeLimit OR o.volumeLimit IS NULL)
- WHERE o.workerFk = vUserFk;
+
+ OPEN vCollections;
+ l: LOOP
+ SET vDone = FALSE;
+ FETCH vCollections INTO vCollectionFk;
+
+ IF vDone THEN
+ LEAVE l;
+ END IF;
+
+ BEGIN
+ DECLARE EXIT HANDLER FOR SQLEXCEPTION
+ BEGIN
+ ROLLBACK;
+ SET vCollectionFk = NULL;
+ RESIGNAL;
+ END;
+
+ START TRANSACTION;
+
+ SELECT workerFk INTO vCollectionWorker
+ FROM `collection`
+ WHERE id = vCollectionFk FOR UPDATE;
+
+ IF vCollectionWorker IS NULL THEN
+ UPDATE `collection`
+ SET workerFk = vUserFk
+ WHERE id = vCollectionFk;
+
+ COMMIT;
+ LEAVE l;
+ END IF;
+
+ ROLLBACK;
+ END;
+ END LOOP;
+ CLOSE vCollections;
IF vCollectionFk IS NULL THEN
CALL collection_new(vUserFk, vCollectionFk);
+
+ UPDATE `collection`
+ SET workerFk = vUserFk
+ WHERE id = vCollectionFk;
END IF;
-
- UPDATE `collection`
- SET workerFk = vUserFk
- WHERE id = vCollectionFk;
-
- DO RELEASE_LOCK(vLockName);
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -52134,7 +52211,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_get`(vWorkerFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `collection_get`(vWorkerFk INT)
BEGIN
/**
* Obtiene colección del sacador si tiene líneas pendientes.
@@ -52185,7 +52262,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_getAssigned`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `collection_getAssigned`(
vUserFk INT,
OUT vCollectionFk INT
)
@@ -52302,7 +52379,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_getTickets`(vParamFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `collection_getTickets`(vParamFk INT)
BEGIN
/**
* Selecciona los tickets de una colección/ticket/sectorCollection
@@ -52404,7 +52481,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_kill`(vSelf INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `collection_kill`(vSelf INT)
BEGIN
/**
* Elimina una coleccion y coloca sus tickets en OK
@@ -52433,7 +52510,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_make`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `collection_make`()
proc:BEGIN
/**
* Genera colecciones de tickets sin asignar trabajador a partir de la tabla
@@ -52506,6 +52583,48 @@ DELIMITER ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `collection_mergeSales` */;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
+DELIMITER ;;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_mergeSales`(vCollectionFk INT)
+BEGIN
+ DECLARE vDone BOOL;
+ DECLARE vTicketFk INT;
+
+ DECLARE vTickets CURSOR FOR
+ SELECT ticketFk
+ FROM ticketCollection
+ WHERE collectionFk = vCollectionFk;
+
+ DECLARE CONTINUE HANDLER FOR NOT FOUND
+ SET vDone = TRUE;
+
+ OPEN vTickets;
+ l: LOOP
+ SET vDone = FALSE;
+
+ FETCH vTickets INTO vTicketFk;
+
+ IF vDone THEN
+ LEAVE l;
+ END IF;
+
+ CALL ticket_mergeSales(vTicketFk);
+ END LOOP;
+ CLOSE vTickets;
+END ;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `collection_new` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -52514,7 +52633,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_new`(vUserFk INT, OUT vCollectionFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `collection_new`(vUserFk INT, OUT vCollectionFk INT)
BEGIN
/**
* Genera colecciones de tickets sin asignar trabajador.
@@ -52524,10 +52643,11 @@ BEGIN
DECLARE vWarehouseFk INT;
DECLARE vWagons INT;
DECLARE vTrainFk INT;
- DECLARE vLinesLimit INT DEFAULT NULL;
+ DECLARE vLinesLimit INT;
DECLARE vTicketLines INT;
- DECLARE vVolumeLimit DECIMAL DEFAULT NULL;
+ DECLARE vVolumeLimit DECIMAL;
DECLARE vTicketVolume DECIMAL;
+ DECLARE vSizeLimit INT;
DECLARE vMaxTickets INT;
DECLARE vStateFk VARCHAR(45);
DECLARE vFirstTicketFk INT;
@@ -52592,6 +52712,7 @@ BEGIN
o.trainFk,
o.linesLimit,
o.volumeLimit,
+ o.sizeLimit,
pc.collection_new_lockname
INTO vMaxTickets,
vHasUniqueCollectionTime,
@@ -52603,6 +52724,7 @@ BEGIN
vTrainFk,
vLinesLimit,
vVolumeLimit,
+ vSizeLimit,
vLockName
FROM productionConfig pc
JOIN worker w ON w.id = vUserFk
@@ -52687,6 +52809,14 @@ BEGIN
JOIN state s ON s.id = pb.state
JOIN agencyMode am ON am.id = pb.agencyModeFk
JOIN agency a ON a.id = am.agencyFk
+ LEFT JOIN (
+ SELECT pb.ticketFk, MAX(i.`size`) maxSize
+ FROM tmp.productionBuffer pb
+ JOIN ticket t ON t.id = pb.ticketfk
+ JOIN sale s ON s.ticketFk = t.id
+ JOIN item i ON i.id = s.itemFk
+ GROUP BY pb.ticketFk
+ ) sub ON sub.ticketFk = pb.ticketFk
JOIN productionConfig pc
WHERE pb.shipped <> util.VN_CURDATE()
OR (pb.ubicacion IS NULL AND a.isOwn)
@@ -52698,8 +52828,10 @@ BEGIN
OR (NOT pb.V AND vItemPackingTypeFk = 'V')
OR (pc.isPreviousPreparationRequired AND pb.previousWithoutParking)
OR LENGTH(pb.problem) > 0
- OR (pb.lines >= vLinesLimit AND vLinesLimit IS NOT NULL)
- OR (pb.m3 >= vVolumeLimit AND vVolumeLimit IS NOT NULL);
+ OR pb.lines > vLinesLimit
+ OR pb.m3 > vVolumeLimit
+ OR sub.maxSize > vSizeLimit
+ OR pb.hasPlantTray;
END IF;
-- Es importante que el primer ticket se coja en todos los casos
@@ -52886,7 +53018,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_printSticker`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `collection_printSticker`(
vSelf INT,
vLabelCount INT
)
@@ -52932,7 +53064,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_setParking`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `collection_setParking`(
vSelf INT,
vParkingFk INT
)
@@ -52963,7 +53095,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_setState`(vSelf INT, vStateCode VARCHAR(255) COLLATE utf8_general_ci)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `collection_setState`(vSelf INT, vStateCode VARCHAR(255) COLLATE utf8_general_ci)
BEGIN
/**
* Modifica el estado de los tickets de una colección.
@@ -53020,7 +53152,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `company_getFiscaldata`(workerFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `company_getFiscaldata`(workerFk INT)
BEGIN
DECLARE vCompanyFk INT;
@@ -53058,7 +53190,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `company_getSuppliersDebt`(vSelf INT, vMonthsAgo INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `company_getSuppliersDebt`(vSelf INT, vMonthsAgo INT)
BEGIN
/**
* Generates a temporary table containing outstanding payments to suppliers.
@@ -53273,7 +53405,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `comparative_add`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `comparative_add`()
BEGIN
/**
* Inserts sales records less than one month old in comparative.
@@ -53345,7 +53477,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `confection_controlSource`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `confection_controlSource`(
vDated DATE,
vScopeDays INT,
vMaxAlertLevel INT,
@@ -53461,7 +53593,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `conveyorExpedition_Add`(vStarted DATETIME, vEnded DATETIME)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `conveyorExpedition_Add`(vStarted DATETIME, vEnded DATETIME)
BEGIN
@@ -53526,7 +53658,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `copyComponentsFromSaleList`(vTargetTicketFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `copyComponentsFromSaleList`(vTargetTicketFk INT)
BEGIN
/* Copy sales and components to the target ticket
@@ -53574,7 +53706,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `createPedidoInterno`(vItemFk INT,vQuantity INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `createPedidoInterno`(vItemFk INT,vQuantity INT)
BEGIN
@@ -53596,7 +53728,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `creditInsurance_getRisk`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `creditInsurance_getRisk`()
BEGIN
/**
* Devuelve el riesgo de los clientes que estan asegurados
@@ -53651,7 +53783,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `creditRecovery`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `creditRecovery`()
BEGIN
/**
* Actualiza el crédito de los clientes
@@ -53718,7 +53850,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `crypt`(vText VARCHAR(255), vKey VARCHAR(255), OUT vResult VARCHAR(255) )
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `crypt`(vText VARCHAR(255), vKey VARCHAR(255), OUT vResult VARCHAR(255) )
BEGIN
DECLARE vEncryptedText VARCHAR(255) DEFAULT '';
@@ -53788,7 +53920,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `cryptOff`(vText VARCHAR(255), vKey VARCHAR(255), OUT vResult VARCHAR(255))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `cryptOff`(vText VARCHAR(255), vKey VARCHAR(255), OUT vResult VARCHAR(255))
BEGIN
DECLARE vUncryptedText VARCHAR(255) DEFAULT '';
@@ -53855,7 +53987,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `department_calcTree`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `department_calcTree`()
BEGIN
/**
* Calculates the #path, #lft, #rgt, #sons and #depth columns of
@@ -53899,7 +54031,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `department_calcTreeRec`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `department_calcTreeRec`(
vSelf INT,
vPath VARCHAR(255),
vDepth INT,
@@ -53981,7 +54113,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `department_doCalc`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `department_doCalc`()
proc: BEGIN
/**
* Recalculates the department tree.
@@ -54023,7 +54155,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `department_getHasMistake`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `department_getHasMistake`()
BEGIN
/**
@@ -54052,7 +54184,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `department_getLeaves`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `department_getLeaves`(
vParentFk INT,
vSearch VARCHAR(255)
)
@@ -54143,7 +54275,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `deviceLog_add`(vWorkerFk INT, vAppName VARCHAR(45), vAppVersion VARCHAR(45), vAndroid_id VARCHAR(64))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `deviceLog_add`(vWorkerFk INT, vAppName VARCHAR(45), vAppVersion VARCHAR(45), vAndroid_id VARCHAR(64))
BEGIN
/**
* Inserta registro en tabla devicelog el log del usuario conectado.
@@ -54171,7 +54303,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `deviceProductionUser_exists`(vUserFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `deviceProductionUser_exists`(vUserFk INT)
BEGIN
/* SELECT COUNT(*) AS UserExists
@@ -54195,7 +54327,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `deviceProductionUser_getWorker`(vAndroid_id VARCHAR(64))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `deviceProductionUser_getWorker`(vAndroid_id VARCHAR(64))
BEGIN
/**
* Selecciona si hay registrado un device con un android_id
@@ -54222,7 +54354,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `deviceProduction_getnameDevice`(vAndroid_id VARCHAR(64))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `deviceProduction_getnameDevice`(vAndroid_id VARCHAR(64))
BEGIN
/**
* Selecciona el id del dispositivo que corresponde al vAndroid_id.
@@ -54248,7 +54380,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `device_checkLogin`(vUserFk INT, vAndroidID VARCHAR(50))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `device_checkLogin`(vUserFk INT, vAndroidID VARCHAR(50))
BEGIN
/*
@@ -54304,7 +54436,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `duaEntryValueUpdate`(vDuaFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `duaEntryValueUpdate`(vDuaFk INT)
BEGIN
UPDATE duaEntry de
@@ -54345,7 +54477,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `duaInvoiceInBooking`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `duaInvoiceInBooking`(
vDuaFk INT
)
BEGIN
@@ -54469,7 +54601,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `duaParcialMake`(vDuaFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `duaParcialMake`(vDuaFk INT)
BEGIN
DECLARE vNewDuaFk INT;
@@ -54503,7 +54635,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `duaTaxBooking`(vDuaFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `duaTaxBooking`(vDuaFk INT)
BEGIN
DECLARE vBookNumber INT;
DECLARE vBookDated DATE;
@@ -54645,7 +54777,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `duaTax_doRecalc`(vDuaFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `duaTax_doRecalc`(vDuaFk INT)
BEGIN
/**
* Borra los valores de duaTax y los vuelve a crear en base a la tabla duaEntry
@@ -54712,7 +54844,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ediTables_Update`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ediTables_Update`()
BEGIN
INSERT IGNORE INTO vn.genus(name)
@@ -54738,7 +54870,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ektEntryAssign_setEntry`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ektEntryAssign_setEntry`()
BEGIN
DECLARE done INT DEFAULT FALSE;
@@ -54863,7 +54995,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `energyMeter_record`(vInput INT, vActiveTime INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `energyMeter_record`(vInput INT, vActiveTime INT)
BEGIN
DECLARE vConsumption INT;
@@ -54896,7 +55028,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `entryDelivered`(vDated DATE, vEntryFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `entryDelivered`(vDated DATE, vEntryFk INT)
BEGIN
DECLARE vTravelFk INT;
@@ -54940,7 +55072,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `entryWithItem`(vShipmentWarehouse INT, vLandingWarehouse INT,vSale INT, vVolume INT, netCost DECIMAL(10,2), vInOutDate DATE)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `entryWithItem`(vShipmentWarehouse INT, vLandingWarehouse INT,vSale INT, vVolume INT, netCost DECIMAL(10,2), vInOutDate DATE)
BEGIN
DECLARE vTravel INT;
@@ -54998,16 +55130,16 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `entry_checkPackaging` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_checkPackaging`(vEntryFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `entry_checkPackaging`(vEntryFk INT)
BEGIN
/**
* Comprueba que los campos package y packaging no sean nulos
@@ -55040,7 +55172,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_clone`(vSelf INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `entry_clone`(vSelf INT)
BEGIN
/**
* clones an entry.
@@ -55073,7 +55205,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_cloneHeader`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `entry_cloneHeader`(
vSelf INT,
OUT vNewEntryFk INT,
vTravelFk INT
@@ -55128,7 +55260,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_cloneWithoutBuy`(vSelf INT, OUT vNewEntryFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `entry_cloneWithoutBuy`(vSelf INT, OUT vNewEntryFk INT)
BEGIN
/**
* Clona una entrada sin compras
@@ -55162,7 +55294,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_copyBuys`(vSelf INT, vDestinationEntryFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `entry_copyBuys`(vSelf INT, vDestinationEntryFk INT)
BEGIN
/**
* Copies all buys from an entry to an entry.
@@ -55193,7 +55325,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_fixMisfit`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `entry_fixMisfit`(
vSelf INT
)
BEGIN
@@ -55269,7 +55401,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_getRate`(vSelf INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `entry_getRate`(vSelf INT)
BEGIN
/**
* Prepara una tabla con las tarifas aplicables en funcion de la fecha
@@ -55303,7 +55435,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_getTransfer`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `entry_getTransfer`(
vSelf INT
)
BEGIN
@@ -55522,7 +55654,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_isEditable`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `entry_isEditable`(
vSelf INT
)
BEGIN
@@ -55559,7 +55691,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_lock`(vSelf INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `entry_lock`(vSelf INT)
BEGIN
/**
* Lock the indicated entry
@@ -55585,7 +55717,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_moveNotPrinted`(vSelf INT,
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `entry_moveNotPrinted`(vSelf INT,
vDays INT,
vChangeEntry BOOL,
OUT vNewEntryFk INT)
@@ -55771,7 +55903,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_notifyChanged`(vSelf INT, vBuyFk INT, vOldValues VARCHAR(512), vNewValues VARCHAR(512))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `entry_notifyChanged`(vSelf INT, vBuyFk INT, vOldValues VARCHAR(512), vNewValues VARCHAR(512))
BEGIN
DECLARE vEmail VARCHAR(255);
DECLARE vFields VARCHAR(100);
@@ -55816,7 +55948,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_recalc`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `entry_recalc`()
BEGIN
/**
* Comprueba que las ventas creadas entre un rango de fechas tienen componentes
@@ -55863,7 +55995,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_splitByShelving`(vShelvingFk VARCHAR(3), vFromEntryFk INT, vToEntryFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `entry_splitByShelving`(vShelvingFk VARCHAR(3), vFromEntryFk INT, vToEntryFk INT)
BEGIN
/**
* Divide las compras entre dos entradas de acuerdo con lo ubicado en una matr�cula
@@ -55992,7 +56124,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_splitMisfit`(vSelf INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `entry_splitMisfit`(vSelf INT)
BEGIN
/* Divide una entrada, pasando los registros que ha insertado vn.entry_fixMisfit de la entrada original
@@ -56039,7 +56171,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_unlock`(vSelf INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `entry_unlock`(vSelf INT)
BEGIN
/**
* Unlock the indicated entry
@@ -56065,7 +56197,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_updateComission`(vCurrency INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `entry_updateComission`(vCurrency INT)
BEGIN
/**
* Actualiza la comision de las entradas de hoy a futuro y las recalcula
@@ -56129,7 +56261,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionGetFromRoute`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `expeditionGetFromRoute`(
vExpeditionFk INT)
BEGIN
/**
@@ -56174,7 +56306,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionPallet_build`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `expeditionPallet_build`(
vExpeditions JSON,
vArcId INT,
vWorkerFk INT,
@@ -56291,7 +56423,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionPallet_Del`(vPalletFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `expeditionPallet_Del`(vPalletFk INT)
BEGIN
DELETE FROM vn.expeditionPallet
@@ -56313,7 +56445,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionPallet_List`(vTruckFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `expeditionPallet_List`(vTruckFk INT)
BEGIN
SELECT ep.id Pallet,
@@ -56342,7 +56474,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionPallet_printLabel`(vSelf INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `expeditionPallet_printLabel`(vSelf INT)
BEGIN
/**
* Calls the report_print procedure and passes it
@@ -56384,16 +56516,16 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `expeditionPallet_View` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionPallet_View`(vPalletFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `expeditionPallet_View`(vPalletFk INT)
BEGIN
SELECT ep.id Pallet,
@@ -56422,7 +56554,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionScan_Add`(vPalletFk INT, vTruckFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `expeditionScan_Add`(vPalletFk INT, vTruckFk INT)
BEGIN
DECLARE vTotal INT DEFAULT 0;
@@ -56462,7 +56594,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionScan_Del`(vScanFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `expeditionScan_Del`(vScanFk INT)
BEGIN
DELETE FROM vn.expeditionScan
@@ -56484,7 +56616,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionScan_List`(vPalletFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `expeditionScan_List`(vPalletFk INT)
BEGIN
SELECT es.id,
@@ -56514,7 +56646,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionScan_Put`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `expeditionScan_Put`(
vPalletFk INT,
vExpeditionFk INT
)
@@ -56545,7 +56677,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionState_add`(vParam INT, vStateCode VARCHAR(100))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `expeditionState_add`(vParam INT, vStateCode VARCHAR(100))
BEGIN
/**
@@ -56589,7 +56721,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionState_addByAdress`(vAdressFk INT, vRouteFk INT, vStateCode VARCHAR(100))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `expeditionState_addByAdress`(vAdressFk INT, vRouteFk INT, vStateCode VARCHAR(100))
BEGIN
/**
@@ -56623,7 +56755,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionState_addByExpedition`(vExpeditionFk INT, vStateCode VARCHAR(100))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `expeditionState_addByExpedition`(vExpeditionFk INT, vStateCode VARCHAR(100))
BEGIN
/**
@@ -56654,7 +56786,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionState_addByPallet`(vPalletFk INT, vStateCode VARCHAR(100))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `expeditionState_addByPallet`(vPalletFk INT, vStateCode VARCHAR(100))
BEGIN
/**
* Inserta nuevos registros en la tabla vn.expeditionState
@@ -56698,7 +56830,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionState_addByRoute`(vRouteFk INT, vStateCode VARCHAR(100))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `expeditionState_addByRoute`(vRouteFk INT, vStateCode VARCHAR(100))
BEGIN
/**
@@ -56731,7 +56863,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `expedition_getFromRoute`(vRouteFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `expedition_getFromRoute`(vRouteFk INT)
BEGIN
/**
* Obtiene las expediciones a partir de una ruta
@@ -56788,7 +56920,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `expedition_getState`(vExpeditionFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `expedition_getState`(vExpeditionFk INT)
BEGIN
DECLARE vTicketsPendientes INT;
@@ -56858,7 +56990,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `expedition_StateGet`(vExpeditionFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `expedition_StateGet`(vExpeditionFk INT)
BEGIN
/* Devuelve una "ficha" con todos los datos relativos a la expedición
@@ -56945,7 +57077,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `freelance_getInfo`(workerFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `freelance_getInfo`(workerFk INT)
BEGIN
SELECT s.name, s.street, s.city, s.nif, s.postCode
FROM route r
@@ -56972,7 +57104,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `getDayExpeditions`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `getDayExpeditions`()
BEGIN
SELECT
@@ -57000,7 +57132,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `getInfoDelivery`(vRouteFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `getInfoDelivery`(vRouteFk INT)
BEGIN
SELECT s.name, s.street, s.city, s.nif, s.postCode FROM vn.route r
JOIN vn.agencyMode am ON r.agencyModeFk = am.id
@@ -57023,7 +57155,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `getPedidosInternos`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `getPedidosInternos`()
BEGIN
SELECT id,name as description,upToDown as quantity FROM vn.item WHERE upToDown;
@@ -57035,16 +57167,16 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `getTaxBases` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `getTaxBases`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `getTaxBases`()
BEGIN
/**
* Calcula y devuelve en número de bases imponibles postivas y negativas
@@ -57089,7 +57221,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `greuge_add`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `greuge_add`()
BEGIN
/**
* Group inserts into vn.greuge and then deletes the records just inserted
@@ -57124,7 +57256,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `greuge_notifyEvents`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `greuge_notifyEvents`()
BEGIN
/**
* Notify to detect wrong greuges.
@@ -57209,7 +57341,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `inventoryFailureAdd`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `inventoryFailureAdd`()
BEGIN
DECLARE done BOOL DEFAULT FALSE;
@@ -57270,7 +57402,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `inventoryMake`(vInventoryDate DATE)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `inventoryMake`(vInventoryDate DATE)
BEGIN
/**
* Recalculate the inventories
@@ -57553,7 +57685,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `inventoryMakeLauncher`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `inventoryMakeLauncher`()
BEGIN
/**
* Recalculate the inventories of all warehouses
@@ -57578,7 +57710,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `inventory_repair`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `inventory_repair`()
BEGIN
DROP TEMPORARY TABLE IF EXISTS tmp.lastEntry;
@@ -57697,7 +57829,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceExpenseMake`(IN vInvoice INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `invoiceExpenseMake`(IN vInvoice INT)
BEGIN
/* Inserta las partidas de gasto correspondientes a la factura
* REQUIERE tabla tmp.ticketToInvoice
@@ -57740,7 +57872,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceFromAddress`(vMaxTicketDate DATETIME,vAddress INT,vCompany INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `invoiceFromAddress`(vMaxTicketDate DATETIME,vAddress INT,vCompany INT)
BEGIN
DECLARE vMinDateTicket DATE DEFAULT TIMESTAMPADD(MONTH, -3, util.VN_CURDATE());
@@ -57775,7 +57907,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceFromClient`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `invoiceFromClient`(
IN vMaxTicketDate datetime,
IN vClientFk INT,
IN vCompanyFk INT)
@@ -57810,7 +57942,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceFromTicket`(IN vTicket INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `invoiceFromTicket`(IN vTicket INT)
BEGIN
DROP TEMPORARY TABLE IF EXISTS `tmp`.`ticketToInvoice`;
@@ -57837,8 +57969,8 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInDueDay_calculate`(
-vInvoiceInFk INT
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `invoiceInDueDay_calculate`(
+ vInvoiceInFk INT
)
BEGIN
/**
@@ -57926,7 +58058,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInDueDay_recalc`(vInvoiceInFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `invoiceInDueDay_recalc`(vInvoiceInFk INT)
BEGIN
DELETE FROM invoiceInDueDay
@@ -57950,7 +58082,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInTaxMakeByDua`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `invoiceInTaxMakeByDua`(
vDuaFk INT
)
BEGIN
@@ -58001,7 +58133,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInTax_afterUpsert`(vInvoiceInFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `invoiceInTax_afterUpsert`(vInvoiceInFk INT)
BEGIN
/**
* Triggered actions when a invoiceInTax is updated or inserted.
@@ -58037,7 +58169,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInTax_getFromDua`(vDuaFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `invoiceInTax_getFromDua`(vDuaFk INT)
BEGIN
/**
* Borra los valores de duaTax y sus vctos. y los vuelve a crear en base a la tabla duaEntry
@@ -58085,7 +58217,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInTax_getFromEntries`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `invoiceInTax_getFromEntries`(
IN vInvoiceInFk INT
)
BEGIN
@@ -58149,7 +58281,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInTax_recalc`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `invoiceInTax_recalc`(
vInvoiceInFk INT
)
BEGIN
@@ -58219,7 +58351,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceIn_booking`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `invoiceIn_booking`(
vSelf INT,
vBookNumber INT
)
@@ -58543,7 +58675,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceIn_checkBooked`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `invoiceIn_checkBooked`(
vSelf INT
)
BEGIN
@@ -58578,7 +58710,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOutAgain`(IN vInvoiceRef VARCHAR(15), vTaxArea VARCHAR(25))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `invoiceOutAgain`(IN vInvoiceRef VARCHAR(15), vTaxArea VARCHAR(25))
BEGIN
/* Para tickets ya facturados, vuelve a repetir el proceso de facturación.
@@ -58648,7 +58780,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOutBooking`(IN vInvoice INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `invoiceOutBooking`(IN vInvoice INT)
BEGIN
/**
* Asienta una factura emitida
@@ -58850,7 +58982,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOutBookingRange`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `invoiceOutBookingRange`()
BEGIN
/* Reasentar facturas
@@ -58910,7 +59042,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOutListByCompany`(vCompany INT, vStarted DATE, vEnded DATE)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `invoiceOutListByCompany`(vCompany INT, vStarted DATE, vEnded DATE)
BEGIN
SELECT
@@ -58950,7 +59082,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOutTaxAndExpense`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `invoiceOutTaxAndExpense`()
BEGIN
/* Para tickets ya facturados, vuelve a repetir el proceso de facturación.
@@ -59039,7 +59171,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOut_exportationFromClient`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `invoiceOut_exportationFromClient`(
vMaxTicketDate DATETIME,
vClientFk INT,
vCompanyFk INT)
@@ -59084,7 +59216,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOut_new`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `invoiceOut_new`(
vSerial VARCHAR(255),
vInvoiceDate DATE,
vTaxArea VARCHAR(25),
@@ -59182,7 +59314,7 @@ BEGIN
AND (vCorrectingSerial = vSerial OR NOT hasAnyNegativeBase())
THEN
- -- el trigger añade el siguiente Id_Factura correspondiente a la vSerial
+ -- el trigger añade el siguiente ref correspondiente a la vSerial
INSERT INTO invoiceOut(
ref,
serial,
@@ -59376,7 +59508,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOut_newFromClient`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `invoiceOut_newFromClient`(
IN vClientFk INT,
IN vSerial CHAR(2),
IN vMaxShipped DATE,
@@ -59445,7 +59577,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOut_newFromTicket`(IN vTicketFk int, IN vSerial char(2), IN vTaxArea varchar(25),
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `invoiceOut_newFromTicket`(IN vTicketFk int, IN vSerial char(2), IN vTaxArea varchar(25),
IN vRef varchar(25), OUT vInvoiceId int)
BEGIN
/**
@@ -59492,7 +59624,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceTaxMake`(vInvoice INT, vTaxArea VARCHAR(25))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `invoiceTaxMake`(vInvoice INT, vTaxArea VARCHAR(25))
BEGIN
/**
* Factura un conjunto de tickets.
@@ -59549,7 +59681,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemBarcode_update`(vItemFk INT,vCode VARCHAR(22), vDelete BOOL)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemBarcode_update`(vItemFk INT,vCode VARCHAR(22), vDelete BOOL)
BEGIN
IF vDelete THEN
DELETE FROM vn.itemBarcode WHERE itemFk = vItemFk AND code = vCode;
@@ -59573,7 +59705,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemFuentesBalance`(vDaysInFuture INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemFuentesBalance`(vDaysInFuture INT)
BEGIN
/* Se utiliza para calcular la necesidad de mover mercancia entre el almacén de fuentes y el nuestro
@@ -59706,7 +59838,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemPlacementFromTicket`(vTicket INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemPlacementFromTicket`(vTicket INT)
BEGIN
/**
* Llama a itemPlacementUpdateVisible
@@ -59743,7 +59875,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemPlacementSupplyAiming`(vShelvingFk VARCHAR(10), quantity INT, vItemFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemPlacementSupplyAiming`(vShelvingFk VARCHAR(10), quantity INT, vItemFk INT)
BEGIN
SELECT ish.itemFk,
@@ -59786,7 +59918,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemPlacementSupplyCloseOrder`(vId INT, vQuantity INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemPlacementSupplyCloseOrder`(vId INT, vQuantity INT)
BEGIN
UPDATE vn.itemPlacementSupply
@@ -59809,7 +59941,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemPlacementSupplyGetOrder`(vSector INT )
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemPlacementSupplyGetOrder`(vSector INT )
BEGIN
DECLARE vId INT;
@@ -59859,7 +59991,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemPlacementSupplyStockGetTargetList`(vItemFk INT,vSectorFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemPlacementSupplyStockGetTargetList`(vItemFk INT,vSectorFk INT)
BEGIN
/**
* Devuelve la lista de ubicaciones para itemFk en ese sector. Se utiliza en la preparación previa.
@@ -59902,7 +60034,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemRefreshTags`(IN vItem INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemRefreshTags`(IN vItem INT)
BEGIN
/**
* Crea la tabla temporal necesaria para el procedimiento item_refreshTags
@@ -59935,7 +60067,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemSale_byWeek`(vWeek INT, IN vYear INT, vItemFk INT, vWarehouseFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemSale_byWeek`(vWeek INT, IN vYear INT, vItemFk INT, vWarehouseFk INT)
BEGIN
DECLARE vStarted DATE;
@@ -59993,7 +60125,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemSaveMin`(min INT,vBarcode VARCHAR(22))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemSaveMin`(min INT,vBarcode VARCHAR(22))
BEGIN
DECLARE vItemFk INT;
@@ -60019,7 +60151,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemSearchShelving`(`vShelvingFk` VARCHAR(3))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemSearchShelving`(`vShelvingFk` VARCHAR(3))
BEGIN
SELECT p.`column` AS col , p.`row`
FROM vn.shelving s
@@ -60041,7 +60173,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingDelete`(vId INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemShelvingDelete`(vId INT)
BEGIN
DELETE FROM vn.itemShelving WHERE id = vId;
@@ -60062,7 +60194,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingLog_get`(vShelvingFk VARCHAR(10) )
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemShelvingLog_get`(vShelvingFk VARCHAR(10) )
BEGIN
/**
@@ -60101,16 +60233,16 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `itemShelvingMakeFromDate` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingMakeFromDate`(IN `vShelvingFk` VARCHAR(8), IN `vBarcode` VARCHAR(22), IN `vQuantity` INT, IN `vPackagingFk` VARCHAR(10), IN `vGrouping` INT, IN `vPacking` INT, IN `vWarehouseFk` INT, `vCreated` VARCHAR(22))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemShelvingMakeFromDate`(IN `vShelvingFk` VARCHAR(8), IN `vBarcode` VARCHAR(22), IN `vQuantity` INT, IN `vPackagingFk` VARCHAR(10), IN `vGrouping` INT, IN `vPacking` INT, IN `vWarehouseFk` INT, `vCreated` VARCHAR(22))
BEGIN
DECLARE vItemFk INT;
@@ -60181,7 +60313,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingMatch`(vEntryFk INT, vAllTravel BOOLEAN, vFromTimed DATETIME, vToTimed DATETIME)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemShelvingMatch`(vEntryFk INT, vAllTravel BOOLEAN, vFromTimed DATETIME, vToTimed DATETIME)
BEGIN
DECLARE vTravelFk INT;
@@ -60225,7 +60357,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingPlacementSupplyAdd`(vItemShelvingFk INT, vItemPlacementSupplyFk INT, vQuantity INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemShelvingPlacementSupplyAdd`(vItemShelvingFk INT, vItemPlacementSupplyFk INT, vQuantity INT)
BEGIN
INSERT INTO vn.itemShelvingPlacementSupply( itemShelvingFk,
@@ -60258,7 +60390,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingProblem`(vSectorFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemShelvingProblem`(vSectorFk INT)
BEGIN
DECLARE vVisibleCache INT;
@@ -60320,7 +60452,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingRadar`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemShelvingRadar`(
vSectorFk INT
)
BEGIN
@@ -60540,7 +60672,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingRadar_Entry`(vEntryFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemShelvingRadar_Entry`(vEntryFk INT)
BEGIN
DECLARE vWarehouseFk INT DEFAULT 1;
@@ -60605,7 +60737,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingRadar_Entry_State_beta`(vEntryFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemShelvingRadar_Entry_State_beta`(vEntryFk INT)
BEGIN
DECLARE vWarehouseFk INT DEFAULT 1;
@@ -60656,7 +60788,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingSale_Add`(vItemShelvingFk INT, vSaleFk INT, vQuantity INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemShelvingSale_Add`(vItemShelvingFk INT, vSaleFk INT, vQuantity INT)
BEGIN
/**
* Añade línea a itemShelvingSale y regulariza el carro
@@ -60698,7 +60830,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingSale_addByCollection`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemShelvingSale_addByCollection`(
vCollectionFk INT(11)
)
BEGIN
@@ -60761,7 +60893,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingSale_addBySale`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemShelvingSale_addBySale`(
vSaleFk INT,
vSectorFk INT
)
@@ -60810,6 +60942,13 @@ proc: BEGIN
RESIGNAL;
END;
+ START TRANSACTION;
+
+ SELECT id INTO vSaleFk
+ FROM sale
+ WHERE id = vSaleFk
+ FOR UPDATE;
+
SELECT MAX(p.pickingOrder), s.quantity - SUM(IFNULL(iss.quantity, 0)), s.quantity
INTO vLastPickingOrder, vOutStanding, vSaleQuantity
FROM sale s
@@ -60819,7 +60958,8 @@ proc: BEGIN
LEFT JOIN parking p ON p.id = sh.parkingFk
WHERE s.id = vSaleFk;
- IF vOutStanding <= 0 THEN
+ IF vOutStanding <= 0 THEN
+ COMMIT;
LEAVE proc;
END IF;
@@ -60837,16 +60977,17 @@ proc: BEGIN
WHERE saleFk = vSaleFk;
IF vTotalReservedQuantity <> vSaleQuantity THEN
+ CALL util.debugAdd('itemShelvingSale_addBySale',
+ CONCAT(vSaleFk, ' - ', vSaleQuantity,' - ', vTotalReservedQuantity,'-', vOutStanding,'-', account.myUser_getId()));
+
UPDATE sale
SET quantity = vTotalReservedQuantity
WHERE id = vSaleFk;
END IF;
LEAVE l;
END IF;
-
- START TRANSACTION;
-
- SELECT id INTO vItemShelvingFk
+
+ SELECT id INTO vItemShelvingFk
FROM itemShelving
WHERE id = vItemShelvingFk
FOR UPDATE;
@@ -60855,7 +60996,8 @@ proc: BEGIN
SET vOutStanding = vOutStanding - vReservedQuantity;
IF vReservedQuantity > 0 THEN
-
+ CALL util.debugAdd('itemShelvingSale_addBySale_reservedQuantity',
+ CONCAT(vSaleFk, ' - ', vReservedQuantity, ' - ', vOutStanding, account.myUser_getId()));
INSERT INTO itemShelvingSale(
itemShelvingFk,
saleFk,
@@ -60873,10 +61015,9 @@ proc: BEGIN
WHERE id = vItemShelvingFk;
END IF;
-
- COMMIT;
END LOOP;
CLOSE vItemShelvingAvailable;
+ COMMIT;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -60952,7 +61093,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingSale_addBySectorCollection`(vSectorCollectionFk INT(11))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemShelvingSale_addBySectorCollection`(vSectorCollectionFk INT(11))
BEGIN
/**
* Reserva cantidades con ubicaciones para el contenido de una preparación previa
@@ -60982,6 +61123,8 @@ BEGIN
FROM operator
WHERE workerFk = account.myUser_getId();
+ CALL util.debugAdd('itemShelvingSale_addBySectorCollection',CONCAT(vSectorCollectionFk,' - ', account.myUser_getId()));
+
OPEN vSales;
l: LOOP
SET vDone = FALSE;
@@ -61010,7 +61153,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingSale_doReserve`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemShelvingSale_doReserve`()
proc: BEGIN
/**
* Genera reservas de la tabla vn.itemShelvingSaleReserve
@@ -61077,7 +61220,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingSale_reallocate`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemShelvingSale_reallocate`(
vItemShelvingFk INT(10),
vItemFk INT(10),
vSectorFk INT
@@ -61145,7 +61288,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingSale_setPicked`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemShelvingSale_setPicked`(
vSaleGroupFk INT(10)
)
BEGIN
@@ -61192,7 +61335,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingSale_setQuantity`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemShelvingSale_setQuantity`(
vItemShelvingSaleFk INT(10),
vQuantity DECIMAL(10,0),
vIsItemShelvingSaleEmpty BOOLEAN,
@@ -61316,7 +61459,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingSale_unpicked`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemShelvingSale_unpicked`(
vSelf INT(11)
)
BEGIN
@@ -61389,7 +61532,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_add`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemShelving_add`(
vShelvingFk VARCHAR(8),
vBarcode VARCHAR(22),
vQuantity INT,
@@ -61436,7 +61579,8 @@ BEGIN
AND buyFk = vBuyFk) THEN
UPDATE itemShelving
- SET visible = visible + vQuantity
+ SET visible = visible + vQuantity,
+ available = available + vQuantity
WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk AND itemFk = vItemFk AND packing = vPacking;
ELSE
@@ -61458,7 +61602,7 @@ BEGIN
id
FROM buy b
WHERE id = vBuyFk;
- END IF;
+ END IF;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -61475,7 +61619,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_addByClaim`(vClaimFk INT, vShelvingFk VARCHAR(3))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemShelving_addByClaim`(vClaimFk INT, vShelvingFk VARCHAR(3))
BEGIN
/**
* Insert items of claim into itemShelving.
@@ -61518,7 +61662,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_addList`(vShelvingFk VARCHAR(3), vList TEXT, vIsChecking BOOL, vWarehouseFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemShelving_addList`(vShelvingFk VARCHAR(3), vList TEXT, vIsChecking BOOL, vWarehouseFk INT)
BEGIN
/* Recorre cada elemento en la colección vList.
* Si el parámetro isChecking = FALSE, llama a itemShelving_add.
@@ -61578,7 +61722,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_filterBuyer`(vBuyerFk INT, vWarehouseFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemShelving_filterBuyer`(vBuyerFk INT, vWarehouseFk INT)
proc:BEGIN
/**
* Lista de articulos filtrados por comprador
@@ -61677,7 +61821,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_get`(IN vSelf VARCHAR(8))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemShelving_get`(IN vSelf VARCHAR(8))
BEGIN
/**
* Lista artículos de itemshelving
@@ -61718,7 +61862,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_getAlternatives`(vShelvingFk VARCHAR(10))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemShelving_getAlternatives`(vShelvingFk VARCHAR(10))
BEGIN
/**
* Devuelve un listado de posibles ubicaciones alternativas a ubicar los item de la matricula
@@ -61753,7 +61897,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_getInfo`(vItemFk VARCHAR(22))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemShelving_getInfo`(vItemFk VARCHAR(22))
BEGIN
/**
* Muestra información realtiva a la ubicación de un item
@@ -61790,7 +61934,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_getItemDetails`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemShelving_getItemDetails`(
vBarcodeItem INT,
vShelvingFK VARCHAR(10)
)
@@ -61858,7 +62002,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_getSaleDate`(vShelvingFk VARCHAR(3))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemShelving_getSaleDate`(vShelvingFk VARCHAR(3))
BEGIN
/* Devuelve la mínima fecha en que se necesita cada producto en esa matrícula.
@@ -62036,7 +62180,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_inventory`(vParkingFromFk VARCHAR(8), vParkingToFk VARCHAR(8))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemShelving_inventory`(vParkingFromFk VARCHAR(8), vParkingToFk VARCHAR(8))
BEGIN
/**
* Devuelve un listado de ubicaciones a revisar
@@ -62114,7 +62258,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_selfConsumption`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemShelving_selfConsumption`(
vShelvingFk VARCHAR(10) COLLATE utf8_general_ci,
vItemFk INT,
vQuantity INT
@@ -62216,34 +62360,32 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_transfer`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemShelving_transfer`(
vItemShelvingFk INT,
vShelvingFk VARCHAR(10)
)
BEGIN
/**
- * Transfiere producto de una ubicación a otra, fusionando si coincide el
- * packing y la fecha.
+ * Transfiere producto de una ubicación a otra
+ * fusionando si coincide el packing y la fecha.
*
* @param vItemShelvingFk Identificador de itemShelving
* @param vShelvingFk Identificador de shelving
*/
- DECLARE vNewItemShelvingFk INT DEFAULT 0;
+ DECLARE vNewItemShelvingFk INT;
- SELECT MAX(ish.id)
- INTO vNewItemShelvingFk
+ SELECT MAX(ish.id) INTO vNewItemShelvingFk
FROM itemShelving ish
JOIN (
- SELECT
- itemFk,
- packing,
- created,
- buyFk
+ SELECT itemFk,
+ packing,
+ created,
+ buyFk
FROM itemShelving
WHERE id = vItemShelvingFk
) ish2 ON ish2.itemFk = ish.itemFk
AND ish2.packing = ish.packing
- AND date(ish2.created) = date(ish.created)
+ AND DATE(ish2.created) = DATE(ish.created)
AND ish2.buyFk = ish.buyFk
WHERE ish.shelvingFk = vShelvingFk COLLATE utf8_unicode_ci;
@@ -62256,11 +62398,17 @@ BEGIN
DELETE FROM itemShelving
WHERE id = vItemShelvingFk;
ELSE
- UPDATE itemShelving
- SET shelvingFk = vShelvingFk
- WHERE id = vItemShelvingFk;
+ IF (SELECT EXISTS(SELECT id FROM shelving
+ WHERE code = vShelvingFk COLLATE utf8_unicode_ci)) THEN
+
+ UPDATE itemShelving
+ SET shelvingFk = vShelvingFk
+ WHERE id = vItemShelvingFk;
+ ELSE
+ CALL util.throw('The shelving not exists');
+ END IF;
END IF;
- SELECT true;
+ SELECT TRUE;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -62277,7 +62425,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_update`(vVisible INT, vPacking INT, vShelf INT ,vGrouping INT )
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemShelving_update`(vVisible INT, vPacking INT, vShelf INT ,vGrouping INT )
BEGIN
/**
* Actualiza itemShelving.
@@ -62309,7 +62457,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemTagMake`(vItemFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemTagMake`(vItemFk INT)
BEGIN
/* * Crea los tags usando la tabla plantilla itemTag
@@ -62369,16 +62517,16 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `itemTagReorder` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemTagReorder`(itemTypeFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemTagReorder`(itemTypeFk INT)
BEGIN
SET @isTriggerDisabled = TRUE;
@@ -62418,7 +62566,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemTagReorderByName`(vName VARCHAR(255))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemTagReorderByName`(vName VARCHAR(255))
BEGIN
SET @isTriggerDisabled = TRUE;
@@ -62458,7 +62606,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemTag_replace`(vItemFromFk INT, vItemToFk INT, vPicture VARCHAR(100))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemTag_replace`(vItemFromFk INT, vItemToFk INT, vPicture VARCHAR(100))
BEGIN
/* Reemplaza los tags de un artículo por los de otro, así como su imagen
@@ -62506,7 +62654,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemTopSeller`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemTopSeller`()
BEGIN
DECLARE vCategoryFk INTEGER;
DECLARE vDone INT DEFAULT FALSE;
@@ -62582,7 +62730,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemUpdateTag`(IN vItem BIGINT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `itemUpdateTag`(IN vItem BIGINT)
BEGIN
@@ -62636,7 +62784,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `item_calcVisible`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `item_calcVisible`(
vSelf INT,
vWarehouseFk INT
)
@@ -62711,7 +62859,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `item_cleanFloramondo`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `item_cleanFloramondo`()
BEGIN
/**
* Elimina todos los items repetidos de floramondo
@@ -62924,7 +63072,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `item_comparative`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `item_comparative`(
vDate DATETIME,
vDayRange TINYINT,
vWarehouseFk TINYINT,
@@ -63234,7 +63382,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `item_deactivateUnused`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `item_deactivateUnused`()
BEGIN
/**
* Cambia a false el campo isActive de la tabla vn.item para todos aquellos
@@ -63278,7 +63426,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `item_devalueA2`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `item_devalueA2`(
vSelf INT,
vShelvingFK VARCHAR(10),
vBuyingValue DECIMAL(10,4),
@@ -63699,7 +63847,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getAtp`(vDated DATE)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `item_getAtp`(vDated DATE)
BEGIN
/**
* Calcula el valor mínimo acumulado para cada artículo ordenado por fecha y
@@ -63760,7 +63908,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getBalance`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `item_getBalance`(
vItemFk INT,
vWarehouseFk INT,
vDated DATETIME
@@ -63950,7 +64098,7 @@ BEGIN
SELECT * FROM sales
UNION ALL
SELECT * FROM orders
- ORDER BY shipped DESC,
+ ORDER BY shipped,
(inventorySupplierFk = entityId) DESC,
alertLevel DESC,
isTicket,
@@ -64053,7 +64201,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getInfo`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `item_getInfo`(
`vBarcode` VARCHAR(22),
`vWarehouseFk` INT
)
@@ -64143,7 +64291,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getLack`(IN vForce BOOLEAN, IN vDays INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `item_getLack`(IN vForce BOOLEAN, IN vDays INT)
BEGIN
/**
* Calcula una tabla con el máximo negativo visible para cada producto y almacen
@@ -64213,7 +64361,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getMinacum`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `item_getMinacum`(
vWarehouseFk TINYINT,
vDated DATE,
vRange INT,
@@ -64328,7 +64476,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getMinETD`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `item_getMinETD`()
BEGIN
/* Devuelve una tabla temporal con la primera ETD, para todos los artículos con salida hoy.
@@ -64365,7 +64513,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getSimilar`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `item_getSimilar`(
vSelf INT,
vWarehouseFk INT,
vDated DATE,
@@ -64477,7 +64625,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getStock`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `item_getStock`(
vWarehouseFk SMALLINT,
vDated DATE,
vItemFk INT
@@ -64562,7 +64710,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `item_multipleBuy`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `item_multipleBuy`(
vDate DATETIME,
vWarehouseFk INT
)
@@ -64611,7 +64759,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `item_multipleBuyByDate`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `item_multipleBuyByDate`(
vDated DATETIME,
vWarehouseFk TINYINT(3)
)
@@ -64664,7 +64812,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `item_refreshFromTags`(vSelf INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `item_refreshFromTags`(vSelf INT)
BEGIN
/**
* Updates item attributes with its corresponding tags.
@@ -64745,7 +64893,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `item_refreshTags`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `item_refreshTags`()
BEGIN
/**
* Update item table, tag "cache" fields
@@ -64787,7 +64935,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `item_saveReference`(vBarcode VARCHAR(22), vReference VARCHAR(150))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `item_saveReference`(vBarcode VARCHAR(22), vReference VARCHAR(150))
BEGIN
/**
@@ -64819,7 +64967,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `item_setGeneric`(vSelf INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `item_setGeneric`(vSelf INT)
BEGIN
/**
* Asigna el código genérico a un item, salvo que sea un código de item genérico.
@@ -64888,7 +65036,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `item_setVisibleDiscard`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `item_setVisibleDiscard`(
vItemFk INT,
vWarehouseFk INT,
vQuantity INT,
@@ -64981,7 +65129,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `item_updatePackingType`(vItem INT, vItemPackingTypeFk VARCHAR(1))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `item_updatePackingType`(vItem INT, vItemPackingTypeFk VARCHAR(1))
BEGIN
/**
* Update the packing type of an item
@@ -65007,7 +65155,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `item_valuateInventory`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `item_valuateInventory`(
vDated DATE,
vItemTypeFk INT,
vItemCategoryFk INT
@@ -65264,7 +65412,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `item_zoneClosure`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `item_zoneClosure`()
BEGIN
/* Devuelve una tabla temporal con la hora minima de un ticket sino tiene el de la zoneClosure y
@@ -65302,7 +65450,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ledger_doCompensation`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ledger_doCompensation`(
vDated DATE,
vCompensationAccount VARCHAR(10),
vBankFk VARCHAR(10),
@@ -65424,7 +65572,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ledger_next`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ledger_next`(
IN vFiscalYear INT,
OUT vLastBookEntry INT
)
@@ -65464,7 +65612,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ledger_nextTx`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ledger_nextTx`(
IN vFiscalYear INT,
OUT vLastBookEntry INT
)
@@ -65499,7 +65647,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `logShow`(vOriginFk INT, vEntity VARCHAR(45))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `logShow`(vOriginFk INT, vEntity VARCHAR(45))
BEGIN
/**
* Muestra las acciones realizadas por el usuario
@@ -65535,7 +65683,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `lungSize_generator`(vDate DATE)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `lungSize_generator`(vDate DATE)
BEGIN
SET @buildingOrder := 0;
@@ -65596,7 +65744,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `machineWorker_add`(vPlate VARCHAR(10), vWorkerFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `machineWorker_add`(vPlate VARCHAR(10), vWorkerFk INT)
BEGIN
/**
@@ -65631,7 +65779,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `machineWorker_getHistorical`(vPlate VARCHAR(20), vWorkerFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `machineWorker_getHistorical`(vPlate VARCHAR(20), vWorkerFk INT)
BEGIN
/**
* Obtiene historial de la matrícula vPlate que el trabajador vWorkerFk escanea,
@@ -65665,7 +65813,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `machineWorker_update`(vPlate VARCHAR(10), vWorkerFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `machineWorker_update`(vPlate VARCHAR(10), vWorkerFk INT)
BEGIN
/**
@@ -65716,7 +65864,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `machine_getWorkerPlate`(vWorkerFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `machine_getWorkerPlate`(vWorkerFk INT)
BEGIN
/**
* Selecciona la matrícula del vehículo del workerfk
@@ -65745,7 +65893,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `mail_insert`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `mail_insert`(
vReceiver VARCHAR(255),
vReplyTo VARCHAR(50),
vSubject VARCHAR(100),
@@ -65796,7 +65944,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `makeNewItem`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `makeNewItem`()
BEGIN
DECLARE newItemFk INT;
@@ -65825,7 +65973,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `makePCSGraf`(vDated DATE)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `makePCSGraf`(vDated DATE)
BEGIN
@@ -65877,7 +66025,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `manaSpellersRequery`(vWorkerFk INTEGER)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `manaSpellersRequery`(vWorkerFk INTEGER)
`whole_proc`:
BEGIN
/**
@@ -65926,7 +66074,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `multipleInventory`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `multipleInventory`(
vDate DATE,
vWarehouseFk TINYINT,
vMaxDays TINYINT
@@ -66134,7 +66282,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `mysqlConnectionsSorter_kill`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `mysqlConnectionsSorter_kill`()
BEGIN
/**
@@ -66184,7 +66332,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `mysqlPreparedCount_check`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `mysqlPreparedCount_check`()
BEGIN
DECLARE vPreparedCount INTEGER;
@@ -66218,7 +66366,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `nextShelvingCodeMake`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `nextShelvingCodeMake`()
BEGIN
DECLARE newShelving VARCHAR(3);
@@ -66272,7 +66420,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `observationAdd`(vOriginFk INT, vTableCode VARCHAR(45), vDescription TEXT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `observationAdd`(vOriginFk INT, vTableCode VARCHAR(45), vDescription TEXT)
BEGIN
/**
* Guarda las observaciones realizadas por el usuario
@@ -66313,7 +66461,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `orderCreate`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `orderCreate`(
vLanded DATE,
vAgencyMode INT,
vAddress INT,
@@ -66353,7 +66501,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `orderDelete`(IN vId INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `orderDelete`(IN vId INT)
BEGIN
DELETE FROM hedera.`order` where id = vId;
@@ -66374,7 +66522,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `orderListCreate`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `orderListCreate`(
vLanded DATE,
vAgencyMode INT,
vAddress INT,
@@ -66401,7 +66549,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `orderListVolume`(IN vOrderId INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `orderListVolume`(IN vOrderId INT)
BEGIN
SELECT
@@ -66430,7 +66578,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `packingListSwitch`(saleFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `packingListSwitch`(saleFk INT)
BEGIN
DECLARE valueFk INT;
@@ -66454,16 +66602,16 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `packingSite_startCollection` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `packingSite_startCollection`(vSelf INT, vTicketFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `packingSite_startCollection`(vSelf INT, vTicketFk INT)
proc: BEGIN
/**
* @param vSelf packingSite id
@@ -66527,7 +66675,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `parking_add`(vFromColumn INT, vToColumn INT, vFromRow INT, vToRow INT, vSectorFk INT, vIsLetterMode BOOLEAN)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `parking_add`(vFromColumn INT, vToColumn INT, vFromRow INT, vToRow INT, vSectorFk INT, vIsLetterMode BOOLEAN)
BEGIN
DECLARE vColumn INT;
@@ -66581,7 +66729,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `parking_algemesi`(vFromRow INT, vToRow INT, vSectorFk INT, vLetter VARCHAR(1), vPickingOrder INT, vTrolleysByLine INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `parking_algemesi`(vFromRow INT, vToRow INT, vSectorFk INT, vLetter VARCHAR(1), vPickingOrder INT, vTrolleysByLine INT)
BEGIN
DECLARE vRow INT;
@@ -66656,7 +66804,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `parking_new`(vStart INT, vEnd INT, vSectorFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `parking_new`(vStart INT, vEnd INT, vSectorFk INT)
BEGIN
DECLARE vRow INT;
@@ -66701,7 +66849,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `parking_setOrder`(vWarehouseFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `parking_setOrder`(vWarehouseFk INT)
BEGIN
/*
@@ -66741,7 +66889,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `payment_add`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `payment_add`(
vDated DATE,
vSupplierFk INT,
vAmount DOUBLE,
@@ -66838,7 +66986,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `prepareClientList`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `prepareClientList`()
BEGIN
/*
@@ -66867,7 +67015,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `prepareTicketList`(vStartingDate DATETIME, vEndingDate DATETIME)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `prepareTicketList`(vStartingDate DATETIME, vEndingDate DATETIME)
BEGIN
DROP TEMPORARY TABLE IF EXISTS tmp.productionTicket;
CREATE TEMPORARY TABLE tmp.productionTicket
@@ -66904,7 +67052,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `previousSticker_get`(vSaleGroupFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `previousSticker_get`(vSaleGroupFk INT)
BEGIN
/**
* Devuelve los campos a imprimir en una etiqueta de preparación previa.
@@ -66975,7 +67123,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `printer_checkSector`(vLabelerFk tinyint(3) unsigned, vSector INT(11))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `printer_checkSector`(vLabelerFk tinyint(3) unsigned, vSector INT(11))
BEGIN
/**
* Comprueba si la impresora pertenece al sector
@@ -67010,7 +67158,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `productionControl`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `productionControl`(
vWarehouseFk INT,
vScopeDays INT
)
@@ -67026,11 +67174,6 @@ proc: BEGIN
DECLARE vEndingDate DATETIME;
DECLARE vIsTodayRelative BOOLEAN;
- DECLARE EXIT HANDLER FOR SQLEXCEPTION
- BEGIN
- RESIGNAL;
- END;
-
SELECT util.dayEnd(util.VN_CURDATE()) + INTERVAL LEAST(vScopeDays, maxProductionScopeDays) DAY
INTO vEndingDate
FROM productionConfig;
@@ -67227,8 +67370,6 @@ proc: BEGIN
salesInParkingCount INT DEFAULT 0)
ENGINE = MEMORY;
- -- Insertamos todos los tickets que tienen productos parkineados
- -- en sectores de previa, segun el sector
CREATE OR REPLACE TEMPORARY TABLE tItemShelvingStock
(PRIMARY KEY(itemFk, sectorFk))
ENGINE = MEMORY
@@ -67261,7 +67402,6 @@ proc: BEGIN
AND s.quantity > 0
GROUP BY pb.ticketFk;
- -- Se calcula la cantidad de productos que estan ya preparados porque su saleGroup está aparcado
UPDATE tmp.ticketWithPrevia twp
JOIN (
SELECT pb.ticketFk, COUNT(DISTINCT s.id) salesInParkingCount
@@ -67275,16 +67415,31 @@ proc: BEGIN
) sub ON twp.ticketFk = sub.ticketFk
SET twp.salesInParkingCount = sub.salesInParkingCount;
- -- Marcamos como pendientes aquellos que no coinciden las cantidades
UPDATE tmp.productionBuffer pb
JOIN tmp.ticketWithPrevia twp ON twp.ticketFk = pb.ticketFk
SET pb.previousWithoutParking = TRUE
WHERE twp.salesCount > twp.salesInParkingCount;
+ -- hasPlantTray
+ ALTER TABLE tmp.productionBuffer
+ ADD hasPlantTray BOOL DEFAULT FALSE;
+
+ UPDATE tmp.productionBuffer pb
+ JOIN sale s ON s.ticketFk = pb.ticketFk
+ JOIN item i ON i.id = s.itemFk
+ JOIN itemType it ON it.id = i.typeFk
+ JOIN itemCategory ic ON ic.id = it.categoryFk
+ JOIN cache.last_buy lb ON lb.warehouse_id = vWarehouseFk AND lb.item_id = s.itemFk
+ JOIN buy b ON b.id = lb.buy_id
+ JOIN packaging p ON p.id = b.packagingFk
+ JOIN productionConfig pc
+ SET pb.hasPlantTray = TRUE
+ WHERE p.isPlantTray
+ AND pb.isOwn;
+
DROP TEMPORARY TABLE
tmp.productionTicket,
tmp.ticket,
- tmp.risk,
tmp.ticket_problems,
tmp.ticketWithPrevia,
tItemShelvingStock,
@@ -67305,7 +67460,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `productionError_add`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `productionError_add`()
BEGIN
DECLARE vDatedFrom DATETIME;
DECLARE vDatedTo DATETIME;
@@ -67482,7 +67637,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `productionError_addCheckerPackager`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `productionError_addCheckerPackager`(
vDatedFrom DATETIME,
vDatedTo DATETIME,
vRol VARCHAR(50))
@@ -67542,7 +67697,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `productionSectorList`(vSectorFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `productionSectorList`(vSectorFk INT)
BEGIN
/**
* Devuelve el listado de sale que se puede preparar en previa para ese sector
@@ -67664,7 +67819,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `raidUpdate`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `raidUpdate`()
BEGIN
/**
* Actualiza el travel de las entradas de redadas
@@ -67708,7 +67863,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `rangeDateInfo`(vStarted DATE, vEnded DATE)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `rangeDateInfo`(vStarted DATE, vEnded DATE)
BEGIN
/**
* Crea una tabla temporal con las fechas
@@ -67758,7 +67913,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `rateView`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `rateView`()
BEGIN
/**
* Muestra información sobre tasas de cambio de Dolares
@@ -67809,7 +67964,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `rate_getPrices`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `rate_getPrices`(
vDated DATE,
vWarehouseFk INT
)
@@ -67867,7 +68022,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `recipe_Plaster`(vItemFk INT, vTicketFk INT, vQuantity INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `recipe_Plaster`(vItemFk INT, vTicketFk INT, vQuantity INT)
BEGIN
DECLARE vLastCost DECIMAL(10,2);
@@ -67915,7 +68070,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `remittance_calc`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `remittance_calc`(
vDated DATE
)
BEGIN
@@ -67998,7 +68153,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `reportLabelCollection_get`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `reportLabelCollection_get`(
vParam INT,
vLabelCount INT
)
@@ -68066,7 +68221,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `report_print`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `report_print`(
vReportName VARCHAR(100),
vPrinterFk INT,
vUserFk INT,
@@ -68162,7 +68317,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `routeGuessPriority`(IN vRuta INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `routeGuessPriority`(IN vRuta INT)
BEGIN
/* Usa los valores del ultimo año para adivinar el orden de los tickets en la ruta
* vRuta id ruta
@@ -68195,7 +68350,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `routeInfo`(vRouteFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `routeInfo`(vRouteFk INT)
BEGIN
DECLARE vPackages INT;
@@ -68241,7 +68396,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `routeMonitor_calculate`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `routeMonitor_calculate`(
vDate DATE,
vDaysAgo INT
)
@@ -68368,7 +68523,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `routeSetOk`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `routeSetOk`(
vRouteFk INT)
BEGIN
@@ -68392,7 +68547,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `routeUpdateM3`(vRoute INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `routeUpdateM3`(vRoute INT)
BEGIN
/**
* @deprecated Use vn.route_updateM3()
@@ -68414,7 +68569,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `route_calcCommission`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `route_calcCommission`(
vSelf INT
)
BEGIN
@@ -68521,7 +68676,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `route_doRecalc`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `route_doRecalc`()
proc: BEGIN
/**
* Recalculates modified route.
@@ -68582,7 +68737,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `route_getTickets`(vRouteFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `route_getTickets`(vRouteFk INT)
BEGIN
/**
* Pasado un RouteFk devuelve la información
@@ -68667,7 +68822,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `route_updateM3`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `route_updateM3`(
vSelf INT
)
BEGIN
@@ -68698,7 +68853,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `saleBuy_Add`(vSaleFk INT, vBuyFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `saleBuy_Add`(vSaleFk INT, vBuyFk INT)
BEGIN
/* Añade un registro a la tabla saleBuy en el caso de que sea posible mantener la trazabilidad
@@ -68737,7 +68892,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `saleGroup_add`(vSectorFk INT,vTicketFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `saleGroup_add`(vSectorFk INT,vTicketFk INT)
BEGIN
/**
* Añade un nuevo registro a la tabla y devuelve su id.
@@ -68766,7 +68921,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `saleGroup_setParking`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `saleGroup_setParking`(
vSaleGroupFk VARCHAR(8),
vParkingFk INT
)
@@ -68799,7 +68954,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `saleMistake_Add`(vSaleFk INT, vUserFk INT, vTypeFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `saleMistake_Add`(vSaleFk INT, vUserFk INT, vTypeFk INT)
BEGIN
INSERT INTO vn.saleMistake(saleFk, userFk, typeFk)
@@ -68821,7 +68976,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `salePreparingList`(IN vTicketFk BIGINT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `salePreparingList`(IN vTicketFk BIGINT)
BEGIN
/**
* Devuelve un listado con las lineas de vn.sale y los distintos estados de prepacion
@@ -68880,7 +69035,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `saleSplit`(vSaleFk INT, vQuantity INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `saleSplit`(vSaleFk INT, vQuantity INT)
BEGIN
@@ -68928,60 +69083,6 @@ DELIMITER ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
-/*!50003 DROP PROCEDURE IF EXISTS `sales_merge` */;
-/*!50003 SET @saved_cs_client = @@character_set_client */ ;
-/*!50003 SET @saved_cs_results = @@character_set_results */ ;
-/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb4 */ ;
-/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
-DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `sales_merge`(vTicketFk INT)
-BEGIN
- DECLARE EXIT HANDLER FOR SQLEXCEPTION
- BEGIN
- ROLLBACK;
- RESIGNAL;
- END;
-
- CREATE OR REPLACE TEMPORARY TABLE tSalesToPreserve
- (PRIMARY KEY (id))
- ENGINE = MEMORY
- SELECT s.id, s.itemFk, SUM(s.quantity) newQuantity
- FROM sale s
- JOIN item i ON i.id = s.itemFk
- JOIN itemType it ON it.id = i.typeFk
- WHERE s.ticketFk = vTicketFk
- AND it.isMergeable
- GROUP BY s.itemFk, s.price, s.discount;
-
- START TRANSACTION;
-
- UPDATE sale s
- JOIN tSalesToPreserve stp ON stp.id = s.id
- SET s.quantity = newQuantity
- WHERE s.ticketFk = vTicketFk;
-
- DELETE s.*
- FROM sale s
- LEFT JOIN tSalesToPreserve stp ON stp.id = s.id
- JOIN item i ON i.id = s.itemFk
- JOIN itemType it ON it.id = i.typeFk
- WHERE s.ticketFk = vTicketFk
- AND stp.id IS NULL
- AND it.isMergeable;
-
- COMMIT;
-
- DROP TEMPORARY TABLE tSalesToPreserve;
-END ;;
-DELIMITER ;
-/*!50003 SET sql_mode = @saved_sql_mode */ ;
-/*!50003 SET character_set_client = @saved_cs_client */ ;
-/*!50003 SET character_set_results = @saved_cs_results */ ;
-/*!50003 SET collation_connection = @saved_col_connection */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sales_mergeByCollection` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -68990,7 +69091,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `sales_mergeByCollection`(vCollectionFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `sales_mergeByCollection`(vCollectionFk INT)
BEGIN
DECLARE vDone BOOL;
@@ -69017,7 +69118,7 @@ BEGIN
LEAVE myLoop;
END IF;
- CALL vn.sales_merge(vTicketFk);
+ CALL ticket_mergeSales(vTicketFk);
END LOOP;
@@ -69039,7 +69140,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `saleTracking_add`(vSaleGroupFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `saleTracking_add`(vSaleGroupFk INT)
BEGIN
/** Inserta en vn.saleTracking las lineas de una previa
*
@@ -69074,7 +69175,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `saleTracking_addPreparedSaleGroup`(vSaleGroupFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `saleTracking_addPreparedSaleGroup`(vSaleGroupFk INT)
BEGIN
/**
* Inserta lineas de vn.saleTracking para un saleGroup (previa) que escanea un sacador
@@ -69102,7 +69203,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `saleTracking_addPrevOK`(vSectorCollectionFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `saleTracking_addPrevOK`(vSectorCollectionFk INT)
BEGIN
/**
* Inserta los registros de la colección de sector con el estado PREVIA OK
@@ -69140,7 +69241,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `saleTracking_del`(vSaleFk INT, vState VARCHAR(50))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `saleTracking_del`(vSaleFk INT, vState VARCHAR(50))
BEGIN
DELETE FROM itemShelvingSale
@@ -69168,7 +69269,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `saleTracking_new`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `saleTracking_new`(
vSaleFK INT,
vIsChecked BOOLEAN,
vOriginalQuantity INT,
@@ -69219,7 +69320,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `saleTracking_updateIsChecked`(vSaleFK INT, vIsChecked BOOL, vIsScanned BOOL)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `saleTracking_updateIsChecked`(vSaleFK INT, vIsChecked BOOL, vIsScanned BOOL)
BEGIN
/**
@@ -69260,7 +69361,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_boxPickingPrint`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `sale_boxPickingPrint`(
IN vPrinterFk INT,
IN vSaleFk INT,
IN vPacking INT,
@@ -69420,7 +69521,10 @@ w1: WHILE vQuantity >= vPacking DO
UPDATE sale SET quantity = quantity - vPacking WHERE id = vSaleFk;
- UPDATE itemShelving SET visible = visible - vPacking WHERE id = vItemShelvingFk;
+ UPDATE itemShelving
+ SET visible = visible - vPacking,
+ available = available - vPacking
+ WHERE id = vItemShelvingFk;
SET vNewSaleFk = NULL;
@@ -69549,16 +69653,16 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sale_calculateComponent` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_calculateComponent`(vSelf INT, vOption VARCHAR(25))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `sale_calculateComponent`(vSelf INT, vOption VARCHAR(25))
proc: BEGIN
/**
* Crea tabla temporal para vn.sale_recalcComponent() para recalcular los componentes
@@ -69590,7 +69694,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_getBoxPickingList`(vSectorFk INT, vDated DATE)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `sale_getBoxPickingList`(vSectorFk INT, vDated DATE)
BEGIN
/**
* Returns a suitable boxPicking sales list
@@ -69679,7 +69783,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_getFromTicketOrCollection`(vParam INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `sale_getFromTicketOrCollection`(vParam INT)
BEGIN
/**
* Visualizar lineas de la tabla sale a través del parámetro vParam que puede
@@ -69809,42 +69913,36 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_getProblems`(IN vIsTodayRelative tinyint(1))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `sale_getProblems`(
+ vIsTodayRelative tinyint(1)
+)
BEGIN
/**
* Calcula los problemas de cada venta para un conjunto de tickets.
*
* @param vIsTodayRelative Indica si se calcula el disponible como si todo saliera hoy
- * @table tmp.sale_getProblems(ticketFk, clientFk, warehouseFk, shipped) Identificadores de los tickets a calcular
+ * @table tmp.sale_getProblems(ticketFk, clientFk, warehouseFk, shipped) Tickets a calcular
* @return tmp.sale_problems
*/
- DECLARE vWarehouseFk INT;
+ DECLARE vWarehouseFk INT;
DECLARE vDate DATE;
- DECLARE vAvailableCache INT;
+ DECLARE vAvailableCache INT;
DECLARE vVisibleCache INT;
DECLARE vDone BOOL;
- DECLARE vRequiredComponent INT;
-
- DECLARE vCursor CURSOR FOR
- SELECT DISTINCT tt.warehouseFk, IF(vIsTodayRelative, util.VN_CURDATE(), DATE(tt.shipped))
- FROM tmp.sale_getProblems tt
- WHERE DATE(tt.shipped) BETWEEN util.VN_CURDATE()
- AND util.VN_CURDATE() + INTERVAL IF(vIsTodayRelative, 9.9, 1.9) DAY;
+ DECLARE vCursor CURSOR FOR
+ SELECT DISTINCT warehouseFk, IF(vIsTodayRelative, util.VN_CURDATE(), DATE(shipped))
+ FROM tmp.sale_getProblems
+ WHERE shipped BETWEEN util.VN_CURDATE()
+ AND util.dayEnd(util.VN_CURDATE() + INTERVAL IF(vIsTodayRelative, 9.9, 1.9) DAY);
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
- DELETE tt.*
- FROM tmp.sale_getProblems tt
- JOIN ticketObservation tto ON tto.ticketFk = tt.ticketFk
- JOIN observationType ot ON ot.id = tto.observationTypeFk
- WHERE ot.code = 'administrative'
- AND tto.description = 'Miriam';
-
CREATE OR REPLACE TEMPORARY TABLE tmp.sale_problems (
ticketFk INT(11),
saleFk INT(11),
isFreezed INTEGER(1) DEFAULT 0,
risk DECIMAL(10,1) DEFAULT 0,
+ hasRisk TINYINT(1) DEFAULT 0,
hasHighRisk TINYINT(1) DEFAULT 0,
hasTicketRequest INTEGER(1) DEFAULT 0,
itemShortage VARCHAR(255),
@@ -69858,105 +69956,43 @@ BEGIN
PRIMARY KEY (ticketFk, saleFk)
) ENGINE = MEMORY;
- CREATE OR REPLACE TEMPORARY TABLE tmp.ticket_list
- (PRIMARY KEY (ticketFk))
- ENGINE = MEMORY
- SELECT ticketFk, clientFk
- FROM tmp.sale_getProblems;
+ INSERT INTO tmp.sale_problems(ticketFk,
+ saleFk,
+ isFreezed,
+ risk,
+ hasRisk,
+ hasHighRisk,
+ hasTicketRequest,
+ isTaxDataChecked,
+ hasComponentLack,
+ isTooLittle)
+ SELECT sgp.ticketFk,
+ s.id,
+ IF(FIND_IN_SET('isFreezed', t.problem), TRUE, FALSE) isFreezed,
+ t.risk,
+ IF(FIND_IN_SET('hasRisk', t.problem), TRUE, FALSE) hasRisk,
+ IF(FIND_IN_SET('hasHighRisk', t.problem), TRUE, FALSE) hasHighRisk,
+ IF(FIND_IN_SET('hasTicketRequest', t.problem), TRUE, FALSE) hasTicketRequest,
+ IF(FIND_IN_SET('isTaxDataChecked', t.problem), FALSE, TRUE) isTaxDataChecked,
+ IF(FIND_IN_SET('hasComponentLack', s.problem), TRUE, FALSE) hasComponentLack,
+ IF(FIND_IN_SET('isTooLittle', t.problem)
+ AND util.VN_NOW() < (util.VN_CURDATE() + INTERVAL HOUR(zc.`hour`) HOUR) + INTERVAL MINUTE(zc.`hour`) MINUTE,
+ TRUE, FALSE) isTooLittle
+ FROM tmp.sale_getProblems sgp
+ JOIN ticket t ON t.id = sgp.ticketFk
+ LEFT JOIN sale s ON s.ticketFk = t.id
+ LEFT JOIN item i ON i.id = s.itemFk
+ LEFT JOIN zoneClosure zc ON zc.zoneFk = t.zoneFk
+ AND zc.dated = util.VN_CURDATE()
+ WHERE s.problem <> '' OR t.problem <> '' OR t.risk
+ GROUP BY t.id, s.id;
- SELECT COUNT(*) INTO vRequiredComponent
- FROM component
- WHERE isRequired;
-
- -- Too Little
- INSERT INTO tmp.sale_problems(ticketFk, isTooLittle)
- SELECT tp.ticketFk, TRUE
- FROM tmp.sale_getProblems tp
- JOIN ticket t ON t.id = tp.ticketFk
- JOIN (
- SELECT t.addressFk,
- SUM(ROUND(`ic`.`cm3delivery` * `s`.`quantity` / 1000, 0)) litros,
- t.totalWithoutVat
- FROM tmp.ticket_list tl
- JOIN ticket t ON t.id = tl.ticketFk
- JOIN sale s ON s.ticketFk = t.id
- AND s.quantity > 0
- JOIN itemCost ic ON ic.itemFk = s.itemFk
- AND ic.warehouseFk = t.warehouseFk
- JOIN zoneClosure zc ON zc.zoneFk = t.zoneFk
- AND zc.dated = util.VN_CURDATE()
- JOIN agencyMode am ON am.id = t.agencyModeFk
- JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk
- WHERE util.VN_NOW() < (util.VN_CURDATE() + INTERVAL HOUR(zc.`hour`) HOUR) + INTERVAL MINUTE(zc.`hour`) MINUTE
- AND dm.code IN ('AGENCY','DELIVERY','PICKUP')
- AND t.shipped BETWEEN util.VN_CURDATE() AND util.midnight()
- GROUP BY t.addressFk
- ) sub ON sub.addressFk = t.addressFk
- JOIN volumeConfig vc
- WHERE sub.litros < vc.minTicketVolume
- AND sub.totalWithoutVat < vc.minTicketValue;
-
- -- VIP
INSERT INTO tmp.sale_problems(ticketFk, isVip)
- SELECT DISTINCT tl.ticketFk, TRUE
- FROM tmp.ticket_list tl
- JOIN client c ON c.id = tl.clientFk
+ SELECT sgp.ticketFk, TRUE
+ FROM tmp.sale_getProblems sgp
+ JOIN client c ON c.id = sgp.clientFk
WHERE c.businessTypeFk = 'VIP'
- ON DUPLICATE KEY UPDATE isVip = TRUE;
-
- -- Faltan componentes
- INSERT INTO tmp.sale_problems(ticketFk, hasComponentLack, saleFk)
- SELECT t.id, COUNT(c.id) < vRequiredComponent hasComponentLack, s.id
- FROM tmp.ticket_list tl
- JOIN ticket t ON t.id = tl.ticketFk
- JOIN sale s ON s.ticketFk = t.id
- JOIN agencyMode am ON am.id = t.agencyModeFk
- JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk
- LEFT JOIN saleComponent sc ON sc.saleFk = s.id
- LEFT JOIN component c ON c.id = sc.componentFk
- AND c.isRequired
- WHERE dm.code IN ('AGENCY','DELIVERY','PICKUP')
- AND s.quantity > 0
- GROUP BY s.id
- HAVING hasComponentLack;
-
- -- Cliente congelado
- INSERT INTO tmp.sale_problems(ticketFk, isFreezed)
- SELECT DISTINCT tl.ticketFk, TRUE
- FROM tmp.ticket_list tl
- JOIN client c ON c.id = tl.clientFk
- WHERE c.isFreezed
- ON DUPLICATE KEY UPDATE isFreezed = c.isFreezed;
-
- -- Credit exceeded
- CREATE OR REPLACE TEMPORARY TABLE tmp.clientGetDebt
- (PRIMARY KEY (clientFk))
- ENGINE = MEMORY
- SELECT DISTINCT clientFk
- FROM tmp.ticket_list;
-
- CALL client_getDebt(util.VN_CURDATE());
-
- INSERT INTO tmp.sale_problems(ticketFk, risk, hasHighRisk)
- SELECT DISTINCT tl.ticketFk, r.risk, ((r.risk - cc.riskTolerance) > c.credit + 10)
- FROM tmp.ticket_list tl
- JOIN ticket t ON t.id = tl.ticketFk
- JOIN agencyMode a ON t.agencyModeFk = a.id
- JOIN tmp.risk r ON r.clientFk = t.clientFk
- JOIN client c ON c.id = t.clientFk
- JOIN clientConfig cc
- WHERE r.risk > c.credit + 10
- AND NOT a.isRiskFree
- ON DUPLICATE KEY UPDATE
- risk = r.risk, hasHighRisk = ((r.risk - cc.riskTolerance) > c.credit + 10);
-
- -- Antiguo COD 100, son peticiones de compra sin terminar
- INSERT INTO tmp.sale_problems(ticketFk, hasTicketRequest)
- SELECT DISTINCT tl.ticketFk, TRUE
- FROM tmp.ticket_list tl
- JOIN ticketRequest tr ON tr.ticketFk = tl.ticketFk
- WHERE tr.isOK IS NULL
- ON DUPLICATE KEY UPDATE hasTicketRequest = TRUE;
+ ON DUPLICATE KEY UPDATE isVIP = TRUE;
CREATE OR REPLACE TEMPORARY TABLE tItemShelvingStock_byWarehouse
(INDEX (itemFk, warehouseFk))
@@ -69968,10 +70004,9 @@ BEGIN
JOIN shelving sh ON sh.code = ish.shelvingFk
JOIN parking p ON p.id = sh.parkingFk
JOIN sector s ON s.id = p.sectorFk
- GROUP BY ish.itemFk,
- s.warehouseFk;
+ GROUP BY ish.itemFk, s.warehouseFk;
- -- Disponible, Faltas, Inventario y Retrasos
+ -- Disponible, faltas, inventario y retrasos
OPEN vCursor;
l: LOOP
SET vDone = FALSE;
@@ -69990,14 +70025,14 @@ BEGIN
INSERT INTO tmp.sale_problems(ticketFk, itemShortage, saleFk)
SELECT ticketFk, problem, saleFk
FROM (
- SELECT tl.ticketFk,
- LEFT(CONCAT('F: ',GROUP_CONCAT(i.id, ' ', i.longName, ' ')),250) problem,
- s.id AS saleFk
- FROM tmp.ticket_list tl
- JOIN ticket t ON t.id = tl.ticketFk
+ SELECT sgp.ticketFk,
+ LEFT(CONCAT('F: ', GROUP_CONCAT(i.id, ' ', i.longName, ' ')), 250) problem,
+ s.id saleFk
+ FROM tmp.sale_getProblems sgp
+ JOIN ticket t ON t.id = sgp.ticketFk
JOIN sale s ON s.ticketFk = t.id
JOIN item i ON i.id = s.itemFk
- JOIN itemType it on it.id = i.typeFk
+ JOIN itemType it ON it.id = i.typeFk
JOIN itemCategory ic ON ic.id = it.categoryFk
LEFT JOIN cache.visible v ON v.item_id = i.id
AND v.calc_id = vVisibleCache
@@ -70005,8 +70040,8 @@ BEGIN
AND av.calc_id = vAvailableCache
LEFT JOIN tItemShelvingStock_byWarehouse issw ON issw.itemFk = i.id
AND issw.warehouseFk = t.warehouseFk
- WHERE IFNULL(v.visible,0) < s.quantity
- AND IFNULL(av.available ,0) < s.quantity
+ WHERE IFNULL(v.visible, 0) < s.quantity
+ AND IFNULL(av.available, 0) < s.quantity
AND IFNULL(issw.visible, 0) < s.quantity
AND NOT s.isPicked
AND NOT s.reserved
@@ -70015,27 +70050,27 @@ BEGIN
AND NOT i.generic
AND util.VN_CURDATE() = vDate
AND t.warehouseFk = vWarehouseFk
- GROUP BY tl.ticketFk) sub
+ GROUP BY sgp.ticketFk) sub
ON DUPLICATE KEY UPDATE itemShortage = sub.problem, saleFk = sub.saleFk;
-- Inventario: Visible suficiente, pero ubicado menor a la cantidad vendida
INSERT INTO tmp.sale_problems(ticketFk, itemLost, saleFk)
SELECT ticketFk, problem, saleFk
FROM (
- SELECT tl.ticketFk,
+ SELECT sgp.ticketFk,
LEFT(GROUP_CONCAT('I: ', i.id, ' ', i.longName, ' '), 250) problem,
s.id saleFk
- FROM tmp.ticket_list tl
- JOIN ticket t ON t.id = tl.ticketFk
+ FROM tmp.sale_getProblems sgp
+ JOIN ticket t ON t.id = sgp.ticketFk
JOIN sale s ON s.ticketFk = t.id
JOIN item i ON i.id = s.itemFk
- JOIN itemType it on it.id = i.typeFk
+ JOIN itemType it ON it.id = i.typeFk
JOIN itemCategory ic ON ic.id = it.categoryFk
LEFT JOIN cache.visible v ON v.item_id = s.itemFk
AND v.calc_id = vVisibleCache
LEFT JOIN tItemShelvingStock_byWarehouse issw ON issw.itemFk = i.id
AND issw.warehouseFk = t.warehouseFk
- WHERE IFNULL(v.visible,0) >= s.quantity
+ WHERE IFNULL(v.visible, 0) >= s.quantity
AND IFNULL(issw.visible, 0) < s.quantity
AND s.quantity > 0
AND NOT s.isPicked
@@ -70045,22 +70080,22 @@ BEGIN
AND NOT i.generic
AND util.VN_CURDATE() = vDate
AND t.warehouseFk = vWarehouseFk
- GROUP BY tl.ticketFk
+ GROUP BY sgp.ticketFk
) sub
- ON DUPLICATE KEY UPDATE itemDelay = sub.problem, saleFk = sub.saleFk;
+ ON DUPLICATE KEY UPDATE itemLost = sub.problem, saleFk = sub.saleFk;
-- Retraso: Disponible suficiente, pero no visible ni ubicado
INSERT INTO tmp.sale_problems(ticketFk, itemDelay, saleFk)
SELECT ticketFk, problem, saleFk
FROM (
- SELECT tl.ticketFk,
+ SELECT sgp.ticketFk,
LEFT(GROUP_CONCAT('R: ', i.id, ' ', i.longName, ' '), 250) problem,
s.id saleFk
- FROM tmp.ticket_list tl
- JOIN ticket t ON t.id = tl.ticketFk
+ FROM tmp.sale_getProblems sgp
+ JOIN ticket t ON t.id = sgp.ticketFk
JOIN sale s ON s.ticketFk = t.id
JOIN item i ON i.id = s.itemFk
- JOIN itemType it on it.id = i.typeFk
+ JOIN itemType it ON it.id = i.typeFk
JOIN itemCategory ic ON ic.id = it.categoryFk
LEFT JOIN cache.visible v ON v.item_id = s.itemFk
AND v.calc_id = vVisibleCache
@@ -70079,43 +70114,35 @@ BEGIN
AND NOT i.generic
AND util.VN_CURDATE() = vDate
AND t.warehouseFk = vWarehouseFk
- GROUP BY tl.ticketFk
+ GROUP BY sgp.ticketFk
) sub
ON DUPLICATE KEY UPDATE itemDelay = sub.problem, saleFk = sub.saleFk;
- -- Redondeo: Cantidad pedida incorrecta en al grouping de la última compra
+ -- Redondeo: cantidad incorrecta con respecto al grouping
CALL buy_getUltimate(NULL, vWarehouseFk, vDate);
INSERT INTO tmp.sale_problems(ticketFk, hasRounding, saleFk)
- SELECT ticketFk, problem ,saleFk
+ SELECT ticketFk, problem, saleFk
FROM (
- SELECT tl.ticketFk,
+ SELECT sgp.ticketFk,
s.id saleFk,
LEFT(GROUP_CONCAT('RE: ',i.id, ' ', IFNULL(i.longName,'') SEPARATOR ', '), 250) problem
- FROM tmp.ticket_list tl
- JOIN ticket t ON t.id = tl.ticketFk
+ FROM tmp.sale_getProblems sgp
+ JOIN ticket t ON t.id = sgp.ticketFk
AND t.warehouseFk = vWarehouseFk
- JOIN sale s ON s.ticketFk = tl.ticketFk
+ JOIN sale s ON s.ticketFk = sgp.ticketFk
JOIN item i ON i.id = s.itemFk
JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
JOIN buy b ON b.id = bu.buyFk
WHERE MOD(s.quantity, b.`grouping`)
- GROUP BY tl.ticketFk
+ GROUP BY sgp.ticketFk
)sub
ON DUPLICATE KEY UPDATE hasRounding = sub.problem, saleFk = sub.saleFk;
+
+ DROP TEMPORARY TABLE tmp.buyUltimate;
END LOOP;
CLOSE vCursor;
-
- INSERT INTO tmp.sale_problems(ticketFk, isTaxDataChecked)
- SELECT DISTINCT tl.ticketFk, FALSE
- FROM tmp.ticket_list tl
- JOIN client c ON c.id = tl.clientFk
- WHERE NOT c.isTaxDataChecked
- ON DUPLICATE KEY UPDATE isTaxDataChecked = FALSE;
- DROP TEMPORARY TABLE
- tmp.clientGetDebt,
- tmp.ticket_list,
- tItemShelvingStock_byWarehouse;
+ DROP TEMPORARY TABLE tItemShelvingStock_byWarehouse;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -70132,7 +70159,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_getProblemsByTicket`(IN vTicketFk INT, IN vIsTodayRelative TINYINT(1))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `sale_getProblemsByTicket`(IN vTicketFk INT, IN vIsTodayRelative TINYINT(1))
BEGIN
/**
* Calcula los problemas de cada venta
@@ -70140,8 +70167,7 @@ BEGIN
*
* @return Problems result
*/
- DROP TEMPORARY TABLE IF EXISTS tmp.sale_getProblems;
- CREATE TEMPORARY TABLE tmp.sale_getProblems
+ CREATE OR REPLACE TEMPORARY TABLE tmp.sale_getProblems
(INDEX (ticketFk))
ENGINE = MEMORY
SELECT t.id ticketFk, t.clientFk, t.warehouseFk, t.shipped
@@ -70171,7 +70197,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_PriceFix`(vTicketFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `sale_PriceFix`(vTicketFk INT)
BEGIN
DELETE sc.*
@@ -70206,7 +70232,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_recalcComponent`(vOption VARCHAR(25))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `sale_recalcComponent`(vOption VARCHAR(25))
proc: BEGIN
/**
* Este procedimiento recalcula los componentes de un conjunto de sales,
@@ -70334,7 +70360,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_replaceItem`(vSaleFk INT, vNewItemFk INT, vQuantity INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `sale_replaceItem`(vSaleFk INT, vNewItemFk INT, vQuantity INT)
BEGIN
/**
* Añade un nuevo articulo para sustituir a otro, y actualiza la memoria de sustituciones.
@@ -70481,7 +70507,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_setProblem`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `sale_setProblem`(
vProblemCode VARCHAR(25)
)
BEGIN
@@ -70535,7 +70561,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_setProblemComponentLack`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `sale_setProblemComponentLack`(
vSelf INT
)
BEGIN
@@ -70573,7 +70599,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_setProblemComponentLackByComponent`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `sale_setProblemComponentLackByComponent`(
vComponentFk INT
)
BEGIN
@@ -70609,56 +70635,6 @@ DELIMITER ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
-/*!50003 DROP PROCEDURE IF EXISTS `sale_setProblemRounding` */;
-/*!50003 SET @saved_cs_client = @@character_set_client */ ;
-/*!50003 SET @saved_cs_results = @@character_set_results */ ;
-/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb4 */ ;
-/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
-DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_setProblemRounding`(
- vSelf INT
-)
-BEGIN
-/**
- * Update the rounding problem for a sales line
- * @param vSelf Id sale
- */
- DECLARE vItemFk INT;
- DECLARE vWarehouseFk INT;
- DECLARE vShipped DATE;
- DECLARE vQuantity INT;
- DECLARE vIsProblemCalcNeeded BOOL;
-
- SELECT s.itemFk, t.warehouseFk, t.shipped, s.quantity, ticket_isProblemCalcNeeded(t.id)
- INTO vItemFk, vWarehouseFk, vShipped, vQuantity, vIsProblemCalcNeeded
- FROM sale s
- JOIN ticket t ON t.id = s.ticketFk
- WHERE s.id = vSelf;
-
- CALL buy_getUltimate(vItemFk, vWarehouseFk, vShipped);
-
- CREATE OR REPLACE TEMPORARY TABLE tmp.sale
- SELECT vSelf saleFk,
- MOD(vQuantity, b.`grouping`) hasProblem,
- vIsProblemCalcNeeded isProblemCalcNeeded
- FROM tmp.buyUltimate bu
- JOIN buy b ON b.id = bu.buyFk
- WHERE bu.itemFk = vItemFk;
-
- CALL sale_setProblem('hasRounding');
-
- DROP TEMPORARY TABLE tmp.sale;
- DROP TEMPORARY TABLE tmp.buyUltimate;
-END ;;
-DELIMITER ;
-/*!50003 SET sql_mode = @saved_sql_mode */ ;
-/*!50003 SET character_set_client = @saved_cs_client */ ;
-/*!50003 SET character_set_results = @saved_cs_results */ ;
-/*!50003 SET collation_connection = @saved_col_connection */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sectorCollectionSaleGroup_add` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -70667,7 +70643,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `sectorCollectionSaleGroup_add`(vSaleGroupFk INT, vSectorCollectionFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `sectorCollectionSaleGroup_add`(vSaleGroupFk INT, vSectorCollectionFk INT)
BEGIN
/**
* Inserta un nuevo registro en vn.sectorCollectionSaleGroup
@@ -70737,7 +70713,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `sectorCollection_get`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `sectorCollection_get`()
BEGIN
/**
* Devuelve las colecciones del sector que corresponden al usuario conectado, y que estan incompletas
@@ -70772,7 +70748,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `sectorCollection_getMyPartial`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `sectorCollection_getMyPartial`()
BEGIN
/**
* Devuelve las colecciones del sector que corresponden al usuario conectado, y que estan incompletas
@@ -70803,7 +70779,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `sectorCollection_getSale`(vSelf INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `sectorCollection_getSale`(vSelf INT)
BEGIN
/**
* Devuelve las lineas de venta correspondientes a esa coleccion de sector
@@ -70848,7 +70824,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `sectorCollection_new`(vSectorFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `sectorCollection_new`(vSectorFk INT)
BEGIN
/**
* Inserta una nueva colección, si el usuario no tiene ninguna vacia.
@@ -70889,7 +70865,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `sectorProductivity_add`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `sectorProductivity_add`()
BEGIN
DECLARE vDatedFrom DATETIME;
DECLARE vDatedTo DATETIME;
@@ -70976,7 +70952,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `sector_getWarehouse`(vSectorFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `sector_getWarehouse`(vSectorFk INT)
BEGIN
SELECT s.warehouseFk
@@ -70999,7 +70975,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `setParking`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `setParking`(
vParam VARCHAR(8),
vParkingCode VARCHAR(8)
)
@@ -71053,7 +71029,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `shelvingChange`(IN `vShelvingO` VARCHAR(8), IN `vShelvingD` VARCHAR(8))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `shelvingChange`(IN `vShelvingO` VARCHAR(8), IN `vShelvingD` VARCHAR(8))
BEGIN
UPDATE vn.itemShelving
@@ -71077,7 +71053,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `shelvingLog_get`(shelvingFk VARCHAR(10))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `shelvingLog_get`(shelvingFk VARCHAR(10))
BEGIN
/* Lista el log de un carro
@@ -71108,7 +71084,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `shelvingParking_get`(vShelvingFk VARCHAR(10), vWarehouseFk INT, vDayRange INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `shelvingParking_get`(vShelvingFk VARCHAR(10), vWarehouseFk INT, vDayRange INT)
BEGIN
@@ -71144,7 +71120,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `shelvingPriority_update`(priority INT,vShelvingFk VARCHAR(10))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `shelvingPriority_update`(priority INT,vShelvingFk VARCHAR(10))
BEGIN
UPDATE vn.shelving SET priority = priority WHERE code=vShelvingFk COLLATE utf8_unicode_ci;
@@ -71165,7 +71141,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `shelving_clean`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `shelving_clean`()
BEGIN
DELETE FROM shelving
@@ -71215,7 +71191,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `shelving_getSpam`(vDated DATE, vWarehouseFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `shelving_getSpam`(vDated DATE, vWarehouseFk INT)
BEGIN
/**
* Devuelve las matrículas con productos que no son necesarios para la venta
@@ -71312,7 +71288,10 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `shelving_setParking`(IN `vShelvingCode` VARCHAR(8), IN `vParkingFk` INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `shelving_setParking`(
+ `vShelvingCode` VARCHAR(8),
+ `vParkingFk` INT
+)
BEGIN
/**
* Aparca una matrícula en un parking
@@ -71348,7 +71327,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `sleep_X_min`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `sleep_X_min`()
BEGIN
# Ernesto. 4.8.2020
# Para su uso en las tareas ejecutadas a las 2AM (visibles con: SELECT * FROM bs.nightTask order by started asc;)
@@ -71361,16 +71340,16 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `stockBuyedByWorker` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `stockBuyedByWorker`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `stockBuyedByWorker`(
vDated DATE,
vWorker INT
)
@@ -71457,7 +71436,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `stockBuyed_add`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `stockBuyed_add`(
vDated DATE
)
BEGIN
@@ -71540,7 +71519,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `stockTraslation`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `stockTraslation`(
vDated DATE
)
BEGIN
@@ -71594,7 +71573,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `subordinateGetList`(vBossFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `subordinateGetList`(vBossFk INT)
BEGIN
-- deprecated usar vn.worker_GetHierarch
@@ -71657,7 +71636,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `supplierExpenses`(vEnded DATE)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `supplierExpenses`(vEnded DATE)
BEGIN
DROP TEMPORARY TABLE IF EXISTS openingBalance;
@@ -71749,7 +71728,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `supplierPackaging_ReportSource`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `supplierPackaging_ReportSource`(
vFromDated DATE,
vSupplierFk INT
)
@@ -71929,7 +71908,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `supplier_checkBalance`(IN vDateTo DATETIME, IN vIsConciliated BOOL)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `supplier_checkBalance`(IN vDateTo DATETIME, IN vIsConciliated BOOL)
BEGIN
/**
* Compara los datos de nuestros proveedores con
@@ -72016,7 +71995,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `supplier_checkIsActive`(vSelf INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `supplier_checkIsActive`(vSelf INT)
BEGIN
/**
* Comprueba si un proveedor esta activo.
@@ -72046,7 +72025,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `supplier_disablePayMethodChecked`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `supplier_disablePayMethodChecked`()
BEGIN
/*
@@ -72254,16 +72233,16 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `ticketBoxesView` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketBoxesView`(IN vTicketFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticketBoxesView`(IN vTicketFk INT)
BEGIN
SELECT s.id,
@@ -72301,7 +72280,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketBuiltTime`(vDate DATE)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticketBuiltTime`(vDate DATE)
BEGIN
DECLARE vDateStart DATETIME DEFAULT DATE(vDate);
@@ -72352,7 +72331,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCalculateClon`(IN vTicketNew INT, vTicketOld INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticketCalculateClon`(IN vTicketNew INT, vTicketOld INT)
BEGIN
/*
* Recalcula los componentes un ticket clonado,
@@ -72402,7 +72381,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCalculateFromType`( vLanded DATE,
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticketCalculateFromType`( vLanded DATE,
vAddressFk INT,
vAgencyModeFk INT,
vTypeFk INT)
@@ -72433,7 +72412,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCalculatePurge`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticketCalculatePurge`()
BEGIN
DROP TEMPORARY TABLE
tmp.ticketCalculateItem,
@@ -72457,7 +72436,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketClon`(vTicketFk INT, vNewShipped DATE)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticketClon`(vTicketFk INT, vNewShipped DATE)
BEGIN
DECLARE vNewTicketFk INT;
@@ -72480,7 +72459,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketClon_OneYear`(vTicketFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticketClon_OneYear`(vTicketFk INT)
BEGIN
DECLARE vShipped DATE;
@@ -72515,7 +72494,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCollection_get`(vTicketFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticketCollection_get`(vTicketFk INT)
BEGIN
SELECT tc.collectionFk
@@ -72538,7 +72517,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCollection_setUsedShelves`(vTicketFk INT, vUsedShelves INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticketCollection_setUsedShelves`(vTicketFk INT, vUsedShelves INT)
BEGIN
/*
@@ -72559,16 +72538,16 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `ticketComponentUpdate` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketComponentUpdate`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticketComponentUpdate`(
vTicketFk INT,
vClientFk INT,
vAgencyModeFk INT,
@@ -72634,16 +72613,16 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `ticketComponentUpdateSale` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketComponentUpdateSale`(vCode VARCHAR(25))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticketComponentUpdateSale`(vCode VARCHAR(25))
BEGIN
/**
* A partir de la tabla tmp.sale, crea los Movimientos_componentes
@@ -72767,7 +72746,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketDown_PrintableSelection`(vSectorFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticketDown_PrintableSelection`(vSectorFk INT)
BEGIN
UPDATE vn.ticketDown td
@@ -72802,7 +72781,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketGetTaxAdd`(vTicketFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticketGetTaxAdd`(vTicketFk INT)
BEGIN
/**
* Añade un ticket a la tabla tmp.ticket para calcular
@@ -72846,7 +72825,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketGetTax_new`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticketGetTax_new`()
READS SQL DATA
BEGIN
/**
@@ -72925,7 +72904,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketGetTotal`(vTaxArea VARCHAR(25))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticketGetTotal`(vTaxArea VARCHAR(25))
BEGIN
/**
* Calcula el total con IVA para un conjunto de tickets.
@@ -72965,7 +72944,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketGetVisibleAvailable`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticketGetVisibleAvailable`(
vTicket INT)
BEGIN
DECLARE vVisibleCalc INT;
@@ -73014,7 +72993,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketNotInvoicedByClient`(vClientFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticketNotInvoicedByClient`(vClientFk INT)
BEGIN
DROP TEMPORARY TABLE IF EXISTS tmp.ticket;
@@ -73057,7 +73036,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketObservation_addNewBorn`(vTicketFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticketObservation_addNewBorn`(vTicketFk INT)
BEGIN
/**
@@ -73090,7 +73069,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketPackaging_add`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticketPackaging_add`(
vClientFk INT,
vDated DATE,
vCompanyFk INT,
@@ -73244,7 +73223,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketParking_findSkipped`(vTicketFk INT, vItemPackingTypeFk VARCHAR(1))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticketParking_findSkipped`(vTicketFk INT, vItemPackingTypeFk VARCHAR(1))
BEGIN
/**
@@ -73323,7 +73302,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketStateToday_setState`(vTicketFk INT, vStateCode VARCHAR(45))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticketStateToday_setState`(vTicketFk INT, vStateCode VARCHAR(45))
BEGIN
/* Modifica el estado de un ticket de hoy
@@ -73366,7 +73345,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketToInvoiceByAddress`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticketToInvoiceByAddress`(
vStarted DATE,
vEnded DATETIME,
vAddress INT,
@@ -73402,7 +73381,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketToInvoiceByDate`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticketToInvoiceByDate`(
vStarted DATE,
vEnded DATETIME,
vClient INT,
@@ -73438,7 +73417,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketToInvoiceByRef`(IN vInvoiceRef VARCHAR(15))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticketToInvoiceByRef`(IN vInvoiceRef VARCHAR(15))
BEGIN
/* Para tickets ya facturados, vuelve a repetir el proceso de facturación.
@@ -73498,7 +73477,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_add`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_add`(
vClientId INT
,vShipped DATE
,vWarehouseFk INT
@@ -73636,7 +73615,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_administrativeCopy`(vOriginalTicket INT, OUT vNewTicket INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_administrativeCopy`(vOriginalTicket INT, OUT vNewTicket INT)
BEGIN
INSERT INTO vn.ticket(clientFk, addressFk, shipped, warehouseFk, companyFk, landed)
@@ -73668,7 +73647,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_canAdvance`(vDateFuture DATE, vDateToAdvance DATE, vWarehouseFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_canAdvance`(vDateFuture DATE, vDateToAdvance DATE, vWarehouseFk INT)
BEGIN
/**
* Devuelve los tickets y la cantidad de lineas de venta que se pueden adelantar.
@@ -73812,7 +73791,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_canbePostponed`(vOriginDated DATE, vFutureDated DATE, vWarehouseFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_canbePostponed`(vOriginDated DATE, vFutureDated DATE, vWarehouseFk INT)
BEGIN
/**
* Devuelve un listado de tickets susceptibles de fusionarse con otros tickets en el futuro
@@ -73889,16 +73868,16 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `ticket_canMerge` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_canMerge`(vDated DATE, vScopeDays INT, vLitersMax INT, vLinesMax INT, vWarehouseFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_canMerge`(vDated DATE, vScopeDays INT, vLitersMax INT, vLinesMax INT, vWarehouseFk INT)
BEGIN
/**
* Devuelve un listado de tickets susceptibles de fusionarse con otros tickets en el futuro
@@ -73976,7 +73955,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_checkNoComponents`(vShippedFrom DATETIME, vShippedTo DATETIME)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_checkNoComponents`(vShippedFrom DATETIME, vShippedTo DATETIME)
BEGIN
/**
@@ -74035,7 +74014,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_Clone`(vOriginalTicket INT, OUT vNewTicket INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_Clone`(vOriginalTicket INT, OUT vNewTicket INT)
BEGIN
/**
* Clona el contenido de un ticket en otro
@@ -74114,7 +74093,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_cloneAll`(vTicketFk INT, vNewShipped DATE, vWithWarehouse BOOLEAN, OUT vNewTicketFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_cloneAll`(vTicketFk INT, vNewShipped DATE, vWithWarehouse BOOLEAN, OUT vNewTicketFk INT)
BEGIN
DECLARE vDone BOOLEAN DEFAULT FALSE;
@@ -74182,7 +74161,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_cloneWeekly`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_cloneWeekly`(
vDateFrom DATE,
vDateTo DATE
)
@@ -74407,10 +74386,10 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_close`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_close`()
BEGIN
/**
- * Realiza el cierre de todos los
+ * Realiza el cierre de todos los
* tickets de la tabla tmp.ticket_close.
*
* @table tmp.ticket_close(ticketFk) Identificadores de los tickets a cerrar
@@ -74425,10 +74404,11 @@ BEGIN
DECLARE vHasDailyInvoice BOOL;
DECLARE vWithPackage BOOL;
DECLARE vHasToInvoice BOOL;
+ DECLARE vSerial VARCHAR(2);
DECLARE cur CURSOR FOR
SELECT ticketFk FROM tmp.ticket_close;
-
+
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN
RESIGNAL;
@@ -74438,7 +74418,7 @@ BEGIN
proc: LOOP
SET vDone = FALSE;
-
+
FETCH cur INTO vCurTicketFk;
IF vDone THEN
@@ -74455,12 +74435,12 @@ BEGIN
c.hasToInvoice
INTO vClientFk,
vIsTaxDataChecked,
- vCompanyFk,
+ vCompanyFk,
vShipped,
vHasDailyInvoice,
vWithPackage,
vHasToInvoice
- FROM ticket t
+ FROM ticket t
JOIN `client` c ON c.id = t.clientFk
JOIN province p ON p.id = c.provinceFk
LEFT JOIN autonomy a ON a.id = p.autonomyFk
@@ -74470,7 +74450,7 @@ BEGIN
INSERT INTO ticketPackaging (ticketFk, packagingFk, quantity)
(SELECT vCurTicketFk, p.id, COUNT(*)
- FROM expedition e
+ FROM expedition e
JOIN packaging p ON p.id = e.packagingFk
JOIN ticket t ON t.id = e.ticketFk
LEFT JOIN agencyMode am ON am.id = t.agencyModeFk
@@ -74481,26 +74461,29 @@ BEGIN
GROUP BY p.itemFk);
-- No retornables o no catalogados
- INSERT INTO sale (itemFk, ticketFk, concept, quantity, price, isPriceFixed)
+ INSERT INTO sale (itemFk, ticketFk, concept, quantity, price, isPriceFixed)
(SELECT e.freightItemFk, vCurTicketFk, i.name, COUNT(*) AS amount, getSpecialPrice(e.freightItemFk, vClientFk), 1
- FROM expedition e
+ FROM expedition e
JOIN item i ON i.id = e.freightItemFk
LEFT JOIN packaging p ON p.itemFk = i.id
WHERE e.ticketFk = vCurTicketFk AND IFNULL(p.isPackageReturnable, 0) = 0
AND getSpecialPrice(e.freightItemFk, vClientFk) > 0
GROUP BY e.freightItemFk);
-
- IF(vHasDailyInvoice) AND vHasToInvoice THEN
- -- Facturacion rapida
+ IF(vHasDailyInvoice) AND vHasToInvoice THEN
+ SELECT invoiceSerial(vClientFk, vCompanyFk, 'quick') INTO vSerial;
+ IF vSerial IS NULL THEN
+ CALL util.throw('Cannot booking without a serial');
+ END IF;
+
CALL ticket_setState(vCurTicketFk, 'DELIVERED');
- -- Facturar si está contabilizado
+
IF vIsTaxDataChecked THEN
CALL invoiceOut_newFromClient(
- vClientFk,
- (SELECT invoiceSerial(vClientFk, vCompanyFk, 'M')),
- vShipped,
- vCompanyFk,
+ vClientFk,
+ vSerial,
+ vShipped,
+ vCompanyFk,
NULL,
NULL,
vNewInvoiceId);
@@ -74527,7 +74510,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_closeByTicket`(IN vTicketFk int)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_closeByTicket`(IN vTicketFk int)
BEGIN
/**
* Inserta el ticket en la tabla temporal
@@ -74559,16 +74542,16 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `ticket_componentMakeUpdate` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_componentMakeUpdate`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_componentMakeUpdate`(
vTicketFk INT,
vClientFk INT,
vNickname VARCHAR(50),
@@ -74678,7 +74661,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_componentPreview`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_componentPreview`(
vTicketFk INT,
vLanded DATE,
vAddressFk INT,
@@ -74791,7 +74774,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_DelayTruck`(vWarehouserFk INT, vHour INT, vMinute INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_DelayTruck`(vWarehouserFk INT, vHour INT, vMinute INT)
BEGIN
DECLARE done INT DEFAULT FALSE;
DECLARE vTicketFk INT;
@@ -74840,7 +74823,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_DelayTruckSplit`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_DelayTruckSplit`(
vTicketFk INT
)
BEGIN
@@ -74912,7 +74895,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_doCmr`(vSelf INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_doCmr`(vSelf INT)
BEGIN
/**
* Crea u actualiza la información del CMR asociado con
@@ -75007,7 +74990,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getFromFloramondo`(vDateFrom DATE, vDateTo DATE)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_getFromFloramondo`(vDateFrom DATE, vDateTo DATE)
BEGIN
/**
* Genera una tabla con la lista de tickets de Floramondo
@@ -75147,7 +75130,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getMovable`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_getMovable`(
vTicketFk INT,
vNewShipped DATETIME,
vWarehouseFk INT
@@ -75215,7 +75198,9 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getProblems`(IN vIsTodayRelative tinyint(1))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_getProblems`(
+ vIsTodayRelative tinyint(1)
+)
BEGIN
/**
* Calcula los problemas para un conjunto de tickets.
@@ -75232,6 +75217,7 @@ BEGIN
SELECT ticketFk,
MAX(isFreezed) isFreezed,
MAX(risk) risk,
+ MAX(hasRisk) hasRisk,
MAX(hasHighRisk) hasHighRisk,
MAX(hasTicketRequest) hasTicketRequest,
MAX(itemShortage) itemShortage,
@@ -75246,19 +75232,19 @@ BEGIN
FROM tmp.sale_problems
GROUP BY ticketFk;
- UPDATE tmp.ticket_problems tp
- SET tp.totalProblems = (
- (tp.isFreezed) +
- IF(tp.risk,TRUE, FALSE) +
- (tp.hasTicketRequest) +
- (tp.isTaxDataChecked = 0) +
- (tp.hasComponentLack) +
- (tp.itemDelay) +
- (tp.isTooLittle) +
- (tp.itemLost) +
- (tp.hasRounding) +
- (tp.itemShortage) +
- (tp.isVip)
+ UPDATE tmp.ticket_problems
+ SET totalProblems = (
+ (isFreezed) +
+ (hasHighRisk) +
+ (hasTicketRequest) +
+ (!isTaxDataChecked) +
+ (hasComponentLack) +
+ (itemDelay IS NOT NULL) +
+ (isTooLittle) +
+ (itemLost IS NOT NULL) +
+ (hasRounding IS NOT NULL) +
+ (itemShortage IS NOT NULL) +
+ (isVip)
);
DROP TEMPORARY TABLE tmp.sale_problems;
@@ -75278,7 +75264,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getSplitList`(vDated DATE, vHour TIME, vWarehouseFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_getSplitList`(vDated DATE, vHour TIME, vWarehouseFk INT)
BEGIN
/**
* Devuelve un listado con los tickets posibles para splitar HOY.
@@ -75451,7 +75437,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getTax`(IN vTaxArea VARCHAR(25))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_getTax`(IN vTaxArea VARCHAR(25))
BEGIN
/**
* Calcula la base imponible, el IVA y el recargo de equivalencia para
@@ -75567,7 +75553,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getWarnings`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_getWarnings`()
BEGIN
/**
* Calcula las adventencias para un conjunto de tickets.
@@ -75622,7 +75608,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getWithParameters`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_getWithParameters`(
vClientFk INT,
vWarehouseFk INT,
vShipped DATE,
@@ -75684,7 +75670,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_insertZone`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_insertZone`()
BEGIN
DECLARE vDone INT DEFAULT 0;
DECLARE vFechedTicket INT;
@@ -75719,6 +75705,62 @@ DELIMITER ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `ticket_mergeSales` */;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
+DELIMITER ;;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_mergeSales`(
+ vSelf INT
+)
+BEGIN
+ DECLARE EXIT HANDLER FOR SQLEXCEPTION
+ BEGIN
+ ROLLBACK;
+ RESIGNAL;
+ END;
+
+ CREATE OR REPLACE TEMPORARY TABLE tSalesToPreserve
+ (PRIMARY KEY (id))
+ ENGINE = MEMORY
+ SELECT s.id, s.itemFk, SUM(s.quantity) newQuantity
+ FROM sale s
+ JOIN item i ON i.id = s.itemFk
+ JOIN itemType it ON it.id = i.typeFk
+ WHERE s.ticketFk = vSelf
+ AND it.isMergeable
+ GROUP BY s.itemFk, s.price, s.discount;
+
+ START TRANSACTION;
+
+ UPDATE sale s
+ JOIN tSalesToPreserve stp ON stp.id = s.id
+ SET s.quantity = newQuantity
+ WHERE s.ticketFk = vSelf;
+
+ DELETE s.*
+ FROM sale s
+ LEFT JOIN tSalesToPreserve stp ON stp.id = s.id
+ JOIN item i ON i.id = s.itemFk
+ JOIN itemType it ON it.id = i.typeFk
+ WHERE s.ticketFk = vSelf
+ AND stp.id IS NULL
+ AND it.isMergeable;
+
+ COMMIT;
+
+ DROP TEMPORARY TABLE tSalesToPreserve;
+END ;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `ticket_priceDifference` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -75727,7 +75769,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_priceDifference`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_priceDifference`(
vTicketFk INT,
vLanded DATE,
vAddressFk INT,
@@ -75784,7 +75826,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_printLabelPrevious`(vTicketFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_printLabelPrevious`(vTicketFk INT)
BEGIN
/**
* Calls the report_print procedure and passes it
@@ -75830,7 +75872,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_recalc`(vSelf INT, vTaxArea VARCHAR(25))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_recalc`(vSelf INT, vTaxArea VARCHAR(25))
proc:BEGIN
/**
* Calcula y guarda el total con/sin IVA en un ticket.
@@ -75880,7 +75922,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_recalcByScope`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_recalcByScope`(
vScope VARCHAR(255),
vId INT
)
@@ -75895,16 +75937,28 @@ BEGIN
DECLARE vTicketFk INT;
DECLARE cTickets CURSOR FOR
- SELECT id FROM ticket
- WHERE refFk IS NULL
- AND ((vScope = 'client' AND clientFk = vId)
- OR (vScope = 'address' AND addressFk = vId));
+ SELECT DISTINCT t.id
+ FROM ticket t
+ LEFT JOIN tItems ti ON ti.id = t.id
+ WHERE t.refFk IS NULL
+ AND ((vScope = 'client' AND t.clientFk = vId)
+ OR (vScope = 'address' AND t.addressFk = vId)
+ OR (vScope = 'item' AND ti.id)
+ );
- DECLARE CONTINUE HANDLER FOR NOT FOUND
- SET vDone = TRUE;
+ DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
+
+ CREATE OR REPLACE TEMPORARY TABLE tItems
+ (PRIMARY KEY (id))
+ ENGINE = MEMORY
+ SELECT DISTINCT t.id
+ FROM ticket t
+ JOIN sale s ON s.ticketFk = t.id
+ JOIN itemTaxCountry itc ON itc.itemFk = s.itemFk
+ WHERE t.refFk IS NULL
+ AND (vScope = 'item' AND itc.itemFk = vId);
OPEN cTickets;
-
myLoop: LOOP
SET vDone = FALSE;
FETCH cTickets INTO vTicketFk;
@@ -75915,8 +75969,9 @@ BEGIN
CALL ticket_recalc(vTicketFk, NULL);
END LOOP;
-
CLOSE cTickets;
+
+ DROP TEMPORARY TABLE tItems;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -75924,16 +75979,16 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `ticket_recalcComponents` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_recalcComponents`(vSelf INT, vOption VARCHAR(25))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_recalcComponents`(vSelf INT, vOption VARCHAR(25))
proc: BEGIN
/**
@@ -75967,7 +76022,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_setNextState`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_setNextState`(
vSelf INT
)
BEGIN
@@ -76014,7 +76069,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_setParking`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_setParking`(
vSelf INT,
vParkingFk INT
)
@@ -76063,16 +76118,16 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `ticket_setPreviousState` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_setPreviousState`(vTicketFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_setPreviousState`(vTicketFk INT)
BEGIN
DECLARE vControlFk INT;
@@ -76117,7 +76172,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_setProblem`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_setProblem`(
vProblemCode VARCHAR(25)
)
BEGIN
@@ -76171,7 +76226,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_setProblemFreeze`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_setProblemFreeze`(
vClientFk INT
)
BEGIN
@@ -76215,7 +76270,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_setProblemRequest`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_setProblemRequest`(
vSelf INT
)
BEGIN
@@ -76258,7 +76313,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_setProblemRisk`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_setProblemRisk`(
vSelf INT
)
BEGIN
@@ -76353,56 +76408,6 @@ DELIMITER ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
-/*!50003 DROP PROCEDURE IF EXISTS `ticket_setProblemRounding` */;
-/*!50003 SET @saved_cs_client = @@character_set_client */ ;
-/*!50003 SET @saved_cs_results = @@character_set_results */ ;
-/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb4 */ ;
-/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
-DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_setProblemRounding`(
- vSelf INT
-)
-BEGIN
-/**
- * Update the rounding problem for the sales lines of a ticket
- *
- * @param vSelf Id de ticket
- */
- DECLARE vWarehouseFk INT;
- DECLARE vDated DATE;
-
- SELECT warehouseFk, shipped
- INTO vWarehouseFk, vDated
- FROM ticket
- WHERE id = vSelf;
-
- CALL buy_getUltimate(NULL, vWarehouseFk, vDated);
-
- CREATE OR REPLACE TEMPORARY TABLE tmp.sale
- (INDEX(saleFk, isProblemCalcNeeded))
- SELECT s.id saleFk ,
- MOD(s.quantity, b.`grouping`) hasProblem,
- ticket_isProblemCalcNeeded(t.id) isProblemCalcNeeded
- FROM ticket t
- JOIN sale s ON s.ticketFk = t.id
- JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
- JOIN buy b ON b.id = bu.buyFk
- WHERE t.id = vSelf;
-
- CALL sale_setProblem('hasRounding');
-
- DROP TEMPORARY TABLE tmp.sale;
- DROP TEMPORARY TABLE tmp.buyUltimate;
-END ;;
-DELIMITER ;
-/*!50003 SET sql_mode = @saved_sql_mode */ ;
-/*!50003 SET character_set_client = @saved_cs_client */ ;
-/*!50003 SET character_set_results = @saved_cs_results */ ;
-/*!50003 SET collation_connection = @saved_col_connection */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `ticket_setProblemTaxDataChecked` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -76411,7 +76416,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_setProblemTaxDataChecked`(vClientFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_setProblemTaxDataChecked`(vClientFk INT)
BEGIN
/**
* Update the problem of tickets, depending on whether
@@ -76449,7 +76454,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_setProblemTooLittle`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_setProblemTooLittle`(
vSelf INT
)
BEGIN
@@ -76458,18 +76463,28 @@ BEGIN
*
* @param vSelf Id del ticket
*/
-
+ DECLARE vTicketIsTooLittle BOOL;
+
+ SELECT ticket_isTooLittle(vSelf) INTO vTicketIsTooLittle;
+
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
(INDEX(ticketFk, isProblemCalcNeeded))
ENGINE = MEMORY
- SELECT vSelf ticketFk,
- ticket_isTooLittle(vSelf) hasProblem,
- ticket_isProblemCalcNeeded(vSelf) isProblemCalcNeeded;
-
+ WITH ticketData AS (
+ SELECT addressFk, DATE(shipped) dated
+ FROM vn.ticket
+ WHERE id = vSelf
+ )
+ SELECT t.id ticketFk,
+ vTicketIsTooLittle hasProblem,
+ ticket_isProblemCalcNeeded(t.id) isProblemCalcNeeded
+ FROM vn.ticket t
+ JOIN ticketData td ON td.addressFk = t.addressFk
+ WHERE t.shipped BETWEEN td.dated AND util.dayEnd(td.dated);
+
CALL ticket_setProblem('isTooLittle');
DROP TEMPORARY TABLE tmp.ticket;
-
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -76486,7 +76501,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_setProblemTooLittleItemCost`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_setProblemTooLittleItemCost`(
vItemFk INT
)
BEGIN
@@ -76530,7 +76545,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_setRisk`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_setRisk`(
vClientFk INT
)
BEGIN
@@ -76626,7 +76641,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_setState`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_setState`(
vSelf INT,
vStateCode VARCHAR(255) COLLATE utf8_general_ci
)
@@ -76687,6 +76702,95 @@ DELIMITER ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `ticket_setVolume` */;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
+DELIMITER ;;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_setVolume`(
+ vSelf INT
+)
+BEGIN
+/**
+ * Update the volume ticket.
+ *
+ * @param vSelf Ticket id
+ */
+ DECLARE vVolume DECIMAL(10,6);
+
+ SELECT SUM(s.quantity * ic.cm3delivery / 1000000) INTO vVolume
+ FROM sale s
+ JOIN ticket t ON t.id = s.ticketFk
+ JOIN itemCost ic ON ic.itemFk = s.itemFk
+ AND ic.warehouseFk = t.warehouseFk
+ WHERE t.id = vSelf;
+
+ UPDATE ticket
+ SET volume = vVolume
+ WHERE id = vSelf;
+END ;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `ticket_setVolumeItemCost` */;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
+DELIMITER ;;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_setVolumeItemCost`(
+ vItemFk INT
+)
+BEGIN
+/**
+ * Update the volume of tickets containing the item.
+ *
+ * @param vItemFk Item id
+ */
+ DECLARE vTicket INT;
+ DECLARE vDone BOOL;
+
+ DECLARE vTickets CURSOR FOR
+ SELECT DISTINCT t.id
+ FROM sale s
+ JOIN ticket t ON t.id = s.ticketFk
+ JOIN itemCost ic ON ic.itemFk = s.itemFk
+ AND ic.warehouseFk = t.warehouseFk
+ WHERE s.itemFk = vItemFk
+ AND t.shipped >= util.VN_CURDATE()
+ AND t.refFk IS NULL;
+
+ DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
+
+ OPEN vTickets;
+ l: LOOP
+ FETCH vTickets INTO vTicket;
+
+ IF vDone THEN
+ LEAVE l;
+ END IF;
+
+ CALL ticket_setVolume(vTicket);
+
+ END LOOP l;
+ CLOSE vTickets;
+END ;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `ticket_split` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -76695,7 +76799,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_split`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_split`(
vTicketFk INT,
vTicketFutureFk INT,
vDated DATE
@@ -76784,7 +76888,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_splitItemPackingType`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_splitItemPackingType`(
vSelf INT,
vOriginalItemPackingTypeFk VARCHAR(1)
)
@@ -76801,8 +76905,6 @@ BEGIN
DECLARE vNewTicketFk INT;
DECLARE vPackingTypesToSplit INT;
DECLARE vDone INT DEFAULT FALSE;
- DECLARE vErrorNumber INT;
- DECLARE vErrorMsg TEXT;
DECLARE vSaleGroup CURSOR FOR
SELECT itemPackingTypeFk
@@ -76812,21 +76914,6 @@ BEGIN
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
- DECLARE EXIT HANDLER FOR SQLEXCEPTION
- BEGIN
- GET DIAGNOSTICS CONDITION 1
- vErrorNumber = MYSQL_ERRNO,
- vErrorMsg = MESSAGE_TEXT;
-
- CALL util.debugAdd('ticket_splitItemPackingType', JSON_OBJECT(
- 'errorNumber', vErrorNumber,
- 'errorMsg', vErrorMsg,
- 'ticketFk', vSelf
- )); -- Tmp
- ROLLBACK;
- RESIGNAL;
- END;
-
START TRANSACTION;
SELECT id
@@ -76940,7 +77027,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_splitPackingComplete`(vTicketFk INT, vSectorFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_splitPackingComplete`(vTicketFk INT, vSectorFk INT)
BEGIN
DECLARE vNeedToSplit BOOLEAN;
@@ -76995,7 +77082,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_WeightDeclaration`(vClientFk INT, vDated DATE)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `ticket_WeightDeclaration`(vClientFk INT, vDated DATE)
BEGIN
DECLARE vTheorycalWeight DECIMAL(10,2);
@@ -77058,7 +77145,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `till_new`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `till_new`(
vClient INT,
vBank INT,
vAmount DOUBLE,
@@ -77144,7 +77231,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `timeBusiness_calculate`(vDatedFrom DATETIME, vDatedTo DATETIME)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `timeBusiness_calculate`(vDatedFrom DATETIME, vDatedTo DATETIME)
BEGIN
/**
* Horas que debe trabajar un empleado según contrato y día.
@@ -77242,7 +77329,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `timeBusiness_calculateAll`(vDatedFrom DATETIME, vDatedTo DATETIME)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `timeBusiness_calculateAll`(vDatedFrom DATETIME, vDatedTo DATETIME)
BEGIN
/**
@@ -77274,7 +77361,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `timeBusiness_calculateByDepartment`(vDepartmentFk INT, vDatedFrom DATETIME, vDatedTo DATETIME)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `timeBusiness_calculateByDepartment`(vDepartmentFk INT, vDatedFrom DATETIME, vDatedTo DATETIME)
BEGIN
/**
* @param vDepartmentFk
@@ -77312,7 +77399,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `timeBusiness_calculateByUser`(vUserFk INT, vDatedFrom DATETIME, vDatedTo DATETIME)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `timeBusiness_calculateByUser`(vUserFk INT, vDatedFrom DATETIME, vDatedTo DATETIME)
BEGIN
/**
@@ -77347,7 +77434,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `timeBusiness_calculateByWorker`(vWorkerFk INT, vDatedFrom DATETIME, vDatedTo DATETIME)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `timeBusiness_calculateByWorker`(vWorkerFk INT, vDatedFrom DATETIME, vDatedTo DATETIME)
BEGIN
/**
@@ -77381,7 +77468,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `timeControl_calculate`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `timeControl_calculate`(
vDatedFrom DATETIME,
vDatedTo DATETIME)
BEGIN
@@ -77588,7 +77675,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `timeControl_calculateAll`(vDatedFrom DATETIME, vDatedTo DATETIME)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `timeControl_calculateAll`(vDatedFrom DATETIME, vDatedTo DATETIME)
BEGIN
/**
@@ -77620,7 +77707,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `timeControl_calculateByDepartment`(vDepartmentFk INT, vDatedFrom DATETIME, vDatedTo DATETIME)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `timeControl_calculateByDepartment`(vDepartmentFk INT, vDatedFrom DATETIME, vDatedTo DATETIME)
BEGIN
/**
* @param vDepartmentFk
@@ -77658,7 +77745,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `timeControl_calculateByUser`(vUserFk INT, vDatedFrom DATETIME, vDatedTo DATETIME)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `timeControl_calculateByUser`(vUserFk INT, vDatedFrom DATETIME, vDatedTo DATETIME)
BEGIN
/**
@@ -77693,7 +77780,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `timeControl_calculateByWorker`(vWorkerFk INT, vDatedFrom DATETIME, vDatedTo DATETIME)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `timeControl_calculateByWorker`(vWorkerFk INT, vDatedFrom DATETIME, vDatedTo DATETIME)
BEGIN
/**
@@ -77728,7 +77815,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `timeControl_getError`(vDatedFrom DATETIME, vDatedTo DATETIME)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `timeControl_getError`(vDatedFrom DATETIME, vDatedTo DATETIME)
BEGIN
/*
* @param vDatedFrom
@@ -77811,7 +77898,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `tpvTransaction_checkStatus`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `tpvTransaction_checkStatus`()
BEGIN
/**
*
@@ -77839,16 +77926,16 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `travelVolume` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `travelVolume`(vTravelFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `travelVolume`(vTravelFk INT)
BEGIN
SELECT w1.name AS ORI,
@@ -77882,16 +77969,16 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `travelVolume_get` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `travelVolume_get`(vFromDated DATE, vToDated DATE, vWarehouseFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `travelVolume_get`(vFromDated DATE, vToDated DATE, vWarehouseFk INT)
BEGIN
SELECT tr.landed Fecha,
a.name Agencia,
@@ -77921,7 +78008,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_checkDates`(vShipped DATE, vLanded DATE)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `travel_checkDates`(vShipped DATE, vLanded DATE)
BEGIN
/**
* Checks the landing/shipment dates of travel, throws an error
@@ -77951,7 +78038,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_checkPackaging`(vSelf INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `travel_checkPackaging`(vSelf INT)
BEGIN
DECLARE vDone BOOL;
DECLARE vEntryFk INT;
@@ -77994,7 +78081,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_checkWarehouseIsFeedStock`(vWarehouseFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `travel_checkWarehouseIsFeedStock`(vWarehouseFk INT)
proc: BEGIN
/*
* Check that the warehouse is not Feed Stock
@@ -78024,7 +78111,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_clone`(vSelf INT, vDays INT, OUT vNewTravelFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `travel_clone`(vSelf INT, vDays INT, OUT vNewTravelFk INT)
BEGIN
/**
* Clona un travel el número de dias indicado y devuelve su id.
@@ -78085,7 +78172,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_cloneWithEntries`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `travel_cloneWithEntries`(
IN vTravelFk INT,
IN vDateStart DATE,
IN vDateEnd DATE,
@@ -78179,7 +78266,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_getDetailFromContinent`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `travel_getDetailFromContinent`(
vContinentFk INT
)
BEGIN
@@ -78292,16 +78379,16 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `travel_getEntriesMissingPackage` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_getEntriesMissingPackage`(vSelf INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `travel_getEntriesMissingPackage`(vSelf INT)
BEGIN
DECLARE vpackageOrPackingNull INT;
DECLARE vTravelFk INT;
@@ -78332,7 +78419,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_moveRaids`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `travel_moveRaids`()
BEGIN
/*
@@ -78417,7 +78504,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_recalc`(vSelf INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `travel_recalc`(vSelf INT)
proc: BEGIN
/**
* Updates the number of entries assigned to the travel.
@@ -78447,7 +78534,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_throwAwb`(vSelf INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `travel_throwAwb`(vSelf INT)
BEGIN
/**
* Throws an error if travel does not have a logical AWB
@@ -78474,7 +78561,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_upcomingArrivals`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `travel_upcomingArrivals`(
vWarehouseFk INT,
vDate DATETIME
)
@@ -78568,7 +78655,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_updatePacking`(vItemFk INT, vPacking INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `travel_updatePacking`(vItemFk INT, vPacking INT)
BEGIN
/**
* Actualiza packing para los movimientos de almacén de la subasta al almacén central
@@ -78610,7 +78697,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_weeklyClone`(vSinceWeek INT, vToWeek INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `travel_weeklyClone`(vSinceWeek INT, vToWeek INT)
BEGIN
/**
* Clona los traslados plantilla para las semanas pasadas por parámetros.
@@ -78696,7 +78783,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `typeTagMake`(vTypeFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `typeTagMake`(vTypeFk INT)
BEGIN
/*
* Plantilla para modificar reemplazar todos los tags
@@ -78767,7 +78854,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `updatePedidosInternos`(vItemFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `updatePedidosInternos`(vItemFk INT)
BEGIN
UPDATE vn.item SET upToDown = 0 WHERE item.id = vItemFk;
@@ -78789,7 +78876,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `vehicle_checkNumberPlate`(vNumberPlate VARCHAR(10), vCountryCodeFk VARCHAR(2))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `vehicle_checkNumberPlate`(vNumberPlate VARCHAR(10), vCountryCodeFk VARCHAR(2))
BEGIN
/**
* Comprueba si la matricula pasada tiene el formato correcto dependiendo del pais del vehiculo
@@ -78819,7 +78906,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `vehicle_notifyEvents`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `vehicle_notifyEvents`()
proc:BEGIN
/**
* Query the vehicleEvent table to see if there are any events that need to be notified.
@@ -78883,7 +78970,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `visible_getMisfit`(vSectorFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `visible_getMisfit`(vSectorFk INT)
BEGIN
/* Devuelve una tabla temporal con los descuadres entre el visible teórico y lo ubicado en la práctica
@@ -78942,7 +79029,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `warehouseFitting`(IN vWhOrigin INT , IN vWhDestiny INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `warehouseFitting`(IN vWhOrigin INT , IN vWhDestiny INT)
BEGIN
DECLARE vCacheVisibleOriginFk INT;
DECLARE vCacheVisibleDestinyFk INT;
@@ -78980,7 +79067,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `warehouseFitting_byTravel`(IN vTravelFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `warehouseFitting_byTravel`(IN vTravelFk INT)
BEGIN
DECLARE vWhOrigin INT;
@@ -79008,7 +79095,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `workerCalculateBoss`(vWorker INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `workerCalculateBoss`(vWorker INT)
BEGIN
/**
* Actualiza la tabla workerBosses
@@ -79049,7 +79136,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `workerCalendar_calculateBusiness`(vYear INT, vBusinessFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `workerCalendar_calculateBusiness`(vYear INT, vBusinessFk INT)
BEGIN
/**
* Calcula los días y horas de vacaciones en función de un contrato y año
@@ -79123,7 +79210,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `workerCalendar_calculateYear`(vYear INT, vWorkerFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `workerCalendar_calculateYear`(vYear INT, vWorkerFk INT)
BEGIN
/**
@@ -79195,7 +79282,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `workerCreateExternal`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `workerCreateExternal`(
vFirstName VARCHAR(50),
vSurname1 VARCHAR(50),
vSurname2 VARCHAR(50),
@@ -79237,7 +79324,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `workerDepartmentByDate`(vDate DATE)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `workerDepartmentByDate`(vDate DATE)
BEGIN
DROP TEMPORARY TABLE IF EXISTS tmp.workerDepartmentByDate;
@@ -79274,7 +79361,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `workerDisable`(vUserId int)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `workerDisable`(vUserId int)
mainLabel:BEGIN
IF (SELECT COUNT(*) FROM workerDisableExcluded WHERE workerFk = vUserId AND (dated > util.VN_CURDATE() OR dated IS NULL)) > 0 THEN
@@ -79323,7 +79410,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `workerDisableAll`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `workerDisableAll`()
BEGIN
DECLARE done BOOL DEFAULT FALSE;
DECLARE vUserFk INT;
@@ -79372,7 +79459,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `workerForAllCalculateBoss`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `workerForAllCalculateBoss`()
BEGIN
/**
* Actualiza la tabla workerBosses utilizando el procedimiento
@@ -79418,7 +79505,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `workerJourney_replace`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `workerJourney_replace`(
vDatedFrom DATE,
vDatedTo DATE,
vWorkerFk INT)
@@ -79739,7 +79826,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `workerMistakeType_get`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `workerMistakeType_get`()
BEGIN
/**
@@ -79766,7 +79853,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `workerMistake_add`(vWorkerFk INT, vWorkerMistakeTypeFk VARCHAR(10))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `workerMistake_add`(vWorkerFk INT, vWorkerMistakeTypeFk VARCHAR(10))
BEGIN
/**
* Añade error al trabajador
@@ -79794,7 +79881,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControlSOWP`(IN vUserFk INT, IN vDated DATE)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `workerTimeControlSOWP`(IN vUserFk INT, IN vDated DATE)
BEGIN
SET @order := 0;
@@ -79820,7 +79907,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_calculateOddDays`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `workerTimeControl_calculateOddDays`()
BEGIN
/**
* Calculo de las fichadas impares por empleado y dia.
@@ -79867,7 +79954,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_check`(vUserFk INT, vDated DATE,vTabletFk VARCHAR(100))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `workerTimeControl_check`(vUserFk INT, vDated DATE,vTabletFk VARCHAR(100))
proc: BEGIN
/**
* Verifica si el empleado puede fichar en el momento actual, si puede fichar llama a workerTimeControlAdd
@@ -80048,7 +80135,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_checkBreak`(vStarted DATE)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `workerTimeControl_checkBreak`(vStarted DATE)
BEGIN
/**
* Retorna los trabajadores que no han respetado el descanso semanal de 36/72 horas
@@ -80215,7 +80302,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_clockIn`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `workerTimeControl_clockIn`(
vWorkerFk INT,
vTimed DATETIME,
vDirection VARCHAR(10),
@@ -80523,7 +80610,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_direction`(vWorkerFk VARCHAR(10), vTimed DATETIME)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `workerTimeControl_direction`(vWorkerFk VARCHAR(10), vTimed DATETIME)
BEGIN
/**
* Devuelve que direcciones de fichadas son lógicas a partir de la anterior fichada
@@ -80612,7 +80699,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_getClockIn`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `workerTimeControl_getClockIn`(
vUserFk INT,
vDated DATE)
BEGIN
@@ -80703,7 +80790,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_login`(vWorkerFk VARCHAR(10))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `workerTimeControl_login`(vWorkerFk VARCHAR(10))
BEGIN
/**
* Consulta la información del usuario y los botones que tiene que activar en la tablet tras hacer login
@@ -80742,7 +80829,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_remove`(IN vUserFk INT, IN vTimed DATETIME)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `workerTimeControl_remove`(IN vUserFk INT, IN vTimed DATETIME)
BEGIN
DECLARE vDirectionRemove VARCHAR(6);
@@ -80804,7 +80891,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_sendMailByDepartment`(IN vDatedFrom DATETIME, IN vDatedTo DATETIME, IN vWorkerFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `workerTimeControl_sendMailByDepartment`(IN vDatedFrom DATETIME, IN vDatedTo DATETIME, IN vWorkerFk INT)
BEGIN
/**
* Inserta el registro de horario semanalmente de PRODUCCION, CAMARA, REPARTO, TALLER NATURAL y TALLER ARTIFICIAL en vn.mail.
@@ -80946,7 +81033,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_sendMailByDepartmentLauncher`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `workerTimeControl_sendMailByDepartmentLauncher`()
BEGIN
DECLARE vDatedFrom, vDatedTo DATETIME;
@@ -80971,7 +81058,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_weekCheckBreak`(vStarted DATE, vEnded DATE)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `workerTimeControl_weekCheckBreak`(vStarted DATE, vEnded DATE)
BEGIN
/**
* Retorna los trabajadores que no han respetado el descanso semanal de 36/72 horas
@@ -81020,7 +81107,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `workerWeekControl`(vUserFk INT, vDated DATE, vTabletFk VARCHAR(100))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `workerWeekControl`(vUserFk INT, vDated DATE, vTabletFk VARCHAR(100))
BEGIN
/*
* Devuelve la cantidad de descansos de 12h y de 36 horas que ha disfrutado el trabajador
@@ -81166,7 +81253,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `worker_checkMultipleDevice`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `worker_checkMultipleDevice`(
vSelf INT
)
BEGIN
@@ -81203,7 +81290,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `worker_getFromHasMistake`(vDepartmentFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `worker_getFromHasMistake`(vDepartmentFk INT)
BEGIN
/**
@@ -81235,7 +81322,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `worker_getHierarchy`(vUserFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `worker_getHierarchy`(vUserFk INT)
BEGIN
/**
* Retorna una tabla temporal con los trabajadores que tiene
@@ -81275,7 +81362,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `worker_getSector`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `worker_getSector`()
BEGIN
/**
@@ -81303,7 +81390,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `worker_updateBalance`(vSelf INT(11), vCredit DECIMAL(10,2), vDebit DECIMAL(10,2))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `worker_updateBalance`(vSelf INT(11), vCredit DECIMAL(10,2), vDebit DECIMAL(10,2))
BEGIN
/**
* Actualiza la columna balance de worker.
@@ -81329,7 +81416,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `worker_updateBusiness`(vSelf INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `worker_updateBusiness`(vSelf INT)
BEGIN
/**
* Activates an account and configures its email settings.
@@ -81376,7 +81463,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `worker_updateChangedBusiness`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `worker_updateChangedBusiness`()
BEGIN
/**
* Actualiza el contrato actual de todos los trabajadores cuyo contracto ha
@@ -81429,7 +81516,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `workingHours`(username varchar(255), logon boolean)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `workingHours`(username varchar(255), logon boolean)
BEGIN
DECLARE userid int(11);
@@ -81458,7 +81545,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `workingHoursTimeIn`(vUserId INT(11))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `workingHoursTimeIn`(vUserId INT(11))
BEGIN
INSERT INTO vn.workingHours (timeIn, userId)
VALUES (util.VN_NOW(),vUserId);
@@ -81478,7 +81565,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `workingHoursTimeOut`(vUserId INT(11))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `workingHoursTimeOut`(vUserId INT(11))
BEGIN
UPDATE vn.workingHours
SET timeOut = util.VN_NOW()
@@ -81500,7 +81587,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `wrongEqualizatedClient`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `wrongEqualizatedClient`()
BEGIN
SELECT clientFk, c.name, c.isActive, c.isTaxDataChecked, count(ie) as num
FROM vn.client c
@@ -81540,7 +81627,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `XDiario_check`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `XDiario_check`()
BEGIN
/**
* Realiza la revisión diaria de los asientos contables,
@@ -81581,7 +81668,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `XDiario_checkDate`(vDate DATE)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `XDiario_checkDate`(vDate DATE)
proc: BEGIN
/**
* Comprueba si la fecha pasada esta en el rango
@@ -81618,7 +81705,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `xdiario_new`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `xdiario_new`(
vBookNumber INT,
vDated DATE,
vSubaccount VARCHAR(12),
@@ -81674,7 +81761,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `zoneClosure_recalc`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `zoneClosure_recalc`()
proc: BEGIN
/**
* Recalculates the delivery time (hour) for every zone in days + scope in future
@@ -81734,7 +81821,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `zoneGeo_calcTree`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `zoneGeo_calcTree`()
BEGIN
/**
* Calculates the #path, #lft, #rgt, #sons and #depth columns of
@@ -81778,7 +81865,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `zoneGeo_calcTreeRec`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `zoneGeo_calcTreeRec`(
vSelf INT,
vPath VARCHAR(255),
vDepth INT,
@@ -81860,7 +81947,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `zoneGeo_checkName`(vName VARCHAR(255))
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `zoneGeo_checkName`(vName VARCHAR(255))
BEGIN
IF vName = '' THEN
SIGNAL SQLSTATE '45000'
@@ -81882,7 +81969,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `zoneGeo_delete`(vSelf INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `zoneGeo_delete`(vSelf INT)
BEGIN
/**
* Deletes a node from the #zoneGeo table. Also sets a mark
@@ -81908,7 +81995,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `zoneGeo_doCalc`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `zoneGeo_doCalc`()
proc: BEGIN
/**
* Recalculates the zones tree.
@@ -81950,7 +82037,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `zoneGeo_setParent`(vSelf INT, vParentFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `zoneGeo_setParent`(vSelf INT, vParentFk INT)
BEGIN
/**
* Updates the parent of a node. Also sets a mark
@@ -81979,7 +82066,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `zoneGeo_throwNotEditable`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `zoneGeo_throwNotEditable`()
BEGIN
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'Column `geoFk` cannot be modified';
@@ -81999,7 +82086,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_excludeFromGeo`(vZoneGeo INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `zone_excludeFromGeo`(vZoneGeo INT)
BEGIN
/**
* Excluye zonas a partir un geoFk.
@@ -82032,7 +82119,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getAddresses`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `zone_getAddresses`(
vSelf INT,
vShipped DATE,
vDepartmentFk INT
@@ -82103,7 +82190,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getAgency`(vAddress INT, vLanded DATE)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `zone_getAgency`(vAddress INT, vLanded DATE)
BEGIN
/**
* Devuelve el listado de agencias disponibles para la fecha
@@ -82152,7 +82239,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getAvailable`(vAddress INT, vLanded DATE)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `zone_getAvailable`(vAddress INT, vLanded DATE)
BEGIN
CALL zone_getFromGeo(address_getGeo(vAddress));
CALL zone_getOptionsForLanding(vLanded, FALSE);
@@ -82178,7 +82265,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getClosed`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `zone_getClosed`()
proc:BEGIN
/**
* Devuelve una tabla con las zonas cerradas para hoy
@@ -82225,7 +82312,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getCollisions`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `zone_getCollisions`()
BEGIN
/**
* Calcula si para un mismo codigo postal y dia
@@ -82346,7 +82433,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getEvents`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `zone_getEvents`(
vGeoFk INT,
vAgencyModeFk INT)
BEGIN
@@ -82423,7 +82510,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getFromGeo`(vGeoFk INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `zone_getFromGeo`(vGeoFk INT)
BEGIN
/**
* Returns all zones which have the passed geo included.
@@ -82492,7 +82579,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getLanded`(vShipped DATE, vAddressFk INT, vAgencyModeFk INT, vWarehouseFk INT, vShowExpiredZones BOOLEAN)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `zone_getLanded`(vShipped DATE, vAddressFk INT, vAgencyModeFk INT, vWarehouseFk INT, vShowExpiredZones BOOLEAN)
BEGIN
/**
* Devuelve una tabla temporal con el dia de recepcion para vShipped.
@@ -82552,7 +82639,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getLeaves`(
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `zone_getLeaves`(
vSelf INT,
vParentFk INT,
vSearch VARCHAR(255),
@@ -82688,7 +82775,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getOptionsForLanding`(vLanded DATE, vShowExpiredZones BOOLEAN)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `zone_getOptionsForLanding`(vLanded DATE, vShowExpiredZones BOOLEAN)
BEGIN
/**
* Gets computed options for the passed zones and delivery date.
@@ -82765,7 +82852,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getOptionsForShipment`(vShipped DATE, vShowExpiredZones BOOLEAN)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `zone_getOptionsForShipment`(vShipped DATE, vShowExpiredZones BOOLEAN)
BEGIN
/**
* Gets computed options for the passed zones and shipping date.
@@ -82853,7 +82940,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getPostalCode`(vSelf INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `zone_getPostalCode`(vSelf INT)
BEGIN
/**
* Devuelve los códigos postales incluidos en una zona
@@ -82912,7 +82999,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getShipped`(vLanded DATE, vAddressFk INT, vAgencyModeFk INT, vShowExpiredZones BOOLEAN)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `zone_getShipped`(vLanded DATE, vAddressFk INT, vAgencyModeFk INT, vShowExpiredZones BOOLEAN)
BEGIN
/**
* Devuelve la mínima fecha de envío para cada warehouse
@@ -82976,7 +83063,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getState`(vDated DATE)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `zone_getState`(vDated DATE)
BEGIN
/**
* Devuelve las zonas y el estado para la fecha solicitada
@@ -83031,7 +83118,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getWarehouse`(vAddress INT, vLanded DATE, vWarehouse INT)
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `zone_getWarehouse`(vAddress INT, vLanded DATE, vWarehouse INT)
BEGIN
/**
* Devuelve el listado de agencias disponibles para la fecha,
@@ -83081,7 +83168,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_upcomingDeliveries`()
+CREATE DEFINER=`vn`@`localhost` PROCEDURE `zone_upcomingDeliveries`()
BEGIN
DECLARE vForwardDays INT;
@@ -87096,7 +87183,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `NewView` AS select `c`.`id` AS `clientFk`,max(`t`.`shipped`) AS `lastShipped`,`pc`.`notBuyingMonths` AS `notBuyingMonths` from ((`client` `c` join `productionConfig` `pc`) left join `ticket` `t` on(`c`.`id` = `t`.`clientFk` and `t`.`shipped` < `util`.`VN_CURDATE`() + interval -`pc`.`rookieDays` day)) group by `c`.`id` having `lastShipped` is null or `lastShipped` < `util`.`VN_CURDATE`() + interval -`notBuyingMonths` month */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87110,11 +87197,11 @@ USE `vn`;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb3 */;
-/*!50001 SET character_set_results = utf8mb3 */;
-/*!50001 SET collation_connection = utf8mb3_general_ci */;
+/*!50001 SET character_set_client = utf8mb4 */;
+/*!50001 SET character_set_results = utf8mb4 */;
+/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `agencyTerm` AS select `sat`.`agencyFk` AS `agencyFk`,`sat`.`minimumPackages` AS `minimumPackages`,`sat`.`kmPrice` AS `kmPrice`,`sat`.`packagePrice` AS `packagePrice`,`sat`.`routePrice` AS `routePrice`,`sat`.`minimumKm` AS `minimumKm`,`sat`.`minimumM3` AS `minimumM3`,`sat`.`m3Price` AS `m3Price` from `supplierAgencyTerm` `sat` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87132,7 +87219,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `annualAverageInvoiced` AS select `cec`.`clientFk` AS `clientFk`,`cec`.`invoiced` AS `invoiced` from `bs`.`clientAnnualConsumption` `cec` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87150,7 +87237,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `awbVolume` AS select `t`.`awbFk` AS `awbFk`,`b`.`stickers` * `i`.`density` * if(`p`.`volume` > 0,`p`.`volume`,`p`.`width` * `p`.`depth` * if(`p`.`height` = 0,`i`.`size` + 10,`p`.`height`)) / (`vc`.`aerealVolumetricDensity` * 1000) AS `volume`,`b`.`id` AS `buyFk` from ((((((`buy` `b` join `item` `i` on(`b`.`itemFk` = `i`.`id`)) join `itemType` `it` on(`i`.`typeFk` = `it`.`id`)) join `packaging` `p` on(`p`.`id` = `b`.`packagingFk`)) join `entry` `e` on(`b`.`entryFk` = `e`.`id`)) join `travel` `t` on(`t`.`id` = `e`.`travelFk`)) join `volumeConfig` `vc`) where `t`.`shipped` > makedate(year(`util`.`VN_CURDATE`()) - 1,1) and `t`.`awbFk` <> 0 */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87168,7 +87255,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `businessCalendar` AS select `c`.`id` AS `id`,`c`.`businessFk` AS `businessFk`,`c`.`dayOffTypeFk` AS `absenceTypeFk`,`c`.`dated` AS `dated` from `calendar` `c` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87186,7 +87273,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `buyer` AS select distinct `u`.`id` AS `userFk`,`u`.`nickname` AS `nickname` from (`account`.`user` `u` join `vn`.`itemType` `it` on(`it`.`workerFk` = `u`.`id`)) where `u`.`active` <> 0 order by `u`.`nickname` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87204,7 +87291,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `buyerSales` AS select `v`.`importe` AS `importe`,`w`.`code` AS `comprador`,`t`.`year` AS `año`,`t`.`week` AS `semana` from (((`bs`.`ventas` `v` join `vn`.`time` `t` on(`t`.`dated` = `v`.`fecha`)) join `vn`.`itemType` `it` on(`it`.`id` = `v`.`tipo_id`)) join `vn`.`worker` `w` on(`w`.`id` = `it`.`workerFk`)) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87222,7 +87309,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `clientLost` AS select `c`.`id` AS `clientFk`,max(`t`.`shipped`) AS `lastShipped`,`pc`.`notBuyingMonths` AS `notBuyingMonths` from ((`client` `c` join `productionConfig` `pc`) left join `ticket` `t` on(`c`.`id` = `t`.`clientFk` and `t`.`shipped` < `util`.`VN_CURDATE`() + interval -`pc`.`rookieDays` day)) group by `c`.`id` having `lastShipped` is null or `lastShipped` < `util`.`VN_CURDATE`() + interval -`notBuyingMonths` month */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87240,7 +87327,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `clientPhoneBook` AS select `c`.`id` AS `clientFk`,trim(`c`.`phone`) AS `phone` from `client` `c` where `c`.`phone` <> 0 and `c`.`isActive` <> 0 union select `c`.`id` AS `clientFk`,trim(`c`.`mobile`) AS `phone` from `client` `c` where `c`.`mobile` <> 0 and `c`.`isActive` <> 0 union select `a`.`clientFk` AS `clientFk`,trim(`a`.`phone`) AS `phone` from (`address` `a` join `client` `c` on(`c`.`id` = `a`.`clientFk`)) where `a`.`phone` <> 0 and `c`.`isActive` <> 0 union select `a`.`clientFk` AS `clientFk`,trim(`a`.`mobile`) AS `phone` from (`address` `a` join `client` `c` on(`c`.`id` = `a`.`clientFk`)) where `a`.`mobile` <> 0 and `c`.`isActive` <> 0 union select `cc`.`clientFk` AS `clientFk`,trim(`cc`.`phone`) AS `phone` from (`clientContact` `cc` left join `client` `c` on(`c`.`id` = `cc`.`clientFk`)) where `c`.`phone` <> 0 and `c`.`isActive` <> 0 */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87258,7 +87345,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `companyL10n` AS select `c`.`id` AS `id`,ifnull(`ci`.`footnotes`,`c`.`footnotes`) AS `footnotes` from (`company` `c` left join `companyI18n` `ci` on(`ci`.`companyFk` = `c`.`id` and `ci`.`lang` = `util`.`LANG`())) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87276,7 +87363,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `defaulter` AS select `d`.`clientFk` AS `clientFk`,`d`.`created` AS `created`,`d`.`amount` AS `amount`,`d`.`defaulterSinced` AS `defaulterSinced`,`d`.`hasChanged` AS `hasChanged`,`c`.`countryFk` AS `country`,`c`.`payMethodFk` AS `payMethod` from (((`bs`.`defaulter` `d` join `vn`.`client` `c` on(`c`.`id` = `d`.`clientFk`)) join `vn`.`country` `co` on(`co`.`id` = `c`.`countryFk`)) join `vn`.`payMethod` `pm` on(`pm`.`id` = `c`.`payMethodFk`)) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87294,7 +87381,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `departmentTree` AS select `node`.`id` AS `id`,concat(convert(repeat(repeat(' ',5),count(`parent`.`id`) - 1) using utf8mb3),`node`.`name`) AS `dep` from (`department` `node` join `department` `parent`) where `node`.`lft` between `parent`.`lft` and `parent`.`rgt` group by `node`.`id` order by `node`.`lft` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87312,7 +87399,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `ediGenus` AS select `g`.`genus_id` AS `id`,`g`.`latin_genus_name` AS `latinGenusName`,`g`.`entry_date` AS `entried`,`g`.`expiry_date` AS `dued`,`g`.`change_date_time` AS `modified` from `edi`.`genus` `g` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87330,7 +87417,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `ediSpecie` AS select `s`.`specie_id` AS `id`,`s`.`genus_id` AS `genusFk`,`s`.`latin_species_name` AS `latinSpeciesName`,`s`.`entry_date` AS `entried`,`s`.`expiry_date` AS `dued`,`s`.`change_date_time` AS `modified` from `edi`.`specie` `s` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87348,7 +87435,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `ektSubAddress` AS select `eea`.`sub` AS `sub`,`a`.`clientFk` AS `clientFk`,`a`.`nickname` AS `nickname`,`eea`.`addressFk` AS `addressFk` from (`ektEntryAssign` `eea` join `address` `a` on(`a`.`id` = `eea`.`addressFk`)) group by `eea`.`sub` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87366,7 +87453,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `especialPrice` AS select `sp`.`id` AS `id`,`sp`.`clientFk` AS `clientFk`,`sp`.`itemFk` AS `itemFk`,`sp`.`value` AS `value` from `specialPrice` `sp` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87384,7 +87471,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `exchangeInsuranceEntry` AS select max(`tr`.`landed`) AS `dated`,cast(sum((`b`.`buyingValue` + `b`.`freightValue`) * `b`.`quantity`) as decimal(10,2)) AS `Dolares`,cast(sum((`b`.`buyingValue` + `b`.`freightValue`) * `b`.`quantity`) / sum((100 + `e`.`commission`) / 100 * (`b`.`buyingValue` + `b`.`freightValue`) * `b`.`quantity`) as decimal(10,4)) AS `rate` from ((`entry` `e` join `buy` `b` on(`e`.`id` = `b`.`entryFk`)) join `travel` `tr` on(`tr`.`id` = `e`.`travelFk`)) where `tr`.`landed` between '2016-01-31' and `util`.`VN_CURDATE`() and `e`.`commission` < 0 and `e`.`currencyFk` = 2 group by month(`tr`.`landed`),year(`tr`.`landed`) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87402,7 +87489,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `exchangeInsuranceIn` AS select `exchangeInsuranceInPrevious`.`dated` AS `dated`,sum(`exchangeInsuranceInPrevious`.`amount`) AS `amount`,cast(sum(`exchangeInsuranceInPrevious`.`amount` * `exchangeInsuranceInPrevious`.`rate`) / sum(`exchangeInsuranceInPrevious`.`amount`) as decimal(10,4)) AS `rate` from `exchangeInsuranceInPrevious` group by `exchangeInsuranceInPrevious`.`dated` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87420,7 +87507,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `exchangeInsuranceInPrevious` AS select `ei`.`dueDated` AS `dated`,`ei`.`amount` AS `amount`,`ei`.`rate` AS `rate` from `exchangeInsurance` `ei` where `ei`.`amount` <> 0 and `ei`.`financialProductTypefk` = 'SC' */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87438,7 +87525,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `exchangeInsuranceOut` AS select `p`.`received` AS `received`,sum(`p`.`divisa`) AS `divisa`,sum(`p`.`divisa`) / sum(`p`.`amount`) AS `rate` from ((`payment` `p` join `accounting` `a` on(`a`.`id` = `p`.`bankFk`)) join `accountingType` `at2` on(`at2`.`id` = `a`.`accountingTypeFk`)) where `p`.`currencyFk` = 2 and `at2`.`code` = 'wireTransfer' and `p`.`supplierFk` <> 2213 group by `p`.`received` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87456,7 +87543,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `expeditionCommon` AS select `rs`.`id` AS `truckFk`,`rs`.`eta` AS `eta`,ifnull(ucase(`rs`.`description`),'SIN ESCANEAR') AS `description`,`es`.`palletFk` AS `palletFk`,`t`.`routeFk` AS `routeFk`,`es`.`id` AS `scanFk`,`e`.`id` AS `expeditionFk`,`r`.`roadmapStopFk` AS `roadmapStopFk`,`t`.`warehouseFk` AS `warehouseFk`,`e`.`created` AS `lastPacked`,`t`.`id` AS `ticketFk` from (((((`roadmapStop` `rs` left join `routesMonitor` `r` on(`rs`.`id` = `r`.`roadmapStopFk`)) left join `ticket` `t` on(`r`.`routeFk` = `t`.`routeFk`)) left join `expedition` `e` on(`t`.`id` = `e`.`ticketFk`)) left join `expeditionScan` `es` on(`e`.`id` = `es`.`expeditionFk`)) left join `expeditionPallet` `ep` on(`es`.`palletFk` = `ep`.`id`)) where `rs`.`eta` >= `util`.`VN_CURDATE`() */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87474,7 +87561,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `expeditionPallet_Print` AS select `rs2`.`description` AS `truck`,`t`.`routeFk` AS `routeFk`,`r`.`description` AS `zone`,count(`es`.`id`) AS `eti`,`ep`.`id` AS `palletFk`,`rs`.`id` <=> `rm`.`roadmapStopFk` AS `isMatch`,`t`.`warehouseFk` AS `warehouseFk`,if(`r`.`created` > `util`.`VN_CURDATE`() + interval 1 day,ucase(dayname(`r`.`created`)),NULL) AS `nombreDia` from (((((((`roadmapStop` `rs` join `expeditionPallet` `ep` on(`ep`.`truckFk` = `rs`.`id`)) join `expeditionScan` `es` on(`es`.`palletFk` = `ep`.`id`)) join `expedition` `e` on(`e`.`id` = `es`.`expeditionFk`)) join `ticket` `t` on(`t`.`id` = `e`.`ticketFk`)) join `route` `r` on(`r`.`id` = `t`.`routeFk`)) left join `routesMonitor` `rm` on(`rm`.`routeFk` = `r`.`id`)) left join `roadmapStop` `rs2` on(`rs2`.`id` = `rm`.`roadmapStopFk`)) group by `ep`.`id`,`t`.`routeFk` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87492,7 +87579,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `expeditionRoute_Monitor` AS select `r`.`id` AS `routeFk`,count(distinct if(`e`.`id` is null,`t`.`id`,NULL)) AS `tickets`,count(distinct `e`.`id`) AS `expeditions`,count(distinct `es`.`id`) AS `scanned`,max(`e`.`created`) AS `lastPacked`,`r`.`created` AS `created` from (((((`route` `r` left join `routesMonitor` `rm` on(`r`.`id` = `rm`.`routeFk`)) left join `roadmapStop` `rs` on(`rs`.`id` = `rm`.`roadmapStopFk`)) join `ticket` `t` on(`t`.`routeFk` = `r`.`id`)) left join `expedition` `e` on(`e`.`ticketFk` = `t`.`id`)) left join `expeditionScan` `es` on(`es`.`expeditionFk` = `e`.`id`)) where `r`.`created` >= `util`.`yesterday`() group by `r`.`id` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87510,7 +87597,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `expeditionRoute_freeTickets` AS select `t`.`routeFk` AS `routeFk`,`tss`.`ticketFk` AS `ticket`,`s`.`name` AS `code`,`w`.`name` AS `almacen`,`tss`.`updated` AS `updated`,`p`.`code` AS `parkingCode` from (((((`ticketState` `tss` join `ticket` `t` on(`t`.`id` = `tss`.`ticketFk`)) join `warehouse` `w` on(`w`.`id` = `t`.`warehouseFk`)) join `state` `s` on(`s`.`id` = `tss`.`state`)) left join `ticketParking` `tp` on(`tp`.`ticketFk` = `t`.`id`)) left join `parking` `p` on(`p`.`id` = `tp`.`parkingFk`)) where ifnull(`t`.`packages`,0) = 0 */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87528,7 +87615,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `expeditionScan_Monitor` AS select `rs`.`id` AS `truckFk`,`rs`.`eta` AS `ETD`,`rs`.`description` AS `description`,`ep`.`id` AS `palletFk`,`ep`.`position` AS `position`,`ep`.`built` AS `built`,`es`.`id` AS `scanFk`,`es`.`expeditionFk` AS `expeditionFk`,`es`.`scanned` AS `scanned` from ((`roadmapStop` `rs` left join `expeditionPallet` `ep` on(`ep`.`truckFk` = `rs`.`id`)) left join `expeditionScan` `es` on(`es`.`palletFk` = `ep`.`id`)) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87546,7 +87633,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `expeditionSticker` AS select `e`.`id` AS `expeditionFk`,`e`.`ticketFk` AS `ticketFk`,`t`.`addressFk` AS `addressFk`,`t`.`clientFk` AS `clientFk`,`a`.`street` AS `street`,`a`.`postalCode` AS `postalCode`,`a`.`city` AS `city`,`a`.`nickname` AS `nickname`,concat('R(',right(`t`.`routeFk`,3),')') AS `routeFk`,`rm`.`beachFk` AS `beachFk`,if(`t`.`routeFk`,ifnull(`rs`.`description`,replace(`am`.`name`,'ZONA ','Z')),`z`.`name`) AS `zona`,`p`.`name` AS `province`,ifnull(`c`.`mobile`,ifnull(`a`.`mobile`,ifnull(`c`.`phone`,`a`.`phone`))) AS `phone`,`w`.`code` AS `workerCode` from (((((((((((`expedition` `e` join `ticket` `t` on(`t`.`id` = `e`.`ticketFk`)) join `address` `a` on(`a`.`id` = `t`.`addressFk`)) join `province` `p` on(`p`.`id` = `a`.`provinceFk`)) left join `routesMonitor` `rm` on(`rm`.`routeFk` = `t`.`routeFk`)) left join `roadmapStop` `rs` on(`rs`.`id` = `rm`.`roadmapStopFk`)) left join `beach` `b` on(`b`.`code` = `rm`.`beachFk`)) left join `zone` `z` on(`z`.`id` = `t`.`zoneFk`)) left join `route` `r` on(`r`.`id` = `t`.`routeFk`)) left join `agencyMode` `am` on(`am`.`id` = `r`.`agencyModeFk`)) join `client` `c` on(`c`.`id` = `a`.`clientFk`)) join `worker` `w` on(`w`.`id` = `e`.`workerFk`)) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87564,7 +87651,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `expeditionTicket_NoBoxes` AS select `t`.`id` AS `ticketFk`,`t`.`warehouseFk` AS `warehouseFk`,`t`.`routeFk` AS `routeFk`,`rs`.`description` AS `description` from (((`ticket` `t` left join `expedition` `e` on(`e`.`ticketFk` = `t`.`id`)) join `routesMonitor` `rm` on(`rm`.`routeFk` = `t`.`routeFk`)) join `roadmapStop` `rs` on(`rs`.`id` = `rm`.`roadmapStopFk`)) where `e`.`id` is null and `rs`.`eta` > `util`.`VN_CURDATE`() */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87582,7 +87669,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `expeditionTimeExpended` AS select `e`.`ticketFk` AS `ticketFk`,min(`e`.`created`) AS `started`,max(`e`.`created`) AS `finished`,max(`e`.`counter`) AS `cajas`,`w`.`code` AS `code`,`t`.`warehouseFk` AS `warehouseFk` from ((`expedition` `e` join `worker` `w` on(`w`.`id` = `e`.`workerFk`)) join `ticket` `t` on(`t`.`id` = `e`.`ticketFk`)) where `e`.`created` > `util`.`VN_CURDATE`() group by `e`.`ticketFk` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87600,7 +87687,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `expeditionTruck` AS select `rs`.`id` AS `id`,`rs`.`roadmapFk` AS `roadmapFk`,`rs`.`eta` AS `eta`,`rs`.`description` AS `description`,`rs`.`bufferFk` AS `bufferFk`,`rs`.`created` AS `created`,`rs`.`userFk` AS `userFk` from `roadmapStop` `rs` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87618,7 +87705,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `firstTicketShipped` AS select min(`ticket`.`shipped`) AS `shipped`,`ticket`.`clientFk` AS `clientFk` from `ticket` where `ticket`.`shipped` > '2001-01-01' group by `ticket`.`clientFk` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87636,7 +87723,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `floraHollandBuyedItems` AS select `b`.`itemFk` AS `itemFk`,`i`.`longName` AS `longName`,`b`.`quantity` AS `quantity`,`b`.`buyingValue` AS `buyingValue`,`tr`.`landed` AS `landed`,`e`.`companyFk` AS `companyFk` from (((((`buy` `b` join `item` `i` on(`b`.`itemFk` = `i`.`id`)) join `itemType` `it` on(`it`.`id` = `i`.`typeFk`)) join `itemCategory` `ic` on(`ic`.`id` = `it`.`categoryFk`)) join `entry` `e` on(`e`.`id` = `b`.`entryFk`)) join `travel` `tr` on(`tr`.`id` = `e`.`travelFk` and `ic`.`id` not in (8,6) and `b`.`buyingValue` <> 0 and `b`.`quantity` <> 0 and `e`.`supplierFk` in (1664,1665,1666,1465,1433))) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87654,7 +87741,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `inkL10n` AS select `k`.`id` AS `id`,ifnull(`i`.`name`,`k`.`name`) AS `name` from (`ink` `k` left join `inkI18n` `i` on(`i`.`inkFk` = `k`.`id` and `i`.`lang` = `util`.`lang`())) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87672,7 +87759,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `invoiceCorrectionDataSource` AS select `s`.`itemFk` AS `itemFk`,`s`.`quantity` AS `quantity`,`s`.`concept` AS `concept`,`s`.`price` AS `price`,`s`.`discount` AS `discount`,`t`.`refFk` AS `refFk`,`s`.`id` AS `saleFk`,`t`.`shipped` AS `shipped` from (`sale` `s` join `ticket` `t` on(`t`.`id` = `s`.`ticketFk`)) where `t`.`shipped` > `util`.`VN_CURDATE`() + interval -3 year */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87690,7 +87777,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `itemBotanicalWithGenus` AS select `ib`.`itemFk` AS `itemFk`,concat(`g`.`name`,' ',ifnull(`s`.`name`,'')) AS `ediBotanic` from ((`itemBotanical` `ib` left join `specie` `s` on(`s`.`id` = `ib`.`specieFk`)) left join `genus` `g` on(`g`.`id` = `ib`.`genusFk`)) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87708,7 +87795,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `itemCategoryL10n` AS select `c`.`id` AS `id`,ifnull(`i`.`name`,`c`.`name`) AS `name` from (`itemCategory` `c` left join `itemCategoryI18n` `i` on(`i`.`categoryFk` = `c`.`id` and `i`.`lang` = `util`.`lang`())) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87726,7 +87813,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `itemColor` AS select `it`.`itemFk` AS `itemFk`,`it`.`value` AS `color` from (`itemTag` `it` join `tag` `t` on(`t`.`id` = `it`.`tagFk`)) where `t`.`code` = 'COLOR' */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87744,7 +87831,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `itemEntryIn` AS select `t`.`warehouseInFk` AS `warehouseInFk`,`t`.`landed` AS `landed`,`b`.`itemFk` AS `itemFk`,`b`.`quantity` AS `quantity`,`t`.`isReceived` AS `isReceived`,`e`.`isRaid` AS `isVirtualStock`,`e`.`id` AS `entryFk` from ((`buy` `b` join `entry` `e` on(`b`.`entryFk` = `e`.`id`)) join `travel` `t` on(`e`.`travelFk` = `t`.`id`)) where `e`.`isExcludedFromAvailable` = 0 and `b`.`quantity` <> 0 */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87762,7 +87849,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `itemEntryOut` AS select `t`.`warehouseOutFk` AS `warehouseOutFk`,`t`.`shipped` AS `shipped`,`b`.`itemFk` AS `itemFk`,-`b`.`quantity` AS `quantity`,`t`.`isDelivered` AS `isDelivered`,`e`.`id` AS `entryFk` from ((`buy` `b` join `entry` `e` on(`b`.`entryFk` = `e`.`id`)) join `travel` `t` on(`e`.`travelFk` = `t`.`id`)) where `e`.`isExcludedFromAvailable` = 0 and `e`.`isRaid` = 0 and `b`.`quantity` <> 0 */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87780,7 +87867,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `itemInk` AS select `i`.`longName` AS `longName`,`i`.`inkFk` AS `inkFk`,`ink`.`name` AS `color` from (`item` `i` join `ink` on(`ink`.`id` = `i`.`inkFk`)) where `ink`.`isRealColor` <> 0 group by `i`.`longName` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87798,7 +87885,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `itemPlacementSupplyList` AS select `ips`.`id` AS `id`,`ips`.`itemFk` AS `itemFk`,`ips`.`quantity` AS `quantity`,`ips`.`priority` AS `priority`,ifnull(`isps`.`created`,`ips`.`created`) AS `created`,`ips`.`userFk` AS `userFk`,`ips`.`repoUserFk` AS `repoUserFk`,`ips`.`quantity` - sum(ifnull(`isps`.`quantity`,0)) AS `saldo`,concat(`i`.`longName`,' ',`i`.`size`) AS `longName`,`i`.`subName` AS `subName`,`i`.`size` AS `size`,`w`.`code` AS `workerCode`,`rw`.`code` AS `repoCode`,`ips`.`sectorFk` AS `sectorFk` from ((((`itemPlacementSupply` `ips` join `item` `i` on(`i`.`id` = `ips`.`itemFk`)) left join `worker` `w` on(`w`.`id` = `ips`.`userFk`)) left join `worker` `rw` on(`rw`.`id` = `ips`.`repoUserFk`)) left join `itemShelvingPlacementSupply` `isps` on(`isps`.`itemPlacementSupplyFk` = `ips`.`id`)) where `ips`.`created` >= `util`.`VN_CURDATE`() group by `ips`.`priority`,`ips`.`id`,`ips`.`sectorFk` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87816,7 +87903,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `itemProductor` AS select `it`.`itemFk` AS `itemFk`,`it`.`value` AS `productor` from (`itemTag` `it` join `tag` `t` on(`t`.`id` = `it`.`tagFk`)) where `t`.`code` = 'PRODUCER' */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87834,7 +87921,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `itemSearch` AS select `s`.`itemFk` AS `itemFk`,`s`.`concept` AS `concept`,`s`.`quantity` AS `quantity`,`t`.`nickname` AS `nickname`,`t`.`shipped` AS `shipped` from ((`sale` `s` join `ticket` `t` on(`t`.`id` = `s`.`ticketFk`)) join `warehouse` `w` on(`w`.`id` = `t`.`warehouseFk`)) where `t`.`shipped` between `util`.`yesterday`() and `util`.`tomorrow`() and `w`.`name` in ('VNH','Floramondo') */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87852,7 +87939,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `itemShelvingAvailable` AS select `s`.`id` AS `saleFk`,`tst`.`updated` AS `Modificado`,`s`.`ticketFk` AS `ticketFk`,0 AS `isPicked`,`s`.`itemFk` AS `itemFk`,`s`.`quantity` AS `quantity`,`s`.`concept` AS `concept`,`i`.`size` AS `size`,`st`.`name` AS `Estado`,`st`.`sectorProdPriority` AS `sectorProdPriority`,`stock`.`visible` AS `available`,`stock`.`sectorFk` AS `sectorFk`,`stock`.`shelvingFk` AS `matricula`,`stock`.`parkingFk` AS `parking`,`stock`.`itemShelvingFk` AS `itemShelving`,`am`.`name` AS `Agency`,`t`.`shipped` AS `shipped`,`stock`.`grouping` AS `grouping`,`stock`.`packing` AS `packing`,`z`.`hour` AS `hour`,`st`.`isPreviousPreparable` AS `isPreviousPreparable`,`sv`.`physicalVolume` AS `physicalVolume`,`t`.`warehouseFk` AS `warehouseFk` from (((((((((`sale` `s` join `ticket` `t` on(`t`.`id` = `s`.`ticketFk`)) join `agencyMode` `am` on(`am`.`id` = `t`.`agencyModeFk`)) join `ticketStateToday` `tst` on(`tst`.`ticketFk` = `t`.`id`)) join `state` `st` on(`st`.`id` = `tst`.`state`)) join `item` `i` on(`i`.`id` = `s`.`itemFk`)) join `itemShelvingStock` `stock` on(`stock`.`itemFk` = `i`.`id`)) left join `saleTracking` `stk` on(`stk`.`saleFk` = `s`.`id`)) left join `zone` `z` on(`z`.`id` = `t`.`zoneFk`)) left join `saleVolume` `sv` on(`sv`.`saleFk` = `s`.`id`)) where `t`.`shipped` between `util`.`yesterday`() and `util`.`dayend`(`util`.`VN_CURDATE`()) and `stk`.`id` is null and `stock`.`visible` > 0 and `stk`.`saleFk` is null and `st`.`isPreviousPreparable` <> 0 */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87870,7 +87957,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `itemShelvingList` AS select `ish`.`shelvingFk` AS `shelvingFk`,`ish`.`visible` AS `visible`,`ish`.`created` AS `created`,`pk`.`code` AS `parking`,`ish`.`itemFk` AS `itemFk`,`i`.`longName` AS `longName`,`i`.`size` AS `size`,`i`.`subName` AS `subName`,`sh`.`parked` AS `parked`,`pk`.`sectorFk` AS `sectorFk` from (((`itemShelving` `ish` join `shelving` `sh` on(`sh`.`code` = `ish`.`shelvingFk`)) join `item` `i` on(`i`.`id` = `ish`.`itemFk`)) left join `parking` `pk` on(`pk`.`id` = `sh`.`parkingFk`)) order by `ish`.`created` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87888,7 +87975,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `itemShelvingPlacementSupplyStock` AS select `ish`.`id` AS `itemShelvingFk`,`ish`.`itemFk` AS `itemFk`,`ish`.`packing` AS `packing`,`ish`.`visible` AS `stock`,`i`.`longName` AS `longName`,`i`.`size` AS `size`,`i`.`subName` AS `subName`,`sh`.`code` AS `shelving`,`p`.`code` AS `parking`,`ish`.`created` AS `created`,ifnull(`sh`.`priority`,1) AS `priority`,`p`.`id` AS `parkingFk`,`p`.`sectorFk` AS `sectorFk` from (((`itemShelving` `ish` join `shelving` `sh` on(`sh`.`code` = `ish`.`shelvingFk`)) left join `parking` `p` on(`p`.`id` = `sh`.`parkingFk`)) join `item` `i` on(`i`.`id` = `ish`.`itemFk`)) group by `ish`.`id` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87906,7 +87993,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `itemShelvingSaleSum` AS select `iss`.`id` AS `id`,`iss`.`itemShelvingFk` AS `itemShelvingFk`,`iss`.`saleFk` AS `saleFk`,sum(`iss`.`quantity`) AS `quantity`,`iss`.`created` AS `created`,`p`.`sectorFk` AS `sectorFk` from (((`itemShelvingSale` `iss` join `itemShelving` `ish` on(`ish`.`id` = `iss`.`itemShelvingFk`)) join `shelving` `sh` on(`sh`.`code` = `ish`.`shelvingFk`)) join `parking` `p` on(`p`.`id` = `sh`.`parkingFk`)) group by `iss`.`saleFk` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87924,7 +88011,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `itemShelvingStock` AS select `ish`.`itemFk` AS `itemFk`,sum(`ish`.`visible`) AS `visible`,min(`ish`.`packing`) AS `packing`,min(`ish`.`grouping`) AS `grouping`,`s`.`description` AS `sector`,sum(`ish`.`visible`) AS `visibleOriginal`,0 AS `removed`,`p`.`sectorFk` AS `sectorFk`,`s`.`warehouseFk` AS `warehouseFk`,`ish`.`shelvingFk` AS `shelvingFk`,`p`.`code` AS `parkingCode`,`sh`.`parkingFk` AS `parkingFk`,`ish`.`id` AS `itemShelvingFk`,`ish`.`created` AS `created`,`st`.`code` = 'previousPrepared' AS `isPreviousPrepared` from ((((`itemShelving` `ish` left join `shelving` `sh` on(`sh`.`code` = `ish`.`shelvingFk`)) left join `parking` `p` on(`p`.`id` = `sh`.`parkingFk`)) left join `sector` `s` on(`s`.`id` = `p`.`sectorFk`)) left join `sectorType` `st` on(`st`.`id` = `s`.`typeFk`)) where `ish`.`visible` <> 0 and `p`.`sectorFk` <> 0 group by `ish`.`itemFk`,`p`.`sectorFk` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87942,7 +88029,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `itemShelvingStockFull` AS select `ish`.`itemFk` AS `itemFk`,`ish`.`visible` AS `quantity`,`ish`.`packing` AS `packing`,`ish`.`grouping` AS `grouping`,`s`.`description` AS `sector`,`issr`.`removed` AS `removed`,`p`.`sectorFk` AS `sectorFk`,`s`.`warehouseFk` AS `warehouseFk`,`ish`.`shelvingFk` AS `shelvingFk`,`p`.`code` AS `parkingCode`,`sh`.`parkingFk` AS `parkingFk`,`ish`.`id` AS `itemShelvingFk`,`ish`.`created` AS `created` from ((((`itemShelving` `ish` join `shelving` `sh` on(`sh`.`code` = `ish`.`shelvingFk`)) join `parking` `p` on(`p`.`id` = `sh`.`parkingFk`)) join `sector` `s` on(`s`.`id` = `p`.`sectorFk`)) left join `itemShelvingStockRemoved` `issr` on(`issr`.`itemShelvingFk` = `ish`.`id`)) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87960,7 +88047,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `itemShelvingStockRemoved` AS select `ish`.`id` AS `itemShelvingFk`,`ish`.`itemFk` AS `itemFk`,0 AS `removed` from ((`itemShelving` `ish` left join `itemShelvingSale` `iss` on(`iss`.`itemShelvingFk` = `ish`.`id`)) left join `itemShelvingPlacementSupply` `isps` on(`isps`.`itemShelvingFk` = `ish`.`id`)) group by `ish`.`id` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87978,7 +88065,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `itemTagged` AS select distinct `itemTag`.`itemFk` AS `itemFk` from `itemTag` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -87996,7 +88083,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `itemTaxCountrySpain` AS select `i`.`id` AS `id`,`i`.`name` AS `name`,`i`.`typeFk` AS `typeFk`,`i`.`stems` AS `stems`,`i`.`description` AS `description`,`i`.`intrastatFk` AS `intrastatFk`,`i`.`expenseFk` AS `expenseFk`,`i`.`comment` AS `comment`,`i`.`relevancy` AS `relevancy`,`i`.`image` AS `image`,`i`.`generic` AS `generic`,`itc`.`taxClassFk` AS `taxClassFk` from (`item` `i` join `itemTaxCountry` `itc` on(`itc`.`itemFk` = `i`.`id`)) where `itc`.`countryFk` = 1 */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88014,7 +88101,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `itemTicketOut` AS select `t`.`warehouseFk` AS `warehouseFk`,`t`.`shipped` AS `shipped`,`s`.`itemFk` AS `itemFk`,-`s`.`quantity` AS `quantity`,`s`.`isPicked` AS `isPicked`,`s`.`reserved` AS `reserved`,`t`.`refFk` AS `refFk`,`s`.`id` AS `saleFk`,`s`.`ticketFk` AS `ticketFk` from (`sale` `s` join `ticket` `t` on(`s`.`ticketFk` = `t`.`id`)) where `s`.`quantity` <> 0 */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88032,7 +88119,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `itemTypeL10n` AS select `t`.`id` AS `id`,ifnull(`i`.`name`,`t`.`name`) AS `name` from (`itemType` `t` left join `itemTypeI18n` `i` on(`i`.`typeFk` = `t`.`id` and `i`.`lang` = `util`.`LANG`())) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88050,7 +88137,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `item_Free_Id` AS select `i1`.`id` + 1 AS `newId` from (`item` `i1` left join `item` `i2` on(`i1`.`id` + 1 = `i2`.`id`)) where `i2`.`id` is null and `i1`.`isFloramondo` <> 0 */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88068,7 +88155,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `labelInfo` AS select `i`.`id` AS `itemId`,`i`.`name` AS `itemName`,`b`.`stickers` AS `stickers`,`b`.`printedStickers` AS `life`,`i`.`inkFk` AS `colorCode`,`i`.`stems` AS `stems`,`i`.`category` AS `category`,`i`.`subName` AS `productor`,`b`.`packing` AS `packing`,`clb`.`warehouse_id` AS `warehouse_id`,`i`.`size` AS `size`,`b`.`isPickedOff` AS `isPickedOff`,`e`.`evaNotes` AS `notes`,`w`.`name` AS `wh_in`,`e`.`id` AS `entryId`,`b`.`id` AS `buyId` from (((((`vn`.`buy` `b` join `vn`.`item` `i` on(`i`.`id` = `b`.`itemFk`)) join `cache`.`last_buy` `clb` on(`clb`.`item_id` = `i`.`id`)) join `vn`.`entry` `e` on(`e`.`id` = `b`.`entryFk`)) left join `vn`.`travel` `tr` on(`tr`.`id` = `e`.`travelFk`)) join `vn`.`warehouse` `w` on(`w`.`id` = `tr`.`warehouseInFk`)) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88086,7 +88173,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `lastHourProduction` AS select `t`.`warehouseFk` AS `warehouseFk`,cast(sum(ifnull(`p`.`volume`,`p`.`width` * `p`.`height` * `p`.`depth`) / 1000000) as decimal(5,1)) AS `m3` from (((`warehouse` `w` join `ticket` `t` on(`t`.`warehouseFk` = `w`.`id`)) left join `expedition` `e` on(`t`.`id` = `e`.`ticketFk`)) left join `packaging` `p` on(`p`.`id` = `e`.`packagingFk`)) where `e`.`created` between `util`.`VN_NOW`() - interval 1 hour and `util`.`VN_NOW`() group by `t`.`warehouseFk` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88104,7 +88191,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `lastPurchases` AS select `tr`.`landed` AS `landed`,`w`.`id` AS `warehouseFk`,`w`.`name` AS `warehouse`,`i`.`longName` AS `longName`,`i`.`subName` AS `subName`,`e`.`id` AS `entryFk`,`b`.`stickers` AS `stickers`,`b`.`packing` AS `packing`,`e`.`invoiceNumber` AS `ref`,`b`.`itemFk` AS `itemFk`,`ek`.`pro` AS `pro`,`ek`.`ref` AS `ektRef`,`ek`.`agj` AS `agj` from (((((`vn`.`buy` `b` join `vn`.`entry` `e` on(`e`.`id` = `b`.`entryFk`)) join `vn`.`item` `i` on(`i`.`id` = `b`.`itemFk`)) join `vn`.`travel` `tr` on(`tr`.`id` = `e`.`travelFk`)) join `vn`.`warehouse` `w` on(`w`.`id` = `tr`.`warehouseInFk`)) left join `edi`.`ekt` `ek` on(`ek`.`id` = `b`.`ektFk`)) where `tr`.`landed` between `util`.`yesterday`() and `util`.`tomorrow`() and `e`.`isRaid` = 0 and `b`.`stickers` > 0 */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88122,7 +88209,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `lastTopClaims` AS select `s`.`itemFk` AS `itemFk`,`i`.`longName` AS `itemName`,`it`.`name` AS `itemTypeName`,count(0) AS `claimsNumber`,round(sum(`cb`.`quantity` * `s`.`price` * (1 - (`c`.`responsibility` - 1) / 4) * (100 - `s`.`discount`) / 100),2) AS `claimedAmount`,round(sum(`cb`.`quantity` * `s`.`price` * (100 - `s`.`discount`) / 100),2) AS `totalAmount` from ((((`claim` `c` join `claimBeginning` `cb` on(`cb`.`claimFk` = `c`.`id`)) join `sale` `s` on(`s`.`id` = `cb`.`saleFk`)) join `item` `i` on(`i`.`id` = `s`.`itemFk`)) join `itemType` `it` on(`it`.`id` = `i`.`typeFk`)) where `c`.`created` >= `util`.`VN_CURDATE`() + interval -1 week group by `s`.`itemFk` having `claimedAmount` > 100 and `claimsNumber` > 2 or `claimsNumber` > 4 order by count(0) desc */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88140,7 +88227,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `mistake` AS select `wr`.`code` AS `revisador`,`s`.`concept` AS `concept`,`w`.`code` AS `sacador`,`w`.`firstName` AS `firstName`,`w`.`lastName` AS `lastName`,`mt`.`description` AS `description`,cast(`iss`.`created` as date) AS `created`,`w`.`id` AS `workerFk` from (((((`saleMistake` `sm` join `mistakeType` `mt` on(`mt`.`id` = `sm`.`typeFk`)) join `worker` `wr` on(`wr`.`id` = `sm`.`userFk`)) join `sale` `s` on(`s`.`id` = `sm`.`saleFk`)) join `itemShelvingSale` `iss` on(`iss`.`saleFk` = `sm`.`saleFk`)) join `worker` `w` on(`w`.`id` = `iss`.`userFk`)) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88158,7 +88245,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `mistakeRatio` AS select `wr`.`code` AS `revisador`,`w`.`code` AS `sacador`,`w`.`firstName` AS `firstName`,`w`.`lastName` AS `lastName`,`mt`.`description` AS `description`,cast(`iss`.`created` as date) AS `created`,`w`.`id` AS `workerFk`,`sm`.`saleFk` AS `saleFk` from ((((`itemShelvingSale` `iss` join `worker` `w` on(`w`.`id` = `iss`.`userFk`)) left join `saleMistake` `sm` on(`iss`.`saleFk` = `sm`.`saleFk`)) left join `mistakeType` `mt` on(`mt`.`id` = `sm`.`typeFk`)) left join `worker` `wr` on(`wr`.`id` = `sm`.`userFk`)) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88176,7 +88263,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `newBornSales` AS select `v`.`importe` AS `amount`,`v`.`Id_Cliente` AS `clientFk`,`c`.`salesPersonFk` AS `userFk`,`v`.`fecha` AS `dated`,`cn`.`firstShipped` AS `firstShipped` from ((((`bs`.`clientNewBorn` `cn` join `bs`.`ventas` `v` on(`cn`.`firstShipped` + interval 1 year > `v`.`fecha` and `v`.`Id_Cliente` = `cn`.`clientFk`)) join `vn`.`client` `c` on(`c`.`id` = `v`.`Id_Cliente`)) join `account`.`user` `u` on(`u`.`id` = `c`.`salesPersonFk`)) join `account`.`role` `r` on(`r`.`id` = `u`.`role`)) where `r`.`name` = 'salesPerson' and `u`.`name` not in ('ismaelalcolea','ruben') */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88190,11 +88277,11 @@ USE `vn`;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb3 */;
-/*!50001 SET character_set_results = utf8mb3 */;
-/*!50001 SET collation_connection = utf8mb3_general_ci */;
+/*!50001 SET character_set_client = utf8mb4 */;
+/*!50001 SET character_set_results = utf8mb4 */;
+/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `operatorWorkerCode` AS select `o`.`workerFk` AS `workerFk`,concat(`w`.`firstName`,' ',`w`.`lastName`) AS `fullName`,`w`.`code` AS `code`,`o`.`numberOfWagons` AS `numberOfWagons` from ((`worker` `w` join `operator` `o` on(`o`.`workerFk` = `w`.`id`)) join `sector` `s` on(`o`.`sectorFk` = `s`.`id`)) where `o`.`sectorFk` is not null and `s`.`code` in ('H2','H2','PEQUES_H','ALTILLO COMP','ALTILLO ARTI') */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88212,7 +88299,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `originL10n` AS select `o`.`id` AS `id`,ifnull(`i`.`name`,`o`.`name`) AS `name` from (`origin` `o` left join `originI18n` `i` on(`i`.`originFk` = `o`.`id` and `i`.`lang` = `util`.`lang`())) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88230,7 +88317,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `packageEquivalentItem` AS select `p`.`itemFk` AS `itemFk`,`p2`.`itemFk` AS `equivalentFk` from ((`packageEquivalent` `pe` join `packaging` `p` on(`p`.`id` = `pe`.`packagingFk`)) join `packaging` `p2` on(`p2`.`id` = `pe`.`equivalentFk`)) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88248,7 +88335,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `paymentExchangeInsurance` 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 `exchangeInsurance` `ei` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88266,7 +88353,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `payrollCenter` AS select `b`.`workCenterFkA3` AS `codCenter`,`b`.`companyFkA3` AS `companyCode` from `payrollWorkCenter` `b` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88284,7 +88371,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `personMedia` AS select `c`.`id` AS `workerFk`,ifnull(`c`.`mobile`,`c`.`phone`) AS `mediaValue` from (`client` `c` join `worker` `w` on(`w`.`id` = `c`.`id`)) having `mediaValue` is not null */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88302,7 +88389,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `phoneBook` AS select 'C' AS `Tipo`,`client`.`id` AS `Id`,`client`.`name` AS `Cliente`,`client`.`phone` AS `Telefono` from `client` where `client`.`phone` is not null union select 'C' AS `Tipo`,`client`.`id` AS `Id`,`client`.`name` AS `Cliente`,`client`.`mobile` AS `Movil` from `client` where `client`.`mobile` is not null union select 'C' AS `Tipo`,`clientContact`.`clientFk` AS `clientFk`,`clientContact`.`name` AS `name`,`clientContact`.`phone` AS `phone` from `clientContact` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88320,7 +88407,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `productionVolume` AS select hour(`e`.`created`) AS `hora`,minute(`e`.`created`) AS `minuto`,ifnull(`p`.`volume`,ifnull(`p`.`width` * `p`.`height` * `p`.`depth`,94500)) AS `cm3`,`t`.`warehouseFk` AS `warehouseFk`,`e`.`created` AS `created` from (((`expedition` `e` left join `packaging` `p` on(`p`.`id` = `e`.`packagingFk`)) join `ticket` `t` on(`t`.`id` = `e`.`ticketFk`)) join `client` `c` on(`c`.`id` = `t`.`clientFk`)) where `e`.`created` between `util`.`VN_CURDATE`() and `util`.`dayend`(`util`.`VN_CURDATE`()) and `c`.`isRelevant` <> 0 */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88338,7 +88425,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `productionVolume_LastHour` AS select cast(sum(`productionVolume`.`cm3` / 1000000) as decimal(10,0)) AS `m3`,`productionVolume`.`warehouseFk` AS `warehouseFk` from `productionVolume` where `productionVolume`.`created` > `util`.`VN_NOW`() + interval -1 hour and `productionVolume`.`warehouseFk` in (1,44,60) group by `productionVolume`.`warehouseFk` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88356,7 +88443,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `role` AS select `account`.`role`.`id` AS `id`,`account`.`role`.`name` AS `name`,`account`.`role`.`description` AS `description`,`account`.`role`.`hasLogin` AS `hasLogin` from `account`.`role` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88374,7 +88461,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `routesControl` AS select `t`.`routeFk` AS `routeFk`,count(`e`.`id`) AS `expeditions`,count(`es`.`id`) AS `scanned`,count(distinct `es`.`palletFk`) AS `pallets`,max(`es`.`scanned`) AS `lastScanned`,max(`rs`.`description`) AS `description`,max(`rs`.`eta`) AS `eta` from ((((`ticket` `t` join `expedition` `e` on(`t`.`id` = `e`.`ticketFk`)) left join `expeditionScan` `es` on(`es`.`expeditionFk` = `e`.`id`)) left join `expeditionPallet` `ep` on(`ep`.`id` = `es`.`palletFk`)) left join `roadmapStop` `rs` on(`rs`.`id` = `ep`.`truckFk`)) where `t`.`shipped` >= `util`.`VN_CURDATE`() and `t`.`routeFk` <> 0 group by `t`.`routeFk` order by max(`rs`.`eta`) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88392,7 +88479,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `saleCost` AS select `s`.`itemFk` AS `itemFk`,`s`.`ticketFk` AS `ticketFk`,`s`.`concept` AS `concept`,`s`.`quantity` AS `quantity`,`s`.`discount` AS `discount`,`s`.`price` AS `price`,`c`.`name` AS `component`,`sc`.`value` AS `coste` from (((`sale` `s` join `saleComponent` `sc` on(`sc`.`saleFk` = `s`.`id`)) join `component` `c` on(`c`.`id` = `sc`.`componentFk`)) join `componentType` `ct` on(`ct`.`id` = `c`.`typeFk`)) where `ct`.`code` = 'cost' */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88410,7 +88497,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `saleMistakeList` AS select `st`.`saleFk` AS `saleFk`,`st`.`workerFk` AS `workerFk`,concat(`w2`.`firstName`,' ',`w2`.`lastName`) AS `sacador`,`st`.`created` AS `created`,concat(`w`.`firstName`,' ',`w`.`lastName`) AS `revisador`,`mt`.`description` AS `description`,`sm`.`created` AS `controlled` from (((((`saleTracking` `st` join `worker` `w2` on(`w2`.`id` = `st`.`workerFk`)) join `state` `s` on(`s`.`id` = `st`.`stateFk` and `s`.`code` in ('PREVIOUS_PREPARATION','PREPARED','OK'))) left join `saleMistake` `sm` on(`st`.`saleFk` = `sm`.`saleFk`)) left join `mistakeType` `mt` on(`mt`.`id` = `sm`.`typeFk`)) left join `worker` `w` on(`w`.`id` = `sm`.`userFk`)) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88428,7 +88515,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `saleMistake_list__2` AS select `st`.`saleFk` AS `saleFk`,`st`.`workerFk` AS `workerFk`,concat(`w2`.`firstName`,' ',`w2`.`lastName`) AS `sacador`,`st`.`created` AS `created`,concat(`w`.`firstName`,' ',`w`.`lastName`) AS `revisador`,`mt`.`description` AS `description`,`sm`.`created` AS `controlled` from (((((`saleTracking` `st` join `worker` `w2` on(`w2`.`id` = `st`.`workerFk`)) join `state` `s` on(`s`.`id` = `st`.`stateFk` and `s`.`code` in ('PREVIOUS_PREPARATION','PREPARED','OK'))) left join `saleMistake` `sm` on(`st`.`saleFk` = `sm`.`saleFk`)) left join `mistakeType` `mt` on(`mt`.`id` = `sm`.`typeFk`)) left join `worker` `w` on(`w`.`id` = `sm`.`userFk`)) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88446,7 +88533,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `saleSaleTracking` AS select distinct `st`.`saleFk` AS `saleFk` from `saleTracking` `st` where `st`.`created` >= `util`.`VN_CURDATE`() + interval -1 day */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88464,7 +88551,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `saleValue` AS select `wh`.`name` AS `warehouse`,`c`.`name` AS `client`,`c`.`typeFk` AS `typeFk`,`u`.`name` AS `buyer`,`it`.`id` AS `itemTypeFk`,`it`.`name` AS `family`,`s`.`itemFk` AS `itemFk`,`s`.`concept` AS `concept`,`s`.`quantity` AS `quantity`,`b`.`buyingValue` + `b`.`freightValue` + `b`.`comissionValue` + `b`.`packageValue` AS `cost`,(`b`.`buyingValue` + `b`.`freightValue` + `b`.`comissionValue` + `b`.`packageValue`) * `s`.`quantity` AS `value`,`tm`.`year` AS `year`,`tm`.`week` AS `week` from (((((((((`vn`.`sale` `s` join `vn`.`item` `i` on(`i`.`id` = `s`.`itemFk`)) join `vn`.`itemType` `it` on(`it`.`id` = `i`.`typeFk`)) join `account`.`user` `u` on(`u`.`id` = `it`.`workerFk`)) join `vn`.`ticket` `t` on(`t`.`id` = `s`.`ticketFk`)) join `vn`.`client` `c` on(`c`.`id` = `t`.`clientFk`)) join `vn`.`warehouse` `wh` on(`wh`.`id` = `t`.`warehouseFk`)) join `vn`.`time` `tm` on(`tm`.`dated` = cast(`t`.`shipped` as date))) join `cache`.`last_buy` `lb` on(`lb`.`item_id` = `i`.`id` and `lb`.`warehouse_id` = `wh`.`id`)) join `vn`.`buy` `b` on(`b`.`id` = `lb`.`buy_id`)) where `wh`.`isManaged` <> 0 */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88482,7 +88569,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `saleVolume` AS select `s`.`ticketFk` AS `ticketFk`,`s`.`id` AS `saleFk`,round(`ic`.`cm3delivery` * `s`.`quantity` / 1000,0) AS `litros`,`t`.`routeFk` AS `routeFk`,`t`.`shipped` AS `shipped`,`t`.`landed` AS `landed`,`s`.`quantity` * `ic`.`cm3delivery` / 1000000 AS `volume`,`s`.`quantity` * `ic`.`grams` / 1000 AS `physicalWeight`,`s`.`quantity` * `ic`.`cm3delivery` * greatest(`ic`.`grams` / `ic`.`cm3delivery`,`vc`.`aerealVolumetricDensity`) / 1000000 AS `weight`,`s`.`quantity` * `ic`.`cm3delivery` / 1000000 AS `physicalVolume`,`s`.`quantity` * `ic`.`cm3delivery` * ifnull(`t`.`zonePrice` - ifnull(`t`.`zoneBonus`,0),`z`.`price` - `z`.`bonus`) / (`vc`.`standardFlowerBox` * 1000) * `z`.`inflation` AS `freight`,`t`.`zoneFk` AS `zoneFk`,`t`.`clientFk` AS `clientFk`,`s`.`isPicked` AS `isPicked`,`s`.`quantity` * `s`.`price` * (100 - `s`.`discount`) / 100 AS `eurosValue`,`i`.`itemPackingTypeFk` AS `itemPackingTypeFk` from (((((`sale` `s` join `item` `i` on(`i`.`id` = `s`.`itemFk`)) join `ticket` `t` on(`t`.`id` = `s`.`ticketFk`)) join `zone` `z` on(`z`.`id` = `t`.`zoneFk`)) join `volumeConfig` `vc`) join `itemCost` `ic` FORCE INDEX (PRIMARY) on(`ic`.`itemFk` = `s`.`itemFk` and `ic`.`warehouseFk` = `t`.`warehouseFk`)) where `s`.`quantity` > 0 */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88500,7 +88587,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `saleVolume_Today_VNH` AS select `t`.`nickname` AS `Cliente`,`p`.`name` AS `Provincia`,`c`.`name` AS `Pais`,cast(sum(`sv`.`volume`) as decimal(5,1)) AS `volume` from (((((`saleVolume` `sv` join `ticket` `t` on(`t`.`id` = `sv`.`ticketFk`)) join `address` `a` on(`a`.`id` = `t`.`addressFk`)) join `province` `p` on(`p`.`id` = `a`.`provinceFk`)) join `country` `c` on(`c`.`id` = `p`.`countryFk`)) join `warehouse` `w` on(`w`.`id` = `t`.`warehouseFk`)) where `w`.`name` = 'VNH' and `t`.`shipped` between `util`.`VN_CURDATE`() and `util`.`dayend`(`util`.`VN_CURDATE`()) group by `t`.`nickname`,`p`.`name` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88518,7 +88605,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `sale_freightComponent` AS select `t`.`id` AS `ticketFk`,`sc`.`value` * `s`.`quantity` AS `amount`,`t`.`shipped` AS `shipped` from ((((`ticket` `t` straight_join `sale` `s` on(`t`.`id` = `s`.`ticketFk`)) join `saleComponent` `sc` on(`sc`.`saleFk` = `s`.`id`)) join `component` `c` on(`c`.`id` = `sc`.`componentFk`)) join `componentType` `ct` on(`ct`.`id` = `c`.`typeFk` and `ct`.`code` = 'freight')) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88536,7 +88623,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `salesPersonSince` AS select `b`.`workerFk` AS `workerFk`,min(`b`.`started`) AS `started` from ((`business` `b` join `worker` `w` on(`w`.`id` = `b`.`workerFk`)) left join `professionalCategory` `pc` on(`pc`.`id` = `b`.`workerBusinessProfessionalCategoryFk`)) where `pc`.`description` = 'Aux ventas' group by `b`.`workerFk` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88554,7 +88641,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `salesPreparedLastHour` AS select `t`.`warehouseFk` AS `warehouseFk`,`st`.`saleFk` AS `saleFk`,`st`.`isChecked` AS `isChecked`,`st`.`originalQuantity` AS `originalQuantity`,`st`.`created` AS `created`,`e`.`code` AS `code`,`w`.`firstName` AS `firstname`,`w`.`lastName` AS `lastName`,`w`.`code` AS `workerCode`,`ic`.`cm3delivery` * `s`.`quantity` / 1000 AS `litros`,`s`.`concept` AS `concept`,`d`.`name` AS `departmentName` from ((((((((`saleTracking` `st` left join `salesPreviousPreparated` `prevPrepSales` on(`prevPrepSales`.`saleFk` = `st`.`saleFk`)) join `sale` `s` on(`s`.`id` = `st`.`saleFk`)) join `ticket` `t` on(`t`.`id` = `s`.`ticketFk`)) join `itemCost` `ic` on(`ic`.`warehouseFk` = `t`.`warehouseFk` and `ic`.`itemFk` = `s`.`itemFk`)) join `worker` `w` on(`w`.`id` = `st`.`workerFk`)) join `state` `e` on(`e`.`id` = `st`.`stateFk`)) join `workerDepartment` `wd` on(`wd`.`workerFk` = `st`.`workerFk`)) join `department` `d` on(`d`.`id` = `wd`.`departmentFk`)) where `st`.`created` > `util`.`VN_NOW`() + interval -1 hour and `prevPrepSales`.`saleFk` is null and `d`.`name` not like 'EQUIPO%' */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88572,7 +88659,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `salesPreviousPreparated` AS select `st`.`saleFk` AS `saleFk` from (`saleTracking` `st` join `state` `e` on(`e`.`id` = `st`.`stateFk`)) where `st`.`created` > `util`.`VN_CURDATE`() and `e`.`code` like 'PREVIOUS_PREPARATION' */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88590,7 +88677,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `supplierPackaging` AS select `e`.`supplierFk` AS `supplierFk`,`b`.`itemFk` AS `itemFk`,`i`.`longName` AS `longName`,`s`.`name` AS `supplier`,`b`.`entryFk` AS `entryFk`,`tr`.`landed` AS `landed`,-least(`b`.`quantity`,0) AS `out`,greatest(`b`.`quantity`,0) AS `in`,`w`.`name` AS `warehouse`,`b`.`buyingValue` AS `buyingValue` from ((((((`buy` `b` join `item` `i` on(`i`.`id` = `b`.`itemFk`)) join `packaging` `p` on(`p`.`itemFk` = `i`.`id`)) join `entry` `e` on(`e`.`id` = `b`.`entryFk`)) join `supplier` `s` on(`s`.`id` = `e`.`supplierFk`)) join `travel` `tr` on(`tr`.`id` = `e`.`travelFk`)) join `warehouse` `w` on(`w`.`id` = `tr`.`warehouseInFk`)) where `p`.`isPackageReturnable` <> 0 */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88608,7 +88695,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `tagL10n` AS select `t`.`id` AS `id`,ifnull(`i`.`name`,`t`.`name`) AS `name` from (`tag` `t` left join `tagI18n` `i` on(`i`.`tagFk` = `t`.`id` and `i`.`lang` = `util`.`LANG`())) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88626,7 +88713,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `ticketDownBuffer` AS select `td`.`ticketFk` AS `ticketFk`,`td`.`created` AS `created`,`td`.`selected` AS `selected`,concat(`w`.`firstName`,' ',`w`.`lastName`) AS `sacador`,`pk`.`code` AS `parking` from ((((`ticketDown` `td` join `ticketParking` `tp` on(`tp`.`ticketFk` = `td`.`ticketFk`)) join `parking` `pk` on(`pk`.`id` = `tp`.`parkingFk`)) join `ticketStateToday` `tst` on(`tst`.`ticketFk` = `td`.`ticketFk`)) join `worker` `w` on(`w`.`id` = `tst`.`userFk`)) where `td`.`selected` = 2 */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88644,7 +88731,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `ticketLastUpdated` AS select `ticketLastUpdatedList`.`ticketFk` AS `ticketFk`,max(`ticketLastUpdatedList`.`created`) AS `lastUpdated` from `ticketLastUpdatedList` group by `ticketLastUpdatedList`.`ticketFk` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88662,7 +88749,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `ticketLastUpdatedList` AS select `s`.`ticketFk` AS `ticketFk`,`st`.`created` AS `created` from (`saleTracking` `st` join `sale` `s` on(`s`.`id` = `st`.`saleFk`)) where `st`.`created` > `util`.`VN_CURDATE`() union all select `tt`.`ticketFk` AS `Id_Ticket`,`tt`.`created` AS `odbc_date` from `ticketTracking` `tt` where `tt`.`created` > `util`.`VN_CURDATE`() union all select `s`.`ticketFk` AS `ticketFk`,`iss`.`created` AS `created` from (`itemShelvingSale` `iss` join `sale` `s` on(`s`.`id` = `iss`.`saleFk`)) where `iss`.`created` > `util`.`VN_CURDATE`() */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88680,7 +88767,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `ticketNotInvoiced` AS select `t`.`companyFk` AS `companyFk`,`cm`.`code` AS `companyCode`,`t`.`clientFk` AS `clientFk`,`c`.`name` AS `clientName`,`t`.`shipped` AS `shipped`,cast(sum(`s`.`quantity` * `s`.`price` * (100 - `s`.`discount`) / 100) as decimal(10,2)) AS `value` from (((`ticket` `t` join `sale` `s` on(`s`.`ticketFk` = `t`.`id`)) join `client` `c` on(`c`.`id` = `t`.`clientFk`)) join `company` `cm` on(`cm`.`id` = `t`.`companyFk`)) where `t`.`refFk` is null and `t`.`shipped` > '2017-01-01' group by `t`.`id` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88698,7 +88785,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `ticketPackingList` AS select `t`.`nickname` AS `nickname`,`t`.`id` AS `ticketFk`,`am`.`name` AS `agencyMode`,`am`.`flag` AS `flag`,`p`.`name` AS `province`,`s`.`itemFk` AS `itemFk`,`s`.`concept` AS `concept`,`s`.`quantity` AS `quantity`,`sv`.`litros` AS `litros`,`to`.`description` AS `observaciones` from (((((((`ticket` `t` join `address` `a` on(`a`.`id` = `t`.`addressFk`)) join `province` `p` on(`p`.`id` = `a`.`provinceFk`)) join `agencyMode` `am` on(`am`.`id` = `t`.`agencyModeFk`)) left join `sale` `s` on(`s`.`ticketFk` = `t`.`id`)) left join `saleVolume` `sv` on(`sv`.`saleFk` = `s`.`id`)) join `observationType` `ot` on(`ot`.`code` = 'packager')) left join `ticketObservation` `to` on(`to`.`ticketFk` = `t`.`id` and `ot`.`id` = `to`.`observationTypeFk`)) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88716,7 +88803,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `ticketPreviousPreparingList` AS select `s`.`ticketFk` AS `ticketFk`,`w`.`code` AS `code`,count(`s`.`id`) AS `saleLines`,sum(`s`.`isPicked` <> 0) AS `alreadyMadeSaleLines`,sum(`s`.`isPicked` <> 0) / count(`s`.`id`) AS `madeRate`,`sg`.`created` AS `created`,`p`.`code` AS `parking`,`iss`.`sectorFk` AS `sectorFk`,`al`.`code` AS `alertCode` from (((((((`saleGroup` `sg` join `saleGroupDetail` `sgd` on(`sgd`.`saleGroupFk` = `sg`.`id`)) join `sale` `s` FORCE INDEX (PRIMARY) on(`s`.`id` = `sgd`.`saleFk`)) join `ticketState` `tls` on(`tls`.`ticketFk` = `s`.`ticketFk`)) join `alertLevel` `al` on(`al`.`id` = `tls`.`alertLevel`)) join `worker` `w` on(`w`.`id` = `sg`.`userFk`)) left join `parking` `p` on(`p`.`id` = `sg`.`parkingFk`)) join `itemShelvingStock` `iss` on(`iss`.`itemFk` = `s`.`itemFk`)) where `sg`.`created` >= `util`.`VN_CURDATE`() + interval 0.1 day group by `sg`.`id` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88734,7 +88821,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `ticketState` AS select `tt`.`created` AS `updated`,`tt`.`stateFk` AS `stateFk`,`tt`.`userFk` AS `userFk`,`tls`.`ticketFk` AS `ticketFk`,`s`.`id` AS `state`,`s`.`order` AS `productionOrder`,`s`.`alertLevel` AS `alertLevel`,`s`.`code` AS `code`,`s`.`isPreviousPreparable` AS `isPreviousPreparable`,`s`.`isPicked` AS `isPicked` from ((`ticketLastState` `tls` join `ticketTracking` `tt` on(`tt`.`id` = `tls`.`ticketTrackingFk`)) join `state` `s` on(`s`.`id` = `tt`.`stateFk`)) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88752,7 +88839,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `ticketStateToday` AS select `ts`.`ticketFk` AS `ticketFk`,`ts`.`state` AS `state`,`ts`.`productionOrder` AS `productionOrder`,`ts`.`alertLevel` AS `alertLevel`,`ts`.`userFk` AS `userFk`,`ts`.`code` AS `code`,`ts`.`updated` AS `updated`,`ts`.`isPicked` AS `isPicked` from (`ticketState` `ts` join `ticket` `t` on(`t`.`id` = `ts`.`ticketFk`)) where `t`.`shipped` between `util`.`VN_CURDATE`() and `MIDNIGHT`(`util`.`VN_CURDATE`()) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88770,7 +88857,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `tr2` AS select `travel`.`id` AS `id`,`travel`.`shipped` AS `shipped`,`travel`.`shipmentHour` AS `shipmentHour`,`travel`.`landed` AS `landed`,`travel`.`landingHour` AS `landingHour`,`travel`.`warehouseInFk` AS `warehouseInFk`,`travel`.`warehouseOutFk` AS `warehouseOutFk`,`travel`.`agencyModeFk` AS `agencyFk`,`travel`.`ref` AS `ref`,`travel`.`isDelivered` AS `isDelivered`,`travel`.`isReceived` AS `isReceived`,`travel`.`m3` AS `m3`,`travel`.`kg` AS `kg`,`travel`.`cargoSupplierFk` AS `cargoSupplierFk`,`travel`.`totalEntries` AS `totalEntries` from `travel` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88788,7 +88875,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `traceabilityBuy` AS select `b`.`id` AS `buyFk`,`b`.`quantity` AS `quantity`,`tr`.`landed` AS `landed`,`w`.`name` AS `warehouseName`,`b`.`entryFk` AS `entryFk`,`s`.`name` AS `supplierName`,ifnull(`b`.`itemOriginalFk`,`b`.`itemFk`) AS `itemFk` from ((((`buy` `b` join `entry` `e` on(`e`.`id` = `b`.`entryFk`)) join `travel` `tr` on(`tr`.`id` = `e`.`travelFk`)) join `supplier` `s` on(`s`.`id` = `e`.`supplierFk`)) join `warehouse` `w` on(`w`.`id` = `tr`.`warehouseInFk`)) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88806,7 +88893,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `traceabilitySale` AS select `s`.`ticketFk` AS `ticketFk`,`sb`.`buyFk` AS `buyFk`,`t`.`shipped` AS `shipped`,`t`.`nickname` AS `nickname`,`s`.`quantity` AS `quantity`,concat(`w`.`firstName`,' ',`w`.`lastName`) AS `worker` from (((`saleBuy` `sb` join `sale` `s` on(`s`.`id` = `sb`.`saleFk`)) join `ticket` `t` on(`t`.`id` = `s`.`ticketFk`)) join `worker` `w` on(`w`.`id` = `sb`.`workerFk`)) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88824,7 +88911,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `workerBusinessDated` AS select `t`.`dated` AS `dated`,`b`.`id` AS `businessFk`,`b`.`workerFk` AS `workerFk` from (`time` `t` left join `business` `b` on(`t`.`dated` between `b`.`started` and ifnull(`b`.`ended`,`util`.`VN_CURDATE`()))) where `t`.`dated` > `util`.`VN_CURDATE`() + interval -2 year */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88842,7 +88929,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `workerDepartment` AS select `b`.`workerFk` AS `workerFk`,`b`.`departmentFk` AS `departmentFk` from (`business` `b` join `worker` `w` on(`w`.`businessFk` = `b`.`id`)) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88860,7 +88947,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `workerLabour` AS select `b`.`id` AS `businessFk`,`b`.`workerFk` AS `workerFk`,`b`.`workcenterFk` AS `workCenterFk`,`b`.`started` AS `started`,`b`.`ended` AS `ended`,`b`.`departmentFk` AS `departmentFk`,`b`.`payedHolidays` AS `payedHolidays` from `business` `b` order by `b`.`started` desc */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88878,7 +88965,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `workerMedia` AS select `w`.`id` AS `workerFk`,`w`.`phone` AS `mediaValue` from `worker` `w` where `w`.`phone` is not null */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88896,7 +88983,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `workerSpeedExpedition` AS select `sv`.`ticketFk` AS `ticketFk`,sum(`sv`.`litros`) AS `litros`,sum(if(`sub`.`started` > `util`.`VN_NOW`() + interval -1 hour,`sv`.`litros`,0)) AS `literLastHour`,cast(60 * sum(`sv`.`litros`) / time_to_sec(timediff(max(`sub`.`finished`),min(`sub`.`started`))) as decimal(10,1)) AS `litersByMinute`,`sub`.`code` AS `workerCode`,`sub`.`cajas` AS `cajas`,`sub`.`warehouseFk` AS `warehouseFk` from (`saleVolume` `sv` join `expeditionTimeExpended` `sub` on(`sub`.`ticketFk` = `sv`.`ticketFk`)) group by `sub`.`code` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88914,7 +89001,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `workerSpeedSaleTracking` AS select `salesPreparedLastHour`.`warehouseFk` AS `warehouseFk`,`salesPreparedLastHour`.`code` AS `state`,`salesPreparedLastHour`.`workerCode` AS `workerCode`,sum(`salesPreparedLastHour`.`litros`) AS `sumaLitros`,min(`salesPreparedLastHour`.`created`) AS `started`,max(`salesPreparedLastHour`.`created`) AS `finished`,sum(if(`salesPreparedLastHour`.`created` >= `util`.`VN_NOW`() + interval -1 hour,`salesPreparedLastHour`.`litros`,0)) AS `sumaLitrosLastHour`,cast(60 * sum(`salesPreparedLastHour`.`litros`) / time_to_sec(timediff(max(`salesPreparedLastHour`.`created`),min(`salesPreparedLastHour`.`created`))) as decimal(10,1)) AS `litersByMinute`,`salesPreparedLastHour`.`departmentName` AS `departmentName` from `salesPreparedLastHour` group by `salesPreparedLastHour`.`warehouseFk`,`salesPreparedLastHour`.`code`,`salesPreparedLastHour`.`workerCode` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88932,7 +89019,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `workerTeamCollegues` AS select distinct `w`.`workerFk` AS `workerFk`,`t`.`workerFk` AS `collegueFk` from (`workerTeam` `w` join `workerTeam` `t` on(`w`.`team` = `t`.`team`)) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88950,7 +89037,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `workerTimeControlUserInfo` AS select `u`.`id` AS `userFk`,`w`.`firstName` AS `name`,`w`.`lastName` AS `surname`,`u`.`name` AS `user`,`u`.`password` AS `password`,`wd`.`departmentFk` AS `departmentFk`,left(`c`.`fi`,8) AS `dni` from (((`account`.`user` `u` join `vn`.`worker` `w` on(`w`.`id` = `u`.`id`)) join `vn`.`client` `c` on(`c`.`id` = `u`.`id`)) left join `vn`.`workerDepartment` `wd` on(`wd`.`workerFk` = `w`.`id`)) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88968,7 +89055,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `workerTimeJourneyNG` AS select `wtc`.`userFk` AS `userFk`,cast(`wtc`.`timed` as date) AS `dated`,if(`wtc`.`order` MOD 2,-1,1) * (hour(`wtc`.`timed`) + minute(`wtc`.`timed`) / 60) AS `Journey`,dayname(`wtc`.`timed`) AS `dayName`,`w`.`lastName` AS `name`,`w`.`firstName` AS `firstname` from (`workerTimeControl` `wtc` join `worker` `w` on(`w`.`id` = `wtc`.`userFk`)) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -88986,7 +89073,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `workerWithoutTractor` AS select `c`.`workerFk` AS `workerFk`,`cl`.`name` AS `Trabajador`,count(distinct `c`.`id`) AS `Colecciones`,max(`c`.`created`) AS `created` from ((`collection` `c` join `client` `cl` on(`cl`.`id` = `c`.`workerFk`)) left join `machineWorker` `mw` on(`mw`.`workerFk` = `c`.`workerFk` and `mw`.`inTimed` > `util`.`VN_CURDATE`())) where `c`.`created` > `util`.`VN_CURDATE`() and `mw`.`workerFk` is null group by `c`.`workerFk` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -89004,7 +89091,7 @@ USE `vn`;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50013 DEFINER=`vn`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `zoneEstimatedDelivery` AS select `t`.`zoneFk` AS `zoneFk`,`zc`.`hour` AS `zoneClosureHour`,`z`.`hour` AS `zoneHour`,`sv`.`volume` AS `volume`,`al`.`hasToRecalcPrice` AS `hasToRecalcPrice`,`lhp`.`m3` AS `m3`,`dl`.`minSpeed` AS `minSpeed` from (((((((((`vn`.`ticket` `t` join `vn`.`ticketStateToday` `tst` on(`tst`.`ticketFk` = `t`.`id`)) join `vn`.`state` `s` on(`s`.`id` = `tst`.`state`)) join `vn`.`saleVolume` `sv` on(`sv`.`ticketFk` = `t`.`id`)) left join `vn`.`lastHourProduction` `lhp` on(`lhp`.`warehouseFk` = `t`.`warehouseFk`)) join `vn`.`warehouse` `w` on(`w`.`id` = `t`.`warehouseFk`)) straight_join `vn`.`zone` `z` on(`z`.`id` = `t`.`zoneFk`)) left join `vn`.`zoneClosure` `zc` on(`zc`.`zoneFk` = `t`.`zoneFk` and `zc`.`dated` = `util`.`VN_CURDATE`())) left join `cache`.`departure_limit` `dl` on(`dl`.`warehouse_id` = `t`.`warehouseFk` and `dl`.`fecha` = `util`.`VN_CURDATE`())) join `vn`.`alertLevel` `al` on(`al`.`id` = `s`.`alertLevel`)) where `w`.`hasProduction` <> 0 and cast(`t`.`shipped` as date) = `util`.`VN_CURDATE`() */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -90739,7 +90826,7 @@ USE `vn2008`;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `mandato_tipo` AS select `m`.`id` AS `idmandato_tipo`,`m`.`name` AS `Nombre` from `vn`.`mandateType` `m` */;
+/*!50001 VIEW `mandato_tipo` AS select `m`.`id` AS `idmandato_tipo`,`m`.`code` AS `Nombre` from `vn`.`mandateType` `m` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
@@ -91419,4 +91506,4 @@ USE `vn2008`;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
--- Dump completed on 2024-08-20 7:45:07
+-- Dump completed on 2024-09-18 9:32:42
diff --git a/db/dump/.dump/triggers.sql b/db/dump/.dump/triggers.sql
index a968277b9..b0879a9c5 100644
--- a/db/dump/.dump/triggers.sql
+++ b/db/dump/.dump/triggers.sql
@@ -1,4 +1,5 @@
--- MariaDB dump 10.19 Distrib 10.5.23-MariaDB, for debian-linux-gnu (x86_64)
+/*M!999999\- enable the sandbox mode */
+-- MariaDB dump 10.19 Distrib 10.5.26-MariaDB, for debian-linux-gnu (x86_64)
--
-- Host: db.verdnatura.es Database: account
-- ------------------------------------------------------
@@ -1502,6 +1503,134 @@ USE `srt`;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `srt`.`buffer_beforeInsert`
+ BEFORE INSERT ON `buffer`
+ FOR EACH ROW
+BEGIN
+ SET NEW.editorFk = account.myUser_getId();
+END */;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `srt`.`buffer_beforeUpdate`
+ BEFORE UPDATE ON `buffer`
+ FOR EACH ROW
+BEGIN
+ SET NEW.editorFk = account.myUser_getId();
+END */;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `srt`.`buffer_afterDelete`
+ AFTER DELETE ON `buffer`
+ FOR EACH ROW
+BEGIN
+ INSERT INTO buffer
+ SET `action` = 'delete',
+ `changedModel` = 'Buffer',
+ `changedModelId` = OLD.id,
+ `userFk` = account.myUser_getId();
+END */;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `srt`.`config_beforeInsert`
+ BEFORE INSERT ON `config`
+ FOR EACH ROW
+BEGIN
+ SET NEW.editorFk = account.myUser_getId();
+END */;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `srt`.`config_beforeUpdate`
+ BEFORE UPDATE ON `config`
+ FOR EACH ROW
+BEGIN
+ SET NEW.editorFk = account.myUser_getId();
+END */;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `srt`.`config_afterDelete`
+ AFTER DELETE ON `config`
+ FOR EACH ROW
+BEGIN
+ INSERT INTO config
+ SET `action` = 'delete',
+ `changedModel` = 'Config',
+ `changedModelId` = OLD.id,
+ `userFk` = account.myUser_getId();
+END */;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `srt`.`expedition_beforeUpdate`
BEFORE UPDATE ON `expedition`
FOR EACH ROW
@@ -1699,13 +1828,13 @@ USE `vn`;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`XDiario_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`XDiario_beforeInsert`
BEFORE INSERT ON `XDiario`
FOR EACH ROW
BEGIN
@@ -1735,13 +1864,13 @@ DELIMITER ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`XDiario_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`XDiario_beforeUpdate`
BEFORE UPDATE ON `XDiario`
FOR EACH ROW
BEGIN
@@ -1791,7 +1920,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`accountReconciliation_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`accountReconciliation_beforeInsert`
BEFORE INSERT ON `accountReconciliation`
FOR EACH ROW
@@ -1818,7 +1947,31 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`address_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`address_afterInsert`
+ BEFORE INSERT ON `address`
+ FOR EACH ROW
+BEGIN
+ IF (SELECT client_hasDifferentCountries(NEW.clientFk)) THEN
+ UPDATE client
+ SET hasToInvoiceByAddress = TRUE
+ WHERE id = NEW.clientFk;
+ END IF;
+END */;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`address_beforeInsert`
BEFORE INSERT ON `address`
FOR EACH ROW
BEGIN
@@ -1857,31 +2010,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`address_afterInsert`
- BEFORE INSERT ON `address`
- FOR EACH ROW
-BEGIN
- IF (SELECT client_hasDifferentCountries(NEW.clientFk)) THEN
- UPDATE client
- SET hasToInvoiceByAddress = TRUE
- WHERE id = NEW.clientFk;
- END IF;
-END */;;
-DELIMITER ;
-/*!50003 SET sql_mode = @saved_sql_mode */ ;
-/*!50003 SET character_set_client = @saved_cs_client */ ;
-/*!50003 SET character_set_results = @saved_cs_results */ ;
-/*!50003 SET collation_connection = @saved_col_connection */ ;
-/*!50003 SET @saved_cs_client = @@character_set_client */ ;
-/*!50003 SET @saved_cs_results = @@character_set_results */ ;
-/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb4 */ ;
-/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
-DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`address_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`address_beforeUpdate`
BEFORE UPDATE ON `address`
FOR EACH ROW
BEGIN
@@ -1911,7 +2040,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`address_afterUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`address_afterUpdate`
AFTER UPDATE ON `address`
FOR EACH ROW
BEGIN
@@ -1959,7 +2088,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`address_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`address_afterDelete`
AFTER DELETE ON `address`
FOR EACH ROW
BEGIN
@@ -1983,7 +2112,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`agency_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`agency_beforeInsert`
BEFORE INSERT ON `agency`
FOR EACH ROW
BEGIN
@@ -2003,7 +2132,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`agency_afterInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`agency_afterInsert`
AFTER INSERT ON `agency`
FOR EACH ROW
BEGIN
@@ -2023,7 +2152,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`autonomy_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`autonomy_beforeInsert`
BEFORE INSERT ON `autonomy`
FOR EACH ROW
BEGIN
@@ -2045,7 +2174,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`autonomy_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`autonomy_beforeUpdate`
BEFORE UPDATE ON `autonomy`
FOR EACH ROW
BEGIN
@@ -2073,7 +2202,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`autonomy_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`autonomy_afterDelete`
AFTER DELETE ON `autonomy`
FOR EACH ROW
BEGIN
@@ -2093,7 +2222,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`awb_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`awb_beforeInsert`
BEFORE INSERT ON `awb`
FOR EACH ROW
BEGIN
@@ -2116,7 +2245,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`awbInvoiceIn_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`awbInvoiceIn_afterDelete`
AFTER DELETE ON `awbInvoiceIn`
FOR EACH ROW
BEGIN
@@ -2143,7 +2272,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`bankEntity_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`bankEntity_beforeInsert`
BEFORE INSERT ON `bankEntity`
FOR EACH ROW
BEGIN
@@ -2163,7 +2292,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`bankEntity_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`bankEntity_beforeUpdate`
BEFORE UPDATE ON `bankEntity`
FOR EACH ROW
BEGIN
@@ -2185,7 +2314,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`budgetNotes_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`budgetNotes_beforeInsert`
BEFORE INSERT ON `budgetNotes`
FOR EACH ROW
BEGIN
@@ -2211,7 +2340,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`business_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`business_beforeInsert`
BEFORE INSERT ON `business`
FOR EACH ROW
BEGIN
@@ -2235,7 +2364,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`business_afterInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`business_afterInsert`
AFTER INSERT ON `business`
FOR EACH ROW
BEGIN
@@ -2255,7 +2384,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`business_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`business_beforeUpdate`
BEFORE UPDATE ON `business`
FOR EACH ROW
BEGIN
@@ -2299,7 +2428,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`business_afterUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`business_afterUpdate`
AFTER UPDATE ON `business`
FOR EACH ROW
BEGIN
@@ -2323,7 +2452,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`business_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`business_afterDelete`
AFTER DELETE ON `business`
FOR EACH ROW
BEGIN
@@ -2349,7 +2478,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`buy_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`buy_beforeInsert`
BEFORE INSERT ON `buy`
FOR EACH ROW
trig: BEGIN
@@ -2454,7 +2583,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`buy_afterInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`buy_afterInsert`
AFTER INSERT ON `buy`
FOR EACH ROW
trig: BEGIN
@@ -2478,7 +2607,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`buy_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`buy_beforeUpdate`
BEFORE UPDATE ON `buy`
FOR EACH ROW
trig:BEGIN
@@ -2548,6 +2677,10 @@ trig:BEGIN
IF NOT NEW.printedStickers <=> OLD.printedStickers THEN
CALL util.throw("Stickers cannot be modified if they are inventory");
END IF;
+
+ IF OLD.entryFk <> NEW.entryFk THEN
+ CALL util.throw("Cannot transfer lines to inventory entry");
+ END IF;
END IF;
IF NEW.quantity < 0 THEN
@@ -2584,7 +2717,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`buy_afterUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`buy_afterUpdate`
AFTER UPDATE ON `buy`
FOR EACH ROW
trig: BEGIN
@@ -2645,7 +2778,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`buy_beforeDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`buy_beforeDelete`
BEFORE DELETE ON `buy`
FOR EACH ROW
BEGIN
@@ -2668,7 +2801,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`buy_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`buy_afterDelete`
AFTER DELETE ON `buy`
FOR EACH ROW
trig: BEGIN
@@ -2696,7 +2829,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`calendar_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`calendar_beforeInsert`
BEFORE INSERT ON `calendar`
FOR EACH ROW
BEGIN
@@ -2716,11 +2849,11 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`calendar_beforeUpdate`
- BEFORE UPDATE ON `calendar`
- FOR EACH ROW
-BEGIN
- SET NEW.editorFk = account.myUser_getId();
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`calendar_beforeUpdate`
+ BEFORE UPDATE ON `calendar`
+ FOR EACH ROW
+BEGIN
+ SET NEW.editorFk = account.myUser_getId();
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -2736,15 +2869,15 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`calendar_afterDelete`
- AFTER DELETE ON `calendar`
- FOR EACH ROW
-BEGIN
- INSERT INTO workerLog
- SET `action` = 'delete',
- `changedModel` = 'Calendar',
- `changedModelId` = OLD.id,
- `userFk` = account.myUser_getId();
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`calendar_afterDelete`
+ AFTER DELETE ON `calendar`
+ FOR EACH ROW
+BEGIN
+ INSERT INTO workerLog
+ SET `action` = 'delete',
+ `changedModel` = 'Calendar',
+ `changedModelId` = OLD.id,
+ `userFk` = account.myUser_getId();
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -2760,7 +2893,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`claim_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`claim_beforeInsert`
BEFORE INSERT ON `claim`
FOR EACH ROW
BEGIN
@@ -2780,7 +2913,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`claim_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`claim_beforeUpdate`
BEFORE UPDATE ON `claim`
FOR EACH ROW
BEGIN
@@ -2800,7 +2933,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`claim_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`claim_afterDelete`
AFTER DELETE ON `claim`
FOR EACH ROW
BEGIN
@@ -2824,7 +2957,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimBeginning_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimBeginning_beforeInsert`
BEFORE INSERT ON `claimBeginning`
FOR EACH ROW
BEGIN
@@ -2844,7 +2977,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimBeginning_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimBeginning_beforeUpdate`
BEFORE UPDATE ON `claimBeginning`
FOR EACH ROW
BEGIN
@@ -2864,7 +2997,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimBeginning_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimBeginning_afterDelete`
AFTER DELETE ON `claimBeginning`
FOR EACH ROW
BEGIN
@@ -2888,7 +3021,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimDevelopment_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimDevelopment_beforeInsert`
BEFORE INSERT ON `claimDevelopment`
FOR EACH ROW
BEGIN
@@ -2908,7 +3041,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimDevelopment_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimDevelopment_beforeUpdate`
BEFORE UPDATE ON `claimDevelopment`
FOR EACH ROW
BEGIN
@@ -2928,7 +3061,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimDevelopment_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimDevelopment_afterDelete`
AFTER DELETE ON `claimDevelopment`
FOR EACH ROW
BEGIN
@@ -2952,7 +3085,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimDms_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimDms_beforeInsert`
BEFORE INSERT ON `claimDms`
FOR EACH ROW
BEGIN
@@ -2972,7 +3105,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimDms_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimDms_beforeUpdate`
BEFORE UPDATE ON `claimDms`
FOR EACH ROW
BEGIN
@@ -2992,7 +3125,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimDms_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimDms_afterDelete`
AFTER DELETE ON `claimDms`
FOR EACH ROW
BEGIN
@@ -3016,7 +3149,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimEnd_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimEnd_beforeInsert`
BEFORE INSERT ON `claimEnd`
FOR EACH ROW
BEGIN
@@ -3036,7 +3169,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimEnd_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimEnd_beforeUpdate`
BEFORE UPDATE ON `claimEnd`
FOR EACH ROW
BEGIN
@@ -3056,7 +3189,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimEnd_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimEnd_afterDelete`
AFTER DELETE ON `claimEnd`
FOR EACH ROW
BEGIN
@@ -3080,7 +3213,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimObservation_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimObservation_beforeInsert`
BEFORE INSERT ON `claimObservation`
FOR EACH ROW
BEGIN
@@ -3100,7 +3233,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimObservation_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimObservation_beforeUpdate`
BEFORE UPDATE ON `claimObservation`
FOR EACH ROW
BEGIN
@@ -3120,7 +3253,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimObservation_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimObservation_afterDelete`
AFTER DELETE ON `claimObservation`
FOR EACH ROW
BEGIN
@@ -3144,7 +3277,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimRatio_afterInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimRatio_afterInsert`
AFTER INSERT ON `claimRatio`
FOR EACH ROW
BEGIN
@@ -3167,7 +3300,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimRatio_afterUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimRatio_afterUpdate`
AFTER UPDATE ON `claimRatio`
FOR EACH ROW
BEGIN
@@ -3190,7 +3323,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimState_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimState_beforeInsert`
BEFORE INSERT ON `claimState`
FOR EACH ROW
BEGIN
@@ -3210,7 +3343,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimState_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimState_beforeUpdate`
BEFORE UPDATE ON `claimState`
FOR EACH ROW
BEGIN
@@ -3230,7 +3363,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimState_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimState_afterDelete`
AFTER DELETE ON `claimState`
FOR EACH ROW
BEGIN
@@ -3254,7 +3387,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`client_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`client_beforeInsert`
BEFORE INSERT ON `client`
FOR EACH ROW
BEGIN
@@ -3287,7 +3420,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`client_afterInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`client_afterInsert`
AFTER INSERT ON `client`
FOR EACH ROW
BEGIN
@@ -3312,7 +3445,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`client_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`client_beforeUpdate`
BEFORE UPDATE ON `client`
FOR EACH ROW
BEGIN
@@ -3400,7 +3533,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`client_afterUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`client_afterUpdate`
AFTER UPDATE ON `client`
FOR EACH ROW
BEGIN
@@ -3449,7 +3582,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`client_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`client_afterDelete`
AFTER DELETE ON `client`
FOR EACH ROW
BEGIN
@@ -3473,7 +3606,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`clientContact_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`clientContact_beforeInsert`
BEFORE INSERT ON `clientContact`
FOR EACH ROW
BEGIN
@@ -3493,7 +3626,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`clientContact_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`clientContact_afterDelete`
AFTER DELETE ON `clientContact`
FOR EACH ROW
BEGIN
@@ -3517,7 +3650,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`clientCredit_afterInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`clientCredit_afterInsert`
AFTER INSERT ON `clientCredit`
FOR EACH ROW
BEGIN
@@ -3552,7 +3685,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`clientDms_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`clientDms_beforeInsert`
BEFORE INSERT ON `clientDms`
FOR EACH ROW
BEGIN
@@ -3572,7 +3705,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`clientDms_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`clientDms_beforeUpdate`
BEFORE UPDATE ON `clientDms`
FOR EACH ROW
BEGIN
@@ -3592,7 +3725,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`clientDms_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`clientDms_afterDelete`
AFTER DELETE ON `clientDms`
FOR EACH ROW
BEGIN
@@ -3616,7 +3749,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`clientObservation_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`clientObservation_beforeInsert`
BEFORE INSERT ON `clientObservation`
FOR EACH ROW
BEGIN
@@ -3636,7 +3769,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`clientObservation_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`clientObservation_beforeUpdate`
BEFORE UPDATE ON `clientObservation`
FOR EACH ROW
BEGIN
@@ -3656,7 +3789,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`clientObservation_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`clientObservation_afterDelete`
AFTER DELETE ON `clientObservation`
FOR EACH ROW
BEGIN
@@ -3680,7 +3813,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`clientSample_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`clientSample_beforeInsert`
BEFORE INSERT ON `clientSample`
FOR EACH ROW
BEGIN
@@ -3700,7 +3833,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`clientSample_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`clientSample_beforeUpdate`
BEFORE UPDATE ON `clientSample`
FOR EACH ROW
BEGIN
@@ -3720,7 +3853,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`clientSample_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`clientSample_afterDelete`
AFTER DELETE ON `clientSample`
FOR EACH ROW
BEGIN
@@ -3744,7 +3877,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`clientUnpaid_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`clientUnpaid_beforeInsert`
BEFORE INSERT ON `clientUnpaid`
FOR EACH ROW
BEGIN
@@ -3764,7 +3897,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`clientUnpaid_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`clientUnpaid_beforeUpdate`
BEFORE UPDATE ON `clientUnpaid`
FOR EACH ROW
BEGIN
@@ -3784,7 +3917,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`cmr_beforeDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`cmr_beforeDelete`
BEFORE DELETE ON `cmr`
FOR EACH ROW
BEGIN
@@ -3806,7 +3939,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`collection_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`collection_beforeUpdate`
BEFORE UPDATE ON `collection`
FOR EACH ROW
BEGIN
@@ -3854,9 +3987,9 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER vn.collectionColors_beforeInsert
-BEFORE INSERT
-ON collectionColors FOR EACH ROW
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`collectionColors_beforeInsert`
+ BEFORE INSERT ON `collectionColors`
+ FOR EACH ROW
BEGIN
CALL util.checkHex(NEW.rgb);
END */;;
@@ -3874,7 +4007,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`collectionColors_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`collectionColors_beforeUpdate`
BEFORE UPDATE ON `collectionColors`
FOR EACH ROW
BEGIN
@@ -3894,7 +4027,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`collectionVolumetry_afterInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`collectionVolumetry_afterInsert`
AFTER INSERT ON `collectionVolumetry`
FOR EACH ROW
BEGIN
@@ -3932,7 +4065,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`collectionVolumetry_afterUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`collectionVolumetry_afterUpdate`
AFTER UPDATE ON `collectionVolumetry`
FOR EACH ROW
BEGIN
@@ -3990,7 +4123,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`collectionVolumetry_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`collectionVolumetry_afterDelete`
AFTER DELETE ON `collectionVolumetry`
FOR EACH ROW
BEGIN
@@ -4028,7 +4161,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`country_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`country_beforeInsert`
BEFORE INSERT ON `country`
FOR EACH ROW
BEGIN
@@ -4048,7 +4181,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`country_afterInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`country_afterInsert`
AFTER INSERT ON `country`
FOR EACH ROW
BEGIN
@@ -4082,7 +4215,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`country_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`country_beforeUpdate`
BEFORE UPDATE ON `country`
FOR EACH ROW
BEGIN
@@ -4104,7 +4237,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`country_afterUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`country_afterUpdate`
AFTER UPDATE ON `country`
FOR EACH ROW
BEGIN
@@ -4127,7 +4260,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`country_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`country_afterDelete`
AFTER DELETE ON `country`
FOR EACH ROW
BEGIN
@@ -4147,7 +4280,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`creditClassification_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`creditClassification_beforeUpdate`
BEFORE UPDATE ON `creditClassification`
FOR EACH ROW
BEGIN
@@ -4167,13 +4300,13 @@ DELIMITER ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`creditInsurance_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`creditInsurance_beforeInsert`
BEFORE INSERT ON `creditInsurance`
FOR EACH ROW
BEGIN
@@ -4195,7 +4328,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`creditInsurance_afterInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`creditInsurance_afterInsert`
AFTER INSERT ON `creditInsurance`
FOR EACH ROW
BEGIN
@@ -4218,7 +4351,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`delivery_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`delivery_beforeInsert`
BEFORE INSERT ON `delivery`
FOR EACH ROW
BEGIN
@@ -4243,7 +4376,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`delivery_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`delivery_beforeUpdate`
BEFORE UPDATE ON `delivery`
FOR EACH ROW
BEGIN
@@ -4268,7 +4401,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`department_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`department_beforeInsert`
BEFORE INSERT ON `department`
FOR EACH ROW
BEGIN
@@ -4288,7 +4421,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`department_afterUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`department_afterUpdate`
AFTER UPDATE ON `department`
FOR EACH ROW
BEGIN
@@ -4317,7 +4450,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`department_beforeDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`department_beforeDelete`
BEFORE DELETE ON `department`
FOR EACH ROW
BEGIN
@@ -4342,7 +4475,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`department_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`department_afterDelete`
AFTER DELETE ON `department`
FOR EACH ROW
BEGIN
@@ -4368,7 +4501,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProduction_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProduction_beforeInsert`
BEFORE INSERT ON `deviceProduction`
FOR EACH ROW
BEGIN
@@ -4388,7 +4521,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProduction_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProduction_beforeUpdate`
BEFORE UPDATE ON `deviceProduction`
FOR EACH ROW
BEGIN
@@ -4408,7 +4541,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProduction_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProduction_afterDelete`
AFTER DELETE ON `deviceProduction`
FOR EACH ROW
BEGIN
@@ -4432,7 +4565,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProductionModels_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProductionModels_beforeInsert`
BEFORE INSERT ON `deviceProductionModels`
FOR EACH ROW
BEGIN
@@ -4452,7 +4585,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProductionModels_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProductionModels_beforeUpdate`
BEFORE UPDATE ON `deviceProductionModels`
FOR EACH ROW
BEGIN
@@ -4472,7 +4605,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProductionState_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProductionState_beforeInsert`
BEFORE INSERT ON `deviceProductionState`
FOR EACH ROW
BEGIN
@@ -4492,7 +4625,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProductionState_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProductionState_beforeUpdate`
BEFORE UPDATE ON `deviceProductionState`
FOR EACH ROW
BEGIN
@@ -4512,7 +4645,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProductionUser_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProductionUser_beforeInsert`
BEFORE INSERT ON `deviceProductionUser`
FOR EACH ROW
BEGIN
@@ -4532,7 +4665,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProductionUser_afterInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProductionUser_afterInsert`
AFTER INSERT ON `deviceProductionUser`
FOR EACH ROW
BEGIN
@@ -4552,7 +4685,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProductionUser_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProductionUser_beforeUpdate`
BEFORE UPDATE ON `deviceProductionUser`
FOR EACH ROW
BEGIN
@@ -4574,7 +4707,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProductionUser_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProductionUser_afterDelete`
AFTER DELETE ON `deviceProductionUser`
FOR EACH ROW
BEGIN
@@ -4598,7 +4731,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`dms_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`dms_beforeInsert`
BEFORE INSERT ON `dms`
FOR EACH ROW
BEGIN
@@ -4631,13 +4764,13 @@ DELIMITER ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`dms_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`dms_beforeUpdate`
BEFORE UPDATE ON `dms`
FOR EACH ROW
BEGIN
@@ -4677,7 +4810,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`dms_beforeDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`dms_beforeDelete`
BEFORE DELETE ON `dms`
FOR EACH ROW
BEGIN
@@ -4705,7 +4838,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`duaTax_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`duaTax_beforeInsert`
BEFORE INSERT ON `duaTax`
FOR EACH ROW
BEGIN
@@ -4726,7 +4859,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`duaTax_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`duaTax_beforeUpdate`
BEFORE UPDATE ON `duaTax`
FOR EACH ROW
BEGIN
@@ -4747,10 +4880,10 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER ektEntryAssign_afterInsert
-AFTER INSERT
-ON ektEntryAssign FOR EACH ROW
- UPDATE entry SET reference = NEW.`ref` WHERE id = NEW.entryFk */;;
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ektEntryAssign_afterInsert`
+ AFTER INSERT ON `ektEntryAssign`
+ FOR EACH ROW
+UPDATE entry SET reference = NEW.`ref` WHERE id = NEW.entryFk */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -4765,8 +4898,8 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER vn.ektEntryAssign_afterUpdate
- AFTER UPDATE ON ektEntryAssign
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ektEntryAssign_afterUpdate`
+ AFTER UPDATE ON `ektEntryAssign`
FOR EACH ROW
BEGIN
IF NOT(NEW.`ref` <=> OLD.`ref`) OR NOT(NEW.`entryFk` <=> OLD.`entryFk`) THEN
@@ -4787,7 +4920,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`entry_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`entry_beforeInsert`
BEFORE INSERT ON `entry`
FOR EACH ROW
BEGIN
@@ -4813,7 +4946,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`entry_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`entry_beforeUpdate`
BEFORE UPDATE ON `entry`
FOR EACH ROW
BEGIN
@@ -4903,7 +5036,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`entry_afterUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`entry_afterUpdate`
AFTER UPDATE ON `entry`
FOR EACH ROW
BEGIN
@@ -4930,7 +5063,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`entry_beforeDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`entry_beforeDelete`
BEFORE DELETE ON `entry`
FOR EACH ROW
BEGIN
@@ -4951,7 +5084,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`entry_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`entry_afterDelete`
AFTER DELETE ON `entry`
FOR EACH ROW
BEGIN
@@ -4975,7 +5108,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`entryDms_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`entryDms_beforeInsert`
BEFORE INSERT ON `entryDms`
FOR EACH ROW
BEGIN
@@ -4995,7 +5128,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`entryDms_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`entryDms_beforeUpdate`
BEFORE UPDATE ON `entryDms`
FOR EACH ROW
BEGIN
@@ -5015,7 +5148,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`entryDms_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`entryDms_afterDelete`
AFTER DELETE ON `entryDms`
FOR EACH ROW
BEGIN
@@ -5039,7 +5172,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`entryObservation_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`entryObservation_beforeInsert`
BEFORE INSERT ON `entryObservation`
FOR EACH ROW
BEGIN
@@ -5059,7 +5192,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`entryObservation_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`entryObservation_beforeUpdate`
BEFORE UPDATE ON `entryObservation`
FOR EACH ROW
BEGIN
@@ -5079,7 +5212,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`entryObservation_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`entryObservation_afterDelete`
AFTER DELETE ON `entryObservation`
FOR EACH ROW
BEGIN
@@ -5103,7 +5236,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expedition_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`expedition_beforeInsert`
BEFORE INSERT ON `expedition`
FOR EACH ROW
BEGIN
@@ -5142,7 +5275,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expedition_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`expedition_beforeUpdate`
BEFORE UPDATE ON `expedition`
FOR EACH ROW
BEGIN
@@ -5171,7 +5304,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expedition_beforeDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`expedition_beforeDelete`
BEFORE DELETE ON `expedition`
FOR EACH ROW
BEGIN
@@ -5195,7 +5328,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expedition_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`expedition_afterDelete`
AFTER DELETE ON `expedition`
FOR EACH ROW
BEGIN
@@ -5219,7 +5352,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionPallet_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionPallet_beforeInsert`
BEFORE INSERT ON `expeditionPallet`
FOR EACH ROW
BEGIN
@@ -5247,7 +5380,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionScan_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionScan_beforeInsert`
BEFORE INSERT ON `expeditionScan`
FOR EACH ROW
BEGIN
@@ -5269,7 +5402,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionState_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionState_beforeInsert`
BEFORE INSERT ON `expeditionState`
FOR EACH ROW
BEGIN
@@ -5289,7 +5422,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionState_afterInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionState_afterInsert`
AFTER INSERT ON `expeditionState`
FOR EACH ROW
BEGIN
@@ -5313,7 +5446,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`floramondoConfig_afterInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`floramondoConfig_afterInsert`
AFTER INSERT ON `floramondoConfig`
FOR EACH ROW
BEGIN
@@ -5333,8 +5466,8 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`gregue_beforeInsert`
- BEFORE INSERT ON greuge
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`gregue_beforeInsert`
+ BEFORE INSERT ON `greuge`
FOR EACH ROW
BEGIN
IF NEW.userFk IS NULL THEN
@@ -5355,7 +5488,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`greuge_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`greuge_beforeInsert`
BEFORE INSERT ON `greuge`
FOR EACH ROW
BEGIN
@@ -5375,7 +5508,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`greuge_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`greuge_beforeUpdate`
BEFORE UPDATE ON `greuge`
FOR EACH ROW
BEGIN
@@ -5395,7 +5528,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`greuge_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`greuge_afterDelete`
AFTER DELETE ON `greuge`
FOR EACH ROW
BEGIN
@@ -5419,11 +5552,11 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`host_beforeUpdate`
- BEFORE UPDATE ON `host`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`host_beforeInsert`
+ BEFORE INSERT ON `host`
FOR EACH ROW
BEGIN
- SET new.updated = util.VN_NOW();
+ SET NEW.editorFk = account.myUser_getId();
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -5439,7 +5572,28 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceIn_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`host_beforeUpdate`
+ BEFORE UPDATE ON `host`
+ FOR EACH ROW
+BEGIN
+ SET new.updated = util.VN_NOW();
+ SET NEW.editorFk = account.myUser_getId();
+END */;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceIn_beforeInsert`
BEFORE INSERT ON `invoiceIn`
FOR EACH ROW
BEGIN
@@ -5507,7 +5661,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceIn_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceIn_beforeUpdate`
BEFORE UPDATE ON `invoiceIn`
FOR EACH ROW
BEGIN
@@ -5551,7 +5705,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceIn_afterUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceIn_afterUpdate`
AFTER UPDATE ON `invoiceIn`
FOR EACH ROW
BEGIN
@@ -5589,7 +5743,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceIn_beforeDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceIn_beforeDelete`
BEFORE DELETE ON `invoiceIn`
FOR EACH ROW
BEGIN
@@ -5609,7 +5763,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceIn_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceIn_afterDelete`
AFTER DELETE ON `invoiceIn`
FOR EACH ROW
BEGIN
@@ -5633,7 +5787,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceInDueDay_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceInDueDay_beforeInsert`
BEFORE INSERT ON `invoiceInDueDay`
FOR EACH ROW
BEGIN
@@ -5675,7 +5829,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceInDueDay_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceInDueDay_beforeUpdate`
BEFORE UPDATE ON `invoiceInDueDay`
FOR EACH ROW
BEGIN
@@ -5717,7 +5871,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceInDueDay_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceInDueDay_afterDelete`
AFTER DELETE ON `invoiceInDueDay`
FOR EACH ROW
BEGIN
@@ -5741,7 +5895,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceInTax_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceInTax_beforeInsert`
BEFORE INSERT ON `invoiceInTax`
FOR EACH ROW
BEGIN
@@ -5762,7 +5916,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceInTax_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceInTax_beforeUpdate`
BEFORE UPDATE ON `invoiceInTax`
FOR EACH ROW
BEGIN
@@ -5786,7 +5940,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceInTax_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceInTax_afterDelete`
AFTER DELETE ON `invoiceInTax`
FOR EACH ROW
BEGIN
@@ -5804,13 +5958,13 @@ DELIMITER ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceOut_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceOut_beforeInsert`
BEFORE INSERT ON `invoiceOut`
FOR EACH ROW
BEGIN
@@ -5875,13 +6029,13 @@ DELIMITER ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceOut_afterInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceOut_afterInsert`
AFTER INSERT ON `invoiceOut`
FOR EACH ROW
BEGIN
@@ -5901,7 +6055,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceOut_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceOut_beforeUpdate`
BEFORE UPDATE ON `invoiceOut`
FOR EACH ROW
BEGIN
@@ -5922,7 +6076,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceOut_beforeDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceOut_beforeDelete`
BEFORE DELETE ON `invoiceOut`
FOR EACH ROW
BEGIN
@@ -5942,7 +6096,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`item_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`item_beforeInsert`
BEFORE INSERT ON `item`
FOR EACH ROW
BEGIN
@@ -5972,7 +6126,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`item_afterInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`item_afterInsert`
AFTER INSERT ON `item`
FOR EACH ROW
BEGIN
@@ -6000,7 +6154,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`item_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`item_beforeUpdate`
BEFORE UPDATE ON `item`
FOR EACH ROW
BEGIN
@@ -6026,7 +6180,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`item_afterUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`item_afterUpdate`
AFTER UPDATE ON `item`
FOR EACH ROW
BEGIN
@@ -6049,7 +6203,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`item_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`item_afterDelete`
AFTER DELETE ON `item`
FOR EACH ROW
BEGIN
@@ -6074,7 +6228,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemBarcode_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemBarcode_beforeInsert`
BEFORE INSERT ON `itemBarcode`
FOR EACH ROW
BEGIN
@@ -6094,7 +6248,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemBarcode_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemBarcode_beforeUpdate`
BEFORE UPDATE ON `itemBarcode`
FOR EACH ROW
BEGIN
@@ -6114,7 +6268,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemBarcode_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemBarcode_afterDelete`
AFTER DELETE ON `itemBarcode`
FOR EACH ROW
BEGIN
@@ -6138,7 +6292,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemBotanical_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemBotanical_beforeInsert`
BEFORE INSERT ON `itemBotanical`
FOR EACH ROW
BEGIN
@@ -6158,7 +6312,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemBotanical_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemBotanical_beforeUpdate`
BEFORE UPDATE ON `itemBotanical`
FOR EACH ROW
BEGIN
@@ -6178,7 +6332,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemBotanical_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemBotanical_afterDelete`
AFTER DELETE ON `itemBotanical`
FOR EACH ROW
BEGIN
@@ -6202,7 +6356,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemCategory_afterInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemCategory_afterInsert`
AFTER INSERT ON `itemCategory`
FOR EACH ROW
BEGIN
@@ -6225,7 +6379,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemCost_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemCost_beforeInsert`
BEFORE INSERT ON `itemCost`
FOR EACH ROW
BEGIN
@@ -6248,7 +6402,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemCost_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemCost_beforeUpdate`
BEFORE UPDATE ON `itemCost`
FOR EACH ROW
BEGIN
@@ -6290,7 +6444,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemMinimumQuantity_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemMinimumQuantity_beforeInsert`
BEFORE INSERT ON `itemMinimumQuantity`
FOR EACH ROW
BEGIN
@@ -6311,7 +6465,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemMinimumQuantity_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemMinimumQuantity_beforeUpdate`
BEFORE UPDATE ON `itemMinimumQuantity`
FOR EACH ROW
BEGIN
@@ -6332,7 +6486,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemMinimumQuantity_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemMinimumQuantity_afterDelete`
AFTER DELETE ON `itemMinimumQuantity`
FOR EACH ROW
BEGIN
@@ -6356,7 +6510,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_beforeInsert`
BEFORE INSERT ON `itemShelving`
FOR EACH ROW
BEGIN
@@ -6379,7 +6533,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_beforeUpdate`
BEFORE UPDATE ON `itemShelving`
FOR EACH ROW
BEGIN
@@ -6404,7 +6558,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_afterUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_afterUpdate`
AFTER UPDATE ON `itemShelving`
FOR EACH ROW
BEGIN
@@ -6434,7 +6588,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_beforeDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_beforeDelete`
BEFORE DELETE ON `itemShelving`
FOR EACH ROW
INSERT INTO vn.itemShelvingLog(itemShelvingFk,
@@ -6461,13 +6615,13 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving _afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_afterDelete`
AFTER DELETE ON `itemShelving`
FOR EACH ROW
BEGIN
INSERT INTO shelvingLog
SET `action` = 'delete',
- `changedModel` = 'itemShelving',
+ `changedModel` = 'ItemShelving',
`changedModelId` = OLD.id,
`userFk` = account.myUser_getId();
END */;;
@@ -6485,31 +6639,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_afterDelete`
- AFTER DELETE ON `itemShelving`
- FOR EACH ROW
-BEGIN
- INSERT INTO shelvingLog
- SET `action` = 'delete',
- `changedModel` = 'itemShelving',
- `changedModelId` = OLD.id,
- `userFk` = account.myUser_getId();
-END */;;
-DELIMITER ;
-/*!50003 SET sql_mode = @saved_sql_mode */ ;
-/*!50003 SET character_set_client = @saved_cs_client */ ;
-/*!50003 SET character_set_results = @saved_cs_results */ ;
-/*!50003 SET collation_connection = @saved_col_connection */ ;
-/*!50003 SET @saved_cs_client = @@character_set_client */ ;
-/*!50003 SET @saved_cs_results = @@character_set_results */ ;
-/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb4 */ ;
-/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
-DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelvingSale_afterInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelvingSale_afterInsert`
AFTER INSERT ON `itemShelvingSale`
FOR EACH ROW
BEGIN
@@ -6533,7 +6663,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemTag_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemTag_beforeInsert`
BEFORE INSERT ON `itemTag`
FOR EACH ROW
BEGIN
@@ -6554,7 +6684,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemTag_afterInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemTag_afterInsert`
AFTER INSERT ON `itemTag`
FOR EACH ROW
trig: BEGIN
@@ -6578,7 +6708,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemTag_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemTag_beforeUpdate`
BEFORE UPDATE ON `itemTag`
FOR EACH ROW
BEGIN
@@ -6603,7 +6733,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemTag_afterUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemTag_afterUpdate`
AFTER UPDATE ON `itemTag`
FOR EACH ROW
trig: BEGIN
@@ -6639,7 +6769,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemTag_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemTag_afterDelete`
AFTER DELETE ON `itemTag`
FOR EACH ROW
trig: BEGIN
@@ -6669,7 +6799,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemTaxCountry_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemTaxCountry_beforeInsert`
BEFORE INSERT ON `itemTaxCountry`
FOR EACH ROW
BEGIN
@@ -6689,7 +6819,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemTaxCountry_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemTaxCountry_beforeUpdate`
BEFORE UPDATE ON `itemTaxCountry`
FOR EACH ROW
BEGIN
@@ -6709,7 +6839,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemTaxCountry_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemTaxCountry_afterDelete`
AFTER DELETE ON `itemTaxCountry`
FOR EACH ROW
BEGIN
@@ -6733,7 +6863,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemType_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemType_beforeUpdate`
BEFORE UPDATE ON `itemType`
FOR EACH ROW
BEGIN
@@ -6763,7 +6893,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`machine_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`machine_beforeInsert`
BEFORE INSERT ON `machine`
FOR EACH ROW
BEGIN
@@ -6785,7 +6915,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`mail_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`mail_beforeInsert`
BEFORE INSERT ON `mail`
FOR EACH ROW
BEGIN
@@ -6811,7 +6941,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`mandate_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`mandate_beforeInsert`
BEFORE INSERT ON `mandate`
FOR EACH ROW
BEGIN
@@ -6829,13 +6959,13 @@ DELIMITER ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`operator_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`operator_beforeInsert`
BEFORE INSERT ON `operator`
FOR EACH ROW
BEGIN
@@ -6855,7 +6985,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`operator_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`operator_beforeUpdate`
BEFORE UPDATE ON `operator`
FOR EACH ROW
BEGIN
@@ -6877,7 +7007,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`packaging_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`packaging_beforeInsert`
BEFORE INSERT ON `packaging`
FOR EACH ROW
BEGIN
@@ -6897,7 +7027,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`packaging_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`packaging_beforeUpdate`
BEFORE UPDATE ON `packaging`
FOR EACH ROW
BEGIN
@@ -6917,7 +7047,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`packingSite_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`packingSite_beforeInsert`
BEFORE INSERT ON `packingSite`
FOR EACH ROW
BEGIN
@@ -6937,7 +7067,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`packingSite_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`packingSite_beforeUpdate`
BEFORE UPDATE ON `packingSite`
FOR EACH ROW
BEGIN
@@ -6957,7 +7087,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`packingSite_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`packingSite_afterDelete`
AFTER DELETE ON `packingSite`
FOR EACH ROW
BEGIN
@@ -6981,7 +7111,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`parking_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`parking_beforeInsert`
BEFORE INSERT ON `parking`
FOR EACH ROW
BEGIN
@@ -7003,7 +7133,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`parking_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`parking_beforeUpdate`
BEFORE UPDATE ON `parking`
FOR EACH ROW
BEGIN
@@ -7025,7 +7155,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`parking_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`parking_afterDelete`
AFTER DELETE ON `parking`
FOR EACH ROW
BEGIN
@@ -7049,7 +7179,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`payment_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`payment_beforeInsert`
BEFORE INSERT ON `payment`
FOR EACH ROW
BEGIN
@@ -7155,7 +7285,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`payment_afterInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`payment_afterInsert`
AFTER INSERT ON `payment`
FOR EACH ROW
BEGIN
@@ -7197,11 +7327,13 @@ DELIMITER ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER payment_beforeUpdate BEFORE UPDATE ON payment FOR EACH ROW
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`payment_beforeUpdate`
+ BEFORE UPDATE ON `payment`
+ FOR EACH ROW
BEGIN
IF ISNULL(NEW.workerFk) THEN
SET NEW.workerFk = account.myUser_getId();
@@ -7221,7 +7353,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`postCode_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`postCode_beforeInsert`
BEFORE INSERT ON `postCode`
FOR EACH ROW
BEGIN
@@ -7242,7 +7374,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`postCode_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`postCode_beforeUpdate`
BEFORE UPDATE ON `postCode`
FOR EACH ROW
BEGIN
@@ -7264,7 +7396,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`postCode_afterUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`postCode_afterUpdate`
AFTER UPDATE ON `postCode`
FOR EACH ROW
BEGIN
@@ -7292,7 +7424,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`postCode_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`postCode_afterDelete`
AFTER DELETE ON `postCode`
FOR EACH ROW
BEGIN
@@ -7312,7 +7444,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`priceFixed_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`priceFixed_beforeInsert`
BEFORE INSERT ON `priceFixed`
FOR EACH ROW
BEGIN
@@ -7337,7 +7469,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`priceFixed_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`priceFixed_beforeUpdate`
BEFORE UPDATE ON `priceFixed`
FOR EACH ROW
BEGIN
@@ -7362,7 +7494,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`productionConfig_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`productionConfig_beforeInsert`
BEFORE INSERT ON `productionConfig`
FOR EACH ROW
BEGIN
@@ -7382,7 +7514,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`productionConfig_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`productionConfig_beforeUpdate`
BEFORE UPDATE ON `productionConfig`
FOR EACH ROW
BEGIN
@@ -7402,7 +7534,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`productionConfig_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`productionConfig_afterDelete`
AFTER DELETE ON `productionConfig`
FOR EACH ROW
BEGIN
@@ -7426,7 +7558,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`projectNotes_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`projectNotes_beforeInsert`
BEFORE INSERT ON `projectNotes`
FOR EACH ROW
BEGIN
@@ -7452,7 +7584,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`province_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`province_beforeInsert`
BEFORE INSERT ON `province`
FOR EACH ROW
BEGIN
@@ -7477,7 +7609,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`province_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`province_beforeUpdate`
BEFORE UPDATE ON `province`
FOR EACH ROW
BEGIN
@@ -7503,7 +7635,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`province_afterUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`province_afterUpdate`
AFTER UPDATE ON `province`
FOR EACH ROW
BEGIN
@@ -7531,7 +7663,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`province_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`province_afterDelete`
AFTER DELETE ON `province`
FOR EACH ROW
BEGIN
@@ -7551,7 +7683,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`rate_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`rate_beforeInsert`
BEFORE INSERT ON `rate`
FOR EACH ROW
BEGIN
@@ -7571,7 +7703,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`rate_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`rate_beforeUpdate`
BEFORE UPDATE ON `rate`
FOR EACH ROW
BEGIN
@@ -7591,7 +7723,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`rate_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`rate_afterDelete`
AFTER DELETE ON `rate`
FOR EACH ROW
BEGIN
@@ -7615,7 +7747,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`receipt_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`receipt_beforeInsert`
BEFORE INSERT ON `receipt`
FOR EACH ROW
BEGIN
@@ -7644,7 +7776,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`receipt_afterInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`receipt_afterInsert`
AFTER INSERT ON `receipt`
FOR EACH ROW
CALL clientRisk_update(NEW.clientFk, NEW.companyFk, -NEW.amountPaid) */;;
@@ -7662,7 +7794,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`receipt_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`receipt_beforeUpdate`
BEFORE UPDATE ON `receipt`
FOR EACH ROW
BEGIN
@@ -7684,7 +7816,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`receipt_afterUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`receipt_afterUpdate`
AFTER UPDATE ON `receipt`
FOR EACH ROW
BEGIN
@@ -7711,7 +7843,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`receipt_beforeDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`receipt_beforeDelete`
BEFORE DELETE ON `receipt`
FOR EACH ROW
CALL clientRisk_update(OLD.clientFk, OLD.companyFk, OLD.amountPaid) */;;
@@ -7729,7 +7861,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`recovery_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`recovery_beforeInsert`
BEFORE INSERT ON `recovery`
FOR EACH ROW
BEGIN
@@ -7749,7 +7881,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`recovery_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`recovery_beforeUpdate`
BEFORE UPDATE ON `recovery`
FOR EACH ROW
BEGIN
@@ -7769,7 +7901,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`recovery_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`recovery_afterDelete`
AFTER DELETE ON `recovery`
FOR EACH ROW
BEGIN
@@ -7793,8 +7925,57 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionTruck_beforeInsert`
- BEFORE INSERT ON `roadmapStop` FOR EACH ROW
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`roadmap_beforeInsert`
+ BEFORE INSERT ON `roadmap`
+ FOR EACH ROW
+BEGIN
+ IF NEW.driver1Fk IS NOT NULL THEN
+ SET NEW.driverName = (SELECT firstName FROM worker WHERE id = NEW.driver1Fk);
+ ELSE
+ SET NEW.driverName = NULL;
+ END IF;
+END */;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`roadmap_beforeUpdate`
+ BEFORE UPDATE ON `roadmap`
+ FOR EACH ROW
+BEGIN
+ IF NEW.driver1Fk IS NOT NULL THEN
+ SET NEW.driverName = (SELECT firstName FROM worker WHERE id = NEW.driver1Fk);
+ ELSE
+ SET NEW.driverName = NULL;
+ END IF;
+END */;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`roadmapStop_beforeInsert`
+ BEFORE INSERT ON `roadmapStop`
+ FOR EACH ROW
BEGIN
SET NEW.description = UCASE(NEW.description);
@@ -7814,8 +7995,9 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionTruck_beforeUpdate`
- BEFORE UPDATE ON `roadmapStop` FOR EACH ROW
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`roadmapStop_beforeUpdate`
+ BEFORE UPDATE ON `roadmapStop`
+ FOR EACH ROW
BEGIN
SET NEW.description = UCASE(NEW.description);
@@ -7835,7 +8017,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`route_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`route_beforeInsert`
BEFORE INSERT ON `route`
FOR EACH ROW
BEGIN
@@ -7876,7 +8058,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`route_afterInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`route_afterInsert`
AFTER INSERT ON `route`
FOR EACH ROW
BEGIN
@@ -7896,7 +8078,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`route_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`route_beforeUpdate`
BEFORE UPDATE ON `route`
FOR EACH ROW
BEGIN
@@ -7937,7 +8119,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`route_afterUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`route_afterUpdate`
AFTER UPDATE ON `route`
FOR EACH ROW
BEGIN
@@ -7978,7 +8160,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`route_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`route_afterDelete`
AFTER DELETE ON `route`
FOR EACH ROW
BEGIN
@@ -8002,7 +8184,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`routesMonitor_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`routesMonitor_beforeInsert`
BEFORE INSERT ON `routesMonitor`
FOR EACH ROW
BEGIN
@@ -8022,7 +8204,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`routesMonitor_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`routesMonitor_beforeUpdate`
BEFORE UPDATE ON `routesMonitor`
FOR EACH ROW
BEGIN
@@ -8042,7 +8224,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`routesMonitor_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`routesMonitor_afterDelete`
AFTER DELETE ON `routesMonitor`
FOR EACH ROW
BEGIN
@@ -8066,7 +8248,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sale_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`sale_beforeInsert`
BEFORE INSERT ON `sale`
FOR EACH ROW
BEGIN
@@ -8087,7 +8269,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sale_afterInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`sale_afterInsert`
AFTER INSERT ON `sale`
FOR EACH ROW
BEGIN
@@ -8129,7 +8311,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sale_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`sale_beforeUpdate`
BEFORE UPDATE ON `sale`
FOR EACH ROW
BEGIN
@@ -8164,7 +8346,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sale_afterUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`sale_afterUpdate`
AFTER UPDATE ON `sale`
FOR EACH ROW
BEGIN
@@ -8249,7 +8431,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sale_beforeDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`sale_beforeDelete`
BEFORE DELETE ON `sale`
FOR EACH ROW
BEGIN
@@ -8279,7 +8461,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sale_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`sale_afterDelete`
AFTER DELETE ON `sale`
FOR EACH ROW
BEGIN
@@ -8336,7 +8518,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleBuy_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleBuy_beforeInsert`
BEFORE INSERT ON `saleBuy`
FOR EACH ROW
BEGIN
@@ -8358,7 +8540,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleGroup_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleGroup_beforeInsert`
BEFORE INSERT ON `saleGroup`
FOR EACH ROW
BEGIN
@@ -8378,7 +8560,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleGroup_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleGroup_beforeUpdate`
BEFORE UPDATE ON `saleGroup`
FOR EACH ROW
BEGIN
@@ -8398,11 +8580,11 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleGroup_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleGroup_afterDelete`
AFTER DELETE ON `saleGroup`
FOR EACH ROW
BEGIN
- INSERT INTO ticketLog
+ INSERT INTO saleGroupLog
SET `action` = 'delete',
`changedModel` = 'SaleGroup',
`changedModelId` = OLD.id,
@@ -8422,7 +8604,71 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleLabel_afterUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleGroupDetail_beforeInsert`
+ BEFORE INSERT ON `saleGroupDetail`
+ FOR EACH ROW
+BEGIN
+ SET NEW.editorFk = account.myUser_getId();
+END */;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleGroupDetail_beforeUpdate`
+ BEFORE UPDATE ON `saleGroupDetail`
+ FOR EACH ROW
+BEGIN
+ SET NEW.editorFk = account.myUser_getId();
+END */;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleGroupDetail_afterDelete`
+ AFTER DELETE ON `saleGroupDetail`
+ FOR EACH ROW
+BEGIN
+ INSERT INTO saleGroupLog
+ SET `action` = 'delete',
+ `changedModel` = 'SaleGroupDetail',
+ `changedModelId` = OLD.id,
+ `userFk` = account.myUser_getId();
+END */;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 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
@@ -8442,7 +8688,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleTracking_afterInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleTracking_afterInsert`
AFTER INSERT ON `saleTracking`
FOR EACH ROW
BEGIN
@@ -8471,7 +8717,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sharingCart_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`sharingCart_beforeInsert`
BEFORE INSERT ON `sharingCart`
FOR EACH ROW
BEGIN
@@ -8498,7 +8744,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sharingCart_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`sharingCart_beforeUpdate`
BEFORE UPDATE ON `sharingCart`
FOR EACH ROW
BEGIN
@@ -8531,7 +8777,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sharingCart_beforeDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`sharingCart_beforeDelete`
BEFORE DELETE ON `sharingCart`
FOR EACH ROW
BEGIN
@@ -8554,7 +8800,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sharingClient_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`sharingClient_beforeInsert`
BEFORE INSERT ON `sharingClient`
FOR EACH ROW
BEGIN
@@ -8575,7 +8821,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sharingClient_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`sharingClient_beforeUpdate`
BEFORE UPDATE ON `sharingClient`
FOR EACH ROW
BEGIN
@@ -8596,7 +8842,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`shelving_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`shelving_beforeInsert`
BEFORE INSERT ON `shelving`
FOR EACH ROW
BEGIN
@@ -8621,7 +8867,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`shelving_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`shelving_beforeUpdate`
BEFORE UPDATE ON `shelving`
FOR EACH ROW
BEGIN
@@ -8649,7 +8895,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`shelving_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`shelving_afterDelete`
AFTER DELETE ON `shelving`
FOR EACH ROW
BEGIN
@@ -8673,7 +8919,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`solunionCAP_afterInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`solunionCAP_afterInsert`
AFTER INSERT ON `solunionCAP`
FOR EACH ROW
BEGIN
@@ -8696,7 +8942,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`solunionCAP_afterUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`solunionCAP_afterUpdate`
AFTER UPDATE ON `solunionCAP`
FOR EACH ROW
BEGIN
@@ -8726,7 +8972,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`solunionCAP_beforeDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`solunionCAP_beforeDelete`
BEFORE DELETE ON `solunionCAP`
FOR EACH ROW
BEGIN
@@ -8749,7 +8995,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`specie_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`specie_beforeInsert`
BEFORE INSERT ON `specie`
FOR EACH ROW
BEGIN
@@ -8769,7 +9015,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`specie_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`specie_beforeUpdate`
BEFORE UPDATE ON `specie`
FOR EACH ROW
BEGIN
@@ -8789,7 +9035,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplier_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplier_beforeInsert`
BEFORE INSERT ON `supplier`
FOR EACH ROW
BEGIN
@@ -8809,7 +9055,45 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplier_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplier_afterUpdate`
+ BEFORE UPDATE ON `supplier`
+ FOR EACH ROW
+BEGIN
+ IF NEW.id <> OLD.id
+ OR NOT (NEW.name <=> OLD.name)
+ OR NOT (NEW.street <=> OLD.street)
+ OR NOT (NEW.account <=> OLD.account)
+ OR NOT (NEW.nif <=> OLD.nif)
+ OR NOT (NEW.isVies <=> OLD.isVies)
+ OR NOT (NEW.provinceFk <=> OLD.provinceFk)
+ OR NOT (NEW.countryFk <=> OLD.countryFk)
+ OR NOT (NEW.postCode <=> OLD.postCode)
+ OR NOT (NEW.city <=> OLD.city)
+ OR NOT (NEW.taxTypeSageFk <=> OLD.taxTypeSageFk)
+ OR NOT (NEW.transactionTypeSageFk <=> OLD.transactionTypeSageFk)
+ OR NOT (NEW.withholdingSageFk <=> OLD.withholdingSageFk) THEN
+
+ UPDATE sage.clientSupplier
+ SET isSync = FALSE
+ WHERE idClientSupplier IN (NEW.id, OLD.id)
+ AND `type` = 'P';
+ END IF;
+END */;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplier_beforeUpdate`
BEFORE UPDATE ON `supplier`
FOR EACH ROW
BEGIN
@@ -8865,45 +9149,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplier_afterUpdate`
- BEFORE UPDATE ON `supplier`
- FOR EACH ROW
-BEGIN
- IF NEW.id <> OLD.id
- OR NOT (NEW.name <=> OLD.name)
- OR NOT (NEW.street <=> OLD.street)
- OR NOT (NEW.account <=> OLD.account)
- OR NOT (NEW.nif <=> OLD.nif)
- OR NOT (NEW.isVies <=> OLD.isVies)
- OR NOT (NEW.provinceFk <=> OLD.provinceFk)
- OR NOT (NEW.countryFk <=> OLD.countryFk)
- OR NOT (NEW.postCode <=> OLD.postCode)
- OR NOT (NEW.city <=> OLD.city)
- OR NOT (NEW.taxTypeSageFk <=> OLD.taxTypeSageFk)
- OR NOT (NEW.transactionTypeSageFk <=> OLD.transactionTypeSageFk)
- OR NOT (NEW.withholdingSageFk <=> OLD.withholdingSageFk) THEN
-
- UPDATE sage.clientSupplier
- SET isSync = FALSE
- WHERE idClientSupplier IN (NEW.id, OLD.id)
- AND `type` = 'P';
- END IF;
-END */;;
-DELIMITER ;
-/*!50003 SET sql_mode = @saved_sql_mode */ ;
-/*!50003 SET character_set_client = @saved_cs_client */ ;
-/*!50003 SET character_set_results = @saved_cs_results */ ;
-/*!50003 SET collation_connection = @saved_col_connection */ ;
-/*!50003 SET @saved_cs_client = @@character_set_client */ ;
-/*!50003 SET @saved_cs_results = @@character_set_results */ ;
-/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb4 */ ;
-/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
-DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplier_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplier_afterDelete`
AFTER DELETE ON `supplier`
FOR EACH ROW
BEGIN
@@ -8927,7 +9173,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplierAccount_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplierAccount_beforeInsert`
BEFORE INSERT ON `supplierAccount`
FOR EACH ROW
BEGIN
@@ -8947,7 +9193,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplierAccount_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplierAccount_beforeUpdate`
BEFORE UPDATE ON `supplierAccount`
FOR EACH ROW
BEGIN
@@ -8967,7 +9213,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplierAccount_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplierAccount_afterDelete`
AFTER DELETE ON `supplierAccount`
FOR EACH ROW
BEGIN
@@ -8991,7 +9237,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplierAddress_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplierAddress_beforeInsert`
BEFORE INSERT ON `supplierAddress`
FOR EACH ROW
BEGIN
@@ -9011,7 +9257,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplierAddress_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplierAddress_beforeUpdate`
BEFORE UPDATE ON `supplierAddress`
FOR EACH ROW
BEGIN
@@ -9031,7 +9277,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplierAddress_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplierAddress_afterDelete`
AFTER DELETE ON `supplierAddress`
FOR EACH ROW
BEGIN
@@ -9055,7 +9301,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplierContact_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplierContact_beforeInsert`
BEFORE INSERT ON `supplierContact`
FOR EACH ROW
BEGIN
@@ -9075,7 +9321,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplierContact_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplierContact_beforeUpdate`
BEFORE UPDATE ON `supplierContact`
FOR EACH ROW
BEGIN
@@ -9095,7 +9341,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplierContact_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplierContact_afterDelete`
AFTER DELETE ON `supplierContact`
FOR EACH ROW
BEGIN
@@ -9119,7 +9365,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplierDms_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplierDms_beforeInsert`
BEFORE INSERT ON `supplierDms`
FOR EACH ROW
BEGIN
@@ -9139,7 +9385,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplierDms_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplierDms_beforeUpdate`
BEFORE UPDATE ON `supplierDms`
FOR EACH ROW
BEGIN
@@ -9159,7 +9405,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplierDms_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplierDms_afterDelete`
AFTER DELETE ON `supplierDms`
FOR EACH ROW
BEGIN
@@ -9183,7 +9429,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`tag_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`tag_beforeInsert`
BEFORE INSERT ON `tag`
FOR EACH ROW
BEGIN
@@ -9205,7 +9451,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticket_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticket_beforeInsert`
BEFORE INSERT ON `ticket`
FOR EACH ROW
BEGIN
@@ -9225,7 +9471,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticket_afterInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticket_afterInsert`
AFTER INSERT ON `ticket`
FOR EACH ROW
BEGIN
@@ -9275,7 +9521,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticket_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticket_beforeUpdate`
BEFORE UPDATE ON `ticket`
FOR EACH ROW
BEGIN
@@ -9363,7 +9609,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticket_afterUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticket_afterUpdate`
AFTER UPDATE ON `ticket`
FOR EACH ROW
BEGIN
@@ -9391,7 +9637,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticket_beforeDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticket_beforeDelete`
BEFORE DELETE ON `ticket`
FOR EACH ROW
BEGIN
@@ -9421,7 +9667,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticket_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticket_afterDelete`
AFTER DELETE ON `ticket`
FOR EACH ROW
BEGIN
@@ -9439,15 +9685,15 @@ DELIMITER ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER ticketCollection_afterDelete
-AFTER DELETE
-ON ticketCollection FOR EACH ROW
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketCollection_afterDelete`
+ AFTER DELETE ON `ticketCollection`
+ FOR EACH ROW
BEGIN
DECLARE vSalesRemaining INT;
@@ -9485,7 +9731,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketDms_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketDms_beforeInsert`
BEFORE INSERT ON `ticketDms`
FOR EACH ROW
BEGIN
@@ -9505,7 +9751,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketDms_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketDms_beforeUpdate`
BEFORE UPDATE ON `ticketDms`
FOR EACH ROW
BEGIN
@@ -9525,7 +9771,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketDms_beforeDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketDms_beforeDelete`
BEFORE DELETE ON `ticketDms`
FOR EACH ROW
BEGIN
@@ -9553,7 +9799,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketDms_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketDms_afterDelete`
AFTER DELETE ON `ticketDms`
FOR EACH ROW
BEGIN
@@ -9577,7 +9823,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketObservation_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketObservation_beforeInsert`
BEFORE INSERT ON `ticketObservation`
FOR EACH ROW
BEGIN
@@ -9597,7 +9843,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketObservation_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketObservation_beforeUpdate`
BEFORE UPDATE ON `ticketObservation`
FOR EACH ROW
BEGIN
@@ -9617,7 +9863,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketObservation_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketObservation_afterDelete`
AFTER DELETE ON `ticketObservation`
FOR EACH ROW
BEGIN
@@ -9641,7 +9887,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketPackaging_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketPackaging_beforeInsert`
BEFORE INSERT ON `ticketPackaging`
FOR EACH ROW
BEGIN
@@ -9661,7 +9907,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketPackaging_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketPackaging_beforeUpdate`
BEFORE UPDATE ON `ticketPackaging`
FOR EACH ROW
BEGIN
@@ -9681,7 +9927,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketPackaging_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketPackaging_afterDelete`
AFTER DELETE ON `ticketPackaging`
FOR EACH ROW
BEGIN
@@ -9705,7 +9951,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketParking_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketParking_beforeInsert`
BEFORE INSERT ON `ticketParking`
FOR EACH ROW
BEGIN
@@ -9727,7 +9973,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketRefund_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketRefund_beforeInsert`
BEFORE INSERT ON `ticketRefund`
FOR EACH ROW
BEGIN
@@ -9747,7 +9993,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketRefund_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketRefund_beforeUpdate`
BEFORE UPDATE ON `ticketRefund`
FOR EACH ROW
BEGIN
@@ -9767,7 +10013,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketRefund_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketRefund_afterDelete`
AFTER DELETE ON `ticketRefund`
FOR EACH ROW
BEGIN
@@ -9791,7 +10037,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketRequest_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketRequest_beforeInsert`
BEFORE INSERT ON `ticketRequest`
FOR EACH ROW
BEGIN
@@ -9823,7 +10069,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketRequest_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketRequest_beforeUpdate`
BEFORE UPDATE ON `ticketRequest`
FOR EACH ROW
BEGIN
@@ -9851,7 +10097,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketRequest_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketRequest_afterDelete`
AFTER DELETE ON `ticketRequest`
FOR EACH ROW
BEGIN
@@ -9875,7 +10121,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketService_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketService_beforeInsert`
BEFORE INSERT ON `ticketService`
FOR EACH ROW
BEGIN
@@ -9895,7 +10141,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketService_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketService_beforeUpdate`
BEFORE UPDATE ON `ticketService`
FOR EACH ROW
BEGIN
@@ -9915,7 +10161,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketService_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketService_afterDelete`
AFTER DELETE ON `ticketService`
FOR EACH ROW
BEGIN
@@ -9939,7 +10185,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketTracking_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketTracking_beforeInsert`
BEFORE INSERT ON `ticketTracking`
FOR EACH ROW
BEGIN
@@ -9959,7 +10205,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketTracking_afterInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketTracking_afterInsert`
AFTER INSERT ON `ticketTracking`
FOR EACH ROW
BEGIN
@@ -9982,9 +10228,9 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketTracking_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketTracking_beforeUpdate`
BEFORE UPDATE ON `ticketTracking`
FOR EACH ROW
BEGIN
@@ -10004,7 +10250,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketTracking_afterUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketTracking_afterUpdate`
AFTER UPDATE ON `ticketTracking`
FOR EACH ROW
BEGIN
@@ -10048,7 +10294,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketTracking_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketTracking_afterDelete`
AFTER DELETE ON `ticketTracking`
FOR EACH ROW
BEGIN
@@ -10095,7 +10341,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketWeekly_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketWeekly_beforeInsert`
BEFORE INSERT ON `ticketWeekly`
FOR EACH ROW
BEGIN
@@ -10115,7 +10361,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketWeekly_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketWeekly_beforeUpdate`
BEFORE UPDATE ON `ticketWeekly`
FOR EACH ROW
BEGIN
@@ -10135,7 +10381,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketWeekly_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketWeekly_afterDelete`
AFTER DELETE ON `ticketWeekly`
FOR EACH ROW
BEGIN
@@ -10159,7 +10405,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`time_afterUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`time_afterUpdate`
AFTER UPDATE ON `time`
FOR EACH ROW
BEGIN
@@ -10184,7 +10430,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`town_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`town_beforeInsert`
BEFORE INSERT ON `town`
FOR EACH ROW
BEGIN
@@ -10205,7 +10451,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`town_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`town_beforeUpdate`
BEFORE UPDATE ON `town`
FOR EACH ROW
BEGIN
@@ -10227,7 +10473,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`town_afterUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`town_afterUpdate`
AFTER UPDATE ON `town`
FOR EACH ROW
BEGIN
@@ -10255,7 +10501,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`town_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`town_afterDelete`
AFTER DELETE ON `town`
FOR EACH ROW
BEGIN
@@ -10275,7 +10521,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`travel_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`travel_beforeInsert`
BEFORE INSERT ON `travel`
FOR EACH ROW
BEGIN
@@ -10303,7 +10549,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`travel_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`travel_beforeUpdate`
BEFORE UPDATE ON `travel`
FOR EACH ROW
BEGIN
@@ -10355,7 +10601,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`travel_afterUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`travel_afterUpdate`
AFTER UPDATE ON `travel`
FOR EACH ROW
BEGIN
@@ -10392,7 +10638,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`travel_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`travel_afterDelete`
AFTER DELETE ON `travel`
FOR EACH ROW
BEGIN
@@ -10416,7 +10662,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`travelThermograph_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`travelThermograph_beforeInsert`
BEFORE INSERT ON `travelThermograph`
FOR EACH ROW
BEGIN
@@ -10436,7 +10682,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`travelThermograph_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`travelThermograph_beforeUpdate`
BEFORE UPDATE ON `travelThermograph`
FOR EACH ROW
BEGIN
@@ -10456,7 +10702,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`travelThermograph_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`travelThermograph_afterDelete`
AFTER DELETE ON `travelThermograph`
FOR EACH ROW
BEGIN
@@ -10480,7 +10726,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`vehicle_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`vehicle_beforeInsert`
BEFORE INSERT ON `vehicle`
FOR EACH ROW
BEGIN
@@ -10500,7 +10746,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`vehicle_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`vehicle_beforeUpdate`
BEFORE UPDATE ON `vehicle`
FOR EACH ROW
BEGIN
@@ -10520,7 +10766,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`warehouse_afterInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`warehouse_afterInsert`
BEFORE UPDATE ON `warehouse`
FOR EACH ROW
BEGIN
@@ -10542,7 +10788,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`worker_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`worker_beforeInsert`
BEFORE INSERT ON `worker`
FOR EACH ROW
BEGIN
@@ -10562,7 +10808,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`worker_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`worker_beforeUpdate`
BEFORE UPDATE ON `worker`
FOR EACH ROW
BEGIN
@@ -10582,7 +10828,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`worker_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`worker_afterDelete`
AFTER DELETE ON `worker`
FOR EACH ROW
BEGIN
@@ -10606,7 +10852,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerDocument_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerDocument_beforeInsert`
BEFORE INSERT ON `workerDocument`
FOR EACH ROW
BEGIN
@@ -10626,7 +10872,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerDocument_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerDocument_beforeUpdate`
BEFORE UPDATE ON `workerDocument`
FOR EACH ROW
BEGIN
@@ -10646,7 +10892,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerDocument_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerDocument_afterDelete`
AFTER DELETE ON `workerDocument`
FOR EACH ROW
BEGIN
@@ -10670,7 +10916,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerIncome_afterInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerIncome_afterInsert`
AFTER INSERT ON `workerIncome`
FOR EACH ROW
BEGIN
@@ -10690,7 +10936,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerIncome_afterUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerIncome_afterUpdate`
AFTER UPDATE ON `workerIncome`
FOR EACH ROW
BEGIN
@@ -10712,7 +10958,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerIncome_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerIncome_afterDelete`
AFTER DELETE ON `workerIncome`
FOR EACH ROW
BEGIN
@@ -10732,11 +10978,11 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerTimeControl_beforeInsert`
- BEFORE INSERT ON `workerTimeControl`
- FOR EACH ROW
-BEGIN
- SET NEW.editorFk = account.myUser_getId();
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerTimeControl_beforeInsert`
+ BEFORE INSERT ON `workerTimeControl`
+ FOR EACH ROW
+BEGIN
+ SET NEW.editorFk = account.myUser_getId();
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -10752,7 +10998,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerTimeControl_afterInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerTimeControl_afterInsert`
AFTER INSERT ON `workerTimeControl`
FOR EACH ROW
BEGIN
@@ -10774,11 +11020,11 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerTimeControl_beforeUpdate`
- BEFORE UPDATE ON `workerTimeControl`
- FOR EACH ROW
-BEGIN
- SET NEW.editorFk = account.myUser_getId();
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerTimeControl_beforeUpdate`
+ BEFORE UPDATE ON `workerTimeControl`
+ FOR EACH ROW
+BEGIN
+ SET NEW.editorFk = account.myUser_getId();
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -10794,15 +11040,15 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerTimeControl_afterDelete`
- AFTER DELETE ON `workerTimeControl`
- FOR EACH ROW
-BEGIN
- INSERT INTO workerLog
- SET `action` = 'delete',
- `changedModel` = 'WorkerTimeControl',
- `changedModelId` = OLD.id,
- `userFk` = account.myUser_getId();
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerTimeControl_afterDelete`
+ AFTER DELETE ON `workerTimeControl`
+ FOR EACH ROW
+BEGIN
+ INSERT INTO workerLog
+ SET `action` = 'delete',
+ `changedModel` = 'WorkerTimeControl',
+ `changedModelId` = OLD.id,
+ `userFk` = account.myUser_getId();
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -10818,7 +11064,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`workingHours_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`workingHours_beforeInsert`
BEFORE INSERT ON `workingHours`
FOR EACH ROW
BEGIN
@@ -10840,7 +11086,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zone_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`zone_beforeInsert`
BEFORE INSERT ON `zone`
FOR EACH ROW
BEGIN
@@ -10860,7 +11106,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zone_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`zone_beforeUpdate`
BEFORE UPDATE ON `zone`
FOR EACH ROW
BEGIN
@@ -10880,7 +11126,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zone_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`zone_afterDelete`
AFTER DELETE ON `zone`
FOR EACH ROW
BEGIN
@@ -10904,7 +11150,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneEvent_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneEvent_beforeInsert`
BEFORE INSERT ON `zoneEvent`
FOR EACH ROW
BEGIN
@@ -10924,7 +11170,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneEvent_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneEvent_beforeUpdate`
BEFORE UPDATE ON `zoneEvent`
FOR EACH ROW
BEGIN
@@ -10944,7 +11190,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneEvent_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneEvent_afterDelete`
AFTER DELETE ON `zoneEvent`
FOR EACH ROW
BEGIN
@@ -10968,7 +11214,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneExclusion_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneExclusion_beforeInsert`
BEFORE INSERT ON `zoneExclusion`
FOR EACH ROW
BEGIN
@@ -10990,7 +11236,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneExclusion_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneExclusion_beforeUpdate`
BEFORE UPDATE ON `zoneExclusion`
FOR EACH ROW
BEGIN
@@ -11012,7 +11258,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneExclusion_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneExclusion_afterDelete`
AFTER DELETE ON `zoneExclusion`
FOR EACH ROW
BEGIN
@@ -11036,7 +11282,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneGeo_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneGeo_beforeInsert`
BEFORE INSERT ON `zoneGeo`
FOR EACH ROW
BEGIN
@@ -11056,7 +11302,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneGeo_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneGeo_beforeUpdate`
BEFORE UPDATE ON `zoneGeo`
FOR EACH ROW
BEGIN
@@ -11078,7 +11324,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneIncluded_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneIncluded_beforeInsert`
BEFORE INSERT ON `zoneIncluded`
FOR EACH ROW
BEGIN
@@ -11099,7 +11345,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneIncluded_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneIncluded_beforeUpdate`
BEFORE UPDATE ON `zoneIncluded`
FOR EACH ROW
BEGIN
@@ -11120,7 +11366,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneIncluded_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneIncluded_afterDelete`
AFTER DELETE ON `zoneIncluded`
FOR EACH ROW
BEGIN
@@ -11145,7 +11391,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneWarehouse_beforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneWarehouse_beforeInsert`
BEFORE INSERT ON `zoneWarehouse`
FOR EACH ROW
BEGIN
@@ -11165,7 +11411,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneWarehouse_beforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneWarehouse_beforeUpdate`
BEFORE UPDATE ON `zoneWarehouse`
FOR EACH ROW
BEGIN
@@ -11185,7 +11431,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneWarehouse_afterDelete`
+/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneWarehouse_afterDelete`
AFTER DELETE ON `zoneWarehouse`
FOR EACH ROW
BEGIN
@@ -11212,4 +11458,4 @@ USE `vn2008`;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
--- Dump completed on 2024-08-20 7:45:23
+-- Dump completed on 2024-09-18 9:32:59
diff --git a/db/dump/dump.before.sql b/db/dump/dump.before.sql
index 24168fe60..20a365c83 100644
--- a/db/dump/dump.before.sql
+++ b/db/dump/dump.before.sql
@@ -1 +1,14 @@
-- Executed before dump
+
+CREATE USER 'vn'@'localhost';
+
+GRANT SELECT,
+ INSERT,
+ UPDATE,
+ DELETE,
+ DROP,
+ CREATE TEMPORARY TABLES,
+ EXECUTE,
+ EVENT,
+ TRIGGER
+ ON *.* TO 'vn'@'localhost';
diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql
index 703c67443..f4c3f8387 100644
--- a/db/dump/fixtures.before.sql
+++ b/db/dump/fixtures.before.sql
@@ -108,6 +108,7 @@ INSERT INTO `vn`.`worker`(`id`,`code`, `firstName`, `lastName`, `bossFk`)
UPDATE `vn`.`worker` SET bossFk = NULL WHERE id = 20;
UPDATE `vn`.`worker` SET bossFk = 20 WHERE id = 1 OR id = 9;
UPDATE `vn`.`worker` SET bossFk = 19 WHERE id = 18;
+UPDATE `vn`.`worker` SET bossFk = 50 WHERE id = 49;
DELETE FROM `vn`.`worker` WHERE firstName ='customer';
@@ -334,21 +335,21 @@ INSERT INTO `vn`.`payDem`(`id`, `payDem`)
(2, 20),
(7, 0);
-INSERT INTO `vn`.`autonomy`(`id`, `name`, `countryFk`)
+INSERT INTO `vn`.`autonomy`(`id`, `name`, `countryFk`, `hasDailyInvoice`)
VALUES
- (1, 'Autonomy one', 1),
- (2, 'Autonomy two', 1),
- (3, 'Autonomy three', 2),
- (4, 'Autonomy four', 13);
+ (1, 'Autonomy one', 1, 1),
+ (2, 'Autonomy two', 1, 0),
+ (3, 'Autonomy three', 2, 0),
+ (4, 'Autonomy four', 13, 0);
INSERT INTO `vn`.`province`(`id`, `name`, `countryFk`, `autonomyFk`, `warehouseFk`)
VALUES
- (1, 'Province one', 1, 1, NULL),
- (2, 'Province two', 1, 1, NULL),
- (3, 'Province three', 30, 2, NULL),
- (4, 'Province four', 2, 3, NULL),
- (5, 'Province five', 13, 4, NULL);
+ (1, 'Province one', 1, 1, NULL),
+ (2, 'Province two', 1, 1, NULL),
+ (3, 'Province three', 30, 2, NULL),
+ (4, 'Province four', 2, 3, NULL),
+ (5, 'Province five', 13, 4, NULL);
INSERT INTO `vn`.`town`(`id`, `name`, `provinceFk`)
VALUES
@@ -364,6 +365,7 @@ INSERT INTO `vn`.`postCode`(`code`, `townFk`, `geoFk`)
('46460', 2, 6),
('46680', 3, 6),
('46600', 4, 7),
+ ('46600',1, 6),
('EC170150', 5, 8);
INSERT INTO `vn`.`clientType`(`code`, `type`)
@@ -396,7 +398,7 @@ INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city
(1107, 'Hank Pym', '09854837G', 'ANT MAN', 'Hawk', 'ANTHILL, SAN FRANCISCO, CALIFORNIA', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 19, 0, 'florist','normal'),
(1108, 'Charles Xavier', '22641921P', 'PROFESSOR X', 'Beast', '3800 VICTORY PKWY, CINCINNATI, OH 45207, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 5, 1, 300, 13, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 19, 0, 'florist','normal'),
(1109, 'Bruce Banner', '16104829E', 'HULK', 'Black widow', 'SOMEWHERE IN NEW YORK', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 9, 0, 'florist','normal'),
- (1110, 'Jessica Jones', '58282869H', 'JESSICA JONES', 'Luke Cage', 'NYCC 2015 POSTER', 'Gotham', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, NULL, 0, 'florist','normal'),
+ (1110, 'Jessica Jones', '58282869H', 'JESSICA JONES', 'Luke Cage', 'NYCC 2015 POSTER', 'Gotham', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, NULL, 1, 'florist','normal'),
(1111, 'Missing', NULL, 'MISSING MAN', 'Anton', 'THE SPACE, UNIVERSE FAR AWAY', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, 'others','loses'),
(1112, 'Trash', NULL, 'GARBAGE MAN', 'Unknown name', 'NEW YORK CITY, UNDERGROUND', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, 'others','loses');
@@ -820,10 +822,10 @@ INSERT INTO `vn`.`ticketTracking`(`ticketFk`, `stateFk`, `userFk`, `created`)
(12, 3, 19, util.VN_NOW()),
(13, 3, 19, util.VN_NOW()),
(14, 3, 19, util.VN_NOW()),
- (15, 2, 19, util.VN_NOW()),
+ (15, 10, 19, util.VN_NOW()),
(16, 3, 19, util.VN_NOW()),
(17, 2, 19, util.VN_NOW()),
- (18, 2, 19, util.VN_NOW()),
+ (37, 10, 19, util.VN_NOW()),
(19, 2, 19, util.VN_NOW()),
(20, 1, 19, DATE_ADD(util.VN_NOW(), INTERVAL +1 MONTH)),
(21, 1, 19, DATE_ADD(util.VN_NOW(), INTERVAL +1 MONTH)),
@@ -1030,19 +1032,20 @@ INSERT INTO `vn`.`expeditionStateType`(`id`, `description`, `code`)
INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `freightItemFk`, `created`, `counter`, `workerFk`, `externalId`, `packagingFk`, `stateTypeFk`, `hostFk`)
VALUES
- (1, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 18, 'UR9000006041', 94, 1, 'pc1'),
- (2, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 18, 'UR9000006041', 94, 1, NULL),
- (3, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 18, 'UR9000006041', 94, 2, NULL),
- (4, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 4, 18, 'UR9000006041', 94, 2, NULL),
- (5, 1, 2, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 18, NULL, 94, 3, NULL),
- (6, 7, 3, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), 1, 18, NULL, 94, 3, NULL),
- (7, 2, 4, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), 1, 18, NULL, 94, NULL,NULL),
- (8, 3, 5, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), 1, 18, NULL, 94, 1, NULL),
- (9, 3, 6, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 18, NULL, 94, 2, NULL),
- (10, 7, 7, 71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL),
- (11, 7, 8, 71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL),
- (12, 7, 9, 71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL),
- (13, 1, 10,71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL);
+ (1, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 18, 'UR9000006041', 94, 1, 'pc1'),
+ (2, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 18, 'UR9000006041', 94, 1, NULL),
+ (3, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 18, 'UR9000006041', 94, 2, NULL),
+ (4, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 4, 18, 'UR9000006041', 94, 2, NULL),
+ (5, 1, 2, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 18, NULL, 94, 3, NULL),
+ (6, 7, 3, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), 1, 18, NULL, 94, 3, NULL),
+ (7, 2, 4, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), 1, 18, NULL, 94, NULL,NULL),
+ (8, 3, 5, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), 1, 18, NULL, 94, 1, NULL),
+ (9, 3, 6, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 18, NULL, 94, 2, NULL),
+ (10, 7, 7, 71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL),
+ (11, 7, 8, 71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL),
+ (12, 7, 9, 71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL),
+ (13, 1, 10, 71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL),
+ (14, 1, 37, 71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL);
INSERT INTO `vn`.`expeditionState`(`id`, `created`, `expeditionFk`, `typeFk`, `userFk`)
@@ -1477,7 +1480,8 @@ INSERT INTO `vn`.`ticketWeekly`(`ticketFk`, `weekDay`)
(2, 1),
(3, 2),
(5, 6),
- (15, 6);
+ (15, 6),
+ (17, 6);
INSERT INTO `vn`.`awb` (id, code, package, weight, created, amount, transitoryFk, taxFk)
VALUES
@@ -1493,16 +1497,17 @@ INSERT INTO `vn`.`awb` (id, code, package, weight, created, amount, transitoryFk
(10, '07546500856', 185, 2364, util.VN_CURDATE(), 5321, 442, 1);
INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseOutFk`, `agencyModeFk`, `m3`, `kg`,`ref`, `totalEntries`, `cargoSupplierFk`, `awbFK`)
- VALUES
- (1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), 1, 2, 1, 100.00, 1000, 'first travel', 1, 1, 1),
- (2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 150, 2000, 'second travel', 2, 2, 2),
- (3, util.VN_CURDATE(), util.VN_CURDATE(), 1, 2, 1, 0.00, 0.00, 'third travel', 1, 1, 3),
- (4, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 3, 1, 50.00, 500, 'fourth travel', 0, 2, 4),
- (5, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 3, 1, 50.00, 500, 'fifth travel', 1, 1, 5),
- (6, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 4, 4, 1, 50.00, 500, 'sixth travel', 1, 2, 6),
- (7, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 4, 1, 50.00, 500, 'seventh travel', 2, 1, 7),
- (8, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 1, 1, 50.00, 500, 'eight travel', 1, 2, 10),
- (10, DATE_ADD(util.VN_CURDATE(), INTERVAL + 5 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 5 DAY), 5, 1, 1, 50.00, 500, 'nineth travel', 1, 2, 10);
+ VALUES (1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), 1, 2, 1, 100.00, 1000, 'first travel', 1, 1, 1),
+ (2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 150.00, 2000, 'second travel', 2, 2, 2),
+ (3, util.VN_CURDATE(), util.VN_CURDATE(), 1, 2, 1, 0.00, 0.00, 'third travel', 1, 1, 3),
+ (4, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 3, 1, 50.00, 500, 'fourth travel', 0, 2, 4),
+ (5, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 3, 1, 50.00, 500, 'fifth travel', 1, 1, 5),
+ (6, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 4, 4, 1, 50.00, 500, 'sixth travel', 1, 2, 6),
+ (7, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 4, 1, 50.00, 500, 'seventh travel', 2, 1, 7),
+ (8, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 1, 1, 50.00, 500, 'eight travel', 1, 2, 10),
+ (10, DATE_ADD(util.VN_CURDATE(), INTERVAL +5 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL +5 DAY), 5, 1, 1, 50.00, 500, 'nineth travel', 1, 2, 10),
+ (11, util.VN_CURDATE() - INTERVAL 1 DAY , util.VN_CURDATE(), 6, 3, 0, 50.00, 500, 'eleventh travel', 1, 2, 4),
+ (12, util.VN_CURDATE() , util.VN_CURDATE() + INTERVAL 1 DAY, 6, 3, 0, 50.00, 500, 'eleventh travel', 1, 2, 4);
INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `invoiceNumber`, `reference`, `isExcludedFromAvailable`, `isRaid`, `evaNotes`)
VALUES
@@ -1515,30 +1520,31 @@ INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed
(7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2007', 'Movement 7', 0, 0, 'observation seven'),
(8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2008', 'Movement 8', 1, 1, ''),
(9, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 9', 1, 1, ''),
- (10, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 9', 1, 1, '');
+ (10, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 10', 1, 1, ''),
+ (99, 69, '2000-12-01 00:00:00.000', 11, 0, 442, 'IN2009', 'Movement 99', 0, 0, '');
INSERT INTO `vn`.`entryConfig` (`defaultEntry`, `inventorySupplierFk`, `defaultSupplierFk`)
VALUES (2, 4, 1);
-INSERT INTO `bs`.`waste`(`buyerFk`, `year`, `week`, `itemFk`, `itemTypeFk`, `saleTotal`, `saleWasteQuantity`, `saleInternalWaste`, `saleExternalWaste`)
+INSERT INTO `bs`.`waste`(`buyerFk`, `year`, `week`, `itemFk`, `itemTypeFk`, `saleTotal`, `saleWasteQuantity`, `saleExternalWaste`, `saleFaultWaste`, `saleContainerWaste`, `saleBreakWaste`, `saleOtherWaste`)
VALUES
- ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 1, 1, '1062', '51', '56.20', '56.20'),
- ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 2, 1, '35074', '687', '53.12', '89.69'),
- ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 3, 1, '1777', '13', '12.02', '53.12'),
- ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 4, 1, '3182', '59', '51', '56.20'),
- ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 5, 1, '1747', '13', '53.12', '53.12'),
- ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 6, 1, '7182', '59', '51', '53.12'),
- ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 7, 1, '1777', '13', '89.69', '89.69'),
- ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 8, 1, '4181', '59', '53.12', '53.12'),
- ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 9, 1, '7268', '59', '12.02', '56.20'),
- ('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 2, 1, '-74', '0', '51', '89.69'),
- ('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 3, 1, '-7', '0', '12.02', '53.12'),
- ('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 4, 1, '1100', '0', '51', '56.20'),
- ('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 5, 1, '848', '-187', '12.02', '89.69'),
- ('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 6, 1, '186', '0', '51', '53.12'),
- ('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 7, 1, '277', '0', '53.12', '56.20');
+ ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 1, 1, '1062', '51', '56.20', '56.20', '56.20', '56.20', '56.20'),
+ ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 2, 1, '35074', '687', '53.12', '89.69', '56.20', '56.20', '56.20'),
+ ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 3, 1, '1777', '13', '12.02', '53.12', '56.20', '56.20', '56.20'),
+ ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 4, 1, '3182', '59', '51', '56.20', '56.20', '56.20', '56.20'),
+ ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 5, 1, '1747', '13', '53.12', '53.12', '56.20', '56.20', '56.20'),
+ ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 6, 1, '7182', '59', '51', '53.12', '56.20', '56.20', '56.20'),
+ ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 7, 1, '1777', '13', '89.69', '89.69', '56.20', '56.20', '56.20'),
+ ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 8, 1, '4181', '59', '53.12', '53.12', '56.20', '56.20', '56.20'),
+ ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 9, 1, '7268', '59', '12.02', '56.20', '56.20', '56.20', '56.20'),
+ ('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 2, 1, '-74', '0', '51', '89.69', '56.20', '56.20', '56.20'),
+ ('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 3, 1, '-7', '0', '12.02', '53.12', '56.20', '56.20', '56.20'),
+ ('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 4, 1, '1100', '0', '51', '56.20', '56.20', '56.20', '56.20'),
+ ('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 5, 1, '848', '-187', '12.02', '89.69', '56.20', '56.20', '56.20'),
+ ('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 6, 1, '186', '0', '51', '53.12', '56.20', '56.20', '56.20'),
+ ('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 7, 1, '277', '0', '53.12', '56.20', '56.20', '56.20', '56.20');
-INSERT INTO `vn`.`buy`(`id`,`entryFk`,`itemFk`,`buyingValue`,`quantity`,`packagingFk`,`stickers`,`freightValue`,`packageValue`,`comissionValue`,`packing`,`grouping`,`groupingMode`,`location`,`price1`,`price2`,`price3`, `printedStickers`,`isChecked`,`isIgnored`,`weight`, `created`)
+ INSERT INTO vn.buy(id,entryFk,itemFk,buyingValue,quantity,packagingFk,stickers,freightValue,packageValue,comissionValue,packing,grouping,groupingMode,location,price1,price2,price3,printedStickers,isChecked,isIgnored,weight,created)
VALUES
(1, 1, 1, 50, 5000, 4, 1, 1.500, 1.500, 0.000, 1, 1, 'packing', NULL, 0.00, 99.6, 99.4, 0, 1, 0, 1, util.VN_CURDATE() - INTERVAL 2 MONTH),
(2, 2, 1, 50, 100, 4, 1, 1.500, 1.500, 0.000, 1, 1, 'packing', NULL, 0.00, 99.6, 99.4, 0, 1, 0, 1, util.VN_CURDATE() - INTERVAL 1 MONTH),
@@ -1554,7 +1560,8 @@ INSERT INTO `vn`.`buy`(`id`,`entryFk`,`itemFk`,`buyingValue`,`quantity`,`packagi
(12, 6, 4, 1.25, 0, 3, 1, 2.500, 2.500, 0.000, 10, 10, 'grouping', NULL, 0.00, 1.75, 1.67, 0, 1, 0, 4, util.VN_CURDATE()),
(13, 7, 1, 50, 0, 3, 1, 2.000, 2.000, 0.000, 1, 1, 'packing', NULL, 0.00, 99.6, 99.4, 0, 1, 0, 4, util.VN_CURDATE()),
(14, 7, 2, 5, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 'grouping', NULL, 0.00, 7.30, 7.00, 0, 1, 0, 4, util.VN_CURDATE()),
- (15, 7, 4, 1.25, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 'grouping', NULL, 0.00, 1.75, 1.67, 0, 1, 0, 4, util.VN_CURDATE());
+ (15, 7, 4, 1.25, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 'grouping', NULL, 0.00, 1.75, 1.67, 0, 1, 0, 4, util.VN_CURDATE()),
+ (16, 99,1,50.0000, 5000, 4, 1, 1.500, 1.500, 0.000, 1, 1, 'packing', NULL, 0.00, 99.60, 99.40, 0, 1, 0, 1.00, '2024-07-30 08:13:51.000');
INSERT INTO `hedera`.`order`(`id`, `date_send`, `customer_id`, `delivery_method_id`, `agency_id`, `address_id`, `company_id`, `note`, `source_app`, `confirmed`,`total`, `date_make`, `first_row_stamp`, `confirm_date`)
VALUES
@@ -2435,30 +2442,32 @@ INSERT INTO `vn`.`workerTimeControl`(`userFk`, `timed`, `manual`, `direction`, `
(1107, CONCAT(util.VN_CURDATE(), ' 10:20'), TRUE, 'middle', 1),
(1107, CONCAT(util.VN_CURDATE(), ' 14:50'), TRUE, 'out', 1);
-INSERT INTO `vn`.`dmsType`(`id`, `name`, `readRoleFk`, `writeRoleFk`, `code`)
+INSERT INTO `vn`.`dmsType`
+ (`id`, `name`, `readRoleFk`, `writeRoleFk`, `code`)
VALUES
- (1, 'Facturas Recibidas', NULL, NULL, 'invoiceIn'),
- (2, 'Doc oficial', NULL, NULL, 'officialDoc'),
- (3, 'Laboral', 37, 37, 'hhrrData'),
- (4, 'Albaranes recibidos', NULL, NULL, 'deliveryNote'),
- (5, 'Otros', 1, 1, 'miscellaneous'),
- (6, 'Pruebas', NULL, NULL, 'tests'),
- (7, 'IAE Clientes', 1, 1, 'economicActivitiesTax'),
- (8, 'Fiscal', NULL, NULL, 'fiscal'),
- (9, 'Vehiculos', NULL, NULL, 'vehicles'),
- (10, 'Plantillas', NULL, NULL, 'templates'),
- (11, 'Contratos', NULL, NULL, 'contracts'),
- (12, 'ley de pagos', 1, 1, 'paymentsLaw'),
- (13, 'Basura', 1, 1, 'trash'),
- (14, 'Ticket', 1, 1, 'ticket'),
- (15, 'Presupuestos', NULL, NULL, 'budgets'),
- (16, 'Logistica', NULL, NULL, 'logistics'),
- (17, 'cmr', 1, 1, 'cmr'),
- (18, 'dua', NULL, NULL, 'dua'),
- (19, 'inmovilizado', NULL, NULL, 'fixedAssets'),
- (20, 'Reclamación', 1, 1, 'claim'),
- (21, 'Entrada', 1, 1, 'entry'),
- (22, 'Proveedor', 1, 1, 'supplier');
+ (1, 'Facturas Recibidas', NULL, NULL, 'invoiceIn'),
+ (2, 'Doc oficial', NULL, NULL, 'officialDoc'),
+ (3, 'Laboral', 37, 37, 'hhrrData'),
+ (4, 'Albaranes recibidos', NULL, NULL, 'deliveryNote'),
+ (5, 'Otros', 1, 1, 'miscellaneous'),
+ (6, 'Pruebas', NULL, NULL, 'tests'),
+ (7, 'IAE Clientes', 1, 1, 'economicActivitiesTax'),
+ (8, 'Fiscal', NULL, NULL, 'fiscal'),
+ (9, 'Vehiculos', NULL, NULL, 'vehicles'),
+ (10, 'Plantillas', NULL, NULL, 'templates'),
+ (11, 'Contratos', NULL, NULL, 'contracts'),
+ (12, 'ley de pagos', 1, 1, 'paymentsLaw'),
+ (13, 'Basura', 1, 1, 'trash'),
+ (14, 'Ticket', 1, 1, 'ticket'),
+ (15, 'Presupuestos', NULL, NULL, 'budgets'),
+ (16, 'Logistica', NULL, NULL, 'logistics'),
+ (17, 'cmr', 1, 1, 'cmr'),
+ (18, 'dua', NULL, NULL, 'dua'),
+ (19, 'inmovilizado', NULL, NULL, 'fixedAssets'),
+ (20, 'Reclamación', 1, 1, 'claim'),
+ (21, 'Entrada', 1, 1, 'entry'),
+ (22, 'Proveedor', 1, 1, 'supplier'),
+ (23, 'Termografos', 35, 35, 'thermograph');
INSERT INTO `vn`.`dms`(`id`, `dmsTypeFk`, `file`, `contentType`, `workerFk`, `warehouseFk`, `companyFk`, `hardCopyNumber`, `hasFile`, `reference`, `description`, `created`)
VALUES
@@ -2466,7 +2475,7 @@ INSERT INTO `vn`.`dms`(`id`, `dmsTypeFk`, `file`, `contentType`, `workerFk`, `wa
(2, 5, '2.txt', 'text/plain', 5, 1, 442, 1, TRUE, 'Client:104', 'Client:104 dms for the client', util.VN_CURDATE()),
(3, 5, '3.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'Client: 104', 'Client:104 readme', util.VN_CURDATE()),
(4, 3, '4.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'Worker: 106', 'Worker:106 readme', util.VN_CURDATE()),
- (5, 5, '5.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'travel: 1', 'dmsForThermograph', util.VN_CURDATE()),
+ (5, 23, '5.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'travel: 1', 'dmsForThermograph', util.VN_CURDATE()),
(6, 5, '6.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'NotExists', 'DoesNotExists', util.VN_CURDATE()),
(7, 20, '7.jpg', 'image/jpeg', 9, 1, 442, NULL, FALSE, '1', 'TICKET ID DEL CLIENTE BRUCE WAYNE ID 1101', util.VN_CURDATE()),
(8, 20, '8.mp4', 'video/mp4', 9, 1, 442, NULL, FALSE, '1', 'TICKET ID DEL CLIENTE BRUCE WAYNE ID 1101', util.VN_CURDATE()),
@@ -2487,7 +2496,7 @@ INSERT INTO `vn`.`clientDms`(`clientFk`, `dmsFk`)
(1104, 2),
(1104, 3);
-INSERT INTO `vn`.`workerDocument`(`id`, `worker`, `document`,`isReadableByWorker`)
+INSERT INTO `vn`.`workerDms`(`id`, `workerFk`, `dmsFk`,`isReadableByWorker`)
VALUES
(1, 1106, 4, TRUE),
(2, 1107, 3, FALSE);
@@ -2516,14 +2525,15 @@ INSERT INTO `vn`.`thermograph`(`id`, `model`)
('138350-0', 'DISPOSABLE');
-INSERT INTO `vn`.`travelThermograph`(`thermographFk`, `created`, `warehouseFk`, `travelFk`, `temperatureFk`, `result`, `dmsFk`)
+INSERT INTO `vn`.`travelThermograph`
+ (`thermographFk`, `created`, `warehouseFk`, `travelFk`, `temperatureFk`, `minTemperature`, `maxTemperature`, `result`, `dmsFk`)
VALUES
- ('TMM190901395', util.VN_CURDATE(), 1, 1, 'WARM', 'Ok', NULL),
- ('TL.BBA85422', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 2, 'COOL', 'Ok', NULL),
- ('TL.BBA85422', util.VN_CURDATE(), 2, 1, 'COOL', 'can not read the temperature', NULL),
- ('TZ1905012010', util.VN_CURDATE(), 1, 1, 'WARM', 'Temperature in range', 5),
- ('138350-0', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 'WARM', NULL, 5),
- ('138350-0', util.VN_CURDATE(), 1, NULL, 'COOL', NULL, NULL);
+ ('TMM190901395', util.VN_CURDATE(), 1, 1, 'WARM', NULL, NULL, 'Ok', NULL),
+ ('TL.BBA85422', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 2, 'COOL', NULL, NULL, 'Ok', NULL),
+ ('TL.BBA85422', util.VN_CURDATE(), 2, 1, 'COOL', NULL, NULL, 'can not read the temperature', NULL),
+ ('TZ1905012010', util.VN_CURDATE(), 1, 1, 'WARM', NULL, NULL, 'Temperature in range', 5),
+ ('138350-0', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 'WARM', 2, 12, NULL, 5),
+ ('138350-0', util.VN_CURDATE(), 1, NULL, 'COOL', NULL, NULL, NULL, NULL);
REPLACE INTO `vn`.`incoterms`(`code`, `name`)
VALUES
@@ -2572,18 +2582,18 @@ INSERT INTO `vn`.`rate`(`dated`, `warehouseFk`, `rate0`, `rate1`, `rate2`, `rate
(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR), 1, 10, 15, 20, 25),
(util.VN_CURDATE(), 1, 12, 17, 22, 27);
-INSERT INTO `vn`.`dua` (id, code, awbFk__, issued, operated, booked, bookEntried, gestdocFk, customsValue, companyFk)
+INSERT INTO `vn`.`dua` (id, code, issued, operated, booked, bookEntried, gestdocFk, customsValue, companyFk)
VALUES
- (1, '19ES0028013A481523', 1, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 1, 11276.95, 442),
- (2, '21ES00280136115760', 2, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 1376.20, 442),
- (3, '19ES00280131956004', 3, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 3, 14268.50, 442),
- (4, '19ES00280131955995', 4, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 1, 8242.50, 442),
- (5, '19ES00280132022070', 5, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 10012.49, 442),
- (6, '19ES00280132032308', 6, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 19914.25, 442),
- (7, '19ES00280132025489', 7, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 1934.06, 442),
- (8, '19ES00280132025490', 8, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 3618.52, 442),
- (9, '19ES00280132025491', 9, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 7126.23, 442),
- (10, '19ES00280132025492', 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 4631.45, 442);
+ (1, '19ES0028013A481523', util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 1, 11276.95, 442),
+ (2, '21ES00280136115760', util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 1376.20, 442),
+ (3, '19ES00280131956004', util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 3, 14268.50, 442),
+ (4, '19ES00280131955995', util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 1, 8242.50, 442),
+ (5, '19ES00280132022070', util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 10012.49, 442),
+ (6, '19ES00280132032308', util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 19914.25, 442),
+ (7, '19ES00280132025489', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 1934.06, 442),
+ (8, '19ES00280132025490', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 3618.52, 442),
+ (9, '19ES00280132025491', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 7126.23, 442),
+ (10, '19ES00280132025492', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 4631.45, 442);
INSERT INTO `vn`.`duaEntry` (`duaFk`, `entryFk`, `value`, `customsValue`, `euroValue`)
VALUES
@@ -3056,9 +3066,6 @@ INSERT INTO `vn`.`workerTimeControlMail` (`id`, `workerFk`, `year`, `week`, `sta
(3, 9, 2000, 51, 'CONFIRMED', util.VN_NOW(), 1, NULL),
(4, 9, 2001, 1, 'SENDED', util.VN_NOW(), 1, NULL);
-INSERT INTO `vn`.`wagonConfig` (`id`, `width`, `height`, `maxWagonHeight`, `minHeightBetweenTrays`, `maxTrays`)
- VALUES
- (1, 1350, 1900, 200, 50, 6);
INSERT INTO `vn`.`wagonTypeColor` (`id`, `name`, `rgb`)
VALUES
@@ -3067,15 +3074,19 @@ INSERT INTO `vn`.`wagonTypeColor` (`id`, `name`, `rgb`)
(3, 'green', '#00ff00'),
(4, 'blue', '#0000ff');
+INSERT INTO `vn`.`wagonConfig` (`id`, `width`, `height`, `maxWagonHeight`, `minHeightBetweenTrays`, `maxTrays`, `defaultTrayColorFk`)
+ VALUES
+ (1, 1350, 1900, 200, 50, 6, 1);
+
INSERT INTO `vn`.`wagonType` (`id`, `name`, `divisible`)
VALUES
(1, 'Wagon Type #1', 1);
-INSERT INTO `vn`.`wagonTypeTray` (`id`, `typeFk`, `height`, `colorFk`)
+INSERT INTO `vn`.`wagonTypeTray` (`id`, `wagonTypeFk`, `height`, `wagonTypeColorFk`)
VALUES
- (1, 1, 100, 1),
+ (1, 1, 0, 1),
(2, 1, 50, 2),
- (3, 1, 0, 3);
+ (3, 1, 100, 3);
INSERT INTO `salix`.`accessTokenConfig` (`id`, `renewPeriod`, `courtesyTime`, `renewInterval`)
VALUES
@@ -3179,7 +3190,7 @@ UPDATE vn.department
SET workerFk = null;
INSERT INTO vn.packaging
- VALUES('--', 2745600.00, 100.00, 120.00, 220.00, 0.00, 1, '2001-01-01 00:00:00.000', NULL, NULL, NULL, 0.00, 16, 0.00, 0, NULL, 0.00, NULL, NULL, 0, NULL, 0, 0);
+ VALUES('--', 2745600.00, 100.00, 120.00, 220.00, 0.00, 1, '2001-01-01 00:00:00.000', NULL, NULL, NULL, 0.00, 16, 0.00, 0, NULL, 0.00, NULL, NULL, 0, NULL, 0, 0,0);
INSERT IGNORE INTO vn.intrastat
@@ -3920,6 +3931,16 @@ INSERT INTO `vn`.`calendarHolidays` (calendarHolidaysTypeFk, dated, calendarHoli
(1, '2001-05-17', 1, 5),
(1, '2001-05-18', 1, 5);
+INSERT INTO vn.medicalReview
+(id, workerFk, centerFk, `date`, `time`, isFit, amount, invoice, remark)
+VALUES(1, 1106, 1, '2000-01-01', '08:10', 1, 200.0, NULL, '');
+INSERT INTO vn.medicalReview
+(id, workerFk, centerFk, `date`, `time`, isFit, amount, invoice, remark)
+VALUES(2, 1106, 2, '2001-01-01', '09:10', 0, 10.0, NULL, NULL);
+INSERT INTO vn.medicalReview
+(id, workerFk, centerFk, `date`, `time`, isFit, amount, invoice, remark)
+VALUES(3, 9, 2, '2000-01-01', '8:00', 1, 150.0, NULL, NULL);
+
INSERT INTO vn.payrollComponent
(id, name, isSalaryAgreed, isVariable, isException)
VALUES
@@ -3957,3 +3978,7 @@ VALUES
(4, 'Referencia Transferencias', 'trnRef'),
(5, 'Referencia Nominas', 'payRef'),
(6, 'ABA', 'aba');
+
+INSERT IGNORE INTO ormConfig
+ SET id =1,
+ selectLimit = 1000;
diff --git a/db/routines/bi/procedures/clean.sql b/db/routines/bi/procedures/clean.sql
index ba43b609c..a1eb99166 100644
--- a/db/routines/bi/procedures/clean.sql
+++ b/db/routines/bi/procedures/clean.sql
@@ -1,5 +1,5 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bi`.`clean`()
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bi`.`clean`()
BEGIN
DECLARE vDateShort DATETIME;
DECLARE vDateLong DATETIME;
@@ -15,5 +15,5 @@ BEGIN
DELETE FROM bi.defaulters WHERE `date` < vDateLong;
DELETE FROM bi.defaulting WHERE `date` < vDateLong;
-END$$
-DELIMITER ;
+END$$
+DELIMITER ;
diff --git a/db/routines/bi/procedures/facturacion_media_anual_update.sql b/db/routines/bi/procedures/facturacion_media_anual_update.sql
index b956f353a..e8810cc21 100644
--- a/db/routines/bi/procedures/facturacion_media_anual_update.sql
+++ b/db/routines/bi/procedures/facturacion_media_anual_update.sql
@@ -1,5 +1,5 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bi`.`facturacion_media_anual_update`()
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bi`.`facturacion_media_anual_update`()
BEGIN
TRUNCATE TABLE bs.clientAnnualConsumption;
@@ -12,5 +12,5 @@ BEGIN
GROUP BY clientFk, year, month
) vol
GROUP BY clientFk;
-END$$
-DELIMITER ;
+END$$
+DELIMITER ;
diff --git a/db/routines/bs/procedures/carteras_add.sql b/db/routines/bs/procedures/carteras_add.sql
index 6de377371..5143b4bb5 100644
--- a/db/routines/bs/procedures/carteras_add.sql
+++ b/db/routines/bs/procedures/carteras_add.sql
@@ -1,5 +1,5 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`carteras_add`()
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`carteras_add`()
BEGIN
/**
* Inserta en la tabla @bs.carteras las ventas desde el año pasado
@@ -23,5 +23,5 @@ BEGIN
GROUP BY w.code, t.`year`, t.`month`;
DROP TEMPORARY TABLE tmp.time;
-END$$
-DELIMITER ;
+END$$
+DELIMITER ;
diff --git a/db/routines/bs/procedures/nightTask_launchAll.sql b/db/routines/bs/procedures/nightTask_launchAll.sql
index 59899ee03..e61e88bb6 100644
--- a/db/routines/bs/procedures/nightTask_launchAll.sql
+++ b/db/routines/bs/procedures/nightTask_launchAll.sql
@@ -1,5 +1,5 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`nightTask_launchAll`()
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`nightTask_launchAll`()
BEGIN
/**
* Runs all nightly tasks.
@@ -76,5 +76,5 @@ BEGIN
END IF;
END LOOP;
CLOSE vQueue;
-END$$
-DELIMITER ;
+END$$
+DELIMITER ;
diff --git a/db/routines/bs/procedures/salesByItemTypeDay_addLauncher.sql b/db/routines/bs/procedures/salesByItemTypeDay_addLauncher.sql
index 3424bac74..63677def6 100644
--- a/db/routines/bs/procedures/salesByItemTypeDay_addLauncher.sql
+++ b/db/routines/bs/procedures/salesByItemTypeDay_addLauncher.sql
@@ -1,6 +1,6 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`salesByItemTypeDay_addLauncher`()
-BEGIN
- CALL bs.salesByItemTypeDay_add(util.VN_CURDATE() - INTERVAL 30 DAY, util.VN_CURDATE());
+BEGIN
+ CALL bs.salesByItemTypeDay_add(util.VN_CURDATE() - INTERVAL 30 DAY, util.VN_CURDATE());
END$$
DELIMITER ;
diff --git a/db/routines/bs/procedures/waste_addSales.sql b/db/routines/bs/procedures/waste_addSales.sql
index 20eee5d49..ea4adbc27 100644
--- a/db/routines/bs/procedures/waste_addSales.sql
+++ b/db/routines/bs/procedures/waste_addSales.sql
@@ -1,8 +1,22 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`waste_addSales`()
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`waste_addSales`(
+ vDateFrom DATE,
+ vDateTo DATE
+)
BEGIN
- DECLARE vDateFrom DATE DEFAULT util.VN_CURDATE() - INTERVAL WEEKDAY(util.VN_CURDATE()) DAY;
- DECLARE vDateTo DATE DEFAULT vDateFrom + INTERVAL 6 DAY;
+/**
+ * Recalcula las mermas de un periodo.
+ *
+ * @param vDateFrom Fecha desde
+ * @param vDateTo Fecha hasta
+ */
+ IF vDateFrom IS NULL THEN
+ SET vDateFrom = util.VN_CURDATE() - INTERVAL WEEKDAY(util.VN_CURDATE()) DAY;
+ END IF;
+
+ IF vDateTo IS NULL THEN
+ SET vDateTo = vDateFrom + INTERVAL 6 DAY;
+ END IF;
CALL cache.last_buy_refresh(FALSE);
@@ -14,16 +28,32 @@ BEGIN
s.itemFk,
SUM((b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity),
SUM(IF(aw.`type`, s.quantity, 0)),
- SUM(
- IF(
- aw.`type` = 'internal',
+ SUM(IF(
+ aw.`type` = 'external',
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
0
)
- ),
- SUM(
- IF(
- aw.`type` = 'external',
+ ),
+ SUM(IF(
+ aw.`type` = 'fault',
+ (b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
+ 0
+ )
+ ),
+ SUM(IF(
+ aw.`type` = 'container',
+ (b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
+ 0
+ )
+ ),
+ SUM(IF(
+ aw.`type` = 'break',
+ (b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
+ 0
+ )
+ ),
+ SUM(IF(
+ aw.`type` = 'other',
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
0
)
@@ -40,6 +70,6 @@ BEGIN
JOIN vn.buy b ON b.id = lb.buy_id
WHERE t.shipped BETWEEN vDateFrom AND vDateTo
AND w.isManaged
- GROUP BY i.id;
+ GROUP BY YEAR(t.shipped), WEEK(t.shipped, 4), i.id;
END$$
DELIMITER ;
diff --git a/db/routines/bs/procedures/waste_addSalesLauncher.sql b/db/routines/bs/procedures/waste_addSalesLauncher.sql
new file mode 100644
index 000000000..5eaea9be4
--- /dev/null
+++ b/db/routines/bs/procedures/waste_addSalesLauncher.sql
@@ -0,0 +1,6 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`waste_addSalesLauncher`()
+BEGIN
+ CALL waste_addSales(NULL, NULL);
+END$$
+DELIMITER ;
diff --git a/db/routines/cache/procedures/available_refresh.sql b/db/routines/cache/procedures/available_refresh.sql
index abf023a41..87c003648 100644
--- a/db/routines/cache/procedures/available_refresh.sql
+++ b/db/routines/cache/procedures/available_refresh.sql
@@ -1,5 +1,10 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`available_refresh`(OUT `vCalc` INT, IN `vRefresh` INT, IN `vWarehouse` INT, IN `vDated` DATE)
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`available_refresh`(
+ OUT `vCalc` INT,
+ `vRefresh` INT,
+ `vWarehouse` INT,
+ `vDated` DATE
+)
proc: BEGIN
DECLARE vStartDate DATE;
DECLARE vReserveDate DATETIME;
diff --git a/db/routines/cache/procedures/available_updateItem.sql b/db/routines/cache/procedures/available_updateItem.sql
new file mode 100644
index 000000000..8e94a9d75
--- /dev/null
+++ b/db/routines/cache/procedures/available_updateItem.sql
@@ -0,0 +1,31 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`available_updateItem`(
+ `vItem` INT,
+ `vWarehouse` INT,
+ `vDated` DATE,
+ `vQuantity` INT
+)
+BEGIN
+/**
+ * Immediately deduct/add an amount from the available cache (if exists).
+ *
+ * @param vItem The item id
+ * @param vWarehouse The warehouse id
+ * @param vDated Available cache date
+ * @param vQuantity The amount to be deducted from the cache
+ */
+ DECLARE vCalc INT;
+
+ SELECT id INTO vCalc
+ FROM cache_calc
+ WHERE cacheName = 'available'
+ AND params = CONCAT_WS('/', vWarehouse, vDated);
+
+ IF vCalc IS NOT NULL THEN
+ UPDATE available
+ SET available = available - vQuantity
+ WHERE calc_id = vCalc
+ AND item_id = vItem;
+ END IF;
+END$$
+DELIMITER ;
diff --git a/db/routines/cache/procedures/cache_calc_end.sql b/db/routines/cache/procedures/cache_calc_end.sql
index b3a25532b..b74a1b7fd 100644
--- a/db/routines/cache/procedures/cache_calc_end.sql
+++ b/db/routines/cache/procedures/cache_calc_end.sql
@@ -1,5 +1,5 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`cache_calc_end`(IN `v_calc` INT)
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`cache_calc_end`(IN `v_calc` INT)
BEGIN
DECLARE v_cache_name VARCHAR(255);
DECLARE v_params VARCHAR(255);
@@ -21,5 +21,5 @@ BEGIN
IF v_cache_name IS NOT NULL THEN
DO RELEASE_LOCK(CONCAT_WS('/', v_cache_name, IFNULL(v_params, '')));
END IF;
-END$$
-DELIMITER ;
+END$$
+DELIMITER ;
diff --git a/db/routines/cache/procedures/cache_calc_start.sql b/db/routines/cache/procedures/cache_calc_start.sql
index 701bb1a68..933d926ef 100644
--- a/db/routines/cache/procedures/cache_calc_start.sql
+++ b/db/routines/cache/procedures/cache_calc_start.sql
@@ -1,5 +1,5 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`cache_calc_start`(OUT `v_calc` INT, INOUT `v_refresh` INT, IN `v_cache_name` VARCHAR(50), IN `v_params` VARCHAR(100))
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`cache_calc_start`(OUT `v_calc` INT, INOUT `v_refresh` INT, IN `v_cache_name` VARCHAR(50), IN `v_params` VARCHAR(100))
proc: BEGIN
DECLARE v_valid BOOL;
DECLARE v_lock_id VARCHAR(100);
@@ -83,5 +83,5 @@ proc: BEGIN
-- Si se debe recalcular mantiene el bloqueo y devuelve su identificador.
SET v_refresh = TRUE;
-END$$
-DELIMITER ;
+END$$
+DELIMITER ;
diff --git a/db/routines/cache/procedures/last_buy_refresh.sql b/db/routines/cache/procedures/last_buy_refresh.sql
index 555ae0b8d..86a5e8d8c 100644
--- a/db/routines/cache/procedures/last_buy_refresh.sql
+++ b/db/routines/cache/procedures/last_buy_refresh.sql
@@ -4,7 +4,7 @@ proc: BEGIN
/**
* Crea o actualiza la cache con la última compra y fecha de cada
* artículo hasta ayer. Para obtener la última compra hasta una fecha
- * determinada utilizar el procedimiento vn.buyUltimate().
+ * determinada utilizar el procedimiento vn.buy_getUltimate().
*
* @param vRefresh %TRUE para forzar el recálculo de la cache
*/
diff --git a/db/routines/edi/events/floramondo.sql b/db/routines/edi/events/floramondo.sql
deleted file mode 100644
index 0a38f3537..000000000
--- a/db/routines/edi/events/floramondo.sql
+++ /dev/null
@@ -1,8 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `edi`.`floramondo`
- ON SCHEDULE EVERY 6 MINUTE
- STARTS '2022-01-28 09:52:45.000'
- ON COMPLETION NOT PRESERVE
- DISABLE
-DO CALL edi.floramondo_offerRefresh()$$
-DELIMITER ;
diff --git a/db/routines/edi/procedures/floramondo_offerRefresh.sql b/db/routines/edi/procedures/floramondo_offerRefresh.sql
deleted file mode 100644
index 18d3f8b7e..000000000
--- a/db/routines/edi/procedures/floramondo_offerRefresh.sql
+++ /dev/null
@@ -1,522 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `edi`.`floramondo_offerRefresh`()
-proc: BEGIN
- DECLARE vLanded DATETIME;
- DECLARE vDone INT DEFAULT FALSE;
- DECLARE vFreeId INT;
- DECLARE vSupplyResponseFk INT;
- DECLARE vLastInserted DATETIME;
- DECLARE vIsAuctionDay BOOLEAN;
- DECLARE vMaxNewItems INT DEFAULT 10000;
- DECLARE vStartingTime DATETIME;
- DECLARE vAalsmeerMarketPlaceID VARCHAR(13) DEFAULT '8713783439043';
- DECLARE vDayRange INT;
-
- DECLARE cur1 CURSOR FOR
- SELECT id
- FROM edi.item_free;
-
- DECLARE cur2 CURSOR FOR
- SELECT srId
- FROM itemToInsert;
-
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
- DECLARE EXIT HANDLER FOR SQLSTATE '45000'
- BEGIN
- ROLLBACK;
- RESIGNAL;
- END;
-
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
- BEGIN
- DO RELEASE_LOCK('edi.floramondo_offerRefresh');
- SET @isTriggerDisabled = FALSE;
- RESIGNAL;
- END;
-
- IF 'test' = (SELECT environment FROM util.config) THEN
- LEAVE proc;
- END IF;
-
- IF !GET_LOCK('edi.floramondo_offerRefresh', 0) THEN
- LEAVE proc;
- END IF;
-
- SELECT dayRange INTO vDayRange
- FROM offerRefreshConfig;
-
- IF vDayRange IS NULL THEN
- CALL util.throw("Variable vDayRange not declared");
- END IF;
-
- SET vStartingTime = util.VN_NOW();
-
- TRUNCATE edi.offerList;
-
- INSERT INTO edi.offerList(supplier, total)
- SELECT v.name, COUNT(DISTINCT sr.ID) total
- FROM edi.supplyResponse sr
- JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID
- WHERE sr.NumberOfUnits > 0
- AND sr.EmbalageCode != 999
- GROUP BY sr.vmpID;
-
- UPDATE edi.offerList o
- JOIN (SELECT v.name, COUNT(*) total
- FROM edi.supplyOffer sr
- JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID
- GROUP BY sr.vmpID) sub ON o.supplier = sub.name
- SET o.`filter` = sub.total;
-
- -- Elimina de la lista de items libres aquellos que ya existen
- DELETE itf.*
- FROM edi.item_free itf
- JOIN vn.item i ON i.id = itf.id;
-
- CREATE OR REPLACE TEMPORARY TABLE tmp
- (INDEX (`Item_ArticleCode`))
- ENGINE = MEMORY
- SELECT t.*
- FROM (
- SELECT *
- FROM edi.supplyOffer
- ORDER BY (MarketPlaceID = vAalsmeerMarketPlaceID) DESC,
- NumberOfUnits DESC LIMIT 10000000000000000000) t
- GROUP BY t.srId;
-
- CREATE OR REPLACE TEMPORARY TABLE edi.offer (INDEX (`srID`), INDEX (`EmbalageCode`),
- INDEX (`ef1`), INDEX (`ef2`), INDEX (`ef3`), INDEX (`ef4`),INDEX (`ef5`), INDEX (`ef6`),
- INDEX (`s1Value`), INDEX (`s2Value`), INDEX (`s3Value`), INDEX (`s4Value`),INDEX (`s5Value`), INDEX (`s6Value`))
- ENGINE = MEMORY
- SELECT so.*,
- ev1.type_description s1Value,
- ev2.type_description s2Value,
- ev3.type_description s3Value,
- ev4.type_description s4Value,
- ev5.type_description s5Value,
- ev6.type_description s6Value,
- eif1.feature ef1,
- eif2.feature ef2,
- eif3.feature ef3,
- eif4.feature ef4,
- eif5.feature ef5,
- eif6.feature ef6
- FROM tmp so
- LEFT JOIN edi.item_feature eif1 ON eif1.item_id = so.Item_ArticleCode
- AND eif1.presentation_order = 1
- AND eif1.expiry_date IS NULL
- LEFT JOIN edi.item_feature eif2 ON eif2.item_id = so.Item_ArticleCode
- AND eif2.presentation_order = 2
- AND eif2.expiry_date IS NULL
- LEFT JOIN edi.item_feature eif3 ON eif3.item_id = so.Item_ArticleCode
- AND eif3.presentation_order = 3
- AND eif3.expiry_date IS NULL
- LEFT JOIN edi.item_feature eif4 ON eif4.item_id = so.Item_ArticleCode
- AND eif4.presentation_order = 4
- AND eif4.expiry_date IS NULL
- LEFT JOIN edi.item_feature eif5 ON eif5.item_id = so.Item_ArticleCode
- AND eif5.presentation_order = 5
- AND eif5.expiry_date IS NULL
- LEFT JOIN edi.item_feature eif6 ON eif6.item_id = so.Item_ArticleCode
- AND eif6.presentation_order = 6
- AND eif6.expiry_date IS NULL
- LEFT JOIN edi.`value` ev1 ON ev1.type_id = eif1.feature
- AND so.s1 = ev1.type_value
- LEFT JOIN edi.`value` ev2 ON ev2.type_id = eif2.feature
- AND so.s2 = ev2.type_value
- LEFT JOIN edi.`value` ev3 ON ev3.type_id = eif3.feature
- AND so.s3 = ev3.type_value
- LEFT JOIN edi.`value` ev4 ON ev4.type_id = eif4.feature
- AND so.s4 = ev4.type_value
- LEFT JOIN edi.`value` ev5 ON ev5.type_id = eif5.feature
- AND so.s5 = ev5.type_value
- LEFT JOIN edi.`value` ev6 ON ev6.type_id = eif6.feature
- AND so.s6 = ev6.type_value
- ORDER BY Price;
-
- DROP TEMPORARY TABLE tmp;
-
- DELETE o
- FROM edi.offer o
- LEFT JOIN vn.tag t1 ON t1.ediTypeFk = o.ef1 AND t1.overwrite = 'size'
- LEFT JOIN vn.tag t2 ON t2.ediTypeFk = o.ef2 AND t2.overwrite = 'size'
- LEFT JOIN vn.tag t3 ON t3.ediTypeFk = o.ef3 AND t3.overwrite = 'size'
- LEFT JOIN vn.tag t4 ON t4.ediTypeFk = o.ef4 AND t4.overwrite = 'size'
- LEFT JOIN vn.tag t5 ON t5.ediTypeFk = o.ef5 AND t5.overwrite = 'size'
- LEFT JOIN vn.tag t6 ON t6.ediTypeFk = o.ef6 AND t6.overwrite = 'size'
- JOIN vn.floramondoConfig fc ON TRUE
- WHERE (t1.id IS NOT NULL AND CONVERT(s1Value, UNSIGNED) > fc.itemMaxSize)
- OR (t2.id IS NOT NULL AND CONVERT(s2Value, UNSIGNED) > fc.itemMaxSize)
- OR (t3.id IS NOT NULL AND CONVERT(s3Value, UNSIGNED) > fc.itemMaxSize)
- OR (t4.id IS NOT NULL AND CONVERT(s4Value, UNSIGNED) > fc.itemMaxSize)
- OR (t5.id IS NOT NULL AND CONVERT(s5Value, UNSIGNED) > fc.itemMaxSize)
- OR (t6.id IS NOT NULL AND CONVERT(s6Value, UNSIGNED) > fc.itemMaxSize);
-
- START TRANSACTION;
-
- -- Actualizamos el campo supplyResponseFk para aquellos articulos que ya estan creados y reutilizamos
- UPDATE IGNORE edi.offer o
- JOIN vn.item i
- ON i.name = o.product_name
- AND i.subname <=> o.company_name
- AND i.value5 <=> o.s1Value
- AND i.value6 <=> o.s2Value
- AND i.value7 <=> o.s3Value
- AND i.value8 <=> o.s4Value
- AND i.value9 <=> o.s5Value
- AND i.value10 <=> o.s6Value
- AND i.NumberOfItemsPerCask <=> o.NumberOfItemsPerCask
- AND i.EmbalageCode <=> o.EmbalageCode
- AND i.quality <=> o.Quality
- JOIN vn.itemType it ON it.id = i.typeFk
- LEFT JOIN vn.sale s ON s.itemFk = i.id
- LEFT JOIN vn.ticket t ON t.id = s.ticketFk
- AND t.shipped > (util.VN_CURDATE() - INTERVAL 1 WEEK)
- LEFT JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk
- LEFT JOIN edi.deliveryInformation di ON di.supplyResponseID = sr.ID
- LEFT JOIN edi.putOrder po ON po.supplyResponseID = i.supplyResponseFk
- AND po.OrderTradeLineDateTime > (util.VN_CURDATE() - INTERVAL 1 WEEK)
- SET i.supplyResponseFk = o.srID
- WHERE (sr.ID IS NULL
- OR sr.NumberOfUnits = 0
- OR di.LatestOrderDateTime < util.VN_NOW()
- OR di.ID IS NULL)
- AND it.isInventory
- AND t.id IS NULL
- AND po.id IS NULL;
-
- CREATE OR REPLACE TEMPORARY TABLE itemToInsert
- ENGINE = MEMORY
- SELECT o.*, CAST(NULL AS DECIMAL(6,0)) itemFk
- FROM edi.offer o
- LEFT JOIN vn.item i ON i.supplyResponseFk = o.srId
- WHERE i.id IS NULL
- LIMIT vMaxNewItems;
-
- -- Reciclado de nº de item
- OPEN cur1;
- OPEN cur2;
-
- read_loop: LOOP
-
- FETCH cur2 INTO vSupplyResponseFk;
- FETCH cur1 INTO vFreeId;
-
- IF vDone THEN
- LEAVE read_loop;
- END IF;
-
- UPDATE itemToInsert
- SET itemFk = vFreeId
- WHERE srId = vSupplyResponseFk;
-
- END LOOP;
-
- CLOSE cur1;
- CLOSE cur2;
-
- -- Insertamos todos los items en Articles de la oferta
- INSERT INTO vn.item(id,
- `name`,
- longName,
- subName,
- expenseFk,
- typeFk,
- intrastatFk,
- originFk,
- supplyResponseFk,
- numberOfItemsPerCask,
- embalageCode,
- quality,
- isFloramondo)
- SELECT iti.itemFk,
- iti.product_name,
- iti.product_name,
- iti.company_name,
- iti.expenseFk,
- iti.itemTypeFk,
- iti.intrastatFk,
- iti.originFk,
- iti.`srId`,
- iti.NumberOfItemsPerCask,
- iti.EmbalageCode,
- iti.Quality,
- TRUE
- FROM itemToInsert iti;
-
- -- Inserta la foto de los articulos nuevos (prioridad alta)
- INSERT IGNORE INTO vn.itemImageQueue(itemFk, url)
- SELECT i.id, PictureReference
- FROM itemToInsert ii
- JOIN vn.item i ON i.supplyResponseFk = ii.srId
- WHERE PictureReference IS NOT NULL
- AND i.image IS NULL;
-
- INSERT INTO edi.`log`(tableName, fieldName,fieldValue)
- SELECT 'itemImageQueue','NumImagenesPtes', COUNT(*)
- FROM vn.itemImageQueue
- WHERE attempts = 0;
-
- -- Inserta si se añadiesen tags nuevos
- INSERT IGNORE INTO vn.tag (name, ediTypeFk)
- SELECT description, type_id FROM edi.type;
-
- -- Desabilita el trigger para recalcular los tags al final
- SET @isTriggerDisabled = TRUE;
-
- -- Inserta los tags sólo en los articulos nuevos
- INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
- SELECT i.id, t.id , ii.product_name, 1
- FROM itemToInsert ii
- JOIN vn.tag t ON t.`name` = 'Producto'
- JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
- WHERE NOT ii.product_name IS NULL;
-
- INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
- SELECT i.id, t.id , ii.Quality, 3
- FROM itemToInsert ii
- JOIN vn.tag t ON t.`name` = 'Calidad'
- JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
- WHERE NOT ii.Quality IS NULL;
-
- INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
- SELECT i.id, t.id , ii.company_name, 4
- FROM itemToInsert ii
- JOIN vn.tag t ON t.`name` = 'Productor'
- JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
- WHERE NOT ii.company_name IS NULL;
-
- INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
- SELECT i.id, t.id , s1Value, 5
- FROM itemToInsert ii
- JOIN vn.tag t ON t.ediTypeFk = ii.ef1
- JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
- WHERE NOT s1Value IS NULL;
-
- INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
- SELECT i.id, t.id , s2Value, 6
- FROM itemToInsert ii
- JOIN vn.tag t ON t.ediTypeFk = ii.ef2
- JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
- WHERE NOT s2Value IS NULL;
-
- INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
- SELECT i.id, t.id , s3Value, 7
- FROM itemToInsert ii
- JOIN vn.tag t ON t.ediTypeFk = ii.ef3
- JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
- WHERE NOT s3Value IS NULL;
-
- INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
- SELECT i.id, t.id , s4Value, 8
- FROM itemToInsert ii
- JOIN vn.tag t ON t.ediTypeFk = ii.ef4
- JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
- WHERE NOT s4Value IS NULL;
-
- INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
- SELECT i.id, t.id , s5Value, 9
- FROM itemToInsert ii
- JOIN vn.tag t ON t.ediTypeFk = ii.ef5
- JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
- WHERE NOT s5Value IS NULL;
-
- INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
- SELECT i.id, t.id , s6Value, 10
- FROM itemToInsert ii
- JOIN vn.tag t ON t.ediTypeFk = ii.ef6
- JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
- WHERE NOT s6Value IS NULL;
-
- INSERT IGNORE INTO vn.itemTag(itemFk, tagFk, value, priority)
- SELECT i.id, t.id, IFNULL(ink.name, ik.color), 11
- FROM itemToInsert ii
- JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
- JOIN vn.tag t ON t.`name` = 'Color'
- LEFT JOIN edi.feature f ON f.item_id = ii.Item_ArticleCode
- LEFT JOIN edi.`type` tp ON tp.type_id = f.feature_type_id
- AND tp.`description` = 'Hoofdkleur 1'
- LEFT JOIN vn.ink ON ink.dutchCode = f.feature_value
- LEFT JOIN vn.itemInk ik ON ik.longName = i.longName
- WHERE ink.name IS NOT NULL
- OR ik.color IS NOT NULL;
-
- CREATE OR REPLACE TABLE tmp.item
- (PRIMARY KEY (id))
- SELECT i.id FROM vn.item i
- JOIN itemToInsert ii ON i.supplyResponseFk = ii.`srId`;
-
- CALL vn.item_refreshTags();
-
- DROP TABLE tmp.item;
-
- SELECT MIN(LatestDeliveryDateTime) INTO vLanded
- FROM edi.supplyResponse sr
- JOIN edi.deliveryInformation di ON di.supplyResponseID = sr.ID
- JOIN edi.marketPlace mp ON mp.id = sr.MarketPlaceID
- JOIN vn.floramondoConfig fc
- WHERE mp.isLatestOrderDateTimeRelevant
- AND di.LatestOrderDateTime > IF(
- fc.MaxLatestOrderHour > HOUR(util.VN_NOW()),
- util.VN_CURDATE(),
- util.VN_CURDATE() + INTERVAL 1 DAY);
-
- UPDATE vn.floramondoConfig
- SET nextLanded = vLanded
- WHERE vLanded IS NOT NULL;
-
- -- Elimina la oferta obsoleta
- UPDATE vn.buy b
- JOIN vn.entry e ON e.id = b.entryFk
- JOIN vn.travel tr ON tr.id = e.travelFk
- JOIN vn.agencyMode am ON am.id = tr.agencyModeFk
- JOIN vn.item i ON i.id = b.itemFk
- LEFT JOIN edi.supplyResponse sr ON i.supplyResponseFk = sr.ID
- LEFT JOIN edi.deliveryInformation di ON di.ID = b.deliveryFk
- SET b.quantity = 0
- WHERE (IFNULL(di.LatestOrderDateTime,util.VN_NOW()) <= util.VN_NOW()
- OR i.supplyResponseFk IS NULL
- OR sr.NumberOfUnits = 0)
- AND am.name = 'LOGIFLORA'
- AND e.isRaid;
-
- -- Localiza las entradas de cada almacen
- UPDATE edi.warehouseFloramondo
- SET entryFk = vn.entry_getForLogiflora(vLanded + INTERVAL travellingDays DAY, warehouseFk);
-
- IF vLanded IS NOT NULL THEN
- -- Actualiza la oferta existente
- UPDATE vn.buy b
- JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk
- JOIN vn.item i ON i.id = b.itemFk
- JOIN edi.offer o ON i.supplyResponseFk = o.`srId`
- SET b.quantity = o.NumberOfUnits * o.NumberOfItemsPerCask,
- b.buyingValue = o.price
- WHERE (b.quantity <> o.NumberOfUnits * o.NumberOfItemsPerCask
- OR b.buyingValue <> o.price);
-
- -- Inserta el resto
- SET vLastInserted := util.VN_NOW();
-
- -- Inserta la oferta
- INSERT INTO vn.buy (
- entryFk,
- itemFk,
- quantity,
- buyingValue,
- stickers,
- packing,
- `grouping`,
- groupingMode,
- packagingFk,
- deliveryFk)
- SELECT wf.entryFk,
- i.id,
- o.NumberOfUnits * o.NumberOfItemsPerCask quantity,
- o.Price,
- o.NumberOfUnits etiquetas,
- o.NumberOfItemsPerCask packing,
- GREATEST(1, IFNULL(o.MinimumQuantity,0)) * o.NumberOfItemsPerCask `grouping`,
- 'packing',
- o.embalageCode,
- o.diId
- FROM edi.offer o
- JOIN vn.item i ON i.supplyResponseFk = o.srId
- JOIN edi.warehouseFloramondo wf
- JOIN vn.packaging p ON p.id
- LIKE o.embalageCode
- LEFT JOIN vn.buy b ON b.itemFk = i.id
- AND b.entryFk = wf.entryFk
- WHERE b.id IS NULL; -- Quitar esta linea y mirar de crear los packages a tiempo REAL
-
- INSERT INTO vn.itemCost(
- itemFk,
- warehouseFk,
- cm3,
- cm3delivery)
- SELECT b.itemFk,
- wf.warehouseFk,
- @cm3 := vn.buy_getUnitVolume(b.id),
- IFNULL((vc.standardFlowerBox * 1000) / i.packingOut, @cm3)
- FROM warehouseFloramondo wf
- JOIN vn.volumeConfig vc
- JOIN vn.buy b ON b.entryFk = wf.entryFk
- JOIN vn.item i ON i.id = b.itemFk
- LEFT JOIN vn.itemCost ic ON ic.itemFk = b.itemFk
- AND ic.warehouseFk = wf.warehouseFk
- WHERE (ic.cm3 IS NULL OR ic.cm3 = 0)
- ON DUPLICATE KEY UPDATE cm3 = @cm3, cm3delivery = IFNULL((vc.standardFlowerBox * 1000) / i.packingOut, @cm3);
-
- CREATE OR REPLACE TEMPORARY TABLE tmp.buyRecalc
- SELECT b.id
- FROM vn.buy b
- JOIN warehouseFloramondo wf ON wf.entryFk = b.entryFk
- WHERE b.created >= vLastInserted;
-
- CALL vn.buy_recalcPrices();
-
- UPDATE edi.offerList o
- JOIN (SELECT v.name, COUNT(DISTINCT b.itemFk) total
- FROM vn.buy b
- JOIN vn.item i ON i.id = b.itemFk
- JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk
- JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID
- JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk
- JOIN vn.warehouse w ON w.id = wf.warehouseFk
- WHERE w.name = 'VNH'
- AND b.quantity > 0
- GROUP BY sr.vmpID) sub ON o.supplier = sub.name
- SET o.vnh = sub.total;
-
- UPDATE edi.offerList o
- JOIN (SELECT v.name, COUNT(DISTINCT b.itemFk) total
- FROM vn.buy b
- JOIN vn.item i ON i.id = b.itemFk
- JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk
- JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID
- JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk
- JOIN vn.warehouse w ON w.id = wf.warehouseFk
- WHERE w.name = 'ALGEMESI'
- AND b.quantity > 0
- GROUP BY sr.vmpID) sub ON o.supplier = sub.name
- SET o.algemesi = sub.total;
- END IF;
-
- DROP TEMPORARY TABLE
- edi.offer,
- itemToInsert;
-
- SET @isTriggerDisabled = FALSE;
-
- COMMIT;
-
- -- Esto habria que pasarlo a procesos programados o trabajar con tags y dejar las familias
- UPDATE vn.item i
- SET typeFk = 121
- WHERE i.longName LIKE 'Rosa Garden %'
- AND typeFk = 17;
-
- UPDATE vn.item i
- SET typeFk = 156
- WHERE i.longName LIKE 'Rosa ec %'
- AND typeFk = 17;
-
- -- Refresca las fotos de los items existentes que mostramos (prioridad baja)
- INSERT IGNORE INTO vn.itemImageQueue(itemFk, url, priority)
- SELECT i.id, sr.PictureReference, 100
- FROM edi.supplyResponse sr
- JOIN vn.item i ON i.supplyResponseFk = sr.ID
- JOIN edi.supplyOffer so ON so.srId = sr.ID
- JOIN hedera.image i2 ON i2.name = i.image
- AND i2.collectionFk = 'catalog'
- WHERE i2.updated <= (UNIX_TIMESTAMP(util.VN_NOW()) - vDayRange)
- AND sr.NumberOfUnits;
-
- INSERT INTO edi.`log`
- SET tableName = 'floramondo_offerRefresh',
- fieldName = 'Tiempo de proceso',
- fieldValue = TIMEDIFF(util.VN_NOW(), vStartingTime);
-
- DO RELEASE_LOCK('edi.floramondo_offerRefresh');
-END$$
-DELIMITER ;
diff --git a/db/routines/hedera/procedures/order_addItem.sql b/db/routines/hedera/procedures/order_addItem.sql
index f690f9aa6..1470ddf35 100644
--- a/db/routines/hedera/procedures/order_addItem.sql
+++ b/db/routines/hedera/procedures/order_addItem.sql
@@ -1,8 +1,8 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `hedera`.`order_addItem`(
vSelf INT,
- vWarehouse INT,
- vItem INT,
+ vWarehouse INT,
+ vItem INT,
vAmount INT)
BEGIN
/**
@@ -37,7 +37,7 @@ BEGIN
ROLLBACK;
RESIGNAL;
END;
-
+
CALL order_calcCatalogFromItem(vSelf, vItem);
START TRANSACTION;
@@ -47,11 +47,15 @@ BEGIN
FROM tmp.zoneGetShipped
WHERE warehouseFk = vWarehouse;
- SELECT IFNULL(available, 0) INTO vAvailable
+ SELECT available INTO vAvailable
FROM tmp.ticketLot
WHERE warehouseFk = vWarehouse
AND itemFk = vItem;
+ IF vAvailable IS NULL THEN
+ SET vAvailable = 0;
+ END IF;
+
IF vAmount > vAvailable THEN
CALL util.throw ('ORDER_ROW_UNAVAILABLE');
END IF;
@@ -102,6 +106,8 @@ BEGIN
amount = vAdd,
price = vPrice;
+ CALL cache.available_updateItem(vItem, vWarehouse, vShipment, vAdd);
+
SET vRow = LAST_INSERT_ID();
INSERT INTO orderRowComponent (rowFk, componentFk, price)
@@ -121,6 +127,6 @@ BEGIN
END IF;
COMMIT;
- CALL vn.ticketCalculatePurge;
+ CALL vn.ticketCalculatePurge;
END$$
DELIMITER ;
diff --git a/db/routines/util/events/log_clean.sql b/db/routines/util/events/log_clean.sql
new file mode 100644
index 000000000..8447069e6
--- /dev/null
+++ b/db/routines/util/events/log_clean.sql
@@ -0,0 +1,8 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `util`.`log_clean`
+ ON SCHEDULE EVERY 1 DAY
+ STARTS '2024-07-09 00:30:00.000'
+ ON COMPLETION PRESERVE
+ ENABLE
+DO CALL util.log_clean$$
+DELIMITER ;
diff --git a/db/routines/util/procedures/log_clean.sql b/db/routines/util/procedures/log_clean.sql
new file mode 100644
index 000000000..aeed9dc44
--- /dev/null
+++ b/db/routines/util/procedures/log_clean.sql
@@ -0,0 +1,54 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`log_clean`()
+BEGIN
+/**
+ * Hace limpieza de los datos de las tablas log,
+ * dejando únicamente los días de retención configurados.
+ */
+ DECLARE vSchemaName VARCHAR(65);
+ DECLARE vSchemaNameQuoted VARCHAR(65);
+ DECLARE vTableName VARCHAR(65);
+ DECLARE vTableNameQuoted VARCHAR(65);
+ DECLARE vRetentionDays INT;
+ DECLARE vStarted DATETIME;
+ DECLARE vDated DATE;
+ DECLARE vDone BOOL;
+
+ DECLARE vQueue CURSOR FOR
+ SELECT schemaName, tableName, retentionDays
+ FROM logCleanMultiConfig
+ ORDER BY `order`;
+
+ DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
+
+ OPEN vQueue;
+ l: LOOP
+ SET vDone = FALSE;
+ FETCH vQueue INTO vSchemaName, vTableName, vRetentionDays;
+
+ IF vDone THEN
+ LEAVE l;
+ END IF;
+
+ IF vRetentionDays THEN
+ SET vStarted = VN_NOW();
+ SET vSchemaNameQuoted = quoteIdentifier(vSchemaName);
+ SET vTableNameQuoted = quoteIdentifier(vTableName);
+ SET vDated = VN_CURDATE() - INTERVAL vRetentionDays DAY;
+
+ EXECUTE IMMEDIATE CONCAT(
+ 'DELETE FROM ', vSchemaNameQuoted,
+ '.', vTableNameQuoted,
+ " WHERE creationDate < '", vDated, "'"
+ );
+
+ UPDATE logCleanMultiConfig
+ SET `started` = vStarted,
+ `finished` = VN_NOW()
+ WHERE schemaName = vSchemaName
+ AND tableName = vTableName;
+ END IF;
+ END LOOP;
+ CLOSE vQueue;
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/events/claim_changeState.sql b/db/routines/vn/events/claim_changeState.sql
index 5d94170a0..2d8968af8 100644
--- a/db/routines/vn/events/claim_changeState.sql
+++ b/db/routines/vn/events/claim_changeState.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`claim_changeState`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` EVENT `vn`.`claim_changeState`
ON SCHEDULE EVERY 1 DAY
STARTS '2024-06-06 07:52:46.000'
ON COMPLETION PRESERVE
diff --git a/db/routines/vn/events/client_unassignSalesPerson.sql b/db/routines/vn/events/client_unassignSalesPerson.sql
index 46ad414b1..ffd83fbf6 100644
--- a/db/routines/vn/events/client_unassignSalesPerson.sql
+++ b/db/routines/vn/events/client_unassignSalesPerson.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`client_unassignSalesPerson`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` EVENT `vn`.`client_unassignSalesPerson`
ON SCHEDULE EVERY 1 DAY
STARTS '2023-06-01 03:30:00.000'
ON COMPLETION PRESERVE
diff --git a/db/routines/vn/events/client_userDisable.sql b/db/routines/vn/events/client_userDisable.sql
index b3354f8fd..6ecc05add 100644
--- a/db/routines/vn/events/client_userDisable.sql
+++ b/db/routines/vn/events/client_userDisable.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`client_userDisable`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` EVENT `vn`.`client_userDisable`
ON SCHEDULE EVERY 1 MONTH
STARTS '2023-06-01 00:00:00.000'
ON COMPLETION PRESERVE
diff --git a/db/routines/vn/events/collection_make.sql b/db/routines/vn/events/collection_make.sql
index 1c6bd0fcb..940b11d93 100644
--- a/db/routines/vn/events/collection_make.sql
+++ b/db/routines/vn/events/collection_make.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`collection_make`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` EVENT `vn`.`collection_make`
ON SCHEDULE EVERY 5 MINUTE
STARTS '2022-09-15 00:00:00.000'
ON COMPLETION PRESERVE
diff --git a/db/routines/vn/events/department_doCalc.sql b/db/routines/vn/events/department_doCalc.sql
index b3ce49fa5..09734fbde 100644
--- a/db/routines/vn/events/department_doCalc.sql
+++ b/db/routines/vn/events/department_doCalc.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`department_doCalc`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` EVENT `vn`.`department_doCalc`
ON SCHEDULE EVERY 15 SECOND
STARTS '2019-11-15 00:00:00.000'
ON COMPLETION PRESERVE
diff --git a/db/routines/vn/events/envialiaThreHoldChecker.sql b/db/routines/vn/events/envialiaThreHoldChecker.sql
index a5440ef67..46f27c2ac 100644
--- a/db/routines/vn/events/envialiaThreHoldChecker.sql
+++ b/db/routines/vn/events/envialiaThreHoldChecker.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`envialiaThreHoldChecker`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` EVENT `vn`.`envialiaThreHoldChecker`
ON SCHEDULE EVERY 1 DAY
STARTS '2022-01-28 09:52:46.000'
ON COMPLETION NOT PRESERVE
diff --git a/db/routines/vn/events/greuge_notify.sql b/db/routines/vn/events/greuge_notify.sql
index 8c23dbe36..c89373d54 100644
--- a/db/routines/vn/events/greuge_notify.sql
+++ b/db/routines/vn/events/greuge_notify.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`greuge_notify`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` EVENT `vn`.`greuge_notify`
ON SCHEDULE EVERY 1 DAY
STARTS '2023-01-01 00:07:00.000'
ON COMPLETION NOT PRESERVE
diff --git a/db/routines/vn/events/itemImageQueue_check.sql b/db/routines/vn/events/itemImageQueue_check.sql
index 680faa37f..01a97613b 100644
--- a/db/routines/vn/events/itemImageQueue_check.sql
+++ b/db/routines/vn/events/itemImageQueue_check.sql
@@ -1,11 +1,11 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`itemImageQueue_check`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` EVENT `vn`.`itemImageQueue_check`
ON SCHEDULE EVERY 1 HOUR
STARTS '2023-07-28 00:00:00.000'
ON COMPLETION PRESERVE
ENABLE
-DO BEGIN
- DELETE FROM itemImageQueue
- WHERE attempts >= (SELECT downloadMaxAttempts FROM itemConfig);
+DO BEGIN
+ DELETE FROM itemImageQueue
+ WHERE attempts >= (SELECT downloadMaxAttempts FROM itemConfig);
END$$
DELIMITER ;
diff --git a/db/routines/vn/events/itemShelvingSale_doReserve.sql b/db/routines/vn/events/itemShelvingSale_doReserve.sql
index 228886556..b8a1a14ec 100644
--- a/db/routines/vn/events/itemShelvingSale_doReserve.sql
+++ b/db/routines/vn/events/itemShelvingSale_doReserve.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`itemShelvingSale_doReserve`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` EVENT `vn`.`itemShelvingSale_doReserve`
ON SCHEDULE EVERY 15 SECOND
STARTS '2023-10-16 00:00:00'
ON COMPLETION PRESERVE
diff --git a/db/routines/vn/events/mysqlConnectionsSorter_kill.sql b/db/routines/vn/events/mysqlConnectionsSorter_kill.sql
index 1f5d46b18..1d87ceb82 100644
--- a/db/routines/vn/events/mysqlConnectionsSorter_kill.sql
+++ b/db/routines/vn/events/mysqlConnectionsSorter_kill.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`mysqlConnectionsSorter_kill`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` EVENT `vn`.`mysqlConnectionsSorter_kill`
ON SCHEDULE EVERY 1 MINUTE
STARTS '2021-10-28 09:56:27.000'
ON COMPLETION NOT PRESERVE
diff --git a/db/routines/vn/events/printQueue_check.sql b/db/routines/vn/events/printQueue_check.sql
index 262ddc7c8..cddba8cf8 100644
--- a/db/routines/vn/events/printQueue_check.sql
+++ b/db/routines/vn/events/printQueue_check.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`printQueue_check`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` EVENT `vn`.`printQueue_check`
ON SCHEDULE EVERY 10 MINUTE
STARTS '2022-01-28 09:52:46.000'
ON COMPLETION PRESERVE
diff --git a/db/routines/vn/events/raidUpdate.sql b/db/routines/vn/events/raidUpdate.sql
index 619dadb48..c0c6f03c5 100644
--- a/db/routines/vn/events/raidUpdate.sql
+++ b/db/routines/vn/events/raidUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`raidUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` EVENT `vn`.`raidUpdate`
ON SCHEDULE EVERY 1 DAY
STARTS '2017-12-29 00:05:00.000'
ON COMPLETION PRESERVE
diff --git a/db/routines/vn/events/route_doRecalc.sql b/db/routines/vn/events/route_doRecalc.sql
index 62f75a3bc..4e6a77674 100644
--- a/db/routines/vn/events/route_doRecalc.sql
+++ b/db/routines/vn/events/route_doRecalc.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`route_doRecalc`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` EVENT `vn`.`route_doRecalc`
ON SCHEDULE EVERY 10 SECOND
STARTS '2021-07-08 07:32:23.000'
ON COMPLETION PRESERVE
diff --git a/db/routines/vn/events/travel_setDelivered.sql b/db/routines/vn/events/travel_setDelivered.sql
index 769ee9d24..396f3e144 100644
--- a/db/routines/vn/events/travel_setDelivered.sql
+++ b/db/routines/vn/events/travel_setDelivered.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`travel_setDelivered`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` EVENT `vn`.`travel_setDelivered`
ON SCHEDULE EVERY 1 DAY
STARTS '2024-07-12 00:10:00.000'
ON COMPLETION PRESERVE
diff --git a/db/routines/vn/events/vehicle_notify.sql b/db/routines/vn/events/vehicle_notify.sql
index d974e1817..edeecd1f8 100644
--- a/db/routines/vn/events/vehicle_notify.sql
+++ b/db/routines/vn/events/vehicle_notify.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`vehicle_notify`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` EVENT `vn`.`vehicle_notify`
ON SCHEDULE EVERY 1 DAY
STARTS '2022-01-01 00:07:00.000'
ON COMPLETION NOT PRESERVE
diff --git a/db/routines/vn/events/workerJourney_doRecalc.sql b/db/routines/vn/events/workerJourney_doRecalc.sql
index 61077fc5b..a3f19929d 100644
--- a/db/routines/vn/events/workerJourney_doRecalc.sql
+++ b/db/routines/vn/events/workerJourney_doRecalc.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`workerJourney_doRecalc`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` EVENT `vn`.`workerJourney_doRecalc`
ON SCHEDULE EVERY 1 DAY
STARTS '2023-07-22 04:00:00.000'
ON COMPLETION PRESERVE
diff --git a/db/routines/vn/events/worker_updateChangedBusiness.sql b/db/routines/vn/events/worker_updateChangedBusiness.sql
index 02f7af8aa..6f6c15650 100644
--- a/db/routines/vn/events/worker_updateChangedBusiness.sql
+++ b/db/routines/vn/events/worker_updateChangedBusiness.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`worker_updateChangedBusiness`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` EVENT `vn`.`worker_updateChangedBusiness`
ON SCHEDULE EVERY 1 DAY
STARTS '2000-01-01 00:00:05.000'
ON COMPLETION NOT PRESERVE
diff --git a/db/routines/vn/events/zoneGeo_doCalc.sql b/db/routines/vn/events/zoneGeo_doCalc.sql
index 579141e13..ca2a54f94 100644
--- a/db/routines/vn/events/zoneGeo_doCalc.sql
+++ b/db/routines/vn/events/zoneGeo_doCalc.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`zoneGeo_doCalc`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` EVENT `vn`.`zoneGeo_doCalc`
ON SCHEDULE EVERY 15 SECOND
STARTS '2019-09-13 15:30:47.000'
ON COMPLETION PRESERVE
diff --git a/db/routines/vn/functions/MIDNIGHT.sql b/db/routines/vn/functions/MIDNIGHT.sql
deleted file mode 100644
index c2df0c0c6..000000000
--- a/db/routines/vn/functions/MIDNIGHT.sql
+++ /dev/null
@@ -1,8 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`MIDNIGHT`(vDate DATE)
- RETURNS datetime
- DETERMINISTIC
-BEGIN
- RETURN TIMESTAMP(vDate,'23:59:59');
-END$$
-DELIMITER ;
diff --git a/db/routines/vn/functions/addressTaxArea.sql b/db/routines/vn/functions/addressTaxArea.sql
index 1d4e9e2f0..3cad7a55d 100644
--- a/db/routines/vn/functions/addressTaxArea.sql
+++ b/db/routines/vn/functions/addressTaxArea.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`addressTaxArea`(vAddresId INT, vCompanyId INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`addressTaxArea`(vAddresId INT, vCompanyId INT)
RETURNS varchar(25) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/address_getGeo.sql b/db/routines/vn/functions/address_getGeo.sql
index 1a9f5ddb8..04155c30c 100644
--- a/db/routines/vn/functions/address_getGeo.sql
+++ b/db/routines/vn/functions/address_getGeo.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`address_getGeo`(vSelf INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`address_getGeo`(vSelf INT)
RETURNS int(11)
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/barcodeToItem.sql b/db/routines/vn/functions/barcodeToItem.sql
index ee0315118..14d19fe4e 100644
--- a/db/routines/vn/functions/barcodeToItem.sql
+++ b/db/routines/vn/functions/barcodeToItem.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`barcodeToItem`(vBarcode VARCHAR(22))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`barcodeToItem`(vBarcode VARCHAR(22))
RETURNS int(11)
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/buy_getUnitVolume.sql b/db/routines/vn/functions/buy_getUnitVolume.sql
index baf300450..473ea8fc0 100644
--- a/db/routines/vn/functions/buy_getUnitVolume.sql
+++ b/db/routines/vn/functions/buy_getUnitVolume.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`buy_getUnitVolume`(vSelf INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`buy_getUnitVolume`(vSelf INT)
RETURNS int(11)
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/buy_getVolume.sql b/db/routines/vn/functions/buy_getVolume.sql
index c29c0a57c..55027d7e5 100644
--- a/db/routines/vn/functions/buy_getVolume.sql
+++ b/db/routines/vn/functions/buy_getVolume.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`buy_getVolume`(vSelf INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`buy_getVolume`(vSelf INT)
RETURNS int(11)
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/catalog_componentReverse.sql b/db/routines/vn/functions/catalog_componentReverse.sql
index f37b20890..c333654da 100644
--- a/db/routines/vn/functions/catalog_componentReverse.sql
+++ b/db/routines/vn/functions/catalog_componentReverse.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`catalog_componentReverse`(vWarehouse INT,
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`catalog_componentReverse`(vWarehouse INT,
vCost DECIMAL(10,3),
vM3 DECIMAL(10,3),
vAddressFk INT,
diff --git a/db/routines/vn/functions/clientGetMana.sql b/db/routines/vn/functions/clientGetMana.sql
index fa983c2b2..4c26ae79b 100644
--- a/db/routines/vn/functions/clientGetMana.sql
+++ b/db/routines/vn/functions/clientGetMana.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`clientGetMana`(vClient INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`clientGetMana`(vClient INT)
RETURNS decimal(10,2)
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/clientGetSalesPerson.sql b/db/routines/vn/functions/clientGetSalesPerson.sql
index 4b8601be3..2502aa196 100644
--- a/db/routines/vn/functions/clientGetSalesPerson.sql
+++ b/db/routines/vn/functions/clientGetSalesPerson.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`clientGetSalesPerson`(vClientFk INT, vDated DATE)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`clientGetSalesPerson`(vClientFk INT, vDated DATE)
RETURNS int(11)
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/clientTaxArea.sql b/db/routines/vn/functions/clientTaxArea.sql
index f03520b0b..1c2f776f1 100644
--- a/db/routines/vn/functions/clientTaxArea.sql
+++ b/db/routines/vn/functions/clientTaxArea.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`clientTaxArea`(vClientId INT, vCompanyId INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`clientTaxArea`(vClientId INT, vCompanyId INT)
RETURNS varchar(25) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
NOT DETERMINISTIC
READS SQL DATA
diff --git a/db/routines/vn/functions/client_getDebt.sql b/db/routines/vn/functions/client_getDebt.sql
index 8c715d2db..c35e61c30 100644
--- a/db/routines/vn/functions/client_getDebt.sql
+++ b/db/routines/vn/functions/client_getDebt.sql
@@ -1,8 +1,8 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`client_getDebt`(`vClient` INT, `vDate` DATE)
- RETURNS decimal(10,2)
- NOT DETERMINISTIC
- READS SQL DATA
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`client_getDebt`(`vClient` INT, `vDate` DATE)
+ RETURNS decimal(10,2)
+ NOT DETERMINISTIC
+ READS SQL DATA
BEGIN
/**
* Returns the risk of a customer.
@@ -34,5 +34,5 @@ BEGIN
tmp.risk;
RETURN vDebt;
-END$$
-DELIMITER ;
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/functions/client_getFromPhone.sql b/db/routines/vn/functions/client_getFromPhone.sql
index 5e4daa532..3ddf3419c 100644
--- a/db/routines/vn/functions/client_getFromPhone.sql
+++ b/db/routines/vn/functions/client_getFromPhone.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`client_getFromPhone`(vPhone VARCHAR(255))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`client_getFromPhone`(vPhone VARCHAR(255))
RETURNS int(11)
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/client_getSalesPerson.sql b/db/routines/vn/functions/client_getSalesPerson.sql
index c53816f7f..d0152e0aa 100644
--- a/db/routines/vn/functions/client_getSalesPerson.sql
+++ b/db/routines/vn/functions/client_getSalesPerson.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`client_getSalesPerson`(vClientFk INT, vDated DATE)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`client_getSalesPerson`(vClientFk INT, vDated DATE)
RETURNS int(11)
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/client_getSalesPersonByTicket.sql b/db/routines/vn/functions/client_getSalesPersonByTicket.sql
index 640df11ce..4c98ac526 100644
--- a/db/routines/vn/functions/client_getSalesPersonByTicket.sql
+++ b/db/routines/vn/functions/client_getSalesPersonByTicket.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`client_getSalesPersonByTicket`(vTicketFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`client_getSalesPersonByTicket`(vTicketFk INT)
RETURNS int(11)
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/client_getSalesPersonCode.sql b/db/routines/vn/functions/client_getSalesPersonCode.sql
index 69b8424d8..b238f26bf 100644
--- a/db/routines/vn/functions/client_getSalesPersonCode.sql
+++ b/db/routines/vn/functions/client_getSalesPersonCode.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`client_getSalesPersonCode`(vClientFk INT, vDated DATE)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`client_getSalesPersonCode`(vClientFk INT, vDated DATE)
RETURNS varchar(3) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/client_getSalesPersonCodeByTicket.sql b/db/routines/vn/functions/client_getSalesPersonCodeByTicket.sql
index 3ec5a8e9d..9e63708f3 100644
--- a/db/routines/vn/functions/client_getSalesPersonCodeByTicket.sql
+++ b/db/routines/vn/functions/client_getSalesPersonCodeByTicket.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`client_getSalesPersonCodeByTicket`(vTicketFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`client_getSalesPersonCodeByTicket`(vTicketFk INT)
RETURNS varchar(3) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/client_hasDifferentCountries.sql b/db/routines/vn/functions/client_hasDifferentCountries.sql
index a90b774c7..5f4831069 100644
--- a/db/routines/vn/functions/client_hasDifferentCountries.sql
+++ b/db/routines/vn/functions/client_hasDifferentCountries.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`client_hasDifferentCountries`(vClientFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`client_hasDifferentCountries`(vClientFk INT)
RETURNS tinyint(1)
NOT DETERMINISTIC
READS SQL DATA
diff --git a/db/routines/vn/functions/collection_isPacked.sql b/db/routines/vn/functions/collection_isPacked.sql
index 9f148273f..f7d81b4c0 100644
--- a/db/routines/vn/functions/collection_isPacked.sql
+++ b/db/routines/vn/functions/collection_isPacked.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`collection_isPacked`(vSelf INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`collection_isPacked`(vSelf INT)
RETURNS tinyint(1)
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/currency_getCommission.sql b/db/routines/vn/functions/currency_getCommission.sql
index b0a591c23..1b5d51ee6 100644
--- a/db/routines/vn/functions/currency_getCommission.sql
+++ b/db/routines/vn/functions/currency_getCommission.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`currency_getCommission`(vSelf INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`currency_getCommission`(vSelf INT)
RETURNS int(11)
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/currentRate.sql b/db/routines/vn/functions/currentRate.sql
index 57870fca4..6d18b9613 100644
--- a/db/routines/vn/functions/currentRate.sql
+++ b/db/routines/vn/functions/currentRate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`currentRate`(vCurrencyFk INT, vDated DATE)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`currentRate`(vCurrencyFk INT, vDated DATE)
RETURNS decimal(10,4)
NOT DETERMINISTIC
READS SQL DATA
diff --git a/db/routines/vn/functions/deviceProductionUser_accessGranted.sql b/db/routines/vn/functions/deviceProductionUser_accessGranted.sql
index a2d39a0ab..b0c5f0e90 100644
--- a/db/routines/vn/functions/deviceProductionUser_accessGranted.sql
+++ b/db/routines/vn/functions/deviceProductionUser_accessGranted.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`deviceProductionUser_accessGranted`(vUserFK INT(10) , android_id VARCHAR(50))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`deviceProductionUser_accessGranted`(vUserFK INT(10) , android_id VARCHAR(50))
RETURNS tinyint(1)
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/duaTax_getRate.sql b/db/routines/vn/functions/duaTax_getRate.sql
index a11015066..ee74a24fe 100644
--- a/db/routines/vn/functions/duaTax_getRate.sql
+++ b/db/routines/vn/functions/duaTax_getRate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`duaTax_getRate`(vDuaFk INT, vTaxClassFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`duaTax_getRate`(vDuaFk INT, vTaxClassFk INT)
RETURNS decimal(5,2)
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/ekt_getEntry.sql b/db/routines/vn/functions/ekt_getEntry.sql
index c629098a6..4e6824682 100644
--- a/db/routines/vn/functions/ekt_getEntry.sql
+++ b/db/routines/vn/functions/ekt_getEntry.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`ekt_getEntry`(vEktFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`ekt_getEntry`(vEktFk INT)
RETURNS int(11)
NOT DETERMINISTIC
READS SQL DATA
diff --git a/db/routines/vn/functions/ekt_getTravel.sql b/db/routines/vn/functions/ekt_getTravel.sql
index 4cf7f5631..a4466eb84 100644
--- a/db/routines/vn/functions/ekt_getTravel.sql
+++ b/db/routines/vn/functions/ekt_getTravel.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`ekt_getTravel`(vEntryAssignFk INT, vEktFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`ekt_getTravel`(vEntryAssignFk INT, vEktFk INT)
RETURNS int(11)
NOT DETERMINISTIC
READS SQL DATA
diff --git a/db/routines/vn/functions/entry_getCommission.sql b/db/routines/vn/functions/entry_getCommission.sql
index 62946407a..4a19f4e63 100644
--- a/db/routines/vn/functions/entry_getCommission.sql
+++ b/db/routines/vn/functions/entry_getCommission.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`entry_getCommission`(vTravelFk INT,
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`entry_getCommission`(vTravelFk INT,
vCurrencyFk INT,
vSupplierFk INT
)
diff --git a/db/routines/vn/functions/entry_getCurrency.sql b/db/routines/vn/functions/entry_getCurrency.sql
index 4cfce19db..ffde8e029 100644
--- a/db/routines/vn/functions/entry_getCurrency.sql
+++ b/db/routines/vn/functions/entry_getCurrency.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`entry_getCurrency`(vCurrency INT,
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`entry_getCurrency`(vCurrency INT,
vSupplierFk INT
)
RETURNS int(11)
diff --git a/db/routines/vn/functions/entry_getForLogiflora.sql b/db/routines/vn/functions/entry_getForLogiflora.sql
deleted file mode 100644
index 71f0b585c..000000000
--- a/db/routines/vn/functions/entry_getForLogiflora.sql
+++ /dev/null
@@ -1,64 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`entry_getForLogiflora`(vLanded DATE, vWarehouseFk INT)
- RETURNS int(11)
- NOT DETERMINISTIC
- READS SQL DATA
-BEGIN
-
- /**
- * Devuelve una entrada para Logiflora. Si no existe la crea.
- *
- * @param vLanded Fecha de llegada al almacén
- * @param vWarehouseFk Identificador de vn.warehouse
- */
-
- DECLARE vTravelFk INT;
- DECLARE vEntryFk INT;
- DECLARE previousEntryFk INT;
-
- SET vTravelFk = vn.travel_getForLogiflora(vLanded, vWarehouseFk);
-
- IF vLanded THEN
-
- SELECT IFNULL(MAX(id),0) INTO vEntryFk
- FROM vn.entry
- WHERE travelFk = vTravelFk
- AND isRaid;
-
- IF NOT vEntryFk THEN
-
- INSERT INTO vn.entry(travelFk, supplierFk, commission, companyFk, currencyFk, isRaid)
- SELECT vTravelFk, s.id, 4, c.id, cu.id, TRUE
- FROM vn.supplier s
- JOIN vn.company c ON c.code = 'VNL'
- JOIN vn.currency cu ON cu.code = 'EUR'
- WHERE s.name = 'KONINKLIJE COOPERATIEVE BLOEMENVEILING FLORAHOLLAN';
-
- SELECT MAX(id) INTO vEntryFk
- FROM vn.entry
- WHERE travelFk = vTravelFk;
-
- END IF;
-
- END IF;
-
- SELECT entryFk INTO previousEntryFk
- FROM edi.warehouseFloramondo wf
- WHERE wf.warehouseFk = vWarehouseFk;
-
- IF IFNULL(previousEntryFk,0) != vEntryFk THEN
-
- UPDATE buy b
- SET b.printedStickers = 0
- WHERE entryFk = previousEntryFk;
-
- DELETE FROM buy WHERE entryFk = previousEntryFk;
-
- DELETE FROM entry WHERE id = previousEntryFk;
-
- END IF;
-
- RETURN vEntryFk;
-
-END$$
-DELIMITER ;
diff --git a/db/routines/vn/functions/entry_isIntrastat.sql b/db/routines/vn/functions/entry_isIntrastat.sql
index 8d46b4a02..79eb7fd86 100644
--- a/db/routines/vn/functions/entry_isIntrastat.sql
+++ b/db/routines/vn/functions/entry_isIntrastat.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`entry_isIntrastat`(vSelf INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`entry_isIntrastat`(vSelf INT)
RETURNS int(11)
NOT DETERMINISTIC
READS SQL DATA
diff --git a/db/routines/vn/functions/entry_isInventoryOrPrevious.sql b/db/routines/vn/functions/entry_isInventoryOrPrevious.sql
index 4acbf060d..7779f7288 100644
--- a/db/routines/vn/functions/entry_isInventoryOrPrevious.sql
+++ b/db/routines/vn/functions/entry_isInventoryOrPrevious.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`entry_isInventoryOrPrevious`(vSelf INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`entry_isInventoryOrPrevious`(vSelf INT)
RETURNS int(11)
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/expedition_checkRoute.sql b/db/routines/vn/functions/expedition_checkRoute.sql
index 9b2929797..ce27ea391 100644
--- a/db/routines/vn/functions/expedition_checkRoute.sql
+++ b/db/routines/vn/functions/expedition_checkRoute.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`expedition_checkRoute`(vPalletFk INT,vExpeditionFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`expedition_checkRoute`(vPalletFk INT,vExpeditionFk INT)
RETURNS tinyint(1)
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/firstDayOfWeek.sql b/db/routines/vn/functions/firstDayOfWeek.sql
index 25ab4480c..d4742771a 100644
--- a/db/routines/vn/functions/firstDayOfWeek.sql
+++ b/db/routines/vn/functions/firstDayOfWeek.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`firstDayOfWeek`(vYear INT, vWeek INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`firstDayOfWeek`(vYear INT, vWeek INT)
RETURNS date
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/getAlert3State.sql b/db/routines/vn/functions/getAlert3State.sql
index f3a7aae53..620ac8d01 100644
--- a/db/routines/vn/functions/getAlert3State.sql
+++ b/db/routines/vn/functions/getAlert3State.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`getAlert3State`(vTicket INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`getAlert3State`(vTicket INT)
RETURNS varchar(45) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci
NOT DETERMINISTIC
READS SQL DATA
diff --git a/db/routines/vn/functions/getDueDate.sql b/db/routines/vn/functions/getDueDate.sql
index 694117a52..c2793cb06 100644
--- a/db/routines/vn/functions/getDueDate.sql
+++ b/db/routines/vn/functions/getDueDate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`getDueDate`(vDated DATE, vDayToPay INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`getDueDate`(vDated DATE, vDayToPay INT)
RETURNS date
NOT DETERMINISTIC
NO SQL
diff --git a/db/routines/vn/functions/getInventoryDate.sql b/db/routines/vn/functions/getInventoryDate.sql
index b67f1c384..9c1a5349f 100644
--- a/db/routines/vn/functions/getInventoryDate.sql
+++ b/db/routines/vn/functions/getInventoryDate.sql
@@ -1,8 +1,8 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`getInventoryDate`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`getInventoryDate`()
RETURNS date
DETERMINISTIC
-BEGIN
- RETURN (SELECT inventoried FROM config LIMIT 1);
+BEGIN
+ RETURN (SELECT inventoried FROM config LIMIT 1);
END$$
DELIMITER ;
diff --git a/db/routines/vn/functions/getNewItemId.sql b/db/routines/vn/functions/getNewItemId.sql
index 2cb9b275b..24c13e28c 100644
--- a/db/routines/vn/functions/getNewItemId.sql
+++ b/db/routines/vn/functions/getNewItemId.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`getNewItemId`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`getNewItemId`()
RETURNS int(11)
NOT DETERMINISTIC
READS SQL DATA
diff --git a/db/routines/vn/functions/getNextDueDate.sql b/db/routines/vn/functions/getNextDueDate.sql
index 8e8691ec5..d0f923d65 100644
--- a/db/routines/vn/functions/getNextDueDate.sql
+++ b/db/routines/vn/functions/getNextDueDate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`getNextDueDate`(vDated DATE, vGapDays INT, vPayDay INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`getNextDueDate`(vDated DATE, vGapDays INT, vPayDay INT)
RETURNS date
NOT DETERMINISTIC
NO SQL
diff --git a/db/routines/vn/functions/getShipmentHour.sql b/db/routines/vn/functions/getShipmentHour.sql
index 9eca04ac4..5fdd8db32 100644
--- a/db/routines/vn/functions/getShipmentHour.sql
+++ b/db/routines/vn/functions/getShipmentHour.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`getShipmentHour`(vTicket INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`getShipmentHour`(vTicket INT)
RETURNS int(11)
NOT DETERMINISTIC
READS SQL DATA
diff --git a/db/routines/vn/functions/getSpecialPrice.sql b/db/routines/vn/functions/getSpecialPrice.sql
index 2cc5f2b99..bcb3251f2 100644
--- a/db/routines/vn/functions/getSpecialPrice.sql
+++ b/db/routines/vn/functions/getSpecialPrice.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`getSpecialPrice`(vItemFk int(11),vClientFk int(11))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`getSpecialPrice`(vItemFk int(11),vClientFk int(11))
RETURNS decimal(10,2)
NOT DETERMINISTIC
READS SQL DATA
diff --git a/db/routines/vn/functions/getTicketTrolleyLabelCount.sql b/db/routines/vn/functions/getTicketTrolleyLabelCount.sql
index b978db73a..8344e1c69 100644
--- a/db/routines/vn/functions/getTicketTrolleyLabelCount.sql
+++ b/db/routines/vn/functions/getTicketTrolleyLabelCount.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`getTicketTrolleyLabelCount`(vTicket INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`getTicketTrolleyLabelCount`(vTicket INT)
RETURNS int(11)
NOT DETERMINISTIC
READS SQL DATA
diff --git a/db/routines/vn/functions/getUser.sql b/db/routines/vn/functions/getUser.sql
index eb85b8346..311394b17 100644
--- a/db/routines/vn/functions/getUser.sql
+++ b/db/routines/vn/functions/getUser.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`getUser`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`getUser`()
RETURNS int(11)
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/getUserId.sql b/db/routines/vn/functions/getUserId.sql
index 9afcb8912..d68dabc84 100644
--- a/db/routines/vn/functions/getUserId.sql
+++ b/db/routines/vn/functions/getUserId.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`getUserId`(userName varchar(30))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`getUserId`(userName varchar(30))
RETURNS int(11)
NOT DETERMINISTIC
READS SQL DATA
diff --git a/db/routines/vn/functions/hasAnyNegativeBase.sql b/db/routines/vn/functions/hasAnyNegativeBase.sql
index 97d1e7328..d3ca25858 100644
--- a/db/routines/vn/functions/hasAnyNegativeBase.sql
+++ b/db/routines/vn/functions/hasAnyNegativeBase.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`hasAnyNegativeBase`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`hasAnyNegativeBase`()
RETURNS tinyint(1)
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/hasAnyPositiveBase.sql b/db/routines/vn/functions/hasAnyPositiveBase.sql
index 7222c3b2a..ea7d8f14b 100644
--- a/db/routines/vn/functions/hasAnyPositiveBase.sql
+++ b/db/routines/vn/functions/hasAnyPositiveBase.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`hasAnyPositiveBase`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`hasAnyPositiveBase`()
RETURNS tinyint(1)
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/hasItemsInSector.sql b/db/routines/vn/functions/hasItemsInSector.sql
index 4aa4edb9c..7a5c4cf60 100644
--- a/db/routines/vn/functions/hasItemsInSector.sql
+++ b/db/routines/vn/functions/hasItemsInSector.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`hasItemsInSector`(vTicketFk INT, vSectorFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`hasItemsInSector`(vTicketFk INT, vSectorFk INT)
RETURNS tinyint(1)
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/hasSomeNegativeBase.sql b/db/routines/vn/functions/hasSomeNegativeBase.sql
index ea7efe777..af435a6c5 100644
--- a/db/routines/vn/functions/hasSomeNegativeBase.sql
+++ b/db/routines/vn/functions/hasSomeNegativeBase.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`hasSomeNegativeBase`(vTicket INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`hasSomeNegativeBase`(vTicket INT)
RETURNS tinyint(1)
NOT DETERMINISTIC
READS SQL DATA
diff --git a/db/routines/vn/functions/intrastat_estimateNet.sql b/db/routines/vn/functions/intrastat_estimateNet.sql
index 350cb788a..645fb6406 100644
--- a/db/routines/vn/functions/intrastat_estimateNet.sql
+++ b/db/routines/vn/functions/intrastat_estimateNet.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`intrastat_estimateNet`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`intrastat_estimateNet`(
vSelf INT,
vStems INT
)
diff --git a/db/routines/vn/functions/invoiceOutAmount.sql b/db/routines/vn/functions/invoiceOutAmount.sql
index 6c66a46f3..447c0883e 100644
--- a/db/routines/vn/functions/invoiceOutAmount.sql
+++ b/db/routines/vn/functions/invoiceOutAmount.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`invoiceOutAmount`(vInvoiceRef VARCHAR(15))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`invoiceOutAmount`(vInvoiceRef VARCHAR(15))
RETURNS decimal(10,2)
NOT DETERMINISTIC
READS SQL DATA
diff --git a/db/routines/vn/functions/invoiceOut_getMaxIssued.sql b/db/routines/vn/functions/invoiceOut_getMaxIssued.sql
index dc1a59eaa..687f82dfc 100644
--- a/db/routines/vn/functions/invoiceOut_getMaxIssued.sql
+++ b/db/routines/vn/functions/invoiceOut_getMaxIssued.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`invoiceOut_getMaxIssued`(vSerial VARCHAR(2),
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`invoiceOut_getMaxIssued`(vSerial VARCHAR(2),
vCompanyFk INT,
vYear INT
)
diff --git a/db/routines/vn/functions/invoiceOut_getPath.sql b/db/routines/vn/functions/invoiceOut_getPath.sql
index 1e174a4cf..7e8850e15 100644
--- a/db/routines/vn/functions/invoiceOut_getPath.sql
+++ b/db/routines/vn/functions/invoiceOut_getPath.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`invoiceOut_getPath`(vSelf INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`invoiceOut_getPath`(vSelf INT)
RETURNS varchar(255) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/invoiceOut_getWeight.sql b/db/routines/vn/functions/invoiceOut_getWeight.sql
index 1302c0341..3c16191bb 100644
--- a/db/routines/vn/functions/invoiceOut_getWeight.sql
+++ b/db/routines/vn/functions/invoiceOut_getWeight.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`invoiceOut_getWeight`(vInvoiceRef VARCHAR(15)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`invoiceOut_getWeight`(vInvoiceRef VARCHAR(15)
)
RETURNS decimal(10,2)
NOT DETERMINISTIC
diff --git a/db/routines/vn/functions/invoiceSerial.sql b/db/routines/vn/functions/invoiceSerial.sql
index 9df887cf5..9c0edf1c3 100644
--- a/db/routines/vn/functions/invoiceSerial.sql
+++ b/db/routines/vn/functions/invoiceSerial.sql
@@ -1,18 +1,23 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`invoiceSerial`(vClientFk INT, vCompanyFk INT, vType CHAR(15))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`invoiceSerial`(
+ vClientFk INT,
+ vCompanyFk INT,
+ vType CHAR(15)
+)
RETURNS char(2) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
DETERMINISTIC
BEGIN
- /**
- * Obtiene la serie de una factura
- * dependiendo del area del cliente.
- *
- * @param vClientFk Id del cliente
- * @param vCompanyFk Id de la empresa
- * @param vType Tipo de factura ['global','multiple','quick']
- * @return vSerie de la factura
- */
+/**
+* Obtiene la serie de una factura
+* dependiendo del area del cliente.
+*
+* @param vClientFk Id del cliente
+* @param vCompanyFk Id de la empresa
+* @param vType Tipo de factura (vn.invoiceOutSerial.type[ENUM])
+* @return vSerie de la factura
+*/
DECLARE vTaxArea VARCHAR(25) COLLATE utf8mb3_general_ci;
+ DECLARE vTransactionCode INT(2);
DECLARE vSerie CHAR(2);
IF (SELECT hasInvoiceSimplified FROM client WHERE id = vClientFk) THEN
@@ -23,9 +28,15 @@ BEGIN
FROM client
WHERE id = vClientFk;
- SELECT code INTO vSerie
- FROM invoiceOutSerial
- WHERE `type` = vType AND taxAreaFk = vTaxArea;
+ SELECT CodigoTransaccion INTO vTransactionCode
+ FROM taxArea
+ WHERE code = vTaxArea;
+
+ SELECT ios.code INTO vSerie
+ FROM invoiceOutSerial ios
+ JOIN taxArea ta ON ta.code = ios.taxAreaFk
+ WHERE ios.`type` = vType
+ AND ta.CodigoTransaccion = vTransactionCode;
RETURN vSerie;
END$$
diff --git a/db/routines/vn/functions/isLogifloraDay.sql b/db/routines/vn/functions/isLogifloraDay.sql
index 8e9c9b264..27e8e7551 100644
--- a/db/routines/vn/functions/isLogifloraDay.sql
+++ b/db/routines/vn/functions/isLogifloraDay.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`isLogifloraDay`(vShipped DATE, vWarehouse INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`isLogifloraDay`(vShipped DATE, vWarehouse INT)
RETURNS tinyint(1)
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/itemPacking.sql b/db/routines/vn/functions/itemPacking.sql
index 6856c12cd..cc5dfae7a 100644
--- a/db/routines/vn/functions/itemPacking.sql
+++ b/db/routines/vn/functions/itemPacking.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`itemPacking`(vBarcode VARCHAR(22), vWarehouseFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`itemPacking`(vBarcode VARCHAR(22), vWarehouseFk INT)
RETURNS int(11)
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/itemShelvingPlacementSupply_ClosestGet.sql b/db/routines/vn/functions/itemShelvingPlacementSupply_ClosestGet.sql
index 6b5fc3ae3..805045021 100644
--- a/db/routines/vn/functions/itemShelvingPlacementSupply_ClosestGet.sql
+++ b/db/routines/vn/functions/itemShelvingPlacementSupply_ClosestGet.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`itemShelvingPlacementSupply_ClosestGet`(vParkingFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`itemShelvingPlacementSupply_ClosestGet`(vParkingFk INT)
RETURNS int(11)
NOT DETERMINISTIC
READS SQL DATA
diff --git a/db/routines/vn/functions/itemTag_getIntValue.sql b/db/routines/vn/functions/itemTag_getIntValue.sql
index fa5a03552..3996f71f8 100644
--- a/db/routines/vn/functions/itemTag_getIntValue.sql
+++ b/db/routines/vn/functions/itemTag_getIntValue.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`itemTag_getIntValue`(vValue VARCHAR(255))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`itemTag_getIntValue`(vValue VARCHAR(255))
RETURNS int(11)
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/item_getFhImage.sql b/db/routines/vn/functions/item_getFhImage.sql
index 13e02e8fe..d5aef592d 100644
--- a/db/routines/vn/functions/item_getFhImage.sql
+++ b/db/routines/vn/functions/item_getFhImage.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`item_getFhImage`(itemFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`item_getFhImage`(itemFk INT)
RETURNS varchar(255) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/item_getPackage.sql b/db/routines/vn/functions/item_getPackage.sql
index 894abe4cf..88e40399f 100644
--- a/db/routines/vn/functions/item_getPackage.sql
+++ b/db/routines/vn/functions/item_getPackage.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`item_getPackage`(vItemFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`item_getPackage`(vItemFk INT)
RETURNS varchar(50) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/item_getVolume.sql b/db/routines/vn/functions/item_getVolume.sql
index afcb32c93..f4156e5a6 100644
--- a/db/routines/vn/functions/item_getVolume.sql
+++ b/db/routines/vn/functions/item_getVolume.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`item_getVolume`(vSelf INT, vPackaging VARCHAR(10))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`item_getVolume`(vSelf INT, vPackaging VARCHAR(10))
RETURNS int(11)
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/itemsInSector_get.sql b/db/routines/vn/functions/itemsInSector_get.sql
index 9054087b3..254ebe1b5 100644
--- a/db/routines/vn/functions/itemsInSector_get.sql
+++ b/db/routines/vn/functions/itemsInSector_get.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`itemsInSector_get`(vTicketFk INT, vSectorFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`itemsInSector_get`(vTicketFk INT, vSectorFk INT)
RETURNS int(11)
NOT DETERMINISTIC
READS SQL DATA
diff --git a/db/routines/vn/functions/lastDayOfWeek.sql b/db/routines/vn/functions/lastDayOfWeek.sql
index 464bf5afe..0aba5ab7b 100644
--- a/db/routines/vn/functions/lastDayOfWeek.sql
+++ b/db/routines/vn/functions/lastDayOfWeek.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`lastDayOfWeek`(vYear INT, vWeek INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`lastDayOfWeek`(vYear INT, vWeek INT)
RETURNS date
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/machine_checkPlate.sql b/db/routines/vn/functions/machine_checkPlate.sql
index d08ed97c5..8660163e4 100644
--- a/db/routines/vn/functions/machine_checkPlate.sql
+++ b/db/routines/vn/functions/machine_checkPlate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`machine_checkPlate`(vPlate VARCHAR(10))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`machine_checkPlate`(vPlate VARCHAR(10))
RETURNS tinyint(1)
NOT DETERMINISTIC
READS SQL DATA
diff --git a/db/routines/vn/functions/messageSend.sql b/db/routines/vn/functions/messageSend.sql
index 8a95118e7..22cca43ec 100644
--- a/db/routines/vn/functions/messageSend.sql
+++ b/db/routines/vn/functions/messageSend.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`messageSend`(vRecipient VARCHAR(255) CHARSET utf8, vMessage TEXT CHARSET utf8)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`messageSend`(vRecipient VARCHAR(255) CHARSET utf8, vMessage TEXT CHARSET utf8)
RETURNS int(11)
NOT DETERMINISTIC
READS SQL DATA
diff --git a/db/routines/vn/functions/messageSendWithUser.sql b/db/routines/vn/functions/messageSendWithUser.sql
index 1d5b730a8..f8bfde2e4 100644
--- a/db/routines/vn/functions/messageSendWithUser.sql
+++ b/db/routines/vn/functions/messageSendWithUser.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`messageSendWithUser`(vSenderFK INT, vRecipient VARCHAR(255) CHARSET utf8, vMessage TEXT CHARSET utf8)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`messageSendWithUser`(vSenderFK INT, vRecipient VARCHAR(255) CHARSET utf8, vMessage TEXT CHARSET utf8)
RETURNS int(11)
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/orderTotalVolume.sql b/db/routines/vn/functions/orderTotalVolume.sql
index 962baa8ec..7962a9a73 100644
--- a/db/routines/vn/functions/orderTotalVolume.sql
+++ b/db/routines/vn/functions/orderTotalVolume.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`orderTotalVolume`(vOrderId INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`orderTotalVolume`(vOrderId INT)
RETURNS decimal(10,3)
NOT DETERMINISTIC
READS SQL DATA
diff --git a/db/routines/vn/functions/orderTotalVolumeBoxes.sql b/db/routines/vn/functions/orderTotalVolumeBoxes.sql
index cbc0e94ac..3474534c4 100644
--- a/db/routines/vn/functions/orderTotalVolumeBoxes.sql
+++ b/db/routines/vn/functions/orderTotalVolumeBoxes.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`orderTotalVolumeBoxes`(vOrderId INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`orderTotalVolumeBoxes`(vOrderId INT)
RETURNS decimal(10,3)
NOT DETERMINISTIC
READS SQL DATA
diff --git a/db/routines/vn/functions/packaging_calculate.sql b/db/routines/vn/functions/packaging_calculate.sql
index c9aaf07b9..01ec8b843 100644
--- a/db/routines/vn/functions/packaging_calculate.sql
+++ b/db/routines/vn/functions/packaging_calculate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`packaging_calculate`(isPackageReturnable TINYINT(1),
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`packaging_calculate`(isPackageReturnable TINYINT(1),
packagingReturnFk INT(11),
base DECIMAL(10,2),
price DECIMAL(10,2),
diff --git a/db/routines/vn/functions/priceFixed_getRate2.sql b/db/routines/vn/functions/priceFixed_getRate2.sql
index d97a20e59..61e5abe9b 100644
--- a/db/routines/vn/functions/priceFixed_getRate2.sql
+++ b/db/routines/vn/functions/priceFixed_getRate2.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`priceFixed_getRate2`(vFixedPriceFk INT, vRate3 DOUBLE)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`priceFixed_getRate2`(vFixedPriceFk INT, vRate3 DOUBLE)
RETURNS double
NOT DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/routeProposal.sql b/db/routines/vn/functions/routeProposal.sql
index 81b5d9048..14b626a39 100644
--- a/db/routines/vn/functions/routeProposal.sql
+++ b/db/routines/vn/functions/routeProposal.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`routeProposal`(vTicketFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`routeProposal`(vTicketFk INT)
RETURNS int(11)
NOT DETERMINISTIC
READS SQL DATA
diff --git a/db/routines/vn/functions/routeProposal_.sql b/db/routines/vn/functions/routeProposal_.sql
deleted file mode 100644
index b4559c10c..000000000
--- a/db/routines/vn/functions/routeProposal_.sql
+++ /dev/null
@@ -1,30 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`routeProposal_`(vTicketFk INT)
- RETURNS int(11)
- NOT DETERMINISTIC
- READS SQL DATA
-BEGIN
-
- DECLARE vRouteFk INT;
- DECLARE vAddressFk INT;
- DECLARE vShipped DATETIME;
-
- SELECT addressFk, date(shipped) INTO vAddressFk, vShipped
- FROM vn.ticket
- WHERE id = vTicketFk;
-
- SELECT routeFk INTO vRouteFk
- FROM
- (SELECT t.routeFk, sum(af.friendship) friendshipSum
- FROM vn.ticket t
- JOIN cache.addressFriendship af ON af.addressFk2 = t.addressFk AND af.addressFk1 = vAddressFk
- WHERE t.shipped BETWEEN vShipped and MIDNIGHT(vShipped)
- AND t.routeFk
- GROUP BY routeFk
- ORDER BY friendshipSum DESC
- ) sub
- LIMIT 1;
-
- RETURN vRouteFk;
-END$$
-DELIMITER ;
diff --git a/db/routines/vn/functions/routeProposal_beta.sql b/db/routines/vn/functions/routeProposal_beta.sql
index 4ec17d3ed..d6db4d361 100644
--- a/db/routines/vn/functions/routeProposal_beta.sql
+++ b/db/routines/vn/functions/routeProposal_beta.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`routeProposal_beta`(vTicketFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`routeProposal_beta`(vTicketFk INT)
RETURNS int(11)
NOT DETERMINISTIC
READS SQL DATA
diff --git a/db/routines/vn/functions/sale_hasComponentLack.sql b/db/routines/vn/functions/sale_hasComponentLack.sql
index 912d5f107..a7ccfeec6 100644
--- a/db/routines/vn/functions/sale_hasComponentLack.sql
+++ b/db/routines/vn/functions/sale_hasComponentLack.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`sale_hasComponentLack`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`sale_hasComponentLack`(
vSelf INT
)RETURNS tinyint(1)
READS SQL DATA
diff --git a/db/routines/vn/functions/specie_IsForbidden.sql b/db/routines/vn/functions/specie_IsForbidden.sql
index 5e7275ae7..a8ed12a50 100644
--- a/db/routines/vn/functions/specie_IsForbidden.sql
+++ b/db/routines/vn/functions/specie_IsForbidden.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`specie_IsForbidden`(vItemFk INT, vAddressFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`specie_IsForbidden`(vItemFk INT, vAddressFk INT)
RETURNS tinyint(1)
NOT DETERMINISTIC
READS SQL DATA
diff --git a/db/routines/vn/functions/testCIF.sql b/db/routines/vn/functions/testCIF.sql
index ba2cc8345..f6acd8fb9 100644
--- a/db/routines/vn/functions/testCIF.sql
+++ b/db/routines/vn/functions/testCIF.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`testCIF`(vCIF VARCHAR(9))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`testCIF`(vCIF VARCHAR(9))
RETURNS varchar(10) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/testNIE.sql b/db/routines/vn/functions/testNIE.sql
index 6843becad..fdc371233 100644
--- a/db/routines/vn/functions/testNIE.sql
+++ b/db/routines/vn/functions/testNIE.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`testNIE`(vNIE VARCHAR(9))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`testNIE`(vNIE VARCHAR(9))
RETURNS tinyint(1)
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/testNIF.sql b/db/routines/vn/functions/testNIF.sql
index 5b6654312..59e59a456 100644
--- a/db/routines/vn/functions/testNIF.sql
+++ b/db/routines/vn/functions/testNIF.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`testNIF`(vNIF VARCHAR(9))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`testNIF`(vNIF VARCHAR(9))
RETURNS tinyint(1)
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/ticketCollection_getNoPacked.sql b/db/routines/vn/functions/ticketCollection_getNoPacked.sql
index a9f04cc88..10065faf5 100644
--- a/db/routines/vn/functions/ticketCollection_getNoPacked.sql
+++ b/db/routines/vn/functions/ticketCollection_getNoPacked.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`ticketCollection_getNoPacked`(vCollectionFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`ticketCollection_getNoPacked`(vCollectionFk INT)
RETURNS varchar(100) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/ticketGetTotal.sql b/db/routines/vn/functions/ticketGetTotal.sql
index ced02e3c5..a45cbbec8 100644
--- a/db/routines/vn/functions/ticketGetTotal.sql
+++ b/db/routines/vn/functions/ticketGetTotal.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`ticketGetTotal`(vTicketId INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`ticketGetTotal`(vTicketId INT)
RETURNS decimal(10,2)
DETERMINISTIC
READS SQL DATA
diff --git a/db/routines/vn/functions/ticketPositionInPath.sql b/db/routines/vn/functions/ticketPositionInPath.sql
index 5e75d868d..c7a6b9094 100644
--- a/db/routines/vn/functions/ticketPositionInPath.sql
+++ b/db/routines/vn/functions/ticketPositionInPath.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`ticketPositionInPath`(vTicketId INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`ticketPositionInPath`(vTicketId INT)
RETURNS varchar(10) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/ticketSplitCounter.sql b/db/routines/vn/functions/ticketSplitCounter.sql
index e82c079ae..eb1058a57 100644
--- a/db/routines/vn/functions/ticketSplitCounter.sql
+++ b/db/routines/vn/functions/ticketSplitCounter.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`ticketSplitCounter`(vTicketFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`ticketSplitCounter`(vTicketFk INT)
RETURNS varchar(15) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
NOT DETERMINISTIC
READS SQL DATA
diff --git a/db/routines/vn/functions/ticketTotalVolume.sql b/db/routines/vn/functions/ticketTotalVolume.sql
index dc861ab6c..1fe9b3d39 100644
--- a/db/routines/vn/functions/ticketTotalVolume.sql
+++ b/db/routines/vn/functions/ticketTotalVolume.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`ticketTotalVolume`(vTicketId INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`ticketTotalVolume`(vTicketId INT)
RETURNS decimal(10,3)
NOT DETERMINISTIC
READS SQL DATA
diff --git a/db/routines/vn/functions/ticketTotalVolumeBoxes.sql b/db/routines/vn/functions/ticketTotalVolumeBoxes.sql
index eb529bab9..1fec10977 100644
--- a/db/routines/vn/functions/ticketTotalVolumeBoxes.sql
+++ b/db/routines/vn/functions/ticketTotalVolumeBoxes.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`ticketTotalVolumeBoxes`(vTicketId INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`ticketTotalVolumeBoxes`(vTicketId INT)
RETURNS decimal(10,1)
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/ticketWarehouseGet.sql b/db/routines/vn/functions/ticketWarehouseGet.sql
index 705949f24..b1c7b9bc2 100644
--- a/db/routines/vn/functions/ticketWarehouseGet.sql
+++ b/db/routines/vn/functions/ticketWarehouseGet.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`ticketWarehouseGet`(vTicketFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`ticketWarehouseGet`(vTicketFk INT)
RETURNS int(11)
NOT DETERMINISTIC
READS SQL DATA
diff --git a/db/routines/vn/functions/ticket_CC_volume.sql b/db/routines/vn/functions/ticket_CC_volume.sql
index 2572ae12d..f0c65931b 100644
--- a/db/routines/vn/functions/ticket_CC_volume.sql
+++ b/db/routines/vn/functions/ticket_CC_volume.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`ticket_CC_volume`(vTicketFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`ticket_CC_volume`(vTicketFk INT)
RETURNS decimal(10,1)
NOT DETERMINISTIC
READS SQL DATA
diff --git a/db/routines/vn/functions/ticket_HasUbication.sql b/db/routines/vn/functions/ticket_HasUbication.sql
index 344a34aa9..7559cf360 100644
--- a/db/routines/vn/functions/ticket_HasUbication.sql
+++ b/db/routines/vn/functions/ticket_HasUbication.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`ticket_HasUbication`(vTicketFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`ticket_HasUbication`(vTicketFk INT)
RETURNS tinyint(1)
NOT DETERMINISTIC
READS SQL DATA
diff --git a/db/routines/vn/functions/ticket_get.sql b/db/routines/vn/functions/ticket_get.sql
index b55b1297e..ac8d0c642 100644
--- a/db/routines/vn/functions/ticket_get.sql
+++ b/db/routines/vn/functions/ticket_get.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`ticket_get`(vParamFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`ticket_get`(vParamFk INT)
RETURNS INT(11)
NOT DETERMINISTIC
READS SQL DATA
diff --git a/db/routines/vn/functions/ticket_getFreightCost.sql b/db/routines/vn/functions/ticket_getFreightCost.sql
index 61905aff2..c5ddf561d 100644
--- a/db/routines/vn/functions/ticket_getFreightCost.sql
+++ b/db/routines/vn/functions/ticket_getFreightCost.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`ticket_getFreightCost`(vTicketFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`ticket_getFreightCost`(vTicketFk INT)
RETURNS decimal(10,2)
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/ticket_getWeight.sql b/db/routines/vn/functions/ticket_getWeight.sql
index 32f84cac7..d0298d63f 100644
--- a/db/routines/vn/functions/ticket_getWeight.sql
+++ b/db/routines/vn/functions/ticket_getWeight.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`ticket_getWeight`(vTicketFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`ticket_getWeight`(vTicketFk INT)
RETURNS decimal(10,3)
NOT DETERMINISTIC
READS SQL DATA
diff --git a/db/routines/vn/functions/ticket_isOutClosureZone.sql b/db/routines/vn/functions/ticket_isOutClosureZone.sql
index ebddcf505..fcd7de858 100644
--- a/db/routines/vn/functions/ticket_isOutClosureZone.sql
+++ b/db/routines/vn/functions/ticket_isOutClosureZone.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`ticket_isOutClosureZone`(vSelf INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`ticket_isOutClosureZone`(vSelf INT)
RETURNS tinyint(1)
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/ticket_isProblemCalcNeeded.sql b/db/routines/vn/functions/ticket_isProblemCalcNeeded.sql
index 4974a8c76..aa821a8e5 100644
--- a/db/routines/vn/functions/ticket_isProblemCalcNeeded.sql
+++ b/db/routines/vn/functions/ticket_isProblemCalcNeeded.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`ticket_isProblemCalcNeeded`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`ticket_isProblemCalcNeeded`(
vSelf INT
)
RETURNS BOOL
diff --git a/db/routines/vn/functions/ticket_isTooLittle.sql b/db/routines/vn/functions/ticket_isTooLittle.sql
index 2752b3f35..a3444c863 100644
--- a/db/routines/vn/functions/ticket_isTooLittle.sql
+++ b/db/routines/vn/functions/ticket_isTooLittle.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`ticket_isTooLittle`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`ticket_isTooLittle`(
vSelf INT
)
RETURNS BOOL
diff --git a/db/routines/vn/functions/till_new.sql b/db/routines/vn/functions/till_new.sql
index b93072596..2b235a91d 100644
--- a/db/routines/vn/functions/till_new.sql
+++ b/db/routines/vn/functions/till_new.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`till_new`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`till_new`(
vClient INT,
vBank INT,
vAmount DOUBLE,
diff --git a/db/routines/vn/functions/timeWorkerControl_getDirection.sql b/db/routines/vn/functions/timeWorkerControl_getDirection.sql
index 518e4aeb5..c0f1e67ea 100644
--- a/db/routines/vn/functions/timeWorkerControl_getDirection.sql
+++ b/db/routines/vn/functions/timeWorkerControl_getDirection.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`timeWorkerControl_getDirection`(vUserFk INT, vTimed DATETIME)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`timeWorkerControl_getDirection`(vUserFk INT, vTimed DATETIME)
RETURNS varchar(6) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci
NOT DETERMINISTIC
READS SQL DATA
diff --git a/db/routines/vn/functions/time_getSalesYear.sql b/db/routines/vn/functions/time_getSalesYear.sql
index 658a1112a..d9022890d 100644
--- a/db/routines/vn/functions/time_getSalesYear.sql
+++ b/db/routines/vn/functions/time_getSalesYear.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`time_getSalesYear`(vMonth INT, vYear INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`time_getSalesYear`(vMonth INT, vYear INT)
RETURNS int(11)
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/travel_getForLogiflora.sql b/db/routines/vn/functions/travel_getForLogiflora.sql
deleted file mode 100644
index cb3f0dac0..000000000
--- a/db/routines/vn/functions/travel_getForLogiflora.sql
+++ /dev/null
@@ -1,52 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`travel_getForLogiflora`(vLanded DATE, vWarehouseFk INT)
- RETURNS int(11)
- NOT DETERMINISTIC
- READS SQL DATA
-BEGIN
-
- /**
- * Devuelve un número de travel para compras de Logiflora a partir de la fecha de llegada y del almacén.
- * Si no existe lo genera.
- *
- * @param vLanded Fecha de llegada al almacén
- * @param vWarehouseFk Identificador de vn.warehouse
- */
-
- DECLARE vTravelFk INT;
-
- IF vLanded THEN
-
- SELECT IFNULL(MAX(tr.id),0) INTO vTravelFk
- FROM vn.travel tr
- JOIN vn.warehouse wIn ON wIn.id = tr.warehouseInFk
- JOIN vn.warehouse wOut ON wOut.id = tr.warehouseOutFk
- JOIN vn.agencyMode am ON am.id = tr.agencyModeFk
- WHERE wIn.id = vWarehouseFk
- AND wOut.name = 'Holanda'
- AND am.name = 'LOGIFLORA'
- AND landed = vLanded;
-
- IF NOT vTravelFk THEN
-
- INSERT INTO vn.travel(landed, shipped, warehouseInFk, warehouseOutFk, agencyModeFk)
- SELECT vLanded, util.VN_CURDATE(), vWarehouseFk, wOut.id, am.id
- FROM vn.warehouse wOut
- JOIN vn.agencyMode am ON am.name = 'LOGIFLORA'
- WHERE wOut.name = 'Holanda';
-
- SELECT MAX(tr.id) INTO vTravelFk
- FROM vn.travel tr
- JOIN vn.warehouse wIn ON wIn.id = tr.warehouseInFk
- JOIN vn.warehouse wOut ON wOut.id = tr.warehouseOutFk
- WHERE wIn.id = vWarehouseFk
- AND wOut.name = 'Holanda'
- AND landed = vLanded;
- END IF;
-
- END IF;
-
- RETURN vTravelFk;
-
-END$$
-DELIMITER ;
diff --git a/db/routines/vn/functions/travel_hasUniqueAwb.sql b/db/routines/vn/functions/travel_hasUniqueAwb.sql
index e918f1a26..d98986753 100644
--- a/db/routines/vn/functions/travel_hasUniqueAwb.sql
+++ b/db/routines/vn/functions/travel_hasUniqueAwb.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`travel_hasUniqueAwb`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`travel_hasUniqueAwb`(
vSelf INT
)
RETURNS BOOL
diff --git a/db/routines/vn/functions/validationCode.sql b/db/routines/vn/functions/validationCode.sql
index 75d603d24..ab0acedaa 100644
--- a/db/routines/vn/functions/validationCode.sql
+++ b/db/routines/vn/functions/validationCode.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`validationCode`(vString VARCHAR(255))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`validationCode`(vString VARCHAR(255))
RETURNS int(11)
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/validationCode_beta.sql b/db/routines/vn/functions/validationCode_beta.sql
index 0e27a4722..afeb1273a 100644
--- a/db/routines/vn/functions/validationCode_beta.sql
+++ b/db/routines/vn/functions/validationCode_beta.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`validationCode_beta`(vString VARCHAR(255))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`validationCode_beta`(vString VARCHAR(255))
RETURNS int(11)
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/workerMachinery_isRegistered.sql b/db/routines/vn/functions/workerMachinery_isRegistered.sql
index 89a1c44ac..60f458e9e 100644
--- a/db/routines/vn/functions/workerMachinery_isRegistered.sql
+++ b/db/routines/vn/functions/workerMachinery_isRegistered.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`workerMachinery_isRegistered`(vWorkerFk VARCHAR(10))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`workerMachinery_isRegistered`(vWorkerFk VARCHAR(10))
RETURNS tinyint(1)
NOT DETERMINISTIC
READS SQL DATA
diff --git a/db/routines/vn/functions/workerNigthlyHours_calculate.sql b/db/routines/vn/functions/workerNigthlyHours_calculate.sql
index 0828b30f9..1b4835712 100644
--- a/db/routines/vn/functions/workerNigthlyHours_calculate.sql
+++ b/db/routines/vn/functions/workerNigthlyHours_calculate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`workerNigthlyHours_calculate`(vTimeIn DATETIME, vTimeOut DATETIME)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`workerNigthlyHours_calculate`(vTimeIn DATETIME, vTimeOut DATETIME)
RETURNS decimal(5,2)
NOT DETERMINISTIC
READS SQL DATA
diff --git a/db/routines/vn/functions/worker_getCode.sql b/db/routines/vn/functions/worker_getCode.sql
index d3d63dccc..76ec94d1b 100644
--- a/db/routines/vn/functions/worker_getCode.sql
+++ b/db/routines/vn/functions/worker_getCode.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`worker_getCode`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`worker_getCode`()
RETURNS varchar(3) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
NOT DETERMINISTIC
READS SQL DATA
diff --git a/db/routines/vn/functions/worker_isBoss.sql b/db/routines/vn/functions/worker_isBoss.sql
index 7efada705..8ab3a1fa9 100644
--- a/db/routines/vn/functions/worker_isBoss.sql
+++ b/db/routines/vn/functions/worker_isBoss.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`worker_isBoss`(vUserId INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`worker_isBoss`(vUserId INT)
RETURNS int(11)
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/worker_isInDepartment.sql b/db/routines/vn/functions/worker_isInDepartment.sql
index 8eee3656e..6f6146d0b 100644
--- a/db/routines/vn/functions/worker_isInDepartment.sql
+++ b/db/routines/vn/functions/worker_isInDepartment.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`worker_isInDepartment`(vDepartmentCode VARCHAR(255))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`worker_isInDepartment`(vDepartmentCode VARCHAR(255))
RETURNS int(11)
DETERMINISTIC
BEGIN
diff --git a/db/routines/vn/functions/worker_isWorking.sql b/db/routines/vn/functions/worker_isWorking.sql
index 3db333bd0..455b78805 100644
--- a/db/routines/vn/functions/worker_isWorking.sql
+++ b/db/routines/vn/functions/worker_isWorking.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`worker_isWorking`(vWorkerFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`worker_isWorking`(vWorkerFk INT)
RETURNS tinyint(1)
NOT DETERMINISTIC
READS SQL DATA
diff --git a/db/routines/vn/functions/zoneGeo_new.sql b/db/routines/vn/functions/zoneGeo_new.sql
index 65b045962..47ec3dec7 100644
--- a/db/routines/vn/functions/zoneGeo_new.sql
+++ b/db/routines/vn/functions/zoneGeo_new.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`zoneGeo_new`(vType VARCHAR(255), vName VARCHAR(255), vParentFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`zoneGeo_new`(vType VARCHAR(255), vName VARCHAR(255), vParentFk INT)
RETURNS int(11)
NOT DETERMINISTIC
NO SQL
diff --git a/db/routines/vn/procedures/XDiario_check.sql b/db/routines/vn/procedures/XDiario_check.sql
index ef969924b..a8f33adde 100644
--- a/db/routines/vn/procedures/XDiario_check.sql
+++ b/db/routines/vn/procedures/XDiario_check.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`XDiario_check`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`XDiario_check`()
BEGIN
/**
* Realiza la revisión diaria de los asientos contables,
diff --git a/db/routines/vn/procedures/XDiario_checkDate.sql b/db/routines/vn/procedures/XDiario_checkDate.sql
index b481d1f36..8b961a1fa 100644
--- a/db/routines/vn/procedures/XDiario_checkDate.sql
+++ b/db/routines/vn/procedures/XDiario_checkDate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`XDiario_checkDate`(vDate DATE)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`XDiario_checkDate`(vDate DATE)
proc: BEGIN
/**
* Comprueba si la fecha pasada esta en el rango
diff --git a/db/routines/vn/procedures/absoluteInventoryHistory.sql b/db/routines/vn/procedures/absoluteInventoryHistory.sql
index 627b7c8be..d2a2029f0 100644
--- a/db/routines/vn/procedures/absoluteInventoryHistory.sql
+++ b/db/routines/vn/procedures/absoluteInventoryHistory.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`absoluteInventoryHistory`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`absoluteInventoryHistory`(
vItemFk INT,
vWarehouseFk INT,
vDate DATETIME
diff --git a/db/routines/vn/procedures/addAccountReconciliation.sql b/db/routines/vn/procedures/addAccountReconciliation.sql
index 8effbd76c..1aa3c28fd 100644
--- a/db/routines/vn/procedures/addAccountReconciliation.sql
+++ b/db/routines/vn/procedures/addAccountReconciliation.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`addAccountReconciliation`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`addAccountReconciliation`()
BEGIN
/**
* Updates duplicate records in the accountReconciliation table,
diff --git a/db/routines/vn/procedures/addNoteFromDelivery.sql b/db/routines/vn/procedures/addNoteFromDelivery.sql
index 61295b7db..57b7bef24 100644
--- a/db/routines/vn/procedures/addNoteFromDelivery.sql
+++ b/db/routines/vn/procedures/addNoteFromDelivery.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`addNoteFromDelivery`(idTicket INT,nota TEXT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`addNoteFromDelivery`(idTicket INT,nota TEXT)
BEGIN
DECLARE observationTypeFk INT DEFAULT 3; /*3 = REPARTIDOR*/
diff --git a/db/routines/vn/procedures/addressTaxArea.sql b/db/routines/vn/procedures/addressTaxArea.sql
index 5deb01fa4..a1bb0dec0 100644
--- a/db/routines/vn/procedures/addressTaxArea.sql
+++ b/db/routines/vn/procedures/addressTaxArea.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`addressTaxArea`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`addressTaxArea`()
READS SQL DATA
BEGIN
/**
diff --git a/db/routines/vn/procedures/address_updateCoordinates.sql b/db/routines/vn/procedures/address_updateCoordinates.sql
index 9d3ec963a..815c7b7a7 100644
--- a/db/routines/vn/procedures/address_updateCoordinates.sql
+++ b/db/routines/vn/procedures/address_updateCoordinates.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`address_updateCoordinates`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`address_updateCoordinates`(
vTicketFk INT,
vLongitude DECIMAL(11,7),
vLatitude DECIMAL(11,7))
diff --git a/db/routines/vn/procedures/agencyHourGetFirstShipped.sql b/db/routines/vn/procedures/agencyHourGetFirstShipped.sql
index 4bd1c4222..dc584d0f9 100644
--- a/db/routines/vn/procedures/agencyHourGetFirstShipped.sql
+++ b/db/routines/vn/procedures/agencyHourGetFirstShipped.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`agencyHourGetFirstShipped`(vAgencyMode INT, vAddress INT, vWarehouse INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`agencyHourGetFirstShipped`(vAgencyMode INT, vAddress INT, vWarehouse INT)
BEGIN
/**
* DEPRECATED usar zoneGetFirstShipped
diff --git a/db/routines/vn/procedures/agencyHourGetLanded.sql b/db/routines/vn/procedures/agencyHourGetLanded.sql
index ee48388a0..6e766d739 100644
--- a/db/routines/vn/procedures/agencyHourGetLanded.sql
+++ b/db/routines/vn/procedures/agencyHourGetLanded.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`agencyHourGetLanded`(vDated DATE, vAddress INT, vAgency INT, vWarehouse INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`agencyHourGetLanded`(vDated DATE, vAddress INT, vAgency INT, vWarehouse INT)
BEGIN
/**
* DEPRECATED usar zoneGetLanded
diff --git a/db/routines/vn/procedures/agencyHourGetWarehouse.sql b/db/routines/vn/procedures/agencyHourGetWarehouse.sql
index 7fc524fce..0e27e4437 100644
--- a/db/routines/vn/procedures/agencyHourGetWarehouse.sql
+++ b/db/routines/vn/procedures/agencyHourGetWarehouse.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`agencyHourGetWarehouse`(vAddress INT, vDate DATE, vWarehouse INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`agencyHourGetWarehouse`(vAddress INT, vDate DATE, vWarehouse INT)
BEGIN
/**
* DEPRECATED usar zoneGetWarehouse
diff --git a/db/routines/vn/procedures/agencyHourListGetShipped.sql b/db/routines/vn/procedures/agencyHourListGetShipped.sql
index b4cf35f77..3a0b0db65 100644
--- a/db/routines/vn/procedures/agencyHourListGetShipped.sql
+++ b/db/routines/vn/procedures/agencyHourListGetShipped.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`agencyHourListGetShipped`(vDate DATE, vAddress INT, vAgency INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`agencyHourListGetShipped`(vDate DATE, vAddress INT, vAgency INT)
BEGIN
/* * DEPRECATED usar zoneGetShipped
*/
diff --git a/db/routines/vn/procedures/agencyVolume.sql b/db/routines/vn/procedures/agencyVolume.sql
index ef47834ba..451b089fc 100644
--- a/db/routines/vn/procedures/agencyVolume.sql
+++ b/db/routines/vn/procedures/agencyVolume.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`agencyVolume`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`agencyVolume`()
BEGIN
/**
* Calculates and presents information on shipment and packaging volumes
diff --git a/db/routines/vn/procedures/available_calc.sql b/db/routines/vn/procedures/available_calc.sql
index 8c806d41d..ddfba8bad 100644
--- a/db/routines/vn/procedures/available_calc.sql
+++ b/db/routines/vn/procedures/available_calc.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`available_calc`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`available_calc`(
vDate DATE,
vAddress INT,
vAgencyMode INT)
diff --git a/db/routines/vn/procedures/available_traslate.sql b/db/routines/vn/procedures/available_traslate.sql
index e4ba13d79..03eb376ab 100644
--- a/db/routines/vn/procedures/available_traslate.sql
+++ b/db/routines/vn/procedures/available_traslate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`available_traslate`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`available_traslate`(
vWarehouseLanding INT,
vDated DATE,
vWarehouseShipment INT)
diff --git a/db/routines/vn/procedures/balanceNestTree_addChild.sql b/db/routines/vn/procedures/balanceNestTree_addChild.sql
index 5cd1ab470..2bf4157c4 100644
--- a/db/routines/vn/procedures/balanceNestTree_addChild.sql
+++ b/db/routines/vn/procedures/balanceNestTree_addChild.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`balanceNestTree_addChild`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`balanceNestTree_addChild`(
vSelf INT,
vName VARCHAR(45)
)
diff --git a/db/routines/vn/procedures/balanceNestTree_delete.sql b/db/routines/vn/procedures/balanceNestTree_delete.sql
index 1d6a9efff..bb0b83bf5 100644
--- a/db/routines/vn/procedures/balanceNestTree_delete.sql
+++ b/db/routines/vn/procedures/balanceNestTree_delete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`balanceNestTree_delete`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`balanceNestTree_delete`(
vSelf INT
)
BEGIN
diff --git a/db/routines/vn/procedures/balanceNestTree_move.sql b/db/routines/vn/procedures/balanceNestTree_move.sql
index ce29de1d9..a05a618b7 100644
--- a/db/routines/vn/procedures/balanceNestTree_move.sql
+++ b/db/routines/vn/procedures/balanceNestTree_move.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`balanceNestTree_move`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`balanceNestTree_move`(
vSelf INT,
vFather INT
)
diff --git a/db/routines/vn/procedures/balance_create.sql b/db/routines/vn/procedures/balance_create.sql
index 366707e58..6363b4c00 100644
--- a/db/routines/vn/procedures/balance_create.sql
+++ b/db/routines/vn/procedures/balance_create.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`balance_create`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`balance_create`(
vStartingMonth INT,
vEndingMonth INT,
vCompany INT,
diff --git a/db/routines/vn/procedures/bankEntity_checkBic.sql b/db/routines/vn/procedures/bankEntity_checkBic.sql
index 2f05ae654..069c2a0d7 100644
--- a/db/routines/vn/procedures/bankEntity_checkBic.sql
+++ b/db/routines/vn/procedures/bankEntity_checkBic.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`bankEntity_checkBic`(vBic VARCHAR(255))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`bankEntity_checkBic`(vBic VARCHAR(255))
BEGIN
/**
* If the bic length is Incorrect throw exception
diff --git a/db/routines/vn/procedures/bankPolicy_notifyExpired.sql b/db/routines/vn/procedures/bankPolicy_notifyExpired.sql
index 61216938d..cdcd212f3 100644
--- a/db/routines/vn/procedures/bankPolicy_notifyExpired.sql
+++ b/db/routines/vn/procedures/bankPolicy_notifyExpired.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`bankPolicy_notifyExpired`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`bankPolicy_notifyExpired`()
BEGIN
/**
*
diff --git a/db/routines/vn/procedures/buyUltimate.sql b/db/routines/vn/procedures/buyUltimate.sql
deleted file mode 100644
index e743b8c90..000000000
--- a/db/routines/vn/procedures/buyUltimate.sql
+++ /dev/null
@@ -1,18 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buyUltimate`(
- vWarehouseFk SMALLINT,
- vDated DATE
-)
-BEGIN
-/**
- * @deprecated Usar buy_getUltimate
- * Calcula las últimas compras realizadas hasta una fecha.
- *
- * @param vItemFk Id del artículo
- * @param vWarehouseFk Id del almacén
- * @param vDated Compras hasta fecha
- * @return tmp.buyUltimate
- */
- CALL buy_getUltimate(NULL, vWarehouseFk, vDated);
-END$$
-DELIMITER ;
diff --git a/db/routines/vn/procedures/buyUltimateFromInterval.sql b/db/routines/vn/procedures/buyUltimateFromInterval.sql
deleted file mode 100644
index acb6282de..000000000
--- a/db/routines/vn/procedures/buyUltimateFromInterval.sql
+++ /dev/null
@@ -1,20 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buyUltimateFromInterval`(
- vWarehouseFk SMALLINT,
- vStarted DATE,
- vEnded DATE
-)
-BEGIN
-/**
- * @deprecated Usar buy_getUltimateFromInterval
- * Calcula las últimas compras realizadas
- * desde un rango de fechas.
- *
- * @param vWarehouseFk Id del almacén si es NULL se actualizan todos
- * @param vStarted Fecha inicial
- * @param vEnded Fecha fin
- * @return tmp.buyUltimateFromInterval
- */
- CALL vn.buy_getUltimateFromInterval(NULL, vWarehouseFk, vStarted, vEnded);
-END$$
-DELIMITER ;
diff --git a/db/routines/vn/procedures/buy_afterUpsert.sql b/db/routines/vn/procedures/buy_afterUpsert.sql
index 76f60d1e5..7ff7dd841 100644
--- a/db/routines/vn/procedures/buy_afterUpsert.sql
+++ b/db/routines/vn/procedures/buy_afterUpsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_afterUpsert`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buy_afterUpsert`(
vSelf INT
)
BEGIN
diff --git a/db/routines/vn/procedures/buy_checkGrouping.sql b/db/routines/vn/procedures/buy_checkGrouping.sql
index 11c727fb1..7d2830ab2 100644
--- a/db/routines/vn/procedures/buy_checkGrouping.sql
+++ b/db/routines/vn/procedures/buy_checkGrouping.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_checkGrouping`(vGrouping INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buy_checkGrouping`(vGrouping INT)
BEGIN
/**
* Checks the buy grouping, throws an error if it's invalid.
diff --git a/db/routines/vn/procedures/buy_chekItem.sql b/db/routines/vn/procedures/buy_checkItem.sql
similarity index 54%
rename from db/routines/vn/procedures/buy_chekItem.sql
rename to db/routines/vn/procedures/buy_checkItem.sql
index e8cf05fed..1144db889 100644
--- a/db/routines/vn/procedures/buy_chekItem.sql
+++ b/db/routines/vn/procedures/buy_checkItem.sql
@@ -1,14 +1,15 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_checkItem`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buy_checkItem`()
BEGIN
/**
* Checks if the item has weightByPiece or size null on any buy.
*
* @param tmp.buysToCheck(id as INT).
*/
- DECLARE hasVolumetricAgency INT;
+ DECLARE vHasVolumetricAgency INT;
+ DECLARE vItemFk INT;
- SELECT a.hasWeightVolumetric INTO hasVolumetricAgency
+ SELECT a.hasWeightVolumetric, i.id INTO vHasVolumetricAgency, vItemFk
FROM entry e
JOIN travel t ON t.id = e.travelFk
JOIN agencyMode a ON a.id = t.agencyModeFk
@@ -19,10 +20,10 @@ BEGIN
AND a.hasWeightVolumetric
LIMIT 1;
- DROP TEMPORARY TABLE tmp.buysToCheck;
+ DROP TEMPORARY TABLE tmp.buysToCheck;
- IF hasVolumetricAgency THEN
- CALL util.throw('Item lacks size/weight in purchase line at agency');
- END IF;
+ IF vHasVolumetricAgency THEN
+ CALL util.throw(CONCAT('Missing size/weight in buy line at agency, item: ', vItemFk));
+ END IF;
END$$
-DELIMITER ;
\ No newline at end of file
+DELIMITER ;
diff --git a/db/routines/vn/procedures/buy_clone.sql b/db/routines/vn/procedures/buy_clone.sql
index 7b77204c9..888531746 100644
--- a/db/routines/vn/procedures/buy_clone.sql
+++ b/db/routines/vn/procedures/buy_clone.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_clone`(vEntryFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buy_clone`(vEntryFk INT)
BEGIN
/**
* Clone buys to an entry
diff --git a/db/routines/vn/procedures/buy_getSplit.sql b/db/routines/vn/procedures/buy_getSplit.sql
index 73cc1dda7..087a4de4d 100644
--- a/db/routines/vn/procedures/buy_getSplit.sql
+++ b/db/routines/vn/procedures/buy_getSplit.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_getSplit`(vSelf INT, vDated DATE)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buy_getSplit`(vSelf INT, vDated DATE)
BEGIN
/**
* Devuelve tantos registros como etiquetas se necesitan para cada uno de los cubos o cajas de
diff --git a/db/routines/vn/procedures/buy_getUltimate.sql b/db/routines/vn/procedures/buy_getUltimate.sql
index 023e81774..1532222ad 100644
--- a/db/routines/vn/procedures/buy_getUltimate.sql
+++ b/db/routines/vn/procedures/buy_getUltimate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_getUltimate`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buy_getUltimate`(
vItemFk INT,
vWarehouseFk SMALLINT,
vDated DATE
diff --git a/db/routines/vn/procedures/buy_getUltimateFromInterval.sql b/db/routines/vn/procedures/buy_getUltimateFromInterval.sql
index 2115beb95..24a843eb0 100644
--- a/db/routines/vn/procedures/buy_getUltimateFromInterval.sql
+++ b/db/routines/vn/procedures/buy_getUltimateFromInterval.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_getUltimateFromInterval`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buy_getUltimateFromInterval`(
vItemFk INT,
vWarehouseFk SMALLINT,
vStarted DATE,
diff --git a/db/routines/vn/procedures/buy_getVolume.sql b/db/routines/vn/procedures/buy_getVolume.sql
index 633be7ec0..227bfac3c 100644
--- a/db/routines/vn/procedures/buy_getVolume.sql
+++ b/db/routines/vn/procedures/buy_getVolume.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_getVolume`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buy_getVolume`()
BEGIN
/**
* Cálculo de volumen en líneas de compra
diff --git a/db/routines/vn/procedures/buy_getVolumeByAgency.sql b/db/routines/vn/procedures/buy_getVolumeByAgency.sql
index 2f63c2bdf..7393d12d8 100644
--- a/db/routines/vn/procedures/buy_getVolumeByAgency.sql
+++ b/db/routines/vn/procedures/buy_getVolumeByAgency.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_getVolumeByAgency`(vDated DATE, vAgencyFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buy_getVolumeByAgency`(vDated DATE, vAgencyFk INT)
BEGIN
DROP TEMPORARY TABLE IF EXISTS tmp.buy;
diff --git a/db/routines/vn/procedures/buy_getVolumeByEntry.sql b/db/routines/vn/procedures/buy_getVolumeByEntry.sql
index e9a2bca2e..436a49654 100644
--- a/db/routines/vn/procedures/buy_getVolumeByEntry.sql
+++ b/db/routines/vn/procedures/buy_getVolumeByEntry.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_getVolumeByEntry`(vEntryFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buy_getVolumeByEntry`(vEntryFk INT)
BEGIN
DROP TEMPORARY TABLE IF EXISTS tmp.buy;
diff --git a/db/routines/vn/procedures/buy_recalcPrices.sql b/db/routines/vn/procedures/buy_recalcPrices.sql
index 35eb00cf1..dea272379 100644
--- a/db/routines/vn/procedures/buy_recalcPrices.sql
+++ b/db/routines/vn/procedures/buy_recalcPrices.sql
@@ -1,52 +1,59 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_recalcPrices`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buy_recalcPrices`()
BEGIN
/**
- * Recalcula los precios para las compras insertadas en tmp.buyRecalc
+ * Recalcula los precios para las compras insertadas en tmp.buyRecalc.
*
* @param tmp.buyRecalc (id)
*/
DECLARE vLanded DATE;
DECLARE vWarehouseFk INT;
- DECLARE vHasNotPrice BOOL;
- DECLARE vBuyingValue DECIMAL(10,4);
- DECLARE vPackagingFk VARCHAR(10);
DECLARE vIsWarehouseFloramondo BOOL;
+ DECLARE vDone BOOL;
+ DECLARE vTravels CURSOR FOR
+ SELECT t.landed, t.warehouseInFk, (w.code = 'flm')
+ FROM tmp.buyRecalc br
+ JOIN buy b ON b.id = br.id
+ JOIN entry e ON e.id = b.entryFk
+ JOIN travel t ON t.id = e.travelFk
+ JOIN warehouse w ON w.id = t.warehouseInFk
+ GROUP BY t.landed, t.warehouseInFk;
- SELECT t.landed, t.warehouseInFk, (w.`name` = 'Floramondo')
- INTO vLanded, vWarehouseFk, vIsWarehouseFloramondo
- FROM tmp.buyRecalc br
- JOIN buy b ON b.id = br.id
- JOIN entry e ON e.id = b.entryFk
- JOIN travel t ON t.id = e.travelFk
- JOIN warehouse w ON w.id = t.warehouseInFk
- LIMIT 1;
+ DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
- CALL rate_getPrices(vLanded, vWarehouseFk);
+ OPEN vTravels;
+ l: LOOP
+ SET vDone = FALSE;
+ FETCH vTravels INTO vLanded, vWarehouseFk, vIsWarehouseFloramondo;
- UPDATE buy b
- JOIN tmp.buyRecalc br ON br.id = b.id AND (@buyId := b.id)
- LEFT JOIN packaging p ON p.id = b.packagingFk
- JOIN item i ON i.id = b.itemFk
- JOIN entry e ON e.id = b.entryFk
- JOIN itemType it ON it.id = i.typeFk
- JOIN travel tr ON tr.id = e.travelFk
- JOIN agencyMode am ON am.id = tr.agencyModeFk
- JOIN tmp.rate r
- JOIN volumeConfig vc
- SET b.freightValue = @PF:= IFNULL(((am.m3 * @m3:= item_getVolume(b.itemFk, b.packagingFk) / 1000000)
- / b.packing) * IF(am.hasWeightVolumetric, GREATEST(b.weight / @m3 / vc.aerealVolumetricDensity, 1), 1), 0),
- b.comissionValue = @CF:= ROUND(IFNULL(e.commission * b.buyingValue / 100, 0), 3),
- b.packageValue = @EF:= IF(vIsWarehouseFloramondo, 0, IFNULL(ROUND(IF(p.isPackageReturnable, p.returnCost / b.packing , p.`value` / b.packing), 3),0)),
- b.price3 = @t3:= IF(r.rate3 = 0, b.buyingValue,ROUND((b.buyingValue + @CF + @EF + @PF) / ((100 - r.rate3 - it.promo ) /100) ,2)), -- He añadido que el coste sea igual a tarifa3 si t3 = 0
- b.price2 = @t2:= round(@t3 * (1 + ((r.rate2 - r.rate3)/100)),2),
- b.price2 = @t2:= IF(@t2 <= @t3,@t3 , @t2);
+ IF vDone THEN
+ LEAVE l;
+ END IF;
- SELECT (b.buyingValue = b.price2), b.buyingValue, b.packagingFk
- INTO vHasNotPrice, vBuyingValue, vPackagingFk
- FROM vn.buy b
- WHERE b.id = @buyId AND b.buyingValue <> 0.01;
+ CALL rate_getPrices(vLanded, vWarehouseFk);
- DROP TEMPORARY TABLE tmp.rate;
+ UPDATE buy b
+ JOIN tmp.buyRecalc br ON br.id = b.id AND (@buyId := b.id)
+ LEFT JOIN packaging p ON p.id = b.packagingFk
+ JOIN item i ON i.id = b.itemFk
+ JOIN entry e ON e.id = b.entryFk
+ JOIN itemType it ON it.id = i.typeFk
+ JOIN travel tr ON tr.id = e.travelFk
+ JOIN agencyMode am ON am.id = tr.agencyModeFk
+ JOIN tmp.rate r
+ JOIN volumeConfig vc
+ SET b.freightValue = @PF:= IFNULL(((am.m3 * @m3:= item_getVolume(b.itemFk, b.packagingFk) / 1000000)
+ / b.packing) * IF(am.hasWeightVolumetric, GREATEST(b.weight / @m3 / vc.aerealVolumetricDensity, 1), 1), 0),
+ b.comissionValue = @CF:= ROUND(IFNULL(e.commission * b.buyingValue / 100, 0), 3),
+ b.packageValue = @EF:= IF(vIsWarehouseFloramondo, 0, IFNULL(ROUND(IF(p.isPackageReturnable, p.returnCost / b.packing , p.`value` / b.packing), 3),0)),
+ b.price3 = @t3:= IF(r.rate3 = 0, b.buyingValue,ROUND((b.buyingValue + @CF + @EF + @PF) / ((100 - r.rate3 - it.promo ) /100) ,2)), -- He añadido que el coste sea igual a tarifa3 si t3 = 0
+ b.price2 = @t2:= round(@t3 * (1 + ((r.rate2 - r.rate3)/100)),2),
+ b.price2 = @t2:= IF(@t2 <= @t3,@t3 , @t2)
+ WHERE tr.landed = vLanded
+ AND tr.warehouseInFk = vWarehouseFk;
+
+ DROP TEMPORARY TABLE tmp.rate;
+ END LOOP;
+ CLOSE vTravels;
END$$
DELIMITER ;
diff --git a/db/routines/vn/procedures/buy_recalcPricesByAwb.sql b/db/routines/vn/procedures/buy_recalcPricesByAwb.sql
index 6f6baf305..fafc4763e 100644
--- a/db/routines/vn/procedures/buy_recalcPricesByAwb.sql
+++ b/db/routines/vn/procedures/buy_recalcPricesByAwb.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_recalcPricesByAwb`(IN awbFk varchar(18))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buy_recalcPricesByAwb`(IN awbFk varchar(18))
BEGIN
/**
* inserta en tmp.buyRecalc las compras de un awb
diff --git a/db/routines/vn/procedures/buy_recalcPricesByBuy.sql b/db/routines/vn/procedures/buy_recalcPricesByBuy.sql
index b699e42d7..0801a9bea 100644
--- a/db/routines/vn/procedures/buy_recalcPricesByBuy.sql
+++ b/db/routines/vn/procedures/buy_recalcPricesByBuy.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_recalcPricesByBuy`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buy_recalcPricesByBuy`(
vBuyFk INT(11)
)
BEGIN
diff --git a/db/routines/vn/procedures/buy_recalcPricesByEntry.sql b/db/routines/vn/procedures/buy_recalcPricesByEntry.sql
index 8d70d3626..e13548680 100644
--- a/db/routines/vn/procedures/buy_recalcPricesByEntry.sql
+++ b/db/routines/vn/procedures/buy_recalcPricesByEntry.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_recalcPricesByEntry`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buy_recalcPricesByEntry`(
vEntryFk INT(11)
)
BEGIN
diff --git a/db/routines/vn/procedures/buy_scan.sql b/db/routines/vn/procedures/buy_scan.sql
index 0d4e8fcdb..e0c7c52de 100644
--- a/db/routines/vn/procedures/buy_scan.sql
+++ b/db/routines/vn/procedures/buy_scan.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_scan`(vBarcode VARCHAR(512))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buy_scan`(vBarcode VARCHAR(512))
BEGIN
/**
* Busca compras a partir de un código de barras de subasta, las marca como
diff --git a/db/routines/vn/procedures/buy_updateGrouping.sql b/db/routines/vn/procedures/buy_updateGrouping.sql
index e589fbd2a..b1b30dd2b 100644
--- a/db/routines/vn/procedures/buy_updateGrouping.sql
+++ b/db/routines/vn/procedures/buy_updateGrouping.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_updateGrouping`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buy_updateGrouping`(
vWarehouseFk INT,
vItemFk INT,
vGrouping INT
diff --git a/db/routines/vn/procedures/buy_updatePacking.sql b/db/routines/vn/procedures/buy_updatePacking.sql
index 0ee9d4c80..ad25352f2 100644
--- a/db/routines/vn/procedures/buy_updatePacking.sql
+++ b/db/routines/vn/procedures/buy_updatePacking.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_updatePacking`(vWarehouseFk INT, vItemFk INT, vPacking INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buy_updatePacking`(vWarehouseFk INT, vItemFk INT, vPacking INT)
BEGIN
/**
* Actualiza packing
diff --git a/db/routines/vn/procedures/catalog_calcFromItem.sql b/db/routines/vn/procedures/catalog_calcFromItem.sql
index 497fd107c..528cf0403 100644
--- a/db/routines/vn/procedures/catalog_calcFromItem.sql
+++ b/db/routines/vn/procedures/catalog_calcFromItem.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`catalog_calcFromItem`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`catalog_calcFromItem`(
vLanded DATE,
vAddressFk INT,
vAgencyModeFk INT,
diff --git a/db/routines/vn/procedures/catalog_calculate.sql b/db/routines/vn/procedures/catalog_calculate.sql
index 2a0157881..39bf2b441 100644
--- a/db/routines/vn/procedures/catalog_calculate.sql
+++ b/db/routines/vn/procedures/catalog_calculate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`catalog_calculate`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`catalog_calculate`(
vLanded DATE,
vAddressFk INT,
vAgencyModeFk INT,
@@ -126,7 +126,10 @@ BEGIN
AND a.available > 0
AND (sub.itemAllowed OR NOT it.isFloramondo OR anr.available > 0)
AND (ag.isAnyVolumeAllowed OR NOT itt.isUnconventionalSize)
- AND (itc.isReclining OR it.`size` IS NULL OR it.`size` < z.itemMaxSize OR z.itemMaxSize IS NULL)
+ AND (it.`size` IS NULL
+ OR IF(itc.isReclining,
+ it.size <= z.itemMaxLength OR z.itemMaxLength IS NULL,
+ it.size <= z.itemMaxSize OR z.itemMaxSize IS NULL))
AND cit.id IS NULL
AND zit.id IS NULL
AND ait.id IS NULL;
diff --git a/db/routines/vn/procedures/catalog_componentCalculate.sql b/db/routines/vn/procedures/catalog_componentCalculate.sql
index 92fe233c5..e29e13a8c 100644
--- a/db/routines/vn/procedures/catalog_componentCalculate.sql
+++ b/db/routines/vn/procedures/catalog_componentCalculate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`catalog_componentCalculate`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`catalog_componentCalculate`(
vZoneFk INT,
vAddressFk INT,
vShipped DATE,
@@ -7,7 +7,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`catalog_componentCa
)
BEGIN
/**
- * Calcula los componentes de los articulos de tmp.ticketLot
+ * Calcula los componentes de los articulos de la tabla tmp.ticketLot
*
* @param vZoneFk para calcular el transporte
* @param vAddressFk Consignatario
@@ -25,18 +25,41 @@ BEGIN
FROM address
WHERE id = vAddressFk;
- CREATE OR REPLACE TEMPORARY TABLE tSpecialPrice
+ CREATE OR REPLACE TEMPORARY TABLE tPriceDelta
(INDEX (itemFk))
- ENGINE = MEMORY
- SELECT * FROM (
+ ENGINE = MEMORY
+ SELECT i.id itemFk,
+ SUM(IFNULL(pd.absIncreasing,0)) absIncreasing,
+ SUM(IFNULL(pd.ratIncreasing,0)) ratIncreasing,
+ pd.warehouseFk
+ FROM item i
+ JOIN priceDelta pd
+ ON pd.itemTypeFk = i.typeFk
+ AND (pd.minSize IS NULL OR pd.minSize <= i.`size`)
+ AND (pd.maxSize IS NULL OR pd.maxSize >= i.`size`)
+ AND (pd.inkFk IS NULL OR pd.inkFk = i.inkFk)
+ AND (pd.originFk IS NULL OR pd.originFk = i.originFk)
+ AND (pd.producerFk IS NULL OR pd.producerFk = i.producerFk)
+ AND (pd.warehouseFk IS NULL OR pd.warehouseFk = vWarehouseFk)
+ LEFT JOIN zoneGeo zg ON zg.id = pd.zoneGeoFk
+ LEFT JOIN zoneGeo zg2 ON zg2.id = address_getGeo(vAddressFk)
+ WHERE (pd.fromDated IS NULL OR pd.fromDated <= vShipped)
+ AND (pd.toDated IS NULL OR pd.toDated >= vShipped)
+ AND (pd.zoneGeoFk IS NULL OR zg2.lft BETWEEN zg.lft AND zg.rgt)
+ GROUP BY itemFk;
+
+ CREATE OR REPLACE TEMPORARY TABLE tSpecialPrice
+ (INDEX (itemFk))
+ ENGINE = MEMORY
+ SELECT * FROM (
SELECT *
- FROM specialPrice
- WHERE (clientFk = vClientFk OR clientFk IS NULL)
- AND started <= vShipped
- AND (ended >= vShipped OR ended IS NULL)
- ORDER BY (clientFk = vClientFk) DESC, id DESC
- LIMIT 10000000000000000000) t
- GROUP BY itemFk;
+ FROM specialPrice
+ WHERE (clientFk = vClientFk OR clientFk IS NULL)
+ AND started <= vShipped
+ AND (ended >= vShipped OR ended IS NULL)
+ ORDER BY (clientFk = vClientFk) DESC, id DESC
+ LIMIT 10000000000000000000) t
+ GROUP BY itemFk;
CREATE OR REPLACE TEMPORARY TABLE tmp.ticketComponentCalculate
(PRIMARY KEY (itemFk, warehouseFk))
@@ -108,6 +131,19 @@ BEGIN
JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tc.itemFk AND tcc.warehouseFk = tc.warehouseFk
GROUP BY tc.itemFk, warehouseFk;
+ -- Bonus del comprador a un rango de productos
+ INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost)
+ SELECT
+ tcb.warehouseFk,
+ tcb.itemFk,
+ c.id,
+ IFNULL(tcb.base * tpd.ratIncreasing / 100,0) + IFNULL(tpd.absIncreasing,0)
+ FROM tmp.ticketComponentBase tcb
+ JOIN component c ON c.code = 'bonus'
+ JOIN tPriceDelta tpd
+ ON tpd.itemFk = tcb.itemFk
+ AND tpd.warehouseFk = tcb.warehouseFk;
+
-- RECOBRO
INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost)
SELECT tcb.warehouseFk, tcb.itemFk, c2.id,
@@ -303,6 +339,7 @@ BEGIN
tmp.ticketComponentBase,
tmp.ticketComponentRate,
tmp.ticketComponentCopy,
- tSpecialPrice;
+ tPriceDelta,
+ tSpecialPrice;
END$$
DELIMITER ;
diff --git a/db/routines/vn/procedures/catalog_componentPrepare.sql b/db/routines/vn/procedures/catalog_componentPrepare.sql
index 2e58a28e2..b16baf1c2 100644
--- a/db/routines/vn/procedures/catalog_componentPrepare.sql
+++ b/db/routines/vn/procedures/catalog_componentPrepare.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`catalog_componentPrepare`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`catalog_componentPrepare`()
BEGIN
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponent;
diff --git a/db/routines/vn/procedures/catalog_componentPurge.sql b/db/routines/vn/procedures/catalog_componentPurge.sql
index c6a19ba62..448396a16 100644
--- a/db/routines/vn/procedures/catalog_componentPurge.sql
+++ b/db/routines/vn/procedures/catalog_componentPurge.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`catalog_componentPurge`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`catalog_componentPurge`()
BEGIN
DROP TEMPORARY TABLE
tmp.ticketComponentPrice,
diff --git a/db/routines/vn/procedures/claimRatio_add.sql b/db/routines/vn/procedures/claimRatio_add.sql
index c375f8736..8c3213644 100644
--- a/db/routines/vn/procedures/claimRatio_add.sql
+++ b/db/routines/vn/procedures/claimRatio_add.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`claimRatio_add`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`claimRatio_add`()
BEGIN
/*
* Añade a la tabla greuges todos los cargos necesario y
diff --git a/db/routines/vn/procedures/clean.sql b/db/routines/vn/procedures/clean.sql
index 9a90b4e85..4a1f526fc 100644
--- a/db/routines/vn/procedures/clean.sql
+++ b/db/routines/vn/procedures/clean.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`clean`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`clean`()
BEGIN
/**
* Purges outdated data to optimize performance.
@@ -59,7 +59,7 @@ BEGIN
DELETE b FROM buy b
JOIN entryConfig e ON e.defaultEntry = b.entryFk
WHERE b.created < v2Months;
- DELETE FROM stockBuyed WHERE creationDate < v2Months;
+ DELETE FROM stockBought WHERE dated < v2Months;
DELETE FROM printQueue WHERE statusCode = 'printed' AND created < v2Months;
-- Equipos duplicados
DELETE w.*
diff --git a/db/routines/vn/procedures/clean_logiflora.sql b/db/routines/vn/procedures/clean_logiflora.sql
index dd08410fd..fd645a158 100644
--- a/db/routines/vn/procedures/clean_logiflora.sql
+++ b/db/routines/vn/procedures/clean_logiflora.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`clean_logiflora`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`clean_logiflora`()
BEGIN
/**
* Elimina las compras y los artículos residuales de logiflora.
diff --git a/db/routines/vn/procedures/clearShelvingList.sql b/db/routines/vn/procedures/clearShelvingList.sql
deleted file mode 100644
index dbaca2747..000000000
--- a/db/routines/vn/procedures/clearShelvingList.sql
+++ /dev/null
@@ -1,8 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`clearShelvingList`(vShelvingFk VARCHAR(8))
-BEGIN
- UPDATE vn.itemShelving
- SET visible = 0
- WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk COLLATE utf8_unicode_ci;
-END$$
-DELIMITER ;
diff --git a/db/routines/vn/procedures/clientDebtSpray.sql b/db/routines/vn/procedures/clientDebtSpray.sql
index 687c08fe2..5248432fe 100644
--- a/db/routines/vn/procedures/clientDebtSpray.sql
+++ b/db/routines/vn/procedures/clientDebtSpray.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`clientDebtSpray`(vClientFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`clientDebtSpray`(vClientFk INT)
BEGIN
/* Reparte el saldo de un cliente en greuge en la cartera que corresponde, y desasigna el comercial
diff --git a/db/routines/vn/procedures/clientFreeze.sql b/db/routines/vn/procedures/clientFreeze.sql
index c89db2316..727311174 100644
--- a/db/routines/vn/procedures/clientFreeze.sql
+++ b/db/routines/vn/procedures/clientFreeze.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`clientFreeze`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`clientFreeze`()
BEGIN
/**
* Congela diariamente aquellos clientes que son morosos sin recobro,
diff --git a/db/routines/vn/procedures/clientGetDebtDiary.sql b/db/routines/vn/procedures/clientGetDebtDiary.sql
index bd7a0b292..c4a52ab74 100644
--- a/db/routines/vn/procedures/clientGetDebtDiary.sql
+++ b/db/routines/vn/procedures/clientGetDebtDiary.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`clientGetDebtDiary`(vClientFK INT, vCompanyFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`clientGetDebtDiary`(vClientFK INT, vCompanyFk INT)
BEGIN
/**
* Devuelve el registro de deuda
diff --git a/db/routines/vn/procedures/clientGreugeSpray.sql b/db/routines/vn/procedures/clientGreugeSpray.sql
index c337e2dd3..2007d13a5 100644
--- a/db/routines/vn/procedures/clientGreugeSpray.sql
+++ b/db/routines/vn/procedures/clientGreugeSpray.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`clientGreugeSpray`(IN vClientFk INT, IN onlyForHisOwner BOOL, IN vWorkerCode VARCHAR(3), IN vWithMana BOOLEAN)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`clientGreugeSpray`(IN vClientFk INT, IN onlyForHisOwner BOOL, IN vWorkerCode VARCHAR(3), IN vWithMana BOOLEAN)
BEGIN
DECLARE vGreuge DECIMAL(10,2);
diff --git a/db/routines/vn/procedures/clientPackagingOverstock.sql b/db/routines/vn/procedures/clientPackagingOverstock.sql
index fcd34c41b..901236bf8 100644
--- a/db/routines/vn/procedures/clientPackagingOverstock.sql
+++ b/db/routines/vn/procedures/clientPackagingOverstock.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`clientPackagingOverstock`(vClientFk INT, vGraceDays INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`clientPackagingOverstock`(vClientFk INT, vGraceDays INT)
BEGIN
DROP TEMPORARY TABLE IF EXISTS tmp.clientPackagingOverstock;
CREATE TEMPORARY TABLE tmp.clientPackagingOverstock
diff --git a/db/routines/vn/procedures/clientPackagingOverstockReturn.sql b/db/routines/vn/procedures/clientPackagingOverstockReturn.sql
index ac37bbc8d..a05e11d1b 100644
--- a/db/routines/vn/procedures/clientPackagingOverstockReturn.sql
+++ b/db/routines/vn/procedures/clientPackagingOverstockReturn.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`clientPackagingOverstockReturn`(vClientFk INT, vGraceDays INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`clientPackagingOverstockReturn`(vClientFk INT, vGraceDays INT)
BEGIN
DECLARE vNewTicket INT DEFAULT 0;
DECLARE vWarehouseFk INT;
diff --git a/db/routines/vn/procedures/clientRemoveWorker.sql b/db/routines/vn/procedures/clientRemoveWorker.sql
index 15d247c67..e2a6b8013 100644
--- a/db/routines/vn/procedures/clientRemoveWorker.sql
+++ b/db/routines/vn/procedures/clientRemoveWorker.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`clientRemoveWorker`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`clientRemoveWorker`()
BEGIN
DECLARE vDone BOOL DEFAULT FALSE;
DECLARE vClientFk INT;
diff --git a/db/routines/vn/procedures/clientRisk_update.sql b/db/routines/vn/procedures/clientRisk_update.sql
index 30ab3265f..2a7644b30 100644
--- a/db/routines/vn/procedures/clientRisk_update.sql
+++ b/db/routines/vn/procedures/clientRisk_update.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`clientRisk_update`(vClientId INT, vCompanyId INT, vAmount DECIMAL(10,2))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`clientRisk_update`(vClientId INT, vCompanyId INT, vAmount DECIMAL(10,2))
BEGIN
IF vAmount IS NOT NULL
THEN
diff --git a/db/routines/vn/procedures/client_RandomList.sql b/db/routines/vn/procedures/client_RandomList.sql
index 2bd0d609b..92b460522 100644
--- a/db/routines/vn/procedures/client_RandomList.sql
+++ b/db/routines/vn/procedures/client_RandomList.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`client_RandomList`(vNumber INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`client_RandomList`(vNumber INT)
BEGIN
DECLARE i INT DEFAULT 0;
diff --git a/db/routines/vn/procedures/client_checkBalance.sql b/db/routines/vn/procedures/client_checkBalance.sql
index 210fcc00f..c5ea717a2 100644
--- a/db/routines/vn/procedures/client_checkBalance.sql
+++ b/db/routines/vn/procedures/client_checkBalance.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`client_checkBalance`(IN vDateTo DATETIME, IN vIsConciliated BOOL)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`client_checkBalance`(IN vDateTo DATETIME, IN vIsConciliated BOOL)
BEGIN
/**
* Compara los datos de nuestros clientes con
diff --git a/db/routines/vn/procedures/client_create.sql b/db/routines/vn/procedures/client_create.sql
index f2321e129..3df3df905 100644
--- a/db/routines/vn/procedures/client_create.sql
+++ b/db/routines/vn/procedures/client_create.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`client_create`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`client_create`(
vFirstname VARCHAR(50),
vSurnames VARCHAR(50),
vFi VARCHAR(9),
diff --git a/db/routines/vn/procedures/client_getDebt.sql b/db/routines/vn/procedures/client_getDebt.sql
index 3eaace4e9..e5726f2c1 100644
--- a/db/routines/vn/procedures/client_getDebt.sql
+++ b/db/routines/vn/procedures/client_getDebt.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`client_getDebt`(vDate DATE)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`client_getDebt`(vDate DATE)
BEGIN
/**
* Calculates the risk for active clients
diff --git a/db/routines/vn/procedures/client_getMana.sql b/db/routines/vn/procedures/client_getMana.sql
index f5bb5747d..7b5e01e38 100644
--- a/db/routines/vn/procedures/client_getMana.sql
+++ b/db/routines/vn/procedures/client_getMana.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`client_getMana`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`client_getMana`()
BEGIN
/**
* Devuelve el mana de los clientes de la tabla tmp.client(id)
diff --git a/db/routines/vn/procedures/client_getRisk.sql b/db/routines/vn/procedures/client_getRisk.sql
index 106284c2f..afe34a5e1 100644
--- a/db/routines/vn/procedures/client_getRisk.sql
+++ b/db/routines/vn/procedures/client_getRisk.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`client_getRisk`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`client_getRisk`(
vDate DATE
)
BEGIN
diff --git a/db/routines/vn/procedures/client_unassignSalesPerson.sql b/db/routines/vn/procedures/client_unassignSalesPerson.sql
index 8773104ca..720a94722 100644
--- a/db/routines/vn/procedures/client_unassignSalesPerson.sql
+++ b/db/routines/vn/procedures/client_unassignSalesPerson.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`client_unassignSalesPerson`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`client_unassignSalesPerson`()
BEGIN
/**
* Elimina la asignación de salesPersonFk de la ficha del clientes
diff --git a/db/routines/vn/procedures/client_userDisable.sql b/db/routines/vn/procedures/client_userDisable.sql
index 779ffd688..1a7c9846b 100644
--- a/db/routines/vn/procedures/client_userDisable.sql
+++ b/db/routines/vn/procedures/client_userDisable.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`client_userDisable`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`client_userDisable`()
BEGIN
/**
* Desactiva los clientes inactivos en los últimos X meses.
diff --git a/db/routines/vn/procedures/cmrPallet_add.sql b/db/routines/vn/procedures/cmrPallet_add.sql
index 2267cd312..befd3d09c 100644
--- a/db/routines/vn/procedures/cmrPallet_add.sql
+++ b/db/routines/vn/procedures/cmrPallet_add.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`cmrPallet_add`(vExpeditionPalletFk INT, vCmrFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`cmrPallet_add`(vExpeditionPalletFk INT, vCmrFk INT)
BEGIN
/**
* Añade registro a tabla cmrPallet.
diff --git a/db/routines/vn/procedures/collectionPlacement_get.sql b/db/routines/vn/procedures/collectionPlacement_get.sql
index 3fb3339e7..239dbd3a2 100644
--- a/db/routines/vn/procedures/collectionPlacement_get.sql
+++ b/db/routines/vn/procedures/collectionPlacement_get.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collectionPlacement_get`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`collectionPlacement_get`(
vParamFk INT(11),
vIsPicker bool)
BEGIN
@@ -55,24 +55,20 @@ BEGIN
SELECT ts.saleFk,
ts.itemFk,
CAST(0 AS DECIMAL(10,0)) saleOrder,
- IF(ish.visible > 0 OR iss.id, 1, 100000) *
- IFNULL(p2.pickingOrder, p.pickingOrder) `order`,
- TO_SECONDS(IF(iss.id,
- iss.created - INTERVAL vCurrentYear YEAR,
- ish.created - INTERVAL YEAR(ish.created) YEAR)) priority,
+ (IF(ish.visible > 0 OR iss.id, 1, 100000) *
+ COALESCE(p2.pickingOrder, p.pickingOrder)) `order`,
+ TO_SECONDS(COALESCE(iss.created, ish.created)) - TO_SECONDS(MAKEDATE(IFNULL(YEAR(iss.created), YEAR(ish.created)), 1)) priority,
CONCAT(
- IF(iss.id,
- CONCAT('< ', IFNULL(wk.`code`, '---'),' > '),
- ''),
- p.`code`) COLLATE utf8_general_ci placement,
+ IF(iss.id, CONCAT('< ', COALESCE(wk.`code`, '---'),' > '), ''),
+ p.`code`
+ ) COLLATE utf8_general_ci placement,
sh.priority shelvingPriority,
sh.code COLLATE utf8_general_ci shelving,
ish.created,
ish.visible,
- IFNULL(
- IF(st.code = 'previousByPacking', ish.packing, g.`grouping`),
- 1) `grouping`,
- st.code = 'previousPrepared' isPreviousPrepared,
+ COALESCE(
+ IF(st.code = 'previousByPacking', ish.packing, g.`grouping`),1) `grouping`,
+ (st.code = 'previousPrepared') isPreviousPrepared,
iss.id itemShelvingSaleFk,
ts.ticketFk,
iss.id,
@@ -80,11 +76,12 @@ BEGIN
iss.userFk,
ts.quantity
FROM tSale ts
- LEFT JOIN (SELECT DISTINCT saleFk
- FROM saleTracking st
- JOIN state s ON s.id = st.stateFk
- WHERE st.isChecked
- AND s.semaphore = 1) st ON st.saleFk = ts.saleFk
+ LEFT JOIN (SELECT st.saleFk
+ FROM saleTracking st
+ JOIN state s ON s.id = st.stateFk
+ WHERE st.isChecked
+ AND s.semaphore = 1
+ GROUP BY st.saleFk) st ON st.saleFk = ts.saleFk
JOIN itemShelving ish ON ish.itemFk = ts.itemFk
JOIN shelving sh ON sh.code = ish.shelvingFk
JOIN parking p ON p.id = sh.parkingFk
@@ -93,14 +90,14 @@ BEGIN
JOIN warehouse w ON w.id = sc.warehouseFk
LEFT JOIN tGrouping g ON g.itemFk = ts.itemFk
LEFT JOIN itemShelvingSale iss ON iss.saleFk = ts.saleFk
- AND iss.itemShelvingFk = ish.id
+ AND iss.itemShelvingFk = ish.id
LEFT JOIN worker wk ON wk.id = iss.userFk
LEFT JOIN saleGroupDetail sgd ON sgd.saleFk = ts.saleFk
LEFT JOIN saleGroup sg ON sg.id = sgd.saleGroupFk
LEFT JOIN parking p2 ON p2.id = sg.parkingFk
WHERE w.id = vWarehouseFk
- AND NOT sc.isHideForPickers
- HAVING (iss.id AND st.saleFk) OR salePreviousPrepared IS NULL;
+ AND NOT sc.isHideForPickers
+ AND ((iss.id AND st.saleFk) OR st.saleFk IS NULL);
CREATE OR REPLACE TEMPORARY TABLE tSalePlacementList2
(INDEX(saleFk), INDEX(olderPriority))
diff --git a/db/routines/vn/procedures/collection_addItem.sql b/db/routines/vn/procedures/collection_addItem.sql
index b5bc91c67..7cd374181 100644
--- a/db/routines/vn/procedures/collection_addItem.sql
+++ b/db/routines/vn/procedures/collection_addItem.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_addItem`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`collection_addItem`(
vBarccodeFk INT,
vQuantity INT,
vTicketFk INT
diff --git a/db/routines/vn/procedures/collection_addWithReservation.sql b/db/routines/vn/procedures/collection_addWithReservation.sql
index 18a3e8ab2..cc0b7fd9b 100644
--- a/db/routines/vn/procedures/collection_addWithReservation.sql
+++ b/db/routines/vn/procedures/collection_addWithReservation.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_addWithReservation`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`collection_addWithReservation`(
vItemFk INT,
vQuantity INT,
vTicketFk INT,
diff --git a/db/routines/vn/procedures/collection_assign.sql b/db/routines/vn/procedures/collection_assign.sql
index 8e48718b5..ba83f1fbb 100644
--- a/db/routines/vn/procedures/collection_assign.sql
+++ b/db/routines/vn/procedures/collection_assign.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_assign`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`collection_assign`(
vUserFk INT,
OUT vCollectionFk INT
)
diff --git a/db/routines/vn/procedures/collection_get.sql b/db/routines/vn/procedures/collection_get.sql
index d29f14ca9..7da3d364e 100644
--- a/db/routines/vn/procedures/collection_get.sql
+++ b/db/routines/vn/procedures/collection_get.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_get`(vWorkerFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`collection_get`(vWorkerFk INT)
BEGIN
/**
* Obtiene colección del sacador si tiene líneas pendientes.
diff --git a/db/routines/vn/procedures/collection_getAssigned.sql b/db/routines/vn/procedures/collection_getAssigned.sql
index 947b53229..518e2dd7b 100644
--- a/db/routines/vn/procedures/collection_getAssigned.sql
+++ b/db/routines/vn/procedures/collection_getAssigned.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_getAssigned`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`collection_getAssigned`(
vUserFk INT,
OUT vCollectionFk INT
)
diff --git a/db/routines/vn/procedures/collection_getTickets.sql b/db/routines/vn/procedures/collection_getTickets.sql
index 7ecff571a..4566792fa 100644
--- a/db/routines/vn/procedures/collection_getTickets.sql
+++ b/db/routines/vn/procedures/collection_getTickets.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_getTickets`(vParamFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`collection_getTickets`(vParamFk INT)
BEGIN
/**
* Selecciona los tickets de una colección/ticket/sectorCollection
@@ -23,7 +23,7 @@ BEGIN
JOIN vn.ticketCollection tc ON tc.ticketFk = tob.ticketFk
LEFT JOIN vn.observationType ot ON ot.id = tob.observationTypeFk
WHERE ot.`code` = 'itemPicker'
- AND tc.collectionFk = vParamFk
+ AND tc.collectionFk = vParamFk OR tc.ticketFk = vParamFk
)
SELECT t.id ticketFk,
IF(!(vItemPackingTypeFk <=> 'V'), cc.code, CONCAT(SUBSTRING('ABCDEFGH', tc.wagon, 1), '-', tc.`level`)) `level`,
diff --git a/db/routines/vn/procedures/collection_kill.sql b/db/routines/vn/procedures/collection_kill.sql
index f80fea512..298e4a7d1 100644
--- a/db/routines/vn/procedures/collection_kill.sql
+++ b/db/routines/vn/procedures/collection_kill.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_kill`(vSelf INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`collection_kill`(vSelf INT)
BEGIN
/**
* Elimina una coleccion y coloca sus tickets en OK
diff --git a/db/routines/vn/procedures/collection_make.sql b/db/routines/vn/procedures/collection_make.sql
index b5b728000..5deb54f74 100644
--- a/db/routines/vn/procedures/collection_make.sql
+++ b/db/routines/vn/procedures/collection_make.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_make`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`collection_make`()
proc:BEGIN
/**
* Genera colecciones de tickets sin asignar trabajador a partir de la tabla
diff --git a/db/routines/vn/procedures/collection_mergeSales.sql b/db/routines/vn/procedures/collection_mergeSales.sql
index 26444d6f9..297bdb97e 100644
--- a/db/routines/vn/procedures/collection_mergeSales.sql
+++ b/db/routines/vn/procedures/collection_mergeSales.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_mergeSales`(vCollectionFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`collection_mergeSales`(vCollectionFk INT)
BEGIN
DECLARE vDone BOOL;
DECLARE vTicketFk INT;
diff --git a/db/routines/vn/procedures/collection_new.sql b/db/routines/vn/procedures/collection_new.sql
index 18b51c4d3..480a88f35 100644
--- a/db/routines/vn/procedures/collection_new.sql
+++ b/db/routines/vn/procedures/collection_new.sql
@@ -1,6 +1,6 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_new`(
- vUserFk INT,
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`collection_new`(
+ vUserFk INT,
OUT vCollectionFk INT
)
BEGIN
@@ -128,8 +128,9 @@ BEGIN
SELECT TRUE
FROM tmp.productionBuffer pb
JOIN state s ON s.id = pb.state
- WHERE s.code = 'PICKER_DESIGNED'
- AND pb.workerCode = vWorkerCode
+ WHERE (s.code = 'PICKER_DESIGNED'
+ AND pb.workerCode = vWorkerCode)
+ OR s.code = 'LAST_CALL'
) INTO vHasAssignedTickets;
-- Se dejan en la tabla tmp.productionBuffer sólo aquellos tickets adecuados
@@ -138,8 +139,9 @@ BEGIN
DELETE pb
FROM tmp.productionBuffer pb
JOIN state s ON s.id = pb.state
- WHERE s.code <> 'PICKER_DESIGNED'
- OR pb.workerCode <> vWorkerCode;
+ WHERE (s.code <> 'PICKER_DESIGNED'
+ OR pb.workerCode <> vWorkerCode)
+ AND s.code <> 'LAST_CALL';
ELSE
DELETE pb
FROM tmp.productionBuffer pb
@@ -167,31 +169,31 @@ BEGIN
OR LENGTH(pb.problem)
OR pb.lines > vLinesLimit
OR pb.m3 > vVolumeLimit
- OR sub.maxSize > vSizeLimit;
+ OR sub.maxSize > vSizeLimit
+ OR pb.hasPlantTray;
END IF;
-- Hay que excluir aquellos que no tengan la misma hora de preparacion, si procede
+
IF vHasUniqueCollectionTime THEN
-
- SELECT ticketFk INTO vFirstTicketFk
- FROM tmp.productionBuffer
- ORDER BY HH,
- mm,
- productionOrder DESC,
- m3 DESC,
- agency,
- zona,
- routeFk,
- ticketFk
- LIMIT 1;
-
DELETE pb
FROM tmp.productionBuffer pb
JOIN tmp.productionBuffer pb2 ON pb2.ticketFk = vFirstTicketFk
- AND (pb.HH <> pb2.HH OR pb.mm <> pb2.mm);
-
+ AND (pb.HH <> pb2.HH OR pb.mm <> pb2.mm);
END IF;
+ SELECT ticketFk INTO vFirstTicketFk
+ FROM tmp.productionBuffer
+ ORDER BY HH,
+ mm,
+ productionOrder DESC,
+ m3 DESC,
+ agency,
+ zona,
+ routeFk,
+ ticketFk
+ LIMIT 1;
+
OPEN vTickets;
l: LOOP
SET vDone = FALSE;
@@ -245,7 +247,7 @@ BEGIN
SELECT wagon INTO vFreeWagonFk
FROM tTrain
GROUP BY wagon
- HAVING SUM(IFNULL(ticketFk, 0)) = 0
+ HAVING COUNT(ticketFk) = 0
ORDER BY wagon
LIMIT 1;
@@ -262,7 +264,7 @@ BEGIN
JOIN (SELECT wagon
FROM tTrain
GROUP BY wagon
- HAVING SUM(IFNULL(ticketFk, 0)) = 0
+ HAVING COUNT(ticketFk) = 0
) sub ON sub.wagon = tt.wagon;
END IF;
END IF;
@@ -322,4 +324,4 @@ BEGIN
tTrain,
tmp.productionBuffer;
END$$
-DELIMITER ;
+DELIMITER ;
\ No newline at end of file
diff --git a/db/routines/vn/procedures/collection_printSticker.sql b/db/routines/vn/procedures/collection_printSticker.sql
index 50259152d..a18d4d7d9 100644
--- a/db/routines/vn/procedures/collection_printSticker.sql
+++ b/db/routines/vn/procedures/collection_printSticker.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_printSticker`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`collection_printSticker`(
vSelf INT,
vLabelCount INT
)
diff --git a/db/routines/vn/procedures/collection_setParking.sql b/db/routines/vn/procedures/collection_setParking.sql
index 5f6ca75da..68b81ba30 100644
--- a/db/routines/vn/procedures/collection_setParking.sql
+++ b/db/routines/vn/procedures/collection_setParking.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_setParking`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`collection_setParking`(
vSelf INT,
vParkingFk INT
)
diff --git a/db/routines/vn/procedures/collection_setState.sql b/db/routines/vn/procedures/collection_setState.sql
index 2d33c53d6..5f8a7afa2 100644
--- a/db/routines/vn/procedures/collection_setState.sql
+++ b/db/routines/vn/procedures/collection_setState.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_setState`(vSelf INT, vStateCode VARCHAR(255) COLLATE utf8_general_ci)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`collection_setState`(vSelf INT, vStateCode VARCHAR(255) COLLATE utf8_general_ci)
BEGIN
/**
* Modifica el estado de los tickets de una colección.
diff --git a/db/routines/vn/procedures/company_getFiscaldata.sql b/db/routines/vn/procedures/company_getFiscaldata.sql
index b59ae38e1..675e19379 100644
--- a/db/routines/vn/procedures/company_getFiscaldata.sql
+++ b/db/routines/vn/procedures/company_getFiscaldata.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`company_getFiscaldata`(workerFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`company_getFiscaldata`(workerFk INT)
BEGIN
DECLARE vCompanyFk INT;
diff --git a/db/routines/vn/procedures/company_getSuppliersDebt.sql b/db/routines/vn/procedures/company_getSuppliersDebt.sql
index 83043f337..84d931542 100644
--- a/db/routines/vn/procedures/company_getSuppliersDebt.sql
+++ b/db/routines/vn/procedures/company_getSuppliersDebt.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`company_getSuppliersDebt`(vSelf INT, vMonthsAgo INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`company_getSuppliersDebt`(vSelf INT, vMonthsAgo INT)
BEGIN
/**
* Generates a temporary table containing outstanding payments to suppliers.
diff --git a/db/routines/vn/procedures/comparative_add.sql b/db/routines/vn/procedures/comparative_add.sql
index 44f9686aa..5aaa440aa 100644
--- a/db/routines/vn/procedures/comparative_add.sql
+++ b/db/routines/vn/procedures/comparative_add.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`comparative_add`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`comparative_add`()
BEGIN
/**
* Inserts sales records less than one month old in comparative.
diff --git a/db/routines/vn/procedures/confection_controlSource.sql b/db/routines/vn/procedures/confection_controlSource.sql
index f011a52e9..837916038 100644
--- a/db/routines/vn/procedures/confection_controlSource.sql
+++ b/db/routines/vn/procedures/confection_controlSource.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`confection_controlSource`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`confection_controlSource`(
vDated DATE,
vScopeDays INT,
vMaxAlertLevel INT,
diff --git a/db/routines/vn/procedures/conveyorExpedition_Add.sql b/db/routines/vn/procedures/conveyorExpedition_Add.sql
index 94cbc88e2..a63cd4946 100644
--- a/db/routines/vn/procedures/conveyorExpedition_Add.sql
+++ b/db/routines/vn/procedures/conveyorExpedition_Add.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`conveyorExpedition_Add`(vStarted DATETIME, vEnded DATETIME)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`conveyorExpedition_Add`(vStarted DATETIME, vEnded DATETIME)
BEGIN
diff --git a/db/routines/vn/procedures/copyComponentsFromSaleList.sql b/db/routines/vn/procedures/copyComponentsFromSaleList.sql
index 8db8409f1..24d2705d0 100644
--- a/db/routines/vn/procedures/copyComponentsFromSaleList.sql
+++ b/db/routines/vn/procedures/copyComponentsFromSaleList.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`copyComponentsFromSaleList`(vTargetTicketFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`copyComponentsFromSaleList`(vTargetTicketFk INT)
BEGIN
/* Copy sales and components to the target ticket
diff --git a/db/routines/vn/procedures/createPedidoInterno.sql b/db/routines/vn/procedures/createPedidoInterno.sql
index ecc5e57a5..2adf9e9f3 100644
--- a/db/routines/vn/procedures/createPedidoInterno.sql
+++ b/db/routines/vn/procedures/createPedidoInterno.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`createPedidoInterno`(vItemFk INT,vQuantity INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`createPedidoInterno`(vItemFk INT,vQuantity INT)
BEGIN
diff --git a/db/routines/vn/procedures/creditInsurance_getRisk.sql b/db/routines/vn/procedures/creditInsurance_getRisk.sql
index eccc37ca1..5562c91d4 100644
--- a/db/routines/vn/procedures/creditInsurance_getRisk.sql
+++ b/db/routines/vn/procedures/creditInsurance_getRisk.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`creditInsurance_getRisk`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`creditInsurance_getRisk`()
BEGIN
/**
* Devuelve el riesgo de los clientes que estan asegurados
@@ -10,7 +10,7 @@ BEGIN
SELECT * FROM (
SELECT cc.client clientFk, ci.grade
FROM creditClassification cc
- JOIN creditInsurance ci ON cc.id = ci.creditClassification
+ JOIN creditInsurance ci ON cc.id = ci.creditClassificationFk
WHERE dateEnd IS NULL
ORDER BY ci.creationDate DESC
LIMIT 10000000000000000000) t1
diff --git a/db/routines/vn/procedures/creditRecovery.sql b/db/routines/vn/procedures/creditRecovery.sql
index 687d652dd..afdb10dc8 100644
--- a/db/routines/vn/procedures/creditRecovery.sql
+++ b/db/routines/vn/procedures/creditRecovery.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`creditRecovery`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`creditRecovery`()
BEGIN
/**
* Actualiza el crédito de los clientes
diff --git a/db/routines/vn/procedures/crypt.sql b/db/routines/vn/procedures/crypt.sql
index b3517b1ad..54a698f66 100644
--- a/db/routines/vn/procedures/crypt.sql
+++ b/db/routines/vn/procedures/crypt.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`crypt`(vText VARCHAR(255), vKey VARCHAR(255), OUT vResult VARCHAR(255) )
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`crypt`(vText VARCHAR(255), vKey VARCHAR(255), OUT vResult VARCHAR(255) )
BEGIN
DECLARE vEncryptedText VARCHAR(255) DEFAULT '';
diff --git a/db/routines/vn/procedures/cryptOff.sql b/db/routines/vn/procedures/cryptOff.sql
index e0677a0e2..1ad33aa6d 100644
--- a/db/routines/vn/procedures/cryptOff.sql
+++ b/db/routines/vn/procedures/cryptOff.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`cryptOff`(vText VARCHAR(255), vKey VARCHAR(255), OUT vResult VARCHAR(255))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`cryptOff`(vText VARCHAR(255), vKey VARCHAR(255), OUT vResult VARCHAR(255))
BEGIN
DECLARE vUncryptedText VARCHAR(255) DEFAULT '';
diff --git a/db/routines/vn/procedures/department_calcTree.sql b/db/routines/vn/procedures/department_calcTree.sql
index 5a265bd41..4f67cda86 100644
--- a/db/routines/vn/procedures/department_calcTree.sql
+++ b/db/routines/vn/procedures/department_calcTree.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`department_calcTree`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`department_calcTree`()
BEGIN
/**
* Calculates the #path, #lft, #rgt, #sons and #depth columns of
diff --git a/db/routines/vn/procedures/department_calcTreeRec.sql b/db/routines/vn/procedures/department_calcTreeRec.sql
index 77054b17f..bae39f4c5 100644
--- a/db/routines/vn/procedures/department_calcTreeRec.sql
+++ b/db/routines/vn/procedures/department_calcTreeRec.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`department_calcTreeRec`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`department_calcTreeRec`(
vSelf INT,
vPath VARCHAR(255),
vDepth INT,
diff --git a/db/routines/vn/procedures/department_doCalc.sql b/db/routines/vn/procedures/department_doCalc.sql
index 915b9f191..11801a8d1 100644
--- a/db/routines/vn/procedures/department_doCalc.sql
+++ b/db/routines/vn/procedures/department_doCalc.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`department_doCalc`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`department_doCalc`()
proc: BEGIN
/**
* Recalculates the department tree.
diff --git a/db/routines/vn/procedures/department_getHasMistake.sql b/db/routines/vn/procedures/department_getHasMistake.sql
index 394105a16..21a89a21d 100644
--- a/db/routines/vn/procedures/department_getHasMistake.sql
+++ b/db/routines/vn/procedures/department_getHasMistake.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`department_getHasMistake`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`department_getHasMistake`()
BEGIN
/**
diff --git a/db/routines/vn/procedures/department_getLeaves.sql b/db/routines/vn/procedures/department_getLeaves.sql
index 7f1e3cc35..ca8641e35 100644
--- a/db/routines/vn/procedures/department_getLeaves.sql
+++ b/db/routines/vn/procedures/department_getLeaves.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`department_getLeaves`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`department_getLeaves`(
vParentFk INT,
vSearch VARCHAR(255)
)
diff --git a/db/routines/vn/procedures/deviceLog_add.sql b/db/routines/vn/procedures/deviceLog_add.sql
index 8d2310633..5743cd4db 100644
--- a/db/routines/vn/procedures/deviceLog_add.sql
+++ b/db/routines/vn/procedures/deviceLog_add.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`deviceLog_add`(vWorkerFk INT, vAppName VARCHAR(45), vAppVersion VARCHAR(45), vAndroid_id VARCHAR(64))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`deviceLog_add`(vWorkerFk INT, vAppName VARCHAR(45), vAppVersion VARCHAR(45), vAndroid_id VARCHAR(64))
BEGIN
/**
* Inserta registro en tabla devicelog el log del usuario conectado.
diff --git a/db/routines/vn/procedures/deviceProductionUser_exists.sql b/db/routines/vn/procedures/deviceProductionUser_exists.sql
index f5be6e94f..9b2442c4b 100644
--- a/db/routines/vn/procedures/deviceProductionUser_exists.sql
+++ b/db/routines/vn/procedures/deviceProductionUser_exists.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`deviceProductionUser_exists`(vUserFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`deviceProductionUser_exists`(vUserFk INT)
BEGIN
/* SELECT COUNT(*) AS UserExists
diff --git a/db/routines/vn/procedures/deviceProductionUser_getWorker.sql b/db/routines/vn/procedures/deviceProductionUser_getWorker.sql
index b18339108..d603405cf 100644
--- a/db/routines/vn/procedures/deviceProductionUser_getWorker.sql
+++ b/db/routines/vn/procedures/deviceProductionUser_getWorker.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`deviceProductionUser_getWorker`(vAndroid_id VARCHAR(64))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`deviceProductionUser_getWorker`(vAndroid_id VARCHAR(64))
BEGIN
/**
* Selecciona si hay registrado un device con un android_id
diff --git a/db/routines/vn/procedures/deviceProduction_getnameDevice.sql b/db/routines/vn/procedures/deviceProduction_getnameDevice.sql
index c8a5abfaf..748798e82 100644
--- a/db/routines/vn/procedures/deviceProduction_getnameDevice.sql
+++ b/db/routines/vn/procedures/deviceProduction_getnameDevice.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`deviceProduction_getnameDevice`(vAndroid_id VARCHAR(64))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`deviceProduction_getnameDevice`(vAndroid_id VARCHAR(64))
BEGIN
/**
* Selecciona el id del dispositivo que corresponde al vAndroid_id.
diff --git a/db/routines/vn/procedures/device_checkLogin.sql b/db/routines/vn/procedures/device_checkLogin.sql
index db566a068..7094eb84a 100644
--- a/db/routines/vn/procedures/device_checkLogin.sql
+++ b/db/routines/vn/procedures/device_checkLogin.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`device_checkLogin`(vUserFk INT, vAndroidID VARCHAR(50))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`device_checkLogin`(vUserFk INT, vAndroidID VARCHAR(50))
BEGIN
/*
diff --git a/db/routines/vn/procedures/duaEntryValueUpdate.sql b/db/routines/vn/procedures/duaEntryValueUpdate.sql
index f688191de..c3c57dd45 100644
--- a/db/routines/vn/procedures/duaEntryValueUpdate.sql
+++ b/db/routines/vn/procedures/duaEntryValueUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`duaEntryValueUpdate`(vDuaFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`duaEntryValueUpdate`(vDuaFk INT)
BEGIN
UPDATE duaEntry de
diff --git a/db/routines/vn/procedures/duaInvoiceInBooking.sql b/db/routines/vn/procedures/duaInvoiceInBooking.sql
index 4570de332..b4329a8bb 100644
--- a/db/routines/vn/procedures/duaInvoiceInBooking.sql
+++ b/db/routines/vn/procedures/duaInvoiceInBooking.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`duaInvoiceInBooking`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`duaInvoiceInBooking`(
vDuaFk INT
)
BEGIN
diff --git a/db/routines/vn/procedures/duaParcialMake.sql b/db/routines/vn/procedures/duaParcialMake.sql
index cbb56e16d..063f26468 100644
--- a/db/routines/vn/procedures/duaParcialMake.sql
+++ b/db/routines/vn/procedures/duaParcialMake.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`duaParcialMake`(vDuaFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`duaParcialMake`(vDuaFk INT)
BEGIN
DECLARE vNewDuaFk INT;
diff --git a/db/routines/vn/procedures/duaTaxBooking.sql b/db/routines/vn/procedures/duaTaxBooking.sql
index a50a10ca4..2c9201231 100644
--- a/db/routines/vn/procedures/duaTaxBooking.sql
+++ b/db/routines/vn/procedures/duaTaxBooking.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`duaTaxBooking`(vDuaFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`duaTaxBooking`(vDuaFk INT)
BEGIN
DECLARE vBookNumber INT;
DECLARE vBookDated DATE;
diff --git a/db/routines/vn/procedures/duaTax_doRecalc.sql b/db/routines/vn/procedures/duaTax_doRecalc.sql
index e2d2b347f..fedc4c56b 100644
--- a/db/routines/vn/procedures/duaTax_doRecalc.sql
+++ b/db/routines/vn/procedures/duaTax_doRecalc.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`duaTax_doRecalc`(vDuaFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`duaTax_doRecalc`(vDuaFk INT)
BEGIN
/**
* Borra los valores de duaTax y los vuelve a crear en base a la tabla duaEntry
diff --git a/db/routines/vn/procedures/ediTables_Update.sql b/db/routines/vn/procedures/ediTables_Update.sql
index 3f0c6df04..9ae759fbd 100644
--- a/db/routines/vn/procedures/ediTables_Update.sql
+++ b/db/routines/vn/procedures/ediTables_Update.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ediTables_Update`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ediTables_Update`()
BEGIN
INSERT IGNORE INTO vn.genus(name)
diff --git a/db/routines/vn/procedures/ektEntryAssign_setEntry.sql b/db/routines/vn/procedures/ektEntryAssign_setEntry.sql
index d80215e37..eecdb32d4 100644
--- a/db/routines/vn/procedures/ektEntryAssign_setEntry.sql
+++ b/db/routines/vn/procedures/ektEntryAssign_setEntry.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ektEntryAssign_setEntry`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ektEntryAssign_setEntry`()
BEGIN
DECLARE done INT DEFAULT FALSE;
diff --git a/db/routines/vn/procedures/energyMeter_record.sql b/db/routines/vn/procedures/energyMeter_record.sql
index 113f73e19..07fb7afd0 100644
--- a/db/routines/vn/procedures/energyMeter_record.sql
+++ b/db/routines/vn/procedures/energyMeter_record.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`energyMeter_record`(vInput INT, vActiveTime INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`energyMeter_record`(vInput INT, vActiveTime INT)
BEGIN
DECLARE vConsumption INT;
diff --git a/db/routines/vn/procedures/entryDelivered.sql b/db/routines/vn/procedures/entryDelivered.sql
index e948770e8..7a6e22b4b 100644
--- a/db/routines/vn/procedures/entryDelivered.sql
+++ b/db/routines/vn/procedures/entryDelivered.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entryDelivered`(vDated DATE, vEntryFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entryDelivered`(vDated DATE, vEntryFk INT)
BEGIN
DECLARE vTravelFk INT;
diff --git a/db/routines/vn/procedures/entryWithItem.sql b/db/routines/vn/procedures/entryWithItem.sql
index 30dd99fbf..f28a69f61 100644
--- a/db/routines/vn/procedures/entryWithItem.sql
+++ b/db/routines/vn/procedures/entryWithItem.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entryWithItem`(vShipmentWarehouse INT, vLandingWarehouse INT,vSale INT, vVolume INT, netCost DECIMAL(10,2), vInOutDate DATE)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entryWithItem`(vShipmentWarehouse INT, vLandingWarehouse INT,vSale INT, vVolume INT, netCost DECIMAL(10,2), vInOutDate DATE)
BEGIN
DECLARE vTravel INT;
diff --git a/db/routines/vn/procedures/entry_checkPackaging.sql b/db/routines/vn/procedures/entry_checkPackaging.sql
index 7ba47b3d5..f9ed03212 100644
--- a/db/routines/vn/procedures/entry_checkPackaging.sql
+++ b/db/routines/vn/procedures/entry_checkPackaging.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_checkPackaging`(vEntryFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_checkPackaging`(vEntryFk INT)
BEGIN
/**
* Comprueba que los campos package y packaging no sean nulos
diff --git a/db/routines/vn/procedures/entry_clone.sql b/db/routines/vn/procedures/entry_clone.sql
index 4f38447c8..a0ed39c29 100644
--- a/db/routines/vn/procedures/entry_clone.sql
+++ b/db/routines/vn/procedures/entry_clone.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_clone`(vSelf INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_clone`(vSelf INT)
BEGIN
/**
* clones an entry.
diff --git a/db/routines/vn/procedures/entry_cloneHeader.sql b/db/routines/vn/procedures/entry_cloneHeader.sql
index 7f9426663..c988cc592 100644
--- a/db/routines/vn/procedures/entry_cloneHeader.sql
+++ b/db/routines/vn/procedures/entry_cloneHeader.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_cloneHeader`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_cloneHeader`(
vSelf INT,
OUT vNewEntryFk INT,
vTravelFk INT
diff --git a/db/routines/vn/procedures/entry_cloneWithoutBuy.sql b/db/routines/vn/procedures/entry_cloneWithoutBuy.sql
index 8d75d8d51..af661ce0a 100644
--- a/db/routines/vn/procedures/entry_cloneWithoutBuy.sql
+++ b/db/routines/vn/procedures/entry_cloneWithoutBuy.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_cloneWithoutBuy`(vSelf INT, OUT vNewEntryFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_cloneWithoutBuy`(vSelf INT, OUT vNewEntryFk INT)
BEGIN
/**
* Clona una entrada sin compras
diff --git a/db/routines/vn/procedures/entry_copyBuys.sql b/db/routines/vn/procedures/entry_copyBuys.sql
index 9bf4a55e4..8446249c7 100644
--- a/db/routines/vn/procedures/entry_copyBuys.sql
+++ b/db/routines/vn/procedures/entry_copyBuys.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_copyBuys`(vSelf INT, vDestinationEntryFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_copyBuys`(vSelf INT, vDestinationEntryFk INT)
BEGIN
/**
* Copies all buys from an entry to an entry.
diff --git a/db/routines/vn/procedures/entry_fixMisfit.sql b/db/routines/vn/procedures/entry_fixMisfit.sql
index 986a0ae9e..c950f9a95 100644
--- a/db/routines/vn/procedures/entry_fixMisfit.sql
+++ b/db/routines/vn/procedures/entry_fixMisfit.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_fixMisfit`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_fixMisfit`(
vSelf INT
)
BEGIN
diff --git a/db/routines/vn/procedures/entry_getRate.sql b/db/routines/vn/procedures/entry_getRate.sql
index 2220ef999..e715fae9b 100644
--- a/db/routines/vn/procedures/entry_getRate.sql
+++ b/db/routines/vn/procedures/entry_getRate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_getRate`(vSelf INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_getRate`(vSelf INT)
BEGIN
/**
* Prepara una tabla con las tarifas aplicables en funcion de la fecha
diff --git a/db/routines/vn/procedures/entry_getTransfer.sql b/db/routines/vn/procedures/entry_getTransfer.sql
index 5bf049b6e..c83556408 100644
--- a/db/routines/vn/procedures/entry_getTransfer.sql
+++ b/db/routines/vn/procedures/entry_getTransfer.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_getTransfer`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_getTransfer`(
vSelf INT
)
BEGIN
diff --git a/db/routines/vn/procedures/entry_isEditable.sql b/db/routines/vn/procedures/entry_isEditable.sql
index c279fac65..12b6d0ef6 100644
--- a/db/routines/vn/procedures/entry_isEditable.sql
+++ b/db/routines/vn/procedures/entry_isEditable.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_isEditable`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_isEditable`(
vSelf INT
)
BEGIN
diff --git a/db/routines/vn/procedures/entry_lock.sql b/db/routines/vn/procedures/entry_lock.sql
index 8ec50323b..51e0f40b4 100644
--- a/db/routines/vn/procedures/entry_lock.sql
+++ b/db/routines/vn/procedures/entry_lock.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_lock`(vSelf INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_lock`(vSelf INT)
BEGIN
/**
* Lock the indicated entry
diff --git a/db/routines/vn/procedures/entry_moveNotPrinted.sql b/db/routines/vn/procedures/entry_moveNotPrinted.sql
index 3a12007d1..3d15681ee 100644
--- a/db/routines/vn/procedures/entry_moveNotPrinted.sql
+++ b/db/routines/vn/procedures/entry_moveNotPrinted.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_moveNotPrinted`(vSelf INT,
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_moveNotPrinted`(vSelf INT,
vDays INT,
vChangeEntry BOOL,
OUT vNewEntryFk INT)
diff --git a/db/routines/vn/procedures/entry_notifyChanged.sql b/db/routines/vn/procedures/entry_notifyChanged.sql
index 11e6fe4c0..5e48699bf 100644
--- a/db/routines/vn/procedures/entry_notifyChanged.sql
+++ b/db/routines/vn/procedures/entry_notifyChanged.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_notifyChanged`(vSelf INT, vBuyFk INT, vOldValues VARCHAR(512), vNewValues VARCHAR(512))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_notifyChanged`(vSelf INT, vBuyFk INT, vOldValues VARCHAR(512), vNewValues VARCHAR(512))
BEGIN
DECLARE vEmail VARCHAR(255);
DECLARE vFields VARCHAR(100);
diff --git a/db/routines/vn/procedures/entry_recalc.sql b/db/routines/vn/procedures/entry_recalc.sql
index b426a9b5b..516c5c193 100644
--- a/db/routines/vn/procedures/entry_recalc.sql
+++ b/db/routines/vn/procedures/entry_recalc.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_recalc`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_recalc`()
BEGIN
/**
* Comprueba que las ventas creadas entre un rango de fechas tienen componentes
diff --git a/db/routines/vn/procedures/entry_splitByShelving.sql b/db/routines/vn/procedures/entry_splitByShelving.sql
index 9f09ed5be..fbf0cef90 100644
--- a/db/routines/vn/procedures/entry_splitByShelving.sql
+++ b/db/routines/vn/procedures/entry_splitByShelving.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_splitByShelving`(vShelvingFk VARCHAR(3), vFromEntryFk INT, vToEntryFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_splitByShelving`(vShelvingFk VARCHAR(3), vFromEntryFk INT, vToEntryFk INT)
BEGIN
/**
* Divide las compras entre dos entradas de acuerdo con lo ubicado en una matr�cula
diff --git a/db/routines/vn/procedures/entry_splitMisfit.sql b/db/routines/vn/procedures/entry_splitMisfit.sql
index 476c52689..a21b2c9c4 100644
--- a/db/routines/vn/procedures/entry_splitMisfit.sql
+++ b/db/routines/vn/procedures/entry_splitMisfit.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_splitMisfit`(vSelf INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_splitMisfit`(vSelf INT)
BEGIN
/* Divide una entrada, pasando los registros que ha insertado vn.entry_fixMisfit de la entrada original
diff --git a/db/routines/vn/procedures/entry_unlock.sql b/db/routines/vn/procedures/entry_unlock.sql
index 1dab48974..4ecdf2797 100644
--- a/db/routines/vn/procedures/entry_unlock.sql
+++ b/db/routines/vn/procedures/entry_unlock.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_unlock`(vSelf INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_unlock`(vSelf INT)
BEGIN
/**
* Unlock the indicated entry
diff --git a/db/routines/vn/procedures/entry_updateComission.sql b/db/routines/vn/procedures/entry_updateComission.sql
index 4ec4f6e58..e2de2a4a5 100644
--- a/db/routines/vn/procedures/entry_updateComission.sql
+++ b/db/routines/vn/procedures/entry_updateComission.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_updateComission`(vCurrency INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_updateComission`(vCurrency INT)
BEGIN
/**
* Actualiza la comision de las entradas de hoy a futuro y las recalcula
diff --git a/db/routines/vn/procedures/expeditionGetFromRoute.sql b/db/routines/vn/procedures/expeditionGetFromRoute.sql
index 46c3c5d70..6191428e6 100644
--- a/db/routines/vn/procedures/expeditionGetFromRoute.sql
+++ b/db/routines/vn/procedures/expeditionGetFromRoute.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`expeditionGetFromRoute`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`expeditionGetFromRoute`(
vExpeditionFk INT)
BEGIN
/**
diff --git a/db/routines/vn/procedures/expeditionPallet_Del.sql b/db/routines/vn/procedures/expeditionPallet_Del.sql
index 451815ca0..e69992032 100644
--- a/db/routines/vn/procedures/expeditionPallet_Del.sql
+++ b/db/routines/vn/procedures/expeditionPallet_Del.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`expeditionPallet_Del`(vPalletFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`expeditionPallet_Del`(vPalletFk INT)
BEGIN
DELETE FROM vn.expeditionPallet
diff --git a/db/routines/vn/procedures/expeditionPallet_List.sql b/db/routines/vn/procedures/expeditionPallet_List.sql
index db7cd6f0e..e419f8793 100644
--- a/db/routines/vn/procedures/expeditionPallet_List.sql
+++ b/db/routines/vn/procedures/expeditionPallet_List.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`expeditionPallet_List`(vTruckFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`expeditionPallet_List`(vTruckFk INT)
BEGIN
SELECT ep.id Pallet,
diff --git a/db/routines/vn/procedures/expeditionPallet_View.sql b/db/routines/vn/procedures/expeditionPallet_View.sql
index fe410b2fb..31e0d6c96 100644
--- a/db/routines/vn/procedures/expeditionPallet_View.sql
+++ b/db/routines/vn/procedures/expeditionPallet_View.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`expeditionPallet_View`(vPalletFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`expeditionPallet_View`(vPalletFk INT)
BEGIN
SELECT ep.id Pallet,
diff --git a/db/routines/vn/procedures/expeditionPallet_build.sql b/db/routines/vn/procedures/expeditionPallet_build.sql
index e917c5eb2..2df73bb85 100644
--- a/db/routines/vn/procedures/expeditionPallet_build.sql
+++ b/db/routines/vn/procedures/expeditionPallet_build.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`expeditionPallet_build`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`expeditionPallet_build`(
vExpeditions JSON,
vArcId INT,
vWorkerFk INT,
diff --git a/db/routines/vn/procedures/expeditionPallet_printLabel.sql b/db/routines/vn/procedures/expeditionPallet_printLabel.sql
index 7aaf8cedb..0a35d2a6b 100644
--- a/db/routines/vn/procedures/expeditionPallet_printLabel.sql
+++ b/db/routines/vn/procedures/expeditionPallet_printLabel.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`expeditionPallet_printLabel`(vSelf INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`expeditionPallet_printLabel`(vSelf INT)
BEGIN
/**
* Calls the report_print procedure and passes it
diff --git a/db/routines/vn/procedures/expeditionScan_Add.sql b/db/routines/vn/procedures/expeditionScan_Add.sql
index 6ab19e8d0..98eeb265b 100644
--- a/db/routines/vn/procedures/expeditionScan_Add.sql
+++ b/db/routines/vn/procedures/expeditionScan_Add.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`expeditionScan_Add`(vPalletFk INT, vTruckFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`expeditionScan_Add`(vPalletFk INT, vTruckFk INT)
BEGIN
DECLARE vTotal INT DEFAULT 0;
diff --git a/db/routines/vn/procedures/expeditionScan_Del.sql b/db/routines/vn/procedures/expeditionScan_Del.sql
index ecbfdad4b..8e082d18c 100644
--- a/db/routines/vn/procedures/expeditionScan_Del.sql
+++ b/db/routines/vn/procedures/expeditionScan_Del.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`expeditionScan_Del`(vScanFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`expeditionScan_Del`(vScanFk INT)
BEGIN
DELETE FROM vn.expeditionScan
diff --git a/db/routines/vn/procedures/expeditionScan_List.sql b/db/routines/vn/procedures/expeditionScan_List.sql
index b0d53053f..7f3ddd3fd 100644
--- a/db/routines/vn/procedures/expeditionScan_List.sql
+++ b/db/routines/vn/procedures/expeditionScan_List.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`expeditionScan_List`(vPalletFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`expeditionScan_List`(vPalletFk INT)
BEGIN
SELECT es.id,
diff --git a/db/routines/vn/procedures/expeditionScan_Put.sql b/db/routines/vn/procedures/expeditionScan_Put.sql
index cbc76d317..fc7d4da23 100644
--- a/db/routines/vn/procedures/expeditionScan_Put.sql
+++ b/db/routines/vn/procedures/expeditionScan_Put.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`expeditionScan_Put`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`expeditionScan_Put`(
vPalletFk INT,
vExpeditionFk INT
)
diff --git a/db/routines/vn/procedures/expeditionState_add.sql b/db/routines/vn/procedures/expeditionState_add.sql
index 299f11b04..974fc4d3e 100644
--- a/db/routines/vn/procedures/expeditionState_add.sql
+++ b/db/routines/vn/procedures/expeditionState_add.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`expeditionState_add`(vParam INT, vStateCode VARCHAR(100))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`expeditionState_add`(vParam INT, vStateCode VARCHAR(100))
BEGIN
/**
diff --git a/db/routines/vn/procedures/expeditionState_addByAdress.sql b/db/routines/vn/procedures/expeditionState_addByAdress.sql
index 1d8de9745..3925ea000 100644
--- a/db/routines/vn/procedures/expeditionState_addByAdress.sql
+++ b/db/routines/vn/procedures/expeditionState_addByAdress.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`expeditionState_addByAdress`(vAdressFk INT, vRouteFk INT, vStateCode VARCHAR(100))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`expeditionState_addByAdress`(vAdressFk INT, vRouteFk INT, vStateCode VARCHAR(100))
BEGIN
/**
diff --git a/db/routines/vn/procedures/expeditionState_addByExpedition.sql b/db/routines/vn/procedures/expeditionState_addByExpedition.sql
index 6fbc205e5..fbc075b88 100644
--- a/db/routines/vn/procedures/expeditionState_addByExpedition.sql
+++ b/db/routines/vn/procedures/expeditionState_addByExpedition.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`expeditionState_addByExpedition`(vExpeditionFk INT, vStateCode VARCHAR(100))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`expeditionState_addByExpedition`(vExpeditionFk INT, vStateCode VARCHAR(100))
BEGIN
/**
diff --git a/db/routines/vn/procedures/expeditionState_addByPallet.sql b/db/routines/vn/procedures/expeditionState_addByPallet.sql
index af99b444d..5ebebb748 100644
--- a/db/routines/vn/procedures/expeditionState_addByPallet.sql
+++ b/db/routines/vn/procedures/expeditionState_addByPallet.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`expeditionState_addByPallet`(vPalletFk INT, vStateCode VARCHAR(100))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`expeditionState_addByPallet`(vPalletFk INT, vStateCode VARCHAR(100))
BEGIN
/**
* Inserta nuevos registros en la tabla vn.expeditionState
diff --git a/db/routines/vn/procedures/expeditionState_addByRoute.sql b/db/routines/vn/procedures/expeditionState_addByRoute.sql
index 5e438287b..c375f95a8 100644
--- a/db/routines/vn/procedures/expeditionState_addByRoute.sql
+++ b/db/routines/vn/procedures/expeditionState_addByRoute.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`expeditionState_addByRoute`(vRouteFk INT, vStateCode VARCHAR(100))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`expeditionState_addByRoute`(vRouteFk INT, vStateCode VARCHAR(100))
BEGIN
/**
diff --git a/db/routines/vn/procedures/expedition_StateGet.sql b/db/routines/vn/procedures/expedition_StateGet.sql
index c709841eb..a871cf3b6 100644
--- a/db/routines/vn/procedures/expedition_StateGet.sql
+++ b/db/routines/vn/procedures/expedition_StateGet.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`expedition_StateGet`(vExpeditionFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`expedition_StateGet`(vExpeditionFk INT)
BEGIN
/* Devuelve una "ficha" con todos los datos relativos a la expedición
diff --git a/db/routines/vn/procedures/expedition_getFromRoute.sql b/db/routines/vn/procedures/expedition_getFromRoute.sql
index 2b726fa7d..f95936413 100644
--- a/db/routines/vn/procedures/expedition_getFromRoute.sql
+++ b/db/routines/vn/procedures/expedition_getFromRoute.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`expedition_getFromRoute`(vRouteFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`expedition_getFromRoute`(vRouteFk INT)
BEGIN
/**
* Obtiene las expediciones a partir de una ruta
diff --git a/db/routines/vn/procedures/expedition_getState.sql b/db/routines/vn/procedures/expedition_getState.sql
index 61d65f571..f2e873a6b 100644
--- a/db/routines/vn/procedures/expedition_getState.sql
+++ b/db/routines/vn/procedures/expedition_getState.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`expedition_getState`(vExpeditionFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`expedition_getState`(vExpeditionFk INT)
BEGIN
DECLARE vTicketsPendientes INT;
diff --git a/db/routines/vn/procedures/freelance_getInfo.sql b/db/routines/vn/procedures/freelance_getInfo.sql
index 0f85ab4bd..64d44c347 100644
--- a/db/routines/vn/procedures/freelance_getInfo.sql
+++ b/db/routines/vn/procedures/freelance_getInfo.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`freelance_getInfo`(workerFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`freelance_getInfo`(workerFk INT)
BEGIN
SELECT s.name, s.street, s.city, s.nif, s.postCode
FROM route r
diff --git a/db/routines/vn/procedures/getDayExpeditions.sql b/db/routines/vn/procedures/getDayExpeditions.sql
index b708c8b0e..5f83937a7 100644
--- a/db/routines/vn/procedures/getDayExpeditions.sql
+++ b/db/routines/vn/procedures/getDayExpeditions.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`getDayExpeditions`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`getDayExpeditions`()
BEGIN
SELECT
diff --git a/db/routines/vn/procedures/getInfoDelivery.sql b/db/routines/vn/procedures/getInfoDelivery.sql
index c240560e9..0663cbbc3 100644
--- a/db/routines/vn/procedures/getInfoDelivery.sql
+++ b/db/routines/vn/procedures/getInfoDelivery.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`getInfoDelivery`(vRouteFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`getInfoDelivery`(vRouteFk INT)
BEGIN
SELECT s.name, s.street, s.city, s.nif, s.postCode FROM vn.route r
JOIN vn.agencyMode am ON r.agencyModeFk = am.id
diff --git a/db/routines/vn/procedures/getPedidosInternos.sql b/db/routines/vn/procedures/getPedidosInternos.sql
index 973e110ef..d6efdc364 100644
--- a/db/routines/vn/procedures/getPedidosInternos.sql
+++ b/db/routines/vn/procedures/getPedidosInternos.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`getPedidosInternos`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`getPedidosInternos`()
BEGIN
SELECT id,name as description,upToDown as quantity FROM vn.item WHERE upToDown;
diff --git a/db/routines/vn/procedures/getTaxBases.sql b/db/routines/vn/procedures/getTaxBases.sql
index 54932aa4f..15a6ce85b 100644
--- a/db/routines/vn/procedures/getTaxBases.sql
+++ b/db/routines/vn/procedures/getTaxBases.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`getTaxBases`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`getTaxBases`()
BEGIN
/**
* Calcula y devuelve en número de bases imponibles postivas y negativas
diff --git a/db/routines/vn/procedures/greuge_add.sql b/db/routines/vn/procedures/greuge_add.sql
index b2241ab83..f69e97caa 100644
--- a/db/routines/vn/procedures/greuge_add.sql
+++ b/db/routines/vn/procedures/greuge_add.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`greuge_add`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`greuge_add`()
BEGIN
/**
* Group inserts into vn.greuge and then deletes the records just inserted
diff --git a/db/routines/vn/procedures/greuge_notifyEvents.sql b/db/routines/vn/procedures/greuge_notifyEvents.sql
index ec00c1bde..bf6755c9a 100644
--- a/db/routines/vn/procedures/greuge_notifyEvents.sql
+++ b/db/routines/vn/procedures/greuge_notifyEvents.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`greuge_notifyEvents`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`greuge_notifyEvents`()
BEGIN
/**
* Notify to detect wrong greuges.
diff --git a/db/routines/vn/procedures/inventoryFailureAdd.sql b/db/routines/vn/procedures/inventoryFailureAdd.sql
index 38765cbda..e2b5fa4a0 100644
--- a/db/routines/vn/procedures/inventoryFailureAdd.sql
+++ b/db/routines/vn/procedures/inventoryFailureAdd.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`inventoryFailureAdd`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`inventoryFailureAdd`()
BEGIN
DECLARE done BOOL DEFAULT FALSE;
diff --git a/db/routines/vn/procedures/inventoryMake.sql b/db/routines/vn/procedures/inventoryMake.sql
index 30bea6690..91065771a 100644
--- a/db/routines/vn/procedures/inventoryMake.sql
+++ b/db/routines/vn/procedures/inventoryMake.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`inventoryMake`(vInventoryDate DATE)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`inventoryMake`(vInventoryDate DATE)
BEGIN
/**
* Recalculate the inventories
diff --git a/db/routines/vn/procedures/inventoryMakeLauncher.sql b/db/routines/vn/procedures/inventoryMakeLauncher.sql
index 717e3c163..1822e1d8d 100644
--- a/db/routines/vn/procedures/inventoryMakeLauncher.sql
+++ b/db/routines/vn/procedures/inventoryMakeLauncher.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`inventoryMakeLauncher`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`inventoryMakeLauncher`()
BEGIN
/**
* Recalculate the inventories of all warehouses
diff --git a/db/routines/vn/procedures/inventory_repair.sql b/db/routines/vn/procedures/inventory_repair.sql
index 93527d84b..9c8300321 100644
--- a/db/routines/vn/procedures/inventory_repair.sql
+++ b/db/routines/vn/procedures/inventory_repair.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`inventory_repair`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`inventory_repair`()
BEGIN
DROP TEMPORARY TABLE IF EXISTS tmp.lastEntry;
diff --git a/db/routines/vn/procedures/invoiceExpenseMake.sql b/db/routines/vn/procedures/invoiceExpenseMake.sql
index a1fe69ff5..ad336e2db 100644
--- a/db/routines/vn/procedures/invoiceExpenseMake.sql
+++ b/db/routines/vn/procedures/invoiceExpenseMake.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceExpenseMake`(IN vInvoice INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`invoiceExpenseMake`(IN vInvoice INT)
BEGIN
/* Inserta las partidas de gasto correspondientes a la factura
* REQUIERE tabla tmp.ticketToInvoice
diff --git a/db/routines/vn/procedures/invoiceFromAddress.sql b/db/routines/vn/procedures/invoiceFromAddress.sql
index 2879460ce..24b247f5b 100644
--- a/db/routines/vn/procedures/invoiceFromAddress.sql
+++ b/db/routines/vn/procedures/invoiceFromAddress.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceFromAddress`(vMaxTicketDate DATETIME,vAddress INT,vCompany INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`invoiceFromAddress`(vMaxTicketDate DATETIME,vAddress INT,vCompany INT)
BEGIN
DECLARE vMinDateTicket DATE DEFAULT TIMESTAMPADD(MONTH, -3, util.VN_CURDATE());
diff --git a/db/routines/vn/procedures/invoiceFromClient.sql b/db/routines/vn/procedures/invoiceFromClient.sql
index 29cee5d4f..1a0dfa4c3 100644
--- a/db/routines/vn/procedures/invoiceFromClient.sql
+++ b/db/routines/vn/procedures/invoiceFromClient.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceFromClient`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`invoiceFromClient`(
IN vMaxTicketDate datetime,
IN vClientFk INT,
IN vCompanyFk INT)
diff --git a/db/routines/vn/procedures/invoiceFromTicket.sql b/db/routines/vn/procedures/invoiceFromTicket.sql
index e5ea00e62..c00a9bab4 100644
--- a/db/routines/vn/procedures/invoiceFromTicket.sql
+++ b/db/routines/vn/procedures/invoiceFromTicket.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceFromTicket`(IN vTicket INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`invoiceFromTicket`(IN vTicket INT)
BEGIN
DROP TEMPORARY TABLE IF EXISTS `tmp`.`ticketToInvoice`;
diff --git a/db/routines/vn/procedures/invoiceInDueDay_calculate.sql b/db/routines/vn/procedures/invoiceInDueDay_calculate.sql
index 7929bee6f..d488b79db 100644
--- a/db/routines/vn/procedures/invoiceInDueDay_calculate.sql
+++ b/db/routines/vn/procedures/invoiceInDueDay_calculate.sql
@@ -1,6 +1,6 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceInDueDay_calculate`(
-vInvoiceInFk INT
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`invoiceInDueDay_calculate`(
+ vInvoiceInFk INT
)
BEGIN
/**
diff --git a/db/routines/vn/procedures/invoiceInDueDay_recalc.sql b/db/routines/vn/procedures/invoiceInDueDay_recalc.sql
index 7d2b0a5ed..b3a9f5aef 100644
--- a/db/routines/vn/procedures/invoiceInDueDay_recalc.sql
+++ b/db/routines/vn/procedures/invoiceInDueDay_recalc.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceInDueDay_recalc`(vInvoiceInFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`invoiceInDueDay_recalc`(vInvoiceInFk INT)
BEGIN
DELETE FROM invoiceInDueDay
diff --git a/db/routines/vn/procedures/invoiceInTaxMakeByDua.sql b/db/routines/vn/procedures/invoiceInTaxMakeByDua.sql
index 3453516cc..4c16346b2 100644
--- a/db/routines/vn/procedures/invoiceInTaxMakeByDua.sql
+++ b/db/routines/vn/procedures/invoiceInTaxMakeByDua.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceInTaxMakeByDua`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`invoiceInTaxMakeByDua`(
vDuaFk INT
)
BEGIN
diff --git a/db/routines/vn/procedures/invoiceInTax_afterUpsert.sql b/db/routines/vn/procedures/invoiceInTax_afterUpsert.sql
index 962cc5224..da3faefbf 100644
--- a/db/routines/vn/procedures/invoiceInTax_afterUpsert.sql
+++ b/db/routines/vn/procedures/invoiceInTax_afterUpsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceInTax_afterUpsert`(vInvoiceInFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`invoiceInTax_afterUpsert`(vInvoiceInFk INT)
BEGIN
/**
* Triggered actions when a invoiceInTax is updated or inserted.
diff --git a/db/routines/vn/procedures/invoiceInTax_getFromDua.sql b/db/routines/vn/procedures/invoiceInTax_getFromDua.sql
index bf2cbe61e..c3a890ddd 100644
--- a/db/routines/vn/procedures/invoiceInTax_getFromDua.sql
+++ b/db/routines/vn/procedures/invoiceInTax_getFromDua.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceInTax_getFromDua`(vDuaFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`invoiceInTax_getFromDua`(vDuaFk INT)
BEGIN
/**
* Borra los valores de duaTax y sus vctos. y los vuelve a crear en base a la tabla duaEntry
diff --git a/db/routines/vn/procedures/invoiceInTax_getFromEntries.sql b/db/routines/vn/procedures/invoiceInTax_getFromEntries.sql
index 5f2ceeb4f..186104a73 100644
--- a/db/routines/vn/procedures/invoiceInTax_getFromEntries.sql
+++ b/db/routines/vn/procedures/invoiceInTax_getFromEntries.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceInTax_getFromEntries`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`invoiceInTax_getFromEntries`(
IN vInvoiceInFk INT
)
BEGIN
diff --git a/db/routines/vn/procedures/invoiceInTax_recalc.sql b/db/routines/vn/procedures/invoiceInTax_recalc.sql
index 4e20b01d3..0daf87103 100644
--- a/db/routines/vn/procedures/invoiceInTax_recalc.sql
+++ b/db/routines/vn/procedures/invoiceInTax_recalc.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceInTax_recalc`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`invoiceInTax_recalc`(
vInvoiceInFk INT
)
BEGIN
diff --git a/db/routines/vn/procedures/invoiceIn_booking.sql b/db/routines/vn/procedures/invoiceIn_booking.sql
index a5dd3a5f1..36189afcc 100644
--- a/db/routines/vn/procedures/invoiceIn_booking.sql
+++ b/db/routines/vn/procedures/invoiceIn_booking.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceIn_booking`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`invoiceIn_booking`(
vSelf INT,
vBookNumber INT
)
diff --git a/db/routines/vn/procedures/invoiceIn_checkBooked.sql b/db/routines/vn/procedures/invoiceIn_checkBooked.sql
index 862870eb4..b9966a9b6 100644
--- a/db/routines/vn/procedures/invoiceIn_checkBooked.sql
+++ b/db/routines/vn/procedures/invoiceIn_checkBooked.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceIn_checkBooked`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`invoiceIn_checkBooked`(
vSelf INT
)
BEGIN
diff --git a/db/routines/vn/procedures/invoiceOutAgain.sql b/db/routines/vn/procedures/invoiceOutAgain.sql
index 82cebc18d..21b43fdf9 100644
--- a/db/routines/vn/procedures/invoiceOutAgain.sql
+++ b/db/routines/vn/procedures/invoiceOutAgain.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceOutAgain`(IN vInvoiceRef VARCHAR(15), vTaxArea VARCHAR(25))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`invoiceOutAgain`(IN vInvoiceRef VARCHAR(15), vTaxArea VARCHAR(25))
BEGIN
/* Para tickets ya facturados, vuelve a repetir el proceso de facturación.
diff --git a/db/routines/vn/procedures/invoiceOutBooking.sql b/db/routines/vn/procedures/invoiceOutBooking.sql
index 9fc1c92b6..86f64ffcb 100644
--- a/db/routines/vn/procedures/invoiceOutBooking.sql
+++ b/db/routines/vn/procedures/invoiceOutBooking.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceOutBooking`(IN vInvoice INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`invoiceOutBooking`(IN vInvoice INT)
BEGIN
/**
* Asienta una factura emitida
diff --git a/db/routines/vn/procedures/invoiceOutBookingRange.sql b/db/routines/vn/procedures/invoiceOutBookingRange.sql
index 57d973f01..e053e51eb 100644
--- a/db/routines/vn/procedures/invoiceOutBookingRange.sql
+++ b/db/routines/vn/procedures/invoiceOutBookingRange.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceOutBookingRange`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`invoiceOutBookingRange`()
BEGIN
/* Reasentar facturas
diff --git a/db/routines/vn/procedures/invoiceOutListByCompany.sql b/db/routines/vn/procedures/invoiceOutListByCompany.sql
index 09ebfc1a4..13145dd6b 100644
--- a/db/routines/vn/procedures/invoiceOutListByCompany.sql
+++ b/db/routines/vn/procedures/invoiceOutListByCompany.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceOutListByCompany`(vCompany INT, vStarted DATE, vEnded DATE)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`invoiceOutListByCompany`(vCompany INT, vStarted DATE, vEnded DATE)
BEGIN
SELECT
diff --git a/db/routines/vn/procedures/invoiceOutTaxAndExpense.sql b/db/routines/vn/procedures/invoiceOutTaxAndExpense.sql
index c263fe8d3..4bae6b245 100644
--- a/db/routines/vn/procedures/invoiceOutTaxAndExpense.sql
+++ b/db/routines/vn/procedures/invoiceOutTaxAndExpense.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceOutTaxAndExpense`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`invoiceOutTaxAndExpense`()
BEGIN
/* Para tickets ya facturados, vuelve a repetir el proceso de facturación.
diff --git a/db/routines/vn/procedures/invoiceOut_exportationFromClient.sql b/db/routines/vn/procedures/invoiceOut_exportationFromClient.sql
index 5fce7c428..1e870ca75 100644
--- a/db/routines/vn/procedures/invoiceOut_exportationFromClient.sql
+++ b/db/routines/vn/procedures/invoiceOut_exportationFromClient.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceOut_exportationFromClient`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`invoiceOut_exportationFromClient`(
vMaxTicketDate DATETIME,
vClientFk INT,
vCompanyFk INT)
diff --git a/db/routines/vn/procedures/invoiceOut_new.sql b/db/routines/vn/procedures/invoiceOut_new.sql
index 43d0a09a1..723f33df5 100644
--- a/db/routines/vn/procedures/invoiceOut_new.sql
+++ b/db/routines/vn/procedures/invoiceOut_new.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceOut_new`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`invoiceOut_new`(
vSerial VARCHAR(255),
vInvoiceDate DATE,
vTaxArea VARCHAR(25),
diff --git a/db/routines/vn/procedures/invoiceOut_newFromClient.sql b/db/routines/vn/procedures/invoiceOut_newFromClient.sql
index e6fc7b78a..74c4aa71d 100644
--- a/db/routines/vn/procedures/invoiceOut_newFromClient.sql
+++ b/db/routines/vn/procedures/invoiceOut_newFromClient.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceOut_newFromClient`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`invoiceOut_newFromClient`(
IN vClientFk INT,
IN vSerial CHAR(2),
IN vMaxShipped DATE,
diff --git a/db/routines/vn/procedures/invoiceOut_newFromTicket.sql b/db/routines/vn/procedures/invoiceOut_newFromTicket.sql
index 3ee7cd678..41919f6ea 100644
--- a/db/routines/vn/procedures/invoiceOut_newFromTicket.sql
+++ b/db/routines/vn/procedures/invoiceOut_newFromTicket.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceOut_newFromTicket`(IN vTicketFk int, IN vSerial char(2), IN vTaxArea varchar(25),
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`invoiceOut_newFromTicket`(IN vTicketFk int, IN vSerial char(2), IN vTaxArea varchar(25),
IN vRef varchar(25), OUT vInvoiceId int)
BEGIN
/**
diff --git a/db/routines/vn/procedures/invoiceTaxMake.sql b/db/routines/vn/procedures/invoiceTaxMake.sql
index 30296dc26..5b1ba6a95 100644
--- a/db/routines/vn/procedures/invoiceTaxMake.sql
+++ b/db/routines/vn/procedures/invoiceTaxMake.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceTaxMake`(vInvoice INT, vTaxArea VARCHAR(25))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`invoiceTaxMake`(vInvoice INT, vTaxArea VARCHAR(25))
BEGIN
/**
* Factura un conjunto de tickets.
diff --git a/db/routines/vn/procedures/itemBarcode_update.sql b/db/routines/vn/procedures/itemBarcode_update.sql
index e2f13dc93..6341d8091 100644
--- a/db/routines/vn/procedures/itemBarcode_update.sql
+++ b/db/routines/vn/procedures/itemBarcode_update.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemBarcode_update`(vItemFk INT,vCode VARCHAR(22), vDelete BOOL)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemBarcode_update`(vItemFk INT,vCode VARCHAR(22), vDelete BOOL)
BEGIN
IF vDelete THEN
DELETE FROM vn.itemBarcode WHERE itemFk = vItemFk AND code = vCode;
diff --git a/db/routines/vn/procedures/itemFuentesBalance.sql b/db/routines/vn/procedures/itemFuentesBalance.sql
deleted file mode 100644
index e60273340..000000000
--- a/db/routines/vn/procedures/itemFuentesBalance.sql
+++ /dev/null
@@ -1,79 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemFuentesBalance`(vDaysInFuture INT)
-BEGIN
-
- /* Se utiliza para calcular la necesidad de mover mercancia entre el almacén de fuentes y el nuestro
- *
- * @param vDaysInFuture Rango de dias para calcular entradas y salidas
- *
- */
-
- DECLARE vWarehouseFk INT;
-
- SELECT s.warehouseFk INTO vWarehouseFk
- FROM vn.sector s
- WHERE s.code = 'FUENTES_PICASSE';
-
- CALL cache.stock_refresh(FALSE);
-
- SELECT i.id itemFk,
- i.longName,
- i.size,
- i.subName,
- v.amount - IFNULL(fue.Fuentes,0) - IFNULL(alb.albenfruit,0) as visible,
- fue.Fuentes,
- alb.Albenfruit,
- sale.venta,
- IFNULL(buy.compra,0) + IFNULL(mov.traslado,0) as compra,
- IFNULL(v.amount,0) + IFNULL(sale.venta,0) + IFNULL(buy.compra,0) + IFNULL(mov.traslado,0)
- - IFNULL(fue.Fuentes,0) - IFNULL(alb.albenfruit,0) as saldo
- FROM vn.item i
- JOIN vn.itemType it ON it.id = i.typeFk
- JOIN vn.itemCategory ic ON ic.id = it.categoryFk
- LEFT JOIN (
- SELECT ish.itemFk, CAST(SUM(ish.visible) AS DECIMAL(10,0)) AS Fuentes
- FROM vn.itemShelving ish
- JOIN vn.shelving sh ON sh.code = ish.shelvingFk
- JOIN vn.parking p ON p.id = sh.parkingFk
- JOIN vn.sector s ON s.id = p.sectorFk
- WHERE s.code = 'FUENTES_PICASSE'
- GROUP BY ish.itemFk
- ) fue ON fue.itemFk = i.id
- LEFT JOIN (
- SELECT ish.itemFk, CAST(SUM(ish.visible) AS DECIMAL(10,0)) AS Albenfruit
- FROM vn.itemShelving ish
- JOIN vn.shelving sh ON sh.code = ish.shelvingFk
- JOIN vn.parking p ON p.id = sh.parkingFk
- JOIN vn.sector s ON s.id = p.sectorFk
- WHERE s.code = 'ALBENFRUIT'
- GROUP BY ish.itemFk
- ) alb ON alb.itemFk = i.id
- LEFT JOIN cache.stock v ON i.id = v.item_id AND v.warehouse_id = vWarehouseFk
- LEFT JOIN (
- SELECT itemFk item_id, CAST(sum(quantity)AS DECIMAL(10,0)) as venta
- FROM itemTicketOut
- WHERE shipped BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(util.VN_CURDATE()))
- AND warehouseFk = vWarehouseFk
- GROUP BY itemFk
- ) sale ON sale.item_id = i.id
- LEFT JOIN (
- SELECT itemFk item_id, CAST(sum(quantity)AS DECIMAL(10,0)) as compra
- FROM itemEntryIn
- WHERE landed BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(util.VN_CURDATE()))
- AND warehouseInFk = vWarehouseFk
- AND isVirtualStock = FALSE
- GROUP BY itemFk
- ) buy ON buy.item_id = i.id
- LEFT JOIN (
- SELECT itemFk item_id, CAST(sum(quantity)AS DECIMAL(10,0)) as traslado
- FROM itemEntryOut
- WHERE shipped BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(util.VN_CURDATE()))
- AND warehouseOutFk = vWarehouseFk
- GROUP BY itemFk
- ) mov ON mov.item_id = i.id
- WHERE (v.amount OR fue.Fuentes OR alb.Albenfruit)
- AND i.itemPackingTypeFk = 'H'
- AND ic.shortLife;
-
-END$$
-DELIMITER ;
diff --git a/db/routines/vn/procedures/itemMinimumQuantity_check.sql b/db/routines/vn/procedures/itemMinimumQuantity_check.sql
index fef7cdbdb..a4b15b90a 100644
--- a/db/routines/vn/procedures/itemMinimumQuantity_check.sql
+++ b/db/routines/vn/procedures/itemMinimumQuantity_check.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemMinimumQuantity_check`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemMinimumQuantity_check`(
vSelf INT,
vItemFk INT,
vStarted DATE,
diff --git a/db/routines/vn/procedures/itemPlacementFromTicket.sql b/db/routines/vn/procedures/itemPlacementFromTicket.sql
index 1a1a735e5..922bde5d4 100644
--- a/db/routines/vn/procedures/itemPlacementFromTicket.sql
+++ b/db/routines/vn/procedures/itemPlacementFromTicket.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemPlacementFromTicket`(vTicket INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemPlacementFromTicket`(vTicket INT)
BEGIN
/**
* Llama a itemPlacementUpdateVisible
diff --git a/db/routines/vn/procedures/itemPlacementSupplyAiming.sql b/db/routines/vn/procedures/itemPlacementSupplyAiming.sql
index ee9125a7b..b96860623 100644
--- a/db/routines/vn/procedures/itemPlacementSupplyAiming.sql
+++ b/db/routines/vn/procedures/itemPlacementSupplyAiming.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemPlacementSupplyAiming`(vShelvingFk VARCHAR(10), quantity INT, vItemFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemPlacementSupplyAiming`(vShelvingFk VARCHAR(10), quantity INT, vItemFk INT)
BEGIN
SELECT ish.itemFk,
diff --git a/db/routines/vn/procedures/itemPlacementSupplyCloseOrder.sql b/db/routines/vn/procedures/itemPlacementSupplyCloseOrder.sql
index 9c4457a5e..935d062a1 100644
--- a/db/routines/vn/procedures/itemPlacementSupplyCloseOrder.sql
+++ b/db/routines/vn/procedures/itemPlacementSupplyCloseOrder.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemPlacementSupplyCloseOrder`(vId INT, vQuantity INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemPlacementSupplyCloseOrder`(vId INT, vQuantity INT)
BEGIN
UPDATE vn.itemPlacementSupply
diff --git a/db/routines/vn/procedures/itemPlacementSupplyGetOrder.sql b/db/routines/vn/procedures/itemPlacementSupplyGetOrder.sql
index b23f69fe7..958dc7e78 100644
--- a/db/routines/vn/procedures/itemPlacementSupplyGetOrder.sql
+++ b/db/routines/vn/procedures/itemPlacementSupplyGetOrder.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemPlacementSupplyGetOrder`(vSector INT )
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemPlacementSupplyGetOrder`(vSector INT )
BEGIN
DECLARE vId INT;
diff --git a/db/routines/vn/procedures/itemPlacementSupplyStockGetTargetList.sql b/db/routines/vn/procedures/itemPlacementSupplyStockGetTargetList.sql
index 86d62cad4..cefa64d13 100644
--- a/db/routines/vn/procedures/itemPlacementSupplyStockGetTargetList.sql
+++ b/db/routines/vn/procedures/itemPlacementSupplyStockGetTargetList.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemPlacementSupplyStockGetTargetList`(vItemFk INT,vSectorFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemPlacementSupplyStockGetTargetList`(vItemFk INT,vSectorFk INT)
BEGIN
/**
* Devuelve la lista de ubicaciones para itemFk en ese sector. Se utiliza en la preparación previa.
diff --git a/db/routines/vn/procedures/itemRefreshTags.sql b/db/routines/vn/procedures/itemRefreshTags.sql
index 21af20c0f..cec133ad1 100644
--- a/db/routines/vn/procedures/itemRefreshTags.sql
+++ b/db/routines/vn/procedures/itemRefreshTags.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemRefreshTags`(IN vItem INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemRefreshTags`(IN vItem INT)
BEGIN
/**
* Crea la tabla temporal necesaria para el procedimiento item_refreshTags
diff --git a/db/routines/vn/procedures/itemSale_byWeek.sql b/db/routines/vn/procedures/itemSale_byWeek.sql
index bc43b7b16..31235f89a 100644
--- a/db/routines/vn/procedures/itemSale_byWeek.sql
+++ b/db/routines/vn/procedures/itemSale_byWeek.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemSale_byWeek`(vWeek INT, IN vYear INT, vItemFk INT, vWarehouseFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemSale_byWeek`(vWeek INT, IN vYear INT, vItemFk INT, vWarehouseFk INT)
BEGIN
DECLARE vStarted DATE;
diff --git a/db/routines/vn/procedures/itemSaveMin.sql b/db/routines/vn/procedures/itemSaveMin.sql
index 510638348..fb7c7d2f8 100644
--- a/db/routines/vn/procedures/itemSaveMin.sql
+++ b/db/routines/vn/procedures/itemSaveMin.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemSaveMin`(min INT,vBarcode VARCHAR(22))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemSaveMin`(min INT,vBarcode VARCHAR(22))
BEGIN
DECLARE vItemFk INT;
diff --git a/db/routines/vn/procedures/itemSearchShelving.sql b/db/routines/vn/procedures/itemSearchShelving.sql
index 8c2c6c7c8..1fef9b2f6 100644
--- a/db/routines/vn/procedures/itemSearchShelving.sql
+++ b/db/routines/vn/procedures/itemSearchShelving.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemSearchShelving`(`vShelvingFk` VARCHAR(3))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemSearchShelving`(`vShelvingFk` VARCHAR(3))
BEGIN
SELECT p.`column` AS col , p.`row`
FROM vn.shelving s
diff --git a/db/routines/vn/procedures/itemShelvingDelete.sql b/db/routines/vn/procedures/itemShelvingDelete.sql
index f895782d3..a8799af11 100644
--- a/db/routines/vn/procedures/itemShelvingDelete.sql
+++ b/db/routines/vn/procedures/itemShelvingDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingDelete`(vId INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelvingDelete`(vId INT)
BEGIN
DELETE FROM vn.itemShelving WHERE id = vId;
diff --git a/db/routines/vn/procedures/itemShelvingLog_get.sql b/db/routines/vn/procedures/itemShelvingLog_get.sql
index ad67ea5cd..52e7a273f 100644
--- a/db/routines/vn/procedures/itemShelvingLog_get.sql
+++ b/db/routines/vn/procedures/itemShelvingLog_get.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingLog_get`(vShelvingFk VARCHAR(10) )
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelvingLog_get`(vShelvingFk VARCHAR(10) )
BEGIN
/**
diff --git a/db/routines/vn/procedures/itemShelvingMakeFromDate.sql b/db/routines/vn/procedures/itemShelvingMakeFromDate.sql
deleted file mode 100644
index 2dde68829..000000000
--- a/db/routines/vn/procedures/itemShelvingMakeFromDate.sql
+++ /dev/null
@@ -1,58 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingMakeFromDate`(IN `vShelvingFk` VARCHAR(8), IN `vBarcode` VARCHAR(22), IN `vQuantity` INT, IN `vPackagingFk` VARCHAR(10), IN `vGrouping` INT, IN `vPacking` INT, IN `vWarehouseFk` INT, `vCreated` VARCHAR(22))
-BEGIN
-
- DECLARE vItemFk INT;
-
- SELECT vn.barcodeToItem(vBarcode) INTO vItemFk;
-
- SELECT itemFk INTO vItemFk
- FROM vn.buy b
- WHERE b.id = vItemFk;
-
- IF (SELECT COUNT(*) FROM vn.shelving WHERE code = vShelvingFk COLLATE utf8_unicode_ci) = 0 THEN
-
- INSERT IGNORE INTO vn.parking(`code`) VALUES(vShelvingFk);
- INSERT INTO vn.shelving(`code`, parkingFk)
- SELECT vShelvingFk, id
- FROM vn.parking
- WHERE `code` = vShelvingFk COLLATE utf8_unicode_ci;
-
- END IF;
-
- IF (SELECT COUNT(*) FROM vn.itemShelving
- WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk
- AND itemFk = vItemFk
- AND packing = vPacking) = 1 THEN
-
- UPDATE vn.itemShelving
- SET visible = visible+vQuantity,
- created = vCreated
- WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk
- AND itemFk = vItemFk
- AND packing = vPacking;
-
- ELSE
- CALL cache.last_buy_refresh(FALSE);
- INSERT INTO itemShelving( itemFk,
- shelvingFk,
- visible,
- created,
- `grouping`,
- packing,
- packagingFk)
- SELECT vItemFk,
- vShelvingFk,
- vQuantity,
- vCreated,
- IF(vGrouping = 0, IFNULL(b.packing, vPacking), vGrouping) `grouping`,
- IF(vPacking = 0, b.packing, vPacking) packing,
- IF(vPackagingFk = '', b.packagingFk, vPackagingFk) packaging
- FROM vn.item i
- LEFT JOIN cache.last_buy lb ON i.id = lb.item_id AND lb.warehouse_id = vWarehouseFk
- LEFT JOIN vn.buy b ON b.id = lb.buy_id
- WHERE i.id = vItemFk;
- END IF;
-
-END$$
-DELIMITER ;
diff --git a/db/routines/vn/procedures/itemShelvingMatch.sql b/db/routines/vn/procedures/itemShelvingMatch.sql
index 9a10c2b87..850c7907b 100644
--- a/db/routines/vn/procedures/itemShelvingMatch.sql
+++ b/db/routines/vn/procedures/itemShelvingMatch.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingMatch`(vEntryFk INT, vAllTravel BOOLEAN, vFromTimed DATETIME, vToTimed DATETIME)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelvingMatch`(vEntryFk INT, vAllTravel BOOLEAN, vFromTimed DATETIME, vToTimed DATETIME)
BEGIN
DECLARE vTravelFk INT;
diff --git a/db/routines/vn/procedures/itemShelvingPlacementSupplyAdd.sql b/db/routines/vn/procedures/itemShelvingPlacementSupplyAdd.sql
deleted file mode 100644
index c3fc59624..000000000
--- a/db/routines/vn/procedures/itemShelvingPlacementSupplyAdd.sql
+++ /dev/null
@@ -1,20 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingPlacementSupplyAdd`(vItemShelvingFk INT, vItemPlacementSupplyFk INT, vQuantity INT)
-BEGIN
-
- INSERT INTO vn.itemShelvingPlacementSupply( itemShelvingFk,
- itemPlacementSupplyFk,
- quantity,
- userFk)
- VALUES (vItemShelvingFk,
- vItemPlacementSupplyFk,
- vQuantity,
- getUser());
-
- UPDATE vn.itemShelving
- SET visible = visible - vQuantity
- WHERE id = vItemShelvingFk;
-
-
-END$$
-DELIMITER ;
diff --git a/db/routines/vn/procedures/itemShelvingProblem.sql b/db/routines/vn/procedures/itemShelvingProblem.sql
index aed7572ee..06c7a376c 100644
--- a/db/routines/vn/procedures/itemShelvingProblem.sql
+++ b/db/routines/vn/procedures/itemShelvingProblem.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingProblem`(vSectorFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelvingProblem`(vSectorFk INT)
BEGIN
DECLARE vVisibleCache INT;
@@ -38,7 +38,7 @@ BEGIN
AND IFNULL(sub3.transit,0) < s.quantity
AND s.isPicked = FALSE
AND s.reserved = FALSE
- AND t.shipped BETWEEN util.VN_CURDATE() AND MIDNIGHT(util.VN_CURDATE())
+ AND t.shipped BETWEEN util.VN_CURDATE() AND util.midnight()
AND tst.isPreviousPreparable = TRUE
AND t.warehouseFk = vWarehouseFk
AND iss.sectorFk = vSectorFk
diff --git a/db/routines/vn/procedures/itemShelvingRadar.sql b/db/routines/vn/procedures/itemShelvingRadar.sql
index aa95d0503..4bdd0873e 100644
--- a/db/routines/vn/procedures/itemShelvingRadar.sql
+++ b/db/routines/vn/procedures/itemShelvingRadar.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingRadar`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelvingRadar`(
vSectorFk INT
)
BEGIN
diff --git a/db/routines/vn/procedures/itemShelvingRadar_Entry.sql b/db/routines/vn/procedures/itemShelvingRadar_Entry.sql
index c0b4fcda2..637b8f77f 100644
--- a/db/routines/vn/procedures/itemShelvingRadar_Entry.sql
+++ b/db/routines/vn/procedures/itemShelvingRadar_Entry.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingRadar_Entry`(vEntryFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelvingRadar_Entry`(vEntryFk INT)
BEGIN
DECLARE vWarehouseFk INT DEFAULT 1;
diff --git a/db/routines/vn/procedures/itemShelvingRadar_Entry_State_beta.sql b/db/routines/vn/procedures/itemShelvingRadar_Entry_State_beta.sql
index c8b5d4bb4..3a8a3d297 100644
--- a/db/routines/vn/procedures/itemShelvingRadar_Entry_State_beta.sql
+++ b/db/routines/vn/procedures/itemShelvingRadar_Entry_State_beta.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingRadar_Entry_State_beta`(vEntryFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelvingRadar_Entry_State_beta`(vEntryFk INT)
BEGIN
DECLARE vWarehouseFk INT DEFAULT 1;
diff --git a/db/routines/vn/procedures/itemShelvingSale_Add.sql b/db/routines/vn/procedures/itemShelvingSale_Add.sql
index 80eb4efca..c00f25150 100644
--- a/db/routines/vn/procedures/itemShelvingSale_Add.sql
+++ b/db/routines/vn/procedures/itemShelvingSale_Add.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingSale_Add`(vItemShelvingFk INT, vSaleFk INT, vQuantity INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelvingSale_Add`(vItemShelvingFk INT, vSaleFk INT, vQuantity INT)
BEGIN
/**
* Añade línea a itemShelvingSale y regulariza el carro
@@ -18,7 +18,8 @@ BEGIN
getUser());
UPDATE itemShelving
- SET visible = visible - vQuantity
+ SET visible = visible - vQuantity,
+ available = available - vQuantity
WHERE id = vItemShelvingFk;
UPDATE vn.saleTracking
diff --git a/db/routines/vn/procedures/itemShelvingSale_addByCollection.sql b/db/routines/vn/procedures/itemShelvingSale_addByCollection.sql
index a6f9b3e8c..bb915b99a 100644
--- a/db/routines/vn/procedures/itemShelvingSale_addByCollection.sql
+++ b/db/routines/vn/procedures/itemShelvingSale_addByCollection.sql
@@ -1,6 +1,6 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingSale_addByCollection`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelvingSale_addByCollection`(
vCollectionFk INT(11)
)
BEGIN
diff --git a/db/routines/vn/procedures/itemShelvingSale_addBySale.sql b/db/routines/vn/procedures/itemShelvingSale_addBySale.sql
index 454ea877f..6625e89b8 100644
--- a/db/routines/vn/procedures/itemShelvingSale_addBySale.sql
+++ b/db/routines/vn/procedures/itemShelvingSale_addBySale.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingSale_addBySale`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelvingSale_addBySale`(
vSaleFk INT,
vSectorFk INT
)
@@ -48,6 +48,13 @@ proc: BEGIN
RESIGNAL;
END;
+ START TRANSACTION;
+
+ SELECT id INTO vSaleFk
+ FROM sale
+ WHERE id = vSaleFk
+ FOR UPDATE;
+
SELECT MAX(p.pickingOrder), s.quantity - SUM(IFNULL(iss.quantity, 0)), s.quantity
INTO vLastPickingOrder, vOutStanding, vSaleQuantity
FROM sale s
@@ -57,7 +64,8 @@ proc: BEGIN
LEFT JOIN parking p ON p.id = sh.parkingFk
WHERE s.id = vSaleFk;
- IF vOutStanding <= 0 THEN
+ IF vOutStanding <= 0 THEN
+ COMMIT;
LEAVE proc;
END IF;
@@ -75,16 +83,17 @@ proc: BEGIN
WHERE saleFk = vSaleFk;
IF vTotalReservedQuantity <> vSaleQuantity THEN
+ CALL util.debugAdd('itemShelvingSale_addBySale',
+ CONCAT(vSaleFk, ' - ', vSaleQuantity,' - ', vTotalReservedQuantity,'-', vOutStanding,'-', account.myUser_getId()));
+
UPDATE sale
SET quantity = vTotalReservedQuantity
WHERE id = vSaleFk;
END IF;
LEAVE l;
END IF;
-
- START TRANSACTION;
-
- SELECT id INTO vItemShelvingFk
+
+ SELECT id INTO vItemShelvingFk
FROM itemShelving
WHERE id = vItemShelvingFk
FOR UPDATE;
@@ -93,7 +102,8 @@ proc: BEGIN
SET vOutStanding = vOutStanding - vReservedQuantity;
IF vReservedQuantity > 0 THEN
-
+ CALL util.debugAdd('itemShelvingSale_addBySale_reservedQuantity',
+ CONCAT(vSaleFk, ' - ', vReservedQuantity, ' - ', vOutStanding, account.myUser_getId()));
INSERT INTO itemShelvingSale(
itemShelvingFk,
saleFk,
@@ -111,9 +121,8 @@ proc: BEGIN
WHERE id = vItemShelvingFk;
END IF;
-
- COMMIT;
END LOOP;
CLOSE vItemShelvingAvailable;
+ COMMIT;
END$$
DELIMITER ;
\ No newline at end of file
diff --git a/db/routines/vn/procedures/itemShelvingSale_addBySaleGroup.sql b/db/routines/vn/procedures/itemShelvingSale_addBySaleGroup.sql
index 285b9f93f..08d09c63e 100644
--- a/db/routines/vn/procedures/itemShelvingSale_addBySaleGroup.sql
+++ b/db/routines/vn/procedures/itemShelvingSale_addBySaleGroup.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingSale_addBySaleGroup`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelvingSale_addBySaleGroup`(
vSaleGroupFk INT(11)
)
BEGIN
diff --git a/db/routines/vn/procedures/itemShelvingSale_addBySectorCollection.sql b/db/routines/vn/procedures/itemShelvingSale_addBySectorCollection.sql
index 26e661d9a..24bb94b7e 100644
--- a/db/routines/vn/procedures/itemShelvingSale_addBySectorCollection.sql
+++ b/db/routines/vn/procedures/itemShelvingSale_addBySectorCollection.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE
`vn`.`itemShelvingSale_addBySectorCollection`(vSectorCollectionFk INT(11))
BEGIN
/**
@@ -30,6 +30,8 @@ BEGIN
FROM operator
WHERE workerFk = account.myUser_getId();
+ CALL util.debugAdd('itemShelvingSale_addBySectorCollection',CONCAT(vSectorCollectionFk,' - ', account.myUser_getId()));
+
OPEN vSales;
l: LOOP
SET vDone = FALSE;
diff --git a/db/routines/vn/procedures/itemShelvingSale_doReserve.sql b/db/routines/vn/procedures/itemShelvingSale_doReserve.sql
index d38a787a1..bbb060934 100644
--- a/db/routines/vn/procedures/itemShelvingSale_doReserve.sql
+++ b/db/routines/vn/procedures/itemShelvingSale_doReserve.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingSale_doReserve`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelvingSale_doReserve`()
proc: BEGIN
/**
* Genera reservas de la tabla vn.itemShelvingSaleReserve
diff --git a/db/routines/vn/procedures/itemShelvingSale_reallocate.sql b/db/routines/vn/procedures/itemShelvingSale_reallocate.sql
index d5b89c373..3302b908c 100644
--- a/db/routines/vn/procedures/itemShelvingSale_reallocate.sql
+++ b/db/routines/vn/procedures/itemShelvingSale_reallocate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingSale_reallocate`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelvingSale_reallocate`(
vItemShelvingFk INT(10),
vItemFk INT(10),
vSectorFk INT
diff --git a/db/routines/vn/procedures/itemShelvingSale_setPicked.sql b/db/routines/vn/procedures/itemShelvingSale_setPicked.sql
index c1e58a9d1..993ff96f0 100644
--- a/db/routines/vn/procedures/itemShelvingSale_setPicked.sql
+++ b/db/routines/vn/procedures/itemShelvingSale_setPicked.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingSale_setPicked`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelvingSale_setPicked`(
vSaleGroupFk INT(10)
)
BEGIN
diff --git a/db/routines/vn/procedures/itemShelvingSale_setQuantity.sql b/db/routines/vn/procedures/itemShelvingSale_setQuantity.sql
index 9d21e6a6f..cde1b6872 100644
--- a/db/routines/vn/procedures/itemShelvingSale_setQuantity.sql
+++ b/db/routines/vn/procedures/itemShelvingSale_setQuantity.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingSale_setQuantity`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelvingSale_setQuantity`(
vItemShelvingSaleFk INT(10),
vQuantity DECIMAL(10,0),
vIsItemShelvingSaleEmpty BOOLEAN,
diff --git a/db/routines/vn/procedures/itemShelvingSale_unpicked.sql b/db/routines/vn/procedures/itemShelvingSale_unpicked.sql
index 889cadfd0..3b636a7b4 100644
--- a/db/routines/vn/procedures/itemShelvingSale_unpicked.sql
+++ b/db/routines/vn/procedures/itemShelvingSale_unpicked.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingSale_unpicked`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelvingSale_unpicked`(
vSelf INT(11)
)
BEGIN
diff --git a/db/routines/vn/procedures/itemShelving_add.sql b/db/routines/vn/procedures/itemShelving_add.sql
index a1bca5b6c..92d1609e4 100644
--- a/db/routines/vn/procedures/itemShelving_add.sql
+++ b/db/routines/vn/procedures/itemShelving_add.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelving_add`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelving_add`(
vShelvingFk VARCHAR(8),
vBarcode VARCHAR(22),
vQuantity INT,
@@ -46,7 +46,8 @@ BEGIN
AND buyFk = vBuyFk) THEN
UPDATE itemShelving
- SET visible = visible + vQuantity
+ SET visible = visible + vQuantity,
+ available = available + vQuantity
WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk AND itemFk = vItemFk AND packing = vPacking;
ELSE
@@ -68,6 +69,6 @@ BEGIN
id
FROM buy b
WHERE id = vBuyFk;
- END IF;
+ END IF;
END$$
DELIMITER ;
\ No newline at end of file
diff --git a/db/routines/vn/procedures/itemShelving_addByClaim.sql b/db/routines/vn/procedures/itemShelving_addByClaim.sql
index 4ff2955c7..5e7cdf3fc 100644
--- a/db/routines/vn/procedures/itemShelving_addByClaim.sql
+++ b/db/routines/vn/procedures/itemShelving_addByClaim.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelving_addByClaim`(vClaimFk INT, vShelvingFk VARCHAR(3))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelving_addByClaim`(vClaimFk INT, vShelvingFk VARCHAR(3))
BEGIN
/**
* Insert items of claim into itemShelving.
diff --git a/db/routines/vn/procedures/itemShelving_addList.sql b/db/routines/vn/procedures/itemShelving_addList.sql
index 130007de5..05b392485 100644
--- a/db/routines/vn/procedures/itemShelving_addList.sql
+++ b/db/routines/vn/procedures/itemShelving_addList.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelving_addList`(vShelvingFk VARCHAR(3), vList TEXT, vIsChecking BOOL, vWarehouseFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelving_addList`(vShelvingFk VARCHAR(3), vList TEXT, vIsChecking BOOL, vWarehouseFk INT)
BEGIN
/* Recorre cada elemento en la colección vList.
* Si el parámetro isChecking = FALSE, llama a itemShelving_add.
diff --git a/db/routines/vn/procedures/itemShelving_filterBuyer.sql b/db/routines/vn/procedures/itemShelving_filterBuyer.sql
index d4675ea0e..0d67a5f46 100644
--- a/db/routines/vn/procedures/itemShelving_filterBuyer.sql
+++ b/db/routines/vn/procedures/itemShelving_filterBuyer.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelving_filterBuyer`(vBuyerFk INT, vWarehouseFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelving_filterBuyer`(vBuyerFk INT, vWarehouseFk INT)
proc:BEGIN
/**
* Lista de articulos filtrados por comprador
diff --git a/db/routines/vn/procedures/itemShelving_get.sql b/db/routines/vn/procedures/itemShelving_get.sql
index d42446b06..606bb8bd9 100644
--- a/db/routines/vn/procedures/itemShelving_get.sql
+++ b/db/routines/vn/procedures/itemShelving_get.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelving_get`(IN vSelf VARCHAR(8))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelving_get`(IN vSelf VARCHAR(8))
BEGIN
/**
* Lista artículos de itemshelving
diff --git a/db/routines/vn/procedures/itemShelving_getAlternatives.sql b/db/routines/vn/procedures/itemShelving_getAlternatives.sql
index de30d46ac..89176c4f5 100644
--- a/db/routines/vn/procedures/itemShelving_getAlternatives.sql
+++ b/db/routines/vn/procedures/itemShelving_getAlternatives.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelving_getAlternatives`(vShelvingFk VARCHAR(10))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelving_getAlternatives`(vShelvingFk VARCHAR(10))
BEGIN
/**
* Devuelve un listado de posibles ubicaciones alternativas a ubicar los item de la matricula
diff --git a/db/routines/vn/procedures/itemShelving_getInfo.sql b/db/routines/vn/procedures/itemShelving_getInfo.sql
index a5749bd26..f02100e8b 100644
--- a/db/routines/vn/procedures/itemShelving_getInfo.sql
+++ b/db/routines/vn/procedures/itemShelving_getInfo.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelving_getInfo`(vItemFk VARCHAR(22))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelving_getInfo`(vItemFk VARCHAR(22))
BEGIN
/**
* Muestra información realtiva a la ubicación de un item
diff --git a/db/routines/vn/procedures/itemShelving_getItemDetails.sql b/db/routines/vn/procedures/itemShelving_getItemDetails.sql
index b097c2d17..4e641ca72 100644
--- a/db/routines/vn/procedures/itemShelving_getItemDetails.sql
+++ b/db/routines/vn/procedures/itemShelving_getItemDetails.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelving_getItemDetails`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelving_getItemDetails`(
vBarcodeItem INT,
vShelvingFK VARCHAR(10)
)
diff --git a/db/routines/vn/procedures/itemShelving_getSaleDate.sql b/db/routines/vn/procedures/itemShelving_getSaleDate.sql
index a9f9466cf..d8ab6ed0c 100644
--- a/db/routines/vn/procedures/itemShelving_getSaleDate.sql
+++ b/db/routines/vn/procedures/itemShelving_getSaleDate.sql
@@ -1,5 +1,5 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelving_getSaleDate`(vShelvingFk VARCHAR(3))
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelving_getSaleDate`(vShelvingFk VARCHAR(3))
BEGIN
/* Devuelve la mínima fecha en que se necesita cada producto en esa matrícula.
@@ -161,5 +161,5 @@ BEGIN
DROP TEMPORARY TABLE tmp.tStockByDay, tmp.tItems;
-END$$
-DELIMITER ;
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/procedures/itemShelving_inventory.sql b/db/routines/vn/procedures/itemShelving_inventory.sql
index f4b8ae165..b57df02e0 100644
--- a/db/routines/vn/procedures/itemShelving_inventory.sql
+++ b/db/routines/vn/procedures/itemShelving_inventory.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelving_inventory`(vParkingFromFk VARCHAR(8), vParkingToFk VARCHAR(8))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelving_inventory`(vParkingFromFk VARCHAR(8), vParkingToFk VARCHAR(8))
BEGIN
/**
* Devuelve un listado de ubicaciones a revisar
diff --git a/db/routines/vn/procedures/itemShelving_selfConsumption.sql b/db/routines/vn/procedures/itemShelving_selfConsumption.sql
index c974d9903..083d8d74c 100644
--- a/db/routines/vn/procedures/itemShelving_selfConsumption.sql
+++ b/db/routines/vn/procedures/itemShelving_selfConsumption.sql
@@ -1,17 +1,17 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelving_selfConsumption`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelving_selfConsumption`(
vShelvingFk VARCHAR(10) COLLATE utf8_general_ci,
vItemFk INT,
vQuantity INT
)
BEGIN
/**
- * Leave the indicated amount on the shelf
+ * Leave the indicated amount on the shelve
* and create a ticket with the difference.
*
- * @param vShelvingFk id of the shelf where the item is located.
+ * @param vShelvingFk id of the shelve where the item is located.
* @param vItemFk article of which the self-consumption ticket is to be created.
- * @param vQuantity amount that will stay on the shelf
+ * @param vQuantity amount that will stay on the shelve
*/
DECLARE vVisible INT;
DECLARE vClientFk INT;
@@ -80,7 +80,8 @@ BEGIN
WHERE id = vItemFk;
UPDATE itemShelving
- SET visible = IF(id = vItemShelvingFk, vQuantity, 0)
+ SET visible = IF(id = vItemShelvingFk, vQuantity, 0),
+ available = IF(id = vItemShelvingFk, vQuantity, 0)
WHERE shelvingFk = vShelvingFk
AND itemFk = vItemFk;
diff --git a/db/routines/vn/procedures/itemShelving_transfer.sql b/db/routines/vn/procedures/itemShelving_transfer.sql
index 47a9a7cf0..95d70227f 100644
--- a/db/routines/vn/procedures/itemShelving_transfer.sql
+++ b/db/routines/vn/procedures/itemShelving_transfer.sql
@@ -1,48 +1,53 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelving_transfer`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelving_transfer`(
vItemShelvingFk INT,
vShelvingFk VARCHAR(10)
)
BEGIN
/**
- * Transfiere producto de una ubicación a otra, fusionando si coincide el
- * packing y la fecha.
+ * Transfiere producto de una ubicación a otra
+ * fusionando si coincide el packing y la fecha.
*
* @param vItemShelvingFk Identificador de itemShelving
* @param vShelvingFk Identificador de shelving
*/
- DECLARE vNewItemShelvingFk INT DEFAULT 0;
+ DECLARE vNewItemShelvingFk INT;
- SELECT MAX(ish.id)
- INTO vNewItemShelvingFk
+ SELECT MAX(ish.id) INTO vNewItemShelvingFk
FROM itemShelving ish
JOIN (
- SELECT
- itemFk,
- packing,
- created,
- buyFk
+ SELECT itemFk,
+ packing,
+ created,
+ buyFk
FROM itemShelving
WHERE id = vItemShelvingFk
) ish2 ON ish2.itemFk = ish.itemFk
AND ish2.packing = ish.packing
- AND date(ish2.created) = date(ish.created)
+ AND DATE(ish2.created) = DATE(ish.created)
AND ish2.buyFk = ish.buyFk
WHERE ish.shelvingFk = vShelvingFk COLLATE utf8_unicode_ci;
IF vNewItemShelvingFk THEN
UPDATE itemShelving ish
JOIN itemShelving ish2 ON ish2.id = vItemShelvingFk
- SET ish.visible = ish.visible + ish2.visible
+ SET ish.visible = ish.visible + ish2.visible,
+ ish.available = ish.available + ish2.available
WHERE ish.id = vNewItemShelvingFk;
DELETE FROM itemShelving
WHERE id = vItemShelvingFk;
ELSE
- UPDATE itemShelving
- SET shelvingFk = vShelvingFk
- WHERE id = vItemShelvingFk;
+ IF (SELECT EXISTS(SELECT id FROM shelving
+ WHERE code = vShelvingFk COLLATE utf8_unicode_ci)) THEN
+
+ UPDATE itemShelving
+ SET shelvingFk = vShelvingFk
+ WHERE id = vItemShelvingFk;
+ ELSE
+ CALL util.throw('The shelving not exists');
+ END IF;
END IF;
- SELECT true;
+ SELECT TRUE;
END$$
-DELIMITER ;
\ No newline at end of file
+DELIMITER ;
diff --git a/db/routines/vn/procedures/itemShelving_update.sql b/db/routines/vn/procedures/itemShelving_update.sql
index 079add704..28dfc7c12 100644
--- a/db/routines/vn/procedures/itemShelving_update.sql
+++ b/db/routines/vn/procedures/itemShelving_update.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelving_update`(vVisible INT, vPacking INT, vShelf INT ,vGrouping INT )
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelving_update`(vVisible INT, vPacking INT, vShelf INT ,vGrouping INT )
BEGIN
/**
* Actualiza itemShelving.
diff --git a/db/routines/vn/procedures/itemTagMake.sql b/db/routines/vn/procedures/itemTagMake.sql
index 6d34ecb78..79120a6c0 100644
--- a/db/routines/vn/procedures/itemTagMake.sql
+++ b/db/routines/vn/procedures/itemTagMake.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemTagMake`(vItemFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemTagMake`(vItemFk INT)
BEGIN
/* * Crea los tags usando la tabla plantilla itemTag
diff --git a/db/routines/vn/procedures/itemTagReorder.sql b/db/routines/vn/procedures/itemTagReorder.sql
index bba3cfe03..6902b1987 100644
--- a/db/routines/vn/procedures/itemTagReorder.sql
+++ b/db/routines/vn/procedures/itemTagReorder.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemTagReorder`(itemTypeFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemTagReorder`(itemTypeFk INT)
BEGIN
SET @isTriggerDisabled = TRUE;
diff --git a/db/routines/vn/procedures/itemTagReorderByName.sql b/db/routines/vn/procedures/itemTagReorderByName.sql
index 89dc92740..743667912 100644
--- a/db/routines/vn/procedures/itemTagReorderByName.sql
+++ b/db/routines/vn/procedures/itemTagReorderByName.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemTagReorderByName`(vName VARCHAR(255))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemTagReorderByName`(vName VARCHAR(255))
BEGIN
SET @isTriggerDisabled = TRUE;
diff --git a/db/routines/vn/procedures/itemTag_replace.sql b/db/routines/vn/procedures/itemTag_replace.sql
index b32285072..2db6ef524 100644
--- a/db/routines/vn/procedures/itemTag_replace.sql
+++ b/db/routines/vn/procedures/itemTag_replace.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemTag_replace`(vItemFromFk INT, vItemToFk INT, vPicture VARCHAR(100))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemTag_replace`(vItemFromFk INT, vItemToFk INT, vPicture VARCHAR(100))
BEGIN
/* Reemplaza los tags de un artículo por los de otro, así como su imagen
diff --git a/db/routines/vn/procedures/itemTopSeller.sql b/db/routines/vn/procedures/itemTopSeller.sql
index f42cf67cf..beccc6765 100644
--- a/db/routines/vn/procedures/itemTopSeller.sql
+++ b/db/routines/vn/procedures/itemTopSeller.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemTopSeller`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemTopSeller`()
BEGIN
DECLARE vCategoryFk INTEGER;
DECLARE vDone INT DEFAULT FALSE;
diff --git a/db/routines/vn/procedures/itemUpdateTag.sql b/db/routines/vn/procedures/itemUpdateTag.sql
index 59529e2b0..2c41ff63d 100644
--- a/db/routines/vn/procedures/itemUpdateTag.sql
+++ b/db/routines/vn/procedures/itemUpdateTag.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemUpdateTag`(IN vItem BIGINT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemUpdateTag`(IN vItem BIGINT)
BEGIN
diff --git a/db/routines/vn/procedures/item_calcVisible.sql b/db/routines/vn/procedures/item_calcVisible.sql
index 32adfdfa3..814d3add3 100644
--- a/db/routines/vn/procedures/item_calcVisible.sql
+++ b/db/routines/vn/procedures/item_calcVisible.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_calcVisible`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`item_calcVisible`(
vSelf INT,
vWarehouseFk INT
)
diff --git a/db/routines/vn/procedures/stockTraslation.sql b/db/routines/vn/procedures/item_calculateStock.sql
similarity index 71%
rename from db/routines/vn/procedures/stockTraslation.sql
rename to db/routines/vn/procedures/item_calculateStock.sql
index f9175dc2a..976ac10e4 100644
--- a/db/routines/vn/procedures/stockTraslation.sql
+++ b/db/routines/vn/procedures/item_calculateStock.sql
@@ -1,15 +1,13 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`stockTraslation`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`item_calculateStock`(
vDated DATE
)
BEGIN
/**
- * Calcula el stock del almacén de subasta desde FechaInventario hasta vDated
- * sin tener en cuenta las salidas del mismo dia vDated
- * para ver el transporte a reservar
+ * Calculate the stock of the auction warehouse from the inventory date to vDated
*
- * @param vDated Fecha hasta la cual calcula el stock
- * @return tmp.item
+ * @param vDated Date to calculate the stock.
+ * @return tmp.item, tmp.buyUltimate
*/
DECLARE vAuctionWarehouseFk INT;
diff --git a/db/routines/vn/procedures/item_cleanFloramondo.sql b/db/routines/vn/procedures/item_cleanFloramondo.sql
index 080c61b5b..849cfe93d 100644
--- a/db/routines/vn/procedures/item_cleanFloramondo.sql
+++ b/db/routines/vn/procedures/item_cleanFloramondo.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_cleanFloramondo`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`item_cleanFloramondo`()
BEGIN
/**
* Elimina todos los items repetidos de floramondo
diff --git a/db/routines/vn/procedures/item_comparative.sql b/db/routines/vn/procedures/item_comparative.sql
index 2625a87a5..298272708 100644
--- a/db/routines/vn/procedures/item_comparative.sql
+++ b/db/routines/vn/procedures/item_comparative.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_comparative`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`item_comparative`(
vDate DATETIME,
vDayRange TINYINT,
vWarehouseFk TINYINT,
diff --git a/db/routines/vn/procedures/item_deactivateUnused.sql b/db/routines/vn/procedures/item_deactivateUnused.sql
index 68a6b4978..cf8f22500 100644
--- a/db/routines/vn/procedures/item_deactivateUnused.sql
+++ b/db/routines/vn/procedures/item_deactivateUnused.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_deactivateUnused`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`item_deactivateUnused`()
BEGIN
/**
* Cambia a false el campo isActive de la tabla vn.item para todos aquellos
diff --git a/db/routines/vn/procedures/item_devalueA2.sql b/db/routines/vn/procedures/item_devalueA2.sql
index 5b19b1522..d0178f6a7 100644
--- a/db/routines/vn/procedures/item_devalueA2.sql
+++ b/db/routines/vn/procedures/item_devalueA2.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_devalueA2`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`item_devalueA2`(
vSelf INT,
vShelvingFK VARCHAR(10),
vBuyingValue DECIMAL(10,4),
@@ -303,7 +303,8 @@ BEGIN
WHERE id = vTargetItemShelvingFk;
ELSE
UPDATE itemShelving
- SET visible = vCurrentVisible - vQuantity
+ SET visible = vCurrentVisible - vQuantity,
+ available = GREATEST(0, available - vQuantity)
WHERE id = vTargetItemShelvingFk;
END IF;
diff --git a/db/routines/vn/procedures/item_getAtp.sql b/db/routines/vn/procedures/item_getAtp.sql
index 255e38867..3e90a7f58 100644
--- a/db/routines/vn/procedures/item_getAtp.sql
+++ b/db/routines/vn/procedures/item_getAtp.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_getAtp`(vDated DATE)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`item_getAtp`(vDated DATE)
BEGIN
/**
* Calcula el valor mínimo acumulado para cada artículo ordenado por fecha y
diff --git a/db/routines/vn/procedures/item_getBalance.sql b/db/routines/vn/procedures/item_getBalance.sql
index 3a594c81c..4aa589d19 100644
--- a/db/routines/vn/procedures/item_getBalance.sql
+++ b/db/routines/vn/procedures/item_getBalance.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_getBalance`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`item_getBalance`(
vItemFk INT,
vWarehouseFk INT,
vDated DATETIME
diff --git a/db/routines/vn/procedures/item_getInfo.sql b/db/routines/vn/procedures/item_getInfo.sql
index 5cd4fb31e..341142892 100644
--- a/db/routines/vn/procedures/item_getInfo.sql
+++ b/db/routines/vn/procedures/item_getInfo.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_getInfo`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`item_getInfo`(
`vBarcode` VARCHAR(22),
`vWarehouseFk` INT
)
diff --git a/db/routines/vn/procedures/item_getLack.sql b/db/routines/vn/procedures/item_getLack.sql
index e0531e2ac..45a6a6260 100644
--- a/db/routines/vn/procedures/item_getLack.sql
+++ b/db/routines/vn/procedures/item_getLack.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_getLack`(IN vForce BOOLEAN, IN vDays INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`item_getLack`(IN vForce BOOLEAN, IN vDays INT)
BEGIN
/**
* Calcula una tabla con el máximo negativo visible para cada producto y almacen
diff --git a/db/routines/vn/procedures/item_getMinETD.sql b/db/routines/vn/procedures/item_getMinETD.sql
index 3876587fe..62710231b 100644
--- a/db/routines/vn/procedures/item_getMinETD.sql
+++ b/db/routines/vn/procedures/item_getMinETD.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_getMinETD`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`item_getMinETD`()
BEGIN
/* Devuelve una tabla temporal con la primera ETD, para todos los artículos con salida hoy.
diff --git a/db/routines/vn/procedures/item_getMinacum.sql b/db/routines/vn/procedures/item_getMinacum.sql
index 1decf881d..85474fc3f 100644
--- a/db/routines/vn/procedures/item_getMinacum.sql
+++ b/db/routines/vn/procedures/item_getMinacum.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_getMinacum`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`item_getMinacum`(
vWarehouseFk TINYINT,
vDated DATE,
vRange INT,
diff --git a/db/routines/vn/procedures/item_getSimilar.sql b/db/routines/vn/procedures/item_getSimilar.sql
index 72c543b40..56afd92e9 100644
--- a/db/routines/vn/procedures/item_getSimilar.sql
+++ b/db/routines/vn/procedures/item_getSimilar.sql
@@ -1,27 +1,26 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_getSimilar`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`item_getSimilar`(
vSelf INT,
vWarehouseFk INT,
vDated DATE,
- vShowType BOOL
+ vShowType BOOL,
+ vDaysInForward INT
)
BEGIN
/**
-* Propone articulos disponibles ordenados, con la cantidad
+* Propone articulos ordenados, con la cantidad
* de veces usado y segun sus caracteristicas.
*
* @param vSelf Id de artículo
* @param vWarehouseFk Id de almacen
* @param vDated Fecha
* @param vShowType Mostrar tipos
+* @param vDaysInForward Días de alcance para las ventas
*/
DECLARE vAvailableCalcFk INT;
- DECLARE vVisibleCalcFk INT;
- DECLARE vTypeFk INT;
DECLARE vPriority INT DEFAULT 1;
CALL cache.available_refresh(vAvailableCalcFk, FALSE, vWarehouseFk, vDated);
- CALL cache.visible_refresh(vVisibleCalcFk, FALSE, vWarehouseFk);
WITH itemTags AS (
SELECT i.id,
@@ -41,8 +40,25 @@ BEGIN
AND it.priority = vPriority
LEFT JOIN vn.tag t ON t.id = it.tagFk
WHERE i.id = vSelf
+ ),
+ stock AS (
+ SELECT itemFk, SUM(visible) stock
+ FROM vn.itemShelvingStock
+ WHERE warehouseFk = vWarehouseFk
+ GROUP BY itemFk
+ ),
+ sold AS (
+ SELECT SUM(s.quantity) quantity, s.itemFk
+ FROM vn.sale s
+ JOIN vn.ticket t ON t.id = s.ticketFk
+ LEFT JOIN vn.itemShelvingSale iss ON iss.saleFk = s.id
+ WHERE t.shipped >= CURDATE() + INTERVAL vDaysInForward DAY
+ AND iss.saleFk IS NULL
+ AND t.warehouseFk = vWarehouseFk
+ GROUP BY s.itemFk
)
SELECT i.id itemFk,
+ LEAST(CAST(sd.quantity AS INT), sk.stock) advanceable,
i.longName,
i.subName,
i.tag5,
@@ -64,13 +80,13 @@ BEGIN
WHEN b.groupingMode = 'packing' THEN b.packing
ELSE 1
END minQuantity,
- v.visible located,
+ sk.stock located,
b.price2
FROM vn.item i
+ LEFT JOIN sold sd ON sd.itemFk = i.id
JOIN cache.available a ON a.item_id = i.id
AND a.calc_id = vAvailableCalcFk
- LEFT JOIN cache.visible v ON v.item_id = i.id
- AND v.calc_id = vVisibleCalcFk
+ LEFT JOIN stock sk ON sk.itemFk = i.id
LEFT JOIN cache.last_buy lb ON lb.item_id = i.id
AND lb.warehouse_id = vWarehouseFk
LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id
@@ -80,20 +96,21 @@ BEGIN
LEFT JOIN vn.tag t ON t.id = it.tagFk
LEFT JOIN vn.buy b ON b.id = lb.buy_id
JOIN itemTags its
- WHERE a.available > 0
+ WHERE (a.available > 0 OR sd.quantity < sk.stock)
AND (i.typeFk = its.typeFk OR NOT vShowType)
AND i.id <> vSelf
- ORDER BY `counter` DESC,
- (t.name = its.name) DESC,
- (it.value = its.value) DESC,
- (i.tag5 = its.tag5) DESC,
- match5 DESC,
- (i.tag6 = its.tag6) DESC,
- match6 DESC,
- (i.tag7 = its.tag7) DESC,
- match7 DESC,
- (i.tag8 = its.tag8) DESC,
- match8 DESC
+ ORDER BY (a.available > 0) DESC,
+ `counter` DESC,
+ (t.name = its.name) DESC,
+ (it.value = its.value) DESC,
+ (i.tag5 = its.tag5) DESC,
+ match5 DESC,
+ (i.tag6 = its.tag6) DESC,
+ match6 DESC,
+ (i.tag7 = its.tag7) DESC,
+ match7 DESC,
+ (i.tag8 = its.tag8) DESC,
+ match8 DESC
LIMIT 100;
END$$
DELIMITER ;
diff --git a/db/routines/vn/procedures/item_getStock.sql b/db/routines/vn/procedures/item_getStock.sql
index c7df75ef2..8c0eea251 100644
--- a/db/routines/vn/procedures/item_getStock.sql
+++ b/db/routines/vn/procedures/item_getStock.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_getStock`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`item_getStock`(
vWarehouseFk SMALLINT,
vDated DATE,
vItemFk INT
diff --git a/db/routines/vn/procedures/item_multipleBuy.sql b/db/routines/vn/procedures/item_multipleBuy.sql
index 0a08f5015..50a535620 100644
--- a/db/routines/vn/procedures/item_multipleBuy.sql
+++ b/db/routines/vn/procedures/item_multipleBuy.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_multipleBuy`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`item_multipleBuy`(
vDate DATETIME,
vWarehouseFk INT
)
diff --git a/db/routines/vn/procedures/item_multipleBuyByDate.sql b/db/routines/vn/procedures/item_multipleBuyByDate.sql
index d508afca4..115202895 100644
--- a/db/routines/vn/procedures/item_multipleBuyByDate.sql
+++ b/db/routines/vn/procedures/item_multipleBuyByDate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_multipleBuyByDate`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`item_multipleBuyByDate`(
vDated DATETIME,
vWarehouseFk TINYINT(3)
)
diff --git a/db/routines/vn/procedures/item_refreshFromTags.sql b/db/routines/vn/procedures/item_refreshFromTags.sql
index 35f7c74e7..704224993 100644
--- a/db/routines/vn/procedures/item_refreshFromTags.sql
+++ b/db/routines/vn/procedures/item_refreshFromTags.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_refreshFromTags`(vSelf INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`item_refreshFromTags`(vSelf INT)
BEGIN
/**
* Updates item attributes with its corresponding tags.
diff --git a/db/routines/vn/procedures/item_refreshTags.sql b/db/routines/vn/procedures/item_refreshTags.sql
index 84ace0883..188242866 100644
--- a/db/routines/vn/procedures/item_refreshTags.sql
+++ b/db/routines/vn/procedures/item_refreshTags.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_refreshTags`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`item_refreshTags`()
BEGIN
/**
* Update item table, tag "cache" fields
diff --git a/db/routines/vn/procedures/item_saveReference.sql b/db/routines/vn/procedures/item_saveReference.sql
index 52416b637..4a4a5d1d7 100644
--- a/db/routines/vn/procedures/item_saveReference.sql
+++ b/db/routines/vn/procedures/item_saveReference.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_saveReference`(vBarcode VARCHAR(22), vReference VARCHAR(150))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`item_saveReference`(vBarcode VARCHAR(22), vReference VARCHAR(150))
BEGIN
/**
diff --git a/db/routines/vn/procedures/item_setGeneric.sql b/db/routines/vn/procedures/item_setGeneric.sql
index 9a78b1349..6f6600759 100644
--- a/db/routines/vn/procedures/item_setGeneric.sql
+++ b/db/routines/vn/procedures/item_setGeneric.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_setGeneric`(vSelf INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`item_setGeneric`(vSelf INT)
BEGIN
/**
* Asigna el código genérico a un item, salvo que sea un código de item genérico.
diff --git a/db/routines/vn/procedures/item_setVisibleDiscard.sql b/db/routines/vn/procedures/item_setVisibleDiscard.sql
index a44d87333..976cb5014 100644
--- a/db/routines/vn/procedures/item_setVisibleDiscard.sql
+++ b/db/routines/vn/procedures/item_setVisibleDiscard.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_setVisibleDiscard`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`item_setVisibleDiscard`(
vItemFk INT,
vWarehouseFk INT,
vQuantity INT,
diff --git a/db/routines/vn/procedures/item_updatePackingType.sql b/db/routines/vn/procedures/item_updatePackingType.sql
index 12a5e687b..021bab11c 100644
--- a/db/routines/vn/procedures/item_updatePackingType.sql
+++ b/db/routines/vn/procedures/item_updatePackingType.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_updatePackingType`(vItem INT, vItemPackingTypeFk VARCHAR(1))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`item_updatePackingType`(vItem INT, vItemPackingTypeFk VARCHAR(1))
BEGIN
/**
* Update the packing type of an item
diff --git a/db/routines/vn/procedures/item_valuateInventory.sql b/db/routines/vn/procedures/item_valuateInventory.sql
index 5f3131c9f..5642ba812 100644
--- a/db/routines/vn/procedures/item_valuateInventory.sql
+++ b/db/routines/vn/procedures/item_valuateInventory.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_valuateInventory`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`item_valuateInventory`(
vDated DATE,
vItemTypeFk INT,
vItemCategoryFk INT
diff --git a/db/routines/vn/procedures/item_zoneClosure.sql b/db/routines/vn/procedures/item_zoneClosure.sql
index c555e5df2..6b33f1b0a 100644
--- a/db/routines/vn/procedures/item_zoneClosure.sql
+++ b/db/routines/vn/procedures/item_zoneClosure.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_zoneClosure`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`item_zoneClosure`()
BEGIN
/* Devuelve una tabla temporal con la hora minima de un ticket sino tiene el de la zoneClosure y
diff --git a/db/routines/vn/procedures/ledger_doCompensation.sql b/db/routines/vn/procedures/ledger_doCompensation.sql
index 391575bac..c2149a1f1 100644
--- a/db/routines/vn/procedures/ledger_doCompensation.sql
+++ b/db/routines/vn/procedures/ledger_doCompensation.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ledger_doCompensation`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ledger_doCompensation`(
vDated DATE,
vCompensationAccount VARCHAR(10),
vBankFk VARCHAR(10),
diff --git a/db/routines/vn/procedures/ledger_next.sql b/db/routines/vn/procedures/ledger_next.sql
index 0a390ab16..34fbb1cdc 100644
--- a/db/routines/vn/procedures/ledger_next.sql
+++ b/db/routines/vn/procedures/ledger_next.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ledger_next`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ledger_next`(
IN vFiscalYear INT,
OUT vLastBookEntry INT
)
diff --git a/db/routines/vn/procedures/ledger_nextTx.sql b/db/routines/vn/procedures/ledger_nextTx.sql
index 98c157676..0a32861a3 100644
--- a/db/routines/vn/procedures/ledger_nextTx.sql
+++ b/db/routines/vn/procedures/ledger_nextTx.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ledger_nextTx`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ledger_nextTx`(
IN vFiscalYear INT,
OUT vLastBookEntry INT
)
diff --git a/db/routines/vn/procedures/logShow.sql b/db/routines/vn/procedures/logShow.sql
index 836d3b0c4..0aad86095 100644
--- a/db/routines/vn/procedures/logShow.sql
+++ b/db/routines/vn/procedures/logShow.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`logShow`(vOriginFk INT, vEntity VARCHAR(45))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`logShow`(vOriginFk INT, vEntity VARCHAR(45))
BEGIN
/**
* Muestra las acciones realizadas por el usuario
diff --git a/db/routines/vn/procedures/lungSize_generator.sql b/db/routines/vn/procedures/lungSize_generator.sql
index e13e83650..e3f2009e1 100644
--- a/db/routines/vn/procedures/lungSize_generator.sql
+++ b/db/routines/vn/procedures/lungSize_generator.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`lungSize_generator`(vDate DATE)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`lungSize_generator`(vDate DATE)
BEGIN
SET @buildingOrder := 0;
diff --git a/db/routines/vn/procedures/machineWorker_add.sql b/db/routines/vn/procedures/machineWorker_add.sql
index b2a7c7e19..41000f556 100644
--- a/db/routines/vn/procedures/machineWorker_add.sql
+++ b/db/routines/vn/procedures/machineWorker_add.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`machineWorker_add`(vPlate VARCHAR(10), vWorkerFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`machineWorker_add`(vPlate VARCHAR(10), vWorkerFk INT)
BEGIN
/**
diff --git a/db/routines/vn/procedures/machineWorker_getHistorical.sql b/db/routines/vn/procedures/machineWorker_getHistorical.sql
index 47fcec5b6..67b1971a2 100644
--- a/db/routines/vn/procedures/machineWorker_getHistorical.sql
+++ b/db/routines/vn/procedures/machineWorker_getHistorical.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`machineWorker_getHistorical`(vPlate VARCHAR(20), vWorkerFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`machineWorker_getHistorical`(vPlate VARCHAR(20), vWorkerFk INT)
BEGIN
/**
* Obtiene historial de la matrícula vPlate que el trabajador vWorkerFk escanea,
diff --git a/db/routines/vn/procedures/machineWorker_update.sql b/db/routines/vn/procedures/machineWorker_update.sql
index 064aa8931..f1a6e40b5 100644
--- a/db/routines/vn/procedures/machineWorker_update.sql
+++ b/db/routines/vn/procedures/machineWorker_update.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`machineWorker_update`(vPlate VARCHAR(10), vWorkerFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`machineWorker_update`(vPlate VARCHAR(10), vWorkerFk INT)
BEGIN
/**
diff --git a/db/routines/vn/procedures/machine_getWorkerPlate.sql b/db/routines/vn/procedures/machine_getWorkerPlate.sql
index 4a50e0334..cbb71c4cf 100644
--- a/db/routines/vn/procedures/machine_getWorkerPlate.sql
+++ b/db/routines/vn/procedures/machine_getWorkerPlate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`machine_getWorkerPlate`(vWorkerFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`machine_getWorkerPlate`(vWorkerFk INT)
BEGIN
/**
* Selecciona la matrícula del vehículo del workerfk
diff --git a/db/routines/vn/procedures/mail_insert.sql b/db/routines/vn/procedures/mail_insert.sql
index 5c5c2e9fd..8af84e145 100644
--- a/db/routines/vn/procedures/mail_insert.sql
+++ b/db/routines/vn/procedures/mail_insert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`mail_insert`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`mail_insert`(
vReceiver VARCHAR(255),
vReplyTo VARCHAR(50),
vSubject VARCHAR(100),
diff --git a/db/routines/vn/procedures/makeNewItem.sql b/db/routines/vn/procedures/makeNewItem.sql
index 5995f43b7..6e5c5b244 100644
--- a/db/routines/vn/procedures/makeNewItem.sql
+++ b/db/routines/vn/procedures/makeNewItem.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`makeNewItem`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`makeNewItem`()
BEGIN
DECLARE newItemFk INT;
diff --git a/db/routines/vn/procedures/makePCSGraf.sql b/db/routines/vn/procedures/makePCSGraf.sql
index 31b4a42e7..7fbef5ec0 100644
--- a/db/routines/vn/procedures/makePCSGraf.sql
+++ b/db/routines/vn/procedures/makePCSGraf.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`makePCSGraf`(vDated DATE)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`makePCSGraf`(vDated DATE)
BEGIN
diff --git a/db/routines/vn/procedures/manaSpellersRequery.sql b/db/routines/vn/procedures/manaSpellersRequery.sql
index 30b91b4f1..4bb64d454 100644
--- a/db/routines/vn/procedures/manaSpellersRequery.sql
+++ b/db/routines/vn/procedures/manaSpellersRequery.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`manaSpellersRequery`(vWorkerFk INTEGER)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`manaSpellersRequery`(vWorkerFk INTEGER)
`whole_proc`:
BEGIN
/**
diff --git a/db/routines/vn/procedures/multipleInventory.sql b/db/routines/vn/procedures/multipleInventory.sql
index 99fb92cc8..c051706b7 100644
--- a/db/routines/vn/procedures/multipleInventory.sql
+++ b/db/routines/vn/procedures/multipleInventory.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`multipleInventory`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`multipleInventory`(
vDate DATE,
vWarehouseFk TINYINT,
vMaxDays TINYINT
diff --git a/db/routines/vn/procedures/mysqlConnectionsSorter_kill.sql b/db/routines/vn/procedures/mysqlConnectionsSorter_kill.sql
index 129b356f2..0dbe34bdd 100644
--- a/db/routines/vn/procedures/mysqlConnectionsSorter_kill.sql
+++ b/db/routines/vn/procedures/mysqlConnectionsSorter_kill.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`mysqlConnectionsSorter_kill`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`mysqlConnectionsSorter_kill`()
BEGIN
/**
diff --git a/db/routines/vn/procedures/mysqlPreparedCount_check.sql b/db/routines/vn/procedures/mysqlPreparedCount_check.sql
index b0c78946d..c388036a5 100644
--- a/db/routines/vn/procedures/mysqlPreparedCount_check.sql
+++ b/db/routines/vn/procedures/mysqlPreparedCount_check.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`mysqlPreparedCount_check`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`mysqlPreparedCount_check`()
BEGIN
DECLARE vPreparedCount INTEGER;
diff --git a/db/routines/vn/procedures/nextShelvingCodeMake.sql b/db/routines/vn/procedures/nextShelvingCodeMake.sql
index d76d6276b..5fc90beac 100644
--- a/db/routines/vn/procedures/nextShelvingCodeMake.sql
+++ b/db/routines/vn/procedures/nextShelvingCodeMake.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`nextShelvingCodeMake`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`nextShelvingCodeMake`()
BEGIN
DECLARE newShelving VARCHAR(3);
diff --git a/db/routines/vn/procedures/observationAdd.sql b/db/routines/vn/procedures/observationAdd.sql
index 960cf0bfe..98935436c 100644
--- a/db/routines/vn/procedures/observationAdd.sql
+++ b/db/routines/vn/procedures/observationAdd.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`observationAdd`(vOriginFk INT, vTableCode VARCHAR(45), vDescription TEXT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`observationAdd`(vOriginFk INT, vTableCode VARCHAR(45), vDescription TEXT)
BEGIN
/**
* Guarda las observaciones realizadas por el usuario
diff --git a/db/routines/vn/procedures/orderCreate.sql b/db/routines/vn/procedures/orderCreate.sql
index 8f732dad6..87f98673b 100644
--- a/db/routines/vn/procedures/orderCreate.sql
+++ b/db/routines/vn/procedures/orderCreate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`orderCreate`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`orderCreate`(
vLanded DATE,
vAgencyMode INT,
vAddress INT,
diff --git a/db/routines/vn/procedures/orderDelete.sql b/db/routines/vn/procedures/orderDelete.sql
index 4264191da..95f800395 100644
--- a/db/routines/vn/procedures/orderDelete.sql
+++ b/db/routines/vn/procedures/orderDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`orderDelete`(IN vId INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`orderDelete`(IN vId INT)
BEGIN
DELETE FROM hedera.`order` where id = vId;
diff --git a/db/routines/vn/procedures/orderListCreate.sql b/db/routines/vn/procedures/orderListCreate.sql
index 12396ea90..aa7d1284d 100644
--- a/db/routines/vn/procedures/orderListCreate.sql
+++ b/db/routines/vn/procedures/orderListCreate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`orderListCreate`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`orderListCreate`(
vLanded DATE,
vAgencyMode INT,
vAddress INT,
diff --git a/db/routines/vn/procedures/orderListVolume.sql b/db/routines/vn/procedures/orderListVolume.sql
index 6eb641f83..946f20d95 100644
--- a/db/routines/vn/procedures/orderListVolume.sql
+++ b/db/routines/vn/procedures/orderListVolume.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`orderListVolume`(IN vOrderId INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`orderListVolume`(IN vOrderId INT)
BEGIN
SELECT
diff --git a/db/routines/vn/procedures/packingListSwitch.sql b/db/routines/vn/procedures/packingListSwitch.sql
index 0883a7b6d..47009b007 100644
--- a/db/routines/vn/procedures/packingListSwitch.sql
+++ b/db/routines/vn/procedures/packingListSwitch.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`packingListSwitch`(saleFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`packingListSwitch`(saleFk INT)
BEGIN
DECLARE valueFk INT;
diff --git a/db/routines/vn/procedures/packingSite_startCollection.sql b/db/routines/vn/procedures/packingSite_startCollection.sql
index 53edd89f1..6c613f5db 100644
--- a/db/routines/vn/procedures/packingSite_startCollection.sql
+++ b/db/routines/vn/procedures/packingSite_startCollection.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`packingSite_startCollection`(vSelf INT, vTicketFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`packingSite_startCollection`(vSelf INT, vTicketFk INT)
proc: BEGIN
/**
* @param vSelf packingSite id
diff --git a/db/routines/vn/procedures/parking_add.sql b/db/routines/vn/procedures/parking_add.sql
index 17772424e..38d974eb0 100644
--- a/db/routines/vn/procedures/parking_add.sql
+++ b/db/routines/vn/procedures/parking_add.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`parking_add`(vFromColumn INT, vToColumn INT, vFromRow INT, vToRow INT, vSectorFk INT, vIsLetterMode BOOLEAN)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`parking_add`(vFromColumn INT, vToColumn INT, vFromRow INT, vToRow INT, vSectorFk INT, vIsLetterMode BOOLEAN)
BEGIN
DECLARE vColumn INT;
diff --git a/db/routines/vn/procedures/parking_algemesi.sql b/db/routines/vn/procedures/parking_algemesi.sql
index 6ea13193d..b9087f57a 100644
--- a/db/routines/vn/procedures/parking_algemesi.sql
+++ b/db/routines/vn/procedures/parking_algemesi.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`parking_algemesi`(vFromRow INT, vToRow INT, vSectorFk INT, vLetter VARCHAR(1), vPickingOrder INT, vTrolleysByLine INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`parking_algemesi`(vFromRow INT, vToRow INT, vSectorFk INT, vLetter VARCHAR(1), vPickingOrder INT, vTrolleysByLine INT)
BEGIN
DECLARE vRow INT;
diff --git a/db/routines/vn/procedures/parking_new.sql b/db/routines/vn/procedures/parking_new.sql
index 327e3a4b0..ba7101828 100644
--- a/db/routines/vn/procedures/parking_new.sql
+++ b/db/routines/vn/procedures/parking_new.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`parking_new`(vStart INT, vEnd INT, vSectorFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`parking_new`(vStart INT, vEnd INT, vSectorFk INT)
BEGIN
DECLARE vRow INT;
diff --git a/db/routines/vn/procedures/parking_setOrder.sql b/db/routines/vn/procedures/parking_setOrder.sql
index 241f855f7..26c601abd 100644
--- a/db/routines/vn/procedures/parking_setOrder.sql
+++ b/db/routines/vn/procedures/parking_setOrder.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`parking_setOrder`(vWarehouseFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`parking_setOrder`(vWarehouseFk INT)
BEGIN
/*
diff --git a/db/routines/vn/procedures/payment_add.sql b/db/routines/vn/procedures/payment_add.sql
index 061a75848..769b72241 100644
--- a/db/routines/vn/procedures/payment_add.sql
+++ b/db/routines/vn/procedures/payment_add.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`payment_add`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`payment_add`(
vDated DATE,
vSupplierFk INT,
vAmount DOUBLE,
diff --git a/db/routines/vn/procedures/prepareClientList.sql b/db/routines/vn/procedures/prepareClientList.sql
index 486152fd6..d4576999c 100644
--- a/db/routines/vn/procedures/prepareClientList.sql
+++ b/db/routines/vn/procedures/prepareClientList.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`prepareClientList`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`prepareClientList`()
BEGIN
/*
diff --git a/db/routines/vn/procedures/prepareTicketList.sql b/db/routines/vn/procedures/prepareTicketList.sql
index 29c95cc9f..7c44bb994 100644
--- a/db/routines/vn/procedures/prepareTicketList.sql
+++ b/db/routines/vn/procedures/prepareTicketList.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`prepareTicketList`(vStartingDate DATETIME, vEndingDate DATETIME)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`prepareTicketList`(vStartingDate DATETIME, vEndingDate DATETIME)
BEGIN
DROP TEMPORARY TABLE IF EXISTS tmp.productionTicket;
CREATE TEMPORARY TABLE tmp.productionTicket
diff --git a/db/routines/vn/procedures/previousSticker_get.sql b/db/routines/vn/procedures/previousSticker_get.sql
index 05f7de250..ad3dbd1c4 100644
--- a/db/routines/vn/procedures/previousSticker_get.sql
+++ b/db/routines/vn/procedures/previousSticker_get.sql
@@ -1,58 +1,64 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`previousSticker_get`(vSaleGroupFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`previousSticker_get`(
+ vSaleGroupFk INT
+)
BEGIN
/**
* Devuelve los campos a imprimir en una etiqueta de preparación previa.
- * Actualiza el valor de vn.saleGroup.parkingFk en el caso de que exista un
+ * Actualiza el valor de saleGroup.parkingFk en el caso de que exista un
* saleGroup del mismo ticket con parking, del mismo sector, para que todos se
* pongan juntos.
*
- * @param vSaleGroupFk Identificador de vn.saleGroup
+ * @param vSaleGroupFk Identificador de saleGroup
*/
DECLARE vTicketFk INT;
DECLARE vParkingFk INT;
DECLARE vSectorFk INT;
+ DECLARE vTicketLines INT;
- SELECT s.ticketFk
- INTO vTicketFk
- FROM vn.saleGroupDetail sgd
- JOIN vn.sale s ON s.id = sgd.saleFk
- WHERE sgd.saleGroupFk = vSaleGroupFk
- LIMIT 1;
+ WITH ticketData AS(
+ SELECT DISTINCT s.ticketFk
+ FROM vn.saleGroupDetail sgd
+ JOIN vn.sale s ON s.id = sgd.saleFk
+ WHERE sgd.saleGroupFk = vSaleGroupFk
+ )
+ SELECT COUNT(*), s.ticketFk INTO vTicketLines, vTicketFk
+ FROM vn.sale s
+ JOIN ticketData td ON td.ticketFk = s.ticketFk;
SELECT sg.parkingFk, sc.sectorFk
INTO vParkingFk, vSectorFk
- FROM vn.saleGroup sg
- JOIN vn.sectorCollectionSaleGroup scsg ON scsg.saleGroupFk = sg.id
- JOIN vn.sectorCollection sc ON sc.id = scsg.sectorCollectionFk
- JOIN vn.saleGroupDetail sgd ON sgd.saleGroupFk = sg.id
- JOIN vn.sale s ON s.id = sgd.saleFk
+ FROM saleGroup sg
+ JOIN sectorCollectionSaleGroup scsg ON scsg.saleGroupFk = sg.id
+ JOIN sectorCollection sc ON sc.id = scsg.sectorCollectionFk
+ JOIN saleGroupDetail sgd ON sgd.saleGroupFk = sg.id
+ JOIN sale s ON s.id = sgd.saleFk
WHERE s.ticketFk = vTicketFk
AND sg.parkingFk IS NOT NULL
LIMIT 1;
- UPDATE vn.saleGroup sg
+ UPDATE saleGroup sg
SET sg.parkingFk = vParkingFk
WHERE sg.id = vSaleGroupFk
AND sg.sectorFk = vSectorFk;
SELECT sgd.saleGroupFk,
t.id ticketFk,
- p.code as location,
- t.observations,
+ COUNT(*) previousLines,
IF(HOUR(t.shipped), HOUR(t.shipped), HOUR(z.`hour`)) shippingHour,
IF(MINUTE(t.shipped), MINUTE(t.shipped), MINUTE(z.`hour`)) shippingMinute ,
IFNULL(MAX(i.itemPackingTypeFk),'H') itemPackingTypeFk ,
- count(*) items,
+ vTicketLines ticketLines,
+ p.code `location`,
sc.description sector
- FROM vn.sale s
- JOIN vn.item i ON i.id = s.itemFk
- JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id
- JOIN vn.saleGroup sg ON sg.id = sgd.saleGroupFk
- JOIN vn.sector sc ON sc.id = sg.sectorFk
- JOIN vn.ticket t ON t.id = s.ticketFk
- LEFT JOIN vn.parking p ON p.id = sg.parkingFk
- LEFT JOIN vn.`zone` z ON z.id = t.zoneFk
+ FROM sale s
+ JOIN item i ON i.id = s.itemFk
+ JOIN saleGroupDetail sgd ON sgd.saleFk = s.id
+ JOIN saleGroup sg ON sg.id = sgd.saleGroupFk
+ JOIN sector sc ON sc.id = sg.sectorFk
+ JOIN ticket t ON t.id = s.ticketFk
+ LEFT JOIN parking p ON p.id = sg.parkingFk
+ LEFT JOIN `zone` z ON z.id = t.zoneFk
WHERE sgd.saleGroupFk = vSaleGroupFk;
END$$
DELIMITER ;
diff --git a/db/routines/vn/procedures/printer_checkSector.sql b/db/routines/vn/procedures/printer_checkSector.sql
index 40728a81a..bb8ad9d85 100644
--- a/db/routines/vn/procedures/printer_checkSector.sql
+++ b/db/routines/vn/procedures/printer_checkSector.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`printer_checkSector`(vLabelerFk tinyint(3) unsigned, vSector INT(11))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`printer_checkSector`(vLabelerFk tinyint(3) unsigned, vSector INT(11))
BEGIN
/**
* Comprueba si la impresora pertenece al sector
diff --git a/db/routines/vn/procedures/productionControl.sql b/db/routines/vn/procedures/productionControl.sql
index 84717a19a..1d206e20d 100644
--- a/db/routines/vn/procedures/productionControl.sql
+++ b/db/routines/vn/procedures/productionControl.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`productionControl`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`productionControl`(
vWarehouseFk INT,
vScopeDays INT
)
@@ -15,13 +15,11 @@ proc: BEGIN
DECLARE vEndingDate DATETIME;
DECLARE vIsTodayRelative BOOLEAN;
- SELECT util.dayEnd(util.VN_CURDATE()) + INTERVAL LEAST(vScopeDays, maxProductionScopeDays) DAY
- INTO vEndingDate
- FROM productionConfig;
-
- SELECT isTodayRelative INTO vIsTodayRelative
- FROM worker
- WHERE id = getUser(); -- Cambiar por account.myUser_getId(), falta dar permisos
+ SELECT w.isTodayRelative, util.dayEnd(util.VN_CURDATE()) + INTERVAL LEAST(vScopeDays, pc.maxProductionScopeDays) DAY
+ INTO vIsTodayRelative,vEndingDate
+ FROM worker w
+ JOIN productionConfig pc
+ WHERE w.id = account.myUser_getId();
CALL prepareTicketList(util.yesterday(), vEndingDate);
@@ -211,8 +209,6 @@ proc: BEGIN
salesInParkingCount INT DEFAULT 0)
ENGINE = MEMORY;
- -- Insertamos todos los tickets que tienen productos parkineados
- -- en sectores de previa, segun el sector
CREATE OR REPLACE TEMPORARY TABLE tItemShelvingStock
(PRIMARY KEY(itemFk, sectorFk))
ENGINE = MEMORY
@@ -245,7 +241,6 @@ proc: BEGIN
AND s.quantity > 0
GROUP BY pb.ticketFk;
- -- Se calcula la cantidad de productos que estan ya preparados porque su saleGroup está aparcado
UPDATE tmp.ticketWithPrevia twp
JOIN (
SELECT pb.ticketFk, COUNT(DISTINCT s.id) salesInParkingCount
@@ -259,12 +254,27 @@ proc: BEGIN
) sub ON twp.ticketFk = sub.ticketFk
SET twp.salesInParkingCount = sub.salesInParkingCount;
- -- Marcamos como pendientes aquellos que no coinciden las cantidades
UPDATE tmp.productionBuffer pb
JOIN tmp.ticketWithPrevia twp ON twp.ticketFk = pb.ticketFk
SET pb.previousWithoutParking = TRUE
WHERE twp.salesCount > twp.salesInParkingCount;
+ -- hasPlantTray
+ ALTER TABLE tmp.productionBuffer
+ ADD hasPlantTray BOOL DEFAULT FALSE;
+
+ UPDATE tmp.productionBuffer pb
+ JOIN sale s ON s.ticketFk = pb.ticketFk
+ JOIN item i ON i.id = s.itemFk
+ JOIN cache.last_buy lb ON lb.warehouse_id = vWarehouseFk
+ AND lb.item_id = s.itemFk
+ JOIN buy b ON b.id = lb.buy_id
+ JOIN packaging p ON p.id = b.packagingFk
+ SET pb.hasPlantTray = TRUE
+ WHERE p.isPlantTray
+ AND s.quantity >= b.packing
+ AND pb.isOwn;
+
DROP TEMPORARY TABLE
tmp.productionTicket,
tmp.ticket,
diff --git a/db/routines/vn/procedures/productionError_add.sql b/db/routines/vn/procedures/productionError_add.sql
index e29accac9..e86b5ff0d 100644
--- a/db/routines/vn/procedures/productionError_add.sql
+++ b/db/routines/vn/procedures/productionError_add.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`productionError_add`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`productionError_add`()
BEGIN
DECLARE vDatedFrom DATETIME;
DECLARE vDatedTo DATETIME;
diff --git a/db/routines/vn/procedures/productionError_addCheckerPackager.sql b/db/routines/vn/procedures/productionError_addCheckerPackager.sql
index dd75f797b..7968aec38 100644
--- a/db/routines/vn/procedures/productionError_addCheckerPackager.sql
+++ b/db/routines/vn/procedures/productionError_addCheckerPackager.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`productionError_addCheckerPackager`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`productionError_addCheckerPackager`(
vDatedFrom DATETIME,
vDatedTo DATETIME,
vRol VARCHAR(50))
diff --git a/db/routines/vn/procedures/productionSectorList.sql b/db/routines/vn/procedures/productionSectorList.sql
index e1445ca52..ed6eff147 100644
--- a/db/routines/vn/procedures/productionSectorList.sql
+++ b/db/routines/vn/procedures/productionSectorList.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`productionSectorList`(vSectorFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`productionSectorList`(vSectorFk INT)
BEGIN
/**
* Devuelve el listado de sale que se puede preparar en previa para ese sector
@@ -55,7 +55,6 @@ BEGIN
i.itemPackingTypeFk,
isa.`size`,
isa.Estado,
- isa.sectorProdPriority,
isa.available,
isa.sectorFk,
isa.matricula,
diff --git a/db/routines/vn/procedures/raidUpdate.sql b/db/routines/vn/procedures/raidUpdate.sql
index 703c14e5c..71352868e 100644
--- a/db/routines/vn/procedures/raidUpdate.sql
+++ b/db/routines/vn/procedures/raidUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`raidUpdate`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`raidUpdate`()
BEGIN
/**
* Actualiza el travel de las entradas de redadas
diff --git a/db/routines/vn/procedures/rangeDateInfo.sql b/db/routines/vn/procedures/rangeDateInfo.sql
index 502248686..a748680b0 100644
--- a/db/routines/vn/procedures/rangeDateInfo.sql
+++ b/db/routines/vn/procedures/rangeDateInfo.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`rangeDateInfo`(vStarted DATE, vEnded DATE)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`rangeDateInfo`(vStarted DATE, vEnded DATE)
BEGIN
/**
* Crea una tabla temporal con las fechas
diff --git a/db/routines/vn/procedures/rateView.sql b/db/routines/vn/procedures/rateView.sql
index d840aa9d5..a92c2bd5b 100644
--- a/db/routines/vn/procedures/rateView.sql
+++ b/db/routines/vn/procedures/rateView.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`rateView`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`rateView`()
BEGIN
/**
* Muestra información sobre tasas de cambio de Dolares
diff --git a/db/routines/vn/procedures/rate_getPrices.sql b/db/routines/vn/procedures/rate_getPrices.sql
index c82ad918e..9674dbacf 100644
--- a/db/routines/vn/procedures/rate_getPrices.sql
+++ b/db/routines/vn/procedures/rate_getPrices.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`rate_getPrices`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`rate_getPrices`(
vDated DATE,
vWarehouseFk INT
)
diff --git a/db/routines/vn/procedures/recipe_Plaster.sql b/db/routines/vn/procedures/recipe_Plaster.sql
index 18fdf55c8..c77c03ef2 100644
--- a/db/routines/vn/procedures/recipe_Plaster.sql
+++ b/db/routines/vn/procedures/recipe_Plaster.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`recipe_Plaster`(vItemFk INT, vTicketFk INT, vQuantity INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`recipe_Plaster`(vItemFk INT, vTicketFk INT, vQuantity INT)
BEGIN
DECLARE vLastCost DECIMAL(10,2);
diff --git a/db/routines/vn/procedures/remittance_calc.sql b/db/routines/vn/procedures/remittance_calc.sql
index ed0a18662..ee0a65fcd 100644
--- a/db/routines/vn/procedures/remittance_calc.sql
+++ b/db/routines/vn/procedures/remittance_calc.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`remittance_calc`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`remittance_calc`(
vDated DATE
)
BEGIN
diff --git a/db/routines/vn/procedures/reportLabelCollection_get.sql b/db/routines/vn/procedures/reportLabelCollection_get.sql
index f3bcbfa28..fc6faf471 100644
--- a/db/routines/vn/procedures/reportLabelCollection_get.sql
+++ b/db/routines/vn/procedures/reportLabelCollection_get.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`reportLabelCollection_get`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`reportLabelCollection_get`(
vParam INT,
vLabelCount INT
)
diff --git a/db/routines/vn/procedures/report_print.sql b/db/routines/vn/procedures/report_print.sql
index 5d399dedf..a5e08538e 100644
--- a/db/routines/vn/procedures/report_print.sql
+++ b/db/routines/vn/procedures/report_print.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`report_print`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`report_print`(
vReportName VARCHAR(100),
vPrinterFk INT,
vUserFk INT,
diff --git a/db/routines/vn/procedures/routeGuessPriority.sql b/db/routines/vn/procedures/routeGuessPriority.sql
index 7208fcbcf..b5445bc50 100644
--- a/db/routines/vn/procedures/routeGuessPriority.sql
+++ b/db/routines/vn/procedures/routeGuessPriority.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`routeGuessPriority`(IN vRuta INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`routeGuessPriority`(IN vRuta INT)
BEGIN
/* Usa los valores del ultimo año para adivinar el orden de los tickets en la ruta
* vRuta id ruta
diff --git a/db/routines/vn/procedures/routeInfo.sql b/db/routines/vn/procedures/routeInfo.sql
index 1f25b1429..bcfba3f51 100644
--- a/db/routines/vn/procedures/routeInfo.sql
+++ b/db/routines/vn/procedures/routeInfo.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`routeInfo`(vRouteFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`routeInfo`(vRouteFk INT)
BEGIN
DECLARE vPackages INT;
diff --git a/db/routines/vn/procedures/routeMonitor_calculate.sql b/db/routines/vn/procedures/routeMonitor_calculate.sql
index 463c176ff..c9a7a9ccf 100644
--- a/db/routines/vn/procedures/routeMonitor_calculate.sql
+++ b/db/routines/vn/procedures/routeMonitor_calculate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`routeMonitor_calculate`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`routeMonitor_calculate`(
vDate DATE,
vDaysAgo INT
)
diff --git a/db/routines/vn/procedures/routeSetOk.sql b/db/routines/vn/procedures/routeSetOk.sql
index 86b32fe7b..bd77c7c14 100644
--- a/db/routines/vn/procedures/routeSetOk.sql
+++ b/db/routines/vn/procedures/routeSetOk.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`routeSetOk`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`routeSetOk`(
vRouteFk INT)
BEGIN
diff --git a/db/routines/vn/procedures/routeUpdateM3.sql b/db/routines/vn/procedures/routeUpdateM3.sql
index 7dbf5a194..a3f78bfa3 100644
--- a/db/routines/vn/procedures/routeUpdateM3.sql
+++ b/db/routines/vn/procedures/routeUpdateM3.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`routeUpdateM3`(vRoute INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`routeUpdateM3`(vRoute INT)
BEGIN
/**
* @deprecated Use vn.route_updateM3()
diff --git a/db/routines/vn/procedures/route_calcCommission.sql b/db/routines/vn/procedures/route_calcCommission.sql
index 63f702bee..7c911a5e2 100644
--- a/db/routines/vn/procedures/route_calcCommission.sql
+++ b/db/routines/vn/procedures/route_calcCommission.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`route_calcCommission`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`route_calcCommission`(
vSelf INT
)
BEGIN
diff --git a/db/routines/vn/procedures/route_doRecalc.sql b/db/routines/vn/procedures/route_doRecalc.sql
index 365796f7e..03faa8df1 100644
--- a/db/routines/vn/procedures/route_doRecalc.sql
+++ b/db/routines/vn/procedures/route_doRecalc.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`route_doRecalc`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`route_doRecalc`()
proc: BEGIN
/**
* Recalculates modified route.
diff --git a/db/routines/vn/procedures/route_getTickets.sql b/db/routines/vn/procedures/route_getTickets.sql
index 55b08208f..136c8f520 100644
--- a/db/routines/vn/procedures/route_getTickets.sql
+++ b/db/routines/vn/procedures/route_getTickets.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`route_getTickets`(vRouteFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`route_getTickets`(vRouteFk INT)
BEGIN
/**
* Pasado un RouteFk devuelve la información
diff --git a/db/routines/vn/procedures/route_updateM3.sql b/db/routines/vn/procedures/route_updateM3.sql
index 98fdae5dd..f6842bf1d 100644
--- a/db/routines/vn/procedures/route_updateM3.sql
+++ b/db/routines/vn/procedures/route_updateM3.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`route_updateM3`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`route_updateM3`(
vSelf INT
)
BEGIN
diff --git a/db/routines/vn/procedures/saleBuy_Add.sql b/db/routines/vn/procedures/saleBuy_Add.sql
index 2f689ad2a..7ad1f051d 100644
--- a/db/routines/vn/procedures/saleBuy_Add.sql
+++ b/db/routines/vn/procedures/saleBuy_Add.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`saleBuy_Add`(vSaleFk INT, vBuyFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`saleBuy_Add`(vSaleFk INT, vBuyFk INT)
BEGIN
/* Añade un registro a la tabla saleBuy en el caso de que sea posible mantener la trazabilidad
diff --git a/db/routines/vn/procedures/saleGroup_add.sql b/db/routines/vn/procedures/saleGroup_add.sql
index 63e3bdedd..2057c4ac8 100644
--- a/db/routines/vn/procedures/saleGroup_add.sql
+++ b/db/routines/vn/procedures/saleGroup_add.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`saleGroup_add`(vSectorFk INT,vTicketFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`saleGroup_add`(vSectorFk INT,vTicketFk INT)
BEGIN
/**
* Añade un nuevo registro a la tabla y devuelve su id.
diff --git a/db/routines/vn/procedures/saleGroup_setParking.sql b/db/routines/vn/procedures/saleGroup_setParking.sql
index fffe5e154..889583c82 100644
--- a/db/routines/vn/procedures/saleGroup_setParking.sql
+++ b/db/routines/vn/procedures/saleGroup_setParking.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`saleGroup_setParking`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`saleGroup_setParking`(
vSaleGroupFk VARCHAR(8),
vParkingFk INT
)
diff --git a/db/routines/vn/procedures/saleMistake_Add.sql b/db/routines/vn/procedures/saleMistake_Add.sql
index cc174993e..93db28bb9 100644
--- a/db/routines/vn/procedures/saleMistake_Add.sql
+++ b/db/routines/vn/procedures/saleMistake_Add.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`saleMistake_Add`(vSaleFk INT, vUserFk INT, vTypeFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`saleMistake_Add`(vSaleFk INT, vUserFk INT, vTypeFk INT)
BEGIN
INSERT INTO vn.saleMistake(saleFk, userFk, typeFk)
diff --git a/db/routines/vn/procedures/salePreparingList.sql b/db/routines/vn/procedures/salePreparingList.sql
index ae3a267f3..9964c3e87 100644
--- a/db/routines/vn/procedures/salePreparingList.sql
+++ b/db/routines/vn/procedures/salePreparingList.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`salePreparingList`(IN vTicketFk BIGINT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`salePreparingList`(IN vTicketFk BIGINT)
BEGIN
/**
* Devuelve un listado con las lineas de vn.sale y los distintos estados de prepacion
diff --git a/db/routines/vn/procedures/saleSplit.sql b/db/routines/vn/procedures/saleSplit.sql
index dab78d811..6fa4d48b3 100644
--- a/db/routines/vn/procedures/saleSplit.sql
+++ b/db/routines/vn/procedures/saleSplit.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`saleSplit`(vSaleFk INT, vQuantity INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`saleSplit`(vSaleFk INT, vQuantity INT)
BEGIN
diff --git a/db/routines/vn/procedures/saleTracking_add.sql b/db/routines/vn/procedures/saleTracking_add.sql
index dc347b0e3..6b7fa5ed3 100644
--- a/db/routines/vn/procedures/saleTracking_add.sql
+++ b/db/routines/vn/procedures/saleTracking_add.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`saleTracking_add`(vSaleGroupFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`saleTracking_add`(vSaleGroupFk INT)
BEGIN
/** Inserta en vn.saleTracking las lineas de una previa
*
diff --git a/db/routines/vn/procedures/saleTracking_addPreparedSaleGroup.sql b/db/routines/vn/procedures/saleTracking_addPreparedSaleGroup.sql
index b9475433c..8c5d336ab 100644
--- a/db/routines/vn/procedures/saleTracking_addPreparedSaleGroup.sql
+++ b/db/routines/vn/procedures/saleTracking_addPreparedSaleGroup.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`saleTracking_addPreparedSaleGroup`(vSaleGroupFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`saleTracking_addPreparedSaleGroup`(vSaleGroupFk INT)
BEGIN
/**
* Inserta lineas de vn.saleTracking para un saleGroup (previa) que escanea un sacador
diff --git a/db/routines/vn/procedures/saleTracking_addPrevOK.sql b/db/routines/vn/procedures/saleTracking_addPrevOK.sql
index 84cea965f..34d1cfac8 100644
--- a/db/routines/vn/procedures/saleTracking_addPrevOK.sql
+++ b/db/routines/vn/procedures/saleTracking_addPrevOK.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`saleTracking_addPrevOK`(vSectorCollectionFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`saleTracking_addPrevOK`(vSectorCollectionFk INT)
BEGIN
/**
* Inserta los registros de la colección de sector con el estado PREVIA OK
diff --git a/db/routines/vn/procedures/saleTracking_del.sql b/db/routines/vn/procedures/saleTracking_del.sql
index 263bd68a1..3c8282b1e 100644
--- a/db/routines/vn/procedures/saleTracking_del.sql
+++ b/db/routines/vn/procedures/saleTracking_del.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`saleTracking_del`(vSaleFk INT, vState VARCHAR(50))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`saleTracking_del`(vSaleFk INT, vState VARCHAR(50))
BEGIN
DELETE FROM itemShelvingSale
diff --git a/db/routines/vn/procedures/saleTracking_new.sql b/db/routines/vn/procedures/saleTracking_new.sql
index 5982f8df0..f43ba53fa 100644
--- a/db/routines/vn/procedures/saleTracking_new.sql
+++ b/db/routines/vn/procedures/saleTracking_new.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`saleTracking_new`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`saleTracking_new`(
vSaleFK INT,
vIsChecked BOOLEAN,
vOriginalQuantity INT,
diff --git a/db/routines/vn/procedures/saleTracking_updateIsChecked.sql b/db/routines/vn/procedures/saleTracking_updateIsChecked.sql
index 57d8df701..0d4d27f73 100644
--- a/db/routines/vn/procedures/saleTracking_updateIsChecked.sql
+++ b/db/routines/vn/procedures/saleTracking_updateIsChecked.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`saleTracking_updateIsChecked`(vSaleFK INT, vIsChecked BOOL, vIsScanned BOOL)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`saleTracking_updateIsChecked`(vSaleFK INT, vIsChecked BOOL, vIsScanned BOOL)
BEGIN
/**
diff --git a/db/routines/vn/procedures/sale_PriceFix.sql b/db/routines/vn/procedures/sale_PriceFix.sql
index 5f956cba8..bdd7ad77f 100644
--- a/db/routines/vn/procedures/sale_PriceFix.sql
+++ b/db/routines/vn/procedures/sale_PriceFix.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_PriceFix`(vTicketFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`sale_PriceFix`(vTicketFk INT)
BEGIN
DELETE sc.*
diff --git a/db/routines/vn/procedures/sale_boxPickingPrint.sql b/db/routines/vn/procedures/sale_boxPickingPrint.sql
index dbb3b6c14..6bb954a78 100644
--- a/db/routines/vn/procedures/sale_boxPickingPrint.sql
+++ b/db/routines/vn/procedures/sale_boxPickingPrint.sql
@@ -1,6 +1,6 @@
DELIMITER $$
$$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE vn.sale_boxPickingPrint(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE vn.sale_boxPickingPrint(
IN vPrinterFk INT,
IN vSaleFk INT,
IN vPacking INT,
@@ -160,7 +160,10 @@ w1: WHILE vQuantity >= vPacking DO
UPDATE sale SET quantity = quantity - vPacking WHERE id = vSaleFk;
- UPDATE itemShelving SET visible = visible - vPacking WHERE id = vItemShelvingFk;
+ UPDATE itemShelving
+ SET visible = visible - vPacking,
+ available = available - vPacking
+ WHERE id = vItemShelvingFk;
SET vNewSaleFk = NULL;
diff --git a/db/routines/vn/procedures/sale_calculateComponent.sql b/db/routines/vn/procedures/sale_calculateComponent.sql
index 63786c75c..4264603cd 100644
--- a/db/routines/vn/procedures/sale_calculateComponent.sql
+++ b/db/routines/vn/procedures/sale_calculateComponent.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_calculateComponent`(vSelf INT, vOption VARCHAR(25))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`sale_calculateComponent`(vSelf INT, vOption VARCHAR(25))
proc: BEGIN
/**
* Crea tabla temporal para vn.sale_recalcComponent() para recalcular los componentes
diff --git a/db/routines/vn/procedures/sale_getBoxPickingList.sql b/db/routines/vn/procedures/sale_getBoxPickingList.sql
index a95ed5b0c..f343ab375 100644
--- a/db/routines/vn/procedures/sale_getBoxPickingList.sql
+++ b/db/routines/vn/procedures/sale_getBoxPickingList.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_getBoxPickingList`(vSectorFk INT, vDated DATE)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`sale_getBoxPickingList`(vSectorFk INT, vDated DATE)
BEGIN
/**
* Returns a suitable boxPicking sales list
diff --git a/db/routines/vn/procedures/sale_getFromTicketOrCollection.sql b/db/routines/vn/procedures/sale_getFromTicketOrCollection.sql
index 5308bdd28..b395d5bc4 100644
--- a/db/routines/vn/procedures/sale_getFromTicketOrCollection.sql
+++ b/db/routines/vn/procedures/sale_getFromTicketOrCollection.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_getFromTicketOrCollection`(vParam INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`sale_getFromTicketOrCollection`(vParam INT)
BEGIN
/**
* Visualizar lineas de la tabla sale a través del parámetro vParam que puede
diff --git a/db/routines/vn/procedures/sale_getProblems.sql b/db/routines/vn/procedures/sale_getProblems.sql
index 6f65a3722..2bba8fbc3 100644
--- a/db/routines/vn/procedures/sale_getProblems.sql
+++ b/db/routines/vn/procedures/sale_getProblems.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_getProblems`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`sale_getProblems`(
vIsTodayRelative tinyint(1)
)
BEGIN
@@ -23,58 +23,53 @@ BEGIN
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
- DELETE tt.*
- FROM tmp.sale_getProblems tt
- JOIN ticketObservation tto ON tto.ticketFk = tt.ticketFk
- JOIN observationType ot ON ot.id = tto.observationTypeFk
- WHERE ot.code = 'administrative'
- AND tto.description = 'Miriam';
+ CREATE OR REPLACE TEMPORARY TABLE tmp.sale_problems (
+ ticketFk INT(11),
+ saleFk INT(11),
+ isFreezed INTEGER(1) DEFAULT 0,
+ risk DECIMAL(10,1) DEFAULT 0,
+ hasRisk TINYINT(1) DEFAULT 0,
+ hasHighRisk TINYINT(1) DEFAULT 0,
+ hasTicketRequest INTEGER(1) DEFAULT 0,
+ itemShortage VARCHAR(255),
+ isTaxDataChecked INTEGER(1) DEFAULT 1,
+ itemDelay VARCHAR(255),
+ itemLost VARCHAR(255),
+ hasComponentLack INTEGER(1),
+ hasRounding VARCHAR(255),
+ isTooLittle BOOL DEFAULT FALSE,
+ isVip BOOL DEFAULT FALSE,
+ PRIMARY KEY (ticketFk, saleFk)
+ ) ENGINE = MEMORY;
- CREATE OR REPLACE TEMPORARY TABLE tmp.sale_problems (
- ticketFk INT(11),
- saleFk INT(11),
- isFreezed INTEGER(1) DEFAULT 0,
- risk DECIMAL(10,1) DEFAULT 0,
- hasHighRisk TINYINT(1) DEFAULT 0,
- hasTicketRequest INTEGER(1) DEFAULT 0,
- itemShortage VARCHAR(255),
- isTaxDataChecked INTEGER(1) DEFAULT 1,
- itemDelay VARCHAR(255),
- itemLost VARCHAR(255),
- hasComponentLack INTEGER(1),
- hasRounding VARCHAR(255),
- isTooLittle BOOL DEFAULT FALSE,
- isVip BOOL DEFAULT FALSE,
- PRIMARY KEY (ticketFk, saleFk)
- ) ENGINE = MEMORY;
-
- INSERT INTO tmp.sale_problems(ticketFk,
- saleFk,
- isFreezed,
- risk,
- hasHighRisk,
- hasTicketRequest,
- isTaxDataChecked,
- hasComponentLack,
- hasRounding,
- isTooLittle)
+ INSERT INTO tmp.sale_problems(ticketFk,
+ saleFk,
+ isFreezed,
+ risk,
+ hasRisk,
+ hasHighRisk,
+ hasTicketRequest,
+ isTaxDataChecked,
+ hasComponentLack,
+ isTooLittle)
SELECT sgp.ticketFk,
s.id,
IF(FIND_IN_SET('isFreezed', t.problem), TRUE, FALSE) isFreezed,
t.risk,
+ IF(FIND_IN_SET('hasRisk', t.problem), TRUE, FALSE) hasRisk,
IF(FIND_IN_SET('hasHighRisk', t.problem), TRUE, FALSE) hasHighRisk,
IF(FIND_IN_SET('hasTicketRequest', t.problem), TRUE, FALSE) hasTicketRequest,
IF(FIND_IN_SET('isTaxDataChecked', t.problem), FALSE, TRUE) isTaxDataChecked,
IF(FIND_IN_SET('hasComponentLack', s.problem), TRUE, FALSE) hasComponentLack,
- IF(FIND_IN_SET('hasRounding', s.problem),
- LEFT(GROUP_CONCAT('RE: ', i.id, ' ', IFNULL(i.longName,'') SEPARATOR ', '), 250),
- NULL
- ) hasRounding,
- IF(FIND_IN_SET('isTooLittle', t.problem), TRUE, FALSE) isTooLittle
+ IF(FIND_IN_SET('isTooLittle', t.problem)
+ AND util.VN_NOW() < (util.VN_CURDATE() + INTERVAL HOUR(zc.`hour`) HOUR) + INTERVAL MINUTE(zc.`hour`) MINUTE,
+ TRUE, FALSE) isTooLittle
FROM tmp.sale_getProblems sgp
JOIN ticket t ON t.id = sgp.ticketFk
LEFT JOIN sale s ON s.ticketFk = t.id
LEFT JOIN item i ON i.id = s.itemFk
+ LEFT JOIN zoneClosure zc ON zc.zoneFk = t.zoneFk
+ AND zc.dated = util.VN_CURDATE()
WHERE s.problem <> '' OR t.problem <> '' OR t.risk
GROUP BY t.id, s.id;
@@ -208,24 +203,31 @@ BEGIN
GROUP BY sgp.ticketFk
) sub
ON DUPLICATE KEY UPDATE itemDelay = sub.problem, saleFk = sub.saleFk;
+
+ -- Redondeo: cantidad incorrecta con respecto al grouping
+ CALL buy_getUltimate(NULL, vWarehouseFk, vDate);
+ INSERT INTO tmp.sale_problems(ticketFk, hasRounding, saleFk)
+ SELECT ticketFk, problem, saleFk
+ FROM (
+ SELECT sgp.ticketFk,
+ s.id saleFk,
+ LEFT(GROUP_CONCAT('RE: ',i.id, ' ', IFNULL(i.longName,'') SEPARATOR ', '), 250) problem
+ FROM tmp.sale_getProblems sgp
+ JOIN ticket t ON t.id = sgp.ticketFk
+ AND t.warehouseFk = vWarehouseFk
+ JOIN sale s ON s.ticketFk = sgp.ticketFk
+ JOIN item i ON i.id = s.itemFk
+ JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
+ JOIN buy b ON b.id = bu.buyFk
+ WHERE MOD(s.quantity, b.`grouping`)
+ GROUP BY sgp.ticketFk
+ )sub
+ ON DUPLICATE KEY UPDATE hasRounding = sub.problem, saleFk = sub.saleFk;
+
+ DROP TEMPORARY TABLE tmp.buyUltimate;
END LOOP;
CLOSE vCursor;
- INSERT INTO tmp.sale_problems(ticketFk, hasRounding, saleFk)
- SELECT ticketFk, problem, saleFk
- FROM (
- SELECT sgp.ticketFk,
- s.id saleFk,
- LEFT(GROUP_CONCAT('RE: ', i.id, ' ', IFNULL(i.longName,'') SEPARATOR ', '), 250) problem
- FROM tmp.sale_getProblems sgp
- JOIN ticket t ON t.id = sgp.ticketFk
- JOIN sale s ON s.ticketFk = sgp.ticketFk
- JOIN item i ON i.id = s.itemFk
- WHERE FIND_IN_SET('hasRounding', s.problem)
- GROUP BY sgp.ticketFk
- ) sub
- ON DUPLICATE KEY UPDATE hasRounding = sub.problem, saleFk = sub.saleFk;
-
DROP TEMPORARY TABLE tItemShelvingStock_byWarehouse;
END$$
DELIMITER ;
diff --git a/db/routines/vn/procedures/sale_getProblemsByTicket.sql b/db/routines/vn/procedures/sale_getProblemsByTicket.sql
index f7a066705..ff419989d 100644
--- a/db/routines/vn/procedures/sale_getProblemsByTicket.sql
+++ b/db/routines/vn/procedures/sale_getProblemsByTicket.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_getProblemsByTicket`(IN vTicketFk INT, IN vIsTodayRelative TINYINT(1))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`sale_getProblemsByTicket`(IN vTicketFk INT, IN vIsTodayRelative TINYINT(1))
BEGIN
/**
* Calcula los problemas de cada venta
diff --git a/db/routines/vn/procedures/sale_recalcComponent.sql b/db/routines/vn/procedures/sale_recalcComponent.sql
index f3c188404..19fadd0b9 100644
--- a/db/routines/vn/procedures/sale_recalcComponent.sql
+++ b/db/routines/vn/procedures/sale_recalcComponent.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_recalcComponent`(vOption VARCHAR(25))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`sale_recalcComponent`(vOption VARCHAR(25))
proc: BEGIN
/**
* Este procedimiento recalcula los componentes de un conjunto de sales,
diff --git a/db/routines/vn/procedures/sale_replaceItem.sql b/db/routines/vn/procedures/sale_replaceItem.sql
index 573d5b488..a61d260cc 100644
--- a/db/routines/vn/procedures/sale_replaceItem.sql
+++ b/db/routines/vn/procedures/sale_replaceItem.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_replaceItem`(vSaleFk INT, vNewItemFk INT, vQuantity INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`sale_replaceItem`(vSaleFk INT, vNewItemFk INT, vQuantity INT)
BEGIN
/**
* Añade un nuevo articulo para sustituir a otro, y actualiza la memoria de sustituciones.
diff --git a/db/routines/vn/procedures/sale_setProblem.sql b/db/routines/vn/procedures/sale_setProblem.sql
index b343c0b8c..333590658 100644
--- a/db/routines/vn/procedures/sale_setProblem.sql
+++ b/db/routines/vn/procedures/sale_setProblem.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_setProblem`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`sale_setProblem`(
vProblemCode VARCHAR(25)
)
BEGIN
diff --git a/db/routines/vn/procedures/sale_setProblemComponentLack.sql b/db/routines/vn/procedures/sale_setProblemComponentLack.sql
index 23eb77c2e..ad14d97d4 100644
--- a/db/routines/vn/procedures/sale_setProblemComponentLack.sql
+++ b/db/routines/vn/procedures/sale_setProblemComponentLack.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_setProblemComponentLack`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`sale_setProblemComponentLack`(
vSelf INT
)
BEGIN
diff --git a/db/routines/vn/procedures/sale_setProblemComponentLackByComponent.sql b/db/routines/vn/procedures/sale_setProblemComponentLackByComponent.sql
index cdf28ac09..fc432f8b3 100644
--- a/db/routines/vn/procedures/sale_setProblemComponentLackByComponent.sql
+++ b/db/routines/vn/procedures/sale_setProblemComponentLackByComponent.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_setProblemComponentLackByComponent`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`sale_setProblemComponentLackByComponent`(
vComponentFk INT
)
BEGIN
diff --git a/db/routines/vn/procedures/sale_setProblemRounding.sql b/db/routines/vn/procedures/sale_setProblemRounding.sql
deleted file mode 100644
index 894749c7b..000000000
--- a/db/routines/vn/procedures/sale_setProblemRounding.sql
+++ /dev/null
@@ -1,37 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_setProblemRounding`(
- vSelf INT
-)
-BEGIN
-/**
- * Update the rounding problem for a sales line
- * @param vSelf Id sale
- */
- DECLARE vItemFk INT;
- DECLARE vWarehouseFk INT;
- DECLARE vShipped DATE;
- DECLARE vQuantity INT;
- DECLARE vIsProblemCalcNeeded BOOL;
-
- SELECT s.itemFk, t.warehouseFk, t.shipped, s.quantity, ticket_isProblemCalcNeeded(t.id)
- INTO vItemFk, vWarehouseFk, vShipped, vQuantity, vIsProblemCalcNeeded
- FROM sale s
- JOIN ticket t ON t.id = s.ticketFk
- WHERE s.id = vSelf;
-
- CALL buy_getUltimate(vItemFk, vWarehouseFk, vShipped);
-
- CREATE OR REPLACE TEMPORARY TABLE tmp.sale
- SELECT vSelf saleFk,
- MOD(vQuantity, b.`grouping`) hasProblem,
- vIsProblemCalcNeeded isProblemCalcNeeded
- FROM tmp.buyUltimate bu
- JOIN buy b ON b.id = bu.buyFk
- WHERE bu.itemFk = vItemFk;
-
- CALL sale_setProblem('hasRounding');
-
- DROP TEMPORARY TABLE tmp.sale;
- DROP TEMPORARY TABLE tmp.buyUltimate;
-END$$
-DELIMITER ;
\ No newline at end of file
diff --git a/db/routines/vn/procedures/sales_mergeByCollection.sql b/db/routines/vn/procedures/sales_mergeByCollection.sql
index 04f8b5bc7..279f9593f 100644
--- a/db/routines/vn/procedures/sales_mergeByCollection.sql
+++ b/db/routines/vn/procedures/sales_mergeByCollection.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sales_mergeByCollection`(vCollectionFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`sales_mergeByCollection`(vCollectionFk INT)
BEGIN
DECLARE vDone BOOL;
diff --git a/db/routines/vn/procedures/sectorCollectionSaleGroup_add.sql b/db/routines/vn/procedures/sectorCollectionSaleGroup_add.sql
index 5ffb30635..9ca1227c1 100644
--- a/db/routines/vn/procedures/sectorCollectionSaleGroup_add.sql
+++ b/db/routines/vn/procedures/sectorCollectionSaleGroup_add.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sectorCollectionSaleGroup_add`(vSaleGroupFk INT, vSectorCollectionFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`sectorCollectionSaleGroup_add`(vSaleGroupFk INT, vSectorCollectionFk INT)
BEGIN
/**
* Inserta un nuevo registro en vn.sectorCollectionSaleGroup
diff --git a/db/routines/vn/procedures/sectorCollection_get.sql b/db/routines/vn/procedures/sectorCollection_get.sql
index e518e05f8..97a44b150 100644
--- a/db/routines/vn/procedures/sectorCollection_get.sql
+++ b/db/routines/vn/procedures/sectorCollection_get.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sectorCollection_get`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`sectorCollection_get`()
BEGIN
/**
* Devuelve las colecciones del sector que corresponden al usuario conectado, y que estan incompletas
diff --git a/db/routines/vn/procedures/sectorCollection_getMyPartial.sql b/db/routines/vn/procedures/sectorCollection_getMyPartial.sql
index 21f26770a..e02455235 100644
--- a/db/routines/vn/procedures/sectorCollection_getMyPartial.sql
+++ b/db/routines/vn/procedures/sectorCollection_getMyPartial.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sectorCollection_getMyPartial`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`sectorCollection_getMyPartial`()
BEGIN
/**
* Devuelve las colecciones del sector que corresponden al usuario conectado, y que estan incompletas
diff --git a/db/routines/vn/procedures/sectorCollection_getSale.sql b/db/routines/vn/procedures/sectorCollection_getSale.sql
index e1636895b..b3b1f0f3f 100644
--- a/db/routines/vn/procedures/sectorCollection_getSale.sql
+++ b/db/routines/vn/procedures/sectorCollection_getSale.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sectorCollection_getSale`(vSelf INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`sectorCollection_getSale`(vSelf INT)
BEGIN
/**
* Devuelve las lineas de venta correspondientes a esa coleccion de sector
diff --git a/db/routines/vn/procedures/sectorCollection_hasSalesReserved.sql b/db/routines/vn/procedures/sectorCollection_hasSalesReserved.sql
index acb460190..6d0fb8f23 100644
--- a/db/routines/vn/procedures/sectorCollection_hasSalesReserved.sql
+++ b/db/routines/vn/procedures/sectorCollection_hasSalesReserved.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION vn.sectorCollection_hasSalesReserved(vSelf INT) RETURNS tinyint(1)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION vn.sectorCollection_hasSalesReserved(vSelf INT) RETURNS tinyint(1)
DETERMINISTIC
BEGIN
/**
diff --git a/db/routines/vn/procedures/sectorCollection_new.sql b/db/routines/vn/procedures/sectorCollection_new.sql
index fae8eba31..3f0112015 100644
--- a/db/routines/vn/procedures/sectorCollection_new.sql
+++ b/db/routines/vn/procedures/sectorCollection_new.sql
@@ -1,5 +1,5 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sectorCollection_new`(vSectorFk INT)
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`sectorCollection_new`(vSectorFk INT)
BEGIN
/**
* Inserta una nueva colección, si el usuario no tiene ninguna vacia.
@@ -24,5 +24,5 @@ BEGIN
INSERT INTO vn.sectorCollection(userFk, sectorFk)
VALUES(vUserFk, vSectorFk);
END IF;
-END$$
-DELIMITER ;
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/procedures/sectorProductivity_add.sql b/db/routines/vn/procedures/sectorProductivity_add.sql
index be75c842d..8b520e692 100644
--- a/db/routines/vn/procedures/sectorProductivity_add.sql
+++ b/db/routines/vn/procedures/sectorProductivity_add.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sectorProductivity_add`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`sectorProductivity_add`()
BEGIN
DECLARE vDatedFrom DATETIME;
DECLARE vDatedTo DATETIME;
diff --git a/db/routines/vn/procedures/sector_getWarehouse.sql b/db/routines/vn/procedures/sector_getWarehouse.sql
index fe363f39f..5a9f1ee5f 100644
--- a/db/routines/vn/procedures/sector_getWarehouse.sql
+++ b/db/routines/vn/procedures/sector_getWarehouse.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sector_getWarehouse`(vSectorFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`sector_getWarehouse`(vSectorFk INT)
BEGIN
SELECT s.warehouseFk
diff --git a/db/routines/vn/procedures/setParking.sql b/db/routines/vn/procedures/setParking.sql
index b3edf350d..96b459031 100644
--- a/db/routines/vn/procedures/setParking.sql
+++ b/db/routines/vn/procedures/setParking.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`setParking`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`setParking`(
vParam VARCHAR(8),
vParkingCode VARCHAR(8)
)
diff --git a/db/routines/vn/procedures/shelvingChange.sql b/db/routines/vn/procedures/shelvingChange.sql
index fde38212c..2e7e92082 100644
--- a/db/routines/vn/procedures/shelvingChange.sql
+++ b/db/routines/vn/procedures/shelvingChange.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`shelvingChange`(IN `vShelvingO` VARCHAR(8), IN `vShelvingD` VARCHAR(8))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`shelvingChange`(IN `vShelvingO` VARCHAR(8), IN `vShelvingD` VARCHAR(8))
BEGIN
UPDATE vn.itemShelving
diff --git a/db/routines/vn/procedures/shelvingLog_get.sql b/db/routines/vn/procedures/shelvingLog_get.sql
index d48e38d03..d72d6cf8b 100644
--- a/db/routines/vn/procedures/shelvingLog_get.sql
+++ b/db/routines/vn/procedures/shelvingLog_get.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`shelvingLog_get`(shelvingFk VARCHAR(10))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`shelvingLog_get`(shelvingFk VARCHAR(10))
BEGIN
/* Lista el log de un carro
diff --git a/db/routines/vn/procedures/shelvingParking_get.sql b/db/routines/vn/procedures/shelvingParking_get.sql
index 0131db7d2..a9ed9f74a 100644
--- a/db/routines/vn/procedures/shelvingParking_get.sql
+++ b/db/routines/vn/procedures/shelvingParking_get.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`shelvingParking_get`(vShelvingFk VARCHAR(10), vWarehouseFk INT, vDayRange INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`shelvingParking_get`(vShelvingFk VARCHAR(10), vWarehouseFk INT, vDayRange INT)
BEGIN
diff --git a/db/routines/vn/procedures/shelvingPriority_update.sql b/db/routines/vn/procedures/shelvingPriority_update.sql
index 317f17333..87019e9cf 100644
--- a/db/routines/vn/procedures/shelvingPriority_update.sql
+++ b/db/routines/vn/procedures/shelvingPriority_update.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`shelvingPriority_update`(priority INT,vShelvingFk VARCHAR(10))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`shelvingPriority_update`(priority INT,vShelvingFk VARCHAR(10))
BEGIN
UPDATE vn.shelving SET priority = priority WHERE code=vShelvingFk COLLATE utf8_unicode_ci;
diff --git a/db/routines/vn/procedures/shelving_clean.sql b/db/routines/vn/procedures/shelving_clean.sql
index f9248a0d7..0b29968bc 100644
--- a/db/routines/vn/procedures/shelving_clean.sql
+++ b/db/routines/vn/procedures/shelving_clean.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`shelving_clean`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`shelving_clean`()
BEGIN
DELETE FROM shelving
@@ -25,8 +25,9 @@ UPDATE shelving sh
AND (
sh.parked IS NULL
OR
- sh.parked < TIMESTAMPADD(MONTH,-1,util.VN_CURDATE())
- )
+ sh.parked < util.VN_CURDATE() - INTERVAL 2 WEEK
+ )
+
AND IF(code REGEXP '^[A-Za-z]{2}[0-9]', LEFT (code, 2) NOT IN (
SELECT DISTINCT LEFT(its.shelvingFk, 2)
FROM itemShelving its
diff --git a/db/routines/vn/procedures/shelving_getSpam.sql b/db/routines/vn/procedures/shelving_getSpam.sql
index 2895470ad..cef407285 100644
--- a/db/routines/vn/procedures/shelving_getSpam.sql
+++ b/db/routines/vn/procedures/shelving_getSpam.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`shelving_getSpam`(vDated DATE, vWarehouseFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`shelving_getSpam`(vDated DATE, vWarehouseFk INT)
BEGIN
/**
* Devuelve las matrículas con productos que no son necesarios para la venta
diff --git a/db/routines/vn/procedures/shelving_setParking.sql b/db/routines/vn/procedures/shelving_setParking.sql
index 3e8717197..f9acad74d 100644
--- a/db/routines/vn/procedures/shelving_setParking.sql
+++ b/db/routines/vn/procedures/shelving_setParking.sql
@@ -1,5 +1,8 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`shelving_setParking`(IN `vShelvingCode` VARCHAR(8), IN `vParkingFk` INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`shelving_setParking`(
+ `vShelvingCode` VARCHAR(8),
+ `vParkingFk` INT
+)
BEGIN
/**
* Aparca una matrícula en un parking
diff --git a/db/routines/vn/procedures/sleep_X_min.sql b/db/routines/vn/procedures/sleep_X_min.sql
index 39102b57d..507432390 100644
--- a/db/routines/vn/procedures/sleep_X_min.sql
+++ b/db/routines/vn/procedures/sleep_X_min.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sleep_X_min`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`sleep_X_min`()
BEGIN
# Ernesto. 4.8.2020
# Para su uso en las tareas ejecutadas a las 2AM (visibles con: SELECT * FROM bs.nightTask order by started asc;)
diff --git a/db/routines/vn/procedures/stockBought_calculate.sql b/db/routines/vn/procedures/stockBought_calculate.sql
new file mode 100644
index 000000000..8b2a32e5d
--- /dev/null
+++ b/db/routines/vn/procedures/stockBought_calculate.sql
@@ -0,0 +1,62 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`stockBought_calculate`(
+ vDated DATE
+)
+proc: BEGIN
+/**
+ * Calculate the stock of the auction warehouse from the inventory date to vDated
+ * without taking into account the outputs of the same day vDated
+ *
+ * @param vDated Date to calculate the stock.
+ */
+ IF vDated < util.VN_CURDATE() THEN
+ LEAVE proc;
+ END IF;
+
+ CREATE OR REPLACE TEMPORARY TABLE tStockBought
+ SELECT workerFk, reserve
+ FROM stockBought
+ WHERE dated = vDated
+ AND reserve;
+
+ DELETE FROM stockBought WHERE dated = vDated;
+
+ CALL item_calculateStock(vDated);
+
+ INSERT INTO stockBought(workerFk, bought, dated)
+ SELECT it.workerFk,
+ ROUND(SUM(
+ (ti.quantity / b.packing) *
+ buy_getVolume(b.id)
+ ) / vc.palletM3 / 1000000, 1) bought,
+ vDated
+ FROM itemType it
+ JOIN item i ON i.typeFk = it.id
+ LEFT JOIN tmp.item ti ON ti.itemFk = i.id
+ JOIN itemCategory ic ON ic.id = it.categoryFk
+ JOIN warehouse wh ON wh.code = 'VNH'
+ JOIN tmp.buyUltimate bu ON bu.itemFk = i.id
+ AND bu.warehouseFk = wh.id
+ JOIN buy b ON b.id = bu.buyFk
+ JOIN volumeConfig vc
+ WHERE ic.display
+ GROUP BY it.workerFk
+ HAVING bought;
+
+ UPDATE stockBought s
+ JOIN tStockBought ts ON ts.workerFk = s.workerFk
+ SET s.reserve = ts.reserve
+ WHERE s.dated = vDated;
+
+ INSERT INTO stockBought (workerFk, reserve, dated)
+ SELECT ts.workerFk, ts.reserve, vDated
+ FROM tStockBought ts
+ WHERE ts.workerFk NOT IN (
+ SELECT workerFk
+ FROM stockBought
+ WHERE dated = vDated
+ );
+
+ DROP TEMPORARY TABLE tStockBought, tmp.item, tmp.buyUltimate;
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/procedures/stockBuyedByWorker.sql b/db/routines/vn/procedures/stockBuyedByWorker.sql
deleted file mode 100644
index 730612db8..000000000
--- a/db/routines/vn/procedures/stockBuyedByWorker.sql
+++ /dev/null
@@ -1,74 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`stockBuyedByWorker`(
- vDated DATE,
- vWorker INT
-)
-BEGIN
-/**
- * Inserta el volumen de compra de un comprador
- * en stockBuyed de acuerdo con la fecha.
- *
- * @param vDated Fecha de compra
- * @param vWorker Id de trabajador
- */
- CREATE OR REPLACE TEMPORARY TABLE tStockBuyed
- (INDEX (userFk))
- ENGINE = MEMORY
- SELECT requested, reserved, userFk
- FROM stockBuyed
- WHERE dated = vDated
- AND userFk = vWorker;
-
- DELETE FROM stockBuyed
- WHERE dated = vDated
- AND userFk = vWorker;
-
- CALL stockTraslation(vDated);
-
- INSERT INTO stockBuyed(userFk, buyed, `dated`, reserved, requested, description)
- SELECT it.workerFk,
- SUM((ti.quantity / b.packing) * buy_getVolume(b.id)) / vc.palletM3 / 1000000,
- vDated,
- sb.reserved,
- sb.requested,
- u.name
- FROM itemType it
- JOIN item i ON i.typeFk = it.id
- LEFT JOIN tmp.item ti ON ti.itemFk = i.id
- JOIN itemCategory ic ON ic.id = it.categoryFk
- JOIN warehouse wh ON wh.code = 'VNH'
- JOIN tmp.buyUltimate bu ON bu.itemFk = i.id
- AND bu.warehouseFk = wh.id
- JOIN buy b ON b.id = bu.buyFk
- JOIN volumeConfig vc
- JOIN account.`user` u ON u.id = it.workerFk
- LEFT JOIN tStockBuyed sb ON sb.userFk = it.workerFk
- WHERE ic.display
- AND it.workerFk = vWorker;
-
- SELECT b.entryFk Id_Entrada,
- i.id Id_Article,
- i.name Article,
- ti.quantity Cantidad,
- (ac.conversionCoefficient * (ti.quantity / b.packing) * buy_getVolume(b.id))
- / (vc.trolleyM3 * 1000000) buyed,
- b.packagingFk id_cubo,
- b.packing
- FROM tmp.item ti
- JOIN item i ON i.id = ti.itemFk
- JOIN itemType it ON i.typeFk = it.id
- JOIN itemCategory ic ON ic.id = it.categoryFk
- JOIN worker w ON w.id = it.workerFk
- JOIN auctionConfig ac
- JOIN tmp.buyUltimate bu ON bu.itemFk = i.id
- AND bu.warehouseFk = ac.warehouseFk
- JOIN buy b ON b.id = bu.buyFk
- JOIN volumeConfig vc
- WHERE ic.display
- AND w.id = vWorker;
-
- DROP TEMPORARY TABLE tmp.buyUltimate,
- tmp.item,
- tStockBuyed;
-END$$
-DELIMITER ;
diff --git a/db/routines/vn/procedures/stockBuyed_add.sql b/db/routines/vn/procedures/stockBuyed_add.sql
deleted file mode 100644
index 1fff1484c..000000000
--- a/db/routines/vn/procedures/stockBuyed_add.sql
+++ /dev/null
@@ -1,70 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`stockBuyed_add`(
- vDated DATE
-)
-BEGIN
-/**
- * Inserta el volumen de compra por comprador
- * en stockBuyed de acuerdo con la fecha.
- *
- * @param vDated Fecha de compra
- */
- CREATE OR REPLACE TEMPORARY TABLE tStockBuyed
- (INDEX (userFk))
- ENGINE = MEMORY
- SELECT requested, reserved, userFk
- FROM stockBuyed
- WHERE dated = vDated;
-
- DELETE FROM stockBuyed WHERE dated = vDated;
-
- CALL stockTraslation(vDated);
-
- INSERT INTO stockBuyed(userFk, buyed, `dated`, description)
- SELECT it.workerFk,
- SUM((ti.quantity / b.packing) * buy_getVolume(b.id)) / vc.palletM3 / 1000000,
- vDated,
- u.name
- FROM itemType it
- JOIN item i ON i.typeFk = it.id
- LEFT JOIN tmp.item ti ON ti.itemFk = i.id
- JOIN itemCategory ic ON ic.id = it.categoryFk
- JOIN warehouse wh ON wh.code = 'VNH'
- JOIN tmp.buyUltimate bu ON bu.itemFk = i.id AND bu.warehouseFk = wh.id
- JOIN buy b ON b.id = bu.buyFk
- JOIN volumeConfig vc
- JOIN account.`user` u ON u.id = it.workerFk
- JOIN workerDepartment wd ON wd.workerFk = u.id
- JOIN department d ON d.id = wd.departmentFk
- WHERE ic.display
- AND d.code IN ('shopping', 'logistic', 'franceTeam')
- GROUP BY it.workerFk;
-
- INSERT INTO stockBuyed(buyed, dated, description)
- SELECT SUM(ic.cm3 * ito.quantity / vc.palletM3 / 1000000),
- vDated,
- IF(c.code = 'ES', p.name, c.name) destiny
- FROM itemTicketOut ito
- JOIN ticket t ON t.id = ito.ticketFk
- JOIN `address` a ON a.id = t.addressFk
- JOIN province p ON p.id = a.provinceFk
- JOIN country c ON c.id = p.countryFk
- JOIN warehouse wh ON wh.id = t.warehouseFk
- JOIN itemCost ic ON ic.itemFk = ito.itemFk
- AND ic.warehouseFk = t.warehouseFk
- JOIN volumeConfig vc
- WHERE ito.shipped BETWEEN vDated AND util.dayend(vDated)
- AND wh.code = 'VNH'
- GROUP BY destiny;
-
- UPDATE stockBuyed s
- JOIN tStockBuyed ts ON ts.userFk = s.userFk
- SET s.requested = ts.requested,
- s.reserved = ts.reserved
- WHERE s.dated = vDated;
-
- DROP TEMPORARY TABLE tmp.buyUltimate,
- tmp.item,
- tStockBuyed;
-END$$
-DELIMITER ;
diff --git a/db/routines/vn/procedures/subordinateGetList.sql b/db/routines/vn/procedures/subordinateGetList.sql
index 0431afaa4..9eeddef94 100644
--- a/db/routines/vn/procedures/subordinateGetList.sql
+++ b/db/routines/vn/procedures/subordinateGetList.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`subordinateGetList`(vBossFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`subordinateGetList`(vBossFk INT)
BEGIN
-- deprecated usar vn.worker_GetHierarch
diff --git a/db/routines/vn/procedures/supplierExpenses.sql b/db/routines/vn/procedures/supplierExpenses.sql
index 11ebbd603..a219ee9e9 100644
--- a/db/routines/vn/procedures/supplierExpenses.sql
+++ b/db/routines/vn/procedures/supplierExpenses.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`supplierExpenses`(vEnded DATE)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`supplierExpenses`(vEnded DATE)
BEGIN
DROP TEMPORARY TABLE IF EXISTS openingBalance;
diff --git a/db/routines/vn/procedures/supplierPackaging_ReportSource.sql b/db/routines/vn/procedures/supplierPackaging_ReportSource.sql
index 63285203b..6700a4932 100644
--- a/db/routines/vn/procedures/supplierPackaging_ReportSource.sql
+++ b/db/routines/vn/procedures/supplierPackaging_ReportSource.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`supplierPackaging_ReportSource`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`supplierPackaging_ReportSource`(
vFromDated DATE,
vSupplierFk INT
)
diff --git a/db/routines/vn/procedures/supplier_checkBalance.sql b/db/routines/vn/procedures/supplier_checkBalance.sql
index 04c513927..5e5cd5aed 100644
--- a/db/routines/vn/procedures/supplier_checkBalance.sql
+++ b/db/routines/vn/procedures/supplier_checkBalance.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`supplier_checkBalance`(IN vDateTo DATETIME, IN vIsConciliated BOOL)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`supplier_checkBalance`(IN vDateTo DATETIME, IN vIsConciliated BOOL)
BEGIN
/**
* Compara los datos de nuestros proveedores con
diff --git a/db/routines/vn/procedures/supplier_checkIsActive.sql b/db/routines/vn/procedures/supplier_checkIsActive.sql
index 9dcb6452a..75118d03a 100644
--- a/db/routines/vn/procedures/supplier_checkIsActive.sql
+++ b/db/routines/vn/procedures/supplier_checkIsActive.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`supplier_checkIsActive`(vSelf INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`supplier_checkIsActive`(vSelf INT)
BEGIN
/**
* Comprueba si un proveedor esta activo.
diff --git a/db/routines/vn/procedures/supplier_disablePayMethodChecked.sql b/db/routines/vn/procedures/supplier_disablePayMethodChecked.sql
index d486f6e86..02cbbcb8f 100644
--- a/db/routines/vn/procedures/supplier_disablePayMethodChecked.sql
+++ b/db/routines/vn/procedures/supplier_disablePayMethodChecked.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`supplier_disablePayMethodChecked`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`supplier_disablePayMethodChecked`()
BEGIN
/*
diff --git a/db/routines/vn/procedures/supplier_statementWithEntries.sql b/db/routines/vn/procedures/supplier_statementWithEntries.sql
index df3b918a7..c0014f8e5 100644
--- a/db/routines/vn/procedures/supplier_statementWithEntries.sql
+++ b/db/routines/vn/procedures/supplier_statementWithEntries.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE vn.supplier_statementWithEntries(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE vn.supplier_statementWithEntries(
vSupplierFk INT,
vCurrencyFk INT,
vCompanyFk INT,
@@ -17,14 +17,14 @@ BEGIN
* @param vOrderBy Order by criteria
* @param vIsConciliated Indicates whether it is reconciled or not
* @param vHasEntries Indicates if future entries must be shown
-* @return tmp.supplierStatement
+* @return tmp.supplierStatement
*/
DECLARE vBalanceStartingDate DATETIME;
SET @euroBalance:= 0;
SET @currencyBalance:= 0;
- SELECT balanceStartingDate
+ SELECT balanceStartingDate
INTO vBalanceStartingDate
FROM invoiceInConfig;
@@ -64,14 +64,14 @@ BEGIN
c.code,
'invoiceIn' statementType
FROM invoiceIn ii
- JOIN invoiceInDueDay iid ON iid.invoiceInFk = ii.id
+ LEFT JOIN invoiceInDueDay iid ON iid.invoiceInFk = ii.id
JOIN currency c ON c.id = ii.currencyFk
WHERE ii.issued >= vBalanceStartingDate
- AND ii.supplierFk = vSupplierFk
+ AND ii.supplierFk = vSupplierFk
AND vCurrencyFk IN (ii.currencyFk, 0)
AND vCompanyFk IN (ii.companyFk, 0)
AND (vIsConciliated = ii.isBooked OR NOT vIsConciliated)
- GROUP BY iid.id
+ GROUP BY iid.id, ii.id
UNION ALL
SELECT p.bankFk,
p.companyFk,
@@ -107,7 +107,7 @@ BEGIN
AND vCurrencyFk IN (p.currencyFk, 0)
AND vCompanyFk IN (p.companyFk, 0)
AND (vIsConciliated = p.isConciliated OR NOT vIsConciliated)
- UNION ALL
+ UNION ALL
SELECT NULL,
companyFk,
NULL,
@@ -134,7 +134,7 @@ BEGIN
AND vCurrencyFk IN (se.currencyFk,0)
AND vCompanyFk IN (se.companyFk,0)
AND (vIsConciliated = se.isConciliated OR NOT vIsConciliated)
- UNION ALL
+ UNION ALL
SELECT NULL bankFk,
e.companyFk,
'E' serial,
@@ -150,7 +150,7 @@ BEGIN
FALSE isBooked,
c.code,
'order'
- FROM entry e
+ FROM entry e
JOIN travel tr ON tr.id = e.travelFk
JOIN currency c ON c.id = e.currencyFk
WHERE e.supplierFk = vSupplierFk
diff --git a/db/routines/vn/procedures/ticketBoxesView.sql b/db/routines/vn/procedures/ticketBoxesView.sql
index d5fcef226..4f62a3d6c 100644
--- a/db/routines/vn/procedures/ticketBoxesView.sql
+++ b/db/routines/vn/procedures/ticketBoxesView.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketBoxesView`(IN vTicketFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticketBoxesView`(IN vTicketFk INT)
BEGIN
SELECT s.id,
diff --git a/db/routines/vn/procedures/ticketBuiltTime.sql b/db/routines/vn/procedures/ticketBuiltTime.sql
index 936e872ab..0e1938681 100644
--- a/db/routines/vn/procedures/ticketBuiltTime.sql
+++ b/db/routines/vn/procedures/ticketBuiltTime.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketBuiltTime`(vDate DATE)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticketBuiltTime`(vDate DATE)
BEGIN
DECLARE vDateStart DATETIME DEFAULT DATE(vDate);
diff --git a/db/routines/vn/procedures/ticketCalculateClon.sql b/db/routines/vn/procedures/ticketCalculateClon.sql
index a56491590..872efee10 100644
--- a/db/routines/vn/procedures/ticketCalculateClon.sql
+++ b/db/routines/vn/procedures/ticketCalculateClon.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketCalculateClon`(IN vTicketNew INT, vTicketOld INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticketCalculateClon`(IN vTicketNew INT, vTicketOld INT)
BEGIN
/*
* Recalcula los componentes un ticket clonado,
diff --git a/db/routines/vn/procedures/ticketCalculateFromType.sql b/db/routines/vn/procedures/ticketCalculateFromType.sql
index 63f4b8941..54d180abd 100644
--- a/db/routines/vn/procedures/ticketCalculateFromType.sql
+++ b/db/routines/vn/procedures/ticketCalculateFromType.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketCalculateFromType`( vLanded DATE,
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticketCalculateFromType`( vLanded DATE,
vAddressFk INT,
vAgencyModeFk INT,
vTypeFk INT)
diff --git a/db/routines/vn/procedures/ticketCalculatePurge.sql b/db/routines/vn/procedures/ticketCalculatePurge.sql
index 86e3b0d1b..da126281f 100644
--- a/db/routines/vn/procedures/ticketCalculatePurge.sql
+++ b/db/routines/vn/procedures/ticketCalculatePurge.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketCalculatePurge`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticketCalculatePurge`()
BEGIN
DROP TEMPORARY TABLE
tmp.ticketCalculateItem,
diff --git a/db/routines/vn/procedures/ticketClon.sql b/db/routines/vn/procedures/ticketClon.sql
index 9144ac709..9d7d1c5b3 100644
--- a/db/routines/vn/procedures/ticketClon.sql
+++ b/db/routines/vn/procedures/ticketClon.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketClon`(vTicketFk INT, vNewShipped DATE)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticketClon`(vTicketFk INT, vNewShipped DATE)
BEGIN
DECLARE vNewTicketFk INT;
diff --git a/db/routines/vn/procedures/ticketClon_OneYear.sql b/db/routines/vn/procedures/ticketClon_OneYear.sql
index b0c08dec8..31f896a22 100644
--- a/db/routines/vn/procedures/ticketClon_OneYear.sql
+++ b/db/routines/vn/procedures/ticketClon_OneYear.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketClon_OneYear`(vTicketFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticketClon_OneYear`(vTicketFk INT)
BEGIN
DECLARE vShipped DATE;
diff --git a/db/routines/vn/procedures/ticketCollection_get.sql b/db/routines/vn/procedures/ticketCollection_get.sql
index 357471fee..6af94fbf2 100644
--- a/db/routines/vn/procedures/ticketCollection_get.sql
+++ b/db/routines/vn/procedures/ticketCollection_get.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketCollection_get`(vTicketFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticketCollection_get`(vTicketFk INT)
BEGIN
SELECT tc.collectionFk
diff --git a/db/routines/vn/procedures/ticketCollection_setUsedShelves.sql b/db/routines/vn/procedures/ticketCollection_setUsedShelves.sql
index c69575ba7..8851fcafb 100644
--- a/db/routines/vn/procedures/ticketCollection_setUsedShelves.sql
+++ b/db/routines/vn/procedures/ticketCollection_setUsedShelves.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketCollection_setUsedShelves`(vTicketFk INT, vUsedShelves INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticketCollection_setUsedShelves`(vTicketFk INT, vUsedShelves INT)
BEGIN
/*
diff --git a/db/routines/vn/procedures/ticketComponentUpdate.sql b/db/routines/vn/procedures/ticketComponentUpdate.sql
index bdb3bf6cb..373bf8fbc 100644
--- a/db/routines/vn/procedures/ticketComponentUpdate.sql
+++ b/db/routines/vn/procedures/ticketComponentUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketComponentUpdate`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticketComponentUpdate`(
vTicketFk INT,
vClientFk INT,
vAgencyModeFk INT,
diff --git a/db/routines/vn/procedures/ticketComponentUpdateSale.sql b/db/routines/vn/procedures/ticketComponentUpdateSale.sql
index d002655d1..26ede95c2 100644
--- a/db/routines/vn/procedures/ticketComponentUpdateSale.sql
+++ b/db/routines/vn/procedures/ticketComponentUpdateSale.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketComponentUpdateSale`(vCode VARCHAR(25))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticketComponentUpdateSale`(vCode VARCHAR(25))
BEGIN
/**
* A partir de la tabla tmp.sale, crea los Movimientos_componentes
diff --git a/db/routines/vn/procedures/ticketDown_PrintableSelection.sql b/db/routines/vn/procedures/ticketDown_PrintableSelection.sql
index 45002dd1f..082a890a6 100644
--- a/db/routines/vn/procedures/ticketDown_PrintableSelection.sql
+++ b/db/routines/vn/procedures/ticketDown_PrintableSelection.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketDown_PrintableSelection`(vSectorFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticketDown_PrintableSelection`(vSectorFk INT)
BEGIN
UPDATE vn.ticketDown td
diff --git a/db/routines/vn/procedures/ticketGetTaxAdd.sql b/db/routines/vn/procedures/ticketGetTaxAdd.sql
index 55f587d9d..b977ae042 100644
--- a/db/routines/vn/procedures/ticketGetTaxAdd.sql
+++ b/db/routines/vn/procedures/ticketGetTaxAdd.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketGetTaxAdd`(vTicketFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticketGetTaxAdd`(vTicketFk INT)
BEGIN
/**
* Añade un ticket a la tabla tmp.ticket para calcular
diff --git a/db/routines/vn/procedures/ticketGetTax_new.sql b/db/routines/vn/procedures/ticketGetTax_new.sql
index f7c5891cc..b7df8a766 100644
--- a/db/routines/vn/procedures/ticketGetTax_new.sql
+++ b/db/routines/vn/procedures/ticketGetTax_new.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketGetTax_new`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticketGetTax_new`()
READS SQL DATA
BEGIN
/**
diff --git a/db/routines/vn/procedures/ticketGetTotal.sql b/db/routines/vn/procedures/ticketGetTotal.sql
index b77f261b0..02c824009 100644
--- a/db/routines/vn/procedures/ticketGetTotal.sql
+++ b/db/routines/vn/procedures/ticketGetTotal.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketGetTotal`(vTaxArea VARCHAR(25))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticketGetTotal`(vTaxArea VARCHAR(25))
BEGIN
/**
* Calcula el total con IVA para un conjunto de tickets.
diff --git a/db/routines/vn/procedures/ticketGetVisibleAvailable.sql b/db/routines/vn/procedures/ticketGetVisibleAvailable.sql
index 3717d57e3..01010f548 100644
--- a/db/routines/vn/procedures/ticketGetVisibleAvailable.sql
+++ b/db/routines/vn/procedures/ticketGetVisibleAvailable.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketGetVisibleAvailable`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticketGetVisibleAvailable`(
vTicket INT)
BEGIN
DECLARE vVisibleCalc INT;
diff --git a/db/routines/vn/procedures/ticketNotInvoicedByClient.sql b/db/routines/vn/procedures/ticketNotInvoicedByClient.sql
index cb177b6d0..7933fda80 100644
--- a/db/routines/vn/procedures/ticketNotInvoicedByClient.sql
+++ b/db/routines/vn/procedures/ticketNotInvoicedByClient.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketNotInvoicedByClient`(vClientFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticketNotInvoicedByClient`(vClientFk INT)
BEGIN
DROP TEMPORARY TABLE IF EXISTS tmp.ticket;
diff --git a/db/routines/vn/procedures/ticketObservation_addNewBorn.sql b/db/routines/vn/procedures/ticketObservation_addNewBorn.sql
index f70a11a48..3e04c8c4e 100644
--- a/db/routines/vn/procedures/ticketObservation_addNewBorn.sql
+++ b/db/routines/vn/procedures/ticketObservation_addNewBorn.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketObservation_addNewBorn`(vTicketFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticketObservation_addNewBorn`(vTicketFk INT)
BEGIN
/**
diff --git a/db/routines/vn/procedures/ticketPackaging_add.sql b/db/routines/vn/procedures/ticketPackaging_add.sql
index f96068b56..ed791a5f2 100644
--- a/db/routines/vn/procedures/ticketPackaging_add.sql
+++ b/db/routines/vn/procedures/ticketPackaging_add.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketPackaging_add`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticketPackaging_add`(
vClientFk INT,
vDated DATE,
vCompanyFk INT,
diff --git a/db/routines/vn/procedures/ticketParking_findSkipped.sql b/db/routines/vn/procedures/ticketParking_findSkipped.sql
index 7713d5b50..14ab28a15 100644
--- a/db/routines/vn/procedures/ticketParking_findSkipped.sql
+++ b/db/routines/vn/procedures/ticketParking_findSkipped.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketParking_findSkipped`(vTicketFk INT, vItemPackingTypeFk VARCHAR(1))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticketParking_findSkipped`(vTicketFk INT, vItemPackingTypeFk VARCHAR(1))
BEGIN
/**
diff --git a/db/routines/vn/procedures/ticketStateToday_setState.sql b/db/routines/vn/procedures/ticketStateToday_setState.sql
index bd79043b4..8802c3d08 100644
--- a/db/routines/vn/procedures/ticketStateToday_setState.sql
+++ b/db/routines/vn/procedures/ticketStateToday_setState.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketStateToday_setState`(vTicketFk INT, vStateCode VARCHAR(45))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticketStateToday_setState`(vTicketFk INT, vStateCode VARCHAR(45))
BEGIN
/* Modifica el estado de un ticket de hoy
diff --git a/db/routines/vn/procedures/ticketToInvoiceByAddress.sql b/db/routines/vn/procedures/ticketToInvoiceByAddress.sql
index ad51c761a..5e554d358 100644
--- a/db/routines/vn/procedures/ticketToInvoiceByAddress.sql
+++ b/db/routines/vn/procedures/ticketToInvoiceByAddress.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketToInvoiceByAddress`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticketToInvoiceByAddress`(
vStarted DATE,
vEnded DATETIME,
vAddress INT,
diff --git a/db/routines/vn/procedures/ticketToInvoiceByDate.sql b/db/routines/vn/procedures/ticketToInvoiceByDate.sql
index 8937ab7ae..52e418ee3 100644
--- a/db/routines/vn/procedures/ticketToInvoiceByDate.sql
+++ b/db/routines/vn/procedures/ticketToInvoiceByDate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketToInvoiceByDate`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticketToInvoiceByDate`(
vStarted DATE,
vEnded DATETIME,
vClient INT,
diff --git a/db/routines/vn/procedures/ticketToInvoiceByRef.sql b/db/routines/vn/procedures/ticketToInvoiceByRef.sql
index 4f5c23ba2..390340143 100644
--- a/db/routines/vn/procedures/ticketToInvoiceByRef.sql
+++ b/db/routines/vn/procedures/ticketToInvoiceByRef.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketToInvoiceByRef`(IN vInvoiceRef VARCHAR(15))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticketToInvoiceByRef`(IN vInvoiceRef VARCHAR(15))
BEGIN
/* Para tickets ya facturados, vuelve a repetir el proceso de facturación.
diff --git a/db/routines/vn/procedures/ticket_Clone.sql b/db/routines/vn/procedures/ticket_Clone.sql
index d22d3c7ff..f97655007 100644
--- a/db/routines/vn/procedures/ticket_Clone.sql
+++ b/db/routines/vn/procedures/ticket_Clone.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_Clone`(vOriginalTicket INT, OUT vNewTicket INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_Clone`(vOriginalTicket INT, OUT vNewTicket INT)
BEGIN
/**
* Clona el contenido de un ticket en otro
diff --git a/db/routines/vn/procedures/ticket_DelayTruck.sql b/db/routines/vn/procedures/ticket_DelayTruck.sql
index 81896dd8e..ebd0e5baf 100644
--- a/db/routines/vn/procedures/ticket_DelayTruck.sql
+++ b/db/routines/vn/procedures/ticket_DelayTruck.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_DelayTruck`(vWarehouserFk INT, vHour INT, vMinute INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_DelayTruck`(vWarehouserFk INT, vHour INT, vMinute INT)
BEGIN
DECLARE done INT DEFAULT FALSE;
DECLARE vTicketFk INT;
diff --git a/db/routines/vn/procedures/ticket_DelayTruckSplit.sql b/db/routines/vn/procedures/ticket_DelayTruckSplit.sql
index 3e5195d9c..1dc45d065 100644
--- a/db/routines/vn/procedures/ticket_DelayTruckSplit.sql
+++ b/db/routines/vn/procedures/ticket_DelayTruckSplit.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_DelayTruckSplit`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_DelayTruckSplit`(
vTicketFk INT
)
BEGIN
diff --git a/db/routines/vn/procedures/ticket_WeightDeclaration.sql b/db/routines/vn/procedures/ticket_WeightDeclaration.sql
index e50290dd8..9105cfc61 100644
--- a/db/routines/vn/procedures/ticket_WeightDeclaration.sql
+++ b/db/routines/vn/procedures/ticket_WeightDeclaration.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_WeightDeclaration`(vClientFk INT, vDated DATE)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_WeightDeclaration`(vClientFk INT, vDated DATE)
BEGIN
DECLARE vTheorycalWeight DECIMAL(10,2);
diff --git a/db/routines/vn/procedures/ticket_add.sql b/db/routines/vn/procedures/ticket_add.sql
index d9b68997c..03ad7246b 100644
--- a/db/routines/vn/procedures/ticket_add.sql
+++ b/db/routines/vn/procedures/ticket_add.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_add`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_add`(
vClientId INT
,vShipped DATE
,vWarehouseFk INT
diff --git a/db/routines/vn/procedures/ticket_administrativeCopy.sql b/db/routines/vn/procedures/ticket_administrativeCopy.sql
index f240a5fe0..7e8c436a8 100644
--- a/db/routines/vn/procedures/ticket_administrativeCopy.sql
+++ b/db/routines/vn/procedures/ticket_administrativeCopy.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_administrativeCopy`(vOriginalTicket INT, OUT vNewTicket INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_administrativeCopy`(vOriginalTicket INT, OUT vNewTicket INT)
BEGIN
INSERT INTO vn.ticket(clientFk, addressFk, shipped, warehouseFk, companyFk, landed)
diff --git a/db/routines/vn/procedures/ticket_canAdvance.sql b/db/routines/vn/procedures/ticket_canAdvance.sql
index d1ca7b5e2..57c3f4235 100644
--- a/db/routines/vn/procedures/ticket_canAdvance.sql
+++ b/db/routines/vn/procedures/ticket_canAdvance.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_canAdvance`(vDateFuture DATE, vDateToAdvance DATE, vWarehouseFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_canAdvance`(vDateFuture DATE, vDateToAdvance DATE, vWarehouseFk INT)
BEGIN
/**
* Devuelve los tickets y la cantidad de lineas de venta que se pueden adelantar.
@@ -19,8 +19,7 @@ BEGIN
CREATE OR REPLACE TEMPORARY TABLE tmp.filter
(INDEX (id))
- SELECT
- origin.ticketFk futureId,
+ SELECT origin.ticketFk futureId,
dest.ticketFk id,
dest.state,
origin.futureState,
@@ -51,48 +50,48 @@ BEGIN
origin.warehouseFk futureWarehouseFk,
origin.companyFk futureCompanyFk,
IFNULL(dest.nickname, origin.nickname) nickname,
- dest.landed
+ dest.landed,
+ dest.preparation
FROM (
- SELECT
- s.ticketFk,
- c.salesPersonFk workerFk,
- t.shipped,
- t.totalWithVat,
- st.name futureState,
- am.name futureAgency,
- count(s.id) futureLines,
- GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) futureIpt,
- CAST(SUM(litros) AS DECIMAL(10,0)) futureLiters,
- SUM(s.quantity <= (IFNULL(il.stock,0) + IFNULL(im.amount, 0))) hasStock,
- z.id futureZoneFk,
- z.name futureZoneName,
- st.classColor,
- t.clientFk,
- t.nickname,
- t.addressFk,
- t.warehouseFk,
- t.companyFk,
- t.agencyModeFk
- FROM ticket t
- JOIN client c ON c.id = t.clientFk
- JOIN sale s ON s.ticketFk = t.id
- JOIN saleVolume sv ON sv.saleFk = s.id
- JOIN item i ON i.id = s.itemFk
- JOIN ticketState ts ON ts.ticketFk = t.id
- JOIN state st ON st.id = ts.stateFk
- JOIN agencyMode am ON t.agencyModeFk = am.id
- JOIN zone z ON t.zoneFk = z.id
- LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk
- LEFT JOIN tmp.itemMinacum im ON im.itemFk = i.id
- AND im.warehouseFk = vWarehouseFk
- LEFT JOIN tmp.itemList il ON il.itemFk = i.id
- WHERE t.shipped BETWEEN vDateFuture AND util.dayend(vDateFuture)
- AND t.warehouseFk = vWarehouseFk
- GROUP BY t.id
+ SELECT s.ticketFk,
+ c.salesPersonFk workerFk,
+ t.shipped,
+ t.totalWithVat,
+ st.name futureState,
+ am.name futureAgency,
+ count(s.id) futureLines,
+ GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) futureIpt,
+ CAST(SUM(litros) AS DECIMAL(10,0)) futureLiters,
+ SUM(s.quantity <= (IFNULL(il.stock,0) + IFNULL(im.amount, 0))) hasStock,
+ z.id futureZoneFk,
+ z.name futureZoneName,
+ st.classColor,
+ t.clientFk,
+ t.nickname,
+ t.addressFk,
+ t.warehouseFk,
+ t.companyFk,
+ t.agencyModeFk
+ FROM ticket t
+ JOIN client c ON c.id = t.clientFk
+ JOIN sale s ON s.ticketFk = t.id
+ JOIN saleVolume sv ON sv.saleFk = s.id
+ JOIN item i ON i.id = s.itemFk
+ JOIN ticketState ts ON ts.ticketFk = t.id
+ JOIN `state` st ON st.id = ts.stateFk
+ JOIN agencyMode am ON t.agencyModeFk = am.id
+ JOIN `zone` z ON t.zoneFk = z.id
+ LEFT JOIN zoneClosure zc ON zc.zoneFk = t.zoneFk
+ LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk
+ LEFT JOIN tmp.itemMinacum im ON im.itemFk = i.id
+ AND im.warehouseFk = vWarehouseFk
+ LEFT JOIN tmp.itemList il ON il.itemFk = i.id
+ WHERE t.shipped BETWEEN vDateFuture AND util.dayend(vDateFuture)
+ AND t.warehouseFk = vWarehouseFk
+ GROUP BY t.id
) origin
LEFT JOIN (
- SELECT
- t.id ticketFk,
+ SELECT t.id ticketFk,
st.name state,
GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) ipt,
t.shipped,
@@ -108,18 +107,25 @@ BEGIN
t.warehouseFk,
t.companyFk,
t.landed,
- t.agencyModeFk
+ t.agencyModeFk,
+ SEC_TO_TIME(
+ COALESCE(HOUR(t.shipped), HOUR(zc.hour), HOUR(z.hour)) * 3600 +
+ COALESCE(MINUTE(t.shipped), MINUTE(zc.hour), MINUTE(z.hour)) * 60
+ ) preparation
FROM ticket t
JOIN sale s ON s.ticketFk = t.id
JOIN saleVolume sv ON sv.saleFk = s.id
JOIN item i ON i.id = s.itemFk
JOIN ticketState ts ON ts.ticketFk = t.id
- JOIN state st ON st.id = ts.stateFk
+ JOIN `state` st ON st.id = ts.stateFk
JOIN agencyMode am ON t.agencyModeFk = am.id
LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk
+ LEFT JOIN `zone` z ON z.id = t.zoneFk
+ LEFT JOIN zoneClosure zc ON zc.zoneFk = t.zoneFk
+ JOIN ticketCanAdvanceConfig tc
WHERE t.shipped BETWEEN vDateToAdvance AND util.dayend(vDateToAdvance)
AND t.warehouseFk = vWarehouseFk
- AND st.order <= 5
+ AND st.order <= tc.destinationOrder
GROUP BY t.id
) dest ON dest.addressFk = origin.addressFk
WHERE origin.hasStock;
diff --git a/db/routines/vn/procedures/ticket_canMerge.sql b/db/routines/vn/procedures/ticket_canMerge.sql
index c3f211027..ce90551db 100644
--- a/db/routines/vn/procedures/ticket_canMerge.sql
+++ b/db/routines/vn/procedures/ticket_canMerge.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_canMerge`(vDated DATE, vScopeDays INT, vLitersMax INT, vLinesMax INT, vWarehouseFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_canMerge`(vDated DATE, vScopeDays INT, vLitersMax INT, vLinesMax INT, vWarehouseFk INT)
BEGIN
/**
* Devuelve un listado de tickets susceptibles de fusionarse con otros tickets en el futuro
diff --git a/db/routines/vn/procedures/ticket_canbePostponed.sql b/db/routines/vn/procedures/ticket_canbePostponed.sql
index 442059b99..1f3c43057 100644
--- a/db/routines/vn/procedures/ticket_canbePostponed.sql
+++ b/db/routines/vn/procedures/ticket_canbePostponed.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_canbePostponed`(vOriginDated DATE, vFutureDated DATE, vWarehouseFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_canbePostponed`(vOriginDated DATE, vFutureDated DATE, vWarehouseFk INT)
BEGIN
/**
* Devuelve un listado de tickets susceptibles de fusionarse con otros tickets en el futuro
@@ -21,6 +21,7 @@ BEGIN
t.clientFk,
t.warehouseFk,
ts.alertLevel,
+ sub2.alertLevel futureAlertLevel,
t.shipped,
t.totalWithVat,
sub2.shipped futureShipped,
@@ -47,6 +48,7 @@ BEGIN
t.addressFk,
t.id,
t.shipped,
+ ts.alertLevel,
st.name state,
st.code,
st.classColor,
diff --git a/db/routines/vn/procedures/ticket_checkNoComponents.sql b/db/routines/vn/procedures/ticket_checkNoComponents.sql
index b03427192..aa2947763 100644
--- a/db/routines/vn/procedures/ticket_checkNoComponents.sql
+++ b/db/routines/vn/procedures/ticket_checkNoComponents.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_checkNoComponents`(vShippedFrom DATETIME, vShippedTo DATETIME)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_checkNoComponents`(vShippedFrom DATETIME, vShippedTo DATETIME)
BEGIN
/**
diff --git a/db/routines/vn/procedures/ticket_cloneAll.sql b/db/routines/vn/procedures/ticket_cloneAll.sql
index 4b3401ed7..30f0431f7 100644
--- a/db/routines/vn/procedures/ticket_cloneAll.sql
+++ b/db/routines/vn/procedures/ticket_cloneAll.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_cloneAll`(vTicketFk INT, vNewShipped DATE, vWithWarehouse BOOLEAN, OUT vNewTicketFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_cloneAll`(vTicketFk INT, vNewShipped DATE, vWithWarehouse BOOLEAN, OUT vNewTicketFk INT)
BEGIN
DECLARE vDone BOOLEAN DEFAULT FALSE;
diff --git a/db/routines/vn/procedures/ticket_cloneWeekly.sql b/db/routines/vn/procedures/ticket_cloneWeekly.sql
index e13e7e677..bfea00f31 100644
--- a/db/routines/vn/procedures/ticket_cloneWeekly.sql
+++ b/db/routines/vn/procedures/ticket_cloneWeekly.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_cloneWeekly`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_cloneWeekly`(
vDateFrom DATE,
vDateTo DATE
)
diff --git a/db/routines/vn/procedures/ticket_close.sql b/db/routines/vn/procedures/ticket_close.sql
index 97da5057c..0da001ffa 100644
--- a/db/routines/vn/procedures/ticket_close.sql
+++ b/db/routines/vn/procedures/ticket_close.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_close`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_close`()
BEGIN
/**
* Realiza el cierre de todos los
@@ -17,6 +17,7 @@ BEGIN
DECLARE vHasDailyInvoice BOOL;
DECLARE vWithPackage BOOL;
DECLARE vHasToInvoice BOOL;
+ DECLARE vSerial VARCHAR(2);
DECLARE cur CURSOR FOR
SELECT ticketFk FROM tmp.ticket_close;
@@ -83,14 +84,17 @@ BEGIN
GROUP BY e.freightItemFk);
IF(vHasDailyInvoice) AND vHasToInvoice THEN
+ SELECT invoiceSerial(vClientFk, vCompanyFk, 'quick') INTO vSerial;
+ IF vSerial IS NULL THEN
+ CALL util.throw('Cannot booking without a serial');
+ END IF;
- -- Facturacion rapida
CALL ticket_setState(vCurTicketFk, 'DELIVERED');
- -- Facturar si está contabilizado
+
IF vIsTaxDataChecked THEN
CALL invoiceOut_newFromClient(
vClientFk,
- (SELECT invoiceSerial(vClientFk, vCompanyFk, 'multiple')),
+ vSerial,
vShipped,
vCompanyFk,
NULL,
diff --git a/db/routines/vn/procedures/ticket_closeByTicket.sql b/db/routines/vn/procedures/ticket_closeByTicket.sql
index 837b809a2..bd0b5b102 100644
--- a/db/routines/vn/procedures/ticket_closeByTicket.sql
+++ b/db/routines/vn/procedures/ticket_closeByTicket.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_closeByTicket`(IN vTicketFk int)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_closeByTicket`(IN vTicketFk int)
BEGIN
/**
* Inserta el ticket en la tabla temporal
diff --git a/db/routines/vn/procedures/ticket_componentMakeUpdate.sql b/db/routines/vn/procedures/ticket_componentMakeUpdate.sql
index 4b0a5bdbc..fa6b79068 100644
--- a/db/routines/vn/procedures/ticket_componentMakeUpdate.sql
+++ b/db/routines/vn/procedures/ticket_componentMakeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_componentMakeUpdate`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_componentMakeUpdate`(
vTicketFk INT,
vClientFk INT,
vNickname VARCHAR(50),
diff --git a/db/routines/vn/procedures/ticket_componentPreview.sql b/db/routines/vn/procedures/ticket_componentPreview.sql
index 4bcd8c8ec..25bdd5ded 100644
--- a/db/routines/vn/procedures/ticket_componentPreview.sql
+++ b/db/routines/vn/procedures/ticket_componentPreview.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_componentPreview`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_componentPreview`(
vTicketFk INT,
vLanded DATE,
vAddressFk INT,
diff --git a/db/routines/vn/procedures/ticket_doCmr.sql b/db/routines/vn/procedures/ticket_doCmr.sql
index e9cd1d659..ba64944f8 100644
--- a/db/routines/vn/procedures/ticket_doCmr.sql
+++ b/db/routines/vn/procedures/ticket_doCmr.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_doCmr`(vSelf INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_doCmr`(vSelf INT)
BEGIN
/**
* Crea u actualiza la información del CMR asociado con
diff --git a/db/routines/vn/procedures/ticket_getFromFloramondo.sql b/db/routines/vn/procedures/ticket_getFromFloramondo.sql
index 5f2bedbb1..05c625653 100644
--- a/db/routines/vn/procedures/ticket_getFromFloramondo.sql
+++ b/db/routines/vn/procedures/ticket_getFromFloramondo.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getFromFloramondo`(vDateFrom DATE, vDateTo DATE)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_getFromFloramondo`(vDateFrom DATE, vDateTo DATE)
BEGIN
/**
* Genera una tabla con la lista de tickets de Floramondo
diff --git a/db/routines/vn/procedures/ticket_getMovable.sql b/db/routines/vn/procedures/ticket_getMovable.sql
index 512151bd4..cf56316f1 100644
--- a/db/routines/vn/procedures/ticket_getMovable.sql
+++ b/db/routines/vn/procedures/ticket_getMovable.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getMovable`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_getMovable`(
vTicketFk INT,
vNewShipped DATETIME,
vWarehouseFk INT
diff --git a/db/routines/vn/procedures/ticket_getProblems.sql b/db/routines/vn/procedures/ticket_getProblems.sql
index e9becab2a..1851bce47 100644
--- a/db/routines/vn/procedures/ticket_getProblems.sql
+++ b/db/routines/vn/procedures/ticket_getProblems.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getProblems`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_getProblems`(
vIsTodayRelative tinyint(1)
)
BEGIN
@@ -18,6 +18,7 @@ BEGIN
SELECT ticketFk,
MAX(isFreezed) isFreezed,
MAX(risk) risk,
+ MAX(hasRisk) hasRisk,
MAX(hasHighRisk) hasHighRisk,
MAX(hasTicketRequest) hasTicketRequest,
MAX(itemShortage) itemShortage,
@@ -32,19 +33,19 @@ BEGIN
FROM tmp.sale_problems
GROUP BY ticketFk;
- UPDATE tmp.ticket_problems tp
- SET tp.totalProblems = (
- (tp.isFreezed) +
- IF(tp.risk,TRUE, FALSE) +
- (tp.hasTicketRequest) +
- (tp.isTaxDataChecked = 0) +
- (tp.hasComponentLack) +
- (tp.itemDelay) +
- (tp.isTooLittle) +
- (tp.itemLost) +
- (tp.hasRounding) +
- (tp.itemShortage) +
- (tp.isVip)
+ UPDATE tmp.ticket_problems
+ SET totalProblems = (
+ (isFreezed) +
+ (hasHighRisk) +
+ (hasTicketRequest) +
+ (!isTaxDataChecked) +
+ (hasComponentLack) +
+ (itemDelay IS NOT NULL) +
+ (isTooLittle) +
+ (itemLost IS NOT NULL) +
+ (hasRounding IS NOT NULL) +
+ (itemShortage IS NOT NULL) +
+ (isVip)
);
DROP TEMPORARY TABLE tmp.sale_problems;
diff --git a/db/routines/vn/procedures/ticket_getSplitList.sql b/db/routines/vn/procedures/ticket_getSplitList.sql
index 10488d596..988bc2931 100644
--- a/db/routines/vn/procedures/ticket_getSplitList.sql
+++ b/db/routines/vn/procedures/ticket_getSplitList.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getSplitList`(vDated DATE, vHour TIME, vWarehouseFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_getSplitList`(vDated DATE, vHour TIME, vWarehouseFk INT)
BEGIN
/**
* Devuelve un listado con los tickets posibles para splitar HOY.
diff --git a/db/routines/vn/procedures/ticket_getTax.sql b/db/routines/vn/procedures/ticket_getTax.sql
index b9f5c14e3..947c45806 100644
--- a/db/routines/vn/procedures/ticket_getTax.sql
+++ b/db/routines/vn/procedures/ticket_getTax.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getTax`(IN vTaxArea VARCHAR(25))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_getTax`(IN vTaxArea VARCHAR(25))
BEGIN
/**
* Calcula la base imponible, el IVA y el recargo de equivalencia para
diff --git a/db/routines/vn/procedures/ticket_getWarnings.sql b/db/routines/vn/procedures/ticket_getWarnings.sql
index 0bda30446..d817a92bb 100644
--- a/db/routines/vn/procedures/ticket_getWarnings.sql
+++ b/db/routines/vn/procedures/ticket_getWarnings.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getWarnings`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_getWarnings`()
BEGIN
/**
* Calcula las adventencias para un conjunto de tickets.
diff --git a/db/routines/vn/procedures/ticket_getWithParameters.sql b/db/routines/vn/procedures/ticket_getWithParameters.sql
index 2d3d09311..02a6d8a1d 100644
--- a/db/routines/vn/procedures/ticket_getWithParameters.sql
+++ b/db/routines/vn/procedures/ticket_getWithParameters.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getWithParameters`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_getWithParameters`(
vClientFk INT,
vWarehouseFk INT,
vShipped DATE,
diff --git a/db/routines/vn/procedures/ticket_insertZone.sql b/db/routines/vn/procedures/ticket_insertZone.sql
index ee6eabdec..600bf80ee 100644
--- a/db/routines/vn/procedures/ticket_insertZone.sql
+++ b/db/routines/vn/procedures/ticket_insertZone.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_insertZone`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_insertZone`()
BEGIN
DECLARE vDone INT DEFAULT 0;
DECLARE vFechedTicket INT;
diff --git a/db/routines/vn/procedures/ticket_mergeSales.sql b/db/routines/vn/procedures/ticket_mergeSales.sql
index 2dc3a39da..8ef5f6d90 100644
--- a/db/routines/vn/procedures/ticket_mergeSales.sql
+++ b/db/routines/vn/procedures/ticket_mergeSales.sql
@@ -1,8 +1,14 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_mergeSales`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_mergeSales`(
vSelf INT
)
BEGIN
+/**
+ * Para un ticket se agrupa las diferentes líneas de venta de un mismo artículo en una sola
+ * siempre y cuando tengan el mismo precio y dto.
+ *
+ * @param vSelf Id de ticket
+ */
DECLARE vHasSalesToMerge BOOL;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
@@ -19,7 +25,7 @@ BEGIN
CREATE OR REPLACE TEMPORARY TABLE tSalesToPreserve
(PRIMARY KEY (id))
ENGINE = MEMORY
- SELECT s.id, s.itemFk, SUM(s.quantity) newQuantity
+ SELECT s.id, s.itemFk, SUM(s.quantity) newQuantity
FROM sale s
JOIN item i ON i.id = s.itemFk
JOIN itemType it ON it.id = i.typeFk
@@ -28,8 +34,7 @@ BEGIN
GROUP BY s.itemFk, s.price, s.discount
HAVING COUNT(*) > 1;
- SELECT COUNT(*) INTO vHasSalesToMerge
- FROM tSalesToPreserve;
+ SELECT COUNT(*) INTO vHasSalesToMerge FROM tSalesToPreserve;
IF vHasSalesToMerge THEN
UPDATE sale s
diff --git a/db/routines/vn/procedures/ticket_priceDifference.sql b/db/routines/vn/procedures/ticket_priceDifference.sql
index 4ef168840..5e36be8a0 100644
--- a/db/routines/vn/procedures/ticket_priceDifference.sql
+++ b/db/routines/vn/procedures/ticket_priceDifference.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_priceDifference`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_priceDifference`(
vTicketFk INT,
vLanded DATE,
vAddressFk INT,
diff --git a/db/routines/vn/procedures/ticket_printLabelPrevious.sql b/db/routines/vn/procedures/ticket_printLabelPrevious.sql
index cba42ff3e..e40e125b5 100644
--- a/db/routines/vn/procedures/ticket_printLabelPrevious.sql
+++ b/db/routines/vn/procedures/ticket_printLabelPrevious.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_printLabelPrevious`(vTicketFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_printLabelPrevious`(vTicketFk INT)
BEGIN
/**
* Calls the report_print procedure and passes it
diff --git a/db/routines/vn/procedures/ticket_recalc.sql b/db/routines/vn/procedures/ticket_recalc.sql
index 50065d03a..ee408a8ca 100644
--- a/db/routines/vn/procedures/ticket_recalc.sql
+++ b/db/routines/vn/procedures/ticket_recalc.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_recalc`(vSelf INT, vTaxArea VARCHAR(25))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_recalc`(vSelf INT, vTaxArea VARCHAR(25))
proc:BEGIN
/**
* Calcula y guarda el total con/sin IVA en un ticket.
diff --git a/db/routines/vn/procedures/ticket_recalcByScope.sql b/db/routines/vn/procedures/ticket_recalcByScope.sql
index ede755187..42652272c 100644
--- a/db/routines/vn/procedures/ticket_recalcByScope.sql
+++ b/db/routines/vn/procedures/ticket_recalcByScope.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_recalcByScope`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_recalcByScope`(
vScope VARCHAR(255),
vId INT
)
diff --git a/db/routines/vn/procedures/ticket_recalcComponents.sql b/db/routines/vn/procedures/ticket_recalcComponents.sql
index 0282c0e42..86a40a4eb 100644
--- a/db/routines/vn/procedures/ticket_recalcComponents.sql
+++ b/db/routines/vn/procedures/ticket_recalcComponents.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_recalcComponents`(vSelf INT, vOption VARCHAR(25))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_recalcComponents`(vSelf INT, vOption VARCHAR(25))
proc: BEGIN
/**
diff --git a/db/routines/vn/procedures/ticket_setNextState.sql b/db/routines/vn/procedures/ticket_setNextState.sql
index b09309a47..164bf34e4 100644
--- a/db/routines/vn/procedures/ticket_setNextState.sql
+++ b/db/routines/vn/procedures/ticket_setNextState.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setNextState`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_setNextState`(
vSelf INT
)
BEGIN
diff --git a/db/routines/vn/procedures/ticket_setParking.sql b/db/routines/vn/procedures/ticket_setParking.sql
index bd2a5370a..acc9a2aee 100644
--- a/db/routines/vn/procedures/ticket_setParking.sql
+++ b/db/routines/vn/procedures/ticket_setParking.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setParking`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_setParking`(
vSelf INT,
vParkingFk INT
)
diff --git a/db/routines/vn/procedures/ticket_setPreviousState.sql b/db/routines/vn/procedures/ticket_setPreviousState.sql
index c03d41b09..aaf482c30 100644
--- a/db/routines/vn/procedures/ticket_setPreviousState.sql
+++ b/db/routines/vn/procedures/ticket_setPreviousState.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setPreviousState`(vTicketFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_setPreviousState`(vTicketFk INT)
BEGIN
DECLARE vControlFk INT;
diff --git a/db/routines/vn/procedures/ticket_setProblem.sql b/db/routines/vn/procedures/ticket_setProblem.sql
index fea6d9b7d..bf305f2f0 100644
--- a/db/routines/vn/procedures/ticket_setProblem.sql
+++ b/db/routines/vn/procedures/ticket_setProblem.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setProblem`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_setProblem`(
vProblemCode VARCHAR(25)
)
BEGIN
diff --git a/db/routines/vn/procedures/ticket_setProblemFreeze.sql b/db/routines/vn/procedures/ticket_setProblemFreeze.sql
index 1de939ba7..622894dfa 100644
--- a/db/routines/vn/procedures/ticket_setProblemFreeze.sql
+++ b/db/routines/vn/procedures/ticket_setProblemFreeze.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setProblemFreeze`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_setProblemFreeze`(
vClientFk INT
)
BEGIN
diff --git a/db/routines/vn/procedures/ticket_setProblemRequest.sql b/db/routines/vn/procedures/ticket_setProblemRequest.sql
index 687facfc7..f84847b65 100644
--- a/db/routines/vn/procedures/ticket_setProblemRequest.sql
+++ b/db/routines/vn/procedures/ticket_setProblemRequest.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setProblemRequest`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_setProblemRequest`(
vSelf INT
)
BEGIN
diff --git a/db/routines/vn/procedures/ticket_setProblemRisk.sql b/db/routines/vn/procedures/ticket_setProblemRisk.sql
index efa5b10e2..60a188d3e 100644
--- a/db/routines/vn/procedures/ticket_setProblemRisk.sql
+++ b/db/routines/vn/procedures/ticket_setProblemRisk.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setProblemRisk`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_setProblemRisk`(
vSelf INT
)
BEGIN
diff --git a/db/routines/vn/procedures/ticket_setProblemRiskByClient.sql b/db/routines/vn/procedures/ticket_setProblemRiskByClient.sql
index 8479550de..1652fd29e 100644
--- a/db/routines/vn/procedures/ticket_setProblemRiskByClient.sql
+++ b/db/routines/vn/procedures/ticket_setProblemRiskByClient.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setProblemRiskByClient`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_setProblemRiskByClient`(
vClientFk INT
)
BEGIN
diff --git a/db/routines/vn/procedures/ticket_setProblemRounding.sql b/db/routines/vn/procedures/ticket_setProblemRounding.sql
deleted file mode 100644
index 551cf67d1..000000000
--- a/db/routines/vn/procedures/ticket_setProblemRounding.sql
+++ /dev/null
@@ -1,37 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setProblemRounding`(
- vSelf INT
-)
-BEGIN
-/**
- * Update the rounding problem for the sales lines of a ticket
- *
- * @param vSelf Id de ticket
- */
- DECLARE vWarehouseFk INT;
- DECLARE vDated DATE;
-
- SELECT warehouseFk, shipped
- INTO vWarehouseFk, vDated
- FROM ticket
- WHERE id = vSelf;
-
- CALL buy_getUltimate(NULL, vWarehouseFk, vDated);
-
- CREATE OR REPLACE TEMPORARY TABLE tmp.sale
- (INDEX(saleFk, isProblemCalcNeeded))
- SELECT s.id saleFk ,
- MOD(s.quantity, b.`grouping`) hasProblem,
- ticket_isProblemCalcNeeded(t.id) isProblemCalcNeeded
- FROM ticket t
- JOIN sale s ON s.ticketFk = t.id
- JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
- JOIN buy b ON b.id = bu.buyFk
- WHERE t.id = vSelf;
-
- CALL sale_setProblem('hasRounding');
-
- DROP TEMPORARY TABLE tmp.sale;
- DROP TEMPORARY TABLE tmp.buyUltimate;
-END$$
-DELIMITER ;
\ No newline at end of file
diff --git a/db/routines/vn/procedures/ticket_setProblemTaxDataChecked.sql b/db/routines/vn/procedures/ticket_setProblemTaxDataChecked.sql
index 9877b5acc..f5c9a88b6 100644
--- a/db/routines/vn/procedures/ticket_setProblemTaxDataChecked.sql
+++ b/db/routines/vn/procedures/ticket_setProblemTaxDataChecked.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
PROCEDURE `vn`.`ticket_setProblemTaxDataChecked`(vClientFk INT)
BEGIN
/**
diff --git a/db/routines/vn/procedures/ticket_setProblemTooLittle.sql b/db/routines/vn/procedures/ticket_setProblemTooLittle.sql
index 03677a05c..233b3d6df 100644
--- a/db/routines/vn/procedures/ticket_setProblemTooLittle.sql
+++ b/db/routines/vn/procedures/ticket_setProblemTooLittle.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setProblemTooLittle`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_setProblemTooLittle`(
vSelf INT
)
BEGIN
diff --git a/db/routines/vn/procedures/ticket_setProblemTooLittleItemCost.sql b/db/routines/vn/procedures/ticket_setProblemTooLittleItemCost.sql
index ac3814c07..acbfd22e9 100644
--- a/db/routines/vn/procedures/ticket_setProblemTooLittleItemCost.sql
+++ b/db/routines/vn/procedures/ticket_setProblemTooLittleItemCost.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setProblemTooLittleItemCost`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_setProblemTooLittleItemCost`(
vItemFk INT
)
BEGIN
diff --git a/db/routines/vn/procedures/ticket_setRisk.sql b/db/routines/vn/procedures/ticket_setRisk.sql
index e3cbaf231..9c006d1e2 100644
--- a/db/routines/vn/procedures/ticket_setRisk.sql
+++ b/db/routines/vn/procedures/ticket_setRisk.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setRisk`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_setRisk`(
vClientFk INT
)
BEGIN
diff --git a/db/routines/vn/procedures/ticket_setState.sql b/db/routines/vn/procedures/ticket_setState.sql
index bde8e0692..f4906fb11 100644
--- a/db/routines/vn/procedures/ticket_setState.sql
+++ b/db/routines/vn/procedures/ticket_setState.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setState`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_setState`(
vSelf INT,
vStateCode VARCHAR(255) COLLATE utf8_general_ci
)
diff --git a/db/routines/vn/procedures/ticket_setVolume.sql b/db/routines/vn/procedures/ticket_setVolume.sql
index 060a6fa57..c3cf0d057 100644
--- a/db/routines/vn/procedures/ticket_setVolume.sql
+++ b/db/routines/vn/procedures/ticket_setVolume.sql
@@ -1,10 +1,10 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setVolume`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_setVolume`(
vSelf INT
)
BEGIN
/**
- * Update the volume ticket
+ * Update the volume ticket.
*
* @param vSelf Ticket id
*/
diff --git a/db/routines/vn/procedures/ticket_setVolumeItemCost.sql b/db/routines/vn/procedures/ticket_setVolumeItemCost.sql
index f266cd769..3c23b7c34 100644
--- a/db/routines/vn/procedures/ticket_setVolumeItemCost.sql
+++ b/db/routines/vn/procedures/ticket_setVolumeItemCost.sql
@@ -1,29 +1,39 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setVolumeItemCost`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_setVolumeItemCost`(
vItemFk INT
)
BEGIN
/**
- * Update the volume tickets of item
+ * Update the volume of tickets containing the item.
*
- * @param vSelf Ticket id
+ * @param vItemFk Item id
*/
- CREATE OR REPLACE TEMPORARY TABLE tTicket
- (PRIMARY KEY (id))
- ENGINE = MEMORY
- SELECT t.id, SUM(s.quantity * ic.cm3delivery / 1000000) volume
+ DECLARE vTicket INT;
+ DECLARE vDone BOOL;
+
+ DECLARE vTickets CURSOR FOR
+ SELECT DISTINCT t.id
FROM sale s
JOIN ticket t ON t.id = s.ticketFk
JOIN itemCost ic ON ic.itemFk = s.itemFk
AND ic.warehouseFk = t.warehouseFk
WHERE s.itemFk = vItemFk
AND t.shipped >= util.VN_CURDATE()
- GROUP BY t.id;
+ AND t.refFk IS NULL;
- UPDATE ticket t
- JOIN tTicket tt ON tt.id = t.id
- SET t.volume = tt.volume;
+ DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
- DROP TEMPORARY TABLE tTicket;
+ OPEN vTickets;
+ l: LOOP
+ FETCH vTickets INTO vTicket;
+
+ IF vDone THEN
+ LEAVE l;
+ END IF;
+
+ CALL ticket_setVolume(vTicket);
+
+ END LOOP l;
+ CLOSE vTickets;
END$$
DELIMITER ;
diff --git a/db/routines/vn/procedures/ticket_split.sql b/db/routines/vn/procedures/ticket_split.sql
index 9a359b83f..c16b7d0df 100644
--- a/db/routines/vn/procedures/ticket_split.sql
+++ b/db/routines/vn/procedures/ticket_split.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_split`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_split`(
vTicketFk INT,
vTicketFutureFk INT,
vDated DATE
diff --git a/db/routines/vn/procedures/ticket_splitItemPackingType.sql b/db/routines/vn/procedures/ticket_splitItemPackingType.sql
index 86e621706..9a4bc01eb 100644
--- a/db/routines/vn/procedures/ticket_splitItemPackingType.sql
+++ b/db/routines/vn/procedures/ticket_splitItemPackingType.sql
@@ -1,15 +1,16 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_splitItemPackingType`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_splitItemPackingType`(
vSelf INT,
vOriginalItemPackingTypeFk VARCHAR(1)
)
-BEGIN
+proc:BEGIN
/**
* Clona y reparte las líneas de ventas de un ticket en funcion del tipo de empaquetado.
- * Respeta el id de ticket inicial para el tipo de empaquetado propuesto.
+ * Respeta el id de ticket original para el tipo de empaquetado propuesto.
*
* @param vSelf Id ticket
- * @param vOriginalItemPackingTypeFk Tipo empaquetado al que se mantiene el ticket original
+ * @param vOriginalItemPackingTypeFk Tipo empaquetado que se mantiene el ticket original
+ * @return table tmp.ticketIPT(ticketFk, itemPackingTypeFk)
*/
DECLARE vDone INT DEFAULT FALSE;
DECLARE vHasItemPackingType BOOL;
@@ -29,8 +30,14 @@ BEGIN
WHERE t.id = vSelf
AND i.itemPackingTypeFk = vOriginalItemPackingTypeFk;
+ CREATE OR REPLACE TEMPORARY TABLE tmp.ticketIPT(
+ ticketFk INT,
+ itemPackingTypeFk VARCHAR(1)
+ ) ENGINE=MEMORY
+ SELECT vSelf ticketFk, vOriginalItemPackingTypeFk itemPackingTypeFk;
+
IF NOT vHasItemPackingType THEN
- CALL util.throw('The ticket has not sales with the itemPackingType');
+ LEAVE proc;
END IF;
CREATE OR REPLACE TEMPORARY TABLE tSalesToMove (
@@ -68,10 +75,15 @@ BEGIN
CLOSE vItemPackingTypes;
UPDATE sale s
- JOIN tSalesToMove stm ON stm.saleFk = s.id
+ JOIN tSalesToMove stm ON stm.saleFk = s.id
SET s.ticketFk = stm.ticketFk
WHERE stm.ticketFk;
+ INSERT INTO tmp.ticketIPT (ticketFk, itemPackingTypeFk)
+ SELECT ticketFk, itemPackingTypeFk
+ FROM tSalesToMove
+ GROUP BY ticketFk;
+
DROP TEMPORARY TABLE tSalesToMove;
END$$
-DELIMITER ;
\ No newline at end of file
+DELIMITER ;
diff --git a/db/routines/vn/procedures/ticket_splitPackingComplete.sql b/db/routines/vn/procedures/ticket_splitPackingComplete.sql
index 528e8fbed..cc2e4183d 100644
--- a/db/routines/vn/procedures/ticket_splitPackingComplete.sql
+++ b/db/routines/vn/procedures/ticket_splitPackingComplete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_splitPackingComplete`(vTicketFk INT, vSectorFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_splitPackingComplete`(vTicketFk INT, vSectorFk INT)
BEGIN
DECLARE vNeedToSplit BOOLEAN;
diff --git a/db/routines/vn/procedures/timeBusiness_calculate.sql b/db/routines/vn/procedures/timeBusiness_calculate.sql
index 3cb734069..448a061ad 100644
--- a/db/routines/vn/procedures/timeBusiness_calculate.sql
+++ b/db/routines/vn/procedures/timeBusiness_calculate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`timeBusiness_calculate`(vDatedFrom DATETIME, vDatedTo DATETIME)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`timeBusiness_calculate`(vDatedFrom DATETIME, vDatedTo DATETIME)
BEGIN
/**
* Horas que debe trabajar un empleado según contrato y día.
diff --git a/db/routines/vn/procedures/timeBusiness_calculateAll.sql b/db/routines/vn/procedures/timeBusiness_calculateAll.sql
index 4e0ac7da5..6ba9edbd4 100644
--- a/db/routines/vn/procedures/timeBusiness_calculateAll.sql
+++ b/db/routines/vn/procedures/timeBusiness_calculateAll.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`timeBusiness_calculateAll`(vDatedFrom DATETIME, vDatedTo DATETIME)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`timeBusiness_calculateAll`(vDatedFrom DATETIME, vDatedTo DATETIME)
BEGIN
/**
diff --git a/db/routines/vn/procedures/timeBusiness_calculateByDepartment.sql b/db/routines/vn/procedures/timeBusiness_calculateByDepartment.sql
index 54c587342..8253e322f 100644
--- a/db/routines/vn/procedures/timeBusiness_calculateByDepartment.sql
+++ b/db/routines/vn/procedures/timeBusiness_calculateByDepartment.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`timeBusiness_calculateByDepartment`(vDepartmentFk INT, vDatedFrom DATETIME, vDatedTo DATETIME)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`timeBusiness_calculateByDepartment`(vDepartmentFk INT, vDatedFrom DATETIME, vDatedTo DATETIME)
BEGIN
/**
* @param vDepartmentFk
diff --git a/db/routines/vn/procedures/timeBusiness_calculateByUser.sql b/db/routines/vn/procedures/timeBusiness_calculateByUser.sql
index a54dfcc2e..800d21c73 100644
--- a/db/routines/vn/procedures/timeBusiness_calculateByUser.sql
+++ b/db/routines/vn/procedures/timeBusiness_calculateByUser.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`timeBusiness_calculateByUser`(vUserFk INT, vDatedFrom DATETIME, vDatedTo DATETIME)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`timeBusiness_calculateByUser`(vUserFk INT, vDatedFrom DATETIME, vDatedTo DATETIME)
BEGIN
/**
diff --git a/db/routines/vn/procedures/timeBusiness_calculateByWorker.sql b/db/routines/vn/procedures/timeBusiness_calculateByWorker.sql
index 89a4c0ab0..29a9f8f5c 100644
--- a/db/routines/vn/procedures/timeBusiness_calculateByWorker.sql
+++ b/db/routines/vn/procedures/timeBusiness_calculateByWorker.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`timeBusiness_calculateByWorker`(vWorkerFk INT, vDatedFrom DATETIME, vDatedTo DATETIME)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`timeBusiness_calculateByWorker`(vWorkerFk INT, vDatedFrom DATETIME, vDatedTo DATETIME)
BEGIN
/**
diff --git a/db/routines/vn/procedures/timeControl_calculate.sql b/db/routines/vn/procedures/timeControl_calculate.sql
index 258960265..f37e0f521 100644
--- a/db/routines/vn/procedures/timeControl_calculate.sql
+++ b/db/routines/vn/procedures/timeControl_calculate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`timeControl_calculate`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`timeControl_calculate`(
vDatedFrom DATETIME,
vDatedTo DATETIME)
BEGIN
diff --git a/db/routines/vn/procedures/timeControl_calculateAll.sql b/db/routines/vn/procedures/timeControl_calculateAll.sql
index c6354ad78..ae085a6a6 100644
--- a/db/routines/vn/procedures/timeControl_calculateAll.sql
+++ b/db/routines/vn/procedures/timeControl_calculateAll.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`timeControl_calculateAll`(vDatedFrom DATETIME, vDatedTo DATETIME)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`timeControl_calculateAll`(vDatedFrom DATETIME, vDatedTo DATETIME)
BEGIN
/**
diff --git a/db/routines/vn/procedures/timeControl_calculateByDepartment.sql b/db/routines/vn/procedures/timeControl_calculateByDepartment.sql
index bb9ccec60..bdd096a77 100644
--- a/db/routines/vn/procedures/timeControl_calculateByDepartment.sql
+++ b/db/routines/vn/procedures/timeControl_calculateByDepartment.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`timeControl_calculateByDepartment`(vDepartmentFk INT, vDatedFrom DATETIME, vDatedTo DATETIME)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`timeControl_calculateByDepartment`(vDepartmentFk INT, vDatedFrom DATETIME, vDatedTo DATETIME)
BEGIN
/**
* @param vDepartmentFk
diff --git a/db/routines/vn/procedures/timeControl_calculateByUser.sql b/db/routines/vn/procedures/timeControl_calculateByUser.sql
index 8e831cb4c..4c123a840 100644
--- a/db/routines/vn/procedures/timeControl_calculateByUser.sql
+++ b/db/routines/vn/procedures/timeControl_calculateByUser.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`timeControl_calculateByUser`(vUserFk INT, vDatedFrom DATETIME, vDatedTo DATETIME)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`timeControl_calculateByUser`(vUserFk INT, vDatedFrom DATETIME, vDatedTo DATETIME)
BEGIN
/**
diff --git a/db/routines/vn/procedures/timeControl_calculateByWorker.sql b/db/routines/vn/procedures/timeControl_calculateByWorker.sql
index 98c3dedd2..d4b14efe9 100644
--- a/db/routines/vn/procedures/timeControl_calculateByWorker.sql
+++ b/db/routines/vn/procedures/timeControl_calculateByWorker.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`timeControl_calculateByWorker`(vWorkerFk INT, vDatedFrom DATETIME, vDatedTo DATETIME)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`timeControl_calculateByWorker`(vWorkerFk INT, vDatedFrom DATETIME, vDatedTo DATETIME)
BEGIN
/**
diff --git a/db/routines/vn/procedures/timeControl_getError.sql b/db/routines/vn/procedures/timeControl_getError.sql
index 6e5ca02ab..fa6345b9c 100644
--- a/db/routines/vn/procedures/timeControl_getError.sql
+++ b/db/routines/vn/procedures/timeControl_getError.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`timeControl_getError`(vDatedFrom DATETIME, vDatedTo DATETIME)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`timeControl_getError`(vDatedFrom DATETIME, vDatedTo DATETIME)
BEGIN
/*
* @param vDatedFrom
diff --git a/db/routines/vn/procedures/tpvTransaction_checkStatus.sql b/db/routines/vn/procedures/tpvTransaction_checkStatus.sql
index e16c20161..eeea13979 100644
--- a/db/routines/vn/procedures/tpvTransaction_checkStatus.sql
+++ b/db/routines/vn/procedures/tpvTransaction_checkStatus.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`tpvTransaction_checkStatus`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`tpvTransaction_checkStatus`()
BEGIN
/**
*
diff --git a/db/routines/vn/procedures/travelVolume.sql b/db/routines/vn/procedures/travelVolume.sql
index 21eae36ac..2e2cdc83b 100644
--- a/db/routines/vn/procedures/travelVolume.sql
+++ b/db/routines/vn/procedures/travelVolume.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`travelVolume`(vTravelFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`travelVolume`(vTravelFk INT)
BEGIN
SELECT w1.name AS ORI,
diff --git a/db/routines/vn/procedures/travelVolume_get.sql b/db/routines/vn/procedures/travelVolume_get.sql
index f9d00aeb4..99c0acbb8 100644
--- a/db/routines/vn/procedures/travelVolume_get.sql
+++ b/db/routines/vn/procedures/travelVolume_get.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`travelVolume_get`(vFromDated DATE, vToDated DATE, vWarehouseFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`travelVolume_get`(vFromDated DATE, vToDated DATE, vWarehouseFk INT)
BEGIN
SELECT tr.landed Fecha,
a.name Agencia,
diff --git a/db/routines/vn/procedures/travel_checkDates.sql b/db/routines/vn/procedures/travel_checkDates.sql
index 45690fcb4..004fefa64 100644
--- a/db/routines/vn/procedures/travel_checkDates.sql
+++ b/db/routines/vn/procedures/travel_checkDates.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`travel_checkDates`(vShipped DATE, vLanded DATE)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`travel_checkDates`(vShipped DATE, vLanded DATE)
BEGIN
/**
* Checks the landing/shipment dates of travel, throws an error
diff --git a/db/routines/vn/procedures/travel_checkPackaging.sql b/db/routines/vn/procedures/travel_checkPackaging.sql
index 59df1b894..2b67f4d25 100644
--- a/db/routines/vn/procedures/travel_checkPackaging.sql
+++ b/db/routines/vn/procedures/travel_checkPackaging.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`travel_checkPackaging`(vSelf INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`travel_checkPackaging`(vSelf INT)
BEGIN
DECLARE vDone BOOL;
DECLARE vEntryFk INT;
diff --git a/db/routines/vn/procedures/travel_checkWarehouseIsFeedStock.sql b/db/routines/vn/procedures/travel_checkWarehouseIsFeedStock.sql
index ef69d772b..27ca9955f 100644
--- a/db/routines/vn/procedures/travel_checkWarehouseIsFeedStock.sql
+++ b/db/routines/vn/procedures/travel_checkWarehouseIsFeedStock.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`travel_checkWarehouseIsFeedStock`(vWarehouseFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`travel_checkWarehouseIsFeedStock`(vWarehouseFk INT)
proc: BEGIN
/*
* Check that the warehouse is not Feed Stock
diff --git a/db/routines/vn/procedures/travel_clone.sql b/db/routines/vn/procedures/travel_clone.sql
index 96500baa1..74a76d477 100644
--- a/db/routines/vn/procedures/travel_clone.sql
+++ b/db/routines/vn/procedures/travel_clone.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`travel_clone`(vSelf INT, vDays INT, OUT vNewTravelFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`travel_clone`(vSelf INT, vDays INT, OUT vNewTravelFk INT)
BEGIN
/**
* Clona un travel el número de dias indicado y devuelve su id.
diff --git a/db/routines/vn/procedures/travel_cloneWithEntries.sql b/db/routines/vn/procedures/travel_cloneWithEntries.sql
index e2d086fc8..ee26aea32 100644
--- a/db/routines/vn/procedures/travel_cloneWithEntries.sql
+++ b/db/routines/vn/procedures/travel_cloneWithEntries.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`travel_cloneWithEntries`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`travel_cloneWithEntries`(
IN vTravelFk INT,
IN vDateStart DATE,
IN vDateEnd DATE,
diff --git a/db/routines/vn/procedures/travel_getDetailFromContinent.sql b/db/routines/vn/procedures/travel_getDetailFromContinent.sql
index e81e648b3..a9ee0b6ca 100644
--- a/db/routines/vn/procedures/travel_getDetailFromContinent.sql
+++ b/db/routines/vn/procedures/travel_getDetailFromContinent.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`travel_getDetailFromContinent`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`travel_getDetailFromContinent`(
vContinentFk INT
)
BEGIN
diff --git a/db/routines/vn/procedures/travel_getEntriesMissingPackage.sql b/db/routines/vn/procedures/travel_getEntriesMissingPackage.sql
index 35d30e0c4..dc78f964c 100644
--- a/db/routines/vn/procedures/travel_getEntriesMissingPackage.sql
+++ b/db/routines/vn/procedures/travel_getEntriesMissingPackage.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`travel_getEntriesMissingPackage`(vSelf INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`travel_getEntriesMissingPackage`(vSelf INT)
BEGIN
DECLARE vpackageOrPackingNull INT;
DECLARE vTravelFk INT;
diff --git a/db/routines/vn/procedures/travel_moveRaids.sql b/db/routines/vn/procedures/travel_moveRaids.sql
index c7696e829..95e02ec55 100644
--- a/db/routines/vn/procedures/travel_moveRaids.sql
+++ b/db/routines/vn/procedures/travel_moveRaids.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`travel_moveRaids`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`travel_moveRaids`()
BEGIN
/*
diff --git a/db/routines/vn/procedures/travel_recalc.sql b/db/routines/vn/procedures/travel_recalc.sql
index 46d1cdc4f..9aebeaad8 100644
--- a/db/routines/vn/procedures/travel_recalc.sql
+++ b/db/routines/vn/procedures/travel_recalc.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`travel_recalc`(vSelf INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`travel_recalc`(vSelf INT)
proc: BEGIN
/**
* Updates the number of entries assigned to the travel.
diff --git a/db/routines/vn/procedures/travel_throwAwb.sql b/db/routines/vn/procedures/travel_throwAwb.sql
index 1b54f8532..a372e4600 100644
--- a/db/routines/vn/procedures/travel_throwAwb.sql
+++ b/db/routines/vn/procedures/travel_throwAwb.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`travel_throwAwb`(vSelf INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`travel_throwAwb`(vSelf INT)
BEGIN
/**
* Throws an error if travel does not have a logical AWB
diff --git a/db/routines/vn/procedures/travel_upcomingArrivals.sql b/db/routines/vn/procedures/travel_upcomingArrivals.sql
index a2cd3733c..f271f55a0 100644
--- a/db/routines/vn/procedures/travel_upcomingArrivals.sql
+++ b/db/routines/vn/procedures/travel_upcomingArrivals.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`travel_upcomingArrivals`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`travel_upcomingArrivals`(
vWarehouseFk INT,
vDate DATETIME
)
diff --git a/db/routines/vn/procedures/travel_updatePacking.sql b/db/routines/vn/procedures/travel_updatePacking.sql
index 0f63bbf62..dd73bb199 100644
--- a/db/routines/vn/procedures/travel_updatePacking.sql
+++ b/db/routines/vn/procedures/travel_updatePacking.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`travel_updatePacking`(vItemFk INT, vPacking INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`travel_updatePacking`(vItemFk INT, vPacking INT)
BEGIN
/**
* Actualiza packing para los movimientos de almacén de la subasta al almacén central
diff --git a/db/routines/vn/procedures/travel_weeklyClone.sql b/db/routines/vn/procedures/travel_weeklyClone.sql
index a92916c10..182e824af 100644
--- a/db/routines/vn/procedures/travel_weeklyClone.sql
+++ b/db/routines/vn/procedures/travel_weeklyClone.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`travel_weeklyClone`(vSinceWeek INT, vToWeek INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`travel_weeklyClone`(vSinceWeek INT, vToWeek INT)
BEGIN
/**
* Clona los traslados plantilla para las semanas pasadas por parámetros.
diff --git a/db/routines/vn/procedures/typeTagMake.sql b/db/routines/vn/procedures/typeTagMake.sql
index ddfc7fdb9..168b3f4ef 100644
--- a/db/routines/vn/procedures/typeTagMake.sql
+++ b/db/routines/vn/procedures/typeTagMake.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`typeTagMake`(vTypeFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`typeTagMake`(vTypeFk INT)
BEGIN
/*
* Plantilla para modificar reemplazar todos los tags
diff --git a/db/routines/vn/procedures/updatePedidosInternos.sql b/db/routines/vn/procedures/updatePedidosInternos.sql
index 97b01bf8b..b2bc25cb9 100644
--- a/db/routines/vn/procedures/updatePedidosInternos.sql
+++ b/db/routines/vn/procedures/updatePedidosInternos.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`updatePedidosInternos`(vItemFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`updatePedidosInternos`(vItemFk INT)
BEGIN
UPDATE vn.item SET upToDown = 0 WHERE item.id = vItemFk;
diff --git a/db/routines/vn/procedures/vehicle_checkNumberPlate.sql b/db/routines/vn/procedures/vehicle_checkNumberPlate.sql
index 8e3f24d76..cbbcbec63 100644
--- a/db/routines/vn/procedures/vehicle_checkNumberPlate.sql
+++ b/db/routines/vn/procedures/vehicle_checkNumberPlate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`vehicle_checkNumberPlate`(vNumberPlate VARCHAR(10), vCountryCodeFk VARCHAR(2))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`vehicle_checkNumberPlate`(vNumberPlate VARCHAR(10), vCountryCodeFk VARCHAR(2))
BEGIN
/**
* Comprueba si la matricula pasada tiene el formato correcto dependiendo del pais del vehiculo
diff --git a/db/routines/vn/procedures/vehicle_notifyEvents.sql b/db/routines/vn/procedures/vehicle_notifyEvents.sql
index 1a07a96e2..756b20bca 100644
--- a/db/routines/vn/procedures/vehicle_notifyEvents.sql
+++ b/db/routines/vn/procedures/vehicle_notifyEvents.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`vehicle_notifyEvents`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`vehicle_notifyEvents`()
proc:BEGIN
/**
* Query the vehicleEvent table to see if there are any events that need to be notified.
diff --git a/db/routines/vn/procedures/visible_getMisfit.sql b/db/routines/vn/procedures/visible_getMisfit.sql
index 631f0236e..a7abdca9a 100644
--- a/db/routines/vn/procedures/visible_getMisfit.sql
+++ b/db/routines/vn/procedures/visible_getMisfit.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`visible_getMisfit`(vSectorFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`visible_getMisfit`(vSectorFk INT)
BEGIN
/* Devuelve una tabla temporal con los descuadres entre el visible teórico y lo ubicado en la práctica
diff --git a/db/routines/vn/procedures/warehouseFitting.sql b/db/routines/vn/procedures/warehouseFitting.sql
index 4be35a3ee..10347bebf 100644
--- a/db/routines/vn/procedures/warehouseFitting.sql
+++ b/db/routines/vn/procedures/warehouseFitting.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`warehouseFitting`(IN vWhOrigin INT , IN vWhDestiny INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`warehouseFitting`(IN vWhOrigin INT , IN vWhDestiny INT)
BEGIN
DECLARE vCacheVisibleOriginFk INT;
DECLARE vCacheVisibleDestinyFk INT;
diff --git a/db/routines/vn/procedures/warehouseFitting_byTravel.sql b/db/routines/vn/procedures/warehouseFitting_byTravel.sql
index db67c1599..9e0a7abc0 100644
--- a/db/routines/vn/procedures/warehouseFitting_byTravel.sql
+++ b/db/routines/vn/procedures/warehouseFitting_byTravel.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`warehouseFitting_byTravel`(IN vTravelFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`warehouseFitting_byTravel`(IN vTravelFk INT)
BEGIN
DECLARE vWhOrigin INT;
diff --git a/db/routines/vn/procedures/workerCalculateBoss.sql b/db/routines/vn/procedures/workerCalculateBoss.sql
index 0fc08ed40..afbf1f89d 100644
--- a/db/routines/vn/procedures/workerCalculateBoss.sql
+++ b/db/routines/vn/procedures/workerCalculateBoss.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerCalculateBoss`(vWorker INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`workerCalculateBoss`(vWorker INT)
BEGIN
/**
* Actualiza la tabla workerBosses
diff --git a/db/routines/vn/procedures/workerCalendar_calculateBusiness.sql b/db/routines/vn/procedures/workerCalendar_calculateBusiness.sql
index 72b461154..429435e3e 100644
--- a/db/routines/vn/procedures/workerCalendar_calculateBusiness.sql
+++ b/db/routines/vn/procedures/workerCalendar_calculateBusiness.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerCalendar_calculateBusiness`(vYear INT, vBusinessFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`workerCalendar_calculateBusiness`(vYear INT, vBusinessFk INT)
BEGIN
/**
* Calcula los días y horas de vacaciones en función de un contrato y año
diff --git a/db/routines/vn/procedures/workerCalendar_calculateYear.sql b/db/routines/vn/procedures/workerCalendar_calculateYear.sql
index 9e3baf641..ccda31ce3 100644
--- a/db/routines/vn/procedures/workerCalendar_calculateYear.sql
+++ b/db/routines/vn/procedures/workerCalendar_calculateYear.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerCalendar_calculateYear`(vYear INT, vWorkerFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`workerCalendar_calculateYear`(vYear INT, vWorkerFk INT)
BEGIN
/**
diff --git a/db/routines/vn/procedures/workerCreateExternal.sql b/db/routines/vn/procedures/workerCreateExternal.sql
index f8cea70b1..c825e6fc5 100644
--- a/db/routines/vn/procedures/workerCreateExternal.sql
+++ b/db/routines/vn/procedures/workerCreateExternal.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerCreateExternal`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`workerCreateExternal`(
vFirstName VARCHAR(50),
vSurname1 VARCHAR(50),
vSurname2 VARCHAR(50),
diff --git a/db/routines/vn/procedures/workerDepartmentByDate.sql b/db/routines/vn/procedures/workerDepartmentByDate.sql
index 40a099d64..466fd3ab6 100644
--- a/db/routines/vn/procedures/workerDepartmentByDate.sql
+++ b/db/routines/vn/procedures/workerDepartmentByDate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerDepartmentByDate`(vDate DATE)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`workerDepartmentByDate`(vDate DATE)
BEGIN
DROP TEMPORARY TABLE IF EXISTS tmp.workerDepartmentByDate;
diff --git a/db/routines/vn/procedures/workerDisable.sql b/db/routines/vn/procedures/workerDisable.sql
index 04612a6dc..7760d5de0 100644
--- a/db/routines/vn/procedures/workerDisable.sql
+++ b/db/routines/vn/procedures/workerDisable.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerDisable`(vUserId int)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`workerDisable`(vUserId int)
mainLabel:BEGIN
IF (SELECT COUNT(*) FROM workerDisableExcluded WHERE workerFk = vUserId AND (dated > util.VN_CURDATE() OR dated IS NULL)) > 0 THEN
diff --git a/db/routines/vn/procedures/workerDisableAll.sql b/db/routines/vn/procedures/workerDisableAll.sql
index e2f7740b2..5c1aed342 100644
--- a/db/routines/vn/procedures/workerDisableAll.sql
+++ b/db/routines/vn/procedures/workerDisableAll.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerDisableAll`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`workerDisableAll`()
BEGIN
DECLARE done BOOL DEFAULT FALSE;
DECLARE vUserFk INT;
diff --git a/db/routines/vn/procedures/workerForAllCalculateBoss.sql b/db/routines/vn/procedures/workerForAllCalculateBoss.sql
index f3574116e..4db97e017 100644
--- a/db/routines/vn/procedures/workerForAllCalculateBoss.sql
+++ b/db/routines/vn/procedures/workerForAllCalculateBoss.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerForAllCalculateBoss`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`workerForAllCalculateBoss`()
BEGIN
/**
* Actualiza la tabla workerBosses utilizando el procedimiento
diff --git a/db/routines/vn/procedures/workerJourney_replace.sql b/db/routines/vn/procedures/workerJourney_replace.sql
index 1fcb8c590..7156e8658 100644
--- a/db/routines/vn/procedures/workerJourney_replace.sql
+++ b/db/routines/vn/procedures/workerJourney_replace.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerJourney_replace`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`workerJourney_replace`(
vDatedFrom DATE,
vDatedTo DATE,
vWorkerFk INT)
diff --git a/db/routines/vn/procedures/workerMistakeType_get.sql b/db/routines/vn/procedures/workerMistakeType_get.sql
index ae81640a1..3429521e5 100644
--- a/db/routines/vn/procedures/workerMistakeType_get.sql
+++ b/db/routines/vn/procedures/workerMistakeType_get.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerMistakeType_get`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`workerMistakeType_get`()
BEGIN
/**
diff --git a/db/routines/vn/procedures/workerMistake_add.sql b/db/routines/vn/procedures/workerMistake_add.sql
index c4786090b..3dfc67046 100644
--- a/db/routines/vn/procedures/workerMistake_add.sql
+++ b/db/routines/vn/procedures/workerMistake_add.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerMistake_add`(vWorkerFk INT, vWorkerMistakeTypeFk VARCHAR(10))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`workerMistake_add`(vWorkerFk INT, vWorkerMistakeTypeFk VARCHAR(10))
BEGIN
/**
* Añade error al trabajador
diff --git a/db/routines/vn/procedures/workerTimeControlSOWP.sql b/db/routines/vn/procedures/workerTimeControlSOWP.sql
index 14959b942..80e57d5c3 100644
--- a/db/routines/vn/procedures/workerTimeControlSOWP.sql
+++ b/db/routines/vn/procedures/workerTimeControlSOWP.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerTimeControlSOWP`(IN vUserFk INT, IN vDated DATE)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`workerTimeControlSOWP`(IN vUserFk INT, IN vDated DATE)
BEGIN
SET @order := 0;
diff --git a/db/routines/vn/procedures/workerTimeControl_calculateOddDays.sql b/db/routines/vn/procedures/workerTimeControl_calculateOddDays.sql
index 9c1e58608..57fd3e977 100644
--- a/db/routines/vn/procedures/workerTimeControl_calculateOddDays.sql
+++ b/db/routines/vn/procedures/workerTimeControl_calculateOddDays.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerTimeControl_calculateOddDays`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`workerTimeControl_calculateOddDays`()
BEGIN
/**
* Calculo de las fichadas impares por empleado y dia.
diff --git a/db/routines/vn/procedures/workerTimeControl_check.sql b/db/routines/vn/procedures/workerTimeControl_check.sql
index ce0e51490..30cf5c639 100644
--- a/db/routines/vn/procedures/workerTimeControl_check.sql
+++ b/db/routines/vn/procedures/workerTimeControl_check.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerTimeControl_check`(vUserFk INT, vDated DATE,vTabletFk VARCHAR(100))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`workerTimeControl_check`(vUserFk INT, vDated DATE,vTabletFk VARCHAR(100))
proc: BEGIN
/**
* Verifica si el empleado puede fichar en el momento actual, si puede fichar llama a workerTimeControlAdd
diff --git a/db/routines/vn/procedures/workerTimeControl_checkBreak.sql b/db/routines/vn/procedures/workerTimeControl_checkBreak.sql
index 15dd12373..81850df9f 100644
--- a/db/routines/vn/procedures/workerTimeControl_checkBreak.sql
+++ b/db/routines/vn/procedures/workerTimeControl_checkBreak.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerTimeControl_checkBreak`(vStarted DATE)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`workerTimeControl_checkBreak`(vStarted DATE)
BEGIN
/**
* Retorna los trabajadores que no han respetado el descanso semanal de 36/72 horas
diff --git a/db/routines/vn/procedures/workerTimeControl_clockIn.sql b/db/routines/vn/procedures/workerTimeControl_clockIn.sql
index a1ce53bc2..522546918 100644
--- a/db/routines/vn/procedures/workerTimeControl_clockIn.sql
+++ b/db/routines/vn/procedures/workerTimeControl_clockIn.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerTimeControl_clockIn`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`workerTimeControl_clockIn`(
vWorkerFk INT,
vTimed DATETIME,
vDirection VARCHAR(10),
diff --git a/db/routines/vn/procedures/workerTimeControl_direction.sql b/db/routines/vn/procedures/workerTimeControl_direction.sql
index 8e807084c..84db396cc 100644
--- a/db/routines/vn/procedures/workerTimeControl_direction.sql
+++ b/db/routines/vn/procedures/workerTimeControl_direction.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerTimeControl_direction`(vWorkerFk VARCHAR(10), vTimed DATETIME)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`workerTimeControl_direction`(vWorkerFk VARCHAR(10), vTimed DATETIME)
BEGIN
/**
* Devuelve que direcciones de fichadas son lógicas a partir de la anterior fichada
diff --git a/db/routines/vn/procedures/workerTimeControl_getClockIn.sql b/db/routines/vn/procedures/workerTimeControl_getClockIn.sql
index 11cd23fa5..454cd3c77 100644
--- a/db/routines/vn/procedures/workerTimeControl_getClockIn.sql
+++ b/db/routines/vn/procedures/workerTimeControl_getClockIn.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerTimeControl_getClockIn`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`workerTimeControl_getClockIn`(
vUserFk INT,
vDated DATE)
BEGIN
diff --git a/db/routines/vn/procedures/workerTimeControl_login.sql b/db/routines/vn/procedures/workerTimeControl_login.sql
index c46663e1f..0a138693c 100644
--- a/db/routines/vn/procedures/workerTimeControl_login.sql
+++ b/db/routines/vn/procedures/workerTimeControl_login.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerTimeControl_login`(vWorkerFk VARCHAR(10))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`workerTimeControl_login`(vWorkerFk VARCHAR(10))
BEGIN
/**
* Consulta la información del usuario y los botones que tiene que activar en la tablet tras hacer login
diff --git a/db/routines/vn/procedures/workerTimeControl_remove.sql b/db/routines/vn/procedures/workerTimeControl_remove.sql
index 7b34cbbeb..b4e55986a 100644
--- a/db/routines/vn/procedures/workerTimeControl_remove.sql
+++ b/db/routines/vn/procedures/workerTimeControl_remove.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerTimeControl_remove`(IN vUserFk INT, IN vTimed DATETIME)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`workerTimeControl_remove`(IN vUserFk INT, IN vTimed DATETIME)
BEGIN
DECLARE vDirectionRemove VARCHAR(6);
diff --git a/db/routines/vn/procedures/workerTimeControl_sendMailByDepartment.sql b/db/routines/vn/procedures/workerTimeControl_sendMailByDepartment.sql
index 5b276084a..b8af457d0 100644
--- a/db/routines/vn/procedures/workerTimeControl_sendMailByDepartment.sql
+++ b/db/routines/vn/procedures/workerTimeControl_sendMailByDepartment.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerTimeControl_sendMailByDepartment`(IN vDatedFrom DATETIME, IN vDatedTo DATETIME, IN vWorkerFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`workerTimeControl_sendMailByDepartment`(IN vDatedFrom DATETIME, IN vDatedTo DATETIME, IN vWorkerFk INT)
BEGIN
/**
* Inserta el registro de horario semanalmente de PRODUCCION, CAMARA, REPARTO, TALLER NATURAL y TALLER ARTIFICIAL en vn.mail.
diff --git a/db/routines/vn/procedures/workerTimeControl_sendMailByDepartmentLauncher.sql b/db/routines/vn/procedures/workerTimeControl_sendMailByDepartmentLauncher.sql
index 406bb8d8d..e1ccb1c78 100644
--- a/db/routines/vn/procedures/workerTimeControl_sendMailByDepartmentLauncher.sql
+++ b/db/routines/vn/procedures/workerTimeControl_sendMailByDepartmentLauncher.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerTimeControl_sendMailByDepartmentLauncher`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`workerTimeControl_sendMailByDepartmentLauncher`()
BEGIN
DECLARE vDatedFrom, vDatedTo DATETIME;
diff --git a/db/routines/vn/procedures/workerTimeControl_weekCheckBreak.sql b/db/routines/vn/procedures/workerTimeControl_weekCheckBreak.sql
index 70ef3da07..af87a251e 100644
--- a/db/routines/vn/procedures/workerTimeControl_weekCheckBreak.sql
+++ b/db/routines/vn/procedures/workerTimeControl_weekCheckBreak.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerTimeControl_weekCheckBreak`(vStarted DATE, vEnded DATE)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`workerTimeControl_weekCheckBreak`(vStarted DATE, vEnded DATE)
BEGIN
/**
* Retorna los trabajadores que no han respetado el descanso semanal de 36/72 horas
diff --git a/db/routines/vn/procedures/workerWeekControl.sql b/db/routines/vn/procedures/workerWeekControl.sql
index 8001d8d3a..186b0a35d 100644
--- a/db/routines/vn/procedures/workerWeekControl.sql
+++ b/db/routines/vn/procedures/workerWeekControl.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerWeekControl`(vUserFk INT, vDated DATE, vTabletFk VARCHAR(100))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`workerWeekControl`(vUserFk INT, vDated DATE, vTabletFk VARCHAR(100))
BEGIN
/*
* Devuelve la cantidad de descansos de 12h y de 36 horas que ha disfrutado el trabajador
diff --git a/db/routines/vn/procedures/worker_checkMultipleDevice.sql b/db/routines/vn/procedures/worker_checkMultipleDevice.sql
index 00df08d49..71978ca3b 100644
--- a/db/routines/vn/procedures/worker_checkMultipleDevice.sql
+++ b/db/routines/vn/procedures/worker_checkMultipleDevice.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`worker_checkMultipleDevice`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`worker_checkMultipleDevice`(
vSelf INT
)
BEGIN
diff --git a/db/routines/vn/procedures/worker_getFromHasMistake.sql b/db/routines/vn/procedures/worker_getFromHasMistake.sql
index 052097e79..a65558bbb 100644
--- a/db/routines/vn/procedures/worker_getFromHasMistake.sql
+++ b/db/routines/vn/procedures/worker_getFromHasMistake.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`worker_getFromHasMistake`(vDepartmentFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`worker_getFromHasMistake`(vDepartmentFk INT)
BEGIN
/**
diff --git a/db/routines/vn/procedures/worker_getHierarchy.sql b/db/routines/vn/procedures/worker_getHierarchy.sql
index de6956898..cbcdd8131 100644
--- a/db/routines/vn/procedures/worker_getHierarchy.sql
+++ b/db/routines/vn/procedures/worker_getHierarchy.sql
@@ -1,5 +1,7 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`worker_getHierarchy`(vUserFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`worker_getHierarchy`(
+ vUserFk INT
+)
BEGIN
/**
* Retorna una tabla temporal con los trabajadores que tiene
@@ -12,15 +14,16 @@ BEGIN
(PRIMARY KEY (workerFk))
ENGINE = MEMORY
WITH RECURSIVE workerHierarchy AS (
- SELECT id workerFk, bossFk, 0 depth
+ SELECT id workerFk, bossFk, 0 `depth`, CAST(id AS CHAR(255)) `path`
FROM vn.worker
WHERE id = vUserFk
UNION ALL
- SELECT w.id, w.bossFk, wh.depth + 1
+ SELECT w.id, w.bossFk, wh.`depth` + 1, CONCAT(wh.`path`, ',', w.id)
FROM vn.worker w
JOIN workerHierarchy wh ON w.bossFk = wh.workerFk
+ WHERE NOT FIND_IN_SET(w.id, wh.`path`)
)
- SELECT *
+ SELECT *
FROM workerHierarchy
ORDER BY depth, workerFk;
END$$
diff --git a/db/routines/vn/procedures/worker_getSector.sql b/db/routines/vn/procedures/worker_getSector.sql
index 759bb839b..3d636394d 100644
--- a/db/routines/vn/procedures/worker_getSector.sql
+++ b/db/routines/vn/procedures/worker_getSector.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`worker_getSector`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`worker_getSector`()
BEGIN
/**
diff --git a/db/routines/vn/procedures/worker_updateBalance.sql b/db/routines/vn/procedures/worker_updateBalance.sql
index 17c2fbbe1..96357e4d6 100644
--- a/db/routines/vn/procedures/worker_updateBalance.sql
+++ b/db/routines/vn/procedures/worker_updateBalance.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`worker_updateBalance`(vSelf INT(11), vCredit DECIMAL(10,2), vDebit DECIMAL(10,2))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`worker_updateBalance`(vSelf INT(11), vCredit DECIMAL(10,2), vDebit DECIMAL(10,2))
BEGIN
/**
* Actualiza la columna balance de worker.
diff --git a/db/routines/vn/procedures/worker_updateBusiness.sql b/db/routines/vn/procedures/worker_updateBusiness.sql
index 76c8c9cbb..a160c417a 100644
--- a/db/routines/vn/procedures/worker_updateBusiness.sql
+++ b/db/routines/vn/procedures/worker_updateBusiness.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`worker_updateBusiness`(vSelf INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`worker_updateBusiness`(vSelf INT)
BEGIN
/**
* Activates an account and configures its email settings.
diff --git a/db/routines/vn/procedures/worker_updateChangedBusiness.sql b/db/routines/vn/procedures/worker_updateChangedBusiness.sql
index 05e68b099..0bb0e5905 100644
--- a/db/routines/vn/procedures/worker_updateChangedBusiness.sql
+++ b/db/routines/vn/procedures/worker_updateChangedBusiness.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`worker_updateChangedBusiness`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`worker_updateChangedBusiness`()
BEGIN
/**
* Actualiza el contrato actual de todos los trabajadores cuyo contracto ha
diff --git a/db/routines/vn/procedures/workingHours.sql b/db/routines/vn/procedures/workingHours.sql
index c08226db7..12b65753f 100644
--- a/db/routines/vn/procedures/workingHours.sql
+++ b/db/routines/vn/procedures/workingHours.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workingHours`(username varchar(255), logon boolean)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`workingHours`(username varchar(255), logon boolean)
BEGIN
DECLARE userid int(11);
diff --git a/db/routines/vn/procedures/workingHoursTimeIn.sql b/db/routines/vn/procedures/workingHoursTimeIn.sql
index 8a4268c54..a8ac07cb4 100644
--- a/db/routines/vn/procedures/workingHoursTimeIn.sql
+++ b/db/routines/vn/procedures/workingHoursTimeIn.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workingHoursTimeIn`(vUserId INT(11))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`workingHoursTimeIn`(vUserId INT(11))
BEGIN
INSERT INTO vn.workingHours (timeIn, userId)
VALUES (util.VN_NOW(),vUserId);
diff --git a/db/routines/vn/procedures/workingHoursTimeOut.sql b/db/routines/vn/procedures/workingHoursTimeOut.sql
index f6ce2886c..d44d99f52 100644
--- a/db/routines/vn/procedures/workingHoursTimeOut.sql
+++ b/db/routines/vn/procedures/workingHoursTimeOut.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workingHoursTimeOut`(vUserId INT(11))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`workingHoursTimeOut`(vUserId INT(11))
BEGIN
UPDATE vn.workingHours
SET timeOut = util.VN_NOW()
diff --git a/db/routines/vn/procedures/wrongEqualizatedClient.sql b/db/routines/vn/procedures/wrongEqualizatedClient.sql
index 47a6a608d..75499b6f1 100644
--- a/db/routines/vn/procedures/wrongEqualizatedClient.sql
+++ b/db/routines/vn/procedures/wrongEqualizatedClient.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`wrongEqualizatedClient`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`wrongEqualizatedClient`()
BEGIN
SELECT clientFk, c.name, c.isActive, c.isTaxDataChecked, count(ie) as num
FROM vn.client c
diff --git a/db/routines/vn/procedures/xdiario_new.sql b/db/routines/vn/procedures/xdiario_new.sql
index 22a26184e..1c73c6bda 100644
--- a/db/routines/vn/procedures/xdiario_new.sql
+++ b/db/routines/vn/procedures/xdiario_new.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`xdiario_new`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`xdiario_new`(
vBookNumber INT,
vDated DATE,
vSubaccount VARCHAR(12),
diff --git a/db/routines/vn/procedures/zoneClosure_recalc.sql b/db/routines/vn/procedures/zoneClosure_recalc.sql
index 9e51c007d..b1bc77350 100644
--- a/db/routines/vn/procedures/zoneClosure_recalc.sql
+++ b/db/routines/vn/procedures/zoneClosure_recalc.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`zoneClosure_recalc`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`zoneClosure_recalc`()
proc: BEGIN
/**
* Recalculates the delivery time (hour) for every zone in days + scope in future
diff --git a/db/routines/vn/procedures/zoneGeo_calcTree.sql b/db/routines/vn/procedures/zoneGeo_calcTree.sql
index 34e1d8241..0bca0d26f 100644
--- a/db/routines/vn/procedures/zoneGeo_calcTree.sql
+++ b/db/routines/vn/procedures/zoneGeo_calcTree.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`zoneGeo_calcTree`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`zoneGeo_calcTree`()
BEGIN
/**
* Calculates the #path, #lft, #rgt, #sons and #depth columns of
diff --git a/db/routines/vn/procedures/zoneGeo_calcTreeRec.sql b/db/routines/vn/procedures/zoneGeo_calcTreeRec.sql
index da499ede3..1994f2f8b 100644
--- a/db/routines/vn/procedures/zoneGeo_calcTreeRec.sql
+++ b/db/routines/vn/procedures/zoneGeo_calcTreeRec.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`zoneGeo_calcTreeRec`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`zoneGeo_calcTreeRec`(
vSelf INT,
vPath VARCHAR(255),
vDepth INT,
diff --git a/db/routines/vn/procedures/zoneGeo_checkName.sql b/db/routines/vn/procedures/zoneGeo_checkName.sql
index 5933f4be2..066209ffd 100644
--- a/db/routines/vn/procedures/zoneGeo_checkName.sql
+++ b/db/routines/vn/procedures/zoneGeo_checkName.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`zoneGeo_checkName`(vName VARCHAR(255))
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`zoneGeo_checkName`(vName VARCHAR(255))
BEGIN
IF vName = '' THEN
SIGNAL SQLSTATE '45000'
diff --git a/db/routines/vn/procedures/zoneGeo_delete.sql b/db/routines/vn/procedures/zoneGeo_delete.sql
index 5bf0c5120..d6f13171b 100644
--- a/db/routines/vn/procedures/zoneGeo_delete.sql
+++ b/db/routines/vn/procedures/zoneGeo_delete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`zoneGeo_delete`(vSelf INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`zoneGeo_delete`(vSelf INT)
BEGIN
/**
* Deletes a node from the #zoneGeo table. Also sets a mark
diff --git a/db/routines/vn/procedures/zoneGeo_doCalc.sql b/db/routines/vn/procedures/zoneGeo_doCalc.sql
index ce32357ec..16f2bd819 100644
--- a/db/routines/vn/procedures/zoneGeo_doCalc.sql
+++ b/db/routines/vn/procedures/zoneGeo_doCalc.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`zoneGeo_doCalc`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`zoneGeo_doCalc`()
proc: BEGIN
/**
* Recalculates the zones tree.
diff --git a/db/routines/vn/procedures/zoneGeo_setParent.sql b/db/routines/vn/procedures/zoneGeo_setParent.sql
index 3f8f051a2..ad37d69db 100644
--- a/db/routines/vn/procedures/zoneGeo_setParent.sql
+++ b/db/routines/vn/procedures/zoneGeo_setParent.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`zoneGeo_setParent`(vSelf INT, vParentFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`zoneGeo_setParent`(vSelf INT, vParentFk INT)
BEGIN
/**
* Updates the parent of a node. Also sets a mark
diff --git a/db/routines/vn/procedures/zoneGeo_throwNotEditable.sql b/db/routines/vn/procedures/zoneGeo_throwNotEditable.sql
index 0b5c8aecf..2fa6fbf85 100644
--- a/db/routines/vn/procedures/zoneGeo_throwNotEditable.sql
+++ b/db/routines/vn/procedures/zoneGeo_throwNotEditable.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`zoneGeo_throwNotEditable`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`zoneGeo_throwNotEditable`()
BEGIN
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'Column `geoFk` cannot be modified';
diff --git a/db/routines/vn/procedures/zone_excludeFromGeo.sql b/db/routines/vn/procedures/zone_excludeFromGeo.sql
index 6f0556bd7..23a5865fd 100644
--- a/db/routines/vn/procedures/zone_excludeFromGeo.sql
+++ b/db/routines/vn/procedures/zone_excludeFromGeo.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`zone_excludeFromGeo`(vZoneGeo INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`zone_excludeFromGeo`(vZoneGeo INT)
BEGIN
/**
* Excluye zonas a partir un geoFk.
diff --git a/db/routines/vn/procedures/zone_getAddresses.sql b/db/routines/vn/procedures/zone_getAddresses.sql
index 0622ece1b..2e5982c82 100644
--- a/db/routines/vn/procedures/zone_getAddresses.sql
+++ b/db/routines/vn/procedures/zone_getAddresses.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`zone_getAddresses`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`zone_getAddresses`(
vSelf INT,
vShipped DATE,
vDepartmentFk INT
diff --git a/db/routines/vn/procedures/zone_getAgency.sql b/db/routines/vn/procedures/zone_getAgency.sql
index 8b66b110b..8b3540477 100644
--- a/db/routines/vn/procedures/zone_getAgency.sql
+++ b/db/routines/vn/procedures/zone_getAgency.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`zone_getAgency`(vAddress INT, vLanded DATE)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`zone_getAgency`(vAddress INT, vLanded DATE)
BEGIN
/**
* Devuelve el listado de agencias disponibles para la fecha
diff --git a/db/routines/vn/procedures/zone_getAvailable.sql b/db/routines/vn/procedures/zone_getAvailable.sql
index 4fd3d1b34..5362185e6 100644
--- a/db/routines/vn/procedures/zone_getAvailable.sql
+++ b/db/routines/vn/procedures/zone_getAvailable.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`zone_getAvailable`(vAddress INT, vLanded DATE)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`zone_getAvailable`(vAddress INT, vLanded DATE)
BEGIN
CALL zone_getFromGeo(address_getGeo(vAddress));
CALL zone_getOptionsForLanding(vLanded, FALSE);
diff --git a/db/routines/vn/procedures/zone_getClosed.sql b/db/routines/vn/procedures/zone_getClosed.sql
index f48e6ff44..4d22c96bd 100644
--- a/db/routines/vn/procedures/zone_getClosed.sql
+++ b/db/routines/vn/procedures/zone_getClosed.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`zone_getClosed`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`zone_getClosed`()
proc:BEGIN
/**
* Devuelve una tabla con las zonas cerradas para hoy
diff --git a/db/routines/vn/procedures/zone_getCollisions.sql b/db/routines/vn/procedures/zone_getCollisions.sql
index e28b2b341..9b57017f7 100644
--- a/db/routines/vn/procedures/zone_getCollisions.sql
+++ b/db/routines/vn/procedures/zone_getCollisions.sql
@@ -1,6 +1,6 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`zone_getCollisions`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`zone_getCollisions`()
BEGIN
/**
* Calcula si para un mismo codigo postal y dia
diff --git a/db/routines/vn/procedures/zone_getEvents.sql b/db/routines/vn/procedures/zone_getEvents.sql
index 53e065083..ce85d1862 100644
--- a/db/routines/vn/procedures/zone_getEvents.sql
+++ b/db/routines/vn/procedures/zone_getEvents.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`zone_getEvents`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`zone_getEvents`(
vGeoFk INT,
vAgencyModeFk INT)
BEGIN
diff --git a/db/routines/vn/procedures/zone_getFromGeo.sql b/db/routines/vn/procedures/zone_getFromGeo.sql
index fe6be86a7..6ccb8b570 100644
--- a/db/routines/vn/procedures/zone_getFromGeo.sql
+++ b/db/routines/vn/procedures/zone_getFromGeo.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`zone_getFromGeo`(vGeoFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`zone_getFromGeo`(vGeoFk INT)
BEGIN
/**
* Returns all zones which have the passed geo included.
diff --git a/db/routines/vn/procedures/zone_getLanded.sql b/db/routines/vn/procedures/zone_getLanded.sql
index b75f409b9..1d6cdcc3f 100644
--- a/db/routines/vn/procedures/zone_getLanded.sql
+++ b/db/routines/vn/procedures/zone_getLanded.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`zone_getLanded`(vShipped DATE, vAddressFk INT, vAgencyModeFk INT, vWarehouseFk INT, vShowExpiredZones BOOLEAN)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`zone_getLanded`(vShipped DATE, vAddressFk INT, vAgencyModeFk INT, vWarehouseFk INT, vShowExpiredZones BOOLEAN)
BEGIN
/**
* Devuelve una tabla temporal con el dia de recepcion para vShipped.
diff --git a/db/routines/vn/procedures/zone_getLeaves.sql b/db/routines/vn/procedures/zone_getLeaves.sql
index d1e66267e..51ab487ed 100644
--- a/db/routines/vn/procedures/zone_getLeaves.sql
+++ b/db/routines/vn/procedures/zone_getLeaves.sql
@@ -1,10 +1,10 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`zone_getLeaves`(
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`zone_getLeaves`(
vSelf INT,
vParentFk INT,
vSearch VARCHAR(255),
vHasInsert BOOL
-)
+)
BEGIN
/**
* Devuelve las ubicaciones incluidas en la ruta y que sean hijos de parentFk.
@@ -119,5 +119,5 @@ BEGIN
END IF;
DROP TEMPORARY TABLE tNodes, tZones;
-END$$
-DELIMITER ;
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/procedures/zone_getOptionsForLanding.sql b/db/routines/vn/procedures/zone_getOptionsForLanding.sql
index 1c12e8c88..80ccf7ed1 100644
--- a/db/routines/vn/procedures/zone_getOptionsForLanding.sql
+++ b/db/routines/vn/procedures/zone_getOptionsForLanding.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`zone_getOptionsForLanding`(vLanded DATE, vShowExpiredZones BOOLEAN)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`zone_getOptionsForLanding`(vLanded DATE, vShowExpiredZones BOOLEAN)
BEGIN
/**
* Gets computed options for the passed zones and delivery date.
diff --git a/db/routines/vn/procedures/zone_getOptionsForShipment.sql b/db/routines/vn/procedures/zone_getOptionsForShipment.sql
index ec7824303..fa48b0b0f 100644
--- a/db/routines/vn/procedures/zone_getOptionsForShipment.sql
+++ b/db/routines/vn/procedures/zone_getOptionsForShipment.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`zone_getOptionsForShipment`(vShipped DATE, vShowExpiredZones BOOLEAN)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`zone_getOptionsForShipment`(vShipped DATE, vShowExpiredZones BOOLEAN)
BEGIN
/**
* Gets computed options for the passed zones and shipping date.
diff --git a/db/routines/vn/procedures/zone_getPostalCode.sql b/db/routines/vn/procedures/zone_getPostalCode.sql
index 920ad3171..b768b6e12 100644
--- a/db/routines/vn/procedures/zone_getPostalCode.sql
+++ b/db/routines/vn/procedures/zone_getPostalCode.sql
@@ -1,5 +1,5 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`zone_getPostalCode`(vSelf INT)
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`zone_getPostalCode`(vSelf INT)
BEGIN
/**
* Devuelve los códigos postales incluidos en una zona
@@ -42,5 +42,5 @@ BEGIN
DELETE FROM tmp.zoneNodes
WHERE sons > 0;
-END$$
-DELIMITER ;
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/procedures/zone_getShipped.sql b/db/routines/vn/procedures/zone_getShipped.sql
index 8d28c9062..924883b72 100644
--- a/db/routines/vn/procedures/zone_getShipped.sql
+++ b/db/routines/vn/procedures/zone_getShipped.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`zone_getShipped`(vLanded DATE, vAddressFk INT, vAgencyModeFk INT, vShowExpiredZones BOOLEAN)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`zone_getShipped`(vLanded DATE, vAddressFk INT, vAgencyModeFk INT, vShowExpiredZones BOOLEAN)
BEGIN
/**
* Devuelve la mínima fecha de envío para cada warehouse
diff --git a/db/routines/vn/procedures/zone_getState.sql b/db/routines/vn/procedures/zone_getState.sql
index aa61d08a2..1678be87d 100644
--- a/db/routines/vn/procedures/zone_getState.sql
+++ b/db/routines/vn/procedures/zone_getState.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`zone_getState`(vDated DATE)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`zone_getState`(vDated DATE)
BEGIN
/**
* Devuelve las zonas y el estado para la fecha solicitada
diff --git a/db/routines/vn/procedures/zone_getWarehouse.sql b/db/routines/vn/procedures/zone_getWarehouse.sql
index b6915a302..aeeba2867 100644
--- a/db/routines/vn/procedures/zone_getWarehouse.sql
+++ b/db/routines/vn/procedures/zone_getWarehouse.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`zone_getWarehouse`(vAddress INT, vLanded DATE, vWarehouse INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`zone_getWarehouse`(vAddress INT, vLanded DATE, vWarehouse INT)
BEGIN
/**
* Devuelve el listado de agencias disponibles para la fecha,
diff --git a/db/routines/vn/procedures/zone_upcomingDeliveries.sql b/db/routines/vn/procedures/zone_upcomingDeliveries.sql
index 96c4136ae..0c3713175 100644
--- a/db/routines/vn/procedures/zone_upcomingDeliveries.sql
+++ b/db/routines/vn/procedures/zone_upcomingDeliveries.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`zone_upcomingDeliveries`()
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`zone_upcomingDeliveries`()
BEGIN
DECLARE vForwardDays INT;
diff --git a/db/routines/vn/triggers/XDiario_beforeInsert.sql b/db/routines/vn/triggers/XDiario_beforeInsert.sql
index bc89e221f..81f45ef56 100644
--- a/db/routines/vn/triggers/XDiario_beforeInsert.sql
+++ b/db/routines/vn/triggers/XDiario_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`XDiario_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`XDiario_beforeInsert`
BEFORE INSERT ON `XDiario`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/XDiario_beforeUpdate.sql b/db/routines/vn/triggers/XDiario_beforeUpdate.sql
index 33787c8f1..1653da4a4 100644
--- a/db/routines/vn/triggers/XDiario_beforeUpdate.sql
+++ b/db/routines/vn/triggers/XDiario_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`XDiario_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`XDiario_beforeUpdate`
BEFORE UPDATE ON `XDiario`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/accountReconciliation_beforeInsert.sql b/db/routines/vn/triggers/accountReconciliation_beforeInsert.sql
index 4fedd62b8..f37084329 100644
--- a/db/routines/vn/triggers/accountReconciliation_beforeInsert.sql
+++ b/db/routines/vn/triggers/accountReconciliation_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`accountReconciliation_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`accountReconciliation_beforeInsert`
BEFORE INSERT ON `accountReconciliation`
FOR EACH ROW
diff --git a/db/routines/vn/triggers/address_afterDelete.sql b/db/routines/vn/triggers/address_afterDelete.sql
index d4195d48d..92326c302 100644
--- a/db/routines/vn/triggers/address_afterDelete.sql
+++ b/db/routines/vn/triggers/address_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`address_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`address_afterDelete`
AFTER DELETE ON `address`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/address_afterInsert.sql b/db/routines/vn/triggers/address_afterInsert.sql
index 318fd3958..e97658311 100644
--- a/db/routines/vn/triggers/address_afterInsert.sql
+++ b/db/routines/vn/triggers/address_afterInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`address_afterInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`address_afterInsert`
BEFORE INSERT ON `address`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/address_afterUpdate.sql b/db/routines/vn/triggers/address_afterUpdate.sql
index ab5e03882..a4e3e51e0 100644
--- a/db/routines/vn/triggers/address_afterUpdate.sql
+++ b/db/routines/vn/triggers/address_afterUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`address_afterUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`address_afterUpdate`
AFTER UPDATE ON `address`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/address_beforeInsert.sql b/db/routines/vn/triggers/address_beforeInsert.sql
index 2ef582499..56ef7aa51 100644
--- a/db/routines/vn/triggers/address_beforeInsert.sql
+++ b/db/routines/vn/triggers/address_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`address_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`address_beforeInsert`
BEFORE INSERT ON `address`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/address_beforeUpdate.sql b/db/routines/vn/triggers/address_beforeUpdate.sql
index 8922105e7..35887912c 100644
--- a/db/routines/vn/triggers/address_beforeUpdate.sql
+++ b/db/routines/vn/triggers/address_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`address_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`address_beforeUpdate`
BEFORE UPDATE ON `address`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/agency_afterInsert.sql b/db/routines/vn/triggers/agency_afterInsert.sql
index 35670538b..85bde9bb5 100644
--- a/db/routines/vn/triggers/agency_afterInsert.sql
+++ b/db/routines/vn/triggers/agency_afterInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`agency_afterInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`agency_afterInsert`
AFTER INSERT ON `agency`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/agency_beforeInsert.sql b/db/routines/vn/triggers/agency_beforeInsert.sql
index 8ff3958e1..b08b7b995 100644
--- a/db/routines/vn/triggers/agency_beforeInsert.sql
+++ b/db/routines/vn/triggers/agency_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`agency_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`agency_beforeInsert`
BEFORE INSERT ON `agency`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/autonomy_afterDelete.sql b/db/routines/vn/triggers/autonomy_afterDelete.sql
index f278ccdea..3ff27c3dd 100644
--- a/db/routines/vn/triggers/autonomy_afterDelete.sql
+++ b/db/routines/vn/triggers/autonomy_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`autonomy_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`autonomy_afterDelete`
AFTER DELETE ON `autonomy`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/autonomy_beforeInsert.sql b/db/routines/vn/triggers/autonomy_beforeInsert.sql
index 3a6448b81..cdceba0b9 100644
--- a/db/routines/vn/triggers/autonomy_beforeInsert.sql
+++ b/db/routines/vn/triggers/autonomy_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`autonomy_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`autonomy_beforeInsert`
BEFORE INSERT ON `autonomy`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/autonomy_beforeUpdate.sql b/db/routines/vn/triggers/autonomy_beforeUpdate.sql
index a2c9a2a11..7a8b1c838 100644
--- a/db/routines/vn/triggers/autonomy_beforeUpdate.sql
+++ b/db/routines/vn/triggers/autonomy_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`autonomy_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`autonomy_beforeUpdate`
BEFORE UPDATE ON `autonomy`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/awbInvoiceIn_afterDelete.sql b/db/routines/vn/triggers/awbInvoiceIn_afterDelete.sql
index fd7f4c6e7..d36f6b4f5 100644
--- a/db/routines/vn/triggers/awbInvoiceIn_afterDelete.sql
+++ b/db/routines/vn/triggers/awbInvoiceIn_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`awbInvoiceIn_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`awbInvoiceIn_afterDelete`
AFTER DELETE ON `awbInvoiceIn`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/awb_beforeInsert.sql b/db/routines/vn/triggers/awb_beforeInsert.sql
index 8dc216024..e632ca858 100644
--- a/db/routines/vn/triggers/awb_beforeInsert.sql
+++ b/db/routines/vn/triggers/awb_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`awb_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`awb_beforeInsert`
BEFORE INSERT ON `awb`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/bankEntity_beforeInsert.sql b/db/routines/vn/triggers/bankEntity_beforeInsert.sql
index 6c1ce78a7..b18af3d15 100644
--- a/db/routines/vn/triggers/bankEntity_beforeInsert.sql
+++ b/db/routines/vn/triggers/bankEntity_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`bankEntity_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`bankEntity_beforeInsert`
BEFORE INSERT ON `bankEntity`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/bankEntity_beforeUpdate.sql b/db/routines/vn/triggers/bankEntity_beforeUpdate.sql
index 5bea154a2..bd3c746c1 100644
--- a/db/routines/vn/triggers/bankEntity_beforeUpdate.sql
+++ b/db/routines/vn/triggers/bankEntity_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`bankEntity_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`bankEntity_beforeUpdate`
BEFORE UPDATE ON `bankEntity`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/budgetNotes_beforeInsert.sql b/db/routines/vn/triggers/budgetNotes_beforeInsert.sql
index 6ea5ad5eb..aa4ee1f9e 100644
--- a/db/routines/vn/triggers/budgetNotes_beforeInsert.sql
+++ b/db/routines/vn/triggers/budgetNotes_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`budgetNotes_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`budgetNotes_beforeInsert`
BEFORE INSERT ON `budgetNotes`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/business_afterDelete.sql b/db/routines/vn/triggers/business_afterDelete.sql
index 9b897b4e9..9fac90e21 100644
--- a/db/routines/vn/triggers/business_afterDelete.sql
+++ b/db/routines/vn/triggers/business_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`business_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`business_afterDelete`
AFTER DELETE ON `business`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/business_afterInsert.sql b/db/routines/vn/triggers/business_afterInsert.sql
index 2949eede8..7a560d380 100644
--- a/db/routines/vn/triggers/business_afterInsert.sql
+++ b/db/routines/vn/triggers/business_afterInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`business_afterInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`business_afterInsert`
AFTER INSERT ON `business`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/business_afterUpdate.sql b/db/routines/vn/triggers/business_afterUpdate.sql
index 95746a30d..888308b9a 100644
--- a/db/routines/vn/triggers/business_afterUpdate.sql
+++ b/db/routines/vn/triggers/business_afterUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`business_afterUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`business_afterUpdate`
AFTER UPDATE ON `business`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/business_beforeInsert.sql b/db/routines/vn/triggers/business_beforeInsert.sql
index 1f136c1e8..36156d023 100644
--- a/db/routines/vn/triggers/business_beforeInsert.sql
+++ b/db/routines/vn/triggers/business_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`business_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`business_beforeInsert`
BEFORE INSERT ON `business`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/business_beforeUpdate.sql b/db/routines/vn/triggers/business_beforeUpdate.sql
index 7dc69bc75..f0c09edc2 100644
--- a/db/routines/vn/triggers/business_beforeUpdate.sql
+++ b/db/routines/vn/triggers/business_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`business_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`business_beforeUpdate`
BEFORE UPDATE ON `business`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/buy_afterDelete.sql b/db/routines/vn/triggers/buy_afterDelete.sql
index 5daaefa33..26df4655f 100644
--- a/db/routines/vn/triggers/buy_afterDelete.sql
+++ b/db/routines/vn/triggers/buy_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`buy_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`buy_afterDelete`
AFTER DELETE ON `buy`
FOR EACH ROW
trig: BEGIN
diff --git a/db/routines/vn/triggers/buy_afterInsert.sql b/db/routines/vn/triggers/buy_afterInsert.sql
index b39842d35..7a6608ada 100644
--- a/db/routines/vn/triggers/buy_afterInsert.sql
+++ b/db/routines/vn/triggers/buy_afterInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`buy_afterInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`buy_afterInsert`
AFTER INSERT ON `buy`
FOR EACH ROW
trig: BEGIN
diff --git a/db/routines/vn/triggers/buy_afterUpdate.sql b/db/routines/vn/triggers/buy_afterUpdate.sql
index fc7ca152d..b82ba1831 100644
--- a/db/routines/vn/triggers/buy_afterUpdate.sql
+++ b/db/routines/vn/triggers/buy_afterUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`buy_afterUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`buy_afterUpdate`
AFTER UPDATE ON `buy`
FOR EACH ROW
trig: BEGIN
diff --git a/db/routines/vn/triggers/buy_beforeDelete.sql b/db/routines/vn/triggers/buy_beforeDelete.sql
index 1bbeadec9..82b7e51d6 100644
--- a/db/routines/vn/triggers/buy_beforeDelete.sql
+++ b/db/routines/vn/triggers/buy_beforeDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`buy_beforeDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`buy_beforeDelete`
BEFORE DELETE ON `buy`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/buy_beforeInsert.sql b/db/routines/vn/triggers/buy_beforeInsert.sql
index 39befcaf1..9c1059266 100644
--- a/db/routines/vn/triggers/buy_beforeInsert.sql
+++ b/db/routines/vn/triggers/buy_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`buy_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`buy_beforeInsert`
BEFORE INSERT ON `buy`
FOR EACH ROW
trig: BEGIN
diff --git a/db/routines/vn/triggers/buy_beforeUpdate.sql b/db/routines/vn/triggers/buy_beforeUpdate.sql
index 366681f99..24246329b 100644
--- a/db/routines/vn/triggers/buy_beforeUpdate.sql
+++ b/db/routines/vn/triggers/buy_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`buy_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`buy_beforeUpdate`
BEFORE UPDATE ON `buy`
FOR EACH ROW
trig:BEGIN
diff --git a/db/routines/vn/triggers/calendar_afterDelete.sql b/db/routines/vn/triggers/calendar_afterDelete.sql
index 5d0114ea8..d67710a67 100644
--- a/db/routines/vn/triggers/calendar_afterDelete.sql
+++ b/db/routines/vn/triggers/calendar_afterDelete.sql
@@ -1,12 +1,12 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`calendar_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`calendar_afterDelete`
AFTER DELETE ON `calendar`
FOR EACH ROW
-BEGIN
- INSERT INTO workerLog
- SET `action` = 'delete',
- `changedModel` = 'Calendar',
- `changedModelId` = OLD.id,
- `userFk` = account.myUser_getId();
+BEGIN
+ INSERT INTO workerLog
+ SET `action` = 'delete',
+ `changedModel` = 'Calendar',
+ `changedModelId` = OLD.id,
+ `userFk` = account.myUser_getId();
END$$
DELIMITER ;
diff --git a/db/routines/vn/triggers/calendar_beforeInsert.sql b/db/routines/vn/triggers/calendar_beforeInsert.sql
index 3e265a099..6351f5391 100644
--- a/db/routines/vn/triggers/calendar_beforeInsert.sql
+++ b/db/routines/vn/triggers/calendar_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`calendar_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`calendar_beforeInsert`
BEFORE INSERT ON `calendar`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/calendar_beforeUpdate.sql b/db/routines/vn/triggers/calendar_beforeUpdate.sql
index f015dc29a..73618aa2a 100644
--- a/db/routines/vn/triggers/calendar_beforeUpdate.sql
+++ b/db/routines/vn/triggers/calendar_beforeUpdate.sql
@@ -1,8 +1,8 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`calendar_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`calendar_beforeUpdate`
BEFORE UPDATE ON `calendar`
FOR EACH ROW
-BEGIN
- SET NEW.editorFk = account.myUser_getId();
+BEGIN
+ SET NEW.editorFk = account.myUser_getId();
END$$
DELIMITER ;
diff --git a/db/routines/vn/triggers/claimBeginning_afterDelete.sql b/db/routines/vn/triggers/claimBeginning_afterDelete.sql
index 5e12d9feb..c61abeeb2 100644
--- a/db/routines/vn/triggers/claimBeginning_afterDelete.sql
+++ b/db/routines/vn/triggers/claimBeginning_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`claimBeginning_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`claimBeginning_afterDelete`
AFTER DELETE ON `claimBeginning`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/claimBeginning_beforeInsert.sql b/db/routines/vn/triggers/claimBeginning_beforeInsert.sql
index f6ad1672b..aa67bbdb3 100644
--- a/db/routines/vn/triggers/claimBeginning_beforeInsert.sql
+++ b/db/routines/vn/triggers/claimBeginning_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`claimBeginning_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`claimBeginning_beforeInsert`
BEFORE INSERT ON `claimBeginning`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/claimBeginning_beforeUpdate.sql b/db/routines/vn/triggers/claimBeginning_beforeUpdate.sql
index 500d08cb6..b4c06a2d7 100644
--- a/db/routines/vn/triggers/claimBeginning_beforeUpdate.sql
+++ b/db/routines/vn/triggers/claimBeginning_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`claimBeginning_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`claimBeginning_beforeUpdate`
BEFORE UPDATE ON `claimBeginning`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/claimDevelopment_afterDelete.sql b/db/routines/vn/triggers/claimDevelopment_afterDelete.sql
index 90b1e89eb..af14b8817 100644
--- a/db/routines/vn/triggers/claimDevelopment_afterDelete.sql
+++ b/db/routines/vn/triggers/claimDevelopment_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`claimDevelopment_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`claimDevelopment_afterDelete`
AFTER DELETE ON `claimDevelopment`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/claimDevelopment_beforeInsert.sql b/db/routines/vn/triggers/claimDevelopment_beforeInsert.sql
index 15ec36138..5d1365a43 100644
--- a/db/routines/vn/triggers/claimDevelopment_beforeInsert.sql
+++ b/db/routines/vn/triggers/claimDevelopment_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`claimDevelopment_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`claimDevelopment_beforeInsert`
BEFORE INSERT ON `claimDevelopment`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/claimDevelopment_beforeUpdate.sql b/db/routines/vn/triggers/claimDevelopment_beforeUpdate.sql
index b0727adb3..c51c7c6d8 100644
--- a/db/routines/vn/triggers/claimDevelopment_beforeUpdate.sql
+++ b/db/routines/vn/triggers/claimDevelopment_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`claimDevelopment_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`claimDevelopment_beforeUpdate`
BEFORE UPDATE ON `claimDevelopment`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/claimDms_afterDelete.sql b/db/routines/vn/triggers/claimDms_afterDelete.sql
index 53bf819e2..1a3630695 100644
--- a/db/routines/vn/triggers/claimDms_afterDelete.sql
+++ b/db/routines/vn/triggers/claimDms_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`claimDms_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`claimDms_afterDelete`
AFTER DELETE ON `claimDms`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/claimDms_beforeInsert.sql b/db/routines/vn/triggers/claimDms_beforeInsert.sql
index bb84e7a81..dfaffda36 100644
--- a/db/routines/vn/triggers/claimDms_beforeInsert.sql
+++ b/db/routines/vn/triggers/claimDms_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`claimDms_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`claimDms_beforeInsert`
BEFORE INSERT ON `claimDms`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/claimDms_beforeUpdate.sql b/db/routines/vn/triggers/claimDms_beforeUpdate.sql
index 8ffab268e..420b4d999 100644
--- a/db/routines/vn/triggers/claimDms_beforeUpdate.sql
+++ b/db/routines/vn/triggers/claimDms_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`claimDms_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`claimDms_beforeUpdate`
BEFORE UPDATE ON `claimDms`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/claimEnd_afterDelete.sql b/db/routines/vn/triggers/claimEnd_afterDelete.sql
index dee80fc77..b63db488f 100644
--- a/db/routines/vn/triggers/claimEnd_afterDelete.sql
+++ b/db/routines/vn/triggers/claimEnd_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`claimEnd_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`claimEnd_afterDelete`
AFTER DELETE ON `claimEnd`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/claimEnd_beforeInsert.sql b/db/routines/vn/triggers/claimEnd_beforeInsert.sql
index beb66c297..113fb8179 100644
--- a/db/routines/vn/triggers/claimEnd_beforeInsert.sql
+++ b/db/routines/vn/triggers/claimEnd_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`claimEnd_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`claimEnd_beforeInsert`
BEFORE INSERT ON `claimEnd`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/claimEnd_beforeUpdate.sql b/db/routines/vn/triggers/claimEnd_beforeUpdate.sql
index 7e91996dd..74d79c240 100644
--- a/db/routines/vn/triggers/claimEnd_beforeUpdate.sql
+++ b/db/routines/vn/triggers/claimEnd_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`claimEnd_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`claimEnd_beforeUpdate`
BEFORE UPDATE ON `claimEnd`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/claimObservation_afterDelete.sql b/db/routines/vn/triggers/claimObservation_afterDelete.sql
index b61368310..30899b2c5 100644
--- a/db/routines/vn/triggers/claimObservation_afterDelete.sql
+++ b/db/routines/vn/triggers/claimObservation_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`claimObservation_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`claimObservation_afterDelete`
AFTER DELETE ON `claimObservation`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/claimObservation_beforeInsert.sql b/db/routines/vn/triggers/claimObservation_beforeInsert.sql
index e6cf4a42a..b510f5c7a 100644
--- a/db/routines/vn/triggers/claimObservation_beforeInsert.sql
+++ b/db/routines/vn/triggers/claimObservation_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`claimObservation_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`claimObservation_beforeInsert`
BEFORE INSERT ON `claimObservation`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/claimObservation_beforeUpdate.sql b/db/routines/vn/triggers/claimObservation_beforeUpdate.sql
index 79008eb1b..a374856d0 100644
--- a/db/routines/vn/triggers/claimObservation_beforeUpdate.sql
+++ b/db/routines/vn/triggers/claimObservation_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`claimObservation_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`claimObservation_beforeUpdate`
BEFORE UPDATE ON `claimObservation`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/claimRatio_afterInsert.sql b/db/routines/vn/triggers/claimRatio_afterInsert.sql
index ca618bb89..ff203e9ba 100644
--- a/db/routines/vn/triggers/claimRatio_afterInsert.sql
+++ b/db/routines/vn/triggers/claimRatio_afterInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`claimRatio_afterInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`claimRatio_afterInsert`
AFTER INSERT ON `claimRatio`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/claimRatio_afterUpdate.sql b/db/routines/vn/triggers/claimRatio_afterUpdate.sql
index daae7ecf0..5a3272d5c 100644
--- a/db/routines/vn/triggers/claimRatio_afterUpdate.sql
+++ b/db/routines/vn/triggers/claimRatio_afterUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`claimRatio_afterUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`claimRatio_afterUpdate`
AFTER UPDATE ON `claimRatio`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/claimState_afterDelete.sql b/db/routines/vn/triggers/claimState_afterDelete.sql
index 00c0a203d..890ef3f73 100644
--- a/db/routines/vn/triggers/claimState_afterDelete.sql
+++ b/db/routines/vn/triggers/claimState_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`claimState_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`claimState_afterDelete`
AFTER DELETE ON `claimState`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/claimState_beforeInsert.sql b/db/routines/vn/triggers/claimState_beforeInsert.sql
index e289e8067..fb7460c53 100644
--- a/db/routines/vn/triggers/claimState_beforeInsert.sql
+++ b/db/routines/vn/triggers/claimState_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`claimState_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`claimState_beforeInsert`
BEFORE INSERT ON `claimState`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/claimState_beforeUpdate.sql b/db/routines/vn/triggers/claimState_beforeUpdate.sql
index 53c8c254b..e113d4ec8 100644
--- a/db/routines/vn/triggers/claimState_beforeUpdate.sql
+++ b/db/routines/vn/triggers/claimState_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`claimState_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`claimState_beforeUpdate`
BEFORE UPDATE ON `claimState`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/claim_afterDelete.sql b/db/routines/vn/triggers/claim_afterDelete.sql
index bd01ad80f..57566d400 100644
--- a/db/routines/vn/triggers/claim_afterDelete.sql
+++ b/db/routines/vn/triggers/claim_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`claim_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`claim_afterDelete`
AFTER DELETE ON `claim`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/claim_beforeInsert.sql b/db/routines/vn/triggers/claim_beforeInsert.sql
index 36f73902b..dc3ef8c7a 100644
--- a/db/routines/vn/triggers/claim_beforeInsert.sql
+++ b/db/routines/vn/triggers/claim_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`claim_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`claim_beforeInsert`
BEFORE INSERT ON `claim`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/claim_beforeUpdate.sql b/db/routines/vn/triggers/claim_beforeUpdate.sql
index 9dec746ad..2898a0c61 100644
--- a/db/routines/vn/triggers/claim_beforeUpdate.sql
+++ b/db/routines/vn/triggers/claim_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`claim_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`claim_beforeUpdate`
BEFORE UPDATE ON `claim`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/clientContact_afterDelete.sql b/db/routines/vn/triggers/clientContact_afterDelete.sql
index b138a0957..5b76d960d 100644
--- a/db/routines/vn/triggers/clientContact_afterDelete.sql
+++ b/db/routines/vn/triggers/clientContact_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`clientContact_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`clientContact_afterDelete`
AFTER DELETE ON `clientContact`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/clientContact_beforeInsert.sql b/db/routines/vn/triggers/clientContact_beforeInsert.sql
index 7ddf4d7dd..fd810e140 100644
--- a/db/routines/vn/triggers/clientContact_beforeInsert.sql
+++ b/db/routines/vn/triggers/clientContact_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`clientContact_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`clientContact_beforeInsert`
BEFORE INSERT ON `clientContact`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/clientCredit_afterInsert.sql b/db/routines/vn/triggers/clientCredit_afterInsert.sql
index 440f24865..76ee34d58 100644
--- a/db/routines/vn/triggers/clientCredit_afterInsert.sql
+++ b/db/routines/vn/triggers/clientCredit_afterInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`clientCredit_afterInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`clientCredit_afterInsert`
AFTER INSERT ON `clientCredit`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/clientDms_afterDelete.sql b/db/routines/vn/triggers/clientDms_afterDelete.sql
index 9b6fb4876..c36632d5c 100644
--- a/db/routines/vn/triggers/clientDms_afterDelete.sql
+++ b/db/routines/vn/triggers/clientDms_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`clientDms_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`clientDms_afterDelete`
AFTER DELETE ON `clientDms`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/clientDms_beforeInsert.sql b/db/routines/vn/triggers/clientDms_beforeInsert.sql
index 011cc6e96..42181d5c6 100644
--- a/db/routines/vn/triggers/clientDms_beforeInsert.sql
+++ b/db/routines/vn/triggers/clientDms_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`clientDms_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`clientDms_beforeInsert`
BEFORE INSERT ON `clientDms`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/clientDms_beforeUpdate.sql b/db/routines/vn/triggers/clientDms_beforeUpdate.sql
index 56eaec7eb..7138caa5f 100644
--- a/db/routines/vn/triggers/clientDms_beforeUpdate.sql
+++ b/db/routines/vn/triggers/clientDms_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`clientDms_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`clientDms_beforeUpdate`
BEFORE UPDATE ON `clientDms`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/clientObservation_afterDelete.sql b/db/routines/vn/triggers/clientObservation_afterDelete.sql
index c93564aa5..f855dccf8 100644
--- a/db/routines/vn/triggers/clientObservation_afterDelete.sql
+++ b/db/routines/vn/triggers/clientObservation_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`clientObservation_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`clientObservation_afterDelete`
AFTER DELETE ON `clientObservation`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/clientObservation_beforeInsert.sql b/db/routines/vn/triggers/clientObservation_beforeInsert.sql
index 684873031..9767d0e58 100644
--- a/db/routines/vn/triggers/clientObservation_beforeInsert.sql
+++ b/db/routines/vn/triggers/clientObservation_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`clientObservation_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`clientObservation_beforeInsert`
BEFORE INSERT ON `clientObservation`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/clientObservation_beforeUpdate.sql b/db/routines/vn/triggers/clientObservation_beforeUpdate.sql
index 6e0b63794..d1cb50e80 100644
--- a/db/routines/vn/triggers/clientObservation_beforeUpdate.sql
+++ b/db/routines/vn/triggers/clientObservation_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`clientObservation_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`clientObservation_beforeUpdate`
BEFORE UPDATE ON `clientObservation`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/clientSample_afterDelete.sql b/db/routines/vn/triggers/clientSample_afterDelete.sql
index 1ac9e77be..5db0ce39e 100644
--- a/db/routines/vn/triggers/clientSample_afterDelete.sql
+++ b/db/routines/vn/triggers/clientSample_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`clientSample_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`clientSample_afterDelete`
AFTER DELETE ON `clientSample`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/clientSample_beforeInsert.sql b/db/routines/vn/triggers/clientSample_beforeInsert.sql
index c7fe43c9b..956013ba9 100644
--- a/db/routines/vn/triggers/clientSample_beforeInsert.sql
+++ b/db/routines/vn/triggers/clientSample_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`clientSample_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`clientSample_beforeInsert`
BEFORE INSERT ON `clientSample`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/clientSample_beforeUpdate.sql b/db/routines/vn/triggers/clientSample_beforeUpdate.sql
index 5c16950b5..d9c7e045f 100644
--- a/db/routines/vn/triggers/clientSample_beforeUpdate.sql
+++ b/db/routines/vn/triggers/clientSample_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`clientSample_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`clientSample_beforeUpdate`
BEFORE UPDATE ON `clientSample`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/clientUnpaid_beforeInsert.sql b/db/routines/vn/triggers/clientUnpaid_beforeInsert.sql
index 279a81b73..de4bf2c20 100644
--- a/db/routines/vn/triggers/clientUnpaid_beforeInsert.sql
+++ b/db/routines/vn/triggers/clientUnpaid_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`clientUnpaid_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`clientUnpaid_beforeInsert`
BEFORE INSERT ON `clientUnpaid`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/clientUnpaid_beforeUpdate.sql b/db/routines/vn/triggers/clientUnpaid_beforeUpdate.sql
index 13cac3fa7..f3dfbe356 100644
--- a/db/routines/vn/triggers/clientUnpaid_beforeUpdate.sql
+++ b/db/routines/vn/triggers/clientUnpaid_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`clientUnpaid_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`clientUnpaid_beforeUpdate`
BEFORE UPDATE ON `clientUnpaid`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/client_afterDelete.sql b/db/routines/vn/triggers/client_afterDelete.sql
index e6849ef49..c5391d89b 100644
--- a/db/routines/vn/triggers/client_afterDelete.sql
+++ b/db/routines/vn/triggers/client_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`client_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`client_afterDelete`
AFTER DELETE ON `client`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/client_afterInsert.sql b/db/routines/vn/triggers/client_afterInsert.sql
index 764d8f067..47ab3fb6f 100644
--- a/db/routines/vn/triggers/client_afterInsert.sql
+++ b/db/routines/vn/triggers/client_afterInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`client_afterInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`client_afterInsert`
AFTER INSERT ON `client`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/client_afterUpdate.sql b/db/routines/vn/triggers/client_afterUpdate.sql
index a2a3e48e3..eb977faa3 100644
--- a/db/routines/vn/triggers/client_afterUpdate.sql
+++ b/db/routines/vn/triggers/client_afterUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`client_afterUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`client_afterUpdate`
AFTER UPDATE ON `client`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/client_beforeInsert.sql b/db/routines/vn/triggers/client_beforeInsert.sql
index 75b69c7dd..45de107f1 100644
--- a/db/routines/vn/triggers/client_beforeInsert.sql
+++ b/db/routines/vn/triggers/client_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`client_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`client_beforeInsert`
BEFORE INSERT ON `client`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/client_beforeUpdate.sql b/db/routines/vn/triggers/client_beforeUpdate.sql
index 914ae5b8a..7142d6604 100644
--- a/db/routines/vn/triggers/client_beforeUpdate.sql
+++ b/db/routines/vn/triggers/client_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`client_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`client_beforeUpdate`
BEFORE UPDATE ON `client`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/cmr_beforeDelete.sql b/db/routines/vn/triggers/cmr_beforeDelete.sql
index 2cb789244..566f3a1bc 100644
--- a/db/routines/vn/triggers/cmr_beforeDelete.sql
+++ b/db/routines/vn/triggers/cmr_beforeDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`cmr_beforeDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`cmr_beforeDelete`
BEFORE DELETE ON `cmr`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/collectionColors_beforeInsert.sql b/db/routines/vn/triggers/collectionColors_beforeInsert.sql
index 254529932..96a7d8aa1 100644
--- a/db/routines/vn/triggers/collectionColors_beforeInsert.sql
+++ b/db/routines/vn/triggers/collectionColors_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`collectionColors_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`collectionColors_beforeInsert`
BEFORE INSERT ON `collectionColors`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/collectionColors_beforeUpdate.sql b/db/routines/vn/triggers/collectionColors_beforeUpdate.sql
index 1ee83ab74..c46460841 100644
--- a/db/routines/vn/triggers/collectionColors_beforeUpdate.sql
+++ b/db/routines/vn/triggers/collectionColors_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`collectionColors_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`collectionColors_beforeUpdate`
BEFORE UPDATE ON `collectionColors`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/collectionVolumetry_afterDelete.sql b/db/routines/vn/triggers/collectionVolumetry_afterDelete.sql
index 53c6340ee..e5461a221 100644
--- a/db/routines/vn/triggers/collectionVolumetry_afterDelete.sql
+++ b/db/routines/vn/triggers/collectionVolumetry_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`collectionVolumetry_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`collectionVolumetry_afterDelete`
AFTER DELETE ON `collectionVolumetry`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/collectionVolumetry_afterInsert.sql b/db/routines/vn/triggers/collectionVolumetry_afterInsert.sql
index 9f061742c..1cc9d377d 100644
--- a/db/routines/vn/triggers/collectionVolumetry_afterInsert.sql
+++ b/db/routines/vn/triggers/collectionVolumetry_afterInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`collectionVolumetry_afterInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`collectionVolumetry_afterInsert`
AFTER INSERT ON `collectionVolumetry`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/collectionVolumetry_afterUpdate.sql b/db/routines/vn/triggers/collectionVolumetry_afterUpdate.sql
index 6dc4311c5..745cddfbe 100644
--- a/db/routines/vn/triggers/collectionVolumetry_afterUpdate.sql
+++ b/db/routines/vn/triggers/collectionVolumetry_afterUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`collectionVolumetry_afterUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`collectionVolumetry_afterUpdate`
AFTER UPDATE ON `collectionVolumetry`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/collection_beforeUpdate.sql b/db/routines/vn/triggers/collection_beforeUpdate.sql
index 40a0b7bed..d6b2f6b8a 100644
--- a/db/routines/vn/triggers/collection_beforeUpdate.sql
+++ b/db/routines/vn/triggers/collection_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`collection_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`collection_beforeUpdate`
BEFORE UPDATE ON `collection`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/country_afterDelete.sql b/db/routines/vn/triggers/country_afterDelete.sql
index 30fbfc817..8be887bb8 100644
--- a/db/routines/vn/triggers/country_afterDelete.sql
+++ b/db/routines/vn/triggers/country_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`country_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`country_afterDelete`
AFTER DELETE ON `country`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/country_afterInsert.sql b/db/routines/vn/triggers/country_afterInsert.sql
index 69294a9d5..af9626b9c 100644
--- a/db/routines/vn/triggers/country_afterInsert.sql
+++ b/db/routines/vn/triggers/country_afterInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`country_afterInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`country_afterInsert`
AFTER INSERT ON `country`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/country_afterUpdate.sql b/db/routines/vn/triggers/country_afterUpdate.sql
index a38994735..95d823c60 100644
--- a/db/routines/vn/triggers/country_afterUpdate.sql
+++ b/db/routines/vn/triggers/country_afterUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`country_afterUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`country_afterUpdate`
AFTER UPDATE ON `country`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/country_beforeInsert.sql b/db/routines/vn/triggers/country_beforeInsert.sql
index 5ba5b832d..eb43cf989 100644
--- a/db/routines/vn/triggers/country_beforeInsert.sql
+++ b/db/routines/vn/triggers/country_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`country_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`country_beforeInsert`
BEFORE INSERT ON `country`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/country_beforeUpdate.sql b/db/routines/vn/triggers/country_beforeUpdate.sql
index 31de99f34..f63672788 100644
--- a/db/routines/vn/triggers/country_beforeUpdate.sql
+++ b/db/routines/vn/triggers/country_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`country_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`country_beforeUpdate`
BEFORE UPDATE ON `country`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/creditClassification_beforeUpdate.sql b/db/routines/vn/triggers/creditClassification_beforeUpdate.sql
index 410ce2bc4..e586e7685 100644
--- a/db/routines/vn/triggers/creditClassification_beforeUpdate.sql
+++ b/db/routines/vn/triggers/creditClassification_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`creditClassification_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`creditClassification_beforeUpdate`
BEFORE UPDATE ON `creditClassification`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/creditInsurance_afterInsert.sql b/db/routines/vn/triggers/creditInsurance_afterInsert.sql
index 22f94854b..f4857a730 100644
--- a/db/routines/vn/triggers/creditInsurance_afterInsert.sql
+++ b/db/routines/vn/triggers/creditInsurance_afterInsert.sql
@@ -1,11 +1,11 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`creditInsurance_afterInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`creditInsurance_afterInsert`
AFTER INSERT ON `creditInsurance`
FOR EACH ROW
BEGIN
UPDATE `client` c
JOIN vn.creditClassification cc ON cc.client = c.id
- SET creditInsurance = NEW.credit WHERE cc.id = NEW.creditClassification;
+ SET creditInsurance = NEW.credit WHERE cc.id = NEW.creditClassificationFk;
END$$
DELIMITER ;
diff --git a/db/routines/vn/triggers/creditInsurance_beforeInsert.sql b/db/routines/vn/triggers/creditInsurance_beforeInsert.sql
deleted file mode 100644
index 51ab223b1..000000000
--- a/db/routines/vn/triggers/creditInsurance_beforeInsert.sql
+++ /dev/null
@@ -1,10 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`creditInsurance_beforeInsert`
- BEFORE INSERT ON `creditInsurance`
- FOR EACH ROW
-BEGIN
- IF NEW.creditClassificationFk THEN
- SET NEW.creditClassification = NEW.creditClassificationFk;
- END IF;
-END$$
-DELIMITER ;
diff --git a/db/routines/vn/triggers/delivery_beforeInsert.sql b/db/routines/vn/triggers/delivery_beforeInsert.sql
index eb4a6f21a..7996e0aef 100644
--- a/db/routines/vn/triggers/delivery_beforeInsert.sql
+++ b/db/routines/vn/triggers/delivery_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`delivery_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`delivery_beforeInsert`
BEFORE INSERT ON `delivery`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/delivery_beforeUpdate.sql b/db/routines/vn/triggers/delivery_beforeUpdate.sql
index 6206d4722..4ddb932e9 100644
--- a/db/routines/vn/triggers/delivery_beforeUpdate.sql
+++ b/db/routines/vn/triggers/delivery_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`delivery_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`delivery_beforeUpdate`
BEFORE UPDATE ON `delivery`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/department_afterDelete.sql b/db/routines/vn/triggers/department_afterDelete.sql
index 311847556..09fcf3ea1 100644
--- a/db/routines/vn/triggers/department_afterDelete.sql
+++ b/db/routines/vn/triggers/department_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`department_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`department_afterDelete`
AFTER DELETE ON `department`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/department_afterUpdate.sql b/db/routines/vn/triggers/department_afterUpdate.sql
index a425e1809..559fad9a3 100644
--- a/db/routines/vn/triggers/department_afterUpdate.sql
+++ b/db/routines/vn/triggers/department_afterUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`department_afterUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`department_afterUpdate`
AFTER UPDATE ON `department`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/department_beforeDelete.sql b/db/routines/vn/triggers/department_beforeDelete.sql
index 6eaa5b42e..307af6b72 100644
--- a/db/routines/vn/triggers/department_beforeDelete.sql
+++ b/db/routines/vn/triggers/department_beforeDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`department_beforeDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`department_beforeDelete`
BEFORE DELETE ON `department`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/department_beforeInsert.sql b/db/routines/vn/triggers/department_beforeInsert.sql
index 6bd6617ae..8fa89fad6 100644
--- a/db/routines/vn/triggers/department_beforeInsert.sql
+++ b/db/routines/vn/triggers/department_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`department_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`department_beforeInsert`
BEFORE INSERT ON `department`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/deviceProductionModels_beforeInsert.sql b/db/routines/vn/triggers/deviceProductionModels_beforeInsert.sql
index 3994520b7..f39ad28db 100644
--- a/db/routines/vn/triggers/deviceProductionModels_beforeInsert.sql
+++ b/db/routines/vn/triggers/deviceProductionModels_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`deviceProductionModels_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`deviceProductionModels_beforeInsert`
BEFORE INSERT ON `deviceProductionModels`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/deviceProductionModels_beforeUpdate.sql b/db/routines/vn/triggers/deviceProductionModels_beforeUpdate.sql
index 01c8d347e..ea43db8a0 100644
--- a/db/routines/vn/triggers/deviceProductionModels_beforeUpdate.sql
+++ b/db/routines/vn/triggers/deviceProductionModels_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`deviceProductionModels_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`deviceProductionModels_beforeUpdate`
BEFORE UPDATE ON `deviceProductionModels`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/deviceProductionState_beforeInsert.sql b/db/routines/vn/triggers/deviceProductionState_beforeInsert.sql
index 1a2a66e10..6fb4bd67a 100644
--- a/db/routines/vn/triggers/deviceProductionState_beforeInsert.sql
+++ b/db/routines/vn/triggers/deviceProductionState_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`deviceProductionState_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`deviceProductionState_beforeInsert`
BEFORE INSERT ON `deviceProductionState`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/deviceProductionState_beforeUpdate.sql b/db/routines/vn/triggers/deviceProductionState_beforeUpdate.sql
index e8172fb42..56a1d2aad 100644
--- a/db/routines/vn/triggers/deviceProductionState_beforeUpdate.sql
+++ b/db/routines/vn/triggers/deviceProductionState_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`deviceProductionState_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`deviceProductionState_beforeUpdate`
BEFORE UPDATE ON `deviceProductionState`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/deviceProductionUser_afterDelete.sql b/db/routines/vn/triggers/deviceProductionUser_afterDelete.sql
index a95170e9a..4e8d7ddf2 100644
--- a/db/routines/vn/triggers/deviceProductionUser_afterDelete.sql
+++ b/db/routines/vn/triggers/deviceProductionUser_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`deviceProductionUser_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`deviceProductionUser_afterDelete`
AFTER DELETE ON `deviceProductionUser`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/deviceProductionUser_afterInsert.sql b/db/routines/vn/triggers/deviceProductionUser_afterInsert.sql
index 3c8a9a51d..f33241d3b 100644
--- a/db/routines/vn/triggers/deviceProductionUser_afterInsert.sql
+++ b/db/routines/vn/triggers/deviceProductionUser_afterInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`deviceProductionUser_afterInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`deviceProductionUser_afterInsert`
AFTER INSERT ON `deviceProductionUser`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/deviceProductionUser_beforeInsert.sql b/db/routines/vn/triggers/deviceProductionUser_beforeInsert.sql
index b392cf5a1..ab9e43cd4 100644
--- a/db/routines/vn/triggers/deviceProductionUser_beforeInsert.sql
+++ b/db/routines/vn/triggers/deviceProductionUser_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`deviceProductionUser_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`deviceProductionUser_beforeInsert`
BEFORE INSERT ON `deviceProductionUser`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/deviceProductionUser_beforeUpdate.sql b/db/routines/vn/triggers/deviceProductionUser_beforeUpdate.sql
index 7318bd99b..85846fb84 100644
--- a/db/routines/vn/triggers/deviceProductionUser_beforeUpdate.sql
+++ b/db/routines/vn/triggers/deviceProductionUser_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`deviceProductionUser_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`deviceProductionUser_beforeUpdate`
BEFORE UPDATE ON `deviceProductionUser`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/deviceProduction_afterDelete.sql b/db/routines/vn/triggers/deviceProduction_afterDelete.sql
index af2b640e5..b7cbac9ff 100644
--- a/db/routines/vn/triggers/deviceProduction_afterDelete.sql
+++ b/db/routines/vn/triggers/deviceProduction_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`deviceProduction_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`deviceProduction_afterDelete`
AFTER DELETE ON `deviceProduction`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/deviceProduction_beforeInsert.sql b/db/routines/vn/triggers/deviceProduction_beforeInsert.sql
index 66b5c2aef..022a1fbb9 100644
--- a/db/routines/vn/triggers/deviceProduction_beforeInsert.sql
+++ b/db/routines/vn/triggers/deviceProduction_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`deviceProduction_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`deviceProduction_beforeInsert`
BEFORE INSERT ON `deviceProduction`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/deviceProduction_beforeUpdate.sql b/db/routines/vn/triggers/deviceProduction_beforeUpdate.sql
index 9206195fe..83e26e224 100644
--- a/db/routines/vn/triggers/deviceProduction_beforeUpdate.sql
+++ b/db/routines/vn/triggers/deviceProduction_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`deviceProduction_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`deviceProduction_beforeUpdate`
BEFORE UPDATE ON `deviceProduction`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/dms_beforeDelete.sql b/db/routines/vn/triggers/dms_beforeDelete.sql
index 3bbc05ba3..603514afa 100644
--- a/db/routines/vn/triggers/dms_beforeDelete.sql
+++ b/db/routines/vn/triggers/dms_beforeDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`dms_beforeDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`dms_beforeDelete`
BEFORE DELETE ON `dms`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/dms_beforeInsert.sql b/db/routines/vn/triggers/dms_beforeInsert.sql
index f7877ecb8..c7ed6bb47 100644
--- a/db/routines/vn/triggers/dms_beforeInsert.sql
+++ b/db/routines/vn/triggers/dms_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`dms_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`dms_beforeInsert`
BEFORE INSERT ON `dms`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/dms_beforeUpdate.sql b/db/routines/vn/triggers/dms_beforeUpdate.sql
index c93659d45..12a640c1b 100644
--- a/db/routines/vn/triggers/dms_beforeUpdate.sql
+++ b/db/routines/vn/triggers/dms_beforeUpdate.sql
@@ -1,7 +1,7 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`dms_beforeUpdate`
- BEFORE UPDATE ON `dms`
- FOR EACH ROW
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`dms_beforeUpdate`
+ BEFORE UPDATE ON `dms`
+ FOR EACH ROW
BEGIN
DECLARE vHardCopyNumber INT;
@@ -24,5 +24,5 @@ BEGIN
SET NEW.hasFile = 0;
END IF;
-END$$
-DELIMITER ;
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/triggers/duaTax_beforeInsert.sql b/db/routines/vn/triggers/duaTax_beforeInsert.sql
index 9ca1d970d..8ce66429b 100644
--- a/db/routines/vn/triggers/duaTax_beforeInsert.sql
+++ b/db/routines/vn/triggers/duaTax_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`duaTax_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`duaTax_beforeInsert`
BEFORE INSERT ON `duaTax`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/duaTax_beforeUpdate.sql b/db/routines/vn/triggers/duaTax_beforeUpdate.sql
index dca8958a9..2d3a59985 100644
--- a/db/routines/vn/triggers/duaTax_beforeUpdate.sql
+++ b/db/routines/vn/triggers/duaTax_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`duaTax_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`duaTax_beforeUpdate`
BEFORE UPDATE ON `duaTax`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/ektEntryAssign_afterInsert.sql b/db/routines/vn/triggers/ektEntryAssign_afterInsert.sql
index e42b43ca1..6df9df941 100644
--- a/db/routines/vn/triggers/ektEntryAssign_afterInsert.sql
+++ b/db/routines/vn/triggers/ektEntryAssign_afterInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ektEntryAssign_afterInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ektEntryAssign_afterInsert`
AFTER INSERT ON `ektEntryAssign`
FOR EACH ROW
UPDATE entry SET reference = NEW.`ref` WHERE id = NEW.entryFk$$
diff --git a/db/routines/vn/triggers/ektEntryAssign_afterUpdate.sql b/db/routines/vn/triggers/ektEntryAssign_afterUpdate.sql
index 8d2791d0f..c85d72e14 100644
--- a/db/routines/vn/triggers/ektEntryAssign_afterUpdate.sql
+++ b/db/routines/vn/triggers/ektEntryAssign_afterUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ektEntryAssign_afterUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ektEntryAssign_afterUpdate`
AFTER UPDATE ON `ektEntryAssign`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/entryDms_afterDelete.sql b/db/routines/vn/triggers/entryDms_afterDelete.sql
index 9ae8e7058..3c32fbd26 100644
--- a/db/routines/vn/triggers/entryDms_afterDelete.sql
+++ b/db/routines/vn/triggers/entryDms_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`entryDms_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`entryDms_afterDelete`
AFTER DELETE ON `entryDms`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/entryDms_beforeInsert.sql b/db/routines/vn/triggers/entryDms_beforeInsert.sql
index 4f9550f48..f0712b481 100644
--- a/db/routines/vn/triggers/entryDms_beforeInsert.sql
+++ b/db/routines/vn/triggers/entryDms_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`entryDms_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`entryDms_beforeInsert`
BEFORE INSERT ON `entryDms`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/entryDms_beforeUpdate.sql b/db/routines/vn/triggers/entryDms_beforeUpdate.sql
index ecc047029..d9b548f60 100644
--- a/db/routines/vn/triggers/entryDms_beforeUpdate.sql
+++ b/db/routines/vn/triggers/entryDms_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`entryDms_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`entryDms_beforeUpdate`
BEFORE UPDATE ON `entryDms`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/entryObservation_afterDelete.sql b/db/routines/vn/triggers/entryObservation_afterDelete.sql
index d143e105a..d61c678d2 100644
--- a/db/routines/vn/triggers/entryObservation_afterDelete.sql
+++ b/db/routines/vn/triggers/entryObservation_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`entryObservation_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`entryObservation_afterDelete`
AFTER DELETE ON `entryObservation`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/entryObservation_beforeInsert.sql b/db/routines/vn/triggers/entryObservation_beforeInsert.sql
index b842aeee7..9a9a8a3ee 100644
--- a/db/routines/vn/triggers/entryObservation_beforeInsert.sql
+++ b/db/routines/vn/triggers/entryObservation_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`entryObservation_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`entryObservation_beforeInsert`
BEFORE INSERT ON `entryObservation`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/entryObservation_beforeUpdate.sql b/db/routines/vn/triggers/entryObservation_beforeUpdate.sql
index 501631c69..3d1b73bec 100644
--- a/db/routines/vn/triggers/entryObservation_beforeUpdate.sql
+++ b/db/routines/vn/triggers/entryObservation_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`entryObservation_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`entryObservation_beforeUpdate`
BEFORE UPDATE ON `entryObservation`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/entry_afterDelete.sql b/db/routines/vn/triggers/entry_afterDelete.sql
index c723930fa..ebc6cd0e1 100644
--- a/db/routines/vn/triggers/entry_afterDelete.sql
+++ b/db/routines/vn/triggers/entry_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`entry_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`entry_afterDelete`
AFTER DELETE ON `entry`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/entry_afterUpdate.sql b/db/routines/vn/triggers/entry_afterUpdate.sql
index 47d61ed30..3a0227cf9 100644
--- a/db/routines/vn/triggers/entry_afterUpdate.sql
+++ b/db/routines/vn/triggers/entry_afterUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`entry_afterUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`entry_afterUpdate`
AFTER UPDATE ON `entry`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/entry_beforeDelete.sql b/db/routines/vn/triggers/entry_beforeDelete.sql
index 5b83daf77..4e933e1f4 100644
--- a/db/routines/vn/triggers/entry_beforeDelete.sql
+++ b/db/routines/vn/triggers/entry_beforeDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`entry_beforeDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`entry_beforeDelete`
BEFORE DELETE ON `entry`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/entry_beforeInsert.sql b/db/routines/vn/triggers/entry_beforeInsert.sql
index 17831f1b8..8a114c13f 100644
--- a/db/routines/vn/triggers/entry_beforeInsert.sql
+++ b/db/routines/vn/triggers/entry_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`entry_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`entry_beforeInsert`
BEFORE INSERT ON `entry`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/entry_beforeUpdate.sql b/db/routines/vn/triggers/entry_beforeUpdate.sql
index 0a161853b..8e5a326a0 100644
--- a/db/routines/vn/triggers/entry_beforeUpdate.sql
+++ b/db/routines/vn/triggers/entry_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`entry_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`entry_beforeUpdate`
BEFORE UPDATE ON `entry`
FOR EACH ROW
BEGIN
@@ -71,7 +71,10 @@ 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
+ IF NOT (NEW.travelFk <=> OLD.travelFk)
+ OR NOT (NEW.currencyFk <=> OLD.currencyFk)
+ OR NOT (NEW.supplierFk <=> OLD.supplierFk) THEN
+
SET NEW.commission = entry_getCommission(NEW.travelFk, NEW.currencyFk, NEW.supplierFk);
END IF;
END$$
diff --git a/db/routines/vn/triggers/expeditionPallet_beforeInsert.sql b/db/routines/vn/triggers/expeditionPallet_beforeInsert.sql
index 419cc2553..d2ea7ef76 100644
--- a/db/routines/vn/triggers/expeditionPallet_beforeInsert.sql
+++ b/db/routines/vn/triggers/expeditionPallet_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`expeditionPallet_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`expeditionPallet_beforeInsert`
BEFORE INSERT ON `expeditionPallet`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/expeditionScan_beforeInsert.sql b/db/routines/vn/triggers/expeditionScan_beforeInsert.sql
index 1dce8fe9b..ec1dbc7c7 100644
--- a/db/routines/vn/triggers/expeditionScan_beforeInsert.sql
+++ b/db/routines/vn/triggers/expeditionScan_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`expeditionScan_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`expeditionScan_beforeInsert`
BEFORE INSERT ON `expeditionScan`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/expeditionState_afterInsert.sql b/db/routines/vn/triggers/expeditionState_afterInsert.sql
index 3d8f4130c..6f0e4c622 100644
--- a/db/routines/vn/triggers/expeditionState_afterInsert.sql
+++ b/db/routines/vn/triggers/expeditionState_afterInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`expeditionState_afterInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`expeditionState_afterInsert`
AFTER INSERT ON `expeditionState`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/expeditionState_beforeInsert.sql b/db/routines/vn/triggers/expeditionState_beforeInsert.sql
index 350240aab..c4dd40611 100644
--- a/db/routines/vn/triggers/expeditionState_beforeInsert.sql
+++ b/db/routines/vn/triggers/expeditionState_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`expeditionState_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`expeditionState_beforeInsert`
BEFORE INSERT ON `expeditionState`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/expeditionTruck_beforeInsert.sql b/db/routines/vn/triggers/expeditionTruck_beforeInsert.sql
deleted file mode 100644
index 23cba7b3a..000000000
--- a/db/routines/vn/triggers/expeditionTruck_beforeInsert.sql
+++ /dev/null
@@ -1,10 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`expeditionTruck_beforeInsert`
- BEFORE INSERT ON `expeditionTruck`
- FOR EACH ROW
-BEGIN
-
- SET NEW.description = UCASE(NEW.description);
-
-END$$
-DELIMITER ;
diff --git a/db/routines/vn/triggers/expeditionTruck_beforeUpdate.sql b/db/routines/vn/triggers/expeditionTruck_beforeUpdate.sql
deleted file mode 100644
index 1b3b97238..000000000
--- a/db/routines/vn/triggers/expeditionTruck_beforeUpdate.sql
+++ /dev/null
@@ -1,10 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`expeditionTruck_beforeUpdate`
- BEFORE UPDATE ON `expeditionTruck`
- FOR EACH ROW
-BEGIN
-
- SET NEW.description = UCASE(NEW.description);
-
-END$$
-DELIMITER ;
diff --git a/db/routines/vn/triggers/expedition_afterDelete.sql b/db/routines/vn/triggers/expedition_afterDelete.sql
index e05cbf279..5d74a71e5 100644
--- a/db/routines/vn/triggers/expedition_afterDelete.sql
+++ b/db/routines/vn/triggers/expedition_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`expedition_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`expedition_afterDelete`
AFTER DELETE ON `expedition`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/expedition_beforeDelete.sql b/db/routines/vn/triggers/expedition_beforeDelete.sql
index cbcc5a3bb..13ba19631 100644
--- a/db/routines/vn/triggers/expedition_beforeDelete.sql
+++ b/db/routines/vn/triggers/expedition_beforeDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`expedition_beforeDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`expedition_beforeDelete`
BEFORE DELETE ON `expedition`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/expedition_beforeInsert.sql b/db/routines/vn/triggers/expedition_beforeInsert.sql
index e73ed9e49..42365c28f 100644
--- a/db/routines/vn/triggers/expedition_beforeInsert.sql
+++ b/db/routines/vn/triggers/expedition_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`expedition_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`expedition_beforeInsert`
BEFORE INSERT ON `expedition`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/expedition_beforeUpdate.sql b/db/routines/vn/triggers/expedition_beforeUpdate.sql
index 870c1a285..49cb6e816 100644
--- a/db/routines/vn/triggers/expedition_beforeUpdate.sql
+++ b/db/routines/vn/triggers/expedition_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`expedition_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`expedition_beforeUpdate`
BEFORE UPDATE ON `expedition`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/floramondoConfig_afterInsert.sql b/db/routines/vn/triggers/floramondoConfig_afterInsert.sql
index f64cb7878..8c94ecbc4 100644
--- a/db/routines/vn/triggers/floramondoConfig_afterInsert.sql
+++ b/db/routines/vn/triggers/floramondoConfig_afterInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`floramondoConfig_afterInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`floramondoConfig_afterInsert`
AFTER INSERT ON `floramondoConfig`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/gregue_beforeInsert.sql b/db/routines/vn/triggers/gregue_beforeInsert.sql
index 76e178356..46e867bc8 100644
--- a/db/routines/vn/triggers/gregue_beforeInsert.sql
+++ b/db/routines/vn/triggers/gregue_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`gregue_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`gregue_beforeInsert`
BEFORE INSERT ON `greuge`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/greuge_afterDelete.sql b/db/routines/vn/triggers/greuge_afterDelete.sql
index 947359b4c..5d6784579 100644
--- a/db/routines/vn/triggers/greuge_afterDelete.sql
+++ b/db/routines/vn/triggers/greuge_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`greuge_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`greuge_afterDelete`
AFTER DELETE ON `greuge`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/greuge_beforeInsert.sql b/db/routines/vn/triggers/greuge_beforeInsert.sql
index 100f2f244..b37c9d2d0 100644
--- a/db/routines/vn/triggers/greuge_beforeInsert.sql
+++ b/db/routines/vn/triggers/greuge_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`greuge_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`greuge_beforeInsert`
BEFORE INSERT ON `greuge`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/greuge_beforeUpdate.sql b/db/routines/vn/triggers/greuge_beforeUpdate.sql
index 265861db5..af9f06206 100644
--- a/db/routines/vn/triggers/greuge_beforeUpdate.sql
+++ b/db/routines/vn/triggers/greuge_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`greuge_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`greuge_beforeUpdate`
BEFORE UPDATE ON `greuge`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/host_beforeInsert.sql b/db/routines/vn/triggers/host_beforeInsert.sql
index c2cb82334..96b78bfb7 100644
--- a/db/routines/vn/triggers/host_beforeInsert.sql
+++ b/db/routines/vn/triggers/host_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`host_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`host_beforeInsert`
BEFORE INSERT ON `host`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/host_beforeUpdate.sql b/db/routines/vn/triggers/host_beforeUpdate.sql
index dc5a18f3c..7f279e655 100644
--- a/db/routines/vn/triggers/host_beforeUpdate.sql
+++ b/db/routines/vn/triggers/host_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`host_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`host_beforeUpdate`
BEFORE UPDATE ON `host`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/invoiceInDueDay_afterDelete.sql b/db/routines/vn/triggers/invoiceInDueDay_afterDelete.sql
index 1e5b75bb2..1e43fb816 100644
--- a/db/routines/vn/triggers/invoiceInDueDay_afterDelete.sql
+++ b/db/routines/vn/triggers/invoiceInDueDay_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceInDueDay_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`invoiceInDueDay_afterDelete`
AFTER DELETE ON `invoiceInDueDay`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/invoiceInDueDay_beforeInsert.sql b/db/routines/vn/triggers/invoiceInDueDay_beforeInsert.sql
index f7e4265a7..4e859496e 100644
--- a/db/routines/vn/triggers/invoiceInDueDay_beforeInsert.sql
+++ b/db/routines/vn/triggers/invoiceInDueDay_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceInDueDay_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`invoiceInDueDay_beforeInsert`
BEFORE INSERT ON `invoiceInDueDay`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/invoiceInDueDay_beforeUpdate.sql b/db/routines/vn/triggers/invoiceInDueDay_beforeUpdate.sql
index 2452ff0d1..9ca9aae50 100644
--- a/db/routines/vn/triggers/invoiceInDueDay_beforeUpdate.sql
+++ b/db/routines/vn/triggers/invoiceInDueDay_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceInDueDay_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`invoiceInDueDay_beforeUpdate`
BEFORE UPDATE ON `invoiceInDueDay`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/invoiceInTax_afterDelete.sql b/db/routines/vn/triggers/invoiceInTax_afterDelete.sql
index f541503ff..e48135ba6 100644
--- a/db/routines/vn/triggers/invoiceInTax_afterDelete.sql
+++ b/db/routines/vn/triggers/invoiceInTax_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceInTax_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`invoiceInTax_afterDelete`
AFTER DELETE ON `invoiceInTax`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/invoiceInTax_beforeInsert.sql b/db/routines/vn/triggers/invoiceInTax_beforeInsert.sql
index b1138fc3a..c20e60b40 100644
--- a/db/routines/vn/triggers/invoiceInTax_beforeInsert.sql
+++ b/db/routines/vn/triggers/invoiceInTax_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceInTax_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`invoiceInTax_beforeInsert`
BEFORE INSERT ON `invoiceInTax`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/invoiceInTax_beforeUpdate.sql b/db/routines/vn/triggers/invoiceInTax_beforeUpdate.sql
index 30918b7c5..68450bb5e 100644
--- a/db/routines/vn/triggers/invoiceInTax_beforeUpdate.sql
+++ b/db/routines/vn/triggers/invoiceInTax_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceInTax_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`invoiceInTax_beforeUpdate`
BEFORE UPDATE ON `invoiceInTax`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/invoiceIn_afterDelete.sql b/db/routines/vn/triggers/invoiceIn_afterDelete.sql
index c088f6492..6b6a05765 100644
--- a/db/routines/vn/triggers/invoiceIn_afterDelete.sql
+++ b/db/routines/vn/triggers/invoiceIn_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceIn_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`invoiceIn_afterDelete`
AFTER DELETE ON `invoiceIn`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/invoiceIn_afterUpdate.sql b/db/routines/vn/triggers/invoiceIn_afterUpdate.sql
index 1a9105c9e..95b1d98a9 100644
--- a/db/routines/vn/triggers/invoiceIn_afterUpdate.sql
+++ b/db/routines/vn/triggers/invoiceIn_afterUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceIn_afterUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`invoiceIn_afterUpdate`
AFTER UPDATE ON `invoiceIn`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/invoiceIn_beforeDelete.sql b/db/routines/vn/triggers/invoiceIn_beforeDelete.sql
index 2ffff923a..3f3d48a2a 100644
--- a/db/routines/vn/triggers/invoiceIn_beforeDelete.sql
+++ b/db/routines/vn/triggers/invoiceIn_beforeDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceIn_beforeDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`invoiceIn_beforeDelete`
BEFORE DELETE ON `invoiceIn`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/invoiceIn_beforeInsert.sql b/db/routines/vn/triggers/invoiceIn_beforeInsert.sql
index 2b80f2534..f01557b5e 100644
--- a/db/routines/vn/triggers/invoiceIn_beforeInsert.sql
+++ b/db/routines/vn/triggers/invoiceIn_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceIn_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`invoiceIn_beforeInsert`
BEFORE INSERT ON `invoiceIn`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/invoiceIn_beforeUpdate.sql b/db/routines/vn/triggers/invoiceIn_beforeUpdate.sql
index 4503c7dbd..e58fadbdf 100644
--- a/db/routines/vn/triggers/invoiceIn_beforeUpdate.sql
+++ b/db/routines/vn/triggers/invoiceIn_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceIn_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`invoiceIn_beforeUpdate`
BEFORE UPDATE ON `invoiceIn`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/invoiceOut_afterInsert.sql b/db/routines/vn/triggers/invoiceOut_afterInsert.sql
index 389c01111..868350f20 100644
--- a/db/routines/vn/triggers/invoiceOut_afterInsert.sql
+++ b/db/routines/vn/triggers/invoiceOut_afterInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceOut_afterInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`invoiceOut_afterInsert`
AFTER INSERT ON `invoiceOut`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/invoiceOut_beforeDelete.sql b/db/routines/vn/triggers/invoiceOut_beforeDelete.sql
index 8c8d7464c..5c9839f05 100644
--- a/db/routines/vn/triggers/invoiceOut_beforeDelete.sql
+++ b/db/routines/vn/triggers/invoiceOut_beforeDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceOut_beforeDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`invoiceOut_beforeDelete`
BEFORE DELETE ON `invoiceOut`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/invoiceOut_beforeInsert.sql b/db/routines/vn/triggers/invoiceOut_beforeInsert.sql
index 0081c8803..9fd027ba0 100644
--- a/db/routines/vn/triggers/invoiceOut_beforeInsert.sql
+++ b/db/routines/vn/triggers/invoiceOut_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceOut_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`invoiceOut_beforeInsert`
BEFORE INSERT ON `invoiceOut`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/invoiceOut_beforeUpdate.sql b/db/routines/vn/triggers/invoiceOut_beforeUpdate.sql
index 72be9cef0..5efb79c77 100644
--- a/db/routines/vn/triggers/invoiceOut_beforeUpdate.sql
+++ b/db/routines/vn/triggers/invoiceOut_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceOut_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`invoiceOut_beforeUpdate`
BEFORE UPDATE ON `invoiceOut`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/itemBarcode_afterDelete.sql b/db/routines/vn/triggers/itemBarcode_afterDelete.sql
index 4453d4a2f..4efde371d 100644
--- a/db/routines/vn/triggers/itemBarcode_afterDelete.sql
+++ b/db/routines/vn/triggers/itemBarcode_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemBarcode_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemBarcode_afterDelete`
AFTER DELETE ON `itemBarcode`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/itemBarcode_beforeInsert.sql b/db/routines/vn/triggers/itemBarcode_beforeInsert.sql
index 503f1eb8a..53563b754 100644
--- a/db/routines/vn/triggers/itemBarcode_beforeInsert.sql
+++ b/db/routines/vn/triggers/itemBarcode_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemBarcode_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemBarcode_beforeInsert`
BEFORE INSERT ON `itemBarcode`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/itemBarcode_beforeUpdate.sql b/db/routines/vn/triggers/itemBarcode_beforeUpdate.sql
index 2131427b2..e73fae473 100644
--- a/db/routines/vn/triggers/itemBarcode_beforeUpdate.sql
+++ b/db/routines/vn/triggers/itemBarcode_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemBarcode_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemBarcode_beforeUpdate`
BEFORE UPDATE ON `itemBarcode`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/itemBotanical_afterDelete.sql b/db/routines/vn/triggers/itemBotanical_afterDelete.sql
index 1b3c50ad1..7858bf1f5 100644
--- a/db/routines/vn/triggers/itemBotanical_afterDelete.sql
+++ b/db/routines/vn/triggers/itemBotanical_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemBotanical_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemBotanical_afterDelete`
AFTER DELETE ON `itemBotanical`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/itemBotanical_beforeInsert.sql b/db/routines/vn/triggers/itemBotanical_beforeInsert.sql
index 8a1b9346d..312c8c9c7 100644
--- a/db/routines/vn/triggers/itemBotanical_beforeInsert.sql
+++ b/db/routines/vn/triggers/itemBotanical_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemBotanical_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemBotanical_beforeInsert`
BEFORE INSERT ON `itemBotanical`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/itemBotanical_beforeUpdate.sql b/db/routines/vn/triggers/itemBotanical_beforeUpdate.sql
index 55939c403..30a1778a6 100644
--- a/db/routines/vn/triggers/itemBotanical_beforeUpdate.sql
+++ b/db/routines/vn/triggers/itemBotanical_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemBotanical_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemBotanical_beforeUpdate`
BEFORE UPDATE ON `itemBotanical`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/itemCategory_afterInsert.sql b/db/routines/vn/triggers/itemCategory_afterInsert.sql
index 9449737d1..7f32b4af2 100644
--- a/db/routines/vn/triggers/itemCategory_afterInsert.sql
+++ b/db/routines/vn/triggers/itemCategory_afterInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemCategory_afterInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemCategory_afterInsert`
AFTER INSERT ON `itemCategory`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/itemCost_beforeInsert.sql b/db/routines/vn/triggers/itemCost_beforeInsert.sql
index ba80193a6..0c1b92548 100644
--- a/db/routines/vn/triggers/itemCost_beforeInsert.sql
+++ b/db/routines/vn/triggers/itemCost_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemCost_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemCost_beforeInsert`
BEFORE INSERT ON `itemCost`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/itemCost_beforeUpdate.sql b/db/routines/vn/triggers/itemCost_beforeUpdate.sql
index 242c768f5..bd5fde85a 100644
--- a/db/routines/vn/triggers/itemCost_beforeUpdate.sql
+++ b/db/routines/vn/triggers/itemCost_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemCost_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemCost_beforeUpdate`
BEFORE UPDATE ON `itemCost`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/itemMinimumQuantity_afterDelete.sql b/db/routines/vn/triggers/itemMinimumQuantity_afterDelete.sql
index 1da5a5942..41a1c41ef 100644
--- a/db/routines/vn/triggers/itemMinimumQuantity_afterDelete.sql
+++ b/db/routines/vn/triggers/itemMinimumQuantity_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemMinimumQuantity_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemMinimumQuantity_afterDelete`
AFTER DELETE ON `itemMinimumQuantity`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/itemMinimumQuantity_beforeInsert.sql b/db/routines/vn/triggers/itemMinimumQuantity_beforeInsert.sql
index 3ee6c0b1a..de19b68c7 100644
--- a/db/routines/vn/triggers/itemMinimumQuantity_beforeInsert.sql
+++ b/db/routines/vn/triggers/itemMinimumQuantity_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemMinimumQuantity_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemMinimumQuantity_beforeInsert`
BEFORE INSERT ON `itemMinimumQuantity`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/itemMinimumQuantity_beforeUpdate.sql b/db/routines/vn/triggers/itemMinimumQuantity_beforeUpdate.sql
index 6f082551c..42b9d7f22 100644
--- a/db/routines/vn/triggers/itemMinimumQuantity_beforeUpdate.sql
+++ b/db/routines/vn/triggers/itemMinimumQuantity_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemMinimumQuantity_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemMinimumQuantity_beforeUpdate`
BEFORE UPDATE ON `itemMinimumQuantity`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/itemShelvingSale_afterInsert.sql b/db/routines/vn/triggers/itemShelvingSale_afterInsert.sql
index ef0048b34..3531b094c 100644
--- a/db/routines/vn/triggers/itemShelvingSale_afterInsert.sql
+++ b/db/routines/vn/triggers/itemShelvingSale_afterInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemShelvingSale_afterInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemShelvingSale_afterInsert`
AFTER INSERT ON `itemShelvingSale`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/itemShelving _afterDelete.sql b/db/routines/vn/triggers/itemShelving_afterDelete.sql
similarity index 62%
rename from db/routines/vn/triggers/itemShelving _afterDelete.sql
rename to db/routines/vn/triggers/itemShelving_afterDelete.sql
index 9a1759eff..f4bafd75c 100644
--- a/db/routines/vn/triggers/itemShelving _afterDelete.sql
+++ b/db/routines/vn/triggers/itemShelving_afterDelete.sql
@@ -1,11 +1,11 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemShelving_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemShelving_afterDelete`
AFTER DELETE ON `itemShelving`
FOR EACH ROW
BEGIN
INSERT INTO shelvingLog
SET `action` = 'delete',
- `changedModel` = 'itemShelving',
+ `changedModel` = 'ItemShelving',
`changedModelId` = OLD.id,
`userFk` = account.myUser_getId();
END$$
diff --git a/db/routines/vn/triggers/itemShelving_afterInsert.sql b/db/routines/vn/triggers/itemShelving_afterInsert.sql
new file mode 100644
index 000000000..92243ca03
--- /dev/null
+++ b/db/routines/vn/triggers/itemShelving_afterInsert.sql
@@ -0,0 +1,18 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemShelving_afterInsert`
+ AFTER INSERT ON `itemShelving`
+ FOR EACH ROW
+BEGIN
+ INSERT INTO itemShelvingLog
+ SET itemShelvingFk = NEW.id,
+ workerFk = account.myUser_getId(),
+ accion = 'CREA REGISTRO',
+ itemFk = NEW.itemFk,
+ shelvingFk = NEW.shelvingFk,
+ visible = NEW.visible,
+ `grouping` = NEW.`grouping`,
+ packing = NEW.packing,
+ available = NEW.available;
+
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/triggers/itemShelving_afterUpdate.sql b/db/routines/vn/triggers/itemShelving_afterUpdate.sql
index 1ad57961a..e5e63db43 100644
--- a/db/routines/vn/triggers/itemShelving_afterUpdate.sql
+++ b/db/routines/vn/triggers/itemShelving_afterUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemShelving_afterUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemShelving_afterUpdate`
AFTER UPDATE ON `itemShelving`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/itemShelving_beforeDelete.sql b/db/routines/vn/triggers/itemShelving_beforeDelete.sql
index a9f59e011..89737a841 100644
--- a/db/routines/vn/triggers/itemShelving_beforeDelete.sql
+++ b/db/routines/vn/triggers/itemShelving_beforeDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemShelving_beforeDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemShelving_beforeDelete`
BEFORE DELETE ON `itemShelving`
FOR EACH ROW
INSERT INTO vn.itemShelvingLog(itemShelvingFk,
diff --git a/db/routines/vn/triggers/itemShelving_beforeInsert.sql b/db/routines/vn/triggers/itemShelving_beforeInsert.sql
index e9fe17cf2..484e785f5 100644
--- a/db/routines/vn/triggers/itemShelving_beforeInsert.sql
+++ b/db/routines/vn/triggers/itemShelving_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemShelving_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemShelving_beforeInsert`
BEFORE INSERT ON `itemShelving`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/itemShelving_beforeUpdate.sql b/db/routines/vn/triggers/itemShelving_beforeUpdate.sql
index 961d89f65..fabdf8efb 100644
--- a/db/routines/vn/triggers/itemShelving_beforeUpdate.sql
+++ b/db/routines/vn/triggers/itemShelving_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemShelving_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemShelving_beforeUpdate`
BEFORE UPDATE ON `itemShelving`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/itemTag_afterDelete.sql b/db/routines/vn/triggers/itemTag_afterDelete.sql
index 4014c88b5..e79c1ac5a 100644
--- a/db/routines/vn/triggers/itemTag_afterDelete.sql
+++ b/db/routines/vn/triggers/itemTag_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemTag_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemTag_afterDelete`
AFTER DELETE ON `itemTag`
FOR EACH ROW
trig: BEGIN
diff --git a/db/routines/vn/triggers/itemTag_afterInsert.sql b/db/routines/vn/triggers/itemTag_afterInsert.sql
index 3dfb25ad3..9e3e9f4e3 100644
--- a/db/routines/vn/triggers/itemTag_afterInsert.sql
+++ b/db/routines/vn/triggers/itemTag_afterInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemTag_afterInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemTag_afterInsert`
AFTER INSERT ON `itemTag`
FOR EACH ROW
trig: BEGIN
diff --git a/db/routines/vn/triggers/itemTag_afterUpdate.sql b/db/routines/vn/triggers/itemTag_afterUpdate.sql
index 61b45a161..494ffe76c 100644
--- a/db/routines/vn/triggers/itemTag_afterUpdate.sql
+++ b/db/routines/vn/triggers/itemTag_afterUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemTag_afterUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemTag_afterUpdate`
AFTER UPDATE ON `itemTag`
FOR EACH ROW
trig: BEGIN
diff --git a/db/routines/vn/triggers/itemTag_beforeInsert.sql b/db/routines/vn/triggers/itemTag_beforeInsert.sql
index cec4fd02f..d97d97106 100644
--- a/db/routines/vn/triggers/itemTag_beforeInsert.sql
+++ b/db/routines/vn/triggers/itemTag_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemTag_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemTag_beforeInsert`
BEFORE INSERT ON `itemTag`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/itemTag_beforeUpdate.sql b/db/routines/vn/triggers/itemTag_beforeUpdate.sql
index 41de249ef..1bdfbad1e 100644
--- a/db/routines/vn/triggers/itemTag_beforeUpdate.sql
+++ b/db/routines/vn/triggers/itemTag_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemTag_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemTag_beforeUpdate`
BEFORE UPDATE ON `itemTag`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/itemTaxCountry_afterDelete.sql b/db/routines/vn/triggers/itemTaxCountry_afterDelete.sql
index 8f91b26e1..0cdf01283 100644
--- a/db/routines/vn/triggers/itemTaxCountry_afterDelete.sql
+++ b/db/routines/vn/triggers/itemTaxCountry_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemTaxCountry_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemTaxCountry_afterDelete`
AFTER DELETE ON `itemTaxCountry`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/itemTaxCountry_beforeInsert.sql b/db/routines/vn/triggers/itemTaxCountry_beforeInsert.sql
index 348dac023..569be2d98 100644
--- a/db/routines/vn/triggers/itemTaxCountry_beforeInsert.sql
+++ b/db/routines/vn/triggers/itemTaxCountry_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemTaxCountry_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemTaxCountry_beforeInsert`
BEFORE INSERT ON `itemTaxCountry`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/itemTaxCountry_beforeUpdate.sql b/db/routines/vn/triggers/itemTaxCountry_beforeUpdate.sql
index 7470cd81e..ad7d6327b 100644
--- a/db/routines/vn/triggers/itemTaxCountry_beforeUpdate.sql
+++ b/db/routines/vn/triggers/itemTaxCountry_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemTaxCountry_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemTaxCountry_beforeUpdate`
BEFORE UPDATE ON `itemTaxCountry`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/itemType_beforeUpdate.sql b/db/routines/vn/triggers/itemType_beforeUpdate.sql
index 0e0aa0098..613ae8bfa 100644
--- a/db/routines/vn/triggers/itemType_beforeUpdate.sql
+++ b/db/routines/vn/triggers/itemType_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemType_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemType_beforeUpdate`
BEFORE UPDATE ON `itemType`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/item_afterDelete.sql b/db/routines/vn/triggers/item_afterDelete.sql
index 34f702cdd..175d0ae44 100644
--- a/db/routines/vn/triggers/item_afterDelete.sql
+++ b/db/routines/vn/triggers/item_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`item_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`item_afterDelete`
AFTER DELETE ON `item`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/item_afterInsert.sql b/db/routines/vn/triggers/item_afterInsert.sql
index a4f9c5f5a..6c0137a2f 100644
--- a/db/routines/vn/triggers/item_afterInsert.sql
+++ b/db/routines/vn/triggers/item_afterInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`item_afterInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`item_afterInsert`
AFTER INSERT ON `item`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/item_afterUpdate.sql b/db/routines/vn/triggers/item_afterUpdate.sql
index 3b433c302..92cc6f78c 100644
--- a/db/routines/vn/triggers/item_afterUpdate.sql
+++ b/db/routines/vn/triggers/item_afterUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`item_afterUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`item_afterUpdate`
AFTER UPDATE ON `item`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/item_beforeInsert.sql b/db/routines/vn/triggers/item_beforeInsert.sql
index d7ee4db34..6f5cdaa71 100644
--- a/db/routines/vn/triggers/item_beforeInsert.sql
+++ b/db/routines/vn/triggers/item_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`item_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`item_beforeInsert`
BEFORE INSERT ON `item`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/item_beforeUpdate.sql b/db/routines/vn/triggers/item_beforeUpdate.sql
index 3cf630d18..0db1dbb40 100644
--- a/db/routines/vn/triggers/item_beforeUpdate.sql
+++ b/db/routines/vn/triggers/item_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`item_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`item_beforeUpdate`
BEFORE UPDATE ON `item`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/machine_beforeInsert.sql b/db/routines/vn/triggers/machine_beforeInsert.sql
index 269879b22..81f4bb346 100644
--- a/db/routines/vn/triggers/machine_beforeInsert.sql
+++ b/db/routines/vn/triggers/machine_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`machine_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`machine_beforeInsert`
BEFORE INSERT ON `machine`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/mail_beforeInsert.sql b/db/routines/vn/triggers/mail_beforeInsert.sql
index fc598f829..04c9db61c 100644
--- a/db/routines/vn/triggers/mail_beforeInsert.sql
+++ b/db/routines/vn/triggers/mail_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`mail_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`mail_beforeInsert`
BEFORE INSERT ON `mail`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/mandate_beforeInsert.sql b/db/routines/vn/triggers/mandate_beforeInsert.sql
index 7d1e9a59e..bfc36cc31 100644
--- a/db/routines/vn/triggers/mandate_beforeInsert.sql
+++ b/db/routines/vn/triggers/mandate_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`mandate_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`mandate_beforeInsert`
BEFORE INSERT ON `mandate`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/operator_beforeInsert.sql b/db/routines/vn/triggers/operator_beforeInsert.sql
index c1805d0fc..e6d82dcc6 100644
--- a/db/routines/vn/triggers/operator_beforeInsert.sql
+++ b/db/routines/vn/triggers/operator_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`operator_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`operator_beforeInsert`
BEFORE INSERT ON `operator`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/operator_beforeUpdate.sql b/db/routines/vn/triggers/operator_beforeUpdate.sql
index 84fb8ca04..1294fcb8e 100644
--- a/db/routines/vn/triggers/operator_beforeUpdate.sql
+++ b/db/routines/vn/triggers/operator_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`operator_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`operator_beforeUpdate`
BEFORE UPDATE ON `operator`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/packaging_beforeInsert.sql b/db/routines/vn/triggers/packaging_beforeInsert.sql
index 02ba3cf4f..abbe24a45 100644
--- a/db/routines/vn/triggers/packaging_beforeInsert.sql
+++ b/db/routines/vn/triggers/packaging_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`packaging_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`packaging_beforeInsert`
BEFORE INSERT ON `packaging`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/packaging_beforeUpdate.sql b/db/routines/vn/triggers/packaging_beforeUpdate.sql
index 515c94bb5..c11b76902 100644
--- a/db/routines/vn/triggers/packaging_beforeUpdate.sql
+++ b/db/routines/vn/triggers/packaging_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`packaging_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`packaging_beforeUpdate`
BEFORE UPDATE ON `packaging`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/packingSite_afterDelete.sql b/db/routines/vn/triggers/packingSite_afterDelete.sql
index 7c76ae7ec..a1fccf67d 100644
--- a/db/routines/vn/triggers/packingSite_afterDelete.sql
+++ b/db/routines/vn/triggers/packingSite_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`packingSite_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`packingSite_afterDelete`
AFTER DELETE ON `packingSite`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/packingSite_beforeInsert.sql b/db/routines/vn/triggers/packingSite_beforeInsert.sql
index 966dfdd53..aab2d4b19 100644
--- a/db/routines/vn/triggers/packingSite_beforeInsert.sql
+++ b/db/routines/vn/triggers/packingSite_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`packingSite_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`packingSite_beforeInsert`
BEFORE INSERT ON `packingSite`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/packingSite_beforeUpdate.sql b/db/routines/vn/triggers/packingSite_beforeUpdate.sql
index 4d56ac1b5..dc365fc41 100644
--- a/db/routines/vn/triggers/packingSite_beforeUpdate.sql
+++ b/db/routines/vn/triggers/packingSite_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`packingSite_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`packingSite_beforeUpdate`
BEFORE UPDATE ON `packingSite`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/parking_afterDelete.sql b/db/routines/vn/triggers/parking_afterDelete.sql
index 1ec96c24d..1237b5dc6 100644
--- a/db/routines/vn/triggers/parking_afterDelete.sql
+++ b/db/routines/vn/triggers/parking_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`parking_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`parking_afterDelete`
AFTER DELETE ON `parking`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/parking_beforeInsert.sql b/db/routines/vn/triggers/parking_beforeInsert.sql
index cdec4c759..f55e9c1b2 100644
--- a/db/routines/vn/triggers/parking_beforeInsert.sql
+++ b/db/routines/vn/triggers/parking_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`parking_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`parking_beforeInsert`
BEFORE INSERT ON `parking`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/parking_beforeUpdate.sql b/db/routines/vn/triggers/parking_beforeUpdate.sql
index 3e808f505..1418abc34 100644
--- a/db/routines/vn/triggers/parking_beforeUpdate.sql
+++ b/db/routines/vn/triggers/parking_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`parking_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`parking_beforeUpdate`
BEFORE UPDATE ON `parking`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/payment_afterInsert.sql b/db/routines/vn/triggers/payment_afterInsert.sql
index 5585d6682..f9c9e2314 100644
--- a/db/routines/vn/triggers/payment_afterInsert.sql
+++ b/db/routines/vn/triggers/payment_afterInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`payment_afterInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`payment_afterInsert`
AFTER INSERT ON `payment`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/payment_beforeInsert.sql b/db/routines/vn/triggers/payment_beforeInsert.sql
index af369a69b..85c6060c0 100644
--- a/db/routines/vn/triggers/payment_beforeInsert.sql
+++ b/db/routines/vn/triggers/payment_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`payment_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`payment_beforeInsert`
BEFORE INSERT ON `payment`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/payment_beforeUpdate.sql b/db/routines/vn/triggers/payment_beforeUpdate.sql
index b3ef1342b..9a3bbe460 100644
--- a/db/routines/vn/triggers/payment_beforeUpdate.sql
+++ b/db/routines/vn/triggers/payment_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`payment_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`payment_beforeUpdate`
BEFORE UPDATE ON `payment`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/postCode_afterDelete.sql b/db/routines/vn/triggers/postCode_afterDelete.sql
index 736d5f5f3..4afcee770 100644
--- a/db/routines/vn/triggers/postCode_afterDelete.sql
+++ b/db/routines/vn/triggers/postCode_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`postCode_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`postCode_afterDelete`
AFTER DELETE ON `postCode`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/postCode_afterUpdate.sql b/db/routines/vn/triggers/postCode_afterUpdate.sql
index c1e56044a..f1019342f 100644
--- a/db/routines/vn/triggers/postCode_afterUpdate.sql
+++ b/db/routines/vn/triggers/postCode_afterUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`postCode_afterUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`postCode_afterUpdate`
AFTER UPDATE ON `postCode`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/postCode_beforeInsert.sql b/db/routines/vn/triggers/postCode_beforeInsert.sql
index 9e6d7e592..503d917a8 100644
--- a/db/routines/vn/triggers/postCode_beforeInsert.sql
+++ b/db/routines/vn/triggers/postCode_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`postCode_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`postCode_beforeInsert`
BEFORE INSERT ON `postCode`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/postCode_beforeUpdate.sql b/db/routines/vn/triggers/postCode_beforeUpdate.sql
index 1b3c228a3..fa8f03a15 100644
--- a/db/routines/vn/triggers/postCode_beforeUpdate.sql
+++ b/db/routines/vn/triggers/postCode_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`postCode_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`postCode_beforeUpdate`
BEFORE UPDATE ON `postCode`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/priceFixed_beforeInsert.sql b/db/routines/vn/triggers/priceFixed_beforeInsert.sql
index ecf6f3e30..b278f3749 100644
--- a/db/routines/vn/triggers/priceFixed_beforeInsert.sql
+++ b/db/routines/vn/triggers/priceFixed_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`priceFixed_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`priceFixed_beforeInsert`
BEFORE INSERT ON `priceFixed`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/priceFixed_beforeUpdate.sql b/db/routines/vn/triggers/priceFixed_beforeUpdate.sql
index f675322b9..1b8efa7f5 100644
--- a/db/routines/vn/triggers/priceFixed_beforeUpdate.sql
+++ b/db/routines/vn/triggers/priceFixed_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`priceFixed_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`priceFixed_beforeUpdate`
BEFORE UPDATE ON `priceFixed`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/productionConfig_afterDelete.sql b/db/routines/vn/triggers/productionConfig_afterDelete.sql
index 384bf681e..6b6800d4f 100644
--- a/db/routines/vn/triggers/productionConfig_afterDelete.sql
+++ b/db/routines/vn/triggers/productionConfig_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`productionConfig_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`productionConfig_afterDelete`
AFTER DELETE ON `productionConfig`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/productionConfig_beforeInsert.sql b/db/routines/vn/triggers/productionConfig_beforeInsert.sql
index 99b217be4..4ece1297a 100644
--- a/db/routines/vn/triggers/productionConfig_beforeInsert.sql
+++ b/db/routines/vn/triggers/productionConfig_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`productionConfig_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`productionConfig_beforeInsert`
BEFORE INSERT ON `productionConfig`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/productionConfig_beforeUpdate.sql b/db/routines/vn/triggers/productionConfig_beforeUpdate.sql
index f1ceaa471..e8b6bc294 100644
--- a/db/routines/vn/triggers/productionConfig_beforeUpdate.sql
+++ b/db/routines/vn/triggers/productionConfig_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`productionConfig_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`productionConfig_beforeUpdate`
BEFORE UPDATE ON `productionConfig`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/projectNotes_beforeInsert.sql b/db/routines/vn/triggers/projectNotes_beforeInsert.sql
index 58d75bec7..ccc7078d3 100644
--- a/db/routines/vn/triggers/projectNotes_beforeInsert.sql
+++ b/db/routines/vn/triggers/projectNotes_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`projectNotes_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`projectNotes_beforeInsert`
BEFORE INSERT ON `projectNotes`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/province_afterDelete.sql b/db/routines/vn/triggers/province_afterDelete.sql
index d0cee78e7..b338340e3 100644
--- a/db/routines/vn/triggers/province_afterDelete.sql
+++ b/db/routines/vn/triggers/province_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`province_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`province_afterDelete`
AFTER DELETE ON `province`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/province_afterUpdate.sql b/db/routines/vn/triggers/province_afterUpdate.sql
index e8f3958b2..4e99cdac4 100644
--- a/db/routines/vn/triggers/province_afterUpdate.sql
+++ b/db/routines/vn/triggers/province_afterUpdate.sql
@@ -1,7 +1,7 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`province_afterUpdate`
- AFTER UPDATE ON `province`
- FOR EACH ROW
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`province_afterUpdate`
+ AFTER UPDATE ON `province`
+ FOR EACH ROW
BEGIN
IF !(OLD.autonomyFk <=> NEW.autonomyFk) THEN
CALL zoneGeo_setParent(NEW.geoFk,
@@ -12,5 +12,5 @@ BEGIN
UPDATE zoneGeo SET `name` = NEW.`name`
WHERE id = NEW.geoFk;
END IF;
-END$$
-DELIMITER ;
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/triggers/province_beforeInsert.sql b/db/routines/vn/triggers/province_beforeInsert.sql
index f3f039fc3..eff8f397a 100644
--- a/db/routines/vn/triggers/province_beforeInsert.sql
+++ b/db/routines/vn/triggers/province_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`province_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`province_beforeInsert`
BEFORE INSERT ON `province`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/province_beforeUpdate.sql b/db/routines/vn/triggers/province_beforeUpdate.sql
index 23ca49d4a..ef553b2bc 100644
--- a/db/routines/vn/triggers/province_beforeUpdate.sql
+++ b/db/routines/vn/triggers/province_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`province_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`province_beforeUpdate`
BEFORE UPDATE ON `province`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/rate_afterDelete.sql b/db/routines/vn/triggers/rate_afterDelete.sql
index dae240c15..69787cd81 100644
--- a/db/routines/vn/triggers/rate_afterDelete.sql
+++ b/db/routines/vn/triggers/rate_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`rate_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`rate_afterDelete`
AFTER DELETE ON `rate`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/rate_beforeInsert.sql b/db/routines/vn/triggers/rate_beforeInsert.sql
index 0d77a95d7..c2117e64c 100644
--- a/db/routines/vn/triggers/rate_beforeInsert.sql
+++ b/db/routines/vn/triggers/rate_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`rate_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`rate_beforeInsert`
BEFORE INSERT ON `rate`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/rate_beforeUpdate.sql b/db/routines/vn/triggers/rate_beforeUpdate.sql
index 2055d14fd..af63e431e 100644
--- a/db/routines/vn/triggers/rate_beforeUpdate.sql
+++ b/db/routines/vn/triggers/rate_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`rate_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`rate_beforeUpdate`
BEFORE UPDATE ON `rate`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/receipt_afterInsert.sql b/db/routines/vn/triggers/receipt_afterInsert.sql
index 3881cb4d2..92e458743 100644
--- a/db/routines/vn/triggers/receipt_afterInsert.sql
+++ b/db/routines/vn/triggers/receipt_afterInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`receipt_afterInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`receipt_afterInsert`
AFTER INSERT ON `receipt`
FOR EACH ROW
CALL clientRisk_update(NEW.clientFk, NEW.companyFk, -NEW.amountPaid)$$
diff --git a/db/routines/vn/triggers/receipt_afterUpdate.sql b/db/routines/vn/triggers/receipt_afterUpdate.sql
index 3d739e8f1..c17783790 100644
--- a/db/routines/vn/triggers/receipt_afterUpdate.sql
+++ b/db/routines/vn/triggers/receipt_afterUpdate.sql
@@ -1,7 +1,7 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`receipt_afterUpdate`
- AFTER UPDATE ON `receipt`
- FOR EACH ROW
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`receipt_afterUpdate`
+ AFTER UPDATE ON `receipt`
+ FOR EACH ROW
BEGIN
IF NEW.isConciliate = FALSE AND NEW.payed > OLD.payed THEN
CALL mail_insert(
@@ -11,5 +11,5 @@ BEGIN
CONCAT('Se ha cambiado el recibo: ', NEW.Id, ' de ', OLD.payed, ' a ', NEW.payed)
);
END IF;
-END$$
-DELIMITER ;
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/triggers/receipt_beforeDelete.sql b/db/routines/vn/triggers/receipt_beforeDelete.sql
index fc75a4c35..1c1f0a0b1 100644
--- a/db/routines/vn/triggers/receipt_beforeDelete.sql
+++ b/db/routines/vn/triggers/receipt_beforeDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`receipt_beforeDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`receipt_beforeDelete`
BEFORE DELETE ON `receipt`
FOR EACH ROW
CALL clientRisk_update(OLD.clientFk, OLD.companyFk, OLD.amountPaid)$$
diff --git a/db/routines/vn/triggers/receipt_beforeInsert.sql b/db/routines/vn/triggers/receipt_beforeInsert.sql
index 696cad241..85bc2c4a2 100644
--- a/db/routines/vn/triggers/receipt_beforeInsert.sql
+++ b/db/routines/vn/triggers/receipt_beforeInsert.sql
@@ -1,7 +1,7 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`receipt_beforeInsert`
- BEFORE INSERT ON `receipt`
- FOR EACH ROW
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`receipt_beforeInsert`
+ BEFORE INSERT ON `receipt`
+ FOR EACH ROW
BEGIN
DECLARE vIsAutoConciliated BOOLEAN;
@@ -13,5 +13,5 @@ BEGIN
SET NEW.isConciliate = vIsAutoConciliated;
END IF;
-END$$
-DELIMITER ;
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/triggers/receipt_beforeUpdate.sql b/db/routines/vn/triggers/receipt_beforeUpdate.sql
index 8ea14c17c..3c66719a4 100644
--- a/db/routines/vn/triggers/receipt_beforeUpdate.sql
+++ b/db/routines/vn/triggers/receipt_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`receipt_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`receipt_beforeUpdate`
BEFORE UPDATE ON `receipt`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/recovery_afterDelete.sql b/db/routines/vn/triggers/recovery_afterDelete.sql
index 429f562ac..27679a2a5 100644
--- a/db/routines/vn/triggers/recovery_afterDelete.sql
+++ b/db/routines/vn/triggers/recovery_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`recovery_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`recovery_afterDelete`
AFTER DELETE ON `recovery`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/recovery_beforeInsert.sql b/db/routines/vn/triggers/recovery_beforeInsert.sql
index 2318e0b7b..4671e95cc 100644
--- a/db/routines/vn/triggers/recovery_beforeInsert.sql
+++ b/db/routines/vn/triggers/recovery_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`recovery_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`recovery_beforeInsert`
BEFORE INSERT ON `recovery`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/recovery_beforeUpdate.sql b/db/routines/vn/triggers/recovery_beforeUpdate.sql
index 4d485c075..45710b773 100644
--- a/db/routines/vn/triggers/recovery_beforeUpdate.sql
+++ b/db/routines/vn/triggers/recovery_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`recovery_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`recovery_beforeUpdate`
BEFORE UPDATE ON `recovery`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/roadmapStop_beforeInsert.sql b/db/routines/vn/triggers/roadmapStop_beforeInsert.sql
new file mode 100644
index 000000000..d71942fea
--- /dev/null
+++ b/db/routines/vn/triggers/roadmapStop_beforeInsert.sql
@@ -0,0 +1,10 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`roadmapStop_beforeInsert`
+ BEFORE INSERT ON `roadmapStop`
+ FOR EACH ROW
+BEGIN
+
+ SET NEW.description = UCASE(NEW.description);
+
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/triggers/roadmapStop_beforeUpdate.sql b/db/routines/vn/triggers/roadmapStop_beforeUpdate.sql
new file mode 100644
index 000000000..c3cbf2597
--- /dev/null
+++ b/db/routines/vn/triggers/roadmapStop_beforeUpdate.sql
@@ -0,0 +1,10 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`roadmapStop_beforeUpdate`
+ BEFORE UPDATE ON `roadmapStop`
+ FOR EACH ROW
+BEGIN
+
+ SET NEW.description = UCASE(NEW.description);
+
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/triggers/roadmap_beforeInsert.sql b/db/routines/vn/triggers/roadmap_beforeInsert.sql
index df07d5540..2f9481140 100644
--- a/db/routines/vn/triggers/roadmap_beforeInsert.sql
+++ b/db/routines/vn/triggers/roadmap_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`roadmap_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`roadmap_beforeInsert`
BEFORE INSERT ON `roadmap`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/roadmap_beforeUpdate.sql b/db/routines/vn/triggers/roadmap_beforeUpdate.sql
index 4905a0442..a2a02e96a 100644
--- a/db/routines/vn/triggers/roadmap_beforeUpdate.sql
+++ b/db/routines/vn/triggers/roadmap_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`roadmap_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`roadmap_beforeUpdate`
BEFORE UPDATE ON `roadmap`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/route_afterDelete.sql b/db/routines/vn/triggers/route_afterDelete.sql
index e929bd519..2bd1e3ab6 100644
--- a/db/routines/vn/triggers/route_afterDelete.sql
+++ b/db/routines/vn/triggers/route_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`route_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`route_afterDelete`
AFTER DELETE ON `route`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/route_afterInsert.sql b/db/routines/vn/triggers/route_afterInsert.sql
index f030f09fa..50e14426c 100644
--- a/db/routines/vn/triggers/route_afterInsert.sql
+++ b/db/routines/vn/triggers/route_afterInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`route_afterInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`route_afterInsert`
AFTER INSERT ON `route`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/route_afterUpdate.sql b/db/routines/vn/triggers/route_afterUpdate.sql
index 14b53c2a5..ec205090e 100644
--- a/db/routines/vn/triggers/route_afterUpdate.sql
+++ b/db/routines/vn/triggers/route_afterUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`route_afterUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`route_afterUpdate`
AFTER UPDATE ON `route`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/route_beforeInsert.sql b/db/routines/vn/triggers/route_beforeInsert.sql
index 442b0620e..788efe662 100644
--- a/db/routines/vn/triggers/route_beforeInsert.sql
+++ b/db/routines/vn/triggers/route_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`route_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`route_beforeInsert`
BEFORE INSERT ON `route`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/route_beforeUpdate.sql b/db/routines/vn/triggers/route_beforeUpdate.sql
index 43ee802f5..0ea403de3 100644
--- a/db/routines/vn/triggers/route_beforeUpdate.sql
+++ b/db/routines/vn/triggers/route_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`route_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`route_beforeUpdate`
BEFORE UPDATE ON `route`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/routesMonitor_afterDelete.sql b/db/routines/vn/triggers/routesMonitor_afterDelete.sql
index 000425dad..aad3ad0ec 100644
--- a/db/routines/vn/triggers/routesMonitor_afterDelete.sql
+++ b/db/routines/vn/triggers/routesMonitor_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`routesMonitor_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`routesMonitor_afterDelete`
AFTER DELETE ON `routesMonitor`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/routesMonitor_beforeInsert.sql b/db/routines/vn/triggers/routesMonitor_beforeInsert.sql
index 70b723d54..731a73b0c 100644
--- a/db/routines/vn/triggers/routesMonitor_beforeInsert.sql
+++ b/db/routines/vn/triggers/routesMonitor_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`routesMonitor_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`routesMonitor_beforeInsert`
BEFORE INSERT ON `routesMonitor`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/routesMonitor_beforeUpdate.sql b/db/routines/vn/triggers/routesMonitor_beforeUpdate.sql
index 0ca867b7a..31b47f52e 100644
--- a/db/routines/vn/triggers/routesMonitor_beforeUpdate.sql
+++ b/db/routines/vn/triggers/routesMonitor_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`routesMonitor_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`routesMonitor_beforeUpdate`
BEFORE UPDATE ON `routesMonitor`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/saleBuy_beforeInsert.sql b/db/routines/vn/triggers/saleBuy_beforeInsert.sql
index 1c36671d5..e00480ad4 100644
--- a/db/routines/vn/triggers/saleBuy_beforeInsert.sql
+++ b/db/routines/vn/triggers/saleBuy_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`saleBuy_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`saleBuy_beforeInsert`
BEFORE INSERT ON `saleBuy`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/saleGroupDetail._beforeInsert.sql b/db/routines/vn/triggers/saleGroupDetail._beforeInsert.sql
new file mode 100644
index 000000000..da975933c
--- /dev/null
+++ b/db/routines/vn/triggers/saleGroupDetail._beforeInsert.sql
@@ -0,0 +1,8 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`saleGroupDetail_beforeInsert`
+ BEFORE INSERT ON `saleGroupDetail`
+ FOR EACH ROW
+BEGIN
+ SET NEW.editorFk = account.myUser_getId();
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/triggers/saleGroupDetail_afterDelete.sql b/db/routines/vn/triggers/saleGroupDetail_afterDelete.sql
new file mode 100644
index 000000000..37c3e9a2b
--- /dev/null
+++ b/db/routines/vn/triggers/saleGroupDetail_afterDelete.sql
@@ -0,0 +1,12 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`saleGroupDetail_afterDelete`
+ AFTER DELETE ON `saleGroupDetail`
+ FOR EACH ROW
+BEGIN
+ INSERT INTO saleGroupLog
+ SET `action` = 'delete',
+ `changedModel` = 'SaleGroupDetail',
+ `changedModelId` = OLD.id,
+ `userFk` = account.myUser_getId();
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/triggers/saleGroupDetail_beforeUpdate.sql b/db/routines/vn/triggers/saleGroupDetail_beforeUpdate.sql
new file mode 100644
index 000000000..1f4238cdc
--- /dev/null
+++ b/db/routines/vn/triggers/saleGroupDetail_beforeUpdate.sql
@@ -0,0 +1,8 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`saleGroupDetail_beforeUpdate`
+ BEFORE UPDATE ON `saleGroupDetail`
+ FOR EACH ROW
+BEGIN
+ SET NEW.editorFk = account.myUser_getId();
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/triggers/saleGroup_afterDelete.sql b/db/routines/vn/triggers/saleGroup_afterDelete.sql
index 1e0163187..f74411b37 100644
--- a/db/routines/vn/triggers/saleGroup_afterDelete.sql
+++ b/db/routines/vn/triggers/saleGroup_afterDelete.sql
@@ -1,9 +1,9 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`saleGroup_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`saleGroup_afterDelete`
AFTER DELETE ON `saleGroup`
FOR EACH ROW
BEGIN
- INSERT INTO ticketLog
+ INSERT INTO saleGroupLog
SET `action` = 'delete',
`changedModel` = 'SaleGroup',
`changedModelId` = OLD.id,
diff --git a/db/routines/vn/triggers/saleGroup_beforeInsert.sql b/db/routines/vn/triggers/saleGroup_beforeInsert.sql
index 18be92ed6..b50489a07 100644
--- a/db/routines/vn/triggers/saleGroup_beforeInsert.sql
+++ b/db/routines/vn/triggers/saleGroup_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`saleGroup_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`saleGroup_beforeInsert`
BEFORE INSERT ON `saleGroup`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/saleGroup_beforeUpdate.sql b/db/routines/vn/triggers/saleGroup_beforeUpdate.sql
index 1f6aa6def..a3358b22c 100644
--- a/db/routines/vn/triggers/saleGroup_beforeUpdate.sql
+++ b/db/routines/vn/triggers/saleGroup_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`saleGroup_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`saleGroup_beforeUpdate`
BEFORE UPDATE ON `saleGroup`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/saleLabel_afterUpdate.sql b/db/routines/vn/triggers/saleLabel_afterUpdate.sql
index ff3787358..38fab771a 100644
--- a/db/routines/vn/triggers/saleLabel_afterUpdate.sql
+++ b/db/routines/vn/triggers/saleLabel_afterUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`saleLabel_afterUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`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
diff --git a/db/routines/vn/triggers/saleTracking_afterInsert.sql b/db/routines/vn/triggers/saleTracking_afterInsert.sql
index 00bef8486..e3dce8747 100644
--- a/db/routines/vn/triggers/saleTracking_afterInsert.sql
+++ b/db/routines/vn/triggers/saleTracking_afterInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`saleTracking_afterInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`saleTracking_afterInsert`
AFTER INSERT ON `saleTracking`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/sale_afterDelete.sql b/db/routines/vn/triggers/sale_afterDelete.sql
index 6365208b2..2751d88c2 100644
--- a/db/routines/vn/triggers/sale_afterDelete.sql
+++ b/db/routines/vn/triggers/sale_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`sale_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`sale_afterDelete`
AFTER DELETE ON `sale`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/sale_afterInsert.sql b/db/routines/vn/triggers/sale_afterInsert.sql
index b5b28257f..f15b17722 100644
--- a/db/routines/vn/triggers/sale_afterInsert.sql
+++ b/db/routines/vn/triggers/sale_afterInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`sale_afterInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`sale_afterInsert`
AFTER INSERT ON `sale`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/sale_afterUpdate.sql b/db/routines/vn/triggers/sale_afterUpdate.sql
index 3f59c9188..82da55486 100644
--- a/db/routines/vn/triggers/sale_afterUpdate.sql
+++ b/db/routines/vn/triggers/sale_afterUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`sale_afterUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`sale_afterUpdate`
AFTER UPDATE ON `sale`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/sale_beforeDelete.sql b/db/routines/vn/triggers/sale_beforeDelete.sql
index a91e7f010..ad97f8b55 100644
--- a/db/routines/vn/triggers/sale_beforeDelete.sql
+++ b/db/routines/vn/triggers/sale_beforeDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`sale_beforeDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`sale_beforeDelete`
BEFORE DELETE ON `sale`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/sale_beforeInsert.sql b/db/routines/vn/triggers/sale_beforeInsert.sql
index 0ef368513..31d5882fc 100644
--- a/db/routines/vn/triggers/sale_beforeInsert.sql
+++ b/db/routines/vn/triggers/sale_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`sale_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`sale_beforeInsert`
BEFORE INSERT ON `sale`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/sale_beforeUpdate.sql b/db/routines/vn/triggers/sale_beforeUpdate.sql
index c5a748503..fa45dad5c 100644
--- a/db/routines/vn/triggers/sale_beforeUpdate.sql
+++ b/db/routines/vn/triggers/sale_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`sale_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`sale_beforeUpdate`
BEFORE UPDATE ON `sale`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/sharingCart_beforeDelete.sql b/db/routines/vn/triggers/sharingCart_beforeDelete.sql
index 6996b3138..aa3c0c2bf 100644
--- a/db/routines/vn/triggers/sharingCart_beforeDelete.sql
+++ b/db/routines/vn/triggers/sharingCart_beforeDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`sharingCart_beforeDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`sharingCart_beforeDelete`
BEFORE DELETE ON `sharingCart`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/sharingCart_beforeInsert.sql b/db/routines/vn/triggers/sharingCart_beforeInsert.sql
index 116337b62..0dd59a91a 100644
--- a/db/routines/vn/triggers/sharingCart_beforeInsert.sql
+++ b/db/routines/vn/triggers/sharingCart_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`sharingCart_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`sharingCart_beforeInsert`
BEFORE INSERT ON `sharingCart`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/sharingCart_beforeUpdate.sql b/db/routines/vn/triggers/sharingCart_beforeUpdate.sql
index 91cbfb3d0..e1dd26938 100644
--- a/db/routines/vn/triggers/sharingCart_beforeUpdate.sql
+++ b/db/routines/vn/triggers/sharingCart_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`sharingCart_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`sharingCart_beforeUpdate`
BEFORE UPDATE ON `sharingCart`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/sharingClient_beforeInsert.sql b/db/routines/vn/triggers/sharingClient_beforeInsert.sql
index eea65e74c..03a0e0ce0 100644
--- a/db/routines/vn/triggers/sharingClient_beforeInsert.sql
+++ b/db/routines/vn/triggers/sharingClient_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`sharingClient_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`sharingClient_beforeInsert`
BEFORE INSERT ON `sharingClient`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/sharingClient_beforeUpdate.sql b/db/routines/vn/triggers/sharingClient_beforeUpdate.sql
index fceab691c..d3358586b 100644
--- a/db/routines/vn/triggers/sharingClient_beforeUpdate.sql
+++ b/db/routines/vn/triggers/sharingClient_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`sharingClient_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`sharingClient_beforeUpdate`
BEFORE UPDATE ON `sharingClient`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/shelving_afterDelete.sql b/db/routines/vn/triggers/shelving_afterDelete.sql
index 964a866e7..aa3c3bcea 100644
--- a/db/routines/vn/triggers/shelving_afterDelete.sql
+++ b/db/routines/vn/triggers/shelving_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`shelving_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`shelving_afterDelete`
AFTER DELETE ON `shelving`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/shelving_beforeInsert.sql b/db/routines/vn/triggers/shelving_beforeInsert.sql
index ef3c7030c..21528ef78 100644
--- a/db/routines/vn/triggers/shelving_beforeInsert.sql
+++ b/db/routines/vn/triggers/shelving_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`shelving_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`shelving_beforeInsert`
BEFORE INSERT ON `shelving`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/shelving_beforeUpdate.sql b/db/routines/vn/triggers/shelving_beforeUpdate.sql
index 89e7cb7e9..23210c4be 100644
--- a/db/routines/vn/triggers/shelving_beforeUpdate.sql
+++ b/db/routines/vn/triggers/shelving_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`shelving_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`shelving_beforeUpdate`
BEFORE UPDATE ON `shelving`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/solunionCAP_afterInsert.sql b/db/routines/vn/triggers/solunionCAP_afterInsert.sql
index 0d6e510ad..d09cadd95 100644
--- a/db/routines/vn/triggers/solunionCAP_afterInsert.sql
+++ b/db/routines/vn/triggers/solunionCAP_afterInsert.sql
@@ -1,11 +1,11 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`solunionCAP_afterInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`solunionCAP_afterInsert`
AFTER INSERT ON `solunionCAP`
FOR EACH ROW
BEGIN
UPDATE client c
JOIN creditClassification cc ON cc.client = c.id
- JOIN creditInsurance ci ON ci.creditClassification = cc.id
+ JOIN creditInsurance ci ON ci.creditClassificationFk = cc.id
SET creditInsurance = ci.credit * 2 WHERE ci.id = NEW.creditInsurance;
END$$
DELIMITER ;
diff --git a/db/routines/vn/triggers/solunionCAP_afterUpdate.sql b/db/routines/vn/triggers/solunionCAP_afterUpdate.sql
index 40ff57f35..1199067bb 100644
--- a/db/routines/vn/triggers/solunionCAP_afterUpdate.sql
+++ b/db/routines/vn/triggers/solunionCAP_afterUpdate.sql
@@ -1,17 +1,17 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`solunionCAP_afterUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`solunionCAP_afterUpdate`
AFTER UPDATE ON `solunionCAP`
FOR EACH ROW
BEGIN
IF NEW.dateLeaving IS NOT NULL THEN
UPDATE client c
JOIN creditClassification cc ON cc.client = c.id
- JOIN creditInsurance ci ON ci.creditClassification = cc.id
+ JOIN creditInsurance ci ON ci.creditClassificationFk = cc.id
SET creditInsurance = ci.credit WHERE ci.id = OLD.creditInsurance;
ELSE
UPDATE client c
JOIN creditClassification cc ON cc.client = c.id
- JOIN creditInsurance ci ON ci.creditClassification = cc.id
+ JOIN creditInsurance ci ON ci.creditClassificationFk = cc.id
SET creditInsurance = ci.credit * 2 WHERE ci.id = OLD.creditInsurance;
END IF;
END$$
diff --git a/db/routines/vn/triggers/solunionCAP_beforeDelete.sql b/db/routines/vn/triggers/solunionCAP_beforeDelete.sql
index 29c4298fd..7913a0d78 100644
--- a/db/routines/vn/triggers/solunionCAP_beforeDelete.sql
+++ b/db/routines/vn/triggers/solunionCAP_beforeDelete.sql
@@ -1,11 +1,11 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`solunionCAP_beforeDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`solunionCAP_beforeDelete`
BEFORE DELETE ON `solunionCAP`
FOR EACH ROW
BEGIN
UPDATE client c
JOIN creditClassification cc ON cc.client = c.id
- JOIN creditInsurance ci ON ci.creditClassification = cc.id
+ JOIN creditInsurance ci ON ci.creditClassificationFk = cc.id
SET creditInsurance = ci.credit WHERE ci.id = OLD.creditInsurance;
END$$
DELIMITER ;
diff --git a/db/routines/vn/triggers/specie_beforeInsert.sql b/db/routines/vn/triggers/specie_beforeInsert.sql
index 68abf0d30..8a9f299fd 100644
--- a/db/routines/vn/triggers/specie_beforeInsert.sql
+++ b/db/routines/vn/triggers/specie_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`specie_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`specie_beforeInsert`
BEFORE INSERT ON `specie`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/specie_beforeUpdate.sql b/db/routines/vn/triggers/specie_beforeUpdate.sql
index 364b1d52f..d859e2cdc 100644
--- a/db/routines/vn/triggers/specie_beforeUpdate.sql
+++ b/db/routines/vn/triggers/specie_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`specie_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`specie_beforeUpdate`
BEFORE UPDATE ON `specie`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/supplierAccount_afterDelete.sql b/db/routines/vn/triggers/supplierAccount_afterDelete.sql
index 23c2cd4a4..81e936140 100644
--- a/db/routines/vn/triggers/supplierAccount_afterDelete.sql
+++ b/db/routines/vn/triggers/supplierAccount_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`supplierAccount_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`supplierAccount_afterDelete`
AFTER DELETE ON `supplierAccount`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/supplierAccount_beforeInsert.sql b/db/routines/vn/triggers/supplierAccount_beforeInsert.sql
index 512f172e1..231479ad6 100644
--- a/db/routines/vn/triggers/supplierAccount_beforeInsert.sql
+++ b/db/routines/vn/triggers/supplierAccount_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`supplierAccount_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`supplierAccount_beforeInsert`
BEFORE INSERT ON `supplierAccount`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/supplierAccount_beforeUpdate.sql b/db/routines/vn/triggers/supplierAccount_beforeUpdate.sql
index 0fac19deb..2937227a4 100644
--- a/db/routines/vn/triggers/supplierAccount_beforeUpdate.sql
+++ b/db/routines/vn/triggers/supplierAccount_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`supplierAccount_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`supplierAccount_beforeUpdate`
BEFORE UPDATE ON `supplierAccount`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/supplierAddress_afterDelete.sql b/db/routines/vn/triggers/supplierAddress_afterDelete.sql
index 69dd94dfe..0840d6fe9 100644
--- a/db/routines/vn/triggers/supplierAddress_afterDelete.sql
+++ b/db/routines/vn/triggers/supplierAddress_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`supplierAddress_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`supplierAddress_afterDelete`
AFTER DELETE ON `supplierAddress`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/supplierAddress_beforeInsert.sql b/db/routines/vn/triggers/supplierAddress_beforeInsert.sql
index db8d0ea94..d66b9d3d2 100644
--- a/db/routines/vn/triggers/supplierAddress_beforeInsert.sql
+++ b/db/routines/vn/triggers/supplierAddress_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`supplierAddress_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`supplierAddress_beforeInsert`
BEFORE INSERT ON `supplierAddress`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/supplierAddress_beforeUpdate.sql b/db/routines/vn/triggers/supplierAddress_beforeUpdate.sql
index 8e484e4de..94d70834e 100644
--- a/db/routines/vn/triggers/supplierAddress_beforeUpdate.sql
+++ b/db/routines/vn/triggers/supplierAddress_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`supplierAddress_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`supplierAddress_beforeUpdate`
BEFORE UPDATE ON `supplierAddress`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/supplierContact_afterDelete.sql b/db/routines/vn/triggers/supplierContact_afterDelete.sql
index 401ec9e9e..18797e383 100644
--- a/db/routines/vn/triggers/supplierContact_afterDelete.sql
+++ b/db/routines/vn/triggers/supplierContact_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`supplierContact_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`supplierContact_afterDelete`
AFTER DELETE ON `supplierContact`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/supplierContact_beforeInsert.sql b/db/routines/vn/triggers/supplierContact_beforeInsert.sql
index 76e78ba5a..444f9e9c8 100644
--- a/db/routines/vn/triggers/supplierContact_beforeInsert.sql
+++ b/db/routines/vn/triggers/supplierContact_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`supplierContact_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`supplierContact_beforeInsert`
BEFORE INSERT ON `supplierContact`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/supplierContact_beforeUpdate.sql b/db/routines/vn/triggers/supplierContact_beforeUpdate.sql
index 24723656a..194218a91 100644
--- a/db/routines/vn/triggers/supplierContact_beforeUpdate.sql
+++ b/db/routines/vn/triggers/supplierContact_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`supplierContact_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`supplierContact_beforeUpdate`
BEFORE UPDATE ON `supplierContact`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/supplierDms_afterDelete.sql b/db/routines/vn/triggers/supplierDms_afterDelete.sql
index 482decbb6..0dbf8e86b 100644
--- a/db/routines/vn/triggers/supplierDms_afterDelete.sql
+++ b/db/routines/vn/triggers/supplierDms_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`supplierDms_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`supplierDms_afterDelete`
AFTER DELETE ON `supplierDms`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/supplierDms_beforeInsert.sql b/db/routines/vn/triggers/supplierDms_beforeInsert.sql
index 130428d1e..2098d6a34 100644
--- a/db/routines/vn/triggers/supplierDms_beforeInsert.sql
+++ b/db/routines/vn/triggers/supplierDms_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`supplierDms_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`supplierDms_beforeInsert`
BEFORE INSERT ON `supplierDms`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/supplierDms_beforeUpdate.sql b/db/routines/vn/triggers/supplierDms_beforeUpdate.sql
index 54dcef049..6e38018e5 100644
--- a/db/routines/vn/triggers/supplierDms_beforeUpdate.sql
+++ b/db/routines/vn/triggers/supplierDms_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`supplierDms_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`supplierDms_beforeUpdate`
BEFORE UPDATE ON `supplierDms`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/supplier_afterDelete.sql b/db/routines/vn/triggers/supplier_afterDelete.sql
index d4b8e0d21..d70830423 100644
--- a/db/routines/vn/triggers/supplier_afterDelete.sql
+++ b/db/routines/vn/triggers/supplier_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`supplier_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`supplier_afterDelete`
AFTER DELETE ON `supplier`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/supplier_afterUpdate.sql b/db/routines/vn/triggers/supplier_afterUpdate.sql
index e89df037f..07f31b5e0 100644
--- a/db/routines/vn/triggers/supplier_afterUpdate.sql
+++ b/db/routines/vn/triggers/supplier_afterUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`supplier_afterUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`supplier_afterUpdate`
BEFORE UPDATE ON `supplier`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/supplier_beforeInsert.sql b/db/routines/vn/triggers/supplier_beforeInsert.sql
index aef8d02ab..b141ec8fb 100644
--- a/db/routines/vn/triggers/supplier_beforeInsert.sql
+++ b/db/routines/vn/triggers/supplier_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`supplier_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`supplier_beforeInsert`
BEFORE INSERT ON `supplier`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/supplier_beforeUpdate.sql b/db/routines/vn/triggers/supplier_beforeUpdate.sql
index f462d6f57..af730b49d 100644
--- a/db/routines/vn/triggers/supplier_beforeUpdate.sql
+++ b/db/routines/vn/triggers/supplier_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`supplier_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`supplier_beforeUpdate`
BEFORE UPDATE ON `supplier`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/tag_beforeInsert.sql b/db/routines/vn/triggers/tag_beforeInsert.sql
index 27057754d..e24dec000 100644
--- a/db/routines/vn/triggers/tag_beforeInsert.sql
+++ b/db/routines/vn/triggers/tag_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`tag_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`tag_beforeInsert`
BEFORE INSERT ON `tag`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/ticketCollection_afterDelete.sql b/db/routines/vn/triggers/ticketCollection_afterDelete.sql
index e0917452a..0b688022f 100644
--- a/db/routines/vn/triggers/ticketCollection_afterDelete.sql
+++ b/db/routines/vn/triggers/ticketCollection_afterDelete.sql
@@ -1,7 +1,7 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketCollection_afterDelete`
- AFTER DELETE ON `ticketCollection`
- FOR EACH ROW
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticketCollection_afterDelete`
+ AFTER DELETE ON `ticketCollection`
+ FOR EACH ROW
BEGIN
DECLARE vSalesRemaining INT;
@@ -24,5 +24,5 @@ BEGIN
END IF;
-END$$
-DELIMITER ;
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/triggers/ticketDms_afterDelete.sql b/db/routines/vn/triggers/ticketDms_afterDelete.sql
index 834079520..40c10a494 100644
--- a/db/routines/vn/triggers/ticketDms_afterDelete.sql
+++ b/db/routines/vn/triggers/ticketDms_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketDms_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticketDms_afterDelete`
AFTER DELETE ON `ticketDms`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/ticketDms_beforeDelete.sql b/db/routines/vn/triggers/ticketDms_beforeDelete.sql
index 9c251fba1..93c335be9 100644
--- a/db/routines/vn/triggers/ticketDms_beforeDelete.sql
+++ b/db/routines/vn/triggers/ticketDms_beforeDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketDms_beforeDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticketDms_beforeDelete`
BEFORE DELETE ON `ticketDms`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/ticketDms_beforeInsert.sql b/db/routines/vn/triggers/ticketDms_beforeInsert.sql
index 0c00dba28..9b35c6e71 100644
--- a/db/routines/vn/triggers/ticketDms_beforeInsert.sql
+++ b/db/routines/vn/triggers/ticketDms_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketDms_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticketDms_beforeInsert`
BEFORE INSERT ON `ticketDms`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/ticketDms_beforeUpdate.sql b/db/routines/vn/triggers/ticketDms_beforeUpdate.sql
index aab22dd99..6f3d1522a 100644
--- a/db/routines/vn/triggers/ticketDms_beforeUpdate.sql
+++ b/db/routines/vn/triggers/ticketDms_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketDms_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticketDms_beforeUpdate`
BEFORE UPDATE ON `ticketDms`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/ticketObservation_afterDelete.sql b/db/routines/vn/triggers/ticketObservation_afterDelete.sql
index f8d88add6..160d3cbdd 100644
--- a/db/routines/vn/triggers/ticketObservation_afterDelete.sql
+++ b/db/routines/vn/triggers/ticketObservation_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketObservation_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticketObservation_afterDelete`
AFTER DELETE ON `ticketObservation`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/ticketObservation_beforeInsert.sql b/db/routines/vn/triggers/ticketObservation_beforeInsert.sql
index ce141d56a..9915b541b 100644
--- a/db/routines/vn/triggers/ticketObservation_beforeInsert.sql
+++ b/db/routines/vn/triggers/ticketObservation_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketObservation_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticketObservation_beforeInsert`
BEFORE INSERT ON `ticketObservation`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/ticketObservation_beforeUpdate.sql b/db/routines/vn/triggers/ticketObservation_beforeUpdate.sql
index 466e17e85..a94a4160b 100644
--- a/db/routines/vn/triggers/ticketObservation_beforeUpdate.sql
+++ b/db/routines/vn/triggers/ticketObservation_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketObservation_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticketObservation_beforeUpdate`
BEFORE UPDATE ON `ticketObservation`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/ticketPackaging_afterDelete.sql b/db/routines/vn/triggers/ticketPackaging_afterDelete.sql
index 320f7e01e..dfdc2ffe1 100644
--- a/db/routines/vn/triggers/ticketPackaging_afterDelete.sql
+++ b/db/routines/vn/triggers/ticketPackaging_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketPackaging_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticketPackaging_afterDelete`
AFTER DELETE ON `ticketPackaging`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/ticketPackaging_beforeInsert.sql b/db/routines/vn/triggers/ticketPackaging_beforeInsert.sql
index f47a7ae35..17bf41daa 100644
--- a/db/routines/vn/triggers/ticketPackaging_beforeInsert.sql
+++ b/db/routines/vn/triggers/ticketPackaging_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketPackaging_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticketPackaging_beforeInsert`
BEFORE INSERT ON `ticketPackaging`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/ticketPackaging_beforeUpdate.sql b/db/routines/vn/triggers/ticketPackaging_beforeUpdate.sql
index 5d15249c4..9ce7ca3db 100644
--- a/db/routines/vn/triggers/ticketPackaging_beforeUpdate.sql
+++ b/db/routines/vn/triggers/ticketPackaging_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketPackaging_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticketPackaging_beforeUpdate`
BEFORE UPDATE ON `ticketPackaging`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/ticketParking_beforeInsert.sql b/db/routines/vn/triggers/ticketParking_beforeInsert.sql
index 2add4f3ea..77c2aeab7 100644
--- a/db/routines/vn/triggers/ticketParking_beforeInsert.sql
+++ b/db/routines/vn/triggers/ticketParking_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketParking_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticketParking_beforeInsert`
BEFORE INSERT ON `ticketParking`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/ticketRefund_afterDelete.sql b/db/routines/vn/triggers/ticketRefund_afterDelete.sql
index 167030d4a..677e25905 100644
--- a/db/routines/vn/triggers/ticketRefund_afterDelete.sql
+++ b/db/routines/vn/triggers/ticketRefund_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketRefund_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticketRefund_afterDelete`
AFTER DELETE ON `ticketRefund`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/ticketRefund_beforeInsert.sql b/db/routines/vn/triggers/ticketRefund_beforeInsert.sql
index 7f3facb55..dd1da6650 100644
--- a/db/routines/vn/triggers/ticketRefund_beforeInsert.sql
+++ b/db/routines/vn/triggers/ticketRefund_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketRefund_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticketRefund_beforeInsert`
BEFORE INSERT ON `ticketRefund`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/ticketRefund_beforeUpdate.sql b/db/routines/vn/triggers/ticketRefund_beforeUpdate.sql
index 7ec093c36..f27e3f092 100644
--- a/db/routines/vn/triggers/ticketRefund_beforeUpdate.sql
+++ b/db/routines/vn/triggers/ticketRefund_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketRefund_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticketRefund_beforeUpdate`
BEFORE UPDATE ON `ticketRefund`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/ticketRequest_afterDelete.sql b/db/routines/vn/triggers/ticketRequest_afterDelete.sql
index a8932a744..051db6b2e 100644
--- a/db/routines/vn/triggers/ticketRequest_afterDelete.sql
+++ b/db/routines/vn/triggers/ticketRequest_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketRequest_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticketRequest_afterDelete`
AFTER DELETE ON `ticketRequest`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/ticketRequest_beforeInsert.sql b/db/routines/vn/triggers/ticketRequest_beforeInsert.sql
index 00e659abc..fcad2f593 100644
--- a/db/routines/vn/triggers/ticketRequest_beforeInsert.sql
+++ b/db/routines/vn/triggers/ticketRequest_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketRequest_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticketRequest_beforeInsert`
BEFORE INSERT ON `ticketRequest`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/ticketRequest_beforeUpdate.sql b/db/routines/vn/triggers/ticketRequest_beforeUpdate.sql
index 954df8ed3..a30b9464f 100644
--- a/db/routines/vn/triggers/ticketRequest_beforeUpdate.sql
+++ b/db/routines/vn/triggers/ticketRequest_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketRequest_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticketRequest_beforeUpdate`
BEFORE UPDATE ON `ticketRequest`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/ticketService_afterDelete.sql b/db/routines/vn/triggers/ticketService_afterDelete.sql
index ca2675ce8..9b1f6e812 100644
--- a/db/routines/vn/triggers/ticketService_afterDelete.sql
+++ b/db/routines/vn/triggers/ticketService_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketService_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticketService_afterDelete`
AFTER DELETE ON `ticketService`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/ticketService_beforeInsert.sql b/db/routines/vn/triggers/ticketService_beforeInsert.sql
index 81b7e5e91..b886d764e 100644
--- a/db/routines/vn/triggers/ticketService_beforeInsert.sql
+++ b/db/routines/vn/triggers/ticketService_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketService_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticketService_beforeInsert`
BEFORE INSERT ON `ticketService`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/ticketService_beforeUpdate.sql b/db/routines/vn/triggers/ticketService_beforeUpdate.sql
index a24af8269..8b706d312 100644
--- a/db/routines/vn/triggers/ticketService_beforeUpdate.sql
+++ b/db/routines/vn/triggers/ticketService_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketService_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticketService_beforeUpdate`
BEFORE UPDATE ON `ticketService`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/ticketTracking_afterDelete.sql b/db/routines/vn/triggers/ticketTracking_afterDelete.sql
index 2683e8d3c..aee31fe5f 100644
--- a/db/routines/vn/triggers/ticketTracking_afterDelete.sql
+++ b/db/routines/vn/triggers/ticketTracking_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketTracking_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticketTracking_afterDelete`
AFTER DELETE ON `ticketTracking`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/ticketTracking_afterInsert.sql b/db/routines/vn/triggers/ticketTracking_afterInsert.sql
index b246cd44f..c2dca56ef 100644
--- a/db/routines/vn/triggers/ticketTracking_afterInsert.sql
+++ b/db/routines/vn/triggers/ticketTracking_afterInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketTracking_afterInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticketTracking_afterInsert`
AFTER INSERT ON `ticketTracking`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/ticketTracking_afterUpdate.sql b/db/routines/vn/triggers/ticketTracking_afterUpdate.sql
index ce5586569..fab8b3d34 100644
--- a/db/routines/vn/triggers/ticketTracking_afterUpdate.sql
+++ b/db/routines/vn/triggers/ticketTracking_afterUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketTracking_afterUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticketTracking_afterUpdate`
AFTER UPDATE ON `ticketTracking`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/ticketTracking_beforeInsert.sql b/db/routines/vn/triggers/ticketTracking_beforeInsert.sql
index 685713aea..8c0b557ba 100644
--- a/db/routines/vn/triggers/ticketTracking_beforeInsert.sql
+++ b/db/routines/vn/triggers/ticketTracking_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketTracking_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticketTracking_beforeInsert`
BEFORE INSERT ON `ticketTracking`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/ticketTracking_beforeUpdate.sql b/db/routines/vn/triggers/ticketTracking_beforeUpdate.sql
index ec875387e..3605ca360 100644
--- a/db/routines/vn/triggers/ticketTracking_beforeUpdate.sql
+++ b/db/routines/vn/triggers/ticketTracking_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketTracking_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticketTracking_beforeUpdate`
BEFORE UPDATE ON `ticketTracking`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/ticketWeekly_afterDelete.sql b/db/routines/vn/triggers/ticketWeekly_afterDelete.sql
index d0ef0b8df..066ab2d08 100644
--- a/db/routines/vn/triggers/ticketWeekly_afterDelete.sql
+++ b/db/routines/vn/triggers/ticketWeekly_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketWeekly_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticketWeekly_afterDelete`
AFTER DELETE ON `ticketWeekly`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/ticketWeekly_beforeInsert.sql b/db/routines/vn/triggers/ticketWeekly_beforeInsert.sql
index e4a61d203..a9f2780e4 100644
--- a/db/routines/vn/triggers/ticketWeekly_beforeInsert.sql
+++ b/db/routines/vn/triggers/ticketWeekly_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketWeekly_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticketWeekly_beforeInsert`
BEFORE INSERT ON `ticketWeekly`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/ticketWeekly_beforeUpdate.sql b/db/routines/vn/triggers/ticketWeekly_beforeUpdate.sql
index 1a631bec1..76a633e23 100644
--- a/db/routines/vn/triggers/ticketWeekly_beforeUpdate.sql
+++ b/db/routines/vn/triggers/ticketWeekly_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketWeekly_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticketWeekly_beforeUpdate`
BEFORE UPDATE ON `ticketWeekly`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/ticket_afterDelete.sql b/db/routines/vn/triggers/ticket_afterDelete.sql
index c80f3dbe1..bcde76e0a 100644
--- a/db/routines/vn/triggers/ticket_afterDelete.sql
+++ b/db/routines/vn/triggers/ticket_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticket_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticket_afterDelete`
AFTER DELETE ON `ticket`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/ticket_afterInsert.sql b/db/routines/vn/triggers/ticket_afterInsert.sql
index 0fad0aaee..d3936af0b 100644
--- a/db/routines/vn/triggers/ticket_afterInsert.sql
+++ b/db/routines/vn/triggers/ticket_afterInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticket_afterInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticket_afterInsert`
AFTER INSERT ON `ticket`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/ticket_afterUpdate.sql b/db/routines/vn/triggers/ticket_afterUpdate.sql
index 1c0a8be67..f6c5e6523 100644
--- a/db/routines/vn/triggers/ticket_afterUpdate.sql
+++ b/db/routines/vn/triggers/ticket_afterUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticket_afterUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticket_afterUpdate`
AFTER UPDATE ON `ticket`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/ticket_beforeDelete.sql b/db/routines/vn/triggers/ticket_beforeDelete.sql
index 02c5352e6..953fa509a 100644
--- a/db/routines/vn/triggers/ticket_beforeDelete.sql
+++ b/db/routines/vn/triggers/ticket_beforeDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticket_beforeDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticket_beforeDelete`
BEFORE DELETE ON `ticket`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/ticket_beforeInsert.sql b/db/routines/vn/triggers/ticket_beforeInsert.sql
index 7e0fc57b8..02b60b6b3 100644
--- a/db/routines/vn/triggers/ticket_beforeInsert.sql
+++ b/db/routines/vn/triggers/ticket_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticket_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticket_beforeInsert`
BEFORE INSERT ON `ticket`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/ticket_beforeUpdate.sql b/db/routines/vn/triggers/ticket_beforeUpdate.sql
index 6d5d7f908..3208a93d0 100644
--- a/db/routines/vn/triggers/ticket_beforeUpdate.sql
+++ b/db/routines/vn/triggers/ticket_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticket_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticket_beforeUpdate`
BEFORE UPDATE ON `ticket`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/time_afterUpdate.sql b/db/routines/vn/triggers/time_afterUpdate.sql
index 1eb735923..e7f3551c5 100644
--- a/db/routines/vn/triggers/time_afterUpdate.sql
+++ b/db/routines/vn/triggers/time_afterUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`time_afterUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`time_afterUpdate`
AFTER UPDATE ON `time`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/town_afterDelete.sql b/db/routines/vn/triggers/town_afterDelete.sql
index e6ca82d80..51696b633 100644
--- a/db/routines/vn/triggers/town_afterDelete.sql
+++ b/db/routines/vn/triggers/town_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`town_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`town_afterDelete`
AFTER DELETE ON `town`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/town_afterUpdate.sql b/db/routines/vn/triggers/town_afterUpdate.sql
index 830428061..dd3fddebd 100644
--- a/db/routines/vn/triggers/town_afterUpdate.sql
+++ b/db/routines/vn/triggers/town_afterUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`town_afterUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`town_afterUpdate`
AFTER UPDATE ON `town`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/town_beforeInsert.sql b/db/routines/vn/triggers/town_beforeInsert.sql
index f3a060b2d..4a1ce887e 100644
--- a/db/routines/vn/triggers/town_beforeInsert.sql
+++ b/db/routines/vn/triggers/town_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`town_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`town_beforeInsert`
BEFORE INSERT ON `town`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/town_beforeUpdate.sql b/db/routines/vn/triggers/town_beforeUpdate.sql
index e607b3f41..fc1410d5c 100644
--- a/db/routines/vn/triggers/town_beforeUpdate.sql
+++ b/db/routines/vn/triggers/town_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`town_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`town_beforeUpdate`
BEFORE UPDATE ON `town`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/travelThermograph_afterDelete.sql b/db/routines/vn/triggers/travelThermograph_afterDelete.sql
index 14a875799..1e51426ef 100644
--- a/db/routines/vn/triggers/travelThermograph_afterDelete.sql
+++ b/db/routines/vn/triggers/travelThermograph_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`travelThermograph_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`travelThermograph_afterDelete`
AFTER DELETE ON `travelThermograph`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/travelThermograph_beforeInsert.sql b/db/routines/vn/triggers/travelThermograph_beforeInsert.sql
index 4ebe14e75..256ee12a6 100644
--- a/db/routines/vn/triggers/travelThermograph_beforeInsert.sql
+++ b/db/routines/vn/triggers/travelThermograph_beforeInsert.sql
@@ -1,8 +1,17 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`travelThermograph_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`travelThermograph_beforeInsert`
BEFORE INSERT ON `travelThermograph`
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
+
+ IF NEW.travelFk IS NULL AND
+ (SELECT COUNT(*) FROM travelThermograph
+ WHERE thermographFk = NEW.thermographFk
+ AND travelFk IS NULL
+ AND id <> NEW.id) > 0
+ THEN
+ CALL util.throw('Duplicate thermographFk without travelFk not allowed.');
+ END IF;
END$$
DELIMITER ;
diff --git a/db/routines/vn/triggers/travelThermograph_beforeUpdate.sql b/db/routines/vn/triggers/travelThermograph_beforeUpdate.sql
index 381e655f3..ffe81b38d 100644
--- a/db/routines/vn/triggers/travelThermograph_beforeUpdate.sql
+++ b/db/routines/vn/triggers/travelThermograph_beforeUpdate.sql
@@ -1,8 +1,17 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`travelThermograph_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`travelThermograph_beforeUpdate`
BEFORE UPDATE ON `travelThermograph`
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
+
+ IF NEW.travelFk IS NULL AND
+ (SELECT COUNT(*) FROM travelThermograph
+ WHERE thermographFk = NEW.thermographFk
+ AND travelFk IS NULL
+ AND id <> NEW.id) > 0
+ THEN
+ CALL util.throw('Duplicate thermographFk without travelFk not allowed.');
+ END IF;
END$$
DELIMITER ;
diff --git a/db/routines/vn/triggers/travel_afterDelete.sql b/db/routines/vn/triggers/travel_afterDelete.sql
index a528793e9..35fdfb4fc 100644
--- a/db/routines/vn/triggers/travel_afterDelete.sql
+++ b/db/routines/vn/triggers/travel_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`travel_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`travel_afterDelete`
AFTER DELETE ON `travel`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/travel_afterUpdate.sql b/db/routines/vn/triggers/travel_afterUpdate.sql
index 7cfe865f3..75de5ab4a 100644
--- a/db/routines/vn/triggers/travel_afterUpdate.sql
+++ b/db/routines/vn/triggers/travel_afterUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`travel_afterUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`travel_afterUpdate`
AFTER UPDATE ON `travel`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/travel_beforeInsert.sql b/db/routines/vn/triggers/travel_beforeInsert.sql
index e54a5d08b..4563c9a81 100644
--- a/db/routines/vn/triggers/travel_beforeInsert.sql
+++ b/db/routines/vn/triggers/travel_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`travel_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`travel_beforeInsert`
BEFORE INSERT ON `travel`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/travel_beforeUpdate.sql b/db/routines/vn/triggers/travel_beforeUpdate.sql
index 5e64ad5b3..33578fea1 100644
--- a/db/routines/vn/triggers/travel_beforeUpdate.sql
+++ b/db/routines/vn/triggers/travel_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`travel_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`travel_beforeUpdate`
BEFORE UPDATE ON `travel`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/vehicle_beforeInsert.sql b/db/routines/vn/triggers/vehicle_beforeInsert.sql
index 046e11703..22505ffb0 100644
--- a/db/routines/vn/triggers/vehicle_beforeInsert.sql
+++ b/db/routines/vn/triggers/vehicle_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`vehicle_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`vehicle_beforeInsert`
BEFORE INSERT ON `vehicle`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/vehicle_beforeUpdate.sql b/db/routines/vn/triggers/vehicle_beforeUpdate.sql
index d61005468..b435c90a4 100644
--- a/db/routines/vn/triggers/vehicle_beforeUpdate.sql
+++ b/db/routines/vn/triggers/vehicle_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`vehicle_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`vehicle_beforeUpdate`
BEFORE UPDATE ON `vehicle`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/warehouse_afterInsert.sql b/db/routines/vn/triggers/warehouse_afterInsert.sql
index 97a8c4152..9063d8e15 100644
--- a/db/routines/vn/triggers/warehouse_afterInsert.sql
+++ b/db/routines/vn/triggers/warehouse_afterInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`warehouse_afterInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`warehouse_afterInsert`
BEFORE UPDATE ON `warehouse`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/workerDocument_afterDelete.sql b/db/routines/vn/triggers/workerDms_afterDelete.sql
similarity index 51%
rename from db/routines/vn/triggers/workerDocument_afterDelete.sql
rename to db/routines/vn/triggers/workerDms_afterDelete.sql
index b266d3bf6..bfb7d481e 100644
--- a/db/routines/vn/triggers/workerDocument_afterDelete.sql
+++ b/db/routines/vn/triggers/workerDms_afterDelete.sql
@@ -1,11 +1,11 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`workerDocument_afterDelete`
- AFTER DELETE ON `workerDocument`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerDms_afterDelete`
+ AFTER DELETE ON `workerDms`
FOR EACH ROW
BEGIN
INSERT INTO workerLog
SET `action` = 'delete',
- `changedModel` = 'WorkerDocument',
+ `changedModel` = 'WorkerDms',
`changedModelId` = OLD.id,
`userFk` = account.myUser_getId();
END$$
diff --git a/db/routines/vn/triggers/workerDms_beforeInsert.sql b/db/routines/vn/triggers/workerDms_beforeInsert.sql
new file mode 100644
index 000000000..a52c60961
--- /dev/null
+++ b/db/routines/vn/triggers/workerDms_beforeInsert.sql
@@ -0,0 +1,8 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerDms_beforeInsert`
+ BEFORE INSERT ON `workerDms`
+ FOR EACH ROW
+BEGIN
+ SET NEW.editorFk = account.myUser_getId();
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/triggers/workerDms_beforeUpdate.sql b/db/routines/vn/triggers/workerDms_beforeUpdate.sql
new file mode 100644
index 000000000..564064444
--- /dev/null
+++ b/db/routines/vn/triggers/workerDms_beforeUpdate.sql
@@ -0,0 +1,8 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerDms_beforeUpdate`
+ BEFORE UPDATE ON `workerDms`
+ FOR EACH ROW
+BEGIN
+ SET NEW.editorFk = account.myUser_getId();
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/triggers/workerDocument_beforeInsert.sql b/db/routines/vn/triggers/workerDocument_beforeInsert.sql
deleted file mode 100644
index 2a795ba38..000000000
--- a/db/routines/vn/triggers/workerDocument_beforeInsert.sql
+++ /dev/null
@@ -1,8 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`workerDocument_beforeInsert`
- BEFORE INSERT ON `workerDocument`
- FOR EACH ROW
-BEGIN
- SET NEW.editorFk = account.myUser_getId();
-END$$
-DELIMITER ;
diff --git a/db/routines/vn/triggers/workerDocument_beforeUpdate.sql b/db/routines/vn/triggers/workerDocument_beforeUpdate.sql
deleted file mode 100644
index ffa137b3a..000000000
--- a/db/routines/vn/triggers/workerDocument_beforeUpdate.sql
+++ /dev/null
@@ -1,8 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`workerDocument_beforeUpdate`
- BEFORE UPDATE ON `workerDocument`
- FOR EACH ROW
-BEGIN
- SET NEW.editorFk = account.myUser_getId();
-END$$
-DELIMITER ;
diff --git a/db/routines/vn/triggers/workerIncome_afterDelete.sql b/db/routines/vn/triggers/workerIncome_afterDelete.sql
index e19df59a8..42580061e 100644
--- a/db/routines/vn/triggers/workerIncome_afterDelete.sql
+++ b/db/routines/vn/triggers/workerIncome_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`workerIncome_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerIncome_afterDelete`
AFTER DELETE ON `workerIncome`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/workerIncome_afterInsert.sql b/db/routines/vn/triggers/workerIncome_afterInsert.sql
index 8837f9c07..fcb24e42b 100644
--- a/db/routines/vn/triggers/workerIncome_afterInsert.sql
+++ b/db/routines/vn/triggers/workerIncome_afterInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`workerIncome_afterInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerIncome_afterInsert`
AFTER INSERT ON `workerIncome`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/workerIncome_afterUpdate.sql b/db/routines/vn/triggers/workerIncome_afterUpdate.sql
index a2584df22..f6b27c761 100644
--- a/db/routines/vn/triggers/workerIncome_afterUpdate.sql
+++ b/db/routines/vn/triggers/workerIncome_afterUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`workerIncome_afterUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerIncome_afterUpdate`
AFTER UPDATE ON `workerIncome`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/workerTimeControl_afterDelete.sql b/db/routines/vn/triggers/workerTimeControl_afterDelete.sql
index 19653c913..27432fccb 100644
--- a/db/routines/vn/triggers/workerTimeControl_afterDelete.sql
+++ b/db/routines/vn/triggers/workerTimeControl_afterDelete.sql
@@ -1,12 +1,12 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`workerTimeControl_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerTimeControl_afterDelete`
AFTER DELETE ON `workerTimeControl`
FOR EACH ROW
-BEGIN
- INSERT INTO workerLog
- SET `action` = 'delete',
- `changedModel` = 'WorkerTimeControl',
- `changedModelId` = OLD.id,
- `userFk` = account.myUser_getId();
+BEGIN
+ INSERT INTO workerLog
+ SET `action` = 'delete',
+ `changedModel` = 'WorkerTimeControl',
+ `changedModelId` = OLD.id,
+ `userFk` = account.myUser_getId();
END$$
DELIMITER ;
diff --git a/db/routines/vn/triggers/workerTimeControl_afterInsert.sql b/db/routines/vn/triggers/workerTimeControl_afterInsert.sql
index b8b9c3b01..84e53a5cd 100644
--- a/db/routines/vn/triggers/workerTimeControl_afterInsert.sql
+++ b/db/routines/vn/triggers/workerTimeControl_afterInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`workerTimeControl_afterInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerTimeControl_afterInsert`
AFTER INSERT ON `workerTimeControl`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/workerTimeControl_beforeInsert.sql b/db/routines/vn/triggers/workerTimeControl_beforeInsert.sql
index ad7acb784..4112c8de6 100644
--- a/db/routines/vn/triggers/workerTimeControl_beforeInsert.sql
+++ b/db/routines/vn/triggers/workerTimeControl_beforeInsert.sql
@@ -1,8 +1,8 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`workerTimeControl_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerTimeControl_beforeInsert`
BEFORE INSERT ON `workerTimeControl`
FOR EACH ROW
-BEGIN
- SET NEW.editorFk = account.myUser_getId();
+BEGIN
+ SET NEW.editorFk = account.myUser_getId();
END$$
DELIMITER ;
diff --git a/db/routines/vn/triggers/workerTimeControl_beforeUpdate.sql b/db/routines/vn/triggers/workerTimeControl_beforeUpdate.sql
index bb391ad61..3e673d847 100644
--- a/db/routines/vn/triggers/workerTimeControl_beforeUpdate.sql
+++ b/db/routines/vn/triggers/workerTimeControl_beforeUpdate.sql
@@ -1,8 +1,8 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`workerTimeControl_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerTimeControl_beforeUpdate`
BEFORE UPDATE ON `workerTimeControl`
FOR EACH ROW
-BEGIN
- SET NEW.editorFk = account.myUser_getId();
+BEGIN
+ SET NEW.editorFk = account.myUser_getId();
END$$
DELIMITER ;
diff --git a/db/routines/vn/triggers/worker_afterDelete.sql b/db/routines/vn/triggers/worker_afterDelete.sql
index 0104248ff..bf21547ac 100644
--- a/db/routines/vn/triggers/worker_afterDelete.sql
+++ b/db/routines/vn/triggers/worker_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`worker_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`worker_afterDelete`
AFTER DELETE ON `worker`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/worker_beforeInsert.sql b/db/routines/vn/triggers/worker_beforeInsert.sql
index 8830bd77e..24adbdbb6 100644
--- a/db/routines/vn/triggers/worker_beforeInsert.sql
+++ b/db/routines/vn/triggers/worker_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`worker_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`worker_beforeInsert`
BEFORE INSERT ON `worker`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/worker_beforeUpdate.sql b/db/routines/vn/triggers/worker_beforeUpdate.sql
index 05705d273..35b854836 100644
--- a/db/routines/vn/triggers/worker_beforeUpdate.sql
+++ b/db/routines/vn/triggers/worker_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`worker_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`worker_beforeUpdate`
BEFORE UPDATE ON `worker`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/workingHours_beforeInsert.sql b/db/routines/vn/triggers/workingHours_beforeInsert.sql
index dce726f10..57fd1e6f8 100644
--- a/db/routines/vn/triggers/workingHours_beforeInsert.sql
+++ b/db/routines/vn/triggers/workingHours_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`workingHours_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workingHours_beforeInsert`
BEFORE INSERT ON `workingHours`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/zoneEvent_afterDelete.sql b/db/routines/vn/triggers/zoneEvent_afterDelete.sql
index 1eecc21dc..aaf477752 100644
--- a/db/routines/vn/triggers/zoneEvent_afterDelete.sql
+++ b/db/routines/vn/triggers/zoneEvent_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`zoneEvent_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`zoneEvent_afterDelete`
AFTER DELETE ON `zoneEvent`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/zoneEvent_beforeInsert.sql b/db/routines/vn/triggers/zoneEvent_beforeInsert.sql
index ae1542851..b8f5486f8 100644
--- a/db/routines/vn/triggers/zoneEvent_beforeInsert.sql
+++ b/db/routines/vn/triggers/zoneEvent_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`zoneEvent_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`zoneEvent_beforeInsert`
BEFORE INSERT ON `zoneEvent`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/zoneEvent_beforeUpdate.sql b/db/routines/vn/triggers/zoneEvent_beforeUpdate.sql
index 09698a2c9..4ba7858d0 100644
--- a/db/routines/vn/triggers/zoneEvent_beforeUpdate.sql
+++ b/db/routines/vn/triggers/zoneEvent_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`zoneEvent_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`zoneEvent_beforeUpdate`
BEFORE UPDATE ON `zoneEvent`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/zoneExclusion_afterDelete.sql b/db/routines/vn/triggers/zoneExclusion_afterDelete.sql
index 6c8a441aa..b701c0434 100644
--- a/db/routines/vn/triggers/zoneExclusion_afterDelete.sql
+++ b/db/routines/vn/triggers/zoneExclusion_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`zoneExclusion_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`zoneExclusion_afterDelete`
AFTER DELETE ON `zoneExclusion`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/zoneExclusion_beforeInsert.sql b/db/routines/vn/triggers/zoneExclusion_beforeInsert.sql
index 6b2d2f5c7..59bd39ef5 100644
--- a/db/routines/vn/triggers/zoneExclusion_beforeInsert.sql
+++ b/db/routines/vn/triggers/zoneExclusion_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`zoneExclusion_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`zoneExclusion_beforeInsert`
BEFORE INSERT ON `zoneExclusion`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/zoneExclusion_beforeUpdate.sql b/db/routines/vn/triggers/zoneExclusion_beforeUpdate.sql
index 1daa6d2f0..ac7626696 100644
--- a/db/routines/vn/triggers/zoneExclusion_beforeUpdate.sql
+++ b/db/routines/vn/triggers/zoneExclusion_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`zoneExclusion_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`zoneExclusion_beforeUpdate`
BEFORE UPDATE ON `zoneExclusion`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/zoneGeo_beforeInsert.sql b/db/routines/vn/triggers/zoneGeo_beforeInsert.sql
index 1dbefbed9..7c9aa5004 100644
--- a/db/routines/vn/triggers/zoneGeo_beforeInsert.sql
+++ b/db/routines/vn/triggers/zoneGeo_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`zoneGeo_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`zoneGeo_beforeInsert`
BEFORE INSERT ON `zoneGeo`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/zoneGeo_beforeUpdate.sql b/db/routines/vn/triggers/zoneGeo_beforeUpdate.sql
index 0fdd7a682..b916ee366 100644
--- a/db/routines/vn/triggers/zoneGeo_beforeUpdate.sql
+++ b/db/routines/vn/triggers/zoneGeo_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`zoneGeo_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`zoneGeo_beforeUpdate`
BEFORE UPDATE ON `zoneGeo`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/zoneIncluded_afterDelete.sql b/db/routines/vn/triggers/zoneIncluded_afterDelete.sql
index 18332bb55..2990626ca 100644
--- a/db/routines/vn/triggers/zoneIncluded_afterDelete.sql
+++ b/db/routines/vn/triggers/zoneIncluded_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`zoneIncluded_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`zoneIncluded_afterDelete`
AFTER DELETE ON `zoneIncluded`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/zoneIncluded_beforeInsert.sql b/db/routines/vn/triggers/zoneIncluded_beforeInsert.sql
index 18895c9a5..614c153f6 100644
--- a/db/routines/vn/triggers/zoneIncluded_beforeInsert.sql
+++ b/db/routines/vn/triggers/zoneIncluded_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`zoneIncluded_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`zoneIncluded_beforeInsert`
BEFORE INSERT ON `zoneIncluded`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/zoneIncluded_beforeUpdate.sql b/db/routines/vn/triggers/zoneIncluded_beforeUpdate.sql
index e3f0a27e2..a718ca178 100644
--- a/db/routines/vn/triggers/zoneIncluded_beforeUpdate.sql
+++ b/db/routines/vn/triggers/zoneIncluded_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`zoneIncluded_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`zoneIncluded_beforeUpdate`
BEFORE UPDATE ON `zoneIncluded`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/zoneWarehouse_afterDelete.sql b/db/routines/vn/triggers/zoneWarehouse_afterDelete.sql
index 3befff38a..b72bc46d4 100644
--- a/db/routines/vn/triggers/zoneWarehouse_afterDelete.sql
+++ b/db/routines/vn/triggers/zoneWarehouse_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`zoneWarehouse_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`zoneWarehouse_afterDelete`
AFTER DELETE ON `zoneWarehouse`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/zoneWarehouse_beforeInsert.sql b/db/routines/vn/triggers/zoneWarehouse_beforeInsert.sql
index 099e66587..68218d09b 100644
--- a/db/routines/vn/triggers/zoneWarehouse_beforeInsert.sql
+++ b/db/routines/vn/triggers/zoneWarehouse_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`zoneWarehouse_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`zoneWarehouse_beforeInsert`
BEFORE INSERT ON `zoneWarehouse`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/zoneWarehouse_beforeUpdate.sql b/db/routines/vn/triggers/zoneWarehouse_beforeUpdate.sql
index 2a6563dc5..de63c802e 100644
--- a/db/routines/vn/triggers/zoneWarehouse_beforeUpdate.sql
+++ b/db/routines/vn/triggers/zoneWarehouse_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`zoneWarehouse_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`zoneWarehouse_beforeUpdate`
BEFORE UPDATE ON `zoneWarehouse`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/zone_afterDelete.sql b/db/routines/vn/triggers/zone_afterDelete.sql
index 463fa89e8..036f657e6 100644
--- a/db/routines/vn/triggers/zone_afterDelete.sql
+++ b/db/routines/vn/triggers/zone_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`zone_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`zone_afterDelete`
AFTER DELETE ON `zone`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/zone_beforeInsert.sql b/db/routines/vn/triggers/zone_beforeInsert.sql
index e0449a989..c87e548d9 100644
--- a/db/routines/vn/triggers/zone_beforeInsert.sql
+++ b/db/routines/vn/triggers/zone_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`zone_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`zone_beforeInsert`
BEFORE INSERT ON `zone`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/zone_beforeUpdate.sql b/db/routines/vn/triggers/zone_beforeUpdate.sql
index f945ad32c..fe017ce6a 100644
--- a/db/routines/vn/triggers/zone_beforeUpdate.sql
+++ b/db/routines/vn/triggers/zone_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`zone_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`zone_beforeUpdate`
BEFORE UPDATE ON `zone`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/views/NewView.sql b/db/routines/vn/views/NewView.sql
index 389564966..5276456d1 100644
--- a/db/routines/vn/views/NewView.sql
+++ b/db/routines/vn/views/NewView.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`NewView`
AS SELECT `c`.`id` AS `clientFk`,
diff --git a/db/routines/vn/views/agencyTerm.sql b/db/routines/vn/views/agencyTerm.sql
index 5f54cf39f..dbd80cad8 100644
--- a/db/routines/vn/views/agencyTerm.sql
+++ b/db/routines/vn/views/agencyTerm.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`agencyTerm`
AS SELECT `sat`.`agencyFk` AS `agencyFk`,
diff --git a/db/routines/vn/views/annualAverageInvoiced.sql b/db/routines/vn/views/annualAverageInvoiced.sql
index 30e81e1ec..4c74572d1 100644
--- a/db/routines/vn/views/annualAverageInvoiced.sql
+++ b/db/routines/vn/views/annualAverageInvoiced.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`annualAverageInvoiced`
AS SELECT `cec`.`clientFk` AS `clientFk`,
diff --git a/db/routines/vn/views/awbVolume.sql b/db/routines/vn/views/awbVolume.sql
index df3b1ed1a..fd0a12ca2 100644
--- a/db/routines/vn/views/awbVolume.sql
+++ b/db/routines/vn/views/awbVolume.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`awbVolume`
AS SELECT `t`.`awbFk` AS `awbFk`,
diff --git a/db/routines/vn/views/businessCalendar.sql b/db/routines/vn/views/businessCalendar.sql
index feda22793..3981a91d2 100644
--- a/db/routines/vn/views/businessCalendar.sql
+++ b/db/routines/vn/views/businessCalendar.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`businessCalendar`
AS SELECT `c`.`id` AS `id`,
diff --git a/db/routines/vn/views/buyer.sql b/db/routines/vn/views/buyer.sql
index 7114c50bc..4f668d35d 100644
--- a/db/routines/vn/views/buyer.sql
+++ b/db/routines/vn/views/buyer.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`buyer`
AS SELECT DISTINCT `u`.`id` AS `userFk`,
diff --git a/db/routines/vn/views/buyerSales.sql b/db/routines/vn/views/buyerSales.sql
index b67e17569..97c181419 100644
--- a/db/routines/vn/views/buyerSales.sql
+++ b/db/routines/vn/views/buyerSales.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`buyerSales`
AS SELECT `v`.`importe` AS `importe`,
diff --git a/db/routines/vn/views/clientLost.sql b/db/routines/vn/views/clientLost.sql
index 764782d08..e445776ce 100644
--- a/db/routines/vn/views/clientLost.sql
+++ b/db/routines/vn/views/clientLost.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`clientLost`
AS SELECT `c`.`id` AS `clientFk`,
diff --git a/db/routines/vn/views/clientPhoneBook.sql b/db/routines/vn/views/clientPhoneBook.sql
index 7ab2a99db..6fe2a5a5e 100644
--- a/db/routines/vn/views/clientPhoneBook.sql
+++ b/db/routines/vn/views/clientPhoneBook.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`clientPhoneBook`
AS SELECT `c`.`id` AS `clientFk`,
diff --git a/db/routines/vn/views/companyL10n.sql b/db/routines/vn/views/companyL10n.sql
index fa5c4c5d8..20292c4be 100644
--- a/db/routines/vn/views/companyL10n.sql
+++ b/db/routines/vn/views/companyL10n.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`companyL10n`
AS SELECT `c`.`id` AS `id`,
diff --git a/db/routines/vn/views/defaulter.sql b/db/routines/vn/views/defaulter.sql
index 9d48978b2..d98d6ccd7 100644
--- a/db/routines/vn/views/defaulter.sql
+++ b/db/routines/vn/views/defaulter.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`defaulter`
AS SELECT `d`.`clientFk` AS `clientFk`,
diff --git a/db/routines/vn/views/departmentTree.sql b/db/routines/vn/views/departmentTree.sql
index 6f5a1205a..36a21cb51 100644
--- a/db/routines/vn/views/departmentTree.sql
+++ b/db/routines/vn/views/departmentTree.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`departmentTree`
AS SELECT `node`.`id` AS `id`,
diff --git a/db/routines/vn/views/ediGenus.sql b/db/routines/vn/views/ediGenus.sql
index 4546afa33..bb56d54a8 100644
--- a/db/routines/vn/views/ediGenus.sql
+++ b/db/routines/vn/views/ediGenus.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`ediGenus`
AS SELECT `g`.`genus_id` AS `id`,
diff --git a/db/routines/vn/views/ediSpecie.sql b/db/routines/vn/views/ediSpecie.sql
index 9587cb530..9d5893aa8 100644
--- a/db/routines/vn/views/ediSpecie.sql
+++ b/db/routines/vn/views/ediSpecie.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`ediSpecie`
AS SELECT `s`.`specie_id` AS `id`,
diff --git a/db/routines/vn/views/ektSubAddress.sql b/db/routines/vn/views/ektSubAddress.sql
index 11f6e2e70..6684a9812 100644
--- a/db/routines/vn/views/ektSubAddress.sql
+++ b/db/routines/vn/views/ektSubAddress.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`ektSubAddress`
AS SELECT `eea`.`sub` AS `sub`,
diff --git a/db/routines/vn/views/especialPrice.sql b/db/routines/vn/views/especialPrice.sql
index 79d3e1384..a5631544e 100644
--- a/db/routines/vn/views/especialPrice.sql
+++ b/db/routines/vn/views/especialPrice.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`especialPrice`
AS SELECT `sp`.`id` AS `id`,
diff --git a/db/routines/vn/views/exchangeInsuranceEntry.sql b/db/routines/vn/views/exchangeInsuranceEntry.sql
index e9c7a7bbe..dc103eed4 100644
--- a/db/routines/vn/views/exchangeInsuranceEntry.sql
+++ b/db/routines/vn/views/exchangeInsuranceEntry.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`exchangeInsuranceEntry`
AS SELECT max(`tr`.`landed`) AS `dated`,
diff --git a/db/routines/vn/views/exchangeInsuranceIn.sql b/db/routines/vn/views/exchangeInsuranceIn.sql
index aa27cfb4c..93ca8e2da 100644
--- a/db/routines/vn/views/exchangeInsuranceIn.sql
+++ b/db/routines/vn/views/exchangeInsuranceIn.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`exchangeInsuranceIn`
AS SELECT `exchangeInsuranceInPrevious`.`dated` AS `dated`,
diff --git a/db/routines/vn/views/exchangeInsuranceInPrevious.sql b/db/routines/vn/views/exchangeInsuranceInPrevious.sql
index 3f997e8bf..afafe76e3 100644
--- a/db/routines/vn/views/exchangeInsuranceInPrevious.sql
+++ b/db/routines/vn/views/exchangeInsuranceInPrevious.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`exchangeInsuranceInPrevious`
AS SELECT `ei`.`dueDated` AS `dated`,
diff --git a/db/routines/vn/views/exchangeInsuranceOut.sql b/db/routines/vn/views/exchangeInsuranceOut.sql
index 5c41dbb24..1975ba594 100644
--- a/db/routines/vn/views/exchangeInsuranceOut.sql
+++ b/db/routines/vn/views/exchangeInsuranceOut.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`exchangeInsuranceOut`
AS SELECT `p`.`received` AS `received`,
diff --git a/db/routines/vn/views/expeditionCommon.sql b/db/routines/vn/views/expeditionCommon.sql
index fcf36a7d8..5687bc348 100644
--- a/db/routines/vn/views/expeditionCommon.sql
+++ b/db/routines/vn/views/expeditionCommon.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`expeditionCommon`
AS SELECT `rs`.`id` AS `truckFk`,
diff --git a/db/routines/vn/views/expeditionPallet_Print.sql b/db/routines/vn/views/expeditionPallet_Print.sql
index aab725ebe..7b933a0a1 100644
--- a/db/routines/vn/views/expeditionPallet_Print.sql
+++ b/db/routines/vn/views/expeditionPallet_Print.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`expeditionPallet_Print`
AS SELECT `rs2`.`description` AS `truck`,
diff --git a/db/routines/vn/views/expeditionRoute_Monitor.sql b/db/routines/vn/views/expeditionRoute_Monitor.sql
index 7eef40425..9b46c8237 100644
--- a/db/routines/vn/views/expeditionRoute_Monitor.sql
+++ b/db/routines/vn/views/expeditionRoute_Monitor.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`expeditionRoute_Monitor`
AS SELECT `r`.`id` AS `routeFk`,
diff --git a/db/routines/vn/views/expeditionRoute_freeTickets.sql b/db/routines/vn/views/expeditionRoute_freeTickets.sql
index 85e6297c9..d49cee22e 100644
--- a/db/routines/vn/views/expeditionRoute_freeTickets.sql
+++ b/db/routines/vn/views/expeditionRoute_freeTickets.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`expeditionRoute_freeTickets`
AS SELECT `t`.`routeFk` AS `routeFk`,
diff --git a/db/routines/vn/views/expeditionScan_Monitor.sql b/db/routines/vn/views/expeditionScan_Monitor.sql
index 94bda1863..6d2e855de 100644
--- a/db/routines/vn/views/expeditionScan_Monitor.sql
+++ b/db/routines/vn/views/expeditionScan_Monitor.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`expeditionScan_Monitor`
AS SELECT `rs`.`id` AS `truckFk`,
diff --git a/db/routines/vn/views/expeditionSticker.sql b/db/routines/vn/views/expeditionSticker.sql
index ef0743527..f9855d764 100644
--- a/db/routines/vn/views/expeditionSticker.sql
+++ b/db/routines/vn/views/expeditionSticker.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`expeditionSticker`
AS SELECT `e`.`id` AS `expeditionFk`,
diff --git a/db/routines/vn/views/expeditionTicket_NoBoxes.sql b/db/routines/vn/views/expeditionTicket_NoBoxes.sql
index 75218c7a9..be3619b21 100644
--- a/db/routines/vn/views/expeditionTicket_NoBoxes.sql
+++ b/db/routines/vn/views/expeditionTicket_NoBoxes.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`expeditionTicket_NoBoxes`
AS SELECT `t`.`id` AS `ticketFk`,
diff --git a/db/routines/vn/views/expeditionTimeExpended.sql b/db/routines/vn/views/expeditionTimeExpended.sql
index 65aeb72b2..3666f51d9 100644
--- a/db/routines/vn/views/expeditionTimeExpended.sql
+++ b/db/routines/vn/views/expeditionTimeExpended.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`expeditionTimeExpended`
AS SELECT `e`.`ticketFk` AS `ticketFk`,
diff --git a/db/routines/vn/views/expeditionTruck.sql b/db/routines/vn/views/expeditionTruck.sql
index 065869de0..a5e0cf350 100644
--- a/db/routines/vn/views/expeditionTruck.sql
+++ b/db/routines/vn/views/expeditionTruck.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`expeditionTruck`
AS SELECT `rs`.`id` AS `id`,
diff --git a/db/routines/vn/views/firstTicketShipped.sql b/db/routines/vn/views/firstTicketShipped.sql
index c01a17976..c2e9f55e6 100644
--- a/db/routines/vn/views/firstTicketShipped.sql
+++ b/db/routines/vn/views/firstTicketShipped.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`firstTicketShipped`
AS SELECT min(`vn`.`ticket`.`shipped`) AS `shipped`,
diff --git a/db/routines/vn/views/floraHollandBuyedItems.sql b/db/routines/vn/views/floraHollandBuyedItems.sql
index b695c49fd..b8699a889 100644
--- a/db/routines/vn/views/floraHollandBuyedItems.sql
+++ b/db/routines/vn/views/floraHollandBuyedItems.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`floraHollandBuyedItems`
AS SELECT `b`.`itemFk` AS `itemFk`,
diff --git a/db/routines/vn/views/inkL10n.sql b/db/routines/vn/views/inkL10n.sql
index 14958ff0a..dfe449d96 100644
--- a/db/routines/vn/views/inkL10n.sql
+++ b/db/routines/vn/views/inkL10n.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`inkL10n`
AS SELECT `k`.`id` AS `id`,
diff --git a/db/routines/vn/views/invoiceCorrectionDataSource.sql b/db/routines/vn/views/invoiceCorrectionDataSource.sql
index d401c20f1..34dc39d85 100644
--- a/db/routines/vn/views/invoiceCorrectionDataSource.sql
+++ b/db/routines/vn/views/invoiceCorrectionDataSource.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`invoiceCorrectionDataSource`
AS SELECT `s`.`itemFk` AS `itemFk`,
diff --git a/db/routines/vn/views/itemBotanicalWithGenus.sql b/db/routines/vn/views/itemBotanicalWithGenus.sql
index 3bc0b943d..fda6e6cc4 100644
--- a/db/routines/vn/views/itemBotanicalWithGenus.sql
+++ b/db/routines/vn/views/itemBotanicalWithGenus.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`itemBotanicalWithGenus`
AS SELECT `ib`.`itemFk` AS `itemFk`,
diff --git a/db/routines/vn/views/itemCategoryL10n.sql b/db/routines/vn/views/itemCategoryL10n.sql
index 08a7c7321..8d47ca662 100644
--- a/db/routines/vn/views/itemCategoryL10n.sql
+++ b/db/routines/vn/views/itemCategoryL10n.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`itemCategoryL10n`
AS SELECT `c`.`id` AS `id`,
diff --git a/db/routines/vn/views/itemColor.sql b/db/routines/vn/views/itemColor.sql
index 5ab8a4c4f..f2c3f87e0 100644
--- a/db/routines/vn/views/itemColor.sql
+++ b/db/routines/vn/views/itemColor.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`itemColor`
AS SELECT `it`.`itemFk` AS `itemFk`,
diff --git a/db/routines/vn/views/itemEntryIn.sql b/db/routines/vn/views/itemEntryIn.sql
index 184ccbf59..4f7855d2b 100644
--- a/db/routines/vn/views/itemEntryIn.sql
+++ b/db/routines/vn/views/itemEntryIn.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`itemEntryIn`
AS SELECT `t`.`warehouseInFk` AS `warehouseInFk`,
diff --git a/db/routines/vn/views/itemEntryOut.sql b/db/routines/vn/views/itemEntryOut.sql
index 82b065985..1e8718c53 100644
--- a/db/routines/vn/views/itemEntryOut.sql
+++ b/db/routines/vn/views/itemEntryOut.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`itemEntryOut`
AS SELECT `t`.`warehouseOutFk` AS `warehouseOutFk`,
diff --git a/db/routines/vn/views/itemInk.sql b/db/routines/vn/views/itemInk.sql
index d13a862e7..6a5a10388 100644
--- a/db/routines/vn/views/itemInk.sql
+++ b/db/routines/vn/views/itemInk.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`itemInk`
AS SELECT `i`.`longName` AS `longName`,
diff --git a/db/routines/vn/views/itemPlacementSupplyList.sql b/db/routines/vn/views/itemPlacementSupplyList.sql
index 10e7ae3ef..d8d3cc705 100644
--- a/db/routines/vn/views/itemPlacementSupplyList.sql
+++ b/db/routines/vn/views/itemPlacementSupplyList.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`itemPlacementSupplyList`
AS SELECT `ips`.`id` AS `id`,
diff --git a/db/routines/vn/views/itemProductor.sql b/db/routines/vn/views/itemProductor.sql
index f6cb0eb19..8d7833489 100644
--- a/db/routines/vn/views/itemProductor.sql
+++ b/db/routines/vn/views/itemProductor.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`itemProductor`
AS SELECT `it`.`itemFk` AS `itemFk`,
diff --git a/db/routines/vn/views/itemSearch.sql b/db/routines/vn/views/itemSearch.sql
index 6a21b9e92..0b51b7397 100644
--- a/db/routines/vn/views/itemSearch.sql
+++ b/db/routines/vn/views/itemSearch.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`itemSearch`
AS SELECT `s`.`itemFk` AS `itemFk`,
diff --git a/db/routines/vn/views/itemShelvingAvailable.sql b/db/routines/vn/views/itemShelvingAvailable.sql
index 868d6a963..15083e6cc 100644
--- a/db/routines/vn/views/itemShelvingAvailable.sql
+++ b/db/routines/vn/views/itemShelvingAvailable.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`itemShelvingAvailable`
AS SELECT `s`.`id` AS `saleFk`,
@@ -10,7 +10,6 @@ AS SELECT `s`.`id` AS `saleFk`,
`s`.`concept` AS `concept`,
`i`.`size` AS `size`,
`st`.`name` AS `Estado`,
- `st`.`sectorProdPriority` AS `sectorProdPriority`,
`stock`.`visible` AS `available`,
`stock`.`sectorFk` AS `sectorFk`,
`stock`.`shelvingFk` AS `matricula`,
diff --git a/db/routines/vn/views/itemShelvingList.sql b/db/routines/vn/views/itemShelvingList.sql
index 570bf0be6..457d6f28a 100644
--- a/db/routines/vn/views/itemShelvingList.sql
+++ b/db/routines/vn/views/itemShelvingList.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`itemShelvingList`
AS SELECT `ish`.`shelvingFk` AS `shelvingFk`,
diff --git a/db/routines/vn/views/itemShelvingPlacementSupplyStock.sql b/db/routines/vn/views/itemShelvingPlacementSupplyStock.sql
index 217aaf6ac..fa1c11314 100644
--- a/db/routines/vn/views/itemShelvingPlacementSupplyStock.sql
+++ b/db/routines/vn/views/itemShelvingPlacementSupplyStock.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`itemShelvingPlacementSupplyStock`
AS SELECT `ish`.`id` AS `itemShelvingFk`,
diff --git a/db/routines/vn/views/itemShelvingSaleSum.sql b/db/routines/vn/views/itemShelvingSaleSum.sql
index 566e20a69..9a402d6f4 100644
--- a/db/routines/vn/views/itemShelvingSaleSum.sql
+++ b/db/routines/vn/views/itemShelvingSaleSum.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`itemShelvingSaleSum`
AS SELECT `iss`.`id` AS `id`,
diff --git a/db/routines/vn/views/itemShelvingStock.sql b/db/routines/vn/views/itemShelvingStock.sql
index e0825eae5..41777eaec 100644
--- a/db/routines/vn/views/itemShelvingStock.sql
+++ b/db/routines/vn/views/itemShelvingStock.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`itemShelvingStock`
AS SELECT `ish`.`itemFk` AS `itemFk`,
diff --git a/db/routines/vn/views/itemShelvingStockFull.sql b/db/routines/vn/views/itemShelvingStockFull.sql
index 71ce5ed79..c767823d6 100644
--- a/db/routines/vn/views/itemShelvingStockFull.sql
+++ b/db/routines/vn/views/itemShelvingStockFull.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`itemShelvingStockFull`
AS SELECT `ish`.`itemFk` AS `itemFk`,
diff --git a/db/routines/vn/views/itemShelvingStockRemoved.sql b/db/routines/vn/views/itemShelvingStockRemoved.sql
index fb201e0f1..7baf3a6c6 100644
--- a/db/routines/vn/views/itemShelvingStockRemoved.sql
+++ b/db/routines/vn/views/itemShelvingStockRemoved.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`itemShelvingStockRemoved`
AS SELECT `ish`.`id` AS `itemShelvingFk`,
diff --git a/db/routines/vn/views/itemTagged.sql b/db/routines/vn/views/itemTagged.sql
index c22354bda..db7460fcc 100644
--- a/db/routines/vn/views/itemTagged.sql
+++ b/db/routines/vn/views/itemTagged.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`itemTagged`
AS SELECT DISTINCT `vn`.`itemTag`.`itemFk` AS `itemFk`
diff --git a/db/routines/vn/views/itemTaxCountrySpain.sql b/db/routines/vn/views/itemTaxCountrySpain.sql
index 9dfaf0b41..992535bdc 100644
--- a/db/routines/vn/views/itemTaxCountrySpain.sql
+++ b/db/routines/vn/views/itemTaxCountrySpain.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`itemTaxCountrySpain`
AS SELECT `i`.`id` AS `id`,
diff --git a/db/routines/vn/views/itemTicketOut.sql b/db/routines/vn/views/itemTicketOut.sql
index d9bbd54bd..7a5e17d76 100644
--- a/db/routines/vn/views/itemTicketOut.sql
+++ b/db/routines/vn/views/itemTicketOut.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`itemTicketOut`
AS SELECT `t`.`warehouseFk` AS `warehouseFk`,
diff --git a/db/routines/vn/views/itemTypeL10n.sql b/db/routines/vn/views/itemTypeL10n.sql
index 03d72f0d4..66ef9ac90 100644
--- a/db/routines/vn/views/itemTypeL10n.sql
+++ b/db/routines/vn/views/itemTypeL10n.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`itemTypeL10n`
AS SELECT `t`.`id` AS `id`,
diff --git a/db/routines/vn/views/item_Free_Id.sql b/db/routines/vn/views/item_Free_Id.sql
index 36464004c..d148a18e6 100644
--- a/db/routines/vn/views/item_Free_Id.sql
+++ b/db/routines/vn/views/item_Free_Id.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`item_Free_Id`
AS SELECT `i1`.`id` + 1 AS `newId`
diff --git a/db/routines/vn/views/labelInfo.sql b/db/routines/vn/views/labelInfo.sql
index ccc6fc6ac..eef0145fb 100644
--- a/db/routines/vn/views/labelInfo.sql
+++ b/db/routines/vn/views/labelInfo.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`labelInfo`
AS SELECT `i`.`id` AS `itemId`,
diff --git a/db/routines/vn/views/lastHourProduction.sql b/db/routines/vn/views/lastHourProduction.sql
index 90bc0cd76..e0b66481d 100644
--- a/db/routines/vn/views/lastHourProduction.sql
+++ b/db/routines/vn/views/lastHourProduction.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`lastHourProduction`
AS SELECT `t`.`warehouseFk` AS `warehouseFk`,
diff --git a/db/routines/vn/views/lastPurchases.sql b/db/routines/vn/views/lastPurchases.sql
index 04a9f8c05..3099acd00 100644
--- a/db/routines/vn/views/lastPurchases.sql
+++ b/db/routines/vn/views/lastPurchases.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`lastPurchases`
AS SELECT `tr`.`landed` AS `landed`,
diff --git a/db/routines/vn/views/lastTopClaims.sql b/db/routines/vn/views/lastTopClaims.sql
index 0bc36e3c2..93dbc4b45 100644
--- a/db/routines/vn/views/lastTopClaims.sql
+++ b/db/routines/vn/views/lastTopClaims.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`lastTopClaims`
AS SELECT `s`.`itemFk` AS `itemFk`,
diff --git a/db/routines/vn/views/mistake.sql b/db/routines/vn/views/mistake.sql
index 0ed4dccf2..ca9223c3b 100644
--- a/db/routines/vn/views/mistake.sql
+++ b/db/routines/vn/views/mistake.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`mistake`
AS SELECT `wr`.`code` AS `revisador`,
diff --git a/db/routines/vn/views/mistakeRatio.sql b/db/routines/vn/views/mistakeRatio.sql
index 4b7fd5a1f..0aa80a966 100644
--- a/db/routines/vn/views/mistakeRatio.sql
+++ b/db/routines/vn/views/mistakeRatio.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`mistakeRatio`
AS SELECT `wr`.`code` AS `revisador`,
diff --git a/db/routines/vn/views/newBornSales.sql b/db/routines/vn/views/newBornSales.sql
index d34eff4ef..b4aac208c 100644
--- a/db/routines/vn/views/newBornSales.sql
+++ b/db/routines/vn/views/newBornSales.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`newBornSales`
AS SELECT `v`.`importe` AS `amount`,
diff --git a/db/routines/vn/views/operatorWorkerCode.sql b/db/routines/vn/views/operatorWorkerCode.sql
index 340d833a7..343f74254 100644
--- a/db/routines/vn/views/operatorWorkerCode.sql
+++ b/db/routines/vn/views/operatorWorkerCode.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`operatorWorkerCode`
AS SELECT `o`.`workerFk` AS `workerFk`,
diff --git a/db/routines/vn/views/originL10n.sql b/db/routines/vn/views/originL10n.sql
index 2ff368e14..ffceccd50 100644
--- a/db/routines/vn/views/originL10n.sql
+++ b/db/routines/vn/views/originL10n.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`originL10n`
AS SELECT `o`.`id` AS `id`,
diff --git a/db/routines/vn/views/packageEquivalentItem.sql b/db/routines/vn/views/packageEquivalentItem.sql
index ba2897c14..767fa326e 100644
--- a/db/routines/vn/views/packageEquivalentItem.sql
+++ b/db/routines/vn/views/packageEquivalentItem.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`packageEquivalentItem`
AS SELECT `p`.`itemFk` AS `itemFk`,
diff --git a/db/routines/vn/views/paymentExchangeInsurance.sql b/db/routines/vn/views/paymentExchangeInsurance.sql
index f3e07eaaf..c5800e48b 100644
--- a/db/routines/vn/views/paymentExchangeInsurance.sql
+++ b/db/routines/vn/views/paymentExchangeInsurance.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`paymentExchangeInsurance`
AS SELECT `ei`.`id` AS `pago_sdc_id`,
diff --git a/db/routines/vn/views/payrollCenter.sql b/db/routines/vn/views/payrollCenter.sql
index dfe7e4728..f06dc702f 100644
--- a/db/routines/vn/views/payrollCenter.sql
+++ b/db/routines/vn/views/payrollCenter.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`payrollCenter`
AS SELECT `b`.`workCenterFkA3` AS `codCenter`,
diff --git a/db/routines/vn/views/personMedia.sql b/db/routines/vn/views/personMedia.sql
index d17410ef1..367f67c8e 100644
--- a/db/routines/vn/views/personMedia.sql
+++ b/db/routines/vn/views/personMedia.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`personMedia`
AS SELECT `c`.`id` AS `workerFk`,
diff --git a/db/routines/vn/views/phoneBook.sql b/db/routines/vn/views/phoneBook.sql
index 5fcafe99c..c51b912aa 100644
--- a/db/routines/vn/views/phoneBook.sql
+++ b/db/routines/vn/views/phoneBook.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`phoneBook`
AS SELECT 'C' AS `Tipo`,
diff --git a/db/routines/vn/views/productionVolume.sql b/db/routines/vn/views/productionVolume.sql
index fd83b96bc..14cf5518b 100644
--- a/db/routines/vn/views/productionVolume.sql
+++ b/db/routines/vn/views/productionVolume.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`productionVolume`
AS SELECT HOUR(`e`.`created`) AS `hora`,
diff --git a/db/routines/vn/views/productionVolume_LastHour.sql b/db/routines/vn/views/productionVolume_LastHour.sql
index 561a23f9b..bafb5a67a 100644
--- a/db/routines/vn/views/productionVolume_LastHour.sql
+++ b/db/routines/vn/views/productionVolume_LastHour.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`productionVolume_LastHour`
AS SELECT cast(
diff --git a/db/routines/vn/views/role.sql b/db/routines/vn/views/role.sql
index 310951570..db2fa109e 100644
--- a/db/routines/vn/views/role.sql
+++ b/db/routines/vn/views/role.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`role`
AS SELECT `account`.`role`.`id` AS `id`,
diff --git a/db/routines/vn/views/routesControl.sql b/db/routines/vn/views/routesControl.sql
index 282dd21e3..9f9e23da1 100644
--- a/db/routines/vn/views/routesControl.sql
+++ b/db/routines/vn/views/routesControl.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`routesControl`
AS SELECT `t`.`routeFk` AS `routeFk`,
diff --git a/db/routines/vn/views/saleCost.sql b/db/routines/vn/views/saleCost.sql
index 304b9e3a3..27f492abd 100644
--- a/db/routines/vn/views/saleCost.sql
+++ b/db/routines/vn/views/saleCost.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`saleCost`
AS SELECT `s`.`itemFk` AS `itemFk`,
diff --git a/db/routines/vn/views/saleMistakeList.sql b/db/routines/vn/views/saleMistakeList.sql
index d362e0d97..0cad951fe 100644
--- a/db/routines/vn/views/saleMistakeList.sql
+++ b/db/routines/vn/views/saleMistakeList.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`saleMistakeList`
AS SELECT `st`.`saleFk` AS `saleFk`,
diff --git a/db/routines/vn/views/saleMistake_list__2.sql b/db/routines/vn/views/saleMistake_list__2.sql
index 1f40a89d9..e65761c75 100644
--- a/db/routines/vn/views/saleMistake_list__2.sql
+++ b/db/routines/vn/views/saleMistake_list__2.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`saleMistake_list__2`
AS SELECT `st`.`saleFk` AS `saleFk`,
diff --git a/db/routines/vn/views/saleSaleTracking.sql b/db/routines/vn/views/saleSaleTracking.sql
index 9ada798cf..7e6531a01 100644
--- a/db/routines/vn/views/saleSaleTracking.sql
+++ b/db/routines/vn/views/saleSaleTracking.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`saleSaleTracking`
AS SELECT DISTINCT `st`.`saleFk` AS `saleFk`
diff --git a/db/routines/vn/views/saleValue.sql b/db/routines/vn/views/saleValue.sql
index 2dee4695e..84741990f 100644
--- a/db/routines/vn/views/saleValue.sql
+++ b/db/routines/vn/views/saleValue.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`saleValue`
AS SELECT `wh`.`name` AS `warehouse`,
diff --git a/db/routines/vn/views/saleVolume.sql b/db/routines/vn/views/saleVolume.sql
index ffc6714c6..a1a1b2925 100644
--- a/db/routines/vn/views/saleVolume.sql
+++ b/db/routines/vn/views/saleVolume.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`saleVolume`
AS SELECT `s`.`ticketFk` AS `ticketFk`,
diff --git a/db/routines/vn/views/saleVolume_Today_VNH.sql b/db/routines/vn/views/saleVolume_Today_VNH.sql
index c36779146..f81253a76 100644
--- a/db/routines/vn/views/saleVolume_Today_VNH.sql
+++ b/db/routines/vn/views/saleVolume_Today_VNH.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`saleVolume_Today_VNH`
AS SELECT `t`.`nickname` AS `Cliente`,
diff --git a/db/routines/vn/views/sale_freightComponent.sql b/db/routines/vn/views/sale_freightComponent.sql
index 269a8cca1..a76a8666c 100644
--- a/db/routines/vn/views/sale_freightComponent.sql
+++ b/db/routines/vn/views/sale_freightComponent.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`sale_freightComponent`
AS SELECT `t`.`id` AS `ticketFk`,
diff --git a/db/routines/vn/views/salesPersonSince.sql b/db/routines/vn/views/salesPersonSince.sql
index 4234ecac4..0e1646f1b 100644
--- a/db/routines/vn/views/salesPersonSince.sql
+++ b/db/routines/vn/views/salesPersonSince.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`salesPersonSince`
AS SELECT `b`.`workerFk` AS `workerFk`,
diff --git a/db/routines/vn/views/salesPreparedLastHour.sql b/db/routines/vn/views/salesPreparedLastHour.sql
index caa7866cb..33e86b29c 100644
--- a/db/routines/vn/views/salesPreparedLastHour.sql
+++ b/db/routines/vn/views/salesPreparedLastHour.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`salesPreparedLastHour`
AS SELECT `t`.`warehouseFk` AS `warehouseFk`,
diff --git a/db/routines/vn/views/salesPreviousPreparated.sql b/db/routines/vn/views/salesPreviousPreparated.sql
index 40ae29eda..bd55862c9 100644
--- a/db/routines/vn/views/salesPreviousPreparated.sql
+++ b/db/routines/vn/views/salesPreviousPreparated.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`salesPreviousPreparated`
AS SELECT `st`.`saleFk` AS `saleFk`
diff --git a/db/routines/vn/views/supplierPackaging.sql b/db/routines/vn/views/supplierPackaging.sql
index 45a9d46d3..01c9c69e7 100644
--- a/db/routines/vn/views/supplierPackaging.sql
+++ b/db/routines/vn/views/supplierPackaging.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`supplierPackaging`
AS SELECT `e`.`supplierFk` AS `supplierFk`,
diff --git a/db/routines/vn/views/tagL10n.sql b/db/routines/vn/views/tagL10n.sql
index 982122b13..68ed9541c 100644
--- a/db/routines/vn/views/tagL10n.sql
+++ b/db/routines/vn/views/tagL10n.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`tagL10n`
AS SELECT `t`.`id` AS `id`,
diff --git a/db/routines/vn/views/ticketDownBuffer.sql b/db/routines/vn/views/ticketDownBuffer.sql
index 4d157f20c..e951de9e0 100644
--- a/db/routines/vn/views/ticketDownBuffer.sql
+++ b/db/routines/vn/views/ticketDownBuffer.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`ticketDownBuffer`
AS SELECT `td`.`ticketFk` AS `ticketFk`,
diff --git a/db/routines/vn/views/ticketLastUpdated.sql b/db/routines/vn/views/ticketLastUpdated.sql
index 96b6eaa17..8a6a66c8e 100644
--- a/db/routines/vn/views/ticketLastUpdated.sql
+++ b/db/routines/vn/views/ticketLastUpdated.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`ticketLastUpdated`
AS SELECT `ticketLastUpdatedList`.`ticketFk` AS `ticketFk`,
diff --git a/db/routines/vn/views/ticketLastUpdatedList.sql b/db/routines/vn/views/ticketLastUpdatedList.sql
index bfc769e47..5d087a596 100644
--- a/db/routines/vn/views/ticketLastUpdatedList.sql
+++ b/db/routines/vn/views/ticketLastUpdatedList.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`ticketLastUpdatedList`
AS SELECT `s`.`ticketFk` AS `ticketFk`,
diff --git a/db/routines/vn/views/ticketNotInvoiced.sql b/db/routines/vn/views/ticketNotInvoiced.sql
index c35b414ce..f966bf85d 100644
--- a/db/routines/vn/views/ticketNotInvoiced.sql
+++ b/db/routines/vn/views/ticketNotInvoiced.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`ticketNotInvoiced`
AS SELECT `t`.`companyFk` AS `companyFk`,
diff --git a/db/routines/vn/views/ticketPackingList.sql b/db/routines/vn/views/ticketPackingList.sql
index bafe3c00c..c185bb7c0 100644
--- a/db/routines/vn/views/ticketPackingList.sql
+++ b/db/routines/vn/views/ticketPackingList.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`ticketPackingList`
AS SELECT `t`.`nickname` AS `nickname`,
diff --git a/db/routines/vn/views/ticketPreviousPreparingList.sql b/db/routines/vn/views/ticketPreviousPreparingList.sql
index cd18b3a7c..4e19c0bb8 100644
--- a/db/routines/vn/views/ticketPreviousPreparingList.sql
+++ b/db/routines/vn/views/ticketPreviousPreparingList.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`ticketPreviousPreparingList`
AS SELECT `s`.`ticketFk` AS `ticketFk`,
diff --git a/db/routines/vn/views/ticketState.sql b/db/routines/vn/views/ticketState.sql
index 118a58b34..588c5c61a 100644
--- a/db/routines/vn/views/ticketState.sql
+++ b/db/routines/vn/views/ticketState.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`ticketState`
AS SELECT `tt`.`created` AS `updated`,
diff --git a/db/routines/vn/views/ticketStateToday.sql b/db/routines/vn/views/ticketStateToday.sql
index 1f10aceb1..8c11fcc87 100644
--- a/db/routines/vn/views/ticketStateToday.sql
+++ b/db/routines/vn/views/ticketStateToday.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`ticketStateToday`
AS SELECT `ts`.`ticketFk` AS `ticketFk`,
@@ -13,4 +13,4 @@ FROM (
`vn`.`ticketState` `ts`
JOIN `vn`.`ticket` `t` ON(`t`.`id` = `ts`.`ticketFk`)
)
-WHERE `t`.`shipped` BETWEEN `util`.`VN_CURDATE`() AND `MIDNIGHT`(`util`.`VN_CURDATE`())
+WHERE `t`.`shipped` BETWEEN `util`.`VN_CURDATE`() AND `util`.`midnight`()
diff --git a/db/routines/vn/views/tr2.sql b/db/routines/vn/views/tr2.sql
index 5abc2bfa8..525554f04 100644
--- a/db/routines/vn/views/tr2.sql
+++ b/db/routines/vn/views/tr2.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`tr2`
AS SELECT `vn`.`travel`.`id` AS `id`,
diff --git a/db/routines/vn/views/traceabilityBuy.sql b/db/routines/vn/views/traceabilityBuy.sql
index 0257c2f5d..8189a8b0e 100644
--- a/db/routines/vn/views/traceabilityBuy.sql
+++ b/db/routines/vn/views/traceabilityBuy.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`traceabilityBuy`
AS SELECT `b`.`id` AS `buyFk`,
diff --git a/db/routines/vn/views/traceabilitySale.sql b/db/routines/vn/views/traceabilitySale.sql
index 9caf11d5e..a251e11d5 100644
--- a/db/routines/vn/views/traceabilitySale.sql
+++ b/db/routines/vn/views/traceabilitySale.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`traceabilitySale`
AS SELECT `s`.`ticketFk` AS `ticketFk`,
diff --git a/db/routines/vn/views/workerBusinessDated.sql b/db/routines/vn/views/workerBusinessDated.sql
index 83d6eb48c..783c18ffd 100644
--- a/db/routines/vn/views/workerBusinessDated.sql
+++ b/db/routines/vn/views/workerBusinessDated.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`workerBusinessDated`
AS SELECT `t`.`dated` AS `dated`,
diff --git a/db/routines/vn/views/workerDepartment.sql b/db/routines/vn/views/workerDepartment.sql
index 4be3122da..e4f3bbe90 100644
--- a/db/routines/vn/views/workerDepartment.sql
+++ b/db/routines/vn/views/workerDepartment.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`workerDepartment`
AS SELECT `b`.`workerFk` AS `workerFk`,
diff --git a/db/routines/vn/views/workerLabour.sql b/db/routines/vn/views/workerLabour.sql
index 2f4067c2d..633d95c4a 100644
--- a/db/routines/vn/views/workerLabour.sql
+++ b/db/routines/vn/views/workerLabour.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`workerLabour`
AS SELECT `b`.`id` AS `businessFk`,
diff --git a/db/routines/vn/views/workerMedia.sql b/db/routines/vn/views/workerMedia.sql
index 72ee04299..bc6961422 100644
--- a/db/routines/vn/views/workerMedia.sql
+++ b/db/routines/vn/views/workerMedia.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`workerMedia`
AS SELECT `w`.`id` AS `workerFk`,
diff --git a/db/routines/vn/views/workerSpeedExpedition.sql b/db/routines/vn/views/workerSpeedExpedition.sql
index db13cf16a..0bbd250b3 100644
--- a/db/routines/vn/views/workerSpeedExpedition.sql
+++ b/db/routines/vn/views/workerSpeedExpedition.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`workerSpeedExpedition`
AS SELECT `sv`.`ticketFk` AS `ticketFk`,
diff --git a/db/routines/vn/views/workerSpeedSaleTracking.sql b/db/routines/vn/views/workerSpeedSaleTracking.sql
index 21f07ea8a..d426af3a5 100644
--- a/db/routines/vn/views/workerSpeedSaleTracking.sql
+++ b/db/routines/vn/views/workerSpeedSaleTracking.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`workerSpeedSaleTracking`
AS SELECT `salesPreparedLastHour`.`warehouseFk` AS `warehouseFk`,
diff --git a/db/routines/vn/views/workerTeamCollegues.sql b/db/routines/vn/views/workerTeamCollegues.sql
index dbe245a16..c43bb6a4a 100644
--- a/db/routines/vn/views/workerTeamCollegues.sql
+++ b/db/routines/vn/views/workerTeamCollegues.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`workerTeamCollegues`
AS SELECT DISTINCT `w`.`workerFk` AS `workerFk`,
diff --git a/db/routines/vn/views/workerTimeControlUserInfo.sql b/db/routines/vn/views/workerTimeControlUserInfo.sql
index eea8ffd7c..5d122fc09 100644
--- a/db/routines/vn/views/workerTimeControlUserInfo.sql
+++ b/db/routines/vn/views/workerTimeControlUserInfo.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`workerTimeControlUserInfo`
AS SELECT `u`.`id` AS `userFk`,
diff --git a/db/routines/vn/views/workerTimeJourneyNG.sql b/db/routines/vn/views/workerTimeJourneyNG.sql
index b45b855b7..e55062e64 100644
--- a/db/routines/vn/views/workerTimeJourneyNG.sql
+++ b/db/routines/vn/views/workerTimeJourneyNG.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`workerTimeJourneyNG`
AS SELECT `wtc`.`userFk` AS `userFk`,
diff --git a/db/routines/vn/views/workerWithoutTractor.sql b/db/routines/vn/views/workerWithoutTractor.sql
index e0c0978a5..205c66599 100644
--- a/db/routines/vn/views/workerWithoutTractor.sql
+++ b/db/routines/vn/views/workerWithoutTractor.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`workerWithoutTractor`
AS SELECT `c`.`workerFk` AS `workerFk`,
diff --git a/db/routines/vn/views/zoneEstimatedDelivery.sql b/db/routines/vn/views/zoneEstimatedDelivery.sql
index 90c7381d8..953a2b25a 100644
--- a/db/routines/vn/views/zoneEstimatedDelivery.sql
+++ b/db/routines/vn/views/zoneEstimatedDelivery.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
+CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`zoneEstimatedDelivery`
AS SELECT `t`.`zoneFk` AS `zoneFk`,
diff --git a/db/routines/vn2008/views/Agencias.sql b/db/routines/vn2008/views/Agencias.sql
index d70ec73f4..1176d02c4 100644
--- a/db/routines/vn2008/views/Agencias.sql
+++ b/db/routines/vn2008/views/Agencias.sql
@@ -13,6 +13,5 @@ AS SELECT `am`.`id` AS `Id_Agencia`,
`am`.`reportMail` AS `send_mail`,
`am`.`isActive` AS `tpv`,
`am`.`code` AS `code`,
- `am`.`showAgencyName` AS `show_AgencyName`,
`am`.`isRiskFree` AS `isRiskFree`
FROM `vn`.`agencyMode` `am`
diff --git a/db/routines/vn2008/views/Articles.sql b/db/routines/vn2008/views/Articles.sql
index 385bf310b..87f1b6d5e 100644
--- a/db/routines/vn2008/views/Articles.sql
+++ b/db/routines/vn2008/views/Articles.sql
@@ -41,7 +41,6 @@ AS SELECT `i`.`id` AS `Id_Article`,
`i`.`hasKgPrice` AS `hasKgPrice`,
`i`.`equivalent` AS `Equivalente`,
`i`.`isToPrint` AS `Imprimir`,
- `i`.`family` AS `Familia__`,
`i`.`doPhoto` AS `do_photo`,
`i`.`created` AS `odbc_date`,
`i`.`isFloramondo` AS `isFloramondo`,
diff --git a/db/routines/vn2008/views/state.sql b/db/routines/vn2008/views/state.sql
index 63f6589af..9f7fcccd8 100644
--- a/db/routines/vn2008/views/state.sql
+++ b/db/routines/vn2008/views/state.sql
@@ -6,7 +6,6 @@ AS SELECT `s`.`id` AS `id`,
`s`.`order` AS `order`,
`s`.`alertLevel` AS `alert_level`,
`s`.`code` AS `code`,
- `s`.`sectorProdPriority` AS `sectorProdPriority`,
`s`.`nextStateFk` AS `nextStateFk`,
`s`.`isPreviousPreparable` AS `isPreviousPreparable`,
`s`.`isPicked` AS `isPicked`
diff --git a/db/versions/11088-bronzeAspidistra/00-firstScript.sql b/db/versions/11088-bronzeAspidistra/00-firstScript.sql
new file mode 100644
index 000000000..5c56993fd
--- /dev/null
+++ b/db/versions/11088-bronzeAspidistra/00-firstScript.sql
@@ -0,0 +1,19 @@
+ALTER TABLE vn.collectionWagonTicket DROP FOREIGN KEY IF EXISTS collectionWagonTicket_tray;
+ALTER TABLE vn.wagonConfig DROP FOREIGN KEY IF EXISTS wagonConfig_wagonTypeColor_FK;
+CREATE OR REPLACE TABLE vn.wagonTypeTray (
+ id INT(11) UNSIGNED auto_increment,
+ wagonTypeFk INT(11) UNSIGNED NULL,
+ height INT(11) UNSIGNED NULL,
+ wagonTypeColorFk int(11) UNSIGNED NULL,
+ CONSTRAINT wagonTypeTray_pk PRIMARY KEY (id),
+ CONSTRAINT wagonTypeTray_wagonType_FK FOREIGN KEY (wagonTypeFk) REFERENCES vn.wagonType(id) ON DELETE CASCADE ON UPDATE RESTRICT,
+ CONSTRAINT wagonTypeTray_wagonTypeColor_FK FOREIGN KEY (wagonTypeColorFk) REFERENCES vn.wagonTypeColor(id)
+)
+ENGINE=InnoDB
+DEFAULT CHARSET=utf8mb3
+COLLATE=utf8mb3_unicode_ci;
+
+ALTER TABLE vn.wagonConfig ADD IF NOT EXISTS defaultHeight INT UNSIGNED DEFAULT 0 NULL COMMENT 'Default height in cm for a base tray';
+ALTER TABLE vn.wagonConfig ADD IF NOT EXISTS defaultTrayColorFk int(11) UNSIGNED NULL COMMENT 'Default color for a base tray';
+ALTER TABLE vn.wagonConfig ADD CONSTRAINT wagonConfig_wagonTypeColor_FK FOREIGN KEY (defaultTrayColorFk) REFERENCES vn.wagonTypeColor(id);
+ALTER TABLE vn.collectionWagonTicket ADD CONSTRAINT collectionWagonTicket_tray FOREIGN KEY (trayFk) REFERENCES vn.wagonTypeTray(id);
diff --git a/db/versions/11107-pinkAspidistra/00-firstScript.sql b/db/versions/11107-pinkAspidistra/00-firstScript.sql
new file mode 100644
index 000000000..62af9c306
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/00-firstScript.sql
@@ -0,0 +1,13 @@
+CREATE OR REPLACE TABLE `util`.`logCleanMultiConfig` (
+ `schemaName` varchar(64) NOT NULL,
+ `tableName` varchar(64) NOT NULL,
+ `retentionDays` int(11) DEFAULT NULL,
+ `order` int(11) DEFAULT NULL,
+ `started` datetime DEFAULT NULL,
+ `finished` datetime DEFAULT NULL,
+ PRIMARY KEY (`schemaName`,`tableName`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
+
+INSERT INTO `util`.`logCleanMultiConfig` (`schemaName`, `tableName`)
+ SELECT TABLE_SCHEMA, TABLE_NAME FROM information_schema.`COLUMNS`
+ WHERE COLUMN_NAME IN ('newInstance', 'newInstance');
diff --git a/db/versions/11107-pinkAspidistra/01-firstScript.sql b/db/versions/11107-pinkAspidistra/01-firstScript.sql
new file mode 100644
index 000000000..426fcc5b8
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/01-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX userLog_creationDate_IDX USING BTREE ON account.userLog (creationDate DESC);
diff --git a/db/versions/11107-pinkAspidistra/02-firstScript.sql b/db/versions/11107-pinkAspidistra/02-firstScript.sql
new file mode 100644
index 000000000..e916754e3
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/02-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX roleLog_creationDate_IDX USING BTREE ON account.roleLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/03-firstScript.sql b/db/versions/11107-pinkAspidistra/03-firstScript.sql
new file mode 100644
index 000000000..f7400c866
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/03-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX ACLLog_creationDate_IDX USING BTREE ON salix.ACLLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/04-firstScript.sql b/db/versions/11107-pinkAspidistra/04-firstScript.sql
new file mode 100644
index 000000000..0c118284e
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/04-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX supplierLog_creationDate_IDX USING BTREE ON vn.supplierLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/05-firstScript.sql b/db/versions/11107-pinkAspidistra/05-firstScript.sql
new file mode 100644
index 000000000..5cb4070bb
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/05-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX deviceProductionLog_creationDate_IDX USING BTREE ON vn.deviceProductionLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/06-firstScript.sql b/db/versions/11107-pinkAspidistra/06-firstScript.sql
new file mode 100644
index 000000000..332b8a60a
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/06-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX routeLog_creationDate_IDX USING BTREE ON vn.routeLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/07-firstScript.sql b/db/versions/11107-pinkAspidistra/07-firstScript.sql
new file mode 100644
index 000000000..b80f8b75f
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/07-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX itemLog_creationDate_IDX USING BTREE ON vn.itemLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/08-firstScript.sql b/db/versions/11107-pinkAspidistra/08-firstScript.sql
new file mode 100644
index 000000000..315f9b256
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/08-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX userLog_creationDate_IDX USING BTREE ON vn.userLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/09-firstScript.sql b/db/versions/11107-pinkAspidistra/09-firstScript.sql
new file mode 100644
index 000000000..7bb604915
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/09-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX invoiceInLog_creationDate_IDX USING BTREE ON vn.invoiceInLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/10-firstScript.sql b/db/versions/11107-pinkAspidistra/10-firstScript.sql
new file mode 100644
index 000000000..06e186e0e
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/10-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX zoneLog_creationDate_IDX USING BTREE ON vn.zoneLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/11-firstScript.sql b/db/versions/11107-pinkAspidistra/11-firstScript.sql
new file mode 100644
index 000000000..be539e7b0
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/11-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX clientLog_creationDate_IDX USING BTREE ON vn.clientLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/12-firstScript.sql b/db/versions/11107-pinkAspidistra/12-firstScript.sql
new file mode 100644
index 000000000..4abc284b6
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/12-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX workerLog_creationDate_IDX USING BTREE ON vn.workerLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/14-firstScript.sql b/db/versions/11107-pinkAspidistra/14-firstScript.sql
new file mode 100644
index 000000000..02d2a37b0
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/14-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX rateLog_creationDate_IDX USING BTREE ON vn.rateLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/15-firstScript.sql b/db/versions/11107-pinkAspidistra/15-firstScript.sql
new file mode 100644
index 000000000..ad75ff6d0
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/15-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX claimLog_creationDate_IDX USING BTREE ON vn.claimLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/17-firstScript.sql b/db/versions/11107-pinkAspidistra/17-firstScript.sql
new file mode 100644
index 000000000..3de084bcf
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/17-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX packingSiteDeviceLog_creationDate_IDX USING BTREE ON vn.packingSiteDeviceLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/18-firstScript.sql b/db/versions/11107-pinkAspidistra/18-firstScript.sql
new file mode 100644
index 000000000..1181f8263
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/18-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX travelLog_creationDate_IDX USING BTREE ON vn.travelLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/19-firstScript.sql b/db/versions/11107-pinkAspidistra/19-firstScript.sql
new file mode 100644
index 000000000..e95f93031
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/19-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX shelvingLog_creationDate_IDX USING BTREE ON vn.shelvingLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/20-firstScript.sql b/db/versions/11107-pinkAspidistra/20-firstScript.sql
new file mode 100644
index 000000000..d3598466d
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/20-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX productionConfigLog_creationDate_IDX USING BTREE ON vn.productionConfigLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/21-firstScript.sql b/db/versions/11107-pinkAspidistra/21-firstScript.sql
new file mode 100644
index 000000000..5db8d3c63
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/21-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX entryLog_creationDate_IDX USING BTREE ON vn.entryLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/22-firstScript.sql b/db/versions/11107-pinkAspidistra/22-firstScript.sql
new file mode 100644
index 000000000..91e68c43b
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/22-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX agencyLog_creationDate_IDX USING BTREE ON vn.agencyLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/23-firstScript.sql b/db/versions/11107-pinkAspidistra/23-firstScript.sql
new file mode 100644
index 000000000..edd79473e
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/23-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX parkingLog_creationDate_IDX USING BTREE ON vn.parkingLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/24-firstScript.sql b/db/versions/11107-pinkAspidistra/24-firstScript.sql
new file mode 100644
index 000000000..81e84c405
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/24-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX bufferLog_creationDate_IDX USING BTREE ON srt.bufferLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11108-redRose/00-firstScript.sql b/db/versions/11108-redRose/00-firstScript.sql
new file mode 100644
index 000000000..e70291e8f
--- /dev/null
+++ b/db/versions/11108-redRose/00-firstScript.sql
@@ -0,0 +1,6 @@
+-- Place your SQL code here
+INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
+ VALUES
+ ('MedicalReview', '*', '*', 'ALLOW', 'ROLE', 'hr'),
+ ('MedicalCenter', '*', '*', 'ALLOW', 'ROLE', 'hr'),
+ ('Worker', '__get__medicalReview', '*', 'ALLOW', 'ROLE', 'hr');
diff --git a/db/versions/11112-blackRose/00-firstScript.sql b/db/versions/11112-blackRose/00-firstScript.sql
new file mode 100644
index 000000000..c26149240
--- /dev/null
+++ b/db/versions/11112-blackRose/00-firstScript.sql
@@ -0,0 +1,13 @@
+UPDATE `salix`.`ACL`
+ SET accessType='READ'
+ WHERE model = 'ACL';
+
+UPDATE `salix`.`ACL`
+ SET principalId='developerBoss'
+ WHERE model = 'AccessToken';
+
+INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId)
+ VALUES
+ ('VnToken', '*', 'READ', 'ALLOW', 'ROLE', 'developer'),
+ ('VnToken', 'killSession', '*', 'ALLOW', 'ROLE', 'developer'),
+ ('ACL', '*', 'WRITE', 'ALLOW', 'ROLE', 'developerBoss');
diff --git a/db/versions/11113-bronzeDendro/00-firstScript.sql b/db/versions/11113-bronzeDendro/00-firstScript.sql
new file mode 100644
index 000000000..63db65378
--- /dev/null
+++ b/db/versions/11113-bronzeDendro/00-firstScript.sql
@@ -0,0 +1,16 @@
+ALTER TABLE IF EXISTS `vn`.`payrollWorker`
+ MODIFY COLUMN IF EXISTS `nss__` varchar(23) NOT NULL COMMENT '@deprecated 2024-03-15',
+ MODIFY COLUMN IF EXISTS `codpuesto__` int(10) NOT NULL COMMENT '@deprecated 2024-03-15',
+ MODIFY COLUMN IF EXISTS `codcontrato__` int(10) NOT NULL COMMENT '@deprecated 2024-03-15',
+ MODIFY COLUMN IF EXISTS `FAntiguedad__` date NOT NULL COMMENT '@deprecated 2024-03-15',
+ MODIFY COLUMN IF EXISTS `grupotarifa__` int(10) NOT NULL COMMENT '@deprecated 2024-03-15',
+ MODIFY COLUMN IF EXISTS `codcategoria__` int(10) NOT NULL COMMENT '@deprecated 2024-03-15',
+ MODIFY COLUMN IF EXISTS `ContratoTemporal__` tinyint(1) NOT NULL DEFAULT 0 COMMENT '@deprecated 2024-03-15';
+
+ALTER TABLE IF EXISTS `vn`.`payrollWorkCenter`
+ MODIFY COLUMN IF EXISTS `Centro__` varchar(255) NOT NULL COMMENT '@deprecated 2024-03-15',
+ MODIFY COLUMN IF EXISTS `nss_cotizacion__` varchar(15) NOT NULL COMMENT '@deprecated 2024-03-15',
+ MODIFY COLUMN IF EXISTS `domicilio__` varchar(255) NOT NULL COMMENT '@deprecated 2024-03-15',
+ MODIFY COLUMN IF EXISTS `poblacion__` varchar(45) NOT NULL COMMENT '@deprecated 2024-03-15',
+ MODIFY COLUMN IF EXISTS `cp__` varchar(5) NOT NULL COMMENT '@deprecated 2024-03-15',
+ MODIFY COLUMN IF EXISTS `empresa_id__` int(10) NOT NULL COMMENT '@deprecated 2024-03-15';
diff --git a/db/versions/11115-turquoiseRose/00-firstScript.sql b/db/versions/11115-turquoiseRose/00-firstScript.sql
new file mode 100644
index 000000000..3982936fc
--- /dev/null
+++ b/db/versions/11115-turquoiseRose/00-firstScript.sql
@@ -0,0 +1,30 @@
+-- Place your SQL code here
+-- vn.stockBought definition
+
+CREATE TABLE IF NOT EXISTS vn.stockBought (
+ id INT UNSIGNED auto_increment NOT NULL,
+ workerFk int(10) unsigned NOT NULL,
+ bought decimal(10,2) NOT NULL COMMENT 'purchase volume in m3 for the day',
+ reserve decimal(10,2) NULL COMMENT 'reserved volume in m3 for the day',
+ dated DATE NOT NULL DEFAULT current_timestamp(),
+ CONSTRAINT stockBought_pk PRIMARY KEY (id),
+ CONSTRAINT stockBought_unique UNIQUE KEY (workerFk,dated),
+ CONSTRAINT stockBought_worker_FK FOREIGN KEY (workerFk) REFERENCES vn.worker(id)
+)
+ENGINE=InnoDB
+DEFAULT CHARSET=utf8mb3
+COLLATE=utf8mb3_unicode_ci;
+
+
+INSERT IGNORE vn.stockBought (workerFk, bought, reserve, dated)
+ SELECT userFk, SUM(buyed), SUM(IFNULL(reserved,0)), dated
+ FROM vn.stockBuyed
+ WHERE userFk IS NOT NULL
+ AND buyed IS NOT NULL
+ GROUP BY userFk, dated;
+
+INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
+ VALUES ('StockBought','*','READ','ALLOW','ROLE','buyer'),
+ ('StockBought','*','WRITE','ALLOW','ROLE','buyer'),
+ ('Buyer','*','READ','ALLOW','ROLE','buyer');
+
diff --git a/db/versions/11124-greenBamboo/01-firstScript.sql b/db/versions/11124-greenBamboo/01-firstScript.sql
index 9cacbd5ff..af3a40f14 100644
--- a/db/versions/11124-greenBamboo/01-firstScript.sql
+++ b/db/versions/11124-greenBamboo/01-firstScript.sql
@@ -1,4 +1,5 @@
-- Calculamos todos los volumenes de todos los tickets una sola vez
+/* Se ejecutará el dia de test - master manualmente para no hacer lenta la subida
CREATE OR REPLACE TEMPORARY TABLE tmp.tTicketVolume
(PRIMARY KEY (id))
ENGINE = MEMORY
@@ -14,3 +15,4 @@ UPDATE vn.ticket t
SET t.volume = tv.volume;
DROP TEMPORARY TABLE tmp.tTicketVolume;
+*/
diff --git a/db/versions/11178-yellowCamellia/00-aclSetWeight.sql b/db/versions/11178-yellowCamellia/00-aclSetWeight.sql
new file mode 100644
index 000000000..d70287738
--- /dev/null
+++ b/db/versions/11178-yellowCamellia/00-aclSetWeight.sql
@@ -0,0 +1,9 @@
+-- Place your SQL code here
+INSERT INTO salix.ACL
+ SET model = 'Ticket',
+ property = 'setWeight',
+ accessType = 'WRITE',
+ permission = 'ALLOW',
+ principalType = 'ROLE',
+ principalId = 'salesPerson';
+
\ No newline at end of file
diff --git a/db/versions/11183-limePhormium/00-firstScript.sql b/db/versions/11183-limePhormium/00-firstScript.sql
new file mode 100644
index 000000000..a30338f9e
--- /dev/null
+++ b/db/versions/11183-limePhormium/00-firstScript.sql
@@ -0,0 +1,23 @@
+CREATE OR REPLACE TABLE `vn`.`saleGroupLog` (
+ `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('SaleGroup', 'SaleGroupDetail') NOT NULL DEFAULT 'SaleGroup',
+ `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,
+ `summaryId` varchar(30) DEFAULT NULL,
+ `reason` varchar(255) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `saleGroupUserFk` (`userFk`),
+ KEY `saleGroupLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`),
+ KEY `saleGroupLog_originFk` (`originFk`,`creationDate`),
+ CONSTRAINT `saleGroupLogUserFk` 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.parkingLog
+ MODIFY COLUMN changedModel enum('Parking') CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT 'Parking' NOT NULL;
diff --git a/db/versions/11196-blackCymbidium/00-firstScript.sql b/db/versions/11196-blackCymbidium/00-firstScript.sql
new file mode 100644
index 000000000..e05225204
--- /dev/null
+++ b/db/versions/11196-blackCymbidium/00-firstScript.sql
@@ -0,0 +1,7 @@
+RENAME TABLE vn.quadMindsApiConfig TO vn.quadmindsApiConfig;
+
+ALTER TABLE vn.quadmindsApiConfig
+ ADD maxObjects INT NULL COMMENT 'Número máximo de objetos en el array por petición',
+ ADD `limit` INT NULL COMMENT 'Limite de objetos solicitados por petición',
+ ADD `orderTimeFrom` VARCHAR(5) NULL COMMENT 'Inicio de ventana horaria de pedido',
+ ADD `orderTimeTo` VARCHAR(5) NULL COMMENT 'Fin de ventana horaria de pedido';
diff --git a/db/versions/11205-grayCymbidium/00-firstScript.sql b/db/versions/11205-grayCymbidium/00-firstScript.sql
new file mode 100644
index 000000000..ba3ab60e1
--- /dev/null
+++ b/db/versions/11205-grayCymbidium/00-firstScript.sql
@@ -0,0 +1,2 @@
+-- Place your SQL code here
+ALTER TABLE dipole.expedition_PrintOut MODIFY COLUMN isPrinted int(11) DEFAULT 0 NOT NULL COMMENT '0.- Not Printed ; 1.- Printed; 2.- Selected ; 3.- Error ; 4.- Waiting to be printed';
diff --git a/db/versions/11206-turquoiseCyca/00-firstScript.sql b/db/versions/11206-turquoiseCyca/00-firstScript.sql
new file mode 100644
index 000000000..ab6b35a0f
--- /dev/null
+++ b/db/versions/11206-turquoiseCyca/00-firstScript.sql
@@ -0,0 +1,2 @@
+INSERT IGNORE INTO salix.ACL (model,property,principalId)
+ VALUES ('Entry','getBuysCsv','supplier');
diff --git a/db/versions/11207-turquoiseMastic/00-firstScript.sql b/db/versions/11207-turquoiseMastic/00-firstScript.sql
new file mode 100644
index 000000000..d1fd184aa
--- /dev/null
+++ b/db/versions/11207-turquoiseMastic/00-firstScript.sql
@@ -0,0 +1,2 @@
+INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId)
+ VALUES ('InvoiceOut','refundAndInvoice','WRITE','ALLOW','ROLE','administrative');
diff --git a/db/versions/11209-pinkOrchid/00-firstScript.sql b/db/versions/11209-pinkOrchid/00-firstScript.sql
new file mode 100644
index 000000000..92a7a7569
--- /dev/null
+++ b/db/versions/11209-pinkOrchid/00-firstScript.sql
@@ -0,0 +1,6 @@
+ALTER TABLE vn.operator
+ MODIFY COLUMN sizeLimit int(10) unsigned DEFAULT NULL NULL COMMENT 'Límite de altura en una colección para la asignación de pedidos';
+
+UPDATE vn.operator
+ SET sizeLimit = 90
+ WHERE itemPackingTypeFk = 'V';
diff --git a/db/versions/11210-greenDendro/00-firstScript.sql b/db/versions/11210-greenDendro/00-firstScript.sql
new file mode 100644
index 000000000..58e6450d6
--- /dev/null
+++ b/db/versions/11210-greenDendro/00-firstScript.sql
@@ -0,0 +1,8 @@
+ALTER TABLE util.config
+ CHANGE dbVersion dbVersion__ char(11) DEFAULT NULL COMMENT '@deprecated 2024-09-02 refs #7819';
+
+ALTER TABLE util.config
+ CHANGE hasTriggersDisabled hasTriggersDisabled__ tinyint(1) DEFAULT 0 NOT NULL COMMENT '@deprecated 2024-09-02 refs #7819';
+
+RENAME TABLE account.accountLog TO account.accountLog__;
+ ALTER TABLE account.accountLog__ COMMENT='@deprecated 2024-09-02 refs #7819';
diff --git a/db/versions/11210-greenDendro/01-firstScript.sql b/db/versions/11210-greenDendro/01-firstScript.sql
new file mode 100644
index 000000000..787011343
--- /dev/null
+++ b/db/versions/11210-greenDendro/01-firstScript.sql
@@ -0,0 +1 @@
+DROP DATABASE IF EXISTS `.mysqlworkbench`;
\ No newline at end of file
diff --git a/db/versions/11210-greenDendro/02-firstScript.sql b/db/versions/11210-greenDendro/02-firstScript.sql
new file mode 100644
index 000000000..2603c5df5
--- /dev/null
+++ b/db/versions/11210-greenDendro/02-firstScript.sql
@@ -0,0 +1,84 @@
+ALTER TABLE bi.rutasBoard DROP COLUMN coste_bulto__;
+ALTER TABLE bi.rutasBoard DROP COLUMN Dia__;
+ALTER TABLE bi.rutasBoard DROP COLUMN km__;
+ALTER TABLE bi.rutasBoard DROP COLUMN m3__;
+ALTER TABLE bi.rutasBoard DROP COLUMN Matricula__;
+ALTER TABLE bi.rutasBoard DROP COLUMN month__;
+ALTER TABLE bi.rutasBoard DROP COLUMN Terceros__;
+ALTER TABLE bi.rutasBoard DROP COLUMN Tipo__;
+ALTER TABLE bi.rutasBoard DROP COLUMN warehouse_id__;
+ALTER TABLE bi.rutasBoard DROP COLUMN year__;
+
+ALTER TABLE bs.clientDied DROP COLUMN Boss__;
+ALTER TABLE bs.clientDied DROP COLUMN clientName__;
+ALTER TABLE bs.clientDied DROP COLUMN workerCode__;
+
+ALTER TABLE bs.salesByItemTypeDay DROP COLUMN netSale__;
+
+ALTER TABLE vn.agency DROP FOREIGN KEY agency_FK;
+ALTER TABLE vn.agency DROP COLUMN warehouseAliasFk__;
+
+ALTER TABLE vn.awbComponent DROP COLUMN dated__;
+
+ALTER TABLE vn.buy DROP COLUMN containerFk__;
+
+ALTER TABLE vn.chat DROP COLUMN status__;
+
+ALTER TABLE vn.claim DROP COLUMN rma__;
+
+ALTER TABLE vn.client DROP COLUMN clientTypeFk__;
+ALTER TABLE vn.client DROP COLUMN hasIncoterms__;
+
+ALTER TABLE vn.clientType DROP COLUMN id__;
+
+ALTER TABLE vn.cmr DROP FOREIGN KEY cmr_fk1;
+ALTER TABLE vn.cmr DROP COLUMN ticketFk__;
+
+ALTER TABLE vn.company DROP COLUMN sage200Company__;
+
+ALTER TABLE vn.country DROP FOREIGN KEY country_FK;
+ALTER TABLE vn.country DROP COLUMN politicalCountryFk__;
+
+ALTER TABLE vn.deliveryNote DROP FOREIGN KEY albaran_FK;
+ALTER TABLE vn.deliveryNote DROP COLUMN farmingFk__;
+
+ALTER TABLE vn.dmsType DROP COLUMN path__;
+
+ALTER TABLE vn.dua DROP COLUMN awbFk__;
+
+ALTER TABLE vn.entry DROP COLUMN isBlocked__;
+
+ALTER TABLE vn.expedition DROP COLUMN itemFk__;
+
+ALTER TABLE vn.item DROP COLUMN minQuantity__;
+ALTER TABLE vn.item DROP COLUMN packingShelve__;
+
+ALTER TABLE vn.itemType DROP COLUMN compression__;
+ALTER TABLE vn.itemType DROP COLUMN density__;
+ALTER TABLE vn.itemType DROP COLUMN hasComponents__;
+ALTER TABLE vn.itemType DROP COLUMN location__;
+ALTER TABLE vn.itemType DROP COLUMN maneuver__;
+ALTER TABLE vn.itemType DROP COLUMN profit__;
+ALTER TABLE vn.itemType DROP COLUMN target__;
+ALTER TABLE vn.itemType DROP COLUMN topMargin__;
+ALTER TABLE vn.itemType DROP COLUMN transaction__;
+ALTER TABLE vn.itemType DROP FOREIGN KEY warehouseFk5;
+ALTER TABLE vn.itemType DROP COLUMN warehouseFk__;
+
+ALTER TABLE vn.ledgerConfig DROP COLUMN lastBookEntry__;
+
+ALTER TABLE vn.saleTracking DROP FOREIGN KEY saleTracking_FK_1;
+ALTER TABLE vn.saleTracking DROP COLUMN actionFk__;
+
+ALTER TABLE vn.supplier DROP COLUMN isFarmer__;
+
+ALTER TABLE vn.supplierAccount DROP COLUMN description__;
+
+ALTER TABLE vn.ticketRequest DROP COLUMN buyerCode__;
+
+ALTER TABLE vn.travel DROP COLUMN agencyFk__;
+
+ALTER TABLE vn.warehouse DROP FOREIGN KEY warehouse_ibfk_2;
+ALTER TABLE vn.warehouse DROP COLUMN aliasFk__;
+
+ALTER TABLE vn.worker DROP COLUMN labelerFk__;
diff --git a/db/versions/11210-greenDendro/03-firstScript.sql b/db/versions/11210-greenDendro/03-firstScript.sql
new file mode 100644
index 000000000..f8157b756
--- /dev/null
+++ b/db/versions/11210-greenDendro/03-firstScript.sql
@@ -0,0 +1,21 @@
+DROP TABLE IF EXISTS account.mailClientAccess__;
+DROP TABLE IF EXISTS account.mailSenderAccess__;
+DROP TABLE IF EXISTS bi.analisis_ventas_familia_evolution__;
+DROP TABLE IF EXISTS bi.live_counter__;
+DROP TABLE IF EXISTS bi.partitioning_information__;
+DROP TABLE IF EXISTS bi.primer_pedido__;
+DROP TABLE IF EXISTS bi.tarifa_premisas__;
+DROP TABLE IF EXISTS bi.tarifa_warehouse__;
+DROP TABLE IF EXISTS bs.compradores__;
+DROP TABLE IF EXISTS bs.salesMonthlySnapshot___;
+DROP TABLE IF EXISTS bs.salesPerson__;
+DROP TABLE IF EXISTS bs.vendedores_evolution__;
+DROP TABLE IF EXISTS vn.botanicExport__;
+DROP TABLE IF EXISTS vn.claimRma__;
+DROP TABLE IF EXISTS vn.coolerPathDetail__;
+DROP TABLE IF EXISTS vn.forecastedBalance__;
+DROP TABLE IF EXISTS vn.routeLoadWorker__;
+DROP TABLE IF EXISTS vn.routeUserPercentage__;
+DROP TABLE IF EXISTS vn.ticketSms__;
+DROP TABLE IF EXISTS vn.ticketTrackingState__;
+DROP TABLE IF EXISTS vn.warehouseAlias__;
diff --git a/db/versions/11211-greenCataractarum/00-firstScript.sql b/db/versions/11211-greenCataractarum/00-firstScript.sql
new file mode 100644
index 000000000..c9ba73479
--- /dev/null
+++ b/db/versions/11211-greenCataractarum/00-firstScript.sql
@@ -0,0 +1 @@
+ALTER TABLE vn.parking ADD COLUMN floor VARCHAR(5) DEFAULT NULL AFTER row;
diff --git a/db/versions/11213-aquaCarnation/00-firstScript.sql b/db/versions/11213-aquaCarnation/00-firstScript.sql
new file mode 100644
index 000000000..9e744b66c
--- /dev/null
+++ b/db/versions/11213-aquaCarnation/00-firstScript.sql
@@ -0,0 +1,129 @@
+
+use vn;
+
+CREATE TABLE IF NOT EXISTS `material` (
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `name` varchar(50) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `name_UNIQUE` (`name`)
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
+
+INSERT IGNORE INTO `material` (`name`) VALUES ('Abedul');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Acacia');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Acero');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Acero Galvanizado');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Acetato');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Acrílico');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Alambre');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Algodón');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Aluminio');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Antracita');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Arcilla');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Bambú');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Banano');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Canneté');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Cartón');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Cartulina');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Celofán');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Cemento');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Cera');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Cerámica');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Chapa');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Chenilla');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Cloruro de polivinilo');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Cobre');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Corcho');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Cordel');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Cotton');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Cotton Chess');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Cristal');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Cubo Asa');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Cuerda');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Cuero');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Doble Raso');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Doble Velvet');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Eco Glass');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Encaje');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Esparto');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Espuma');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Felpa');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Fibra');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Fibra de Coco');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Fibra de Vidrio y Resina');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Fieltro');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Foam');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Gamuza');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Gasa');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Glass');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Goma');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Grafito');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Hierro');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Hoja Carbono');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Hoja de Mirto');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Hormigón');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Jute');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Kraft');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Lana');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Látex');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Latrix');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Lienzo');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Lino');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Lurex');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Madera');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Metacrilato');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Metal');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Mimbre');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Musgo');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Nonwoven');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Nylon');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Organza');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Paja');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Pana');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Papel');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Paperweb');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Paulownia');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Peluche');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Piedra');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Pizarra');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Plástico');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Poliestireno');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Polipropileno');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Poliresina');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Polyester');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Porcelana');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Puntilla');
+INSERT IGNORE INTO `material` (`name`) VALUES ('PVC');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Rafia');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Rama');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Raso');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Rattan');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Rayon');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Reciclable');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Red');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Resina');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Roca');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Rope');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Saco');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Salim');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Seagrass');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Silicona');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Sisal');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Tejido');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Tela');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Terciopelo');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Terracota');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Textil');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Titanio');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Tul');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Velvet');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Vidrio');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Yute');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Zinc');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Base de goma');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Base de madera');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Plumas');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Protección Uva');
+INSERT IGNORE INTO `material` (`name`) VALUES ('Purpurina');
+
+UPDATE vn.tag SET isFree=0,sourceTable='material' WHERE name= 'Material';
+UPDATE vn.tag SET isFree=0,sourceTable='material' WHERE name='Material secundario';
\ No newline at end of file
diff --git a/db/versions/11215-purpleIvy/00-firstScript.sql b/db/versions/11215-purpleIvy/00-firstScript.sql
new file mode 100644
index 000000000..ac82b7773
--- /dev/null
+++ b/db/versions/11215-purpleIvy/00-firstScript.sql
@@ -0,0 +1,4 @@
+-- Place your SQL code here
+INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
+ VALUES ('Worker', '__get__descriptor', 'READ', 'ALLOW', 'ROLE', 'employee'),
+ ('Worker', 'findById', 'READ', 'ALLOW', 'ROLE', '$subordinate');
\ No newline at end of file
diff --git a/db/versions/11216-salmonPaniculata/00-firstScript.sql b/db/versions/11216-salmonPaniculata/00-firstScript.sql
new file mode 100644
index 000000000..956dcc25b
--- /dev/null
+++ b/db/versions/11216-salmonPaniculata/00-firstScript.sql
@@ -0,0 +1,12 @@
+-- Place your SQL code here
+DELETE FROM salix.ACL WHERE model = 'Province' LIMIT 1;
+DELETE FROM salix.ACL WHERE model = 'Town' LIMIT 1;
+
+UPDATE salix.ACL SET accessType = 'READ' WHERE model = 'BankEntity';
+INSERT INTO salix.ACL
+ SET model = 'BankEntity',
+ property = '*',
+ accessType = 'WRITE',
+ permission = 'ALLOW',
+ principalType = 'ROLE',
+ principalId = 'financial';
diff --git a/db/versions/11217-greenDracena/00-hederaMessages.sql b/db/versions/11217-greenDracena/00-hederaMessages.sql
new file mode 100644
index 000000000..f6c9bdce3
--- /dev/null
+++ b/db/versions/11217-greenDracena/00-hederaMessages.sql
@@ -0,0 +1,19 @@
+INSERT INTO hedera.message (code,description)
+ VALUES ('ORDER_ROW_UNAVAILABLE','The ordered quantity exceeds the available');
+INSERT INTO hedera.message (code,description)
+ VALUES ('AMOUNT_NOT_MATCH_GROUPING','The quantity ordered does not match the grouping');
+
+INSERT INTO hedera.messageI18n (code,lang,description)
+ VALUES ('ORDER_ROW_UNAVAILABLE','es','La cantidad pedida excede el disponible');
+INSERT INTO hedera.messageI18n (code,lang,description)
+ VALUES ('AMOUNT_NOT_MATCH_GROUPING','es','La cantidad pedida no coincide con el agrupado');
+
+INSERT INTO hedera.messageI18n (code,lang,description)
+ VALUES ('ORDER_ROW_UNAVAILABLE','fr','La quantité demandée dépasse ce qui est disponible');
+INSERT INTO hedera.messageI18n (code,lang,description)
+ VALUES ('AMOUNT_NOT_MATCH_GROUPING','fr','La quantité commandée ne correspond pas au regroupement');
+
+INSERT INTO hedera.messageI18n (code,lang,description)
+ VALUES ('ORDER_ROW_UNAVAILABLE','pt','A quantidade de entrega excede a disponibilidade');
+INSERT INTO hedera.messageI18n (code,lang,description)
+ VALUES ('AMOUNT_NOT_MATCH_GROUPING','pt','A quantidade solicitada não corresponde ao agrupamento');
diff --git a/db/versions/11219-goldenCataractarum/00-firstScript.sql b/db/versions/11219-goldenCataractarum/00-firstScript.sql
new file mode 100644
index 000000000..4c4b9eac5
--- /dev/null
+++ b/db/versions/11219-goldenCataractarum/00-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX saleGroupLog_creationDate_IDX USING BTREE ON vn.saleGroupLog (creationDate DESC);
diff --git a/db/versions/11221-chocolateSalal/00-firstScript.sql b/db/versions/11221-chocolateSalal/00-firstScript.sql
new file mode 100644
index 000000000..bca742585
--- /dev/null
+++ b/db/versions/11221-chocolateSalal/00-firstScript.sql
@@ -0,0 +1,9 @@
+-- Place your SQL code here
+CREATE TABLE IF NOT EXISTS vn.ticketCanAdvanceConfig (
+ id int(10) unsigned NOT NULL,
+ destinationOrder INT NULL,
+ PRIMARY KEY (`id`),
+ CONSTRAINT `ticketCanAdvanceConfig_check` CHECK (`id` = 1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
+
+INSERT INTO vn.ticketCanAdvanceConfig SET id =1, destinationOrder = 5;
\ No newline at end of file
diff --git a/db/versions/11222-azureCordyline/00-firstScript.sql b/db/versions/11222-azureCordyline/00-firstScript.sql
new file mode 100644
index 000000000..c63228911
--- /dev/null
+++ b/db/versions/11222-azureCordyline/00-firstScript.sql
@@ -0,0 +1 @@
+ALTER TABLE vn.state DROP COLUMN sectorProdPriority;
diff --git a/db/versions/11223-turquoiseLilium/00-firstScript.sql b/db/versions/11223-turquoiseLilium/00-firstScript.sql
new file mode 100644
index 000000000..9003451c4
--- /dev/null
+++ b/db/versions/11223-turquoiseLilium/00-firstScript.sql
@@ -0,0 +1,2 @@
+INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
+VALUES( 'Device', 'handleUser', '*', 'ALLOW', 'ROLE', 'employee');
\ No newline at end of file
diff --git a/db/versions/11224-whiteMastic/00-firstScript.sql b/db/versions/11224-whiteMastic/00-firstScript.sql
new file mode 100644
index 000000000..de74dfc55
--- /dev/null
+++ b/db/versions/11224-whiteMastic/00-firstScript.sql
@@ -0,0 +1,3 @@
+ALTER TABLE vn.creditInsurance DROP FOREIGN KEY CreditInsurance_Fk1;
+ALTER TABLE vn.creditInsurance
+ CHANGE creditClassification creditClassification__ int(11) DEFAULT NULL COMMENT '@deprecated 2024-09-11';
diff --git a/db/versions/11225-goldenLaurel/00-firstScript.sql b/db/versions/11225-goldenLaurel/00-firstScript.sql
new file mode 100644
index 000000000..87f521a03
--- /dev/null
+++ b/db/versions/11225-goldenLaurel/00-firstScript.sql
@@ -0,0 +1 @@
+ALTER TABLE vn.workerDocument CHANGE worker workerFk int(10) unsigned DEFAULT NULL NULL;
diff --git a/db/versions/11225-goldenLaurel/01-firstScript.sql b/db/versions/11225-goldenLaurel/01-firstScript.sql
new file mode 100644
index 000000000..3aa3a1876
--- /dev/null
+++ b/db/versions/11225-goldenLaurel/01-firstScript.sql
@@ -0,0 +1 @@
+ALTER TABLE vn.workerDocument CHANGE document dmsFk int(11) DEFAULT NULL NULL;
diff --git a/db/versions/11225-goldenLaurel/02-firstScript.sql b/db/versions/11225-goldenLaurel/02-firstScript.sql
new file mode 100644
index 000000000..d0e789534
--- /dev/null
+++ b/db/versions/11225-goldenLaurel/02-firstScript.sql
@@ -0,0 +1 @@
+RENAME TABLE vn.workerDocument TO vn.workerDms;
diff --git a/db/versions/11227-maroonEucalyptus/00-addWorkerTimeControlMailAcl.sql b/db/versions/11227-maroonEucalyptus/00-addWorkerTimeControlMailAcl.sql
new file mode 100644
index 000000000..330dcb839
--- /dev/null
+++ b/db/versions/11227-maroonEucalyptus/00-addWorkerTimeControlMailAcl.sql
@@ -0,0 +1,4 @@
+-- Place your SQL code here
+INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
+ VALUES ('WorkerTimeControlMail', 'count', 'READ', 'ALLOW', 'ROLE', 'employee'),
+ ('Worker', '__get__mail', 'READ', 'ALLOW', 'ROLE', 'hr');
diff --git a/db/versions/11229-salmonAsparagus/00-firstScript.sql b/db/versions/11229-salmonAsparagus/00-firstScript.sql
new file mode 100644
index 000000000..80547db38
--- /dev/null
+++ b/db/versions/11229-salmonAsparagus/00-firstScript.sql
@@ -0,0 +1,2 @@
+ALTER TABLE vn.productionConfig ADD IF NOT EXISTS minPlantTrayLength INT DEFAULT 53 NOT NULL
+COMMENT 'minimum length for plant tray restriction. Avoid to make collection of the ticket with this kind of item';
diff --git a/db/versions/11234-yellowRuscus/00-firstScript.sql b/db/versions/11234-yellowRuscus/00-firstScript.sql
new file mode 100644
index 000000000..2cbac598b
--- /dev/null
+++ b/db/versions/11234-yellowRuscus/00-firstScript.sql
@@ -0,0 +1,13 @@
+ALTER TABLE `vn`.`payrollWorkCenter` DROP PRIMARY KEY;
+ALTER TABLE `vn`.`payrollWorkCenter` DROP COLUMN `empresa_id__`;
+ALTER TABLE `vn`.`payrollWorkCenter` DROP COLUMN `Centro__`;
+ALTER TABLE `vn`.`payrollWorkCenter` DROP COLUMN `nss_cotizacion__`;
+ALTER TABLE `vn`.`payrollWorkCenter` DROP COLUMN `domicilio__`;
+ALTER TABLE `vn`.`payrollWorkCenter` DROP COLUMN `poblacion__`;
+ALTER TABLE `vn`.`payrollWorkCenter` DROP COLUMN `cp__`;
+ALTER TABLE `vn`.`payrollWorker` DROP COLUMN `nss__`;
+ALTER TABLE `vn`.`payrollWorker` DROP COLUMN `codpuesto__`;
+ALTER TABLE `vn`.`payrollWorker` DROP COLUMN `codcontrato__`;
+ALTER TABLE `vn`.`payrollWorker` DROP COLUMN `FAntiguedad__`;
+ALTER TABLE `vn`.`payrollWorker` DROP COLUMN `codcategoria__`;
+ALTER TABLE `vn`.`payrollWorker` DROP COLUMN `ContratoTemporal__`;
diff --git a/db/versions/11235-purpleCordyline/00-firstScript.sql b/db/versions/11235-purpleCordyline/00-firstScript.sql
new file mode 100644
index 000000000..f3bb6ddab
--- /dev/null
+++ b/db/versions/11235-purpleCordyline/00-firstScript.sql
@@ -0,0 +1,12 @@
+ALTER TABLE vn.collectionWagon DROP FOREIGN KEY IF EXISTS collectionWagon_FK_1;
+ALTER TABLE vn.collectionWagonTicket DROP FOREIGN KEY IF EXISTS collectionWagonTicket_FK_1;
+ALTER TABLE vn.wagonVolumetry DROP FOREIGN KEY IF EXISTS wagonVolumetry_FK_1;
+
+ALTER TABLE vn.wagon MODIFY COLUMN id int(11) unsigned auto_increment NOT NULL COMMENT '26 letras de alfabeto inglés';
+ALTER TABLE vn.collectionWagon MODIFY COLUMN wagonFk int(11) unsigned NOT NULL;
+ALTER TABLE vn.collectionWagonTicket MODIFY COLUMN wagonFk int(11) unsigned NOT NULL;
+ALTER TABLE vn.wagonVolumetry MODIFY COLUMN wagonFk int(11) unsigned NOT NULL;
+
+ALTER TABLE vn.collectionWagon ADD CONSTRAINT collectionWagon_FK_1 FOREIGN KEY (wagonFk) REFERENCES vn.wagon(id) ON DELETE RESTRICT ON UPDATE CASCADE;
+ALTER TABLE vn.collectionWagonTicket ADD CONSTRAINT collectionWagonTicket_FK_1 FOREIGN KEY (wagonFk) REFERENCES vn.wagon(id) ON DELETE RESTRICT ON UPDATE CASCADE;
+ALTER TABLE vn.wagonVolumetry ADD CONSTRAINT wagonVolumetry_FK_1 FOREIGN KEY (wagonFk) REFERENCES vn.wagon(id) ON DELETE RESTRICT ON UPDATE CASCADE;
diff --git a/db/versions/11236-blackMedeola/00-firstScript.sql b/db/versions/11236-blackMedeola/00-firstScript.sql
new file mode 100644
index 000000000..8729e40e1
--- /dev/null
+++ b/db/versions/11236-blackMedeola/00-firstScript.sql
@@ -0,0 +1,19 @@
+ALTER TABLE vn.addressWaste
+ MODIFY COLUMN `type` enum('external', 'fault', 'container', 'break', 'other')
+ CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL;
+
+UPDATE vn.addressWaste
+ SET `type`='container'
+ WHERE addressFk=77;
+
+UPDATE vn.addressWaste
+ SET `type`='fault'
+ WHERE addressFk=317;
+
+UPDATE vn.addressWaste
+ SET `type`='break'
+ WHERE addressFk=57702;
+
+UPDATE vn.addressWaste
+ SET `type`='other'
+ WHERE addressFk=43432;
diff --git a/db/versions/11236-blackMedeola/01-firstScript.sql b/db/versions/11236-blackMedeola/01-firstScript.sql
new file mode 100644
index 000000000..87262115b
--- /dev/null
+++ b/db/versions/11236-blackMedeola/01-firstScript.sql
@@ -0,0 +1,6 @@
+ALTER TABLE bs.waste
+ DROP COLUMN saleInternalWaste,
+ ADD saleFaultWaste decimal(10,2) DEFAULT NULL NULL,
+ ADD saleContainerWaste decimal(10,2) DEFAULT NULL NULL,
+ ADD saleBreakWaste decimal(10,2) DEFAULT NULL NULL,
+ ADD saleOtherWaste decimal(10,2) DEFAULT NULL NULL;
diff --git a/db/versions/11237-goldenBamboo/00-firstScript.sql b/db/versions/11237-goldenBamboo/00-firstScript.sql
new file mode 100644
index 000000000..3e387eba8
--- /dev/null
+++ b/db/versions/11237-goldenBamboo/00-firstScript.sql
@@ -0,0 +1,3 @@
+UPDATE bs.nightTask
+ SET `procedure` = 'waste_addSalesLauncher'
+ WHERE `procedure` = 'waste_addSales';
diff --git a/db/versions/11239-goldenBirch/00-firstScript.sql b/db/versions/11239-goldenBirch/00-firstScript.sql
new file mode 100644
index 000000000..559982081
--- /dev/null
+++ b/db/versions/11239-goldenBirch/00-firstScript.sql
@@ -0,0 +1,2 @@
+-- Place your SQL code here
+ALTER TABLE vn.packaging ADD IF NOT EXISTS isPlantTray BOOL DEFAULT FALSE NOT NULL COMMENT 'The container is a plant tray. Used to restrict the picking of full plant trays, to make previous picking.';
diff --git a/db/versions/11240-aquaCyca/00-firstScript.sql b/db/versions/11240-aquaCyca/00-firstScript.sql
new file mode 100644
index 000000000..97ad39ef1
--- /dev/null
+++ b/db/versions/11240-aquaCyca/00-firstScript.sql
@@ -0,0 +1 @@
+GRANT EXECUTE ON PROCEDURE bs.waste_addSales TO buyerBoss;
diff --git a/db/versions/11241-grayPalmetto/00-firstScript.sql b/db/versions/11241-grayPalmetto/00-firstScript.sql
new file mode 100644
index 000000000..b9ae692c6
--- /dev/null
+++ b/db/versions/11241-grayPalmetto/00-firstScript.sql
@@ -0,0 +1,2 @@
+ALTER TABLE vn.packaging ADD IF NOT EXISTS isPlantTray BOOL DEFAULT FALSE NOT NULL
+ COMMENT 'The container is a plant tray. Used to restrict the picking of full plant trays, to make previous picking.';
\ No newline at end of file
diff --git a/db/versions/11246-whiteMonstera/00-firstScript.sql b/db/versions/11246-whiteMonstera/00-firstScript.sql
new file mode 100644
index 000000000..72c46cf79
--- /dev/null
+++ b/db/versions/11246-whiteMonstera/00-firstScript.sql
@@ -0,0 +1 @@
+DELETE FROM salix.ACL WHERE model = 'Worker' AND property = 'findById' AND principalId = 'employee';
\ No newline at end of file
diff --git a/db/versions/11247-chocolateChico/00-firstScript.sql b/db/versions/11247-chocolateChico/00-firstScript.sql
new file mode 100644
index 000000000..8cbfebdde
--- /dev/null
+++ b/db/versions/11247-chocolateChico/00-firstScript.sql
@@ -0,0 +1,4 @@
+UPDATE salix.ACL SET principalId = 'employee' WHERE model = 'Worker' AND principalId = '$subordinate';
+INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
+VALUES ('Worker', '__get__advancedSummary', 'READ', 'ALLOW', 'ROLE', 'hr'),
+ ('Worker', '__get__summary', 'READ', 'ALLOW', 'ROLE', 'employee');
diff --git a/db/versions/11248-azureOrchid/00-firstScript.sql b/db/versions/11248-azureOrchid/00-firstScript.sql
new file mode 100644
index 000000000..a4a4bd740
--- /dev/null
+++ b/db/versions/11248-azureOrchid/00-firstScript.sql
@@ -0,0 +1,3 @@
+ALTER TABLE vn.`zone`
+ ADD COLUMN IF NOT EXISTS itemMaxLength int(11) NULL COMMENT 'Longitud maxima para articulos acostados que esa agencia puede transportar',
+ MODIFY COLUMN itemMaxSize int(11) DEFAULT NULL NULL COMMENT 'Altura maxima de los articulos que esa agencia puede transportar';
diff --git a/db/versions/11249-crimsonPhormium/00-firstScript.sql b/db/versions/11249-crimsonPhormium/00-firstScript.sql
new file mode 100644
index 000000000..32410c561
--- /dev/null
+++ b/db/versions/11249-crimsonPhormium/00-firstScript.sql
@@ -0,0 +1,3 @@
+-- Place your SQL code here
+ALTER TABLE vn.parking DROP FOREIGN KEY IF EXISTS parking_fk1;
+ALTER TABLE vn.parking ADD CONSTRAINT parking_fk1 FOREIGN KEY (sectorFk) REFERENCES vn.sector(id) ON DELETE RESTRICT ON UPDATE CASCADE;
diff --git a/db/versions/11253-limeChico/00-firstScript.sql b/db/versions/11253-limeChico/00-firstScript.sql
new file mode 100644
index 000000000..acf1de15c
--- /dev/null
+++ b/db/versions/11253-limeChico/00-firstScript.sql
@@ -0,0 +1,3 @@
+INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
+ VALUES ('Postcode','*','WRITE','ALLOW','ROLE','administrative');
+
diff --git a/db/versions/11254-tealCarnation/00-thermographTemperature.sql b/db/versions/11254-tealCarnation/00-thermographTemperature.sql
new file mode 100644
index 000000000..123e6c665
--- /dev/null
+++ b/db/versions/11254-tealCarnation/00-thermographTemperature.sql
@@ -0,0 +1,3 @@
+ALTER TABLE `vn`.`travelThermograph`
+ADD COLUMN `maxTemperature` DECIMAL(5,2) NULL AFTER `temperatureFk`,
+ADD COLUMN `minTemperature` DECIMAL(5,2) NULL AFTER `maxTemperature`;
diff --git a/db/versions/11254-tealCarnation/01-thermographFk.sql b/db/versions/11254-tealCarnation/01-thermographFk.sql
new file mode 100644
index 000000000..2baf99a45
--- /dev/null
+++ b/db/versions/11254-tealCarnation/01-thermographFk.sql
@@ -0,0 +1,2 @@
+ALTER TABLE `vn`.`travelThermograph` DROP FOREIGN KEY travelThermographDmsFgn;
+ALTER TABLE `vn`.`travelThermograph` ADD CONSTRAINT travelThermographDmsFgn FOREIGN KEY (dmsFk) REFERENCES vn.dms(id) ON DELETE CASCADE ON UPDATE CASCADE;
diff --git a/db/versions/11255-maroonRaphis/00-firstScript.sql b/db/versions/11255-maroonRaphis/00-firstScript.sql
new file mode 100644
index 000000000..7febf0e6c
--- /dev/null
+++ b/db/versions/11255-maroonRaphis/00-firstScript.sql
@@ -0,0 +1,2 @@
+ALTER TABLE vn.worker
+ CHANGE isF11Allowed isF11Allowed__ TINYINT(1) NOT NULL DEFAULT 0 COMMENT '@deprecated 2024-09-22';
\ No newline at end of file
diff --git a/db/versions/11256-grayFern/00-firstScript.sql b/db/versions/11256-grayFern/00-firstScript.sql
new file mode 100644
index 000000000..7dcd380a7
--- /dev/null
+++ b/db/versions/11256-grayFern/00-firstScript.sql
@@ -0,0 +1,6 @@
+INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
+ VALUES ('Province','*','WRITE','ALLOW','ROLE','administrative');
+
+INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
+ VALUES ('Town','*','WRITE','ALLOW','ROLE','administrative');
+
diff --git a/db/versions/11258-silverTulip/00-firstScript.sql b/db/versions/11258-silverTulip/00-firstScript.sql
new file mode 100644
index 000000000..79910fa76
--- /dev/null
+++ b/db/versions/11258-silverTulip/00-firstScript.sql
@@ -0,0 +1,31 @@
+-- vn.priceDelta definition
+
+CREATE OR REPLACE TABLE vn.priceDelta (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `itemTypeFk` smallint(5) unsigned NOT NULL,
+ `minSize` int(10) unsigned DEFAULT NULL COMMENT 'Minimum item.size',
+ `maxSize` int(10) unsigned DEFAULT NULL COMMENT 'Maximum item.size',
+ `inkFk` varchar(3) DEFAULT NULL,
+ `originFk` tinyint(2) unsigned DEFAULT NULL,
+ `producerFk` mediumint(3) unsigned DEFAULT NULL,
+ `fromDated` date DEFAULT NULL,
+ `toDated` date DEFAULT NULL,
+ `absIncreasing` decimal(10,3) DEFAULT NULL COMMENT 'Absolute increasing of final price',
+ `ratIncreasing` int(11) DEFAULT NULL COMMENT 'Increasing ratio for the cost price',
+ `warehouseFk` smallint(6) unsigned NOT NULL,
+ `created` timestamp NOT NULL DEFAULT current_timestamp(),
+ `editorFk` int(10) unsigned DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `priceDelta_itemType_FK` (`itemTypeFk`),
+ KEY `priceDelta_ink_FK` (`inkFk`),
+ KEY `priceDelta_producer_FK` (`producerFk`),
+ KEY `priceDelta_warehouse_FK` (`warehouseFk`),
+ KEY `priceDelta_worker_FK` (`editorFk`),
+ CONSTRAINT `priceDelta_ink_FK` FOREIGN KEY (`inkFk`) REFERENCES `ink` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `priceDelta_itemType_FK` FOREIGN KEY (`itemTypeFk`) REFERENCES `itemType` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `priceDelta_producer_FK` FOREIGN KEY (`producerFk`) REFERENCES `producer` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `priceDelta_warehouse_FK` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `priceDelta_worker_FK` FOREIGN KEY (`editorFk`) REFERENCES `worker` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Defines the increasing o decreasing for ranges of items';
+
+GRANT INSERT, SELECT, UPDATE, DELETE ON TABLE vn.priceDelta TO buyer;
\ No newline at end of file
diff --git a/db/versions/11260-navyCyca/00-firstScript.sql b/db/versions/11260-navyCyca/00-firstScript.sql
new file mode 100644
index 000000000..0824ea5f7
--- /dev/null
+++ b/db/versions/11260-navyCyca/00-firstScript.sql
@@ -0,0 +1,32 @@
+-- Place your SQL code here
+-- vn.priceDelta definition
+
+CREATE OR REPLACE TABLE vn.priceDelta (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `itemTypeFk` smallint(5) unsigned NOT NULL,
+ `minSize` int(10) unsigned DEFAULT NULL COMMENT 'Minimum item.size',
+ `maxSize` int(10) unsigned DEFAULT NULL COMMENT 'Maximum item.size',
+ `inkFk` varchar(3) DEFAULT NULL,
+ `originFk` tinyint(2) unsigned DEFAULT NULL,
+ `producerFk` mediumint(3) unsigned DEFAULT NULL,
+ `fromDated` date DEFAULT NULL,
+ `toDated` date DEFAULT NULL,
+ `absIncreasing` decimal(10,3) DEFAULT NULL COMMENT 'Absolute increasing of final price',
+ `ratIncreasing` int(11) DEFAULT NULL COMMENT 'Increasing ratio for the cost price',
+ `warehouseFk` smallint(6) unsigned NOT NULL,
+ `created` timestamp NOT NULL DEFAULT current_timestamp(),
+ `editorFk` int(10) unsigned DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `priceDelta_itemType_FK` (`itemTypeFk`),
+ KEY `priceDelta_ink_FK` (`inkFk`),
+ KEY `priceDelta_producer_FK` (`producerFk`),
+ KEY `priceDelta_warehouse_FK` (`warehouseFk`),
+ KEY `priceDelta_worker_FK` (`editorFk`),
+ CONSTRAINT `priceDelta_ink_FK` FOREIGN KEY (`inkFk`) REFERENCES `ink` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `priceDelta_itemType_FK` FOREIGN KEY (`itemTypeFk`) REFERENCES `itemType` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `priceDelta_producer_FK` FOREIGN KEY (`producerFk`) REFERENCES `producer` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `priceDelta_warehouse_FK` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `priceDelta_worker_FK` FOREIGN KEY (`editorFk`) REFERENCES `worker` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Defines the increasing o decreasing for ranges of items';
+
+GRANT INSERT, SELECT, UPDATE, DELETE ON TABLE vn.priceDelta TO buyer;
\ No newline at end of file
diff --git a/db/versions/11261-bronzeDracena/00-firstScript.sql b/db/versions/11261-bronzeDracena/00-firstScript.sql
new file mode 100644
index 000000000..1ef944db2
--- /dev/null
+++ b/db/versions/11261-bronzeDracena/00-firstScript.sql
@@ -0,0 +1,2 @@
+ALTER TABLE vn.agencyMode
+ CHANGE IF EXISTS showAgencyName showAgencyName__ tinyint(1) DEFAULT 1 COMMENT '@deprecated 2024-09-24';
\ No newline at end of file
diff --git a/db/versions/11262-chocolateCamellia/00-firstScript.sql b/db/versions/11262-chocolateCamellia/00-firstScript.sql
new file mode 100644
index 000000000..79910fa76
--- /dev/null
+++ b/db/versions/11262-chocolateCamellia/00-firstScript.sql
@@ -0,0 +1,31 @@
+-- vn.priceDelta definition
+
+CREATE OR REPLACE TABLE vn.priceDelta (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `itemTypeFk` smallint(5) unsigned NOT NULL,
+ `minSize` int(10) unsigned DEFAULT NULL COMMENT 'Minimum item.size',
+ `maxSize` int(10) unsigned DEFAULT NULL COMMENT 'Maximum item.size',
+ `inkFk` varchar(3) DEFAULT NULL,
+ `originFk` tinyint(2) unsigned DEFAULT NULL,
+ `producerFk` mediumint(3) unsigned DEFAULT NULL,
+ `fromDated` date DEFAULT NULL,
+ `toDated` date DEFAULT NULL,
+ `absIncreasing` decimal(10,3) DEFAULT NULL COMMENT 'Absolute increasing of final price',
+ `ratIncreasing` int(11) DEFAULT NULL COMMENT 'Increasing ratio for the cost price',
+ `warehouseFk` smallint(6) unsigned NOT NULL,
+ `created` timestamp NOT NULL DEFAULT current_timestamp(),
+ `editorFk` int(10) unsigned DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `priceDelta_itemType_FK` (`itemTypeFk`),
+ KEY `priceDelta_ink_FK` (`inkFk`),
+ KEY `priceDelta_producer_FK` (`producerFk`),
+ KEY `priceDelta_warehouse_FK` (`warehouseFk`),
+ KEY `priceDelta_worker_FK` (`editorFk`),
+ CONSTRAINT `priceDelta_ink_FK` FOREIGN KEY (`inkFk`) REFERENCES `ink` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `priceDelta_itemType_FK` FOREIGN KEY (`itemTypeFk`) REFERENCES `itemType` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `priceDelta_producer_FK` FOREIGN KEY (`producerFk`) REFERENCES `producer` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `priceDelta_warehouse_FK` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `priceDelta_worker_FK` FOREIGN KEY (`editorFk`) REFERENCES `worker` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Defines the increasing o decreasing for ranges of items';
+
+GRANT INSERT, SELECT, UPDATE, DELETE ON TABLE vn.priceDelta TO buyer;
\ No newline at end of file
diff --git a/db/versions/11263-brownAnthurium/00-firstScript.sql b/db/versions/11263-brownAnthurium/00-firstScript.sql
new file mode 100644
index 000000000..0824ea5f7
--- /dev/null
+++ b/db/versions/11263-brownAnthurium/00-firstScript.sql
@@ -0,0 +1,32 @@
+-- Place your SQL code here
+-- vn.priceDelta definition
+
+CREATE OR REPLACE TABLE vn.priceDelta (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `itemTypeFk` smallint(5) unsigned NOT NULL,
+ `minSize` int(10) unsigned DEFAULT NULL COMMENT 'Minimum item.size',
+ `maxSize` int(10) unsigned DEFAULT NULL COMMENT 'Maximum item.size',
+ `inkFk` varchar(3) DEFAULT NULL,
+ `originFk` tinyint(2) unsigned DEFAULT NULL,
+ `producerFk` mediumint(3) unsigned DEFAULT NULL,
+ `fromDated` date DEFAULT NULL,
+ `toDated` date DEFAULT NULL,
+ `absIncreasing` decimal(10,3) DEFAULT NULL COMMENT 'Absolute increasing of final price',
+ `ratIncreasing` int(11) DEFAULT NULL COMMENT 'Increasing ratio for the cost price',
+ `warehouseFk` smallint(6) unsigned NOT NULL,
+ `created` timestamp NOT NULL DEFAULT current_timestamp(),
+ `editorFk` int(10) unsigned DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `priceDelta_itemType_FK` (`itemTypeFk`),
+ KEY `priceDelta_ink_FK` (`inkFk`),
+ KEY `priceDelta_producer_FK` (`producerFk`),
+ KEY `priceDelta_warehouse_FK` (`warehouseFk`),
+ KEY `priceDelta_worker_FK` (`editorFk`),
+ CONSTRAINT `priceDelta_ink_FK` FOREIGN KEY (`inkFk`) REFERENCES `ink` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `priceDelta_itemType_FK` FOREIGN KEY (`itemTypeFk`) REFERENCES `itemType` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `priceDelta_producer_FK` FOREIGN KEY (`producerFk`) REFERENCES `producer` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `priceDelta_warehouse_FK` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `priceDelta_worker_FK` FOREIGN KEY (`editorFk`) REFERENCES `worker` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Defines the increasing o decreasing for ranges of items';
+
+GRANT INSERT, SELECT, UPDATE, DELETE ON TABLE vn.priceDelta TO buyer;
\ No newline at end of file
diff --git a/db/versions/11264-turquoisePaniculata/00-firstScript.sql b/db/versions/11264-turquoisePaniculata/00-firstScript.sql
new file mode 100644
index 000000000..8ca3df265
--- /dev/null
+++ b/db/versions/11264-turquoisePaniculata/00-firstScript.sql
@@ -0,0 +1 @@
+ALTER TABLE dipole.expedition_PrintOut DROP COLUMN IF EXISTS isChecked;
diff --git a/db/versions/11271-blackMastic/00-firstScript.sql b/db/versions/11271-blackMastic/00-firstScript.sql
new file mode 100644
index 000000000..dcc8349a5
--- /dev/null
+++ b/db/versions/11271-blackMastic/00-firstScript.sql
@@ -0,0 +1,3 @@
+-- Place your SQL code here
+ALTER TABLE vn.priceDelta ADD IF NOT EXISTS zoneGeoFk int(11) NULL COMMENT 'Application area for the bonus component';
+ALTER TABLE vn.priceDelta ADD CONSTRAINT priceDelta_zoneGeo_FK FOREIGN KEY IF NOT EXISTS (zoneGeoFk) REFERENCES vn.zoneGeo(id) ON DELETE RESTRICT ON UPDATE CASCADE;
diff --git a/db/versions/11272-azureLilium/00-firstScript.sql b/db/versions/11272-azureLilium/00-firstScript.sql
new file mode 100644
index 000000000..0194ece18
--- /dev/null
+++ b/db/versions/11272-azureLilium/00-firstScript.sql
@@ -0,0 +1,4 @@
+-- Place your SQL code here
+RENAME TABLE vn.stockBuyed TO vn.stockBuyed__;
+ALTER TABLE vn.stockBuyed__
+COMMENT='@deprecated 2024-10-01 rename and refactor to stockBought';
diff --git a/db/versions/11274-redGerbera/00-firstScript copy 2.sql b/db/versions/11274-redGerbera/00-firstScript copy 2.sql
new file mode 100644
index 000000000..452accf2e
--- /dev/null
+++ b/db/versions/11274-redGerbera/00-firstScript copy 2.sql
@@ -0,0 +1 @@
+ALTER TABLE vn.address MODIFY COLUMN isEqualizated tinyint(1) DEFAULT FALSE NOT NULL;
diff --git a/db/versions/11274-redGerbera/00-firstScript copy 3.sql b/db/versions/11274-redGerbera/00-firstScript copy 3.sql
new file mode 100644
index 000000000..c1f574379
--- /dev/null
+++ b/db/versions/11274-redGerbera/00-firstScript copy 3.sql
@@ -0,0 +1 @@
+ALTER TABLE vn.autonomy MODIFY COLUMN isUeeMember tinyint(1) DEFAULT FALSE NOT NULL;
\ No newline at end of file
diff --git a/db/versions/11274-redGerbera/00-firstScript copy 4.sql b/db/versions/11274-redGerbera/00-firstScript copy 4.sql
new file mode 100644
index 000000000..18a4d3314
--- /dev/null
+++ b/db/versions/11274-redGerbera/00-firstScript copy 4.sql
@@ -0,0 +1 @@
+ALTER TABLE vn.chat MODIFY COLUMN checkUserStatus tinyint(1) DEFAULT FALSE NOT NULL;
diff --git a/db/versions/11274-redGerbera/00-firstScript copy 5.sql b/db/versions/11274-redGerbera/00-firstScript copy 5.sql
new file mode 100644
index 000000000..c75965735
--- /dev/null
+++ b/db/versions/11274-redGerbera/00-firstScript copy 5.sql
@@ -0,0 +1,3 @@
+ALTER TABLE vn.warehouse
+ MODIFY COLUMN isOrigin tinyint(1) DEFAULT FALSE NOT NULL,
+ MODIFY COLUMN isDestiny tinyint(1) DEFAULT FALSE NOT NULL;
\ No newline at end of file
diff --git a/db/versions/11274-redGerbera/00-firstScript copy 6.sql b/db/versions/11274-redGerbera/00-firstScript copy 6.sql
new file mode 100644
index 000000000..63b942e9d
--- /dev/null
+++ b/db/versions/11274-redGerbera/00-firstScript copy 6.sql
@@ -0,0 +1 @@
+ALTER TABLE vn.zoneIncluded MODIFY COLUMN isIncluded tinyint(1) DEFAULT FALSE NOT NULL;
diff --git a/db/versions/11274-redGerbera/00-firstScript copy.sql b/db/versions/11274-redGerbera/00-firstScript copy.sql
new file mode 100644
index 000000000..f14ff371d
--- /dev/null
+++ b/db/versions/11274-redGerbera/00-firstScript copy.sql
@@ -0,0 +1 @@
+ALTER TABLE bs.defaulter MODIFY COLUMN hasChanged tinyint(1) DEFAULT FALSE NOT NULL;
diff --git a/db/versions/11274-redGerbera/00-firstScript.sql b/db/versions/11274-redGerbera/00-firstScript.sql
new file mode 100644
index 000000000..8bcf7e027
--- /dev/null
+++ b/db/versions/11274-redGerbera/00-firstScript.sql
@@ -0,0 +1 @@
+ALTER TABLE account.user MODIFY COLUMN emailVerified tinyint(1) DEFAULT FALSE NOT NULL;
diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js
index 097c6e1ab..0a3892c86 100644
--- a/e2e/helpers/selectors.js
+++ b/e2e/helpers/selectors.js
@@ -687,8 +687,8 @@ export default {
ticketFuture: {
searchResult: 'vn-ticket-future tbody tr',
openAdvancedSearchButton: 'vn-searchbar .append vn-icon[icon="arrow_drop_down"]',
- originDated: 'vn-date-picker[label="Origin date"]',
- futureDated: 'vn-date-picker[label="Destination date"]',
+ originScopeDays: 'vn-date-picker[label="Origin date"]',
+ futureScopeDays: 'vn-date-picker[label="Destination date"]',
linesMax: 'vn-textfield[label="Max Lines"]',
litersMax: 'vn-textfield[label="Max Liters"]',
ipt: 'vn-autocomplete[label="Origin IPT"]',
diff --git a/e2e/paths/01-salix/03_smartTable_searchBar_integrations.spec.js b/e2e/paths/01-salix/03_smartTable_searchBar_integrations.spec.js
deleted file mode 100644
index 9c37ce9ba..000000000
--- a/e2e/paths/01-salix/03_smartTable_searchBar_integrations.spec.js
+++ /dev/null
@@ -1,68 +0,0 @@
-import selectors from '../../helpers/selectors.js';
-import getBrowser from '../../helpers/puppeteer';
-
-describe('SmartTable SearchBar integration', () => {
- let browser;
- let page;
- beforeAll(async() => {
- browser = await getBrowser();
- page = browser.page;
- await page.loginAndModule('salesPerson', 'item');
- await page.waitToClick(selectors.globalItems.searchButton);
- });
-
- afterAll(async() => {
- await browser.close();
- });
-
- it('should search by type in searchBar, reload page and have same results', async() => {
- await page.waitToClick(selectors.itemsIndex.openAdvancedSearchButton);
- await page.autocompleteSearch(selectors.itemsIndex.advancedSearchItemType, 'Anthurium');
- await page.waitToClick(selectors.itemsIndex.advancedSearchButton);
- await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 4);
-
- await page.reload({
- waitUntil: 'networkidle2'
- });
-
- await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 4);
-
- await page.write(selectors.itemsIndex.advancedSmartTableGrouping, '1');
- await page.keyboard.press('Enter');
- await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 2);
-
- await page.reload({
- waitUntil: 'networkidle2'
- });
-
- await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1);
- });
-
- it('should filter in section without smart-table and search in searchBar go to zone section', async() => {
- await page.loginAndModule('salesPerson', 'zone');
- await page.waitToClick(selectors.globalItems.searchButton);
-
- await page.doSearch('A');
- const firstCount = await page.countElement(selectors.zoneIndex.searchResult);
-
- await page.doSearch('A');
- const secondCount = await page.countElement(selectors.zoneIndex.searchResult);
-
- expect(firstCount).toEqual(7);
- expect(secondCount).toEqual(7);
- });
-
- it('should order orders by first id and order by last id, reload page and have same order', async() => {
- await page.loginAndModule('developer', 'item');
- await page.accessToSection('item.fixedPrice');
- await page.keyboard.press('Enter');
-
- await page.waitForTextInField(selectors.itemFixedPrice.firstItemID, '1');
-
- await page.waitToClick(selectors.itemFixedPrice.orderColumnId);
- await page.reload({
- waitUntil: 'networkidle2'
- });
- await page.waitForTextInField(selectors.itemFixedPrice.firstItemID, '3');
- });
-});
diff --git a/e2e/paths/02-client/04_edit_billing_data.spec.js b/e2e/paths/02-client/04_edit_billing_data.spec.js
index 10eb85406..ca2c3b953 100644
--- a/e2e/paths/02-client/04_edit_billing_data.spec.js
+++ b/e2e/paths/02-client/04_edit_billing_data.spec.js
@@ -35,6 +35,14 @@ describe('Client Edit billing data path', () => {
it(`should attempt to edit the billing data without an IBAN but fail`, async() => {
await page.autocompleteSearch($.payMethod, 'PayMethod with IBAN');
+ await page.waitToClick($.saveButton);
+ const message = await page.waitForSnackbar();
+
+ expect(message.text).toContain('That payment method requires an IBAN');
+ });
+
+ it(`should edit the billing data and save the form`, async() => {
+ await page.autocompleteSearch($.payMethod, 'PayMethod five');
await page.autocompleteSearch($.swiftBic, 'BBKKESMMMMM');
await page.clearInput($.dueDay);
await page.write($.dueDay, '60');
@@ -45,10 +53,13 @@ describe('Client Edit billing data path', () => {
await page.waitToClick($.saveButton);
const message = await page.waitForSnackbar();
- expect(message.text).toContain('That payment method requires an IBAN');
+ expect(message.text).toContain('Notification sent!');
});
it(`should create a new BIC code`, async() => {
+ await page.loginAndModule('financial', 'client');
+ await page.accessToSearchResult('Bruce Banner');
+ await page.accessToSection('client.card.billingData');
await page.waitToClick($.newBankEntityButton);
await page.write($.newBankEntityName, 'Gotham City Bank');
await page.write($.newBankEntityBIC, 'GTHMCT');
@@ -66,7 +77,7 @@ describe('Client Edit billing data path', () => {
it(`should confirm the IBAN pay method was sucessfully saved`, async() => {
const payMethod = await page.waitToGetProperty($.payMethod, 'value');
- expect(payMethod).toEqual('PayMethod with IBAN');
+ expect(payMethod).toEqual('PayMethod five');
});
it(`should clear the BIC code field, update the IBAN to see how he BIC code autocompletes`, async() => {
@@ -79,14 +90,6 @@ describe('Client Edit billing data path', () => {
expect(automaticCode).toEqual('CAIXESBB');
});
- it(`should save the form with all its new data`, async() => {
- await page.waitForWatcherData($.watcher);
- await page.waitToClick($.saveButton);
- const message = await page.waitForSnackbar();
-
- expect(message.text).toContain('Notification sent!');
- });
-
it('should confirm the billing data have been edited', async() => {
const dueDate = await page.waitToGetProperty($.dueDay, 'value');
const IBAN = await page.waitToGetProperty($.IBAN, 'value');
@@ -94,7 +97,9 @@ describe('Client Edit billing data path', () => {
const receivedCoreLCR = await page.checkboxState($.receivedCoreLCRCheckbox);
const receivedCoreVNL = await page.checkboxState($.receivedCoreVNLCheckbox);
const receivedB2BVNL = await page.checkboxState($.receivedB2BVNLCheckbox);
+ const payMethod = await page.waitToGetProperty($.payMethod, 'value');
+ expect(payMethod).toEqual('PayMethod five');
expect(dueDate).toEqual('60');
expect(IBAN).toEqual('ES9121000418450200051332');
expect(swiftBic).toEqual('CAIXESBB');
diff --git a/e2e/paths/05-ticket/09_weekly.spec.js b/e2e/paths/05-ticket/09_weekly.spec.js
index 1caf91f9c..370d422e6 100644
--- a/e2e/paths/05-ticket/09_weekly.spec.js
+++ b/e2e/paths/05-ticket/09_weekly.spec.js
@@ -19,7 +19,7 @@ describe('Ticket descriptor path', () => {
it('should count the amount of tickets in the turns section', async() => {
const result = await page.countElement(selectors.ticketsIndex.weeklyTicket);
- expect(result).toEqual(5);
+ expect(result).toEqual(6);
});
it('should go back to the ticket index then search and access a ticket summary', async() => {
@@ -106,7 +106,7 @@ describe('Ticket descriptor path', () => {
await page.doSearch();
const nResults = await page.countElement(selectors.ticketsIndex.searchWeeklyResult);
- expect(nResults).toEqual(5);
+ expect(nResults).toEqual(6);
});
it('should update the agency then remove it afterwards', async() => {
diff --git a/e2e/paths/05-ticket/21_future.spec.js b/e2e/paths/05-ticket/21_future.spec.js
index 7b7d478f7..60bb9c38d 100644
--- a/e2e/paths/05-ticket/21_future.spec.js
+++ b/e2e/paths/05-ticket/21_future.spec.js
@@ -30,18 +30,18 @@ describe('Ticket Future path', () => {
expect(message.text).toContain('warehouseFk is a required argument');
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
- await page.clearInput(selectors.ticketFuture.futureDated);
+ await page.clearInput(selectors.ticketFuture.futureScopeDays);
await page.waitToClick(selectors.ticketFuture.submit);
message = await page.waitForSnackbar();
- expect(message.text).toContain('futureDated is a required argument');
+ expect(message.text).toContain('futureScopeDays is a required argument');
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
- await page.clearInput(selectors.ticketFuture.originDated);
+ await page.clearInput(selectors.ticketFuture.originScopeDays);
await page.waitToClick(selectors.ticketFuture.submit);
message = await page.waitForSnackbar();
- expect(message.text).toContain('originDated is a required argument');
+ expect(message.text).toContain('originScopeDays is a required argument');
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
await page.waitToClick(selectors.ticketFuture.submit);
@@ -71,7 +71,7 @@ describe('Ticket Future path', () => {
await page.autocompleteSearch(selectors.ticketFuture.state, 'Free');
await page.waitToClick(selectors.ticketFuture.submit);
- expect(httpRequest).toContain('state=FREE');
+ expect(httpRequest).toContain('state=0');
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
@@ -80,7 +80,7 @@ describe('Ticket Future path', () => {
await page.autocompleteSearch(selectors.ticketFuture.futureState, 'Free');
await page.waitToClick(selectors.ticketFuture.submit);
- expect(httpRequest).toContain('futureState=FREE');
+ expect(httpRequest).toContain('futureState=0');
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
await page.clearInput(selectors.ticketFuture.state);
diff --git a/e2e/paths/09-invoice-out/01_summary.spec.js b/e2e/paths/09-invoice-out/01_summary.spec.js
deleted file mode 100644
index 09ac66ffc..000000000
--- a/e2e/paths/09-invoice-out/01_summary.spec.js
+++ /dev/null
@@ -1,44 +0,0 @@
-import selectors from '../../helpers/selectors.js';
-import getBrowser from '../../helpers/puppeteer';
-
-describe('InvoiceOut summary path', () => {
- let browser;
- let page;
-
- beforeAll(async() => {
- browser = await getBrowser();
- page = browser.page;
- await page.loginAndModule('employee', 'invoiceOut');
- await page.accessToSearchResult('T1111111');
- });
-
- afterAll(async() => {
- await browser.close();
- });
-
- it('should reach the summary section', async() => {
- await page.waitForState('invoiceOut.card.summary');
- });
-
- it('should contain the company from which the invoice is emited', async() => {
- const result = await page.waitToGetProperty(selectors.invoiceOutSummary.company, 'innerText');
-
- expect(result).toEqual('Company VNL');
- });
-
- it('should contain the tax breakdown', async() => {
- const firstTax = await page.waitToGetProperty(selectors.invoiceOutSummary.taxOne, 'innerText');
- const secondTax = await page.waitToGetProperty(selectors.invoiceOutSummary.taxTwo, 'innerText');
-
- expect(firstTax).toContain('10%');
- expect(secondTax).toContain('21%');
- });
-
- it('should contain the tickets info', async() => {
- const firstTicket = await page.waitToGetProperty(selectors.invoiceOutSummary.ticketOne, 'innerText');
- const secondTicket = await page.waitToGetProperty(selectors.invoiceOutSummary.ticketTwo, 'innerText');
-
- expect(firstTicket).toContain('Bat cave');
- expect(secondTicket).toContain('Bat cave');
- });
-});
diff --git a/e2e/paths/09-invoice-out/02_descriptor.spec.js b/e2e/paths/09-invoice-out/02_descriptor.spec.js
deleted file mode 100644
index 5169345bc..000000000
--- a/e2e/paths/09-invoice-out/02_descriptor.spec.js
+++ /dev/null
@@ -1,137 +0,0 @@
-import selectors from '../../helpers/selectors.js';
-import getBrowser from '../../helpers/puppeteer';
-
-describe('InvoiceOut descriptor path', () => {
- let browser;
- let page;
-
- beforeAll(async() => {
- browser = await getBrowser();
- page = browser.page;
- await page.loginAndModule('administrative', 'ticket');
- });
-
- afterAll(async() => {
- await browser.close();
- });
-
- describe('as Administrative', () => {
- it('should search for tickets with an specific invoiceOut', async() => {
- await page.waitToClick(selectors.ticketsIndex.openAdvancedSearchButton);
- await page.clearInput(selectors.ticketsIndex.advancedSearchDaysOnward);
- await page.write(selectors.ticketsIndex.advancedSearchInvoiceOut, 'T2222222');
- await page.waitToClick(selectors.ticketsIndex.advancedSearchButton);
- await page.waitForState('ticket.card.summary');
- });
-
- it('should navigate to the invoiceOut index', async() => {
- await page.waitToClick(selectors.globalItems.applicationsMenuButton);
- await page.waitForSelector(selectors.globalItems.applicationsMenuVisible);
- await page.waitToClick(selectors.globalItems.invoiceOutButton);
- await page.waitForSelector(selectors.invoiceOutIndex.topbarSearch);
- await page.waitForState('invoiceOut.index');
- });
-
- it(`should click on the search result to access to the invoiceOut summary`, async() => {
- await page.accessToSearchResult('T2222222');
- await page.waitForState('invoiceOut.card.summary');
- });
-
- it('should delete the invoiceOut using the descriptor more menu', async() => {
- await page.waitToClick(selectors.invoiceOutDescriptor.moreMenu);
- await page.waitToClick(selectors.invoiceOutDescriptor.moreMenuDeleteInvoiceOut);
- await page.waitToClick(selectors.invoiceOutDescriptor.acceptDeleteButton);
- const message = await page.waitForSnackbar();
-
- expect(message.text).toContain('InvoiceOut deleted');
- });
-
- it('should have been relocated to the invoiceOut index', async() => {
- await page.waitForState('invoiceOut.index');
- });
-
- it(`should search for the deleted invouceOut to find no results`, async() => {
- await page.doSearch('T2222222');
- const nResults = await page.countElement(selectors.invoiceOutIndex.searchResult);
-
- expect(nResults).toEqual(0);
- });
-
- it('should navigate to the ticket index', async() => {
- await page.waitToClick(selectors.globalItems.applicationsMenuButton);
- await page.waitForSelector(selectors.globalItems.applicationsMenuVisible);
- await page.waitToClick(selectors.globalItems.ticketsButton);
- await page.waitForState('ticket.index');
- });
-
- it('should search now for tickets with an specific invoiceOut to find no results', async() => {
- await page.doSearch('T2222222');
- const nResults = await page.countElement(selectors.ticketsIndex.searchResult);
-
- expect(nResults).toEqual(0);
- });
-
- it('should now navigate to the invoiceOut index', async() => {
- await page.waitToClick(selectors.globalItems.applicationsMenuButton);
- await page.waitForSelector(selectors.globalItems.applicationsMenuVisible);
- await page.waitToClick(selectors.globalItems.invoiceOutButton);
- await page.waitForState('invoiceOut.index');
- });
-
- it(`should search and access to the invoiceOut summary`, async() => {
- await page.accessToSearchResult('T1111111');
- await page.waitForState('invoiceOut.card.summary');
- });
-
- it(`should check the invoiceOut is booked in the summary data`, async() => {
- await page.waitForTextInElement(selectors.invoiceOutSummary.bookedLabel, '/');
- const result = await page.waitToGetProperty(selectors.invoiceOutSummary.bookedLabel, 'innerText');
-
- expect(result.length).toBeGreaterThan(1);
- });
-
- it('should re-book the invoiceOut using the descriptor more menu', async() => {
- await page.waitToClick(selectors.invoiceOutDescriptor.moreMenu);
- await page.waitToClick(selectors.invoiceOutDescriptor.moreMenuBookInvoiceOut);
- await page.waitToClick(selectors.invoiceOutDescriptor.acceptBookingButton);
- const message = await page.waitForSnackbar();
-
- expect(message.text).toContain('InvoiceOut booked');
- });
-
- it(`should check the invoiceOut booked in the summary data`, async() => {
- let today = Date.vnNew();
-
- let day = today.getDate();
- if (day < 10) day = `0${day}`;
-
- let month = (today.getMonth() + 1);
- if (month < 10) month = `0${month}`;
-
- let expectedDate = `${day}/${month}/${today.getFullYear()}`;
-
- await page.waitForContentLoaded();
- const result = await page
- .waitToGetProperty(selectors.invoiceOutSummary.bookedLabel, 'innerText');
-
- expect(result).toEqual(expectedDate);
- });
- });
-
- describe('as salesPerson', () => {
- it(`should log in as salesPerson then go to the target invoiceOut summary`, async() => {
- await page.loginAndModule('salesPerson', 'invoiceOut');
- await page.accessToSearchResult('A1111111');
- });
-
- it(`should check the salesPerson role doens't see the book option in the more menu`, async() => {
- await page.waitToClick(selectors.invoiceOutDescriptor.moreMenu);
- await page.waitForSelector(selectors.invoiceOutDescriptor.moreMenuShowInvoiceOutPdf);
- await page.waitForSelector(selectors.invoiceOutDescriptor.moreMenuBookInvoiceOut, {hidden: true});
- });
-
- it(`should check the salesPerson role doens't see the delete option in the more menu`, async() => {
- await page.waitForSelector(selectors.invoiceOutDescriptor.moreMenuDeleteInvoiceOut, {hidden: true});
- });
- });
-});
diff --git a/e2e/paths/09-invoice-out/03_manualInvoice.spec.js b/e2e/paths/09-invoice-out/03_manualInvoice.spec.js
deleted file mode 100644
index a1856f1b1..000000000
--- a/e2e/paths/09-invoice-out/03_manualInvoice.spec.js
+++ /dev/null
@@ -1,53 +0,0 @@
-import selectors from '../../helpers/selectors.js';
-import getBrowser from '../../helpers/puppeteer';
-
-describe('InvoiceOut manual invoice path', () => {
- let browser;
- let page;
-
- beforeAll(async() => {
- browser = await getBrowser();
- page = browser.page;
- await page.loginAndModule('administrative', 'invoiceOut');
- });
-
- afterAll(async() => {
- await browser.close();
- });
-
- it('should create an invoice from a ticket', async() => {
- await page.waitToClick(selectors.invoiceOutIndex.createInvoice);
- await page.waitForSelector(selectors.invoiceOutIndex.manualInvoiceForm);
-
- await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceTicket, '15');
- await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceSerial, 'Global nacional');
- await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceTaxArea, 'national');
- await page.waitToClick(selectors.invoiceOutIndex.saveInvoice);
- const message = await page.waitForSnackbar();
-
- await page.waitForState('invoiceOut.card.summary');
-
- expect(message.text).toContain('Data saved!');
- });
-
- it(`should create another invoice from a client`, async() => {
- await page.waitToClick(selectors.globalItems.applicationsMenuButton);
- await page.waitForSelector(selectors.globalItems.applicationsMenuVisible);
- await page.waitToClick(selectors.globalItems.invoiceOutButton);
- await page.waitForSelector(selectors.invoiceOutIndex.topbarSearch);
- await page.waitForState('invoiceOut.index');
-
- await page.waitToClick(selectors.invoiceOutIndex.createInvoice);
- await page.waitForSelector(selectors.invoiceOutIndex.manualInvoiceForm);
-
- await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceClient, 'Petter Parker');
- await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceSerial, 'Global nacional');
- await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceTaxArea, 'national');
- await page.waitToClick(selectors.invoiceOutIndex.saveInvoice);
- const message = await page.waitForSnackbar();
-
- await page.waitForState('invoiceOut.card.summary');
-
- expect(message.text).toContain('Data saved!');
- });
-});
diff --git a/e2e/paths/09-invoice-out/04_globalInvoice.spec.js b/e2e/paths/09-invoice-out/04_globalInvoice.spec.js
deleted file mode 100644
index 64cddfa25..000000000
--- a/e2e/paths/09-invoice-out/04_globalInvoice.spec.js
+++ /dev/null
@@ -1,39 +0,0 @@
-import selectors from '../../helpers/selectors.js';
-import getBrowser from '../../helpers/puppeteer';
-
-describe('InvoiceOut global invoice path', () => {
- let browser;
- let page;
-
- beforeAll(async() => {
- browser = await getBrowser();
- page = browser.page;
- await page.loginAndModule('administrative', 'invoiceOut');
- await page.waitToClick('[icon="search"]');
- await page.waitForTimeout(1000); // index search needs time to return results
- });
-
- afterAll(async() => {
- await browser.close();
- });
-
- let invoicesBeforeOneClient;
- let now = Date.vnNew();
-
- it('should count the amount of invoices listed before globla invoces are made', async() => {
- invoicesBeforeOneClient = await page.countElement(selectors.invoiceOutIndex.searchResult);
-
- expect(invoicesBeforeOneClient).toBeGreaterThanOrEqual(4);
- });
-
- it('should create a global invoice for charles xavier today', async() => {
- await page.accessToSection('invoiceOut.global-invoicing');
- await page.waitToClick(selectors.invoiceOutGlobalInvoicing.oneClient);
- await page.autocompleteSearch(selectors.invoiceOutGlobalInvoicing.clientId, 'Charles Xavier');
- await page.pickDate(selectors.invoiceOutGlobalInvoicing.invoiceDate, now);
- await page.pickDate(selectors.invoiceOutGlobalInvoicing.maxShipped, now);
- await page.autocompleteSearch(selectors.invoiceOutGlobalInvoicing.printer, '1');
- await page.waitToClick(selectors.invoiceOutGlobalInvoicing.makeInvoice);
- await page.waitForTimeout(1000);
- });
-});
diff --git a/e2e/paths/09-invoice-out/05_negative_bases.spec.js b/e2e/paths/09-invoice-out/05_negative_bases.spec.js
deleted file mode 100644
index 43ced2115..000000000
--- a/e2e/paths/09-invoice-out/05_negative_bases.spec.js
+++ /dev/null
@@ -1,29 +0,0 @@
-import getBrowser from '../../helpers/puppeteer';
-
-describe('InvoiceOut negative bases path', () => {
- let browser;
- let page;
- const httpRequests = [];
-
- beforeAll(async() => {
- browser = await getBrowser();
- page = browser.page;
- page.on('request', req => {
- if (req.url().includes(`InvoiceOuts/negativeBases`))
- httpRequests.push(req.url());
- });
- await page.loginAndModule('administrative', 'invoiceOut');
- await page.accessToSection('invoiceOut.negative-bases');
- });
-
- afterAll(async() => {
- await browser.close();
- });
-
- it('should show negative bases in a date range', async() => {
- const request = httpRequests.find(req =>
- req.includes(`from`) && req.includes(`to`));
-
- expect(request).toBeDefined();
- });
-});
diff --git a/e2e/paths/10-travel/05_thermograph.spec.js b/e2e/paths/10-travel/05_thermograph.spec.js
deleted file mode 100644
index c9709f2f5..000000000
--- a/e2e/paths/10-travel/05_thermograph.spec.js
+++ /dev/null
@@ -1,64 +0,0 @@
-import selectors from '../../helpers/selectors.js';
-import getBrowser from '../../helpers/puppeteer';
-
-describe('Travel thermograph path', () => {
- const thermographName = '7H3-37H3RN4L-FL4M3';
- let browser;
- let page;
-
- beforeAll(async() => {
- browser = await getBrowser();
- page = browser.page;
- await page.loginAndModule('buyer', 'travel');
- await page.write(selectors.travelIndex.generalSearchFilter, '3');
- await page.keyboard.press('Enter');
- await page.accessToSection('travel.card.thermograph.index');
- });
-
- afterAll(async() => {
- await browser.close();
- });
-
- it('should reach the thermograph section', async() => {
- await page.waitForState('travel.card.thermograph.index');
- });
-
- it('should click the add thermograph floating button', async() => {
- await page.waitToClick(selectors.travelThermograph.add);
- await page.waitForState('travel.card.thermograph.create');
- });
-
- it('should click on the add thermograph icon of the thermograph autocomplete', async() => {
- await page.waitToClick(selectors.travelThermograph.addThermographIcon);
- await page.write(selectors.travelThermograph.newThermographId, thermographName);
- await page.autocompleteSearch(selectors.travelThermograph.newThermographModel, 'TEMPMATE');
- await page.autocompleteSearch(selectors.travelThermograph.newThermographWarehouse, 'Warehouse Two');
- await page.autocompleteSearch(selectors.travelThermograph.newThermographTemperature, 'Warm');
- await page.waitToClick(selectors.travelThermograph.createThermographButton);
- });
-
- it('should select the file to upload', async() => {
- let currentDir = process.cwd();
- let filePath = `${currentDir}/e2e/assets/thermograph.jpeg`;
-
- const [fileChooser] = await Promise.all([
- page.waitForFileChooser(),
- page.waitToClick(selectors.travelThermograph.uploadIcon)
- ]);
- await fileChooser.accept([filePath]);
-
- await page.waitToClick(selectors.travelThermograph.upload);
-
- const message = await page.waitForSnackbar();
- const state = await page.getState();
-
- expect(message.text).toContain('Data saved!');
- expect(state).toBe('travel.card.thermograph.index');
- });
-
- it('should check everything was saved correctly', async() => {
- const result = await page.waitToGetProperty(selectors.travelThermograph.createdThermograph, 'innerText');
-
- expect(result).toContain(thermographName);
- });
-});
diff --git a/e2e/paths/11-zone/01_basic-data.spec.js b/e2e/paths/11-zone/01_basic-data.spec.js
deleted file mode 100644
index 34d08c57f..000000000
--- a/e2e/paths/11-zone/01_basic-data.spec.js
+++ /dev/null
@@ -1,104 +0,0 @@
-import selectors from '../../helpers/selectors.js';
-import getBrowser from '../../helpers/puppeteer';
-
-describe('Zone basic data path', () => {
- let browser;
- let page;
-
- beforeAll(async() => {
- browser = await getBrowser();
- page = browser.page;
-
- await page.loginAndModule('deliveryAssistant',
- 'zone'); // turns up the zone module name and route aint the same lol
- await page.accessToSearchResult('10');
- await page.accessToSection('zone.card.basicData');
- });
-
- afterAll(async() => {
- await browser.close();
- });
-
- it('should reach the basic data section', async() => {
- await page.waitForState('zone.card.basicData');
- });
-
- it('should edit de form and then save', async() => {
- await page.clearInput(selectors.zoneBasicData.name);
- await page.write(selectors.zoneBasicData.name, 'Brimstone teleportation');
- await page.autocompleteSearch(selectors.zoneBasicData.agency, 'Quantum break device');
- await page.clearInput(selectors.zoneBasicData.maxVolume);
- await page.write(selectors.zoneBasicData.maxVolume, '10');
- await page.clearInput(selectors.zoneBasicData.travelingDays);
- await page.write(selectors.zoneBasicData.travelingDays, '1');
- await page.clearInput(selectors.zoneBasicData.closing);
- await page.pickTime(selectors.zoneBasicData.closing, '21:00');
- await page.clearInput(selectors.zoneBasicData.price);
- await page.write(selectors.zoneBasicData.price, '999');
- await page.clearInput(selectors.zoneBasicData.bonus);
- await page.write(selectors.zoneBasicData.bonus, '100');
- await page.clearInput(selectors.zoneBasicData.inflation);
- await page.write(selectors.zoneBasicData.inflation, '200');
- await page.waitToClick(selectors.zoneBasicData.volumetric);
- await page.waitToClick(selectors.zoneBasicData.saveButton);
- const message = await page.waitForSnackbar();
-
- expect(message.text).toContain('Data saved!');
- });
-
- it('should now reload the section', async() => {
- await page.reloadSection('zone.card.basicData');
- });
-
- it('should confirm the name was updated', async() => {
- const result = await page.waitToGetProperty(selectors.zoneBasicData.name, 'value');
-
- expect(result).toEqual('Brimstone teleportation');
- });
-
- it('should confirm the agency was updated', async() => {
- const result = await page.waitToGetProperty(selectors.zoneBasicData.agency, 'value');
-
- expect(result).toEqual('Quantum break device');
- });
-
- it('should confirm the max volume was updated', async() => {
- const result = await page.waitToGetProperty(selectors.zoneBasicData.maxVolume, 'value');
-
- expect(result).toEqual('10');
- });
-
- it('should confirm the traveling days were updated', async() => {
- const result = await page.waitToGetProperty(selectors.zoneBasicData.travelingDays, 'value');
-
- expect(result).toEqual('1');
- });
-
- it('should confirm the closing hour was updated', async() => {
- const result = await page.waitToGetProperty(selectors.zoneBasicData.closing, 'value');
-
- expect(result).toEqual('21:00');
- });
-
- it('should confirm the price was updated', async() => {
- const result = await page.waitToGetProperty(selectors.zoneBasicData.price, 'value');
-
- expect(result).toEqual('999');
- });
-
- it('should confirm the bonus was updated', async() => {
- const result = await page.waitToGetProperty(selectors.zoneBasicData.bonus, 'value');
-
- expect(result).toEqual('100');
- });
-
- it('should confirm the inflation was updated', async() => {
- const result = await page.waitToGetProperty(selectors.zoneBasicData.inflation, 'value');
-
- expect(result).toEqual('200');
- });
-
- it('should confirm the volumetric checkbox was checked', async() => {
- await page.waitForClassPresent(selectors.zoneBasicData.volumetric, 'checked');
- });
-});
diff --git a/e2e/paths/11-zone/02_descriptor.spec.js b/e2e/paths/11-zone/02_descriptor.spec.js
deleted file mode 100644
index baccc910f..000000000
--- a/e2e/paths/11-zone/02_descriptor.spec.js
+++ /dev/null
@@ -1,32 +0,0 @@
-import selectors from '../../helpers/selectors.js';
-import getBrowser from '../../helpers/puppeteer';
-
-describe('Zone descriptor path', () => {
- let browser;
- let page;
-
- beforeAll(async() => {
- browser = await getBrowser();
- page = browser.page;
- await page.loginAndModule('deliveryAssistant', 'zone');
- await page.accessToSearchResult('13');
- });
-
- afterAll(async() => {
- await browser.close();
- });
-
- it('should eliminate the zone using the descriptor option', async() => {
- await page.waitToClick(selectors.zoneDescriptor.menu);
- await page.waitToClick(selectors.zoneDescriptor.deleteZone);
- await page.respondToDialog('accept');
- await page.waitForState('zone.index');
- });
-
- it('should search for the deleted zone to find no results', async() => {
- await page.doSearch('13');
- const count = await page.countElement(selectors.zoneIndex.searchResult);
-
- expect(count).toEqual(0);
- });
-});
diff --git a/e2e/paths/13-supplier/01_summary_and_descriptor.spec.js b/e2e/paths/13-supplier/01_summary_and_descriptor.spec.js
deleted file mode 100644
index a2e194e42..000000000
--- a/e2e/paths/13-supplier/01_summary_and_descriptor.spec.js
+++ /dev/null
@@ -1,79 +0,0 @@
-import selectors from '../../helpers/selectors.js';
-import getBrowser from '../../helpers/puppeteer';
-
-describe('Supplier summary & descriptor path', () => {
- let browser;
- let page;
-
- beforeAll(async() => {
- browser = await getBrowser();
- page = browser.page;
- await page.loginAndModule('administrative', 'supplier');
- await page.accessToSearchResult('1');
- });
-
- afterAll(async() => {
- await browser.close();
- });
-
- // summary
- it('should reach the second entry summary section', async() => {
- await page.waitForState('supplier.card.summary');
- });
-
- it(`should confirm there's data on the summary header`, async() => {
- const result = await page.waitToGetProperty(selectors.supplierSummary.header, 'innerText');
-
- expect(result).toContain('PLANTS SL - 1');
- });
-
- it(`should confirm there's data on the summary basic data`, async() => {
- const result = await page.waitToGetProperty(selectors.supplierSummary.basicDataId, 'innerText');
-
- expect(result).toContain('Id 1');
- });
-
- it(`should confirm there's data on the summary fiscal address`, async() => {
- const result = await page.waitToGetProperty(selectors.supplierSummary.fiscalAddressTaxNumber, 'innerText');
-
- expect(result).toContain('Tax number 06089160W');
- });
-
- it(`should confirm there's data on the summary fiscal pay method`, async() => {
- const result = await page.waitToGetProperty(selectors.supplierSummary.billingDataPayMethod, 'innerText');
-
- expect(result).toContain('Pay method PayMethod one');
- });
-
- // descriptor
- it(`should confirm there's data on the descriptor`, async() => {
- const result = await page.waitToGetProperty(selectors.supplierDescriptor.alias, 'innerText');
-
- expect(result).toContain('Plants nick');
- });
-
- it(`should navigate to the supplier's client summary using the icon client button`, async() => {
- await page.waitToClick(selectors.supplierDescriptor.clientButton);
- await page.waitForState('client.card.summary');
- });
-
- it(`should navigate back to the supplier`, async() => {
- await page.waitToClick(selectors.globalItems.homeButton);
- await page.waitForState('home');
- await page.selectModule('supplier');
- await page.accessToSearchResult('1');
- await page.waitForState('supplier.card.summary');
- });
-
- it(`should navigate back to suppliers but a different one this time`, async() => {
- await page.waitToClick(selectors.globalItems.homeButton);
- await page.waitForState('home');
- await page.selectModule('supplier');
- await page.accessToSearchResult('2');
- await page.waitForState('supplier.card.summary');
- });
-
- it(`should check the client button isn't present since this supplier should not be a client`, async() => {
- await page.waitForSelector(selectors.supplierDescriptor.clientButton, {visible: false});
- });
-});
diff --git a/e2e/paths/13-supplier/02_basic_data.spec.js b/e2e/paths/13-supplier/02_basic_data.spec.js
deleted file mode 100644
index 710ebd8df..000000000
--- a/e2e/paths/13-supplier/02_basic_data.spec.js
+++ /dev/null
@@ -1,67 +0,0 @@
-import selectors from '../../helpers/selectors.js';
-import getBrowser from '../../helpers/puppeteer';
-
-describe('Supplier basic data path', () => {
- let browser;
- let page;
-
- beforeAll(async() => {
- browser = await getBrowser();
- page = browser.page;
- await page.loginAndModule('financial', 'supplier');
- await page.accessToSearchResult('1');
- await page.accessToSection('supplier.card.basicData');
- });
-
- afterAll(async() => {
- await browser.close();
- });
-
- it('should edit the basic data', async() => {
- await page.clearInput(selectors.supplierBasicData.alias);
- await page.write(selectors.supplierBasicData.alias, 'Plants Nick SL');
- await page.waitToClick(selectors.supplierBasicData.isReal);
- await page.waitToClick(selectors.supplierBasicData.isActive);
- await page.waitToClick(selectors.supplierBasicData.isPayMethodChecked);
- await page.write(selectors.supplierBasicData.notes, 'Some notes');
-
- await page.waitToClick(selectors.supplierBasicData.saveButton);
- const message = await page.waitForSnackbar();
-
- expect(message.text).toContain('Data saved!');
- });
-
- it('should reload the section', async() => {
- await page.reloadSection('supplier.card.basicData');
- });
-
- it('should check the alias was edited', async() => {
- const result = await page.waitToGetProperty(selectors.supplierBasicData.alias, 'value');
-
- expect(result).toEqual('Plants Nick SL');
- });
-
- it('should check the isReal checkbox is now checked', async() => {
- const result = await page.checkboxState(selectors.supplierBasicData.isReal);
-
- expect(result).toBe('checked');
- });
-
- it('should check the isActive checkbox is now unchecked', async() => {
- const result = await page.checkboxState(selectors.supplierBasicData.isActive);
-
- expect(result).toBe('unchecked');
- });
-
- it('should check the isPayMethodChecked checkbox is now unchecked', async() => {
- const result = await page.checkboxState(selectors.supplierBasicData.isPayMethodChecked);
-
- expect(result).toBe('unchecked');
- });
-
- it('should check the notes were edited', async() => {
- const result = await page.waitToGetProperty(selectors.supplierBasicData.notes, 'value');
-
- expect(result).toEqual('Some notes');
- });
-});
diff --git a/e2e/paths/13-supplier/03_fiscal_data.spec.js b/e2e/paths/13-supplier/03_fiscal_data.spec.js
deleted file mode 100644
index ccd9d7809..000000000
--- a/e2e/paths/13-supplier/03_fiscal_data.spec.js
+++ /dev/null
@@ -1,56 +0,0 @@
-import getBrowser from '../../helpers/puppeteer';
-
-describe('Supplier fiscal data path', () => {
- let browser;
- let page;
-
- beforeAll(async() => {
- browser = await getBrowser();
- page = browser.page;
- await page.loginAndModule('administrative', 'supplier');
- await page.accessToSearchResult('2');
- });
-
- afterAll(async() => {
- await browser.close();
- });
-
- it('should attempt to edit the fiscal data and check data iss saved', async() => {
- await page.accessToSection('supplier.card.fiscalData');
-
- const form = 'vn-supplier-fiscal-data form';
- const values = {
- province: null,
- country: null,
- postcode: null,
- city: 'Valencia',
- socialName: 'FARMER KING SL',
- taxNumber: '12345678Z',
- account: '0123456789',
- sageWithholding: 'retencion estimacion objetiva',
- sageTaxType: 'operaciones no sujetas'
- };
-
- const errorMessage = await page.sendForm(form, {
- taxNumber: 'Wrong tax number'
- });
- const message = await page.sendForm(form, values);
-
- await page.reloadSection('supplier.card.fiscalData');
- const formValues = await page.fetchForm(form, Object.keys(values));
-
- expect(errorMessage.text).toContain('Invalid Tax number');
- expect(message.isSuccess).toBeTrue();
- expect(formValues).toEqual({
- province: 'Province one',
- country: 'España',
- postcode: '46000',
- city: 'Valencia',
- socialName: 'FARMER KING SL',
- taxNumber: '12345678Z',
- account: '0123456789',
- sageWithholding: 'RETENCION ESTIMACION OBJETIVA',
- sageTaxType: 'Operaciones no sujetas'
- });
- });
-});
diff --git a/e2e/paths/13-supplier/04_billing_data.spec.js b/e2e/paths/13-supplier/04_billing_data.spec.js
deleted file mode 100644
index d3cb6dcab..000000000
--- a/e2e/paths/13-supplier/04_billing_data.spec.js
+++ /dev/null
@@ -1,52 +0,0 @@
-import selectors from '../../helpers/selectors.js';
-import getBrowser from '../../helpers/puppeteer';
-
-describe('Supplier billing data path', () => {
- let browser;
- let page;
-
- beforeAll(async() => {
- browser = await getBrowser();
- page = browser.page;
- await page.loginAndModule('administrative', 'supplier');
- await page.accessToSearchResult('442');
- await page.accessToSection('supplier.card.billingData');
- });
-
- afterAll(async() => {
- await browser.close();
- });
-
- it('should edit the billing data', async() => {
- await page.autocompleteSearch(selectors.supplierBillingData.payMethod, 'PayMethod with IBAN');
- await page.autocompleteSearch(selectors.supplierBillingData.payDem, '10');
- await page.clearInput(selectors.supplierBillingData.payDay);
- await page.write(selectors.supplierBillingData.payDay, '19');
- await page.waitToClick(selectors.supplierBillingData.saveButton);
- const message = await page.waitForSnackbar();
-
- expect(message.text).toContain('Data saved!');
- });
-
- it('should reload the section', async() => {
- await page.reloadSection('supplier.card.billingData');
- });
-
- it('should check the pay method was edited', async() => {
- const result = await page.waitToGetProperty(selectors.supplierBillingData.payMethod, 'value');
-
- expect(result).toEqual('PayMethod with IBAN');
- });
-
- it('should check the payDem was edited', async() => {
- const result = await page.waitToGetProperty(selectors.supplierBillingData.payDem, 'value');
-
- expect(result).toEqual('10');
- });
-
- it('should check the pay day was edited', async() => {
- const result = await page.waitToGetProperty(selectors.supplierBillingData.payDay, 'value');
-
- expect(result).toEqual('19');
- });
-});
diff --git a/e2e/paths/13-supplier/05_address.spec.js b/e2e/paths/13-supplier/05_address.spec.js
deleted file mode 100644
index 5bccba3ee..000000000
--- a/e2e/paths/13-supplier/05_address.spec.js
+++ /dev/null
@@ -1,79 +0,0 @@
-import selectors from '../../helpers/selectors.js';
-import getBrowser from '../../helpers/puppeteer';
-
-describe('Supplier address path', () => {
- let browser;
- let page;
-
- beforeAll(async() => {
- browser = await getBrowser();
- page = browser.page;
- await page.loginAndModule('employee', 'supplier');
- await page.accessToSearchResult('1');
- await page.accessToSection('supplier.card.address.index');
- });
-
- afterAll(async() => {
- await browser.close();
- });
-
- it('should count the addresses before creating one', async() => {
- const count = await page.countElement(selectors.supplierAddress.anyAddress);
-
- expect(count).toEqual(2);
- });
-
- it('should open the new address form by clicking the add button', async() => {
- await page.waitToClick(selectors.supplierAddress.newAddress);
- await page.waitForState('supplier.card.address.create');
- });
-
- it('should create a new address', async() => {
- await page.write(selectors.supplierAddress.newNickname, 'Darkest dungeon');
- await page.write(selectors.supplierAddress.newStreet, 'Wayne manor');
- await page.write(selectors.supplierAddress.newPostcode, '46000');
- await page.write(selectors.supplierAddress.newCity, 'Valencia');
- await page.autocompleteSearch(selectors.supplierAddress.newProvince, 'Province one');
- await page.write(selectors.supplierAddress.newPhone, '888888888');
- await page.write(selectors.supplierAddress.newMobile, '444444444');
- await page.waitToClick(selectors.supplierAddress.saveButton);
- const message = await page.waitForSnackbar();
-
- expect(message.text).toContain('Data saved!');
- });
-
- it('should have been redirected to the addresses index', async() => {
- await page.waitForState('supplier.card.address.index');
- });
-
- it('should count the addresses and find one more now', async() => {
- const count = await page.countElement(selectors.supplierAddress.anyAddress);
-
- expect(count).toEqual(3);
- });
-
- it('should open the edit address form by clicking the new address', async() => {
- await page.waitToClick(selectors.supplierAddress.thirdAddress);
- await page.waitForState('supplier.card.address.edit');
- });
-
- it('should edit the address', async() => {
- await page.overwrite(selectors.supplierAddress.editNickname, 'Wayne manor');
- await page.overwrite(selectors.supplierAddress.editStreet, '1007 Mountain Drive');
- await page.overwrite(selectors.supplierAddress.editPostcode, '46000');
- await page.overwrite(selectors.supplierAddress.editCity, 'Valencia');
- await page.autocompleteSearch(selectors.supplierAddress.editProvince, 'Province one');
- await page.overwrite(selectors.supplierAddress.editPhone, '777777777');
- await page.overwrite(selectors.supplierAddress.editMobile, '555555555');
- await page.waitToClick(selectors.supplierAddress.saveButton);
- const message = await page.waitForSnackbar();
-
- expect(message.text).toContain('Data saved!');
- });
-
- it('should check the address has now the expected data', async() => {
- let thirdAddress = await page.waitToGetProperty(selectors.supplierAddress.thirdAddress, 'innerText');
-
- expect(thirdAddress).toContain('Wayne manor');
- });
-});
diff --git a/e2e/paths/13-supplier/06_contact.spec.js b/e2e/paths/13-supplier/06_contact.spec.js
deleted file mode 100644
index 60fd28f9c..000000000
--- a/e2e/paths/13-supplier/06_contact.spec.js
+++ /dev/null
@@ -1,89 +0,0 @@
-import selectors from '../../helpers/selectors.js';
-import getBrowser from '../../helpers/puppeteer';
-
-describe('Supplier contact path', () => {
- let browser;
- let page;
-
- beforeAll(async() => {
- browser = await getBrowser();
- page = browser.page;
- await page.loginAndModule('administrative', 'supplier');
- await page.accessToSearchResult('1');
- await page.accessToSection('supplier.card.contact');
- });
-
- afterAll(async() => {
- await browser.close();
- });
-
- it('should create a new contact', async() => {
- await page.waitToClick(selectors.supplierContact.addNewContact);
- await page.write(selectors.supplierContact.thirdContactName, 'The tester');
- await page.write(selectors.supplierContact.thirdContactPhone, '99 999 99 99');
- await page.write(selectors.supplierContact.thirdContactMobile, '555 55 55 55');
- await page.write(selectors.supplierContact.thirdContactEmail, 'testing@puppeteer.com');
- await page.write(selectors.supplierContact.thirdContactNotes, 'the end to end integration tester');
- await page.waitToClick(selectors.supplierContact.saveButton);
- const message = await page.waitForSnackbar();
-
- expect(message.text).toContain('Data saved!');
- });
-
- it(`should reload the section and count the contacts`, async() => {
- await page.reloadSection('supplier.card.contact');
- const result = await page.countElement(selectors.supplierContact.anyContact);
-
- expect(result).toEqual(3);
- });
-
- it(`should check the new contact name was saved correctly`, async() => {
- const result = await page.waitToGetProperty(selectors.supplierContact.thirdContactName, 'value');
-
- expect(result).toContain('The tester');
- });
-
- it(`should check the new contact phone was saved correctly`, async() => {
- const result = await page.waitToGetProperty(selectors.supplierContact.thirdContactPhone, 'value');
-
- expect(result).toContain('99 999 99 99');
- });
-
- it(`should check the new contact mobile was saved correctly`, async() => {
- const result = await page.waitToGetProperty(selectors.supplierContact.thirdContactMobile, 'value');
-
- expect(result).toContain('555 55 55 55');
- });
-
- it(`should check the new contact email was saved correctly`, async() => {
- const result = await page.waitToGetProperty(selectors.supplierContact.thirdContactEmail, 'value');
-
- expect(result).toContain('testing@puppeteer.com');
- });
-
- it(`should check the new contact note was saved correctly`, async() => {
- await page.waitForTextInField(selectors.supplierContact.thirdContactNotes, 'the end to end integration tester');
- const result = await page.waitToGetProperty(selectors.supplierContact.thirdContactNotes, 'value');
-
- expect(result).toContain('the end to end integration tester');
- });
-
- it(`should remove the created contact`, async() => {
- await page.waitToClick(selectors.supplierContact.thirdContactDeleteButton, 'value');
- const result = await page.countElement(selectors.supplierContact.anyContact);
-
- expect(result).toEqual(2);
-
- await page.waitToClick(selectors.supplierContact.saveButton);
- const message = await page.waitForSnackbar();
-
- expect(message.text).toContain('Data saved!');
- });
-
- it(`should reload the section and count the amount of contacts went back to 2`, async() => {
- await page.reloadSection('supplier.card.contact');
- const result = await page.countElement(selectors.supplierContact.anyContact);
-
- expect(result).toEqual(2);
- });
-});
diff --git a/front/core/services/app.js b/front/core/services/app.js
index cec7bea7f..b8fcc43e1 100644
--- a/front/core/services/app.js
+++ b/front/core/services/app.js
@@ -57,7 +57,7 @@ export default class App {
getUrl(route, appName = 'lilium') {
const index = window.location.hash.indexOf(route.toLowerCase());
- const newRoute = index < 0 ? route : window.location.hash.substring(index);
+ let newRoute = index < 0 ? route : window.location.hash.substring(index);
const env = process.env.NODE_ENV;
const filter = {
where: {and: [
@@ -66,6 +66,11 @@ export default class App {
]}
};
+
+ if (this.logger.$params.q)
+ newRoute = newRoute.concat(`?table=${this.logger.$params.q}`);
+
+
return this.logger.$http.get('Urls/findOne', {filter})
.then(res => {
if (res && res.data)
diff --git a/loopback/common/models/vn-model.js b/loopback/common/models/vn-model.js
index a11bed11d..e24653d13 100644
--- a/loopback/common/models/vn-model.js
+++ b/loopback/common/models/vn-model.js
@@ -33,7 +33,7 @@ module.exports = function(Self) {
const defaultLimit = this.app.orm.selectLimit;
const filter = ctx.args.filter || {limit: defaultLimit};
- if (filter.limit > defaultLimit) {
+ if (!filter.limit || filter.limit > defaultLimit) {
filter.limit = defaultLimit;
ctx.args.filter = filter;
}
@@ -349,9 +349,10 @@ module.exports = function(Self) {
},
hasFilter(ctx) {
- return ctx.req.method.toUpperCase() === 'GET' &&
- ctx.method.accepts.some(x => x.arg === 'filter' && x.type.toLowerCase() === 'object');
- }
-
+ const {method, req} = ctx;
+ if (method.noLimit) return false;
+ return req.method.toUpperCase() === 'GET' &&
+ method.accepts.some(x => x.arg === 'filter' && x.type.toLowerCase() === 'object');
+ },
});
};
diff --git a/loopback/locale/en.json b/loopback/locale/en.json
index 06538a524..ea84cb6eb 100644
--- a/loopback/locale/en.json
+++ b/loopback/locale/en.json
@@ -150,7 +150,7 @@
"Receipt's bank was not found": "Receipt's bank was not found",
"This receipt was not compensated": "This receipt was not compensated",
"Client's email was not found": "Client's email was not found",
- "Tickets with associated refunds": "Tickets with associated refunds can't be deleted. This ticket is associated with refund Nº %d",
+ "Tickets with associated refunds": "Tickets with associated refunds can't be deleted. This ticket is associated with refund Nº %s",
"It is not possible to modify tracked sales": "It is not possible to modify tracked sales",
"It is not possible to modify sales that their articles are from Floramondo": "It is not possible to modify sales that their articles are from Floramondo",
"It is not possible to modify cloned sales": "It is not possible to modify cloned sales",
@@ -230,10 +230,15 @@
"This workCenter is already assigned to this agency": "This workCenter is already assigned to this agency",
"You can only have one PDA": "You can only have one PDA",
"Incoterms and Customs agent are required for a non UEE member": "Incoterms and Customs agent are required for a non UEE member",
- "It has been invoiced but the PDF could not be generated": "It has been invoiced but the PDF could not be generated",
+ "The invoices have been created but the PDFs could not be generated": "The invoices have been created but the PDFs could not be generated",
"It has been invoiced but the PDF of refund not be generated": "It has been invoiced but the PDF of refund not be generated",
"Cannot add holidays on this day": "Cannot add holidays on this day",
"Cannot send mail": "Cannot send mail",
"CONSTRAINT `chkParkingCodeFormat` failed for `vn`.`parking`": "CONSTRAINT `chkParkingCodeFormat` failed for `vn`.`parking`",
- "This postcode already exists": "This postcode already exists"
-}
\ No newline at end of file
+ "This postcode already exists": "This postcode already exists",
+ "Original invoice not found": "Original invoice not found",
+ "There is already a tray with the same height": "There is already a tray with the same height",
+ "The height must be greater than 50cm": "The height must be greater than 50cm",
+ "The maximum height of the wagon is 200cm": "The maximum height of the wagon is 200cm",
+ "The quantity claimed cannot be greater than the quantity of the line": "The quantity claimed cannot be greater than the quantity of the line"
+}
diff --git a/loopback/locale/es.json b/loopback/locale/es.json
index 377691ae6..796c945e8 100644
--- a/loopback/locale/es.json
+++ b/loopback/locale/es.json
@@ -272,7 +272,7 @@
"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",
+ "Tickets with associated refunds": "No se pueden borrar tickets con abonos asociados. Este ticket está asociado al abono Nº %s",
"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",
@@ -363,12 +363,23 @@
"You can not use the same password": "No puedes usar la misma contraseña",
"This PDA is already assigned to another user": "Este PDA ya está asignado a otro usuario",
"You can only have one PDA": "Solo puedes tener un PDA",
- "It has been invoiced but the PDF could not be generated": "Se ha facturado pero no se ha podido generar el PDF",
+ "The invoices have been created but the PDFs could not be generated": "Se ha facturado pero no se ha podido generar el PDF",
"It has been invoiced but the PDF of refund not be generated": "Se ha facturado pero no se ha podido generar el PDF del abono",
"Payment method is required": "El método de pago es obligatorio",
"Cannot send mail": "Não é possível enviar o email",
"CONSTRAINT `supplierAccountTooShort` failed for `vn`.`supplier`": "La cuenta debe tener exactamente 10 dígitos",
"The sale not exists in the item shelving": "La venta no existe en la estantería del artículo",
"The entry not have stickers": "La entrada no tiene etiquetas",
- "Too many records": "Demasiados registros"
-}
\ No newline at end of file
+ "Too many records": "Demasiados registros",
+ "Original invoice not found": "Factura original no encontrada",
+ "The entry has no lines or does not exist": "La entrada no tiene lineas o no existe",
+ "Weight already set": "El peso ya está establecido",
+ "This ticket is not allocated to your department": "Este ticket no está asignado a tu departamento",
+ "There is already a tray with the same height": "Ya existe una bandeja con la misma altura",
+ "The height must be greater than 50cm": "La altura debe ser superior a 50cm",
+ "The maximum height of the wagon is 200cm": "La altura máxima es 200cm",
+ "The entry does not have stickers": "La entrada no tiene etiquetas",
+ "This buyer has already made a reservation for this date": "Este comprador ya ha hecho una reserva para esta fecha",
+ "No valid travel thermograph found": "No se encontró un termógrafo válido",
+ "The quantity claimed cannot be greater than the quantity of the line": "La cantidad reclamada no puede ser mayor que la cantidad de la línea"
+}
diff --git a/loopback/locale/fr.json b/loopback/locale/fr.json
index 49584ef0e..a6648b186 100644
--- a/loopback/locale/fr.json
+++ b/loopback/locale/fr.json
@@ -272,7 +272,7 @@
"Invoice date can't be less than max date": "La date de la facture ne peut pas être inférieure à la date limite",
"Warehouse inventory not set": "L'inventaire de l'entrepôt n'est pas établi",
"This locker has already been assigned": "Ce casier a déjà été assigné",
- "Tickets with associated refunds": "Vous ne pouvez pas supprimer des tickets avec des remboursements associés. Ce ticket est associé au remboursement Nº %d",
+ "Tickets with associated refunds": "Vous ne pouvez pas supprimer des tickets avec des remboursements associés. Ce ticket est associé au remboursement Nº %s",
"Not exist this branch": "La branche n'existe pas",
"This ticket cannot be signed because it has not been boxed": "Ce ticket ne peut pas être signé car il n'a pas été emballé",
"Collection does not exist": "La collection n'existe pas",
@@ -358,7 +358,9 @@
"This workCenter is already assigned to this agency": "Ce centre de travail est déjà assigné à cette agence",
"Select ticket or client": "Choisissez un ticket ou un client",
"It was not able to create the invoice": "Il n'a pas été possible de créer la facture",
- "It has been invoiced but the PDF could not be generated": "La facture a été émise mais le PDF n'a pas pu être généré",
+ "The invoices have been created but the PDFs could not be generated": "La facture a été émise mais le PDF n'a pas pu être généré",
"It has been invoiced but the PDF of refund not be generated": "Il a été facturé mais le PDF de remboursement n'a pas été généré",
- "Cannot send mail": "Impossible d'envoyer le mail"
+ "Cannot send mail": "Impossible d'envoyer le mail",
+ "Original invoice not found": "Facture originale introuvable",
+ "The quantity claimed cannot be greater than the quantity of the line": "Le montant réclamé ne peut pas être supérieur au montant de la ligne"
}
diff --git a/loopback/locale/pt.json b/loopback/locale/pt.json
index 95c1fff0a..a43f0e780 100644
--- a/loopback/locale/pt.json
+++ b/loopback/locale/pt.json
@@ -358,6 +358,9 @@
"This workCenter is already assigned to this agency": "Este centro de trabalho já está atribuído a esta agência",
"Select ticket or client": "Selecione um ticket ou cliente",
"It was not able to create the invoice": "Não foi possível criar a fatura",
- "It has been invoiced but the PDF could not be generated": "Foi faturado, mas o PDF não pôde ser gerado",
- "It has been invoiced but the PDF of refund not be generated": "Foi faturado mas não foi gerado o PDF do reembolso"
+ "The invoices have been created but the PDFs could not be generated": "Foi faturado, mas o PDF não pôde ser gerado",
+ "It has been invoiced but the PDF of refund not be generated": "Foi faturado mas não foi gerado o PDF do reembolso",
+ "Original invoice not found": "Fatura original não encontrada",
+ "Cannot send mail": "Não é possível enviar o email",
+ "The quantity claimed cannot be greater than the quantity of the line": "O valor reclamado não pode ser superior ao valor da linha"
}
diff --git a/loopback/server/boot/role-resolver.js b/loopback/server/boot/role-resolver.js
new file mode 100644
index 000000000..183d64de1
--- /dev/null
+++ b/loopback/server/boot/role-resolver.js
@@ -0,0 +1,9 @@
+module.exports = async function(app) {
+ const models = app.models;
+
+ models.VnRole.registerResolver('$subordinate', async(role, ctx) => {
+ if (!ctx.accessToken) return false;
+ const httpCtx = {req: {accessToken: {userId: ctx.accessToken.userId}}};
+ return models.Worker.isSubordinate(httpCtx, +ctx.modelId);
+ });
+};
diff --git a/loopback/util/flatten.js b/loopback/util/flatten.js
new file mode 100644
index 000000000..18d682d1f
--- /dev/null
+++ b/loopback/util/flatten.js
@@ -0,0 +1,42 @@
+/**
+ * Flattens an array of objects by converting each object into a flat structure.
+ *
+ * @param {Array} dataArray Array of objects to be flattened
+ * @return {Array} Array of flattened objects
+ */
+function flatten(dataArray) {
+ return dataArray.map(item => flattenObj(item.__data));
+}
+
+/**
+ * Recursively flattens an object, converting nested properties into a single level object
+ * with keys representing the original nested structure.
+ *
+ * @param {Object} data The object to be flattened
+ * @param {String} [prefix=''] Optional prefix for nested keys
+ * @return {Object} Flattened object
+ */
+function flattenObj(data, prefix = '') {
+ let result = {};
+ try {
+ for (let key in data) {
+ if (!data[key]) continue;
+
+ const newKey = prefix ? `${prefix}_${key}` : key;
+ const value = data[key];
+
+ if (typeof value === 'object' && value !== null && !Array.isArray(value))
+ Object.assign(result, flattenObj(value.__data, newKey));
+ else
+ result[newKey] = value;
+ }
+ } catch (error) {
+ console.error(error);
+ }
+
+ return result;
+}
+module.exports = {
+ flatten,
+ flattenObj,
+};
diff --git a/modules/account/back/model-config.json b/modules/account/back/model-config.json
index 0cd43d0ce..cfec1fbe4 100644
--- a/modules/account/back/model-config.json
+++ b/modules/account/back/model-config.json
@@ -1,4 +1,7 @@
{
+ "Account": {
+ "dataSource": "vn"
+ },
"AccountConfig": {
"dataSource": "vn"
},
@@ -47,9 +50,6 @@
"SipConfig": {
"dataSource": "vn"
},
- "Account": {
- "dataSource": "vn"
- },
"UserLog": {
"dataSource": "vn"
},
diff --git a/modules/account/back/models/account.json b/modules/account/back/models/account.json
index 6c2784696..fc1bbeb3d 100644
--- a/modules/account/back/models/account.json
+++ b/modules/account/back/models/account.json
@@ -46,4 +46,4 @@
"permission": "ALLOW"
}
]
-}
+}
\ No newline at end of file
diff --git a/modules/claim/back/methods/claim-beginning/specs/claim-beginning.spec.js b/modules/claim/back/methods/claim-beginning/specs/claim-beginning.spec.js
new file mode 100644
index 000000000..b7974ad23
--- /dev/null
+++ b/modules/claim/back/methods/claim-beginning/specs/claim-beginning.spec.js
@@ -0,0 +1,55 @@
+const models = require('vn-loopback/server/server').models;
+const LoopBackContext = require('loopback-context');
+
+describe('ClaimBeginning model()', () => {
+ const claimFk = 1;
+ const activeCtx = {
+ accessToken: {userId: 18},
+ headers: {origin: 'localhost:5000'},
+ __: () => {}
+ };
+
+ beforeEach(() => {
+ spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
+ active: activeCtx
+ });
+ });
+
+ it('should change quantity claimed', async() => {
+ const tx = await models.ClaimBeginning.beginTransaction({});
+
+ let error;
+ try {
+ const options = {transaction: tx};
+ const claim = await models.ClaimBeginning.findOne({where: {claimFk}}, options);
+ const sale = await models.Sale.findById(claim.saleFk, {}, options);
+ await claim.updateAttribute('quantity', sale.quantity - 1, options);
+
+ await tx.rollback();
+ } catch (e) {
+ error = e;
+ await tx.rollback();
+ }
+
+ expect(error).toBeUndefined();
+ });
+
+ it('should throw error when quantity claimed is greater than quantity of the sale', async() => {
+ const tx = await models.ClaimBeginning.beginTransaction({});
+
+ let error;
+ try {
+ const options = {transaction: tx};
+ const claim = await models.ClaimBeginning.findOne({where: {claimFk}}, options);
+ const sale = await models.Sale.findById(claim.saleFk, {}, options);
+ await claim.updateAttribute('quantity', sale.quantity + 1, options);
+
+ await tx.rollback();
+ } catch (e) {
+ error = e;
+ await tx.rollback();
+ }
+
+ expect(error.toString()).toContain('The quantity claimed cannot be greater than the quantity of the line');
+ });
+});
diff --git a/modules/claim/back/models/claim-beginning.js b/modules/claim/back/models/claim-beginning.js
index d269b2285..3dc9261c3 100644
--- a/modules/claim/back/models/claim-beginning.js
+++ b/modules/claim/back/models/claim-beginning.js
@@ -10,16 +10,21 @@ module.exports = Self => {
});
Self.observe('before save', async ctx => {
+ const options = ctx.options;
+ const models = Self.app.models;
+ const saleFk = ctx?.currentInstance?.saleFk || ctx?.instance?.saleFk;
+ const sale = await models.Sale.findById(saleFk, {fields: ['ticketFk', 'quantity']}, options);
+
if (ctx.isNewInstance) {
- const models = Self.app.models;
- const options = ctx.options;
- const instance = ctx.instance;
- const ticket = await models.Sale.findById(instance.saleFk, {fields: ['ticketFk']}, options);
- const claim = await models.Claim.findById(instance.claimFk, {fields: ['ticketFk']}, options);
- if (ticket.ticketFk != claim.ticketFk)
+ const claim = await models.Claim.findById(ctx.instance.claimFk, {fields: ['ticketFk']}, options);
+ if (sale.ticketFk != claim.ticketFk)
throw new UserError(`Cannot create a new claimBeginning from a different ticket`);
}
+
await claimIsEditable(ctx);
+
+ if (sale?.quantity && ctx.data?.quantity && ctx.data.quantity > sale?.quantity)
+ throw new UserError('The quantity claimed cannot be greater than the quantity of the line');
});
Self.observe('before delete', async ctx => {
diff --git a/modules/client/back/models/address.js b/modules/client/back/models/address.js
index 4a93b5d5c..7011008a4 100644
--- a/modules/client/back/models/address.js
+++ b/modules/client/back/models/address.js
@@ -43,8 +43,14 @@ module.exports = Self => {
include: [{
relation: 'province',
scope: {
- fields: ['id', 'name']
- }
+ fields: ['id', 'name', 'countryFk'],
+ include: [
+ {
+ relation: 'country',
+ scope: {fields: ['id', 'name']},
+ },
+ ],
+ },
}, {
relation: 'agencyMode',
scope: {
diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js
index 0a8ebcae5..dc19c5d81 100644
--- a/modules/client/back/models/client.js
+++ b/modules/client/back/models/client.js
@@ -320,7 +320,8 @@ module.exports = Self => {
// Credit management changes
- if (changes?.rating >= 0 || changes?.recommendedCredit >= 0)
+ if ((changes?.rating != null && changes.rating >= 0)
+ || (changes?.recommendedCredit != null && changes.recommendedCredit >= 0))
await Self.changeCreditManagement(ctx, finalState, changes);
const oldInstance = {};
diff --git a/modules/client/front/balance/create/index.js b/modules/client/front/balance/create/index.js
index 9113d7605..f1474e10c 100644
--- a/modules/client/front/balance/create/index.js
+++ b/modules/client/front/balance/create/index.js
@@ -23,6 +23,7 @@ class Controller extends Dialog {
}
set clientFk(value) {
+ if (!value) return;
this.receipt.clientFk = value;
const filter = {
@@ -152,7 +153,7 @@ class Controller extends Dialog {
getAmountPaid() {
const filter = {
where: {
- clientFk: this.$params.id,
+ clientFk: this.$params.id ?? this.clientFk,
companyFk: this.receipt.companyFk
}
};
@@ -210,8 +211,8 @@ ngModule.vnComponent('vnClientBalanceCreate', {
payed: '',
bankFk: '',
amountPaid: '',
+ clientFk: '',
companyFk: '',
description: '',
- clientFk: ''
}
});
diff --git a/modules/entry/back/methods/entry/filter.js b/modules/entry/back/methods/entry/filter.js
index 776544bc6..f4703245c 100644
--- a/modules/entry/back/methods/entry/filter.js
+++ b/modules/entry/back/methods/entry/filter.js
@@ -106,10 +106,15 @@ module.exports = Self => {
description: `The to shipped date filter`
},
{
- arg: 'days',
+ arg: 'daysOnward',
type: 'number',
description: `N days interval`
},
+ {
+ arg: 'daysAgo',
+ type: 'number',
+ description: `N days ago interval`
+ },
{
arg: 'invoiceAmount',
type: 'number',
@@ -216,16 +221,29 @@ module.exports = Self => {
JOIN vn.currency cu ON cu.id = e.currencyFk`
);
- if (ctx.args.days) {
- stmt.merge({
- sql: `
- AND t.shipped <= util.VN_CURDATE() + INTERVAL ? DAY
- AND t.shipped >= util.VN_CURDATE()
- `,
- params: [ctx.args.days]
- });
+ stmt.merge(conn.makeWhere(filter.where));
+
+ const {daysAgo, daysOnward} = ctx.args;
+ if (daysOnward || daysAgo) {
+ const params = [];
+ let today = 'util.VN_CURDATE()';
+ let from = today;
+ let to = today;
+
+ if (daysAgo) {
+ from += ' - INTERVAL ? DAY';
+ params.push(daysAgo);
+ }
+ if (daysOnward) {
+ to += ' + INTERVAL ? DAY';
+ params.push(daysOnward);
+ }
+
+ const whereDays = (filter.where ? 'AND' : 'WHERE') + ` t.shipped BETWEEN ${from} AND ${to}`;
+ stmt.merge({sql: whereDays, params});
}
- stmt.merge(conn.makeSuffix(filter));
+
+ stmt.merge(conn.makePagination(filter));
const itemsIndex = stmts.push(stmt) - 1;
const sql = ParameterizedSQL.join(stmts, ';');
diff --git a/modules/entry/back/methods/entry/getBuysCsv.js b/modules/entry/back/methods/entry/getBuysCsv.js
new file mode 100644
index 000000000..4bd246fa0
--- /dev/null
+++ b/modules/entry/back/methods/entry/getBuysCsv.js
@@ -0,0 +1,44 @@
+const {toCSV} = require('vn-loopback/util/csv');
+const {flatten} = require('vn-loopback/util/flatten');
+const UserError = require('vn-loopback/util/user-error');
+
+module.exports = Self => {
+ Self.remoteMethodCtx('getBuysCsv', {
+ description: 'Returns buys for one entry in CSV file format',
+ accessType: 'READ',
+ accepts: [{
+ arg: 'id',
+ type: 'number',
+ required: true,
+ description: 'The entry id',
+ http: {source: 'path'}
+ }
+ ],
+ returns: [
+ {
+ arg: 'body',
+ type: 'file',
+ root: true
+ }, {
+ arg: 'Content-Type',
+ type: 'String',
+ http: {target: 'header'}
+ }, {
+ arg: 'Content-Disposition',
+ type: 'String',
+ http: {target: 'header'}
+ }
+ ],
+ http: {
+ path: `/:id/getBuysCsv`,
+ verb: 'GET'
+ }
+ });
+
+ Self.getBuysCsv = async(ctx, id, options) => {
+ const data = await Self.getBuys(ctx, id, null, options);
+ if (!data.length) throw new UserError('The entry has no lines or does not exist');
+ const dataFlatted = flatten(data);
+ return [toCSV(dataFlatted), 'text/csv', `inline; filename="buys-${id}.csv"`];
+ };
+};
diff --git a/modules/entry/back/methods/entry/print.js b/modules/entry/back/methods/entry/print.js
index c155c3d8b..5b9de9a69 100644
--- a/modules/entry/back/methods/entry/print.js
+++ b/modules/entry/back/methods/entry/print.js
@@ -53,6 +53,13 @@ module.exports = Self => {
}
if (!merger._doc) throw new UserError('The entry not have stickers');
+
+ await Self.rawSql(`
+ UPDATE buy
+ SET printedStickers = stickers
+ WHERE entryFk = ?
+ `, [id], myOptions);
+
return [await merger.saveAsBuffer(), 'application/pdf', `filename="entry-${id}.pdf"`];
};
};
diff --git a/modules/entry/back/methods/entry/specs/filter.spec.js b/modules/entry/back/methods/entry/specs/filter.spec.js
index c7156062a..105838858 100644
--- a/modules/entry/back/methods/entry/specs/filter.spec.js
+++ b/modules/entry/back/methods/entry/specs/filter.spec.js
@@ -49,13 +49,13 @@ describe('Entry filter()', () => {
});
describe('should return the entry matching the supplier', () => {
- it('when userId is supplier ', async() => {
+ it('when userId is supplier and searching days onward', async() => {
const tx = await models.Entry.beginTransaction({});
const options = {transaction: tx};
try {
const ctx = {
- args: {days: 6},
+ args: {daysOnward: 6},
req: {accessToken: {userId: 1102}}
};
@@ -70,6 +70,27 @@ describe('Entry filter()', () => {
}
});
+ it('when userId is supplier and searching days ago', async() => {
+ const tx = await models.Entry.beginTransaction({});
+ const options = {transaction: tx};
+
+ try {
+ const ctx = {
+ args: {daysAgo: 31},
+ req: {accessToken: {userId: 1102}}
+ };
+
+ const result = await models.Entry.filter(ctx, options);
+
+ expect(result.length).toEqual(6);
+
+ await tx.rollback();
+ } catch (e) {
+ await tx.rollback();
+ throw e;
+ }
+ });
+
it('when userId is supplier fetching other supplier', async() => {
const tx = await models.Entry.beginTransaction({});
const options = {transaction: tx};
diff --git a/modules/entry/back/methods/stock-bought/getStockBought.js b/modules/entry/back/methods/stock-bought/getStockBought.js
new file mode 100644
index 000000000..c1f99c496
--- /dev/null
+++ b/modules/entry/back/methods/stock-bought/getStockBought.js
@@ -0,0 +1,58 @@
+module.exports = Self => {
+ Self.remoteMethod('getStockBought', {
+ description: 'Returns the stock bought for a given date',
+ accessType: 'READ',
+ accepts: [{
+ arg: 'workerFk',
+ type: 'number',
+ description: 'The id for a buyer',
+ },
+ {
+ arg: 'dated',
+ type: 'date',
+ description: 'The date to filter',
+ }
+ ],
+ returns: {
+ type: ['object'],
+ root: true
+ },
+ http: {
+ path: `/getStockBought`,
+ verb: 'GET'
+ }
+ });
+
+ Self.getStockBought = async(workerFk, dated = Date.vnNew()) => {
+ const models = Self.app.models;
+ const today = Date.vnNew();
+ dated.setHours(0, 0, 0, 0);
+ today.setHours(0, 0, 0, 0);
+
+ await models.StockBought.rawSql(`CALL vn.stockBought_calculate(?)`, [dated]);
+
+ const filter = {
+ where: {dated},
+ include: [
+ {
+ fields: ['workerFk', 'reserve', 'bought'],
+ relation: 'worker',
+ scope: {
+ include: [
+ {
+ relation: 'user',
+ scope: {
+ fields: ['id', 'name']
+ }
+ }
+ ]
+ }
+ }
+ ]
+ };
+
+ if (workerFk) filter.where.workerFk = workerFk;
+
+ return models.StockBought.find(filter);
+ };
+};
diff --git a/modules/entry/back/methods/stock-bought/getStockBoughtDetail.js b/modules/entry/back/methods/stock-bought/getStockBoughtDetail.js
new file mode 100644
index 000000000..3e040d0d3
--- /dev/null
+++ b/modules/entry/back/methods/stock-bought/getStockBoughtDetail.js
@@ -0,0 +1,74 @@
+module.exports = Self => {
+ Self.remoteMethod('getStockBoughtDetail', {
+ description: 'Returns the detail of stock bought for a given date and a worker',
+ accessType: 'READ',
+ accepts: [{
+ arg: 'workerFk',
+ type: 'number',
+ description: 'The worker to filter',
+ required: true,
+ }, {
+ arg: 'dated',
+ type: 'string',
+ description: 'The date to filter',
+ required: true,
+ }
+ ],
+ returns: {
+ type: ['object'],
+ root: true
+ },
+ http: {
+ path: `/getStockBoughtDetail`,
+ verb: 'GET'
+ }
+ });
+
+ Self.getStockBoughtDetail = async(workerFk, dated) => {
+ const models = Self.app.models;
+ const myOptions = {};
+ let tx;
+ let result;
+
+ if (typeof options == 'object')
+ Object.assign(myOptions, options);
+
+ if (!myOptions.transaction) {
+ tx = await Self.beginTransaction({});
+ myOptions.transaction = tx;
+ }
+
+ try {
+ await models.StockBought.rawSql(`CALL vn.item_calculateStock(?)`, [dated], myOptions);
+ result = await Self.rawSql(
+ `SELECT b.entryFk entryFk,
+ i.id itemFk,
+ i.name itemName,
+ ti.quantity,
+ (ac.conversionCoefficient * (ti.quantity / b.packing) * buy_getVolume(b.id))
+ / (vc.trolleyM3 * 1000000) volume,
+ b.packagingFk packagingFk,
+ b.packing
+ FROM tmp.item ti
+ JOIN item i ON i.id = ti.itemFk
+ JOIN itemType it ON i.typeFk = it.id
+ JOIN itemCategory ic ON ic.id = it.categoryFk
+ JOIN worker w ON w.id = it.workerFk
+ JOIN auctionConfig ac
+ JOIN tmp.buyUltimate bu ON bu.itemFk = i.id
+ AND bu.warehouseFk = ac.warehouseFk
+ JOIN buy b ON b.id = bu.buyFk
+ JOIN volumeConfig vc
+ WHERE ic.display
+ AND w.id = ?`,
+ [workerFk], myOptions
+ );
+ await Self.rawSql(`DROP TEMPORARY TABLE tmp.item, tmp.buyUltimate;`, [], myOptions);
+ if (tx) await tx.commit();
+ return result;
+ } catch (e) {
+ await tx.rollback();
+ throw e;
+ }
+ };
+};
diff --git a/modules/entry/back/model-config.json b/modules/entry/back/model-config.json
index dc7fd86be..5c45b6e07 100644
--- a/modules/entry/back/model-config.json
+++ b/modules/entry/back/model-config.json
@@ -25,5 +25,8 @@
},
"EntryType": {
"dataSource": "vn"
+ },
+ "StockBought": {
+ "dataSource": "vn"
}
-}
\ No newline at end of file
+}
diff --git a/modules/entry/back/models/entry.js b/modules/entry/back/models/entry.js
index b11d64415..8ca79f531 100644
--- a/modules/entry/back/models/entry.js
+++ b/modules/entry/back/models/entry.js
@@ -3,6 +3,7 @@ module.exports = Self => {
require('../methods/entry/filter')(Self);
require('../methods/entry/getEntry')(Self);
require('../methods/entry/getBuys')(Self);
+ require('../methods/entry/getBuysCsv')(Self);
require('../methods/entry/importBuys')(Self);
require('../methods/entry/importBuysPreview')(Self);
require('../methods/entry/lastItemBuys')(Self);
diff --git a/modules/entry/back/models/stock-bought.js b/modules/entry/back/models/stock-bought.js
new file mode 100644
index 000000000..ae52e7654
--- /dev/null
+++ b/modules/entry/back/models/stock-bought.js
@@ -0,0 +1,10 @@
+const UserError = require('vn-loopback/util/user-error');
+module.exports = Self => {
+ require('../methods/stock-bought/getStockBought')(Self);
+ require('../methods/stock-bought/getStockBoughtDetail')(Self);
+ Self.rewriteDbError(function(err) {
+ if (err.code === 'ER_DUP_ENTRY')
+ return new UserError(`This buyer has already made a reservation for this date`);
+ return err;
+ });
+};
diff --git a/modules/entry/back/models/stock-bought.json b/modules/entry/back/models/stock-bought.json
new file mode 100644
index 000000000..18c9f0347
--- /dev/null
+++ b/modules/entry/back/models/stock-bought.json
@@ -0,0 +1,34 @@
+{
+ "name": "StockBought",
+ "base": "VnModel",
+ "options": {
+ "mysql": {
+ "table": "stockBought"
+ }
+ },
+ "properties": {
+ "id": {
+ "type": "number",
+ "id": true
+ },
+ "workerFk": {
+ "type": "number"
+ },
+ "bought": {
+ "type": "number"
+ },
+ "reserve": {
+ "type": "number"
+ },
+ "dated": {
+ "type": "date"
+ }
+ },
+ "relations": {
+ "worker": {
+ "type": "belongsTo",
+ "model": "Worker",
+ "foreignKey": "workerFk"
+ }
+ }
+}
diff --git a/modules/invoiceIn/back/methods/invoice-in/filter.js b/modules/invoiceIn/back/methods/invoice-in/filter.js
index 8a884e211..936f7bb6c 100644
--- a/modules/invoiceIn/back/methods/invoice-in/filter.js
+++ b/modules/invoiceIn/back/methods/invoice-in/filter.js
@@ -138,9 +138,9 @@ module.exports = Self => {
? {'ii.id': value}
: {'s.name': {like: `%${value}%`}};
case 'from':
- return {'ii.created': {gte: value}};
+ return {'ii.issued': {gte: value}};
case 'to':
- return {'ii.created': {lte: value}};
+ return {'ii.issued': {lte: value}};
case 'fi':
return {'s.nif': value};
case 'account':
@@ -173,7 +173,6 @@ module.exports = Self => {
const stmt = new ParameterizedSQL(
`SELECT
ii.id,
- ii.serialNumber,
ii.serial,
ii.issued,
ii.isBooked,
diff --git a/modules/invoiceIn/back/methods/invoice-in/getTotals.js b/modules/invoiceIn/back/methods/invoice-in/getTotals.js
index 7bef9f7e9..c4e73abc2 100644
--- a/modules/invoiceIn/back/methods/invoice-in/getTotals.js
+++ b/modules/invoiceIn/back/methods/invoice-in/getTotals.js
@@ -27,10 +27,12 @@ module.exports = Self => {
const [result] = await Self.rawSql(`
SELECT iit.*,
- SUM(iidd.amount) totalDueDay
+ SUM(iidd.amount) totalDueDay,
+ SUM(iidd.foreignValue) totalDueDayForeignValue
FROM vn.invoiceIn ii
LEFT JOIN (
SELECT SUM(iit.taxableBase) totalTaxableBase,
+ SUM(iit.foreignValue) totalTaxableBaseForeignValue,
CAST(
SUM(IFNULL(iit.taxableBase * (1 + (ti.PorcentajeIva / 100)), iit.taxableBase))
AS DECIMAL(10, 2)
diff --git a/modules/invoiceIn/back/methods/invoice-in/specs/filter.spec.js b/modules/invoiceIn/back/methods/invoice-in/specs/filter.spec.js
index ff2164783..48310b32a 100644
--- a/modules/invoiceIn/back/methods/invoice-in/specs/filter.spec.js
+++ b/modules/invoiceIn/back/methods/invoice-in/specs/filter.spec.js
@@ -47,29 +47,6 @@ describe('InvoiceIn filter()', () => {
}
});
- it('should return the invoice in matching the serial number', async() => {
- const tx = await models.InvoiceIn.beginTransaction({});
- const options = {transaction: tx};
-
- try {
- const ctx = {
- args: {
- serialNumber: '1002',
- }
- };
-
- const result = await models.InvoiceIn.filter(ctx, {}, options);
-
- expect(result.length).toEqual(1);
- expect(result[0].serialNumber).toEqual(1002);
-
- await tx.rollback();
- } catch (e) {
- await tx.rollback();
- throw e;
- }
- });
-
it('should return the invoice in matching the account', async() => {
const tx = await models.InvoiceIn.beginTransaction({});
const options = {transaction: tx};
@@ -158,7 +135,7 @@ describe('InvoiceIn filter()', () => {
const result = await models.InvoiceIn.filter(ctx, {}, options);
- expect(result.length).toEqual(5);
+ expect(result.length).toEqual(6);
await tx.rollback();
} catch (e) {
diff --git a/modules/invoiceOut/back/methods/invoiceOut/invoiceClient.js b/modules/invoiceOut/back/methods/invoiceOut/invoiceClient.js
index 2c44cef34..2fad1afd8 100644
--- a/modules/invoiceOut/back/methods/invoiceOut/invoiceClient.js
+++ b/modules/invoiceOut/back/methods/invoiceOut/invoiceClient.js
@@ -47,12 +47,16 @@ module.exports = Self => {
Self.invoiceClient = async(ctx, options) => {
const args = ctx.args;
const models = Self.app.models;
- options = typeof options === 'object' ? {...options} : {};
- options.userId = ctx.req.accessToken.userId;
-
let tx;
- if (!options.transaction)
- tx = options.transaction = await Self.beginTransaction({});
+ const myOptions = {userId: ctx.req.accessToken.userId};
+
+ if (typeof options == 'object')
+ Object.assign(myOptions, options);
+
+ if (!myOptions.transaction) {
+ tx = await Self.beginTransaction({});
+ myOptions.transaction = tx;
+ }
const minShipped = Date.vnNew();
minShipped.setFullYear(args.maxShipped.getFullYear() - 1);
@@ -60,7 +64,7 @@ module.exports = Self => {
try {
const client = await models.Client.findById(args.clientId, {
fields: ['id', 'hasToInvoiceByAddress']
- }, options);
+ }, myOptions);
if (client.hasToInvoiceByAddress) {
await Self.rawSql('CALL ticketToInvoiceByAddress(?, ?, ?, ?)', [
@@ -68,13 +72,13 @@ module.exports = Self => {
args.maxShipped,
args.addressId,
args.companyFk
- ], options);
+ ], myOptions);
} else {
await Self.rawSql('CALL invoiceFromClient(?, ?, ?)', [
args.maxShipped,
client.id,
args.companyFk
- ], options);
+ ], myOptions);
}
const invoiceId = await models.Ticket.makeInvoice(
@@ -83,7 +87,7 @@ module.exports = Self => {
args.companyFk,
args.invoiceDate,
null,
- options
+ myOptions
);
if (tx) await tx.commit();
diff --git a/modules/invoiceOut/back/methods/invoiceOut/refundAndInvoice.js b/modules/invoiceOut/back/methods/invoiceOut/refundAndInvoice.js
new file mode 100644
index 000000000..41a645ff3
--- /dev/null
+++ b/modules/invoiceOut/back/methods/invoiceOut/refundAndInvoice.js
@@ -0,0 +1,95 @@
+module.exports = Self => {
+ Self.remoteMethodCtx('refundAndInvoice', {
+ description: 'Refund an invoice and create a new one',
+ accessType: 'WRITE',
+ accepts: [
+ {
+ arg: 'id',
+ type: 'number',
+ required: true,
+ description: 'Issued invoice id'
+ },
+ {
+ arg: 'withWarehouse',
+ type: 'boolean',
+ required: true
+ },
+ {
+ arg: 'cplusRectificationTypeFk',
+ type: 'number',
+ required: true
+ },
+ {
+ arg: 'siiTypeInvoiceOutFk',
+ type: 'number',
+ required: true
+ },
+ {
+ arg: 'invoiceCorrectionTypeFk',
+ type: 'number',
+ required: true
+ },
+ ],
+ returns: {
+ type: 'object',
+ root: true
+ },
+ http: {
+ path: '/refundAndInvoice',
+ verb: 'post'
+ }
+ });
+
+ Self.refundAndInvoice = async(
+ ctx,
+ id,
+ withWarehouse,
+ cplusRectificationTypeFk,
+ siiTypeInvoiceOutFk,
+ invoiceCorrectionTypeFk,
+ options
+ ) => {
+ const models = Self.app.models;
+ const myOptions = {userId: ctx.req.accessToken.userId};
+ let refundId;
+
+ if (typeof options == 'object')
+ Object.assign(myOptions, options);
+
+ let tx;
+ if (!myOptions.transaction) {
+ tx = await Self.beginTransaction({});
+ myOptions.transaction = tx;
+ }
+
+ try {
+ const originalInvoice = await models.InvoiceOut.findById(id, myOptions);
+
+ const refundedTickets = await Self.refund(ctx, originalInvoice.ref, withWarehouse, myOptions);
+
+ const invoiceCorrection = {
+ correctedFk: id,
+ cplusRectificationTypeFk,
+ siiTypeInvoiceOutFk,
+ invoiceCorrectionTypeFk
+ };
+ const ticketIds = refundedTickets.map(ticket => ticket.id);
+ refundId = await models.Ticket.invoiceTickets(ctx, ticketIds, invoiceCorrection, myOptions);
+
+ tx && await tx.commit();
+ } catch (e) {
+ if (tx) await tx.rollback();
+ throw e;
+ }
+
+ if (tx) {
+ try {
+ await models.InvoiceOut.makePdfList(ctx, refundId);
+ } catch (e) {
+ throw new UserError('The invoices have been created but the PDFs could not be generated');
+ }
+ }
+
+ return {refundId};
+ };
+};
diff --git a/modules/invoiceOut/back/methods/invoiceOut/specs/makePdfAndNotify.spec.js b/modules/invoiceOut/back/methods/invoiceOut/specs/makePdfAndNotify.spec.js
new file mode 100644
index 000000000..002face07
--- /dev/null
+++ b/modules/invoiceOut/back/methods/invoiceOut/specs/makePdfAndNotify.spec.js
@@ -0,0 +1,105 @@
+const models = require('vn-loopback/server/server').models;
+const LoopBackContext = require('loopback-context');
+const UserError = require('vn-loopback/util/user-error');
+
+describe('InvoiceOut makePdfAndNotify()', () => {
+ const userId = 5;
+ const ctx = {
+ req: {
+ accessToken: {userId},
+ __: (key, obj) => `Translated: ${key}, ${JSON.stringify(obj)}`,
+ getLocale: () => 'es'
+ },
+ args: {}
+ };
+ const activeCtx = {accessToken: {userId}};
+ const id = 4;
+ const printerFk = 1;
+
+ beforeEach(() => {
+ spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({active: activeCtx});
+ });
+
+ it('should generate PDF and send email when client is to be mailed', async() => {
+ const tx = await models.InvoiceOut.beginTransaction({});
+ const options = {transaction: tx};
+
+ try {
+ await models.InvoiceOut.makePdfAndNotify(ctx, id, printerFk, options);
+
+ const invoice = await models.InvoiceOut.findById(id, {
+ fields: ['ref', 'clientFk'],
+ include: {
+ relation: 'client',
+ scope: {
+ fields: ['id', 'email', 'isToBeMailed', 'salesPersonFk']
+ }
+ }
+ }, options);
+
+ expect(invoice).toBeDefined();
+ expect(invoice.client().isToBeMailed).toBe(true);
+
+ await tx.rollback();
+ } catch (e) {
+ await tx.rollback();
+ throw e;
+ }
+ });
+
+ it('should generate PDF and print when client is not to be mailed', async() => {
+ const tx = await models.InvoiceOut.beginTransaction({});
+ const options = {transaction: tx};
+
+ try {
+ await models.InvoiceOut.makePdfAndNotify(ctx, id, null, options);
+
+ const invoice = await models.InvoiceOut.findById(id, {
+ fields: ['ref', 'clientFk'],
+ include: {
+ relation: 'client',
+ scope: {
+ fields: ['id', 'email', 'isToBeMailed', 'salesPersonFk']
+ }
+ }
+ }, options);
+
+ expect(invoice).toBeDefined();
+
+ await tx.rollback();
+ } catch (e) {
+ await tx.rollback();
+ throw e;
+ }
+ });
+
+ it('should throw UserError when PDF generation fails', async() => {
+ const tx = await models.InvoiceOut.beginTransaction({});
+ const options = {transaction: tx};
+
+ try {
+ await models.InvoiceOut.makePdfAndNotify(ctx, null, null, options);
+ await tx.rollback();
+ } catch (e) {
+ expect(e instanceof UserError).toBe(true);
+ expect(e.message).toContain('Error while generating PDF');
+ await tx.rollback();
+ }
+ });
+
+ it('should send message to salesperson when email fails', async() => {
+ const tx = await models.InvoiceOut.beginTransaction({});
+ const options = {transaction: tx};
+
+ try {
+ spyOn(models.InvoiceOut, 'invoiceEmail').and.rejectWith(new Error('Test Error'));
+ await models.InvoiceOut.makePdfAndNotify(ctx, id, null, options);
+ await tx.rollback();
+ } catch (e) {
+ expect(e instanceof UserError).toBe(true);
+ expect(e.message).toContain('Error when sending mail to client');
+
+ await tx.rollback();
+ }
+ });
+});
diff --git a/modules/invoiceOut/back/methods/invoiceOut/specs/refundAndInvoice.spec.js b/modules/invoiceOut/back/methods/invoiceOut/specs/refundAndInvoice.spec.js
new file mode 100644
index 000000000..ed15fb404
--- /dev/null
+++ b/modules/invoiceOut/back/methods/invoiceOut/specs/refundAndInvoice.spec.js
@@ -0,0 +1,81 @@
+const models = require('vn-loopback/server/server').models;
+const LoopBackContext = require('loopback-context');
+
+describe('InvoiceOut refundAndInvoice()', () => {
+ const userId = 5;
+ const ctx = {req: {accessToken: {userId}}};
+ const activeCtx = {accessToken: {userId}};
+ const id = 4;
+ const cplusRectificationTypeFk = 1;
+ const siiTypeInvoiceOutFk = 1;
+ const invoiceCorrectionTypeFk = 1;
+
+ beforeEach(() => {
+ spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({active: activeCtx});
+ });
+
+ it('should refund an invoice and create a new invoice with warehouse', async() => {
+ const tx = await models.InvoiceOut.beginTransaction({});
+ const options = {transaction: tx};
+ const withWarehouse = true;
+
+ try {
+ const result = await models.InvoiceOut.refundAndInvoice(
+ ctx,
+ id,
+ withWarehouse,
+ cplusRectificationTypeFk,
+ siiTypeInvoiceOutFk,
+ invoiceCorrectionTypeFk,
+ options
+ );
+
+ expect(result).toBeDefined();
+ expect(result.refundId).toBeDefined();
+
+ const invoicesAfter = await models.InvoiceOut.find({where: {id: result.refundId}}, options);
+ const ticketsAfter = await models.Ticket.find(
+ {where: {refFk: 'R10100001', warehouse: {neq: null}}}, options);
+
+ expect(invoicesAfter.length).toBeGreaterThan(0);
+ expect(ticketsAfter.length).toBeGreaterThan(0);
+
+ await tx.rollback();
+ } catch (e) {
+ await tx.rollback();
+ throw e;
+ }
+ });
+
+ it('should refund an invoice and create a new invoice with warehouse null', async() => {
+ const tx = await models.InvoiceOut.beginTransaction({});
+ const options = {transaction: tx};
+ const withWarehouse = false;
+
+ try {
+ const result = await models.InvoiceOut.refundAndInvoice(
+ ctx,
+ id,
+ withWarehouse,
+ cplusRectificationTypeFk,
+ siiTypeInvoiceOutFk,
+ invoiceCorrectionTypeFk,
+ options
+ );
+
+ expect(result).toBeDefined();
+ expect(result.refundId).toBeDefined();
+
+ const invoicesAfter = await models.InvoiceOut.find({where: {id: result.refundId}}, options);
+ const ticketsAfter = await models.Ticket.find({where: {refFk: 'R10100001', warehouse: null}}, options);
+
+ expect(invoicesAfter.length).toBeGreaterThan(0);
+ expect(ticketsAfter.length).toBeGreaterThan(0);
+
+ await tx.rollback();
+ } catch (e) {
+ await tx.rollback();
+ throw e;
+ }
+ });
+});
diff --git a/modules/invoiceOut/back/methods/invoiceOut/specs/transfer.spec.js b/modules/invoiceOut/back/methods/invoiceOut/specs/transfer.spec.js
new file mode 100644
index 000000000..8ec91743e
--- /dev/null
+++ b/modules/invoiceOut/back/methods/invoiceOut/specs/transfer.spec.js
@@ -0,0 +1,135 @@
+const models = require('vn-loopback/server/server').models;
+const LoopBackContext = require('loopback-context');
+const UserError = require('vn-loopback/util/user-error');
+
+describe('InvoiceOut transfer()', () => {
+ const userId = 5;
+ let options;
+ let tx;
+ let ctx;
+ const activeCtx = {accessToken: {userId}};
+ const id = 4;
+ const newClientFk = 1101;
+ const cplusRectificationTypeFk = 1;
+ const siiTypeInvoiceOutFk = 1;
+ const invoiceCorrectionTypeFk = 1;
+
+ beforeEach(async() => {
+ ctx = {
+ req: {
+ accessToken: {userId: 1106},
+ headers: {origin: 'http://localhost'},
+ __: value => value,
+ getLocale: () => 'es'
+ },
+ args: {}
+ };
+
+ spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({active: activeCtx});
+ options = {transaction: tx};
+ tx = await models.Sale.beginTransaction({});
+ options.transaction = tx;
+ });
+
+ afterEach(async() => {
+ await tx.rollback();
+ });
+
+ it('should transfer an invoice to a new client and return the new invoice ID', async() => {
+ const makeInvoice = true;
+ const makePdfListMock = spyOn(models.InvoiceOut, 'makePdfList').and.returnValue();
+
+ const [result] = await models.InvoiceOut.transfer(
+ ctx,
+ id,
+ newClientFk,
+ cplusRectificationTypeFk,
+ siiTypeInvoiceOutFk,
+ invoiceCorrectionTypeFk,
+ makeInvoice,
+ options
+ );
+
+ const newInvoice = await models.InvoiceOut.findById(result, null, options);
+
+ expect(newInvoice.clientFk).toBe(newClientFk);
+
+ const transferredTickets = await models.Ticket.find({
+ where: {
+ refFk: newInvoice.ref,
+ clientFk: newClientFk
+ }
+ }, options);
+
+ expect(transferredTickets.length).toBeGreaterThan(0);
+ expect(makePdfListMock).toHaveBeenCalledWith(ctx, [result]);
+ });
+
+ it('should throw an error if original invoice is not found', async() => {
+ const makeInvoice = true;
+ try {
+ await models.InvoiceOut.transfer(
+ ctx,
+ 'idNotExists',
+ newClientFk,
+ cplusRectificationTypeFk,
+ siiTypeInvoiceOutFk,
+ invoiceCorrectionTypeFk,
+ makeInvoice,
+ options
+ );
+ fail('Expected an error to be thrown');
+ } catch (e) {
+ expect(e).toBeInstanceOf(UserError);
+ expect(e.message).toBe('Original invoice not found');
+ }
+ });
+
+ it('should throw an error if the new client is the same as the original client', async() => {
+ const makeInvoice = true;
+ const originalInvoice = await models.InvoiceOut.findById(id, options);
+
+ try {
+ await models.InvoiceOut.transfer(
+ ctx,
+ id,
+ originalInvoice.clientFk,
+ cplusRectificationTypeFk,
+ siiTypeInvoiceOutFk,
+ invoiceCorrectionTypeFk,
+ makeInvoice,
+ options
+ );
+ fail('Expected an error to be thrown');
+ } catch (e) {
+ expect(e).toBeInstanceOf(UserError);
+ expect(e.message).toBe('Select a different client');
+ }
+ });
+
+ it('should not create a new invoice if makeInvoice is false', async() => {
+ const originalTickets = await models.Ticket.find({
+ where: {clientFk: newClientFk, refFk: null},
+ options
+ });
+
+ const result = await models.InvoiceOut.transfer(
+ ctx,
+ id,
+ newClientFk,
+ cplusRectificationTypeFk,
+ siiTypeInvoiceOutFk,
+ invoiceCorrectionTypeFk,
+ false,
+ options
+ );
+
+ expect(result).toBeUndefined();
+
+ const transferredTickets = await models.Ticket.find({
+ where: {clientFk: newClientFk, refFk: null}
+ }, options);
+
+ expect(transferredTickets.length).toBeGreaterThan(originalTickets.length);
+ });
+});
diff --git a/modules/invoiceOut/back/methods/invoiceOut/specs/transferinvoice.spec.js b/modules/invoiceOut/back/methods/invoiceOut/specs/transferinvoice.spec.js
deleted file mode 100644
index 22787e730..000000000
--- a/modules/invoiceOut/back/methods/invoiceOut/specs/transferinvoice.spec.js
+++ /dev/null
@@ -1,116 +0,0 @@
-const models = require('vn-loopback/server/server').models;
-const LoopBackContext = require('loopback-context');
-
-describe('InvoiceOut transferInvoice()', () => {
- const activeCtx = {
- accessToken: {userId: 5},
- http: {
- req: {
- headers: {origin: 'http://localhost'}
- }
- }
- };
- const ctx = {req: activeCtx};
-
- beforeEach(() => {
- spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
- active: activeCtx
- });
- });
-
- it('should return the id of the created issued invoice', async() => {
- const tx = await models.InvoiceOut.beginTransaction({});
- const options = {transaction: tx};
- const id = 4;
- const newClient = 1;
- spyOn(models.InvoiceOut, 'makePdfList');
-
- try {
- const {clientFk: oldClient} = await models.InvoiceOut.findById(id, {fields: ['clientFk']});
- const invoicesBefore = await models.InvoiceOut.find({}, options);
- const result = await models.InvoiceOut.transferInvoice(
- ctx,
- id,
- 'T4444444',
- newClient,
- 1,
- 1,
- 1,
- true,
- options);
- const invoicesAfter = await models.InvoiceOut.find({}, options);
- const rectificativeInvoice = invoicesAfter[invoicesAfter.length - 2];
- const newInvoice = invoicesAfter[invoicesAfter.length - 1];
-
- expect(result).toBeDefined();
- expect(invoicesAfter.length - invoicesBefore.length).toEqual(2);
- expect(rectificativeInvoice.clientFk).toEqual(oldClient);
- expect(newInvoice.clientFk).toEqual(newClient);
-
- await tx.rollback();
- } catch (e) {
- await tx.rollback();
- throw e;
- }
- });
-
- it('should throw an error when it is the same client', async() => {
- const tx = await models.InvoiceOut.beginTransaction({});
- const options = {transaction: tx};
- spyOn(models.InvoiceOut, 'makePdfList');
-
- try {
- await models.InvoiceOut.transferInvoice(ctx, '1', 'T1111111', 1101, 1, 1, 1, true, options);
- await tx.rollback();
- } catch (e) {
- expect(e.message).toBe(`Select a different client`);
- await tx.rollback();
- }
- });
-
- it('should throw an error when it is refund', async() => {
- const tx = await models.InvoiceOut.beginTransaction({});
- const options = {transaction: tx};
- spyOn(models.InvoiceOut, 'makePdfList');
- try {
- await models.InvoiceOut.transferInvoice(ctx, '1', 'T1111111', 1102, 1, 1, 1, true, options);
- await tx.rollback();
- } catch (e) {
- expect(e.message).toContain(`This ticket is already a refund`);
- await tx.rollback();
- }
- });
-
- it('should throw an error when pdf failed', async() => {
- const tx = await models.InvoiceOut.beginTransaction({});
- const options = {transaction: tx};
- spyOn(models.InvoiceOut, 'makePdfList').and.returnValue(() => {
- throw new Error('test');
- });
-
- try {
- await models.InvoiceOut.transferInvoice(ctx, '1', 'T1111111', 1102, 1, 1, 1, true, options);
- await tx.rollback();
- } catch (e) {
- expect(e.message).toContain(`It has been invoiced but the PDF could not be generated`);
- await tx.rollback();
- }
- });
-
- it('should not generate an invoice', async() => {
- const tx = await models.InvoiceOut.beginTransaction({});
- const options = {transaction: tx};
- spyOn(models.InvoiceOut, 'makePdfList');
-
- let response;
- try {
- response = await models.InvoiceOut.transferInvoice(ctx, '1', 'T1111111', 1102, 1, 1, 1, false, options);
- await tx.rollback();
- } catch (e) {
- await tx.rollback();
- throw e;
- }
-
- expect(response).not.toBeDefined();
- });
-});
diff --git a/modules/invoiceOut/back/methods/invoiceOut/transfer.js b/modules/invoiceOut/back/methods/invoiceOut/transfer.js
new file mode 100644
index 000000000..aa5c0d9d2
--- /dev/null
+++ b/modules/invoiceOut/back/methods/invoiceOut/transfer.js
@@ -0,0 +1,123 @@
+const UserError = require('vn-loopback/util/user-error');
+
+module.exports = Self => {
+ Self.remoteMethodCtx('transfer', {
+ description: 'Transfer an issued invoice to another client',
+ accessType: 'WRITE',
+ accepts: [
+ {
+ arg: 'id',
+ type: 'number',
+ required: true,
+ description: 'Issued invoice id'
+ },
+ {
+ arg: 'newClientFk',
+ type: 'number',
+ required: true
+ },
+ {
+ arg: 'cplusRectificationTypeFk',
+ type: 'number',
+ required: true
+ },
+ {
+ arg: 'siiTypeInvoiceOutFk',
+ type: 'number',
+ required: true
+ },
+ {
+ arg: 'invoiceCorrectionTypeFk',
+ type: 'number',
+ required: true
+ },
+ {
+ arg: 'makeInvoice',
+ type: 'boolean',
+ required: true
+ },
+ ],
+ returns: {type: 'object', root: true},
+ http: {path: '/transfer', verb: 'post'}
+ });
+
+ Self.transfer = async(
+ ctx,
+ id,
+ newClientFk,
+ cplusRectificationTypeFk,
+ siiTypeInvoiceOutFk,
+ invoiceCorrectionTypeFk,
+ makeInvoice,
+ options
+ ) => {
+ const models = Self.app.models;
+ let tx;
+ const myOptions = {};
+
+ if (typeof options == 'object')
+ Object.assign(myOptions, options);
+
+ if (!myOptions.transaction) {
+ tx = await Self.beginTransaction({});
+ myOptions.transaction = tx;
+ }
+
+ const originalInvoice = await models.InvoiceOut.findById(id);
+ if (!originalInvoice)
+ throw new UserError('Original invoice not found');
+
+ if (originalInvoice.clientFk === newClientFk)
+ throw new UserError('Select a different client');
+
+ let transferredInvoiceId;
+ try {
+ await Self.refundAndInvoice(
+ ctx,
+ id,
+ false,
+ cplusRectificationTypeFk,
+ siiTypeInvoiceOutFk,
+ invoiceCorrectionTypeFk,
+ myOptions
+ );
+
+ const tickets = await models.Ticket.find({where: {refFk: originalInvoice.ref}}, myOptions);
+ const ticketIds = tickets.map(ticket => ticket.id);
+ const transferredTickets = await models.Ticket.cloneAll(ctx, ticketIds, false, false, myOptions);
+ const client = await models.Client.findById(newClientFk,
+ {fields: ['id', 'defaultAddressFk']}, myOptions);
+ const address = await models.Address.findById(client.defaultAddressFk,
+ {fields: ['id', 'nickname']}, myOptions);
+
+ const transferredTicketIds = transferredTickets.map(ticket => ticket.id);
+ await models.Ticket.updateAll(
+ {id: {inq: transferredTicketIds}},
+ {
+ clientFk: newClientFk,
+ addressFk: client.defaultAddressFk,
+ nickname: address.nickname
+ },
+ myOptions
+ );
+
+ if (makeInvoice)
+ transferredInvoiceId = await models.Ticket.invoiceTickets(ctx, transferredTicketIds, null, myOptions);
+
+ if (tx) await tx.commit();
+ } catch (e) {
+ if (tx) await tx.rollback();
+ throw e;
+ }
+
+ if (transferredInvoiceId) {
+ try {
+ await models.InvoiceOut.makePdfList(ctx, transferredInvoiceId);
+ } catch (e) {
+ throw new UserError('The invoices have been created but the PDFs could not be generatedd');
+ }
+ }
+
+ return transferredInvoiceId;
+ };
+};
diff --git a/modules/invoiceOut/back/methods/invoiceOut/transferInvoice.js b/modules/invoiceOut/back/methods/invoiceOut/transferInvoice.js
deleted file mode 100644
index c31f381d9..000000000
--- a/modules/invoiceOut/back/methods/invoiceOut/transferInvoice.js
+++ /dev/null
@@ -1,131 +0,0 @@
-const UserError = require('vn-loopback/util/user-error');
-
-module.exports = Self => {
- Self.remoteMethodCtx('transferInvoice', {
- description: 'Transfer an issued invoice to another client',
- accessType: 'WRITE',
- accepts: [
- {
- arg: 'id',
- type: 'number',
- required: true,
- description: 'Issued invoice id'
- },
- {
- arg: 'refFk',
- type: 'string',
- required: true
- },
- {
- arg: 'newClientFk',
- type: 'number',
- required: true
- },
- {
- arg: 'cplusRectificationTypeFk',
- type: 'number',
- required: true
- },
- {
- arg: 'siiTypeInvoiceOutFk',
- type: 'number',
- required: true
- },
- {
- arg: 'invoiceCorrectionTypeFk',
- type: 'number',
- required: true
- },
- {
- arg: 'makeInvoice',
- type: 'boolean',
- required: true
- },
- ],
- returns: {
- type: 'object',
- root: true
- },
- http: {
- path: '/transferInvoice',
- verb: 'post'
- }
- });
-
- Self.transferInvoice = async(
- ctx,
- id,
- refFk,
- newClientFk,
- cplusRectificationTypeFk,
- siiTypeInvoiceOutFk,
- invoiceCorrectionTypeFk,
- makeInvoice,
- options
- ) => {
- const models = Self.app.models;
- const myOptions = {userId: ctx.req.accessToken.userId};
- let invoiceId;
- let refundId;
-
- let tx;
- if (typeof options == 'object')
- Object.assign(myOptions, options);
-
- const {clientFk} = await models.InvoiceOut.findById(id);
-
- if (clientFk == newClientFk)
- throw new UserError(`Select a different client`);
-
- if (!myOptions.transaction) {
- tx = await Self.beginTransaction({});
- myOptions.transaction = tx;
- }
- try {
- const tickets = await models.Ticket.find({where: {refFk}}, myOptions);
- const ticketsIds = tickets.map(ticket => ticket.id);
- const refundTickets = await models.Ticket.cloneAll(ctx, ticketsIds, false, true, myOptions);
-
- const clonedTickets = await models.Ticket.cloneAll(ctx, ticketsIds, false, false, myOptions);
-
- const clonedTicketIds = [];
-
- for (const clonedTicket of clonedTickets) {
- await clonedTicket.updateAttribute('clientFk', newClientFk, myOptions);
- clonedTicketIds.push(clonedTicket.id);
- }
-
- const invoiceCorrection = {
- correctedFk: id,
- cplusRectificationTypeFk,
- siiTypeInvoiceOutFk,
- invoiceCorrectionTypeFk
- };
- const refundTicketIds = refundTickets.map(ticket => ticket.id);
-
- refundId = await models.Ticket.invoiceTickets(ctx, refundTicketIds, invoiceCorrection, myOptions);
-
- if (makeInvoice)
- invoiceId = await models.Ticket.invoiceTickets(ctx, clonedTicketIds, null, myOptions);
-
- tx && await tx.commit();
- } catch (e) {
- if (tx) await tx.rollback();
- throw e;
- }
-
- if (tx && makeInvoice) {
- try {
- await models.InvoiceOut.makePdfList(ctx, invoiceId);
- } catch (e) {
- throw new UserError('It has been invoiced but the PDF could not be generated');
- }
- try {
- await models.InvoiceOut.makePdfList(ctx, refundId);
- } catch (e) {
- throw new UserError('It has been invoiced but the PDF of refund not be generated');
- }
- }
- return invoiceId;
- };
-};
diff --git a/modules/invoiceOut/back/models/invoice-out.js b/modules/invoiceOut/back/models/invoice-out.js
index b0e05b626..bab1fa375 100644
--- a/modules/invoiceOut/back/models/invoice-out.js
+++ b/modules/invoiceOut/back/models/invoice-out.js
@@ -26,7 +26,8 @@ module.exports = Self => {
require('../methods/invoiceOut/getInvoiceDate')(Self);
require('../methods/invoiceOut/negativeBases')(Self);
require('../methods/invoiceOut/negativeBasesCsv')(Self);
- require('../methods/invoiceOut/transferInvoice')(Self);
+ require('../methods/invoiceOut/transfer')(Self);
+ require('../methods/invoiceOut/refundAndInvoice')(Self);
Self.filePath = async function(id, options) {
const fields = ['ref', 'issued'];
@@ -82,8 +83,10 @@ module.exports = Self => {
const invoiceOutSerial = await Self.app.models.InvoiceOutSerial.findById(serial);
if (invoiceOutSerial?.taxAreaFk == 'WORLD') {
const address = await Self.app.models.Address.findById(addressId);
- if (!address || !address.customsAgentFk || !address.incotermsFk)
- throw new UserError('The address of the customer must have information about Incoterms and Customs Agent');
+ if (!address?.customsAgentFk || !address.incotermsFk) {
+ throw new UserError(
+ 'The address of the customer must have information about Incoterms and Customs Agent');
+ }
}
return serial;
diff --git a/modules/invoiceOut/front/card/index.html b/modules/invoiceOut/front/card/index.html
deleted file mode 100644
index a6f56f775..000000000
--- a/modules/invoiceOut/front/card/index.html
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
diff --git a/modules/invoiceOut/front/card/index.js b/modules/invoiceOut/front/card/index.js
deleted file mode 100644
index c443912d9..000000000
--- a/modules/invoiceOut/front/card/index.js
+++ /dev/null
@@ -1,41 +0,0 @@
-import ngModule from '../module';
-import ModuleCard from 'salix/components/module-card';
-
-class Controller extends ModuleCard {
- reload() {
- const filter = {
- fields: [
- 'id',
- 'ref',
- 'issued',
- 'serial',
- 'amount',
- 'clientFk',
- 'companyFk',
- 'hasPdf'
- ],
- include: [
- {
- relation: 'company',
- scope: {
- fields: ['id', 'code']
- }
- }, {
- relation: 'client',
- scope: {
- fields: ['id', 'socialName', 'name', 'email']
- }
- }
- ]
- };
-
- this.$http.get(`InvoiceOuts/${this.$params.id}`, {filter})
- .then(res => this.invoiceOut = res.data);
- }
-}
-
-ngModule.vnComponent('vnInvoiceOutCard', {
- template: require('./index.html'),
- controller: Controller
-});
-
diff --git a/modules/invoiceOut/front/card/index.spec.js b/modules/invoiceOut/front/card/index.spec.js
deleted file mode 100644
index 2a8d576dc..000000000
--- a/modules/invoiceOut/front/card/index.spec.js
+++ /dev/null
@@ -1,27 +0,0 @@
-import './index.js';
-
-describe('vnInvoiceOut', () => {
- let controller;
- let $httpBackend;
- let data = {id: 1, name: 'fooName'};
-
- beforeEach(ngModule('invoiceOut'));
-
- beforeEach(inject(($componentController, _$httpBackend_, $stateParams) => {
- $httpBackend = _$httpBackend_;
-
- let $element = angular.element('');
- controller = $componentController('vnInvoiceOutCard', {$element});
-
- $stateParams.id = data.id;
- $httpBackend.whenRoute('GET', 'InvoiceOuts/:id').respond(data);
- }));
-
- it('should request data and set it on the controller', () => {
- controller.reload();
- $httpBackend.flush();
-
- expect(controller.invoiceOut).toEqual(data);
- });
-});
-
diff --git a/modules/invoiceOut/front/descriptor-menu/index.js b/modules/invoiceOut/front/descriptor-menu/index.js
index 07a0f1768..288de879e 100644
--- a/modules/invoiceOut/front/descriptor-menu/index.js
+++ b/modules/invoiceOut/front/descriptor-menu/index.js
@@ -138,7 +138,6 @@ class Controller extends Section {
transferInvoice() {
const params = {
id: this.invoiceOut.id,
- refFk: this.invoiceOut.ref,
newClientFk: this.clientId,
cplusRectificationTypeFk: this.cplusRectificationType,
siiTypeInvoiceOutFk: this.siiTypeInvoiceOut,
@@ -155,7 +154,7 @@ class Controller extends Section {
return;
}
- this.$http.post(`InvoiceOuts/transferInvoice`, params).then(res => {
+ this.$http.post(`InvoiceOuts/transfer`, params).then(res => {
const invoiceId = res.data;
this.vnApp.showSuccess(this.$t('Transferred invoice'));
this.$state.go('invoiceOut.card.summary', {id: invoiceId});
diff --git a/modules/invoiceOut/front/descriptor/locale/es.yml b/modules/invoiceOut/front/descriptor/es.yml
similarity index 100%
rename from modules/invoiceOut/front/descriptor/locale/es.yml
rename to modules/invoiceOut/front/descriptor/es.yml
diff --git a/modules/invoiceOut/front/global-invoicing/index.html b/modules/invoiceOut/front/global-invoicing/index.html
deleted file mode 100644
index 3ece30862..000000000
--- a/modules/invoiceOut/front/global-invoicing/index.html
+++ /dev/null
@@ -1,158 +0,0 @@
-
-
-
-