danhandev opened a new pull request, #6809:
URL: https://github.com/apache/fineract/pull/6809

   ## Description
   
   Fixes the server side of 
[FINERACT-643](https://issues.apache.org/jira/browse/FINERACT-643).
   
   **Original issue**
   
   The journal entries list cannot be filtered to system entries. The only 
filter by kind of entry is `manualEntriesOnly`, which is applied only when it 
is `true`, so `manualEntriesOnly=false` returns every entry. The web app's 
"System Entries" option is mapped to `manualEntriesOnly=false` and therefore 
shows all entries.
   
   **What changed**
   
   As agreed on the issue (option 1), `GET /journalentries` gets a new 
`entrySource` parameter and `manualEntriesOnly` stays as it is:
   
   - `entrySource=MANUAL` returns manual entries, their reversals and opening 
balances (`manual_entry = true`).
   - `entrySource=SYSTEM` returns the entries posted by the system 
(`manual_entry = false`).
   - The value is case-insensitive. Any other value returns 400 
`error.msg.query.parameter.value.unsupported`, as `chargeStatus` on the savings 
account charges does, so an empty page always means "no matching entries" (the 
same reasoning as for the `status` filter of the clients list in #1207).
   - Both filters apply when `manualEntriesOnly` is sent as well, so 
`manualEntriesOnly=true&entrySource=SYSTEM` returns no entries.
   
   **Naming question:** on the issue I used `entryType` as an example, but 
`entryType` is already the debit/credit field of every journal entry in the 
response, so I named the parameter `entrySource`. Happy to rename it if you 
prefer something else.
   
   **How it is covered**
   
   `FeignJournalEntrySourceFilterTest` posts a savings deposit (system entries) 
and a manual entry on the same GL account and checks the unfiltered, `MANUAL`, 
`SYSTEM` and lower-case `system` results, the combinations with 
`manualEntriesOnly`, and the 400 for an unsupported value. Both tests fail on 
develop and pass with this change. `GLAccountIntegrationTest`, 
`AccountingScenarioIntegrationTest`, 
`JournalEntryReversalOrderingIntegrationTest` and 
`FeignTrialBalanceSummaryReportTest` pass as well.
   
   **Out of scope**
   
   - The web app still sends `manualEntriesOnly=false` for "System Entries" and 
needs its own change to send `entrySource=SYSTEM` 
([openMF/web-app#236](https://github.com/openMF/web-app/issues/236), linked 
from the issue).
   - `entityType` is still ignored whenever `manualEntriesOnly` is sent 
(existing behaviour). It works together with `entrySource`.
   - The generated Java client (`fineract-client`) gets one more argument on 
`retrieveAllJournalEntries`; the only positional caller in the repo 
(`JournalEntryHelper`) is updated.
   
   ## Checklist
   
   Please make sure these boxes are checked before submitting your pull request 
- thanks!
   
   - [x] Write the commit message as per [our 
guidelines](https://github.com/apache/fineract/blob/develop/CONTRIBUTING.md#pull-requests)
   - [x] Acknowledge that we will not review PRs that are not passing the build 
_("green")_ - it is your responsibility to get a proposed PR to pass the build, 
not primarily the project's maintainers.
   - [x] Create/update [unit or integration 
tests](https://fineract.apache.org/docs/current/#_testing) for verifying the 
changes made.
   - [x] Follow our [coding 
conventions](https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions).
   - [x] Add required Swagger annotation and update API documentation at 
fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with 
details of any API changes (`entrySource` added)
   - [x] [This PR must not be a "code 
dump"](https://cwiki.apache.org/confluence/display/FINERACT/Pull+Request+Size+Limit).
 Large changes can be made in a branch, with assistance. Ask for help on the 
[developer mailing list](https://fineract.apache.org/#contribute).
   - [x] If merging this PR resolves a JIRA issue, I will mark that issue as 
resolved and set "Fix Version/s" appropriately.
   - [x] I followed the [AI 
Policy](https://github.com/apache/fineract/blob/develop/CONTRIBUTING.md#ai-policy).
   
   Your assigned reviewer(s) will follow our [guidelines for code 
reviews](https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to