From 74136442954aba00717704dedf56b801aba02817 Mon Sep 17 00:00:00 2001 From: Pako Date: Thu, 15 Feb 2024 14:37:09 +0100 Subject: [PATCH] contact_request and deliveryDate_get --- .../floranet/procedures/contact_Request.sql | 20 +++++++++++ .../floranet/procedures/deliveryDate_get.sql | 35 +++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 db/routines/floranet/procedures/contact_Request.sql create mode 100644 db/routines/floranet/procedures/deliveryDate_get.sql diff --git a/db/routines/floranet/procedures/contact_Request.sql b/db/routines/floranet/procedures/contact_Request.sql new file mode 100644 index 000000000..c55348d6f --- /dev/null +++ b/db/routines/floranet/procedures/contact_Request.sql @@ -0,0 +1,20 @@ +DROP PROCEDURE IF EXISTS floranet.contact_Request; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`localhost` +PROCEDURE floranet.contact_Request( + vName VARCHAR(100), + vPhone VARCHAR(15), + vEmail VARCHAR(100), + vMessage TEXT) +READS SQL DATA +BEGIN +/** + * Set actions for contact request + * + * @param vPostalCode Delivery address postal code + */ + +END$$ +DELIMITER ; \ No newline at end of file diff --git a/db/routines/floranet/procedures/deliveryDate_get.sql b/db/routines/floranet/procedures/deliveryDate_get.sql new file mode 100644 index 000000000..06a8ae1ad --- /dev/null +++ b/db/routines/floranet/procedures/deliveryDate_get.sql @@ -0,0 +1,35 @@ +DROP PROCEDURE IF EXISTS floranet.deliveryDate_get; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`localhost` PROCEDURE floranet.deliveryDate_get(vPostalCode VARCHAR(15)) +READS SQL DATA +BEGIN +/** + * Returns available dates for this postalCode + * + * @param vPostalCode Delivery address postal code + */ + CREATE OR REPLACE TEMPORARY TABLE tmp.deliveryDate + (dated DATE PRIMARY KEY) + ENGINE = MEMORY; + + IF vPostalCode != "00000" THEN + INSERT INTO tmp.deliveryDate + SET dated = CURDATE() + INTERVAL 1 DAY; + + INSERT INTO tmp.deliveryDate + SET dated = CURDATE() + INTERVAL 2 DAY; + + INSERT INTO tmp.deliveryDate + SET dated = CURDATE() + INTERVAL 4 DAY; + + INSERT INTO tmp.deliveryDate + SET dated = CURDATE() + INTERVAL 7 DAY; + END IF; + + SELECT * FROM tmp.deliveryDate; + + DROP TEMPORARY TABLE tmp.deliveryDate; +END$$ +DELIMITER ; \ No newline at end of file