feat: refs#8087 Redadas en travel
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Carlos Andrés 2024-11-19 13:40:12 +01:00
parent b8f2e0b906
commit 6a43d3c752
5 changed files with 36 additions and 20 deletions

View File

@ -0,0 +1,17 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`travel_checkRaid`(
vIsRaid BOOL,
vDaysInForward INT
)
BEGIN
/**
* Check if the values of isRaid and daysInforward are correct
*
* @param vIsRaid idRaid value
* @param vDaysInForward daysInForward value
*/
IF (NOT vIsRaid AND vDaysInForward IS NOT NULL) OR (vIsRaid AND vDaysInForward IS NULL) THEN
CALL util.throw('The raid information is not correct');
END IF;
END$$
DELIMITER ;

View File

@ -1,10 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`town_beforeUpdate`
BEFORE UPDATE ON `town`
FOR EACH ROW
BEGIN
-- IF !(OLD.geoFk <=> NEW.geoFk) THEN
-- CALL zoneGeo_throwNotEditable;
-- END IF;
END$$
DELIMITER ;

View File

@ -8,7 +8,11 @@ BEGIN
CALL travel_checkDates(NEW.shipped, NEW.landed); CALL travel_checkDates(NEW.shipped, NEW.landed);
CALL travel_checkWarehouseIsFeedStock(NEW.warehouseInFk); CALL travel_checkWarehouseIsFeedStock(NEW.warehouseInFk);
IF NEW.isRaid IS NOT NULL OR NEW.daysInForward IS NOT NULL THEN
CALL travel_checkRaid(NEW.isRaid, NEW.daysInForward);
END IF;
IF NEW.awbFk IS NOT NULL THEN IF NEW.awbFk IS NOT NULL THEN
CALL travel_throwAwb(NEW.id); CALL travel_throwAwb(NEW.id);
END IF; END IF;

View File

@ -7,7 +7,7 @@ BEGIN
SET NEW.editorFk = account.myUser_getId(); 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 OR NOT (NEW.shipped <=> OLD.shipped) THEN
CALL travel_checkDates(NEW.shipped, NEW.landed); CALL travel_checkDates(NEW.shipped, NEW.landed);
END IF; END IF;
@ -20,19 +20,23 @@ BEGIN
CALL travel_checkWarehouseIsFeedStock(NEW.warehouseInFk); CALL travel_checkWarehouseIsFeedStock(NEW.warehouseInFk);
END IF; END IF;
IF NOT (NEW.isRaid <=> OLD.isRaid) OR NOT (NEW.daysInForward <=> OLD.daysInForward) THEN
CALL travel_checkRaid(NEW.isRaid, NEW.daysInForward);
END IF;
IF NOT (NEW.awbFk <=> OLD.awbFk)THEN IF NOT (NEW.awbFk <=> OLD.awbFk)THEN
SELECT COUNT(*) INTO vHasAnyInvoiceBooked SELECT COUNT(*) INTO vHasAnyInvoiceBooked
FROM travel t FROM travel t
JOIN entry e ON e.travelFk = t.id JOIN entry e ON e.travelFk = t.id
JOIN invoiceIn ii ON ii.id = e.invoiceInFk JOIN invoiceIn ii ON ii.id = e.invoiceInFk
WHERE t.id = NEW.id WHERE t.id = NEW.id
AND ii.isBooked; AND ii.isBooked;
IF vHasAnyInvoiceBooked THEN IF vHasAnyInvoiceBooked THEN
CALL util.throw('The travel has entries with booked invoices'); CALL util.throw('The travel has entries with booked invoices');
END IF; END IF;
END IF; END IF;
IF (NOT(NEW.awbFk <=> OLD.awbFk)) AND NEW.awbFk IS NOT NULL THEN IF (NOT(NEW.awbFk <=> OLD.awbFk)) AND NEW.awbFk IS NOT NULL THEN
CALL travel_throwAwb(NEW.id); CALL travel_throwAwb(NEW.id);
END IF; END IF;

View File

@ -245,5 +245,6 @@
"ticketLostExpedition": "The ticket [{{ticketId}}]({{{ticketUrl}}}) has the following lost expedition:{{ expeditionId }}", "ticketLostExpedition": "The ticket [{{ticketId}}]({{{ticketUrl}}}) has the following lost expedition:{{ expeditionId }}",
"null": "null", "null": "null",
"Invalid or expired verification code": "Invalid or expired verification code", "Invalid or expired verification code": "Invalid or expired verification code",
"Payment method is required": "Payment method is required" "Payment method is required": "Payment method is required",
"The raid information is not correct": "The raid information is not correct"
} }