31 lines
715 B
SQL
31 lines
715 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`client_mailSalesLauncher`()
|
|
BEGIN
|
|
/**
|
|
* Lanza el envío de correos electrónicos con el resumen de pedidos
|
|
* preparados para todos los clientes con el campo eypbc a TRUE.
|
|
*
|
|
* @param vSelf Id del cliente
|
|
* @param vDated Fecha de preparación
|
|
*/
|
|
DECLARE vDone BOOL DEFAULT FALSE;
|
|
DECLARE vClientFk INT;
|
|
DECLARE vClients CURSOR FOR
|
|
SELECT id
|
|
FROM client
|
|
WHERE eypbc;
|
|
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
|
|
|
OPEN vClients;
|
|
l: LOOP
|
|
SET vDone = FALSE;
|
|
FETCH vClients INTO vClientFk;
|
|
|
|
IF vDone THEN
|
|
LEAVE l;
|
|
END IF;
|
|
CALL client_mailSales(vClientFk, util.yesterday());
|
|
END LOOP;
|
|
END$$
|
|
DELIMITER ;
|