Merge pull request 'refs #7191 check isBooked in entry_BeforeUpdate' (!2329) from 7191-entry_BeforeUpdate-isBooked into dev
Reviewed-on: #2329 Reviewed-by: Guillermo Bonet <guillermo@verdnatura.es> Reviewed-by: Carlos Andrés <carlosap@verdnatura.es>
This commit is contained in:
commit
5643a2e9e2
|
@ -6,9 +6,19 @@ BEGIN
|
||||||
DECLARE vIsVirtual BOOL;
|
DECLARE vIsVirtual BOOL;
|
||||||
DECLARE vPrintedCount INT;
|
DECLARE vPrintedCount INT;
|
||||||
DECLARE vHasDistinctWarehouses BOOL;
|
DECLARE vHasDistinctWarehouses BOOL;
|
||||||
|
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);
|
||||||
|
ELSE
|
||||||
|
IF NEW.isBooked THEN
|
||||||
|
SELECT COUNT(*) INTO vTotalBuy
|
||||||
|
FROM buy
|
||||||
|
WHERE entryFk = NEW.id;
|
||||||
|
IF NOT vTotalBuy THEN
|
||||||
|
CALL util.throw('Entry must have lines to be marked booked');
|
||||||
|
END IF;
|
||||||
|
END IF;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
SET NEW.editorFk = account.myUser_getId();
|
SET NEW.editorFk = account.myUser_getId();
|
||||||
|
@ -16,7 +26,7 @@ BEGIN
|
||||||
IF NOT (NEW.travelFk <=> OLD.travelFk) THEN
|
IF NOT (NEW.travelFk <=> OLD.travelFk) THEN
|
||||||
|
|
||||||
IF NEW.travelFk IS NOT NULL AND NOT travel_hasUniqueAwb(NEW.travelFk) THEN
|
IF NEW.travelFk IS NOT NULL AND NOT travel_hasUniqueAwb(NEW.travelFk) THEN
|
||||||
CALL util.throw('The travel is incorrect, there is a different AWB in the associated entries');
|
CALL util.throw('The travel is incorrect, there is a different AWB in the associated entries');
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
SELECT COUNT(*) > 0 INTO vIsVirtual
|
SELECT COUNT(*) > 0 INTO vIsVirtual
|
||||||
|
|
Loading…
Reference in New Issue