feat: refs #7335 Added call ticket_afterUpdate #2415

Merged
guillermo merged 7 commits from 7335-modifyCmr into dev 2024-05-08 11:54:03 +00:00
1 changed files with 4 additions and 11 deletions
Showing only changes of commit 2adf96cb37 - Show all commits

View File

@ -7,7 +7,7 @@ BEGIN
* *
* @param vSelf El id del ticket * @param vSelf El id del ticket
*/ */
DECLARE vCmrFk, vPreviousCmrFk, vCurrentCmrFk INT; DECLARE vCmrFk INT;
SELECT cmrFk INTO vCmrFk SELECT cmrFk INTO vCmrFk
FROM ticket FROM ticket
WHERE id = vSelf; WHERE id = vSelf;
@ -44,8 +44,6 @@ BEGIN
AND t.id = vSelf AND t.id = vSelf
GROUP BY t.id; GROUP BY t.id;
START TRANSACTION;
IF vCmrFk THEN IF vCmrFk THEN
UPDATE cmr c UPDATE cmr c
JOIN tTicket t JOIN tTicket t
@ -58,8 +56,6 @@ BEGIN
c.ead = t.landed c.ead = t.landed
WHERE id = vCmrFk; WHERE id = vCmrFk;
ELSE ELSE
SELECT MAX(id) INTO vPreviousCmrFk FROM cmr;
INSERT INTO cmr ( INSERT INTO cmr (
senderInstruccions, senderInstruccions,
truckPlate, truckPlate,
@ -71,16 +67,13 @@ BEGIN
) )
SELECT * FROM tTicket; SELECT * FROM tTicket;
SELECT MAX(id) INTO vCurrentCmrFk FROM cmr; IF (SELECT EXISTS(SELECT * FROM tTicket)) THEN
IF vPreviousCmrFk <> vCurrentCmrFk THEN
UPDATE ticket UPDATE ticket
SET cmrFk = vCurrentCmrFk SET cmrFk = vCurrentCmrFk
guillermo marked this conversation as resolved Outdated

SQL Error [1054] [42S22]: Unknown column 'vCurrentCmrFk' in 'field list'

SQL Error [1054] [42S22]: Unknown column 'vCurrentCmrFk' in 'field list'
WHERE id = vSelf; WHERE id = LAST_INSERT_ID();
END IF; END IF;
END IF; END IF;
COMMIT;
DROP TEMPORARY TABLE tTicket; DROP TEMPORARY TABLE tTicket;
END$$ END$$
DELIMITER ; DELIMITER ;