7773-testToMaster_2430 #2774

Merged
alexm merged 368 commits from 7773-testToMaster_2430 into master 2024-07-23 06:21:03 +00:00
3 changed files with 33 additions and 22 deletions
Showing only changes of commit 880b332575 - Show all commits

View File

@ -0,0 +1,25 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`address_updateCoordinates`(
vTicketFk INT,
vLongitude INT,
vLatitude INT)
BEGIN
/**
* Actualiza las coordenadas de una dirección.
*
* @param vTicketFk Id del ticket
* @param vLongitude Longitud de la dirección
* @param vLatitude Latitud de la dirección
*/
DECLARE vAddressFK INT;
SELECT addressFK INTO vAddressFK
FROM ticket
WHERE id = vTicketFk;
UPDATE address
SET longitude = vLongitude,
latitude = vLatitude
WHERE id = vAddressFK;
END$$
DELIMITER ;

View File

@ -3,18 +3,11 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`delivery_beforeInsert
BEFORE INSERT ON `delivery`
FOR EACH ROW
BEGIN
IF (NEW.longitude IS NOT NULL AND NEW.latitude IS NOT NULL AND NEW.ticketFK IS NOT NULL)
IF (NEW.longitude IS NOT NULL
AND NEW.latitude IS NOT NULL
AND NEW.ticketFK IS NOT NULL)
THEN
UPDATE address
SET longitude = NEW.longitude,
latitude = NEW.latitude
WHERE id IN (
SELECT addressFK
FROM ticket
WHERE id = NEW.ticketFk
);
CALL address_updateCoordinates(NEW.ticketFk, NEW.longitude, NEW.latitude);
END IF;
END$$
DELIMITER ;

View File

@ -3,18 +3,11 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`delivery_beforeUpdate
BEFORE UPDATE ON `delivery`
FOR EACH ROW
BEGIN
IF (NEW.longitude IS NOT NULL AND NEW.latitude IS NOT NULL AND NEW.ticketFK IS NOT NULL)
IF (NEW.longitude IS NOT NULL
AND NEW.latitude IS NOT NULL
AND NEW.ticketFK IS NOT NULL)
THEN
UPDATE address
SET longitude = NEW.longitude,
latitude = NEW.latitude
WHERE id IN (
SELECT addressFK
FROM ticket
WHERE id = NEW.ticketFk
);
CALL address_updateCoordinates(NEW.ticketFk, NEW.longitude, NEW.latitude);
END IF;
END$$
DELIMITER ;