[
https://issues.apache.org/jira/browse/FINERACT-2711?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Adam Saghy updated FINERACT-2711:
---------------------------------
Fix Version/s: 1.16.0
> Bulk-import shared-account download template: Clients and Products named
> ranges use + size() + 1 string concatenation, producing a wildly wrong row
> bound (e.g. $B$21 instead of $B$3 for two rows)
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: FINERACT-2711
> URL: https://issues.apache.org/jira/browse/FINERACT-2711
> Project: Apache Fineract
> Issue Type: Bug
> Components: DataImportTool
> Reporter: Farooq Ayoade
> Assignee: Farooq Ayoade
> Priority: Minor
> Fix For: 1.16.0
>
>
> ---Observed behavior
> SharedAccountWorkBookPopulator.setNames() builds the Clients and Products
> named ranges like this:
> {code:java}
> clientsGroup.setRefersToFormula(CLIENT_SHEET_NAME + "!$B$2:$B$" +
> clients.size() + 1);
> ...
> productGroup.setRefersToFormula(SHARED_PRODUCTS_SHEET_NAME + "!$B$2:$B$" +
> products.size() + 1);
> {code}
> Because the whole expression is left-to-right string concatenation, size()
> + 1 does not add — the 1 is appended as
> text. For two clients the range becomes Clients!$B$2:$B$21 (POI parses "2"
> + "1" as row 21) instead of the intended
> Clients!$B$2:$B$3. The dropdown then spans dozens of empty rows.
> Expected behavior
> The upper bound is size + 1 as a number (last data row = row 2 + size − 1),
> i.e. $B$3 for two rows — exactly as every
> other bulk-import populator writes its office/client ranges.
> Root cause
>
> Missing parentheses around the arithmetic, so + binds as string
> concatenation. The sibling populators
> (LoanWorkbookPopulator.setNames, SavingsWorkbookPopulator.setNames, …)
> already use (size() + 1) and are unaffected.
> Proposed fix
> {code:java}
> clientsGroup.setRefersToFormula(CLIENT_SHEET_NAME + "!$B$2:$B$" +
> (clients.size() + 1));
> productGroup.setRefersToFormula(SHARED_PRODUCTS_SHEET_NAME + "!$B$2:$B$" +
> (products.size() + 1));
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)