7336_devToTest #2414
|
@ -6,19 +6,19 @@ BEGIN
|
|||
DECLARE vIsVirtual BOOL;
|
||||
DECLARE vPrintedCount INT;
|
||||
DECLARE vHasDistinctWarehouses BOOL;
|
||||
DECLARE vEntryFkCount INT;
|
||||
DECLARE vTotalBuy INT;
|
||||
|
||||
IF NEW.isBooked = OLD.isBooked THEN
|
||||
CALL entry_checkBooked(OLD.id);
|
||||
END IF;
|
||||
|
||||
ELSE
|
||||
IF NEW.isBooked = 1 THEN
|
||||
SELECT COUNT(*) INTO vEntryFkCount
|
||||
SELECT COUNT(*) INTO vTotalBuy
|
||||
FROM buy WHERE entryFk = NEW.id;
|
||||
IF vEntryFkCount = 0 THEN
|
||||
IF vTotalBuy = 0 THEN
|
||||
CALL util.throw('The entry cannot be marked as booked if it does not have lines');
|
||||
END IF;
|
||||
END IF;
|
||||
END IF;
|
||||
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
|
||||
|
|
Loading…
Reference in New Issue