Koha-clms/Koha/REST/V1
Jan Kissig 1293980793
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>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-01 18:22:36 +02:00
..
Acquisitions Bug 36495: Use render_resource_deleted() helper everywhere 2024-04-26 18:06:14 +02:00
Auth Bug 36937: Remove warning from unit tests 2024-06-13 14:14:08 +01:00
Biblios Bug 36495: Use render_resource_deleted() helper everywhere 2024-04-26 18:06:14 +02:00
CashRegisters Bug 36495: Use render_resource_not_found() helper everywhere 2024-04-26 18:06:13 +02:00
Clubs Bug 36495: Use render_resource_not_found() helper everywhere 2024-04-26 18:06:13 +02:00
Config/SMTP Bug 36495: Use render_resource_deleted() helper everywhere 2024-04-26 18:06:14 +02:00
ERM Bug 37043: Update the base URL for the Counter Registry API 2024-06-06 12:10:36 +01:00
ILL Bug 36495: Use render_resource_deleted() helper everywhere 2024-04-26 18:06:14 +02:00
OAuth Bug 36219: Re-add missing state param for Oauth/OIDC client 2024-03-04 14:50:41 +01:00
Patrons Bug 37535: Adding a debit via API will show the belated patron as the librarian that caused the debit 2024-08-01 18:22:36 +02:00
Preservation Bug 36495: Use render_resource_deleted() helper everywhere 2024-04-26 18:06:14 +02:00
StockRotation Bug 35430: Add rota endpoints for stockrotation 2024-06-28 13:49:26 +02:00
AdvancedEditorMacro.pm Bug 36495: Use render_resource_deleted() helper everywhere 2024-04-26 18:06:14 +02:00
ArticleRequests.pm Bug 36495: Use render_resource_deleted() helper everywhere 2024-04-26 18:06:14 +02:00
Auth.pm Bug 36367: Remove call to non-existent subroutine new_userenv 2024-06-14 11:17:19 +01:00
AuthorisedValueCategories.pm Bug 34920: Return sorted av_cats to be able to test 2024-07-01 18:55:47 +02:00
AuthorisedValues.pm Bug 36495: Use render_resource_not_found() helper everywhere 2024-04-26 18:06:13 +02:00
Authorities.pm Bug 36495: Use render_resource_deleted() helper everywhere 2024-04-26 18:06:14 +02:00
BackgroundJobs.pm Bug 36495: Use render_resource_not_found() helper everywhere 2024-04-26 18:06:13 +02:00
Biblios.pm Bug 36120: (QA follow-up) Fix /biblios.t unit test 2024-05-03 16:02:53 +02:00
Bookings.pm Bug 36495: Use render_resource_deleted() helper everywhere 2024-04-26 18:06:14 +02:00
Checkouts.pm Bug 36495: Use render_resource_not_found() helper everywhere 2024-04-26 18:06:13 +02:00
CirculationRules.pm Bug 36641: (follow-up) Ensure limited return works 2024-07-18 18:25:49 +02:00
Cities.pm Bug 36495: Use render_resource_deleted() helper everywhere 2024-04-26 18:06:14 +02:00
DeletedBiblios.pm Bug 33960: Add routes and controller 2024-04-22 08:57:50 +02:00
ERM.pm Bug 33606: (QA follow-up) Cosmetic changes 2023-07-06 12:24:15 -03:00
ExtendedAttributeTypes.pm Bug 37262: (follow-up) Rename types/tables 2024-07-12 10:21:23 +02:00
Holds.pm Bug 36495: Use render_resource_deleted() helper everywhere 2024-04-26 18:06:14 +02:00
ImportBatchProfiles.pm Bug 36495: Use render_resource_deleted() helper everywhere 2024-04-26 18:06:14 +02:00
ImportRecordMatches.pm Bug 36495: Use render_resource_not_found() helper everywhere 2024-04-26 18:06:13 +02:00
ItemTypes.pm Bug 34008: (QA follow-up) 'item_type_id' should be used 2023-11-01 17:23:15 -03:00
Items.pm Bug 29560: (follow-up) Split prepare and store logic 2024-07-15 11:04:05 +02:00
Libraries.pm Bug 36495: Use render_resource_deleted() helper everywhere 2024-04-26 18:06:14 +02:00
OAuth.pm Bug 33556: Avoid relying on $c->validation 2023-07-21 17:14:37 -03:00
Patrons.pm Bug 36505: (follow-up) Consistent error codes in POST 2024-04-26 18:06:16 +02:00
Preservation.pm Bug 30708: Tidy perl files 2023-10-18 15:42:04 -03:00
Quotes.pm Bug 36495: Use render_resource_deleted() helper everywhere 2024-04-26 18:06:14 +02:00
RecordSources.pm Bug 35919: Add /record_sources endpoints 2024-04-26 17:06:03 +02:00
ReturnClaims.pm Bug 36495: Use render_resource_deleted() helper everywhere 2024-04-26 18:06:14 +02:00
SearchFilter.pm Bug 36495: Use render_resource_deleted() helper everywhere 2024-04-26 18:06:14 +02:00
Static.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Suggestions.pm Bug 36495: Use render_resource_deleted() helper everywhere 2024-04-26 18:06:14 +02:00
Tickets.pm Bug 35657: Add support for assignee_id to ticket_updates endpoint 2024-05-02 15:03:35 +02:00
TransferLimits.pm Bug 36495: Use render_resource_deleted() helper everywhere 2024-04-26 18:06:14 +02:00
TwoFactorAuth.pm Bug 36495: Use render_resource_deleted() helper everywhere 2024-04-26 18:06:14 +02:00