6956-2410_devTest #2112

Merged
alexm merged 150 commits from 6956-2410_devTest into test 2024-02-29 09:17:58 +00:00
2 changed files with 19 additions and 4 deletions
Showing only changes of commit 7ffc11e45a - Show all commits

View File

@ -43,9 +43,9 @@ BEGIN
SET NEW.currencyFk = entry_getCurrency(NEW.currencyFk, NEW.supplierFk);
END IF;
IF NOT (NEW.travelFk <=> OLD.travelFk)
OR NOT (NEW.currencyFk <=> OLD.currencyFk) THEN
SET NEW.commission = entry_getCommission(NEW.travelFk, NEW.currencyFk,NEW.supplierFk);
IF NOT (NEW.travelFk <=> OLD.travelFk)
OR NOT (NEW.currencyFk <=> OLD.currencyFk) THEN
SET NEW.commission = entry_getCommission(NEW.travelFk, NEW.currencyFk,NEW.supplierFk);
END IF;
END$$
DELIMITER ;

View File

@ -3,9 +3,11 @@ 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)
IF NOT (NEW.landed <=> OLD.landed)
OR NOT (NEW.shipped <=> OLD.shipped) THEN
CALL travel_checkDates(NEW.shipped, NEW.landed);
END IF;
@ -17,5 +19,18 @@ BEGIN
IF NOT (NEW.warehouseInFk <=> OLD.warehouseInFk) THEN
CALL travel_checkWarehouseIsFeedStock(NEW.warehouseInFk);
END IF;
IF NOT (NEW.awbFk <=> OLD.awbFk)THEN
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 vHasAnyInvoiceBooked THEN
CALL util.throw('The travel has entries with booked invoices');
END IF;
END IF;
END$$
DELIMITER ;