feat: comprobaciones facturas contabilizadas refs #6932
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
bed4faceb7
commit
5fe4f794cc
|
@ -6,6 +6,7 @@ BEGIN
|
|||
DECLARE vIsVirtual BOOL;
|
||||
DECLARE vPrintedCount INT;
|
||||
DECLARE vHasDistinctWarehouses BOOL;
|
||||
DECLARE vHasAnyInvoiceBooked BOOL;
|
||||
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
|
||||
|
@ -49,15 +50,13 @@ BEGIN
|
|||
END IF;
|
||||
|
||||
IF NOT (NEW.invoiceInFk <=> OLD.invoiceInFk)THEN
|
||||
DECLARE vHanAnyInvoiceBooked BOOL;
|
||||
|
||||
SELECT COUNT(*) INTO vHanAnyInvoiceBooked
|
||||
SELECT COUNT(*) INTO vHasAnyInvoiceBooked
|
||||
FROM entry e
|
||||
JOIN invoiceIn ii ON ii.id = e.invoiceInFk
|
||||
WHERE e.id = NEW.id
|
||||
AND ii.isBooked;
|
||||
|
||||
IF vHanAnyInvoiceBooked THEN
|
||||
IF vHasAnyInvoiceBooked THEN
|
||||
CALL util.throw('The travel has entries with booked invoices')
|
||||
END IF;
|
||||
END IF;
|
||||
|
|
|
@ -3,6 +3,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`travel_beforeUpdate`
|
|||
BEFORE UPDATE ON `travel`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
DECLARE vHasAnyInvoiceBooked BOOL;
|
||||
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
|
||||
IF NOT (NEW.landed <=> OLD.landed)
|
||||
|
@ -19,16 +21,15 @@ BEGIN
|
|||
END IF;
|
||||
|
||||
IF NOT (NEW.awbFk <=> OLD.awbFk)THEN
|
||||
DECLARE vHanAnyInvoiceBooked BOOL;
|
||||
|
||||
SELECT COUNT(*) INTO vHanAnyInvoiceBooked
|
||||
|
||||
SELECT COUNT(*) INTO vHasAnyInvoiceBooked
|
||||
FROM travel t
|
||||
JOIN entry e ON e.travelFk =t.id
|
||||
JOIN invoiceIn ii ON ii.id = e.invoiceInFk
|
||||
WHERE t.id = NEW.id
|
||||
AND ii.isBooked;
|
||||
|
||||
IF vHanAnyInvoiceBooked THEN
|
||||
|
||||
IF vHasAnyInvoiceBooked THEN
|
||||
CALL util.throw('The travel has entries with booked invoices')
|
||||
END IF;
|
||||
END IF;
|
||||
|
|
Loading…
Reference in New Issue