FINERACT-2054: BadSqlGrammar Error in Loans Awaiting Disbursal Summary Report

This error is thrown because of Office/Branch( ounder.name) is not mentioned in the Group by clause
This commit is contained in:
Mariappan Sivakumar
2024-02-13 09:23:29 +01:00
committed by Adam Saghy
parent c504996c1d
commit 5577365858
@@ -12734,7 +12734,7 @@
<column name="report_subtype"/>
<column name="report_category" value="Loan"/>
<column name="report_sql"
value="SELECT &#13;&#10;concat(repeat(&quot;..&quot;, &#13;&#10; ((LENGTH(ounder.`hierarchy`) - LENGTH(REPLACE(ounder.`hierarchy`, '.', '')) - 1))), ounder.`name`) as &quot;Office/Branch&quot;,&#13;&#10;pl.`name` as &quot;Product&quot;, &#13;&#10;ifnull(cur.display_symbol, l.currency_code) as Currency, f.`name` as Fund,&#13;&#10;sum(l.principal_amount) as Principal&#13;&#10;from m_office o &#13;&#10;join m_office ounder on ounder.hierarchy like concat(o.hierarchy, '%')&#13;&#10;and ounder.hierarchy like concat('${currentUserHierarchy}', '%')&#13;&#10;join m_client c on c.office_id = ounder.id&#13;&#10;join m_loan l on l.client_id = c.id&#13;&#10;join m_product_loan pl on pl.id = l.product_id&#13;&#10;left join m_staff lo on lo.id = l.loan_officer_id&#13;&#10;left join m_currency cur on cur.code = l.currency_code&#13;&#10;left join m_fund f on f.id = l.fund_id&#13;&#10;left join m_code_value purp on purp.id = l.loanpurpose_cv_id&#13;&#10;where o.id = ${officeId}&#13;&#10;and (l.currency_code = &quot;${currencyId}&quot; or &quot;-1&quot; = &quot;${currencyId}&quot;)&#13;&#10;and (l.product_id = &quot;${loanProductId}&quot; or &quot;-1&quot; = &quot;${loanProductId}&quot;)&#13;&#10;and (ifnull(l.loan_officer_id, -10) = &quot;${loanOfficerId}&quot; or &quot;-1&quot; = &quot;${loanOfficerId}&quot;)&#13;&#10;and (ifnull(l.fund_id, -10) = ${fundId} or -1 = ${fundId})&#13;&#10;and (ifnull(l.loanpurpose_cv_id, -10) = ${loanPurposeId} or -1 = ${loanPurposeId})&#13;&#10;and l.loan_status_id = 200&#13;&#10;group by ounder.hierarchy, pl.`name`, l.currency_code, f.`name`&#13;&#10;order by ounder.hierarchy, pl.`name`, l.currency_code, f.`name`"/>
value="SELECT &#13;&#10;concat(repeat(&quot;..&quot;, &#13;&#10; ((LENGTH(ounder.`hierarchy`) - LENGTH(REPLACE(ounder.`hierarchy`, '.', '')) - 1))), ounder.`name`) as &quot;Office/Branch&quot;,&#13;&#10;pl.`name` as &quot;Product&quot;, &#13;&#10;ifnull(cur.display_symbol, l.currency_code) as Currency, f.`name` as Fund,&#13;&#10;sum(l.principal_amount) as Principal&#13;&#10;from m_office o &#13;&#10;join m_office ounder on ounder.hierarchy like concat(o.hierarchy, '%')&#13;&#10;and ounder.hierarchy like concat('${currentUserHierarchy}', '%')&#13;&#10;join m_client c on c.office_id = ounder.id&#13;&#10;join m_loan l on l.client_id = c.id&#13;&#10;join m_product_loan pl on pl.id = l.product_id&#13;&#10;left join m_staff lo on lo.id = l.loan_officer_id&#13;&#10;left join m_currency cur on cur.code = l.currency_code&#13;&#10;left join m_fund f on f.id = l.fund_id&#13;&#10;left join m_code_value purp on purp.id = l.loanpurpose_cv_id&#13;&#10;where o.id = ${officeId}&#13;&#10;and (l.currency_code = &quot;${currencyId}&quot; or &quot;-1&quot; = &quot;${currencyId}&quot;)&#13;&#10;and (l.product_id = &quot;${loanProductId}&quot; or &quot;-1&quot; = &quot;${loanProductId}&quot;)&#13;&#10;and (ifnull(l.loan_officer_id, -10) = &quot;${loanOfficerId}&quot; or &quot;-1&quot; = &quot;${loanOfficerId}&quot;)&#13;&#10;and (ifnull(l.fund_id, -10) = ${fundId} or -1 = ${fundId})&#13;&#10;and (ifnull(l.loanpurpose_cv_id, -10) = ${loanPurposeId} or -1 = ${loanPurposeId})&#13;&#10;and l.loan_status_id = 200&#13;&#10;group by ounder.hierarchy, ounder.name, pl.`name`, l.currency_code, f.`name`&#13;&#10;order by ounder.hierarchy, ounder.name, pl.`name`, l.currency_code, f.`name`"/>
<column name="description" value="Individual Client Report"/>
<column name="core_report" valueBoolean="true"/>
<column name="use_report" valueBoolean="true"/>