26 lines
575 B
SQL
26 lines
575 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`saleGroup_setParking`(
|
|
vSaleGroupFk VARCHAR(8),
|
|
vParkingFk INT
|
|
)
|
|
BEGIN
|
|
/**
|
|
* Aparca una preparación previa en un parking.
|
|
*
|
|
* @param vSaleGroupFk id de la preparación previa
|
|
* @param vParkingFk id del parking
|
|
*/
|
|
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
|
BEGIN
|
|
RESIGNAL;
|
|
END;
|
|
|
|
UPDATE saleGroup sg
|
|
SET sg.parkingFk = vParkingFk
|
|
WHERE sg.id = vSaleGroupFk
|
|
AND sg.created >= util.VN_CURDATE() - INTERVAL 1 WEEK;
|
|
|
|
CALL ticket_setNextState(ticket_get(vSaleGroupFk));
|
|
END$$
|
|
DELIMITER ;
|