Merge branch 'dev' into 7409-workerIncome
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Carlos Satorres 2024-06-26 08:00:58 +00:00
commit f9a09f3fec
6 changed files with 83 additions and 17 deletions

View File

@ -1,16 +1,15 @@
DROP PROCEDURE IF EXISTS floranet.catalogue_get;
DELIMITER $$
$$
CREATE DEFINER=`root`@`localhost` PROCEDURE floranet.catalogue_get(vLanded DATE, vPostalCode VARCHAR(15))
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE floranet.catalogue_get(vLanded DATE, vPostalCode VARCHAR(15))
READS SQL DATA
proc:BEGIN
/**
* Returns list, price and all the stuff regarding the floranet items.
* Returns list, price and all the stuff regarding the floranet items, for the designed shop
*
* @param vLanded Delivery date
* @param vPostalCode Delivery address postal code
*/
DECLARE vAddressFk INT;
DECLARE vLastCatalogueFk INT;
DECLARE vLockName VARCHAR(20);
DECLARE vLockTime INT;
@ -21,7 +20,7 @@ proc:BEGIN
RESIGNAL;
END;
SET vLockName = 'catalogue_get';
SET vLockTime = 15;
@ -32,6 +31,15 @@ proc:BEGIN
SELECT MAX(id) INTO vLastCatalogueFk
FROM catalogue;
SELECT addressFk
INTO vAddressFk
FROM addressPostCode apc
WHERE apc.dayOfWeek = dayOfWeek(vLanded)
AND NOW() < vLanded - INTERVAL apc.hoursInAdvance HOUR
AND apc.postCode = vPostalCode
-- Aquí hay que incluir los criterios de selección de tienda
LIMIT 1;
INSERT INTO catalogue(
name,
price,
@ -51,17 +59,14 @@ proc:BEGIN
it.name,
CONCAT('https://cdn.verdnatura.es/image/catalog/1600x900/', i.image),
i.description,
apc.addressFk
vAddressFk
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;
JOIN addressPostCode apc ON addressFk = vAddressFk
JOIN vn.address a ON a.id = vAddressFk;
SELECT *
FROM catalogue

View File

@ -1,8 +1,6 @@
DROP PROCEDURE IF EXISTS floranet.deliveryDate_get;
DELIMITER $$
$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `floranet`.`deliveryDate_get`(vPostalCode VARCHAR(15))
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `floranet`.`deliveryDate_get`(vPostalCode VARCHAR(15))
READS SQL DATA
BEGIN
/**

View File

@ -101,7 +101,7 @@ proc:BEGIN
vNewTicketFk,
c.itemFk,
CONCAT('Entrega: ',c.name),
- c.price,
- apc.deliveryCost,
1
FROM catalogue c
JOIN addressPostCode apc
@ -119,7 +119,7 @@ proc:BEGIN
vNewTicketFk,
r.elementFk,
i.longName,
r.cost,
0,
r.quantity
FROM catalogue c
JOIN recipe r ON r.itemFk = c.itemFk

View File

@ -0,0 +1,8 @@
-- Place your SQL code here
USE vn;
INSERT INTO salix.ACL ( model, property, accessType, permission, principalType, principalId) VALUES('ItemShelvingLog', '*', 'READ', 'ALLOW', 'ROLE', 'production');
-- redmine regularitzar parking per a que no tinguen espais
ALTER TABLE parking DROP CONSTRAINT chkParkingCodeFormat;
ALTER TABLE parking
ADD CONSTRAINT chkParkingCodeFormat CHECK (CHAR_LENGTH(code) > 4 AND code REGEXP ('^[^ ]+-[^ ]+$'));

View File

@ -50,6 +50,9 @@
"ItemShelving": {
"dataSource": "vn"
},
"ItemShelvingLog": {
"dataSource": "vn"
},
"ItemShelvingSale": {
"dataSource": "vn"
},
@ -74,4 +77,4 @@
"FixedPrice": {
"dataSource": "vn"
}
}
}

View File

@ -0,0 +1,52 @@
{
"name": "ItemShelvingLog",
"base": "VnModel",
"mixins": {
"Loggable": true
},
"options": {
"mysql": {
"table": "itemShelvingLog"
}
},
"properties": {
"id": {
"type": "number",
"id": true,
"description": "Identifier"
},
"created": {
"type": "date"
},
"shelvingFk": {
"type": "string"
},
"itemFk": {
"type": "number"
},
"visible": {
"type": "number"
},
"accion": {
"type": "string"
}
},
"relations": {
"item": {
"type": "belongsTo",
"model": "Item",
"foreignKey": "itemFk"
},
"worker": {
"type": "belongsTo",
"model": "Worker",
"foreignKey": "workerFk"
},
"shelving": {
"type": "belongsTo",
"model": "Shelving",
"foreignKey": "shelvingFk",
"primaryKey": "code"
}
}
}