Merge branch 'dev' into 7108-exchange
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:
commit
ef4d17c0e6
|
@ -48,7 +48,7 @@ BEGIN
|
|||
-- Marcamos para no repetir
|
||||
UPDATE vn.claimEnd ce
|
||||
JOIN vn.claim c ON c.id = ce.claimFk
|
||||
SET c.isChargedToMana = TRUE
|
||||
SET ce.isGreuge = TRUE
|
||||
WHERE ce.claimDestinationFk NOT IN (1,5)
|
||||
AND NOT ce.isGreuge
|
||||
AND c.claimStateFk = 3;
|
||||
|
|
|
@ -44,8 +44,8 @@ proc:BEGIN
|
|||
addressFk
|
||||
)
|
||||
SELECT CONCAT(i.name, ' by ',a.nickname),
|
||||
i.minPrice + apc.deliveryCost,
|
||||
i.id,
|
||||
r.price + apc.deliveryCost,
|
||||
r.itemFk,
|
||||
vLanded,
|
||||
vPostalCode,
|
||||
it.name,
|
||||
|
@ -53,13 +53,15 @@ proc:BEGIN
|
|||
i.description,
|
||||
apc.addressFk
|
||||
FROM vn.item i
|
||||
JOIN (SELECT itemFk, SUM(quantity * cost) price
|
||||
FROM recipe
|
||||
GROUP BY itemFk) r ON r.itemFk = i.id
|
||||
JOIN vn.itemType it ON it.id = i.typeFk
|
||||
JOIN addressPostCode apc
|
||||
ON apc.dayOfWeek = dayOfWeek(vLanded)
|
||||
AND NOW() < vLanded - INTERVAL apc.hoursInAdvance HOUR
|
||||
AND apc.postCode = vPostalCode
|
||||
JOIN vn.address a ON a.id = apc.addressFk
|
||||
WHERE it.code IN ('FNR','FNP');
|
||||
JOIN vn.address a ON a.id = apc.addressFk;
|
||||
|
||||
SELECT *
|
||||
FROM catalogue
|
||||
|
|
|
@ -18,10 +18,29 @@ proc:BEGIN
|
|||
DECLARE vBodyEmail TEXT;
|
||||
DECLARE vZoneFk INT;
|
||||
|
||||
DECLARE exit handler FOR SQLEXCEPTION
|
||||
BEGIN
|
||||
ROLLBACK;
|
||||
|
||||
GET DIAGNOSTICS CONDITION 2 @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
|
||||
|
||||
SELECT CONCAT('ERROR ', IFNULL(@errno,0), ': ', ifnull(@text,'texto')) AS `SQLEXCEPTION`;
|
||||
|
||||
CALL vn.mail_insert(
|
||||
'floranet@verdnatura.es,pako@verdnatura.es',
|
||||
'noreply@verdnatura.es',
|
||||
'Floranet.order_confirm failure',
|
||||
CONCAT('CatalogueFk: ', vCatalogueFk, '\n','ERROR ', IFNULL(@errno, 0), ': ', ifnull(@text, 'texto'))
|
||||
);
|
||||
END;
|
||||
|
||||
IF (SELECT isPaid FROM `order` WHERE catalogueFk = vCatalogueFk) THEN
|
||||
CALL util.throw('Esta orden ya está confirmada');
|
||||
SELECT CONCAT('CatalogueFk: ', vCatalogueFk, ' Esta orden ya está confirmada') AS `ERROR`;
|
||||
LEAVE proc;
|
||||
END IF;
|
||||
|
||||
START TRANSACTION;
|
||||
|
||||
UPDATE `order`
|
||||
SET isPaid = TRUE,
|
||||
payed = NOW()
|
||||
|
@ -90,6 +109,23 @@ proc:BEGIN
|
|||
AND apc.dayOfWeek = dayOfWeek(c.dated)
|
||||
WHERE c.id = vCatalogueFk;
|
||||
|
||||
INSERT INTO vn.sale(
|
||||
ticketFk,
|
||||
itemFk,
|
||||
concept,
|
||||
price,
|
||||
quantity)
|
||||
SELECT
|
||||
vNewTicketFk,
|
||||
r.elementFk,
|
||||
i.longName,
|
||||
r.cost,
|
||||
r.quantity
|
||||
FROM catalogue c
|
||||
JOIN recipe r ON r.itemFk = c.itemFk
|
||||
JOIN vn.item i ON i.id = r.elementFk
|
||||
WHERE c.id = vCatalogueFk;
|
||||
|
||||
SELECT cl.email,
|
||||
cf.email,
|
||||
CONCAT('Nuevo pedido FLORANET para entrega el ',c.dated),
|
||||
|
@ -124,5 +160,8 @@ proc:BEGIN
|
|||
SELECT isPaid, vNewTicketFk
|
||||
FROM `order`
|
||||
WHERE catalogueFk = vCatalogueFk;
|
||||
|
||||
COMMIT;
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,20 @@
|
|||
-- Place your SQL code here
|
||||
|
||||
|
||||
-- floranet.recipe definition
|
||||
|
||||
CREATE OR REPLACE TABLE floranet.`recipe`
|
||||
(
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`itemFk` int(11) NOT NULL COMMENT 'Bouquet or plant name',
|
||||
`elementFk` int(11) NOT NULL COMMENT 'Item detail for bouquet''s composition',
|
||||
`quantity` int(10) unsigned NOT NULL DEFAULT 1,
|
||||
`cost` decimal(10,2) NOT NULL DEFAULT 1.00,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `recipe_FK` (`itemFk`),
|
||||
KEY `recipe_FK_1` (`elementFk`),
|
||||
CONSTRAINT `recipe_FK` FOREIGN KEY (`itemFk`) REFERENCES `vn`.`item` (`id`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `recipe_item_FK` FOREIGN KEY (`elementFk`) REFERENCES `vn`.`item` (`id`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='Links handmade products with their elements';
|
||||
|
||||
DROP TABLE IF EXISTS floranet.`element`;
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE vn.productionConfig ADD scannablePreviusCodeType enum('qr','barcode')
|
||||
CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT 'barcode' NOT NULL;
|
Loading…
Reference in New Issue