refs #7191 requested modifications
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Ivan Mas 2024-04-22 15:03:08 +02:00
parent 00ce018ee3
commit 0284b138d7
1 changed files with 8 additions and 8 deletions

View File

@ -6,17 +6,17 @@ BEGIN
DECLARE vIsVirtual BOOL; DECLARE vIsVirtual BOOL;
DECLARE vPrintedCount INT; DECLARE vPrintedCount INT;
DECLARE vHasDistinctWarehouses BOOL; DECLARE vHasDistinctWarehouses BOOL;
DECLARE vEntryFkCount INT; DECLARE vTotalBuy INT;
IF NEW.isBooked = OLD.isBooked THEN IF NEW.isBooked = OLD.isBooked THEN
CALL entry_checkBooked(OLD.id); CALL entry_checkBooked(OLD.id);
END IF; ELSE
IF NEW.isBooked = 1 THEN
IF NEW.isBooked = 1 THEN SELECT COUNT(*) INTO vTotalBuy
SELECT COUNT(*) INTO vEntryFkCount FROM buy WHERE entryFk = NEW.id;
FROM buy WHERE entryFk = NEW.id; IF vTotalBuy = 0 THEN
IF vEntryFkCount = 0 THEN CALL util.throw('The entry cannot be marked as booked if it does not have lines');
CALL util.throw('The entry cannot be marked as booked if it does not have lines'); END IF;
END IF; END IF;
END IF; END IF;