tickets y email
gitea/salix/pipeline/pr-dev This commit looks good
Details
gitea/salix/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
257de96743
commit
49a2e6fc84
|
@ -40,16 +40,18 @@ proc:BEGIN
|
|||
postalCode,
|
||||
`type`,
|
||||
image,
|
||||
description
|
||||
description,
|
||||
addressFk
|
||||
)
|
||||
SELECT CONCAT(i.name, ' by ',a.nickname),
|
||||
i.`size` + apc.deliveryCost,
|
||||
i.minPrice + apc.deliveryCost,
|
||||
i.id,
|
||||
vLanded,
|
||||
vPostalCode,
|
||||
it.name,
|
||||
CONCAT('https://cdn.verdnatura.es/image/catalog/1600x900/', i.image),
|
||||
i.description
|
||||
i.description,
|
||||
apc.addressFk
|
||||
FROM vn.item i
|
||||
JOIN vn.itemType it ON it.id = i.typeFk
|
||||
JOIN addressPostCode apc
|
||||
|
|
|
@ -4,7 +4,7 @@ $$
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`PROCEDURE floranet.order_confirm(vCatalogueFk INT)
|
||||
READS SQL DATA
|
||||
|
||||
BEGIN
|
||||
proc:BEGIN
|
||||
/** Update order.isPaid field, and makes the ticket
|
||||
*
|
||||
* @param vCatalogueFk floranet.catalogue.id
|
||||
|
@ -12,8 +12,16 @@ BEGIN
|
|||
* @returns floranet.order.isPaid
|
||||
*/
|
||||
DECLARE vNewTicketFk INT;
|
||||
DECLARE vCustomerEmail VARCHAR(255);
|
||||
DECLARE vFloranetEmail VARCHAR(255);
|
||||
DECLARE vSubjectEmail VARCHAR(100);
|
||||
DECLARE vBodyEmail TEXT;
|
||||
DECLARE vZoneFk INT;
|
||||
|
||||
IF (SELECT isPaid FROM `order` WHERE catalogueFk = vCatalogueFk) THEN
|
||||
CALL util.throw('Esta orden ya está confirmada');
|
||||
END IF;
|
||||
|
||||
UPDATE `order`
|
||||
SET isPaid = TRUE,
|
||||
payed = NOW()
|
||||
|
@ -33,7 +41,7 @@ BEGIN
|
|||
) sub
|
||||
LIMIT 1;
|
||||
|
||||
INSERT INTO ticket (
|
||||
INSERT INTO vn.ticket (
|
||||
clientFk,
|
||||
shipped,
|
||||
addressFk,
|
||||
|
@ -57,7 +65,7 @@ BEGIN
|
|||
vZoneFk
|
||||
FROM vn.address a
|
||||
JOIN vn.agencyMode am ON am.id = a.agencyModeFk
|
||||
JOIN vn.agency ag ON ag.id = am.agencyFk
|
||||
JOIN vn.agency ag ON ag.id = am.agencyFk
|
||||
JOIN catalogue c ON c.addressFk = a.id
|
||||
JOIN vn.company co ON co.code = 'VNL'
|
||||
WHERE c.id = vCatalogueFk;
|
||||
|
@ -79,10 +87,41 @@ BEGIN
|
|||
FROM catalogue c
|
||||
JOIN addressPostCode apc
|
||||
ON apc.addressFk = c.addressFk
|
||||
AND apc.dayOfWeek = dayOfWeek(vDated)
|
||||
AND apc.dayOfWeek = dayOfWeek(c.dated)
|
||||
WHERE c.id = vCatalogueFk;
|
||||
|
||||
SELECT cl.email,
|
||||
cf.email,
|
||||
CONCAT('Nuevo pedido FLORANET para entrega el ',c.dated),
|
||||
CONCAT_WS('\n',
|
||||
CONCAT('Producto: ', c.name),
|
||||
CONCAT('Fecha de entrega: ',c.dated),
|
||||
CONCAT('Destinatario: ', o.deliveryName),
|
||||
CONCAT('Dirección: ', o.address),
|
||||
CONCAT('CP: ', c.postalCode),
|
||||
CONCAT('Foto: ', c.image),
|
||||
CONCAT('Mensaje: ', IFNULL(o.message,"Ninguno.")),
|
||||
CONCAT('Teléfono: ',IFNULL(o.deliveryPhone,"--")),
|
||||
CONCAT('Observaciones: ', IFNULL(o.observations,"No hay."))
|
||||
)
|
||||
INTO vCustomerEmail,
|
||||
vFloranetEmail,
|
||||
vSubjectEmail,
|
||||
vBodyEmail
|
||||
FROM vn.client cl
|
||||
JOIN vn.address a ON a.clientFk = cl.id
|
||||
JOIN catalogue c ON c.addressFk = a.id
|
||||
JOIN `order` o ON o.catalogueFk = c.id
|
||||
JOIN config cf
|
||||
WHERE c.id = vCatalogueFk;
|
||||
|
||||
CALL vn.mail_insert(
|
||||
vCustomerEmail,
|
||||
vFloranetEmail,
|
||||
vSubjectEmail,
|
||||
vBodyEmail);
|
||||
|
||||
SELECT isPaid
|
||||
SELECT isPaid, vNewTicketFk
|
||||
FROM `order`
|
||||
WHERE catalogueFk = vCatalogueFk;
|
||||
END$$
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
-- Place your SQL code here
|
||||
CREATE OR REPLACE TABLE floranet.config (
|
||||
email varchar(255) DEFAULT 'floranet@verdnatura.es' NOT NULL
|
||||
)
|
||||
ENGINE=InnoDB
|
||||
DEFAULT CHARSET=utf8mb3
|
||||
COLLATE=utf8mb3_unicode_ci;
|
||||
|
||||
|
Loading…
Reference in New Issue