refs #7191 check isBooked in entry_BeforeUpdate #2329
|
@ -6,17 +6,17 @@ BEGIN
|
|||
DECLARE vIsVirtual BOOL;
|
||||
DECLARE vPrintedCount INT;
|
||||
DECLARE vHasDistinctWarehouses BOOL;
|
||||
DECLARE vEntryFkCount INT;
|
||||
DECLARE vTotalBuy INT;
|
||||
ivanm marked this conversation as resolved
Outdated
|
||||
|
||||
IF NEW.isBooked = OLD.isBooked THEN
|
||||
CALL entry_checkBooked(OLD.id);
|
||||
END IF;
|
||||
|
||||
IF NEW.isBooked = 1 THEN
|
||||
SELECT COUNT(*) INTO vEntryFkCount
|
||||
FROM buy WHERE entryFk = NEW.id;
|
||||
IF vEntryFkCount = 0 THEN
|
||||
CALL util.throw('The entry cannot be marked as booked if it does not have lines');
|
||||
ELSE
|
||||
IF NEW.isBooked = 1 THEN
|
||||
SELECT COUNT(*) INTO vTotalBuy
|
||||
ivanm marked this conversation as resolved
Outdated
carlosap
commented
No es te que mirar sempre que siga TRUE, es deu de mirar sempre que cambie de valor y el nou siga TRUE No es te que mirar sempre que siga TRUE, es deu de mirar sempre que cambie de valor y el nou siga TRUE
|
||||
FROM buy WHERE entryFk = NEW.id;
|
||||
IF vTotalBuy = 0 THEN
|
||||
CALL util.throw('The entry cannot be marked as booked if it does not have lines');
|
||||
ivanm marked this conversation as resolved
Outdated
guillermo
commented
IF NOT vTotalBuy THEN IF NOT vTotalBuy THEN
|
||||
END IF;
|
||||
ivanm marked this conversation as resolved
Outdated
guillermo
commented
Acortar msg del throw, lo máximo que permite el procedimiento son 55 carácteres Acortar msg del throw, lo máximo que permite el procedimiento son 55 carácteres
|
||||
END IF;
|
||||
END IF;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
El que estem contant son buy no entry, seria més descriptiu buyCounter ó totalBuy