Bugzilla – Attachment 164804 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), 2.10 KB, created by
Marcel de Rooy
on 2024-04-12 08:39:44 UTC
(
hide
)
Description:
Bug 36483: Patrons.pm use case
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2024-04-12 08:39:44 UTC
Size:
2.10 KB
patch
obsolete
>From b4060026dbacd19ba0e990653f673e7400b307d8 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 >Content-Type: text/plain; charset=utf-8 > >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> >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > 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 24aba7fa9f..0c37a4aeb6 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.30.2
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