[Bug 35386] New: Renewals via the API are recorded using the branch of the API account used
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35386 Bug ID: 35386 Summary: Renewals via the API are recorded using the branch of the API account used Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: REST API Assignee: koha-bugs@lists.koha-community.org Reporter: nick@bywatersolutions.com CC: tomascohen@gmail.com When renewing items via the API Koha records the branch of the renewal as the branch of the account that is signed in to the API. For outside service (Aspen, Communico) they may have a single API account that represents all user interactions. While this behavior may not be technically incorrect, it should be configurable like OpacRenewalBranch - allowing the library to decide which branch is recorded in the statistics table. -- 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=35386 Daniel B. <dbarden@cuyahogalibrary.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dbarden@cuyahogalibrary.org -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35386 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Small 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=35386 --- Comment #1 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 159278 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=159278&action=edit Bug 35386: Add RESTAPIRenewalBranch system preference This patch adds a new system prefernce, RESTAPIRenewalBranch, analogous to the existing OpacRenewalBranch system preference. The preference allows choosing how the renewal branch is recorded in the statistics table. In order ot preserve existing behaviour, the default is to use the api user's branch. To test: 1 - Checkout some items to a patron 2 - Add an API user account with circulation permissions and a different homebranch 3 - POST a renewal to: http://localhost:8080/api/v1/checkouts/{checkout_id}/renewal 4 - Check statistics table and confirm the api users branch was used 5 - Apply patches, restart all 6 - Repeat API renewal, confirm same branch used 7 - Change the RESTAPIRenewal syspref 8 - Repeat API renewal and confirm specified branch is used 9 - Confirm the syspref works for all settings -- 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=35386 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |nick@bywatersolutions.com |ity.org | -- 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=35386 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #159278|0 |1 is obsolete| | --- Comment #2 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 159282 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=159282&action=edit Bug 35386: Add RESTAPIRenewalBranch system preference This patch adds a new system prefernce, RESTAPIRenewalBranch, analogous to the existing OpacRenewalBranch system preference. The preference allows choosing how the renewal branch is recorded in the statistics table. In order ot preserve existing behaviour, the default is to use the api user's branch. To test: 1 - Checkout some items to a patron 2 - Add an API user account with circulation permissions and a different homebranch 3 - POST a renewal to: http://localhost:8080/api/v1/checkouts/{checkout_id}/renewal 4 - Check statistics table and confirm the api users branch was used 5 - Apply patches, restart all 6 - Repeat API renewal, confirm same branch used 7 - Change the RESTAPIRenewal syspref 8 - Repeat API renewal and confirm specified branch is used 9 - Confirm the syspref works for all settings -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35386 Brendan Lawlor <blawlor@clamsnet.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |blawlor@clamsnet.org --- Comment #3 from Brendan Lawlor <blawlor@clamsnet.org> --- When I tested this out I confirmed before the patch the branch recorded for the renewal is the API user's homebranch. When I applied the patch I noticed the system preference RESTAPIRenewalBranch defaults to 'APIRenew' and when I made a post to {{base_url}}/api/v1/checkouts/1/renewal the branch recorded in the statistics table as 'API Renew' According to the test plan it should default to the branch of the api user. Also one of the options for RESTAPIRenewalBranch is NULL, which did work to record the branch in the statistics as NULL, but I'm not sure if that is an intended option. The other options I tested worked as expected for: the branch of the api user the library the item was checked out from the items home library NULL the patron's home library -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35386 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact| |tomascohen@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35386 --- Comment #4 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Brendan Lawlor from comment #3)
Also one of the options for RESTAPIRenewalBranch is NULL, which did work to record the branch in the statistics as NULL, but I'm not sure if that is an intended option.
That's a good question! I'd like to mention that the author provided tests for that particular use case so I assume it is what they wanted it to be like. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35386 --- Comment #5 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Nick Clemens from comment #0)
When renewing items via the API Koha records the branch of the renewal as the branch of the account that is signed in to the API.
For outside service (Aspen, Communico) they may have a single API account that represents all user interactions.
While this behavior may not be technically incorrect, it should be configurable like OpacRenewalBranch - allowing the library to decide which branch is recorded in the statistics table.
We can currently specify the current branch by using the `x-koha-library` header (available since bug 24003 => v19.11.07): https://api.koha-community.org/Development.html#section/Special-headers I think decoupling the default from the OPAC would be correct, though. So I'd rename the bug. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35386 --- Comment #6 from Brendan Lawlor <blawlor@clamsnet.org> --- Out of curiosity, I tested this when also using the header x-koha-library. The library specified in the header takes precedence over the system preference so it won't negatively affect any implementations that use that header. I think it's a good idea to have the default configurable by the library with the setting in addition to being able to use the header so I think this is the correct behavior. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35386 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Renewals via the API are |Add ability to configure |recorded using the branch |renewal branch when not |of the API account used |specified in API request -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35386 --- Comment #7 from Nick Clemens <nick@bywatersolutions.com> --- (In reply to Brendan Lawlor from comment #3)
When I tested this out I confirmed before the patch the branch recorded for the renewal is the API user's homebranch.
When I applied the patch I noticed the system preference RESTAPIRenewalBranch defaults to 'APIRenew' and when I made a post to {{base_url}}/api/v1/checkouts/1/renewal the branch recorded in the statistics table as 'API Renew' According to the test plan it should default to the branch of the api user.
I only see this if I look at the preference before running updatedatabase If the update has not been run to set the default then the interface will display the first option in the list
Also one of the options for RESTAPIRenewalBranch is NULL, which did work to record the branch in the statistics as NULL, but I'm not sure if that is an intended option.
This was intended to match the OPacRenewalBranch options -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35386 --- Comment #8 from Nick Clemens <nick@bywatersolutions.com> --- (In reply to Tomás Cohen Arazi from comment #5)
I think decoupling the default from the OPAC would be correct, though. So I'd rename the bug.
Renamed (In reply to Brendan Lawlor from comment #6)
I think it's a good idea to have the default configurable by the library with the setting in addition to being able to use the header so I think this is the correct behavior.
Agreed :-) This should be ready for sign off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35386 Brendan Lawlor <blawlor@clamsnet.org> changed: What |Removed |Added ---------------------------------------------------------------------------- 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=35386 Brendan Lawlor <blawlor@clamsnet.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #159282|0 |1 is obsolete| | --- Comment #9 from Brendan Lawlor <blawlor@clamsnet.org> --- Created attachment 161244 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=161244&action=edit Bug 35386: Add RESTAPIRenewalBranch system preference This patch adds a new system prefernce, RESTAPIRenewalBranch, analogous to the existing OpacRenewalBranch system preference. The preference allows choosing how the renewal branch is recorded in the statistics table. In order ot preserve existing behaviour, the default is to use the api user's branch. To test: 1 - Checkout some items to a patron 2 - Add an API user account with circulation permissions and a different homebranch 3 - POST a renewal to: http://localhost:8080/api/v1/checkouts/{checkout_id}/renewal 4 - Check statistics table and confirm the api users branch was used 5 - Apply patches, restart all 6 - Repeat API renewal, confirm same branch used 7 - Change the RESTAPIRenewal syspref 8 - Repeat API renewal and confirm specified branch is used 9 - Confirm the syspref works for all settings Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35386 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |enhancement CC| |martin.renvoize@ptfs-europe | |.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35386 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #161244|0 |1 is obsolete| | --- Comment #10 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 161428 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=161428&action=edit Bug 35386: Add RESTAPIRenewalBranch system preference This patch adds a new system prefernce, RESTAPIRenewalBranch, analogous to the existing OpacRenewalBranch system preference. The preference allows choosing how the renewal branch is recorded in the statistics table. In order ot preserve existing behaviour, the default is to use the api user's branch. To test: 1 - Checkout some items to a patron 2 - Add an API user account with circulation permissions and a different homebranch 3 - POST a renewal to: http://localhost:8080/api/v1/checkouts/{checkout_id}/renewal 4 - Check statistics table and confirm the api users branch was used 5 - Apply patches, restart all 6 - Repeat API renewal, confirm same branch used 7 - Change the RESTAPIRenewal syspref 8 - Repeat API renewal and confirm specified branch is used 9 - Confirm the syspref works for all settings Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35386 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|tomascohen@gmail.com |martin.renvoize@ptfs-europe | |.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35386 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA --- Comment #11 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Tidied and fixed QA complaints inline.. all working as expected Passing QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35386 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Add ability to configure |Add ability to configure |renewal branch when not |renewal library when not |specified in API request |specified in API request --- Comment #12 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Please all, keep terminology in mind. Small fixes made inline: * api => API * branch > library (in system preference description at least) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35386 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |24.05.00 released in| | Status|Passed QA |Pushed to master -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35386 --- Comment #13 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Pushed for 24.05! 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=35386 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to main |Needs documenting CC| |fridolin.somers@biblibre.co | |m --- Comment #14 from Fridolin Somers <fridolin.somers@biblibre.com> --- Not backported to 23.11.x -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35386 Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Documentation| |https://gitlab.com/koha-com submission| |munity/koha-manual/-/merge_ | |requests/886 Status|Needs documenting |RESOLVED CC| |caroline.cyr-la-rose@inlibr | |o.com Resolution|--- |FIXED Documentation| |Caroline Cyr La Rose contact| | -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org