24 lines
674 B
SQL
24 lines
674 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`ticket_isOutClosureZone`(vSelf INT)
|
|
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 ;
|