Koha-clms/Koha/REST/V1
Jan Kissig 4179a3fe27 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>
(cherry picked from commit 1293980793)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 3460eaa617)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-12-06 10:14:21 +01:00
..
Acquisitions Bug 36483: Make API controllers use $c->objects->to_api 2024-05-23 14:47:41 +02:00
Auth Bug 36937: Remove warning from unit tests 2024-07-19 09:33:48 +02:00
Biblios Bug 36483: Make API controllers use $c->objects->to_api 2024-05-23 14:47:41 +02:00
CashRegisters Bug 36483: Make API controllers use $c->objects->to_api 2024-05-23 14:47:41 +02:00
Clubs Bug 36483: Make API controllers use $c->objects->to_api 2024-05-23 14:47:41 +02:00
Config/SMTP Bug 36483: Make API controllers use $c->objects->to_api 2024-05-23 14:47:41 +02:00
ERM Bug 37043: Update the base URL for the Counter Registry API 2024-06-27 09:59:25 +02:00
OAuth Bug 34271: Remove a few Logger statements from REST API 2023-10-18 10:26:03 -03:00
Patrons Bug 37535: Adding a debit via API will show the belated patron as the librarian that caused the debit 2024-12-06 10:14:21 +01:00
Preservation Bug 36483: Make API controllers use $c->objects->to_api 2024-05-23 14:47:41 +02:00
AdvancedEditorMacro.pm Bug 36483: Make API controllers use $c->objects->to_api 2024-05-23 14:47:41 +02:00
ArticleRequests.pm Bug 33556: Avoid relying on $c->validation 2023-07-21 17:14:37 -03:00
Auth.pm Bug 36420: Allow Basic authentication using `cardnumber` 2024-05-23 15:29:14 +02:00
AuthorisedValueCategories.pm Bug 34920: Return sorted av_cats to be able to test 2024-12-02 11:21:04 +01:00
AuthorisedValues.pm Bug 33556: Avoid relying on $c->validation 2023-07-21 17:14:37 -03:00
Authorities.pm Bug 36483: Make API controllers use $c->objects->to_api 2024-05-23 14:47:41 +02:00
BackgroundJobs.pm Bug 36483: Make API controllers use $c->objects->to_api 2024-05-23 14:47:41 +02:00
Biblios.pm Bug 36483: Make API controllers use $c->objects->to_api 2024-05-23 14:47:41 +02:00
Bookings.pm Bug 36100: (QA follow-up) Move 400 to 409 2024-03-11 11:00:23 +01:00
Checkouts.pm Bug 37076: Fix incorrect needsconfirmation code 2024-12-02 09:57:10 +01:00
CirculationRules.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Cities.pm Bug 36483: Make API controllers use $c->objects->to_api 2024-05-23 14:47:41 +02:00
ERM.pm Bug 33606: (QA follow-up) Cosmetic changes 2023-07-06 12:24:15 -03:00
Holds.pm Bug 35353: Add REST API endpoint to retrieve old holds 2024-05-24 10:07:38 +02:00
Illbackends.pm Bug 33556: Avoid relying on $c->validation 2023-07-21 17:14:37 -03:00
IllbatchStatuses.pm Bug 30719: (QA follow-up) Rename illbatchstatuses 2023-10-17 14:45:22 -03:00
Illbatches.pm Bug 30719: (QA follow-up) Pick better column names and cleanup 2023-10-17 14:45:23 -03:00
Illrequests.pm Bug 36483: Make API controllers use $c->objects->to_api 2024-05-23 14:47:41 +02:00
ImportBatchProfiles.pm Bug 36483: Make API controllers use $c->objects->to_api 2024-05-23 14:47:41 +02:00
ImportRecordMatches.pm Bug 33556: Avoid relying on $c->validation 2023-07-21 17:14:37 -03: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 35963: Fix bundled items table ordering and filtering 2024-03-11 10:42:34 +01:00
Libraries.pm Bug 36482: Make embedding work for GET /libraries/:library_id 2024-05-24 10:15:28 +02:00
OAuth.pm Bug 33556: Avoid relying on $c->validation 2023-07-21 17:14:37 -03:00
Patrons.pm Bug 36483: Patrons.pm use case 2024-05-23 14:47:41 +02:00
Preservation.pm Bug 30708: Tidy perl files 2023-10-18 15:42:04 -03:00
Quotes.pm Bug 36483: Make API controllers use $c->objects->to_api 2024-05-23 14:47:41 +02:00
ReturnClaims.pm Bug 36483: Make API controllers use $c->objects->to_api 2024-05-23 14:47:41 +02:00
SearchFilter.pm Bug 36483: Make API controllers use $c->objects->to_api 2024-05-23 14:47:41 +02:00
Stage.pm Bug 33556: Avoid relying on $c->validation 2023-07-21 17:14:37 -03:00
Static.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Suggestions.pm Bug 36483: Make API controllers use $c->objects->to_api 2024-05-23 14:47:41 +02:00
Tickets.pm Bug 36483: Make API controllers use $c->objects->to_api 2024-05-23 14:47:41 +02:00
TransferLimits.pm Bug 36483: Make API controllers use $c->objects->to_api 2024-05-23 14:47:41 +02:00
TwoFactorAuth.pm Bug 30843: Add mfa_range configuration option for TOTP 2023-09-25 10:53:51 -03:00