Hotfix changes whit conficts merged incorrectly #2829

Merged
carlosap merged 1 commits from Hotfix-changes-whit-conficts-merged-incorrectly into master 2024-08-02 12:16:04 +00:00
2 changed files with 20 additions and 11 deletions

View File

@ -11,24 +11,29 @@ BEGIN
*/
DECLARE vSaleFk INT;
DECLARE vHasProblem INT;
DECLARE vIsProblemCalcNeeded 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;
OPEN vSaleList;
l: LOOP
SET vDone = FALSE;
FETCH vSaleList INTO vSaleFk, vHasProblem;
FETCH vSaleList INTO vSaleFk, vHasProblem, vIsProblemCalcNeeded;
IF vDone THEN
LEAVE l;
END IF;
UPDATE sale
SET problem = CONCAT(
IF(vHasProblem,
CONCAT(problem, ',', vProblemCode),
REPLACE(problem, vProblemCode , '')))
SET problem = IF (vIsProblemCalcNeeded,
CONCAT(
IF(vHasProblem,
CONCAT(problem, ',', vProblemCode),
REPLACE(problem, vProblemCode , ''))),
NULL)
WHERE id = vSaleFk;
END LOOP;
CLOSE vSaleList;

View File

@ -12,24 +12,28 @@ BEGIN
*/
DECLARE vTicketFk INT;
DECLARE vHasProblem INT;
DECLARE vIsProblemCalcNeeded 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;
OPEN vTicketList;
l: LOOP
SET vDone = FALSE;
FETCH vTicketList INTO vTicketFk, vHasProblem;
FETCH vTicketList INTO vTicketFk, vHasProblem, vIsProblemCalcNeeded;
IF vDone THEN
LEAVE l;
END IF;
UPDATE ticket
SET problem = CONCAT(
IF(vHasProblem,
SET problem = IF(vIsProblemCalcNeeded,
CONCAT(IF(vHasProblem,
CONCAT(problem, ',', vProblemCode),
REPLACE(problem, vProblemCode , '')))
REPLACE(problem, vProblemCode , ''))),
NULL)
WHERE id = vTicketFk;
END LOOP;
CLOSE vTicketList;