feat refactor setParking REGEXP refs #7575 #2654
|
@ -23,39 +23,41 @@ proc: BEGIN
|
|||
LEAVE proc;
|
||||
END IF;
|
||||
|
||||
-- Se comprueba si es una preparación previa
|
||||
SELECT COUNT(*) INTO vIsSaleGroup
|
||||
FROM vn.saleGroup sg
|
||||
WHERE sg.id = vParam;
|
||||
IF vParam REGEXP '^[0-9]+$' THEN
|
||||
-- Se comprueba si es una preparación previa
|
||||
SELECT COUNT(*) INTO vIsSaleGroup
|
||||
FROM vn.saleGroup sg
|
||||
WHERE sg.id = vParam;
|
||||
|
||||
IF vIsSaleGroup THEN
|
||||
CALL vn.saleGroup_setParking(vParam, vParkingFk);
|
||||
LEAVE proc;
|
||||
IF vIsSaleGroup THEN
|
||||
CALL vn.saleGroup_setParking(vParam, vParkingFk);
|
||||
LEAVE proc;
|
||||
END IF;
|
||||
|
||||
-- Se comprueba si es un ticket
|
||||
SELECT COUNT(*) INTO vIsTicket
|
||||
FROM vn.ticket t
|
||||
WHERE t.id = vParam
|
||||
AND t.shipped >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE());
|
||||
|
||||
IF vIsTicket THEN
|
||||
CALL vn.ticket_setParking(vParam, vParkingFk);
|
||||
LEAVE proc;
|
||||
END IF;
|
||||
|
||||
-- Se comprueba si es una coleccion de tickets
|
||||
SELECT COUNT(*) INTO vIsCollection
|
||||
FROM vn.collection c
|
||||
WHERE c.id = vParam
|
||||
AND c.created >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE());
|
||||
|
||||
IF vIsCollection THEN
|
||||
CALL vn.collection_setParking(vParam, vParkingFk);
|
||||
LEAVE proc;
|
||||
END IF;
|
||||
ELSE
|
||||
-- Por descarte, se considera una matrícula
|
||||
CALL vn.shelving_setParking(vParam, vParkingFk);
|
||||
END IF;
|
||||
|
||||
-- Se comprueba si es un ticket
|
||||
SELECT COUNT(*) INTO vIsTicket
|
||||
FROM vn.ticket t
|
||||
WHERE t.id = vParam
|
||||
AND t.shipped >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE());
|
||||
|
||||
IF vIsTicket THEN
|
||||
CALL vn.ticket_setParking(vParam, vParkingFk);
|
||||
LEAVE proc;
|
||||
END IF;
|
||||
|
||||
-- Se comprueba si es una coleccion de tickets
|
||||
SELECT COUNT(*) INTO vIsCollection
|
||||
FROM vn.collection c
|
||||
WHERE c.id = vParam
|
||||
AND c.created >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE());
|
||||
|
||||
IF vIsCollection THEN
|
||||
CALL vn.collection_setParking(vParam, vParkingFk);
|
||||
LEAVE proc;
|
||||
END IF;
|
||||
|
||||
-- Por descarte, se considera una matrícula
|
||||
CALL vn.shelving_setParking(vParam, vParkingFk);
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
Loading…
Reference in New Issue