refs #7217 create travel_throwAWBError
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Ivan Mas 2024-05-16 15:34:45 +02:00
parent 9b5b269fe6
commit b2db076c2f
5 changed files with 22 additions and 8 deletions

View File

@ -0,0 +1,14 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`travel_throwAWBError`(vSelf INT)
BEGIN
/**
* Throws an error if travel does not have a logical AWB
* or there are several AWBs associated with the same DUA
*
* @param vSelf The travel id
*/
IF NOT travel_hasUniqueAwb(vSelf) THEN
CALL util.throw('The AWB is incorrect, there is a different AWB in the associated entries');
END IF;
END$$
DELIMITER ;

View File

@ -7,8 +7,8 @@ BEGIN
CALL supplier_checkIsActive(NEW.supplierFk);
SET NEW.currencyFk = entry_getCurrency(NEW.currencyFk, NEW.supplierFk);
SET NEW.commission = entry_getCommission(NEW.travelFk, NEW.currencyFk,NEW.supplierFk);
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');
IF NEW.travelFk IS NOT NULL THEN
CALL travel_throwAWBError(NEW.travelFk);
END IF;
END$$
DELIMITER ;

View File

@ -25,8 +25,8 @@ BEGIN
IF NOT (NEW.travelFk <=> OLD.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');
IF NEW.travelFk IS NOT NULL THEN
CALL travel_throwAWBError(NEW.travelFk);
END IF;
SELECT COUNT(*) > 0 INTO vIsVirtual

View File

@ -9,8 +9,8 @@ BEGIN
CALL travel_checkWarehouseIsFeedStock(NEW.warehouseInFk);
IF NEW.awbFk IS NOT NULL AND NOT travel_hasUniqueAwb(NEW.id) THEN
CALL util.throw('The AWB is incorrect, there is a different AWB in the associated entries');
IF NEW.awbFk IS NOT NULL THEN
CALL travel_throwAWBError (NEW.id);
END IF;
END$$
DELIMITER ;

View File

@ -33,8 +33,8 @@ BEGIN
END IF;
END IF;
IF (NOT(NEW.awbFk <=> OLD.awbFk)) AND NEW.awbFk IS NOT NULL AND NOT travel_hasUniqueAwb(NEW.id) THEN
CALL util.throw('The AWB is incorrect, there is a different AWB in the associated entries');
IF (NOT(NEW.awbFk <=> OLD.awbFk)) AND NEW.awbFk IS NOT NULL THEN
CALL travel_throwAWBError(NEW.id);
END IF;
END$$
DELIMITER ;