refactor: refs #6495 Requested changes
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Guillermo Bonet 2024-03-05 08:55:40 +01:00
parent 216f6f1db3
commit 619ac4e053
3 changed files with 43 additions and 30 deletions

View File

@ -1,9 +1,9 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`client_sendMailPurchases`(
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`client_mailSales`(
vSelf INT,
vDated DATE
)
BEGIN
proc: BEGIN
/**
* Envia un correo electrónico con un resumen de los pedidos
* preparados para un cliente.
@ -43,14 +43,19 @@ BEGIN
SET vDated = IFNULL(vDated, util.yesterday());
OPEN vTickets;
FETCH vTickets INTO vTicketFk, vAlias, vAmount, vStreet, vCity;
SET vString = CONCAT('<p><font face="verdana" >',
'<h2> Relación de envíos.</h2>',
'<h3><font color="green">Dia: ', vDated, '</font></h3>');
WHILE NOT vDone DO
OPEN vTickets;
l: LOOP
SET vDone = FALSE;
FETCH vTickets INTO vTicketFk, vAlias, vAmount, vStreet, vCity;
IF vDone THEN
LEAVE l;
END IF;
SET vString = CONCAT(vString, '<br><br>',
'<table>
<tr>
@ -63,8 +68,11 @@ BEGIN
</table>',
' ', vAlias, '<br>',
' ', vStreet, '(', vCity, ')');
FETCH vTickets INTO vTicketFk, vAlias, vAmount, vStreet, vCity;
END WHILE;
END LOOP;
IF vTicketFk IS NULL THEN
LEAVE proc;
END IF;
SET vString = CONCAT(
vString,
@ -75,17 +83,19 @@ BEGIN
'<br><h3> Muchas gracias por su confianza</h3>',
'</font></p>');
-- Envío del email
SELECT CONCAT(email,', pako@verdnatura.es') INTO vMailTo
SELECT email INTO vMailTo
FROM client
WHERE id = vSelf
AND email <> '';
-- Envío del email
IF vMailTo IS NOT NULL THEN
CALL mail_insert(
IFNULL(vMailTo, 'pako.natek@gmail.com'),
'pako@verdnatura.es',
vMailTo,
NULL,
'Resumen de pedidos preparados',
vString
);
END IF;
END$$
DELIMITER ;

View File

@ -1,5 +1,5 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`client_sendMailPurchasesLauncher`()
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`client_mailSalesLauncher`()
BEGIN
/**
* Lanza el envío de correos electrónicos con el resumen de pedidos
@ -17,11 +17,14 @@ BEGIN
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
OPEN vClients;
l: LOOP
SET vDone = FALSE;
FETCH vClients INTO vClientFk;
WHILE NOT vDone DO
CALL client_sendMailPurchases(util.yesterday(), vClientFk);
FETCH vClients INTO vClientFk;
END WHILE;
IF vDone THEN
LEAVE l;
END IF;
CALL client_mailSales(vClientFk, util.yesterday());
END LOOP;
END$$
DELIMITER ;

View File

@ -1,4 +1,4 @@
UPDATE IGNORE bs.nightTask
SET `procedure` = 'client_sendMailPurchasesLauncher',
SET `procedure` = 'client_mailSalesLauncher',
`schema` = 'vn'
WHERE `procedure` = 'emailYesterdayPurchasesLauncher';