[API] Configure Ad Hoc Receipt Reasons

Description

As an implementer of OpenLMIS I want to be able to assign valid reasons for performing ad hoc receipts so that I can track why my users are performing an ad hoc receipt.

Acceptance Criteria
1.Given I am a admin, when my access_token is verified, I can get all the list of reason type and reasonCategories.
2.Given I am a admin, when I get a list of all reasons and pick one from the list, assign that existing reason to program & facility type, then I should see it in the valid reasons list.
3.Given I am a admin, when I assign the same reason for a second time, then I should not see it twice in the valid reason list.
4.Given I am a admin, when I create a new reason, then I should see this newly created reason in the all reasons list.
5.Given I am a admin, when I create a reason that has content identical to an existing reason, then I should not see 2 reasons looks the same in the all reasons list.
6.Given I am a admin, when I update an existing reason, I should see changed content in all reasons list.
7.Given I am a admin, when I update the newly created reason, then I should see changed content in all reasons list.
8.Given I am a admin, when I assign the newly created reason to program & facility type, then I should see it in the valid reasons list.
9.Given I am a admin, when I detach a reason from a valid list of some program & facility type, then I should not see it anymore in the reason list.
10.Given I am a admin, when I doing assignment, if reason id does not exist in DB, then I will get error message from the system.
11.Given I am a admin, when I update a reason that has content identical to an existing reason, then I should not see 2 reasons looks the same in the all reasons list.
12.Given I am a non admin, I should not be able to assign anything.
13.Given I am a non admin, I should not be able to see the whole reason list.
14.Given I am a non admin, I should not be able to create any new reason.
15.Given I am a non admin, I should not be able to delete anything from any valid reason list.
1.For each program and Facility type combination, implementer/admin can select from the following fields:
*Inter-facility transfer
For OLMIS-634, when user selects a facility as the source, automatically select inter-facility transfer as the reason
*Donation
For OLMIS-634, when user selects NGO or donor as the source, automatically select donation as the reason
*Other: by selecting this, implementer/admin would allow user to specify an other (free text) source of ad hoc receipt
2.Implementer/admin can edit the name of the field (defaults to be as above) for each program and Facility type combination

3.Implementer/admin can add more reasons for each program and Facility type combination

4.Initially, this configuration can be made via SQL update. Eventually, this option should be configurable via upload script or UI.
*If via UI, eventually an option to copy sources from one program-Facility type combination to another would be great
*Eventually, this should not just be a create operation but allow edit/update as well

Note:

  • This story can be a lower priority. While most stock cards have receipt source as a column, they don’t have reason as commonly indicated. So can be pushed to a lower priority if needed.

  • UI preference for this to be on the same page as

  • (Same as configuring sources for ad hoc receipt) Ad hoc receipt reasons can vary from program to program and Facility type to Facility type – which is included in the story details above. However this is a lower priority – i.e. it can be pushed to a future release with us starting with the same set of reasons configured across programs and Facility types.

Assignee

Yi Deng

Reporter

Mary Jo Kochendorfer

Story Points

2

Epic Link

Sprint

None

Fix versions

Affects versions

Priority

Minor
Configure