Hotfix changes whit conficts merged incorrectly
gitea/salix/pipeline/pr-master This commit looks good Details

This commit is contained in:
Carlos Andrés 2024-08-02 13:45:58 +02:00
parent dead585a1b
commit f431d6c37f
2 changed files with 20 additions and 11 deletions

View File

@ -11,24 +11,29 @@ BEGIN
*/ */
DECLARE vSaleFk INT; DECLARE vSaleFk INT;
DECLARE vHasProblem INT; DECLARE vHasProblem INT;
DECLARE vIsProblemCalcNeeded BOOL;
DECLARE vDone BOOL; DECLARE vDone BOOL;
DECLARE vSaleList CURSOR FOR SELECT saleFk, hasProblem FROM tmp.sale; DECLARE vSaleList CURSOR FOR
SELECT saleFk, hasProblem, isProblemCalcNeeded
FROM tmp.sale;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
OPEN vSaleList; OPEN vSaleList;
l: LOOP l: LOOP
SET vDone = FALSE; SET vDone = FALSE;
FETCH vSaleList INTO vSaleFk, vHasProblem; FETCH vSaleList INTO vSaleFk, vHasProblem, vIsProblemCalcNeeded;
IF vDone THEN IF vDone THEN
LEAVE l; LEAVE l;
END IF; END IF;
UPDATE sale UPDATE sale
SET problem = CONCAT( SET problem = IF (vIsProblemCalcNeeded,
IF(vHasProblem, CONCAT(
CONCAT(problem, ',', vProblemCode), IF(vHasProblem,
REPLACE(problem, vProblemCode , ''))) CONCAT(problem, ',', vProblemCode),
REPLACE(problem, vProblemCode , ''))),
NULL)
WHERE id = vSaleFk; WHERE id = vSaleFk;
END LOOP; END LOOP;
CLOSE vSaleList; CLOSE vSaleList;

View File

@ -12,24 +12,28 @@ BEGIN
*/ */
DECLARE vTicketFk INT; DECLARE vTicketFk INT;
DECLARE vHasProblem INT; DECLARE vHasProblem INT;
DECLARE vIsProblemCalcNeeded BOOL;
DECLARE vDone BOOL; DECLARE vDone BOOL;
DECLARE vTicketList CURSOR FOR SELECT ticketFk, hasProblem FROM tmp.ticket; DECLARE vTicketList CURSOR FOR
SELECT ticketFk, hasProblem, isProblemCalcNeeded
FROM tmp.ticket;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
OPEN vTicketList; OPEN vTicketList;
l: LOOP l: LOOP
SET vDone = FALSE; SET vDone = FALSE;
FETCH vTicketList INTO vTicketFk, vHasProblem; FETCH vTicketList INTO vTicketFk, vHasProblem, vIsProblemCalcNeeded;
IF vDone THEN IF vDone THEN
LEAVE l; LEAVE l;
END IF; END IF;
UPDATE ticket UPDATE ticket
SET problem = CONCAT( SET problem = IF(vIsProblemCalcNeeded,
IF(vHasProblem, CONCAT(IF(vHasProblem,
CONCAT(problem, ',', vProblemCode), CONCAT(problem, ',', vProblemCode),
REPLACE(problem, vProblemCode , ''))) REPLACE(problem, vProblemCode , ''))),
NULL)
WHERE id = vTicketFk; WHERE id = vTicketFk;
END LOOP; END LOOP;
CLOSE vTicketList; CLOSE vTicketList;