Bugzilla – Attachment 116112 Details for
Bug 27330
Wrong return status when no enrollments in club holds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27330: (follow-up) Cleanup missed on bug 23843
Bug-27330-follow-up-Cleanup-missed-on-bug-23843.patch (text/plain), 3.88 KB, created by
Katrin Fischer
on 2021-01-31 14:06:53 UTC
(
hide
)
Description:
Bug 27330: (follow-up) Cleanup missed on bug 23843
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2021-01-31 14:06:53 UTC
Size:
3.88 KB
patch
obsolete
>From dc3087ddef42eef4782278956138892d1bce9f75 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 4 Jan 2021 11:29:38 -0300 >Subject: [PATCH] Bug 27330: (follow-up) Cleanup missed on bug 23843 > >This patch makes some cleanup missed on bug 23843. The catch condition >on the controller was copied and pasted from other controller and should >be avoided unless there's a known case that needs special handling. >Otherwise it will be catched by the $c->unhandled_exception call. > >All the old mappings were inadvertedly kept in the controller as well as >the (unused) _to_api method. > >The base class is also cleaned from unnecessary mappings. Only mapped >things need to be added. > >To test: >1. Apply this patch >2. Run: > $ kshell > k$ prove t/db_dependent/api/v1/clubs_holds.t \ > t/db_dependent/Koha/Club/Hold.t >=> SUCCESS: Tests pass! >3. Sign off :-D > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > Koha/Club/Hold.pm | 5 +--- > Koha/REST/V1/Clubs/Holds.pm | 65 +++++++++------------------------------------ > 2 files changed, 13 insertions(+), 57 deletions(-) > >diff --git a/Koha/Club/Hold.pm b/Koha/Club/Hold.pm >index aaf61ac901..378cd027f7 100644 >--- a/Koha/Club/Hold.pm >+++ b/Koha/Club/Hold.pm >@@ -161,10 +161,7 @@ on the API. > > sub to_api_mapping { > return { >- id => 'club_hold_id', >- club_id => 'club_id', >- biblio_id => 'biblio_id', >- item_id => 'item_id' >+ id => 'club_hold_id' > }; > } > >diff --git a/Koha/REST/V1/Clubs/Holds.pm b/Koha/REST/V1/Clubs/Holds.pm >index 9a4aaa052a..67b7fdbbdc 100644 >--- a/Koha/REST/V1/Clubs/Holds.pm >+++ b/Koha/REST/V1/Clubs/Holds.pm >@@ -110,16 +110,18 @@ sub add { > $expiration_date = output_pref( dt_from_string( $expiration_date, 'rfc3339' ) ); > } > >- my $club_hold = Koha::Club::Hold::add({ >- club_id => $club_id, >- biblio_id => $biblio->biblionumber, >- item_id => $item_id, >- pickup_library_id => $pickup_library_id, >- expiration_date => $expiration_date, >- notes => $notes, >- item_type => $item_type, >- default_patron_home => $default_patron_home >- }); >+ my $club_hold = Koha::Club::Hold::add( >+ { >+ club_id => $club_id, >+ biblio_id => $biblio->biblionumber, >+ item_id => $item_id, >+ pickup_library_id => $pickup_library_id, >+ expiration_date => $expiration_date, >+ notes => $notes, >+ item_type => $item_type, >+ default_patron_home => $default_patron_home >+ } >+ ); > > return $c->render( > status => 201, >@@ -140,47 +142,4 @@ sub add { > }; > } > >-=head3 _to_api >- >-Helper function that maps unblessed Koha::Club::Hold objects into REST api >-attribute names. >- >-=cut >- >-sub _to_api { >- my $club_hold = shift; >- >- # Rename attributes >- foreach my $column ( keys %{ $Koha::REST::V1::Clubs::Holds::to_api_mapping } ) { >- my $mapped_column = $Koha::REST::V1::Clubs::Holds::to_api_mapping->{$column}; >- if ( exists $club_hold->{ $column } >- && defined $mapped_column ) >- { >- # key != undef >- $club_hold->{ $mapped_column } = delete $club_hold->{ $column }; >- } >- elsif ( exists $club_hold->{ $column } >- && !defined $mapped_column ) >- { >- # key == undef >- delete $club_hold->{ $column }; >- } >- } >- >- # Calculate the 'restricted' field >- return $club_hold; >-} >- >-=head3 $to_api_mapping >- >-=cut >- >-our $to_api_mapping = { >- id => 'club_hold_id', >- club_id => 'club_id', >- biblio_id => 'biblio_id', >- item_id => 'item_id' >-}; >- >- > 1; >-- >2.11.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 27330
:
114798
|
114799
|
114800
|
115863
|
115864
|
115865
|
115866
|
115867
|
115968
|
115969
|
115970
|
115971
|
115972
|
116109
|
116110
|
116111
| 116112 |
116113