[Bug 37535] New: Adding a debit via API will show the belated patron as the librarian that caused the debit
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37535 Bug ID: 37535 Summary: Adding a debit via API will show the belated patron as the librarian that caused the debit Change sponsored?: --- Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: REST API Assignee: koha-bugs@lists.koha-community.org Reporter: bibliothek@th-wildau.de QA Contact: testopia@bugs.koha-community.org CC: tomascohen@gmail.com When POSTing { "amount": 1.17, "description": "some description", "internal_note": "internal_noteo", "type": "MANUAL", "user_id": 17 } to http://localhost:8081/api/v1/patrons/5/account/debits I would expect patron 5 to be debited by user_id 17. At least that is what the definition for debit says. But instead the belated patron is also shown as librarian in http://localhost:8081/cgi-bin/koha/members/accountline-details.pl?accountlines_id=<ACCOUNTLINE FROM RESPONSE> When POSTing without user_id I would expect that the user_id is gained from the api user, but also the belated patron is shown as librarian. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37535 Jan Kissig <bibliothek@th-wildau.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|enhancement |minor -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37535 --- Comment #1 from Jan Kissig <bibliothek@th-wildau.de> --- Created attachment 169887 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=169887&action=edit Bug 37535: Adding a debit via API will show the belated patron as the librarian that caused the debit This patch fixes the addPatronDebit route so that the librarian that caused the debit is taken from either the requests payload user_id or if not set from the api user. Test plan: a) enable system preference RESTBasicAuth b) use a REST client to send a POST request with the following JSON body to http://localhost:8081/api/v1/patrons/5/account/debits { "amount": 1.23, "description": "some description", "internal_note": "internal_note", "type": "MANUAL" } Authentication username and password is "koha" c) verify that "user_id" is the same as patron_id in response. d) send a different request including user_id to the same endpoint { "amount": 1.23, "description": "some description", "internal_note": "internal_note", "type": "MANUAL", "user_id": 19 } e) verify that "user_id" is the same as patron_id in response. f) apply patch and repeat step b) and d) e) verify that user_id in b) is now 51 (which is the borrowernumber of koha user) f) verify that user_id in d) is now 19 as defined in request g) recheck on http://localhost:8081/cgi-bin/koha/members/accountline-details.pl?accountlines_id=<account_line_id> (from response) that column Librarian now says the user from user_id h) sign off :) -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37535 Jan Kissig <bibliothek@th-wildau.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|minor |trivial Patch complexity|--- |Trivial patch Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37535 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |tomascohen@gmail.com |y.org | Assignee|koha-bugs@lists.koha-commun |jan.kissig@th-wildau.de |ity.org | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37535 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|Trivial patch |Small patch Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37535 --- Comment #2 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 169905 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=169905&action=edit Bug 37535: Regression tests Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37535 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #169887|0 |1 is obsolete| | --- Comment #3 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 169906 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=169906&action=edit Bug 37535: Adding a debit via API will show the belated patron as the librarian that caused the debit This patch fixes the addPatronDebit route so that the librarian that caused the debit is taken from either the requests payload user_id or if not set from the api user. Test plan: a) enable system preference RESTBasicAuth b) use a REST client to send a POST request with the following JSON body to http://localhost:8081/api/v1/patrons/5/account/debits { "amount": 1.23, "description": "some description", "internal_note": "internal_note", "type": "MANUAL" } Authentication username and password is "koha" c) verify that "user_id" is the same as patron_id in response. d) send a different request including user_id to the same endpoint { "amount": 1.23, "description": "some description", "internal_note": "internal_note", "type": "MANUAL", "user_id": 19 } e) verify that "user_id" is the same as patron_id in response. f) apply patch and repeat step b) and d) e) verify that user_id in b) is now 51 (which is the borrowernumber of koha user) f) verify that user_id in d) is now 19 as defined in request g) recheck on http://localhost:8081/cgi-bin/koha/members/accountline-details.pl?accountlines_id=<account_line_id> (from response) that column Librarian now says the user from user_id h) sign off :) Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37535 --- Comment #4 from Tomás Cohen Arazi <tomascohen@gmail.com> --- I wrote tests once I so you filed this bug. I confirm your patch fixes the issue. A revisited test plan (using the tests) would be: 1. Apply the regression tests patch 2. Run: $ ktd --shell k$ prove t/db_dependent/api/v1/patrons_accounts.t => FAIL: Tests fail. 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37535 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37535 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Adding a debit via API will |Adding a debit via API will |show the belated patron as |show the patron as the |the librarian that caused |librarian that caused the |the debit |debit -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37535 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to main Version(s)| |24.11.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37535 --- Comment #5 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Pushed for 24.11! Well done everyone, thank you! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37535 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|24.11.00 |24.11.00,24.05.06 released in| | Status|Pushed to main |Pushed to stable CC| |lucas@bywatersolutions.com --- Comment #6 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Backported to 24.05.x for upcoming 24.05.06 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37535 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to stable |Pushed to oldstable -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37535 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fridolin.somers@biblibre.co | |m Status|Pushed to oldstable |Pushed to oldoldstable Version(s)|24.11.00,24.05.06 |24.11.00,24.05.06,23.11.11 released in| | --- Comment #7 from Fridolin Somers <fridolin.somers@biblibre.com> --- Pushed to 23.11.x for 23.11.11 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37535 Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to oldoldstable |RESOLVED Resolution|--- |FIXED CC| |wainuiwitikapark@catalyst.n | |et.nz --- Comment #8 from Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> --- Not backporting to 22.11 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org