From 03b95eb9f6d7e1a9993b6d4e25bb7a4cb6bccfdd Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 8 Jul 2024 13:43:08 +0200 Subject: [PATCH 1/2] refs #5525 fix accountDetailValue --- print/templates/reports/sepa-core/sql/supplier.sql | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/print/templates/reports/sepa-core/sql/supplier.sql b/print/templates/reports/sepa-core/sql/supplier.sql index a32d311de..e0ad69257 100644 --- a/print/templates/reports/sepa-core/sql/supplier.sql +++ b/print/templates/reports/sepa-core/sql/supplier.sql @@ -7,7 +7,6 @@ SELECT s.city, sp.name province, s.nif, - sa.iban, sa.supplierFk, be.name bankName, ad.value accountDetailValue @@ -21,9 +20,11 @@ FROM LEFT JOIN supplierAccount sa ON sa.supplierFk = s.id LEFT JOIN bankEntity be ON sa.bankEntityFk = be.id LEFT JOIN accountDetail ad ON ad.supplierAccountFk = sa.id - LEFT JOIN accountDetailType adt ON adt.id = ad.accountDetailTypeFk AND adt.id = 3 + JOIN accountDetailType adt ON adt.id = ad.accountDetailTypeFk WHERE (m.companyFk = ? OR m.companyFk IS NULL) AND (c.id = ? OR (c.id IS NULL AND c.countryFk = sa.countryFk)) + AND adt.id = 3 +GROUP BY ad.value ORDER BY - m.created DESC; +m.created DESC; From 06ae86d78faf3dae812f18045091a41fbe717319 Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 8 Jul 2024 13:45:16 +0200 Subject: [PATCH 2/2] refs #5525 fix adt --- print/templates/reports/sepa-core/sql/supplier.sql | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/print/templates/reports/sepa-core/sql/supplier.sql b/print/templates/reports/sepa-core/sql/supplier.sql index e0ad69257..1276f2437 100644 --- a/print/templates/reports/sepa-core/sql/supplier.sql +++ b/print/templates/reports/sepa-core/sql/supplier.sql @@ -20,11 +20,10 @@ FROM LEFT JOIN supplierAccount sa ON sa.supplierFk = s.id LEFT JOIN bankEntity be ON sa.bankEntityFk = be.id LEFT JOIN accountDetail ad ON ad.supplierAccountFk = sa.id - JOIN accountDetailType adt ON adt.id = ad.accountDetailTypeFk + JOIN accountDetailType adt ON adt.id = ad.accountDetailTypeFk AND adt.id = 3 WHERE (m.companyFk = ? OR m.companyFk IS NULL) AND (c.id = ? OR (c.id IS NULL AND c.countryFk = sa.countryFk)) - AND adt.id = 3 GROUP BY ad.value ORDER BY m.created DESC;