Bugzilla – Attachment 164267 Details for
Bug 36483
Calling $object->to_api directly should be avoided
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36483: Patrons.pm use case
Bug-36483-Patronspm-use-case.patch (text/plain), 1.96 KB, created by
Tomás Cohen Arazi (tcohen)
on 2024-04-02 13:00:02 UTC
(
hide
)
Description:
Bug 36483: Patrons.pm use case
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2024-04-02 13:00:02 UTC
Size:
1.96 KB
patch
obsolete
>From e7dca00f385b1186fda3963e17c0250f29288202 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 2 Apr 2024 12:53:45 +0000 >Subject: [PATCH] Bug 36483: Patrons.pm use case > >This case brought my attention as there was a different 'user' parameter being passed. >It turns out we already thought about this, and `objects.to_api` is of course always passing it :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/REST/V1/Patrons.pm | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) > >diff --git a/Koha/REST/V1/Patrons.pm b/Koha/REST/V1/Patrons.pm >index 24aba7fa9f8..0c37a4aeb68 100644 >--- a/Koha/REST/V1/Patrons.pm >+++ b/Koha/REST/V1/Patrons.pm >@@ -103,8 +103,7 @@ Controller function that handles adding a new Koha::Patron object > =cut > > sub add { >- my $c = shift->openapi->valid_input or return; >- my $current_user = $c->stash('koha.user'); >+ my $c = shift->openapi->valid_input or return; > > return try { > >@@ -169,7 +168,7 @@ sub add { > $c->res->headers->location($c->req->url->to_string . '/' . $patron->borrowernumber); > return $c->render( > status => 201, >- openapi => $patron->to_api( { user => $current_user } ) >+ openapi => $c->objects->to_api($patron), > ); > } > ); >@@ -261,8 +260,7 @@ Controller function that handles updating a Koha::Patron object > =cut > > sub update { >- my $c = shift->openapi->valid_input or return; >- my $current_user = $c->stash('koha.user'); >+ my $c = shift->openapi->valid_input or return; > > my $patron = Koha::Patrons->find( $c->param('patron_id') ); > >@@ -311,7 +309,7 @@ sub update { > $patron->discard_changes; > return $c->render( > status => 200, >- openapi => $patron->to_api( { user => $current_user } ) >+ openapi => $c->objects->to_api($patron), > ); > } > catch { >-- >2.44.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 36483
:
164264
|
164266
|
164267
|
164293
|
164294
|
164803
|
164804