Bugzilla – Attachment 117687 Details for
Bug 27855
Allow embedding extended_attributes on /patrons routes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27855: Make GET /patrons/:patron_id use objects.find
Bug-27855-Make-GET-patronspatronid-use-objectsfind.patch (text/plain), 1.62 KB, created by
Martin Renvoize (ashimema)
on 2021-03-04 11:41:43 UTC
(
hide
)
Description:
Bug 27855: Make GET /patrons/:patron_id use objects.find
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-03-04 11:41:43 UTC
Size:
1.62 KB
patch
obsolete
>From b10d0ed4caec437876f962cb37ba8357d9665766 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 4 Mar 2021 06:43:01 -0300 >Subject: [PATCH] Bug 27855: Make GET /patrons/:patron_id use objects.find > >This patch makes the route for fetching a patron use the objects.find >helper instead of a plain Koha::Patrons->find. This gives the controller >embedding superpowers. > >To test, we just need to check nothing broke: >1. Apply this patch >2. Run: > $ kshell > k$ prove t/db_dependent/api/v1/patrons.t >=> SUCCESS: Tests pass! >3. Sign off :-D > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/REST/V1/Patrons.pm | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > >diff --git a/Koha/REST/V1/Patrons.pm b/Koha/REST/V1/Patrons.pm >index f82af2c8f9..8c63705474 100644 >--- a/Koha/REST/V1/Patrons.pm >+++ b/Koha/REST/V1/Patrons.pm >@@ -73,13 +73,19 @@ sub get { > > return try { > my $patron_id = $c->validation->param('patron_id'); >- my $patron = Koha::Patrons->find($patron_id); >+ my $patron = $c->objects->find( Koha::Patrons->new, $patron_id ); > > unless ($patron) { >- return $c->render( status => 404, openapi => { error => "Patron not found." } ); >+ return $c->render( >+ status => 404, >+ openapi => { error => "Patron not found." } >+ ); > } > >- return $c->render( status => 200, openapi => $patron->to_api ); >+ return $c->render( >+ status => 200, >+ openapi => $patron >+ ); > } > catch { > $c->unhandled_exception($_); >-- >2.20.1
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 27855
:
117660
|
117661
|
117662
|
117663
|
117681
|
117682
|
117683
|
117684
|
117685
|
117686
|
117687
|
117688
|
117689
|
117690
|
117691
|
117692
|
117693
|
117694
|
117695