7430_devToTest #2490

Merged
alexm merged 306 commits from 7430_devToTest into test 2024-05-21 09:15:04 +00:00
5 changed files with 23 additions and 6 deletions
Showing only changes of commit ffe56edc9c - Show all commits

View File

@ -162,7 +162,7 @@ INSERT INTO `vn`.`currency`(`id`, `code`, `name`, `ratio`)
(3, 'GBP', 'Libra', 1),
(4, 'JPY', 'Yen Japones', 1);
INSERT INTO `vn`.`country`(`id`, `country`, `isUeeMember`, `code`, `currencyFk`, `ibanLength`, `continentFk`, `hasDailyInvoice`, `CEE`)
INSERT INTO `vn`.`country`(`id`, `name`, `isUeeMember`, `code`, `currencyFk`, `ibanLength`, `continentFk`, `hasDailyInvoice`, `CEE`)
VALUES
(1, 'España', 1, 'ES', 1, 24, 4, 0, 1),
(2, 'Italia', 1, 'IT', 1, 27, 4, 0, 1),

View File

@ -5,14 +5,17 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`country_afterInsert`
BEGIN
UPDATE sage.Naciones
SET countryFk = NEW.id
WHERE Nacion = NEW.country;
WHERE Nacion = NEW.name;
IF ROW_COUNT() = 0 THEN
CALL mail_insert(
'cau@verdnatura.es',
NULL,
'Actualizar tabla sage.Naciones',
CONCAT('Se ha insertado un nuevo país en la tabla vn.conuntry. Para el correcto funcionamiento del sistema \n\t\t\t\tde contabilidad es necesario actualizar la columna sage.Naciones.countryFk con el valor del nuevo país. \n\t\t\t Hay que buscar el nuevo país: ', NEW.country, ' en la tabla sage.Naciones y actualizar el campo sage.Naciones.countryFk con el valor ', NEW.id)
CONCAT('Se ha insertado un nuevo país en la tabla vn.conuntry.
Para el correcto funcionamiento del sistema \n\t\t\t\tde contabilidad es necesario actualizar la columna
sage.Naciones.countryFk con el valor del nuevo país. \n\t\t\t Hay que buscar el nuevo país: ', NEW.name,
' en la tabla sage.Naciones y actualizar el campo sage.Naciones.countryFk con el valor ', NEW.id)
);
END IF;
END$$

View File

@ -3,8 +3,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`country_afterUpdate`
AFTER UPDATE ON `country`
FOR EACH ROW
BEGIN
IF !(OLD.country <=> NEW.country) THEN
UPDATE zoneGeo SET `name` = NEW.country
IF !(OLD.name <=> NEW.name) THEN
UPDATE zoneGeo SET `name` = NEW.name
WHERE id = NEW.geoFk;
END IF;
END$$

View File

@ -3,6 +3,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`country_beforeInsert`
BEFORE INSERT ON `country`
FOR EACH ROW
BEGIN
SET NEW.geoFk = zoneGeo_new('country', NEW.country, NULL);
SET NEW.geoFk = zoneGeo_new('country', NEW.name, NULL);
END$$
DELIMITER ;

View File

@ -1,2 +1,16 @@
-- Place your SQL code here
ALTER TABLE vn.country CHANGE country name varchar(25) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL;
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`Paises`
AS SELECT `c`.`id` AS `Id`,
`c`.`name` AS `Pais`,
`c`.`CEE` AS `CEE`,
`c`.`isUeeMember` AS `isUeeMember`,
`c`.`code` AS `Codigo`,
`c`.`currencyFk` AS `Id_Moneda`,
`c`.`geoFk` AS `geoFk`,
`c`.`ibanLength` AS `ibanLength`,
`c`.`hasDailyInvoice` AS `hasDailyInvoice`
FROM `vn`.`country` `c`