2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-07-22 09:52:42 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` FUNCTION `vn`.`ticket_isOutClosureZone`(vSelf INT)
|
2024-01-15 11:31:03 +00:00
|
|
|
RETURNS tinyint(1)
|
|
|
|
DETERMINISTIC
|
|
|
|
BEGIN
|
|
|
|
/**
|
|
|
|
* Devuelve true/false si la hora actual supera la hora del cierre del ticket más el tiempo configurado en packingDelay
|
|
|
|
*
|
|
|
|
* @param vSelf Ticket id
|
|
|
|
* @return true o false
|
|
|
|
*/
|
|
|
|
DECLARE vIsTicketInTime BOOL;
|
|
|
|
|
|
|
|
SELECT TIMEDIFF(CURRENT_TIME(), zc.hour + INTERVAL tc.packingDelay HOUR) > 0 INTO vIsTicketInTime
|
|
|
|
FROM vn.ticket t
|
|
|
|
JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk
|
|
|
|
LEFT JOIN vn.ticketConfig tc ON TRUE
|
|
|
|
WHERE t.id = vSelf
|
|
|
|
AND zc.dated = util.VN_CURDATE();
|
|
|
|
|
|
|
|
RETURN vIsTicketInTime;
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|