feat: refs #8227 Roadmap changes
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Guillermo Bonet 2025-01-30 09:28:44 +01:00
parent a14d6227a1
commit 123f28055e
2 changed files with 10 additions and 17 deletions

View File

@ -13,12 +13,8 @@ BEGIN
CALL util.throw('Departure time can not be after arrival time');
END IF;
IF NEW.trailerPlate IS NOT NULL THEN
SET NEW.m3 = (SELECT m3 FROM vehicle WHERE numberPlate = NEW.trailerPlate);
END IF;
IF NEW.tugPlate IS NOT NULL THEN
SET NEW.m3 = NEW.m3 + (SELECT m3 FROM vehicle WHERE numberPlate = NEW.tugPlate);
IF NEW.trailerPlate IS NOT NULL OR NEW.tugPlate IS NOT NULL THEN
SET NEW.m3 = (SELECT SUM(m3) FROM vehicle WHERE numberPlate IN (NEW.trailerPlate, NEW.tugPlate));
END IF;
IF NEW.driver1Fk IS NOT NULL THEN
@ -31,5 +27,11 @@ BEGIN
LEFT JOIN client c ON c.id = w.id
WHERE w.id = NEW.driver1Fk);
END IF;
IF NEW.driverChangeFk IS NOT NULL THEN
SET NEW.driverChangeName = (SELECT CONCAT(w.firstName, ' ', w.lastName)
FROM worker w
WHERE w.id = NEW.driverChangeFk);
END IF;
END$$
DELIMITER ;

View File

@ -13,12 +13,8 @@ BEGIN
CALL util.throw('Departure time can not be after arrival time');
END IF;
IF NOT (NEW.trailerPlate <=> OLD.trailerPlate) THEN
SET NEW.m3 = (SELECT m3 FROM vehicle WHERE numberPlate = NEW.trailerPlate);
END IF;
IF NOT (NEW.tugPlate <=> OLD.tugPlate) THEN
SET NEW.m3 = NEW.m3 + (SELECT m3 FROM vehicle WHERE numberPlate = NEW.tugPlate);
IF NOT (NEW.trailerPlate <=> OLD.trailerPlate) OR NOT (NEW.tugPlate <=> OLD.tugPlate) THEN
SET NEW.m3 = (SELECT SUM(m3) FROM vehicle WHERE numberPlate IN (NEW.trailerPlate, NEW.tugPlate));
END IF;
IF NOT (NEW.driverName <=> OLD.driverName) THEN
@ -44,11 +40,6 @@ BEGIN
SET NEW.driverChangeName = (SELECT CONCAT(w.firstName, ' ', w.lastName)
FROM worker w
WHERE w.id = NEW.driverChangeFk);
SET NEW.phone = (SELECT COALESCE(w.phone, c.mobile, c.phone, c.mobile)
FROM worker w
LEFT JOIN client c ON c.id = w.id
WHERE w.id = NEW.driverChangeFk);
END IF;
END$$
DELIMITER ;