7167-testToMaster_2414 #2244

Merged
alexm merged 643 commits from 7167-testToMaster_2414 into master 2024-04-04 05:32:41 +00:00
3 changed files with 43 additions and 30 deletions
Showing only changes of commit 619ac4e053 - Show all commits

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,29 +68,34 @@ 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,
'<table>',
'<tr><th></th></tr>',
'</table>',
'<br><br>Puede acceder al detalle de los albaranes haciendo click sobre el número de Ticket',
'<br><h3> Muchas gracias por su confianza</h3>',
'</font></p>');
vString,
'<table>',
'<tr><th></th></tr>',
'</table>',
'<br><br>Puede acceder al detalle de los albaranes haciendo click sobre el número de Ticket',
'<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 <> '';
CALL mail_insert(
IFNULL(vMailTo, 'pako.natek@gmail.com'),
'pako@verdnatura.es',
'Resumen de pedidos preparados',
vString
);
-- Envío del email
IF vMailTo IS NOT NULL THEN
CALL mail_insert(
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;
FETCH vClients INTO vClientFk;
WHILE NOT vDone DO
CALL client_sendMailPurchases(util.yesterday(), vClientFk);
l: LOOP
SET vDone = FALSE;
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';