refactor: #7258 Fixes

This commit is contained in:
Guillermo Bonet 2024-04-24 10:57:35 +02:00
parent f7ebd071bf
commit 71e1e53ccd
5 changed files with 29 additions and 29 deletions

View File

@ -11,7 +11,7 @@ BEGIN
SELECT d.client, d.amount, pm.graceDays SELECT d.client, d.amount, pm.graceDays
FROM bi.defaulters d FROM bi.defaulters d
JOIN vn.client c ON c.id = d.client JOIN vn.client c ON c.id = d.client
JOIN vn.payMethod pm ON pm.id = c.pay_met_id JOIN vn.payMethod pm ON pm.id = c.payMethodFk
WHERE hasChanged AND date = vDate; WHERE hasChanged AND date = vDate;
DECLARE invoices CURSOR FOR DECLARE invoices CURSOR FOR

View File

@ -58,7 +58,7 @@ BEGIN
JOIN vn.address a on a.id = t.addressFk JOIN vn.address a on a.id = t.addressFk
JOIN vn.client c on c.id = a.clientFk JOIN vn.client c on c.id = a.clientFk
JOIN tmp.ticket_list tt on tt.id = t.id JOIN tmp.ticket_list tt on tt.id = t.id
JOIN vn.item i on s.itemFk = i.Id_Ticket JOIN vn.item i on s.itemFk = i.id
JOIN vn.company co on co.id = t.companyFk JOIN vn.company co on co.id = t.companyFk
LEFT JOIN vn.company co2 on co2.clientFk = c.id LEFT JOIN vn.company co2 on co2.clientFk = c.id
JOIN vn.itemType it on it.id = i.typeFk JOIN vn.itemType it on it.id = i.typeFk

View File

@ -4,7 +4,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`solunionCAP_afterInse
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
UPDATE client c UPDATE client c
JOIN creditClassification cc ON cc.client = c.clientFk JOIN creditClassification cc ON cc.client = c.id
JOIN creditInsurance ci ON ci.creditClassification = cc.id JOIN creditInsurance ci ON ci.creditClassification = cc.id
SET creditInsurance = ci.credit * 2 WHERE ci.id = NEW.creditInsurance; SET creditInsurance = ci.credit * 2 WHERE ci.id = NEW.creditInsurance;
END$$ END$$

View File

@ -5,12 +5,12 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`solunionCAP_afterUpda
BEGIN BEGIN
IF NEW.dateLeaving IS NOT NULL THEN IF NEW.dateLeaving IS NOT NULL THEN
UPDATE client c UPDATE client c
JOIN creditClassification cc ON cc.client = c.clientFk JOIN creditClassification cc ON cc.client = c.id
JOIN creditInsurance ci ON ci.creditClassification = cc.id JOIN creditInsurance ci ON ci.creditClassification = cc.id
SET creditInsurance = ci.credit WHERE ci.id = OLD.creditInsurance; SET creditInsurance = ci.credit WHERE ci.id = OLD.creditInsurance;
ELSE ELSE
UPDATE client c UPDATE client c
JOIN creditClassification cc ON cc.client = c.clientFk JOIN creditClassification cc ON cc.client = c.id
JOIN creditInsurance ci ON ci.creditClassification = cc.id JOIN creditInsurance ci ON ci.creditClassification = cc.id
SET creditInsurance = ci.credit * 2 WHERE ci.id = OLD.creditInsurance; SET creditInsurance = ci.credit * 2 WHERE ci.id = OLD.creditInsurance;
END IF; END IF;

View File

@ -4,7 +4,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`solunionCAP_beforeDel
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
UPDATE client c UPDATE client c
JOIN creditClassification cc ON cc.client = c.clientFk JOIN creditClassification cc ON cc.client = c.id
JOIN creditInsurance ci ON ci.creditClassification = cc.id JOIN creditInsurance ci ON ci.creditClassification = cc.id
SET creditInsurance = ci.credit WHERE ci.id = OLD.creditInsurance; SET creditInsurance = ci.credit WHERE ci.id = OLD.creditInsurance;
END$$ END$$