Bugzilla – Attachment 104015 Details for
Bug 25297
Consistent return value in K::A::Order->current_item_level_holds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25297: Consistent return value in K::A::Order->current_item_level_holds
Bug-25297-Consistent-return-value-in-KAOrder-curre.patch (text/plain), 2.17 KB, created by
Jonathan Druart
on 2020-04-30 10:51:09 UTC
(
hide
)
Description:
Bug 25297: Consistent return value in K::A::Order->current_item_level_holds
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-04-30 10:51:09 UTC
Size:
2.17 KB
patch
obsolete
>From 1351be427776e9e8aedaacdf5a4c7bc8fdc64781 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 27 Apr 2020 18:55:59 -0300 >Subject: [PATCH] Bug 25297: Consistent return value in > K::A::Order->current_item_level_holds >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >This patch makes the return values for 'current_item_level_holds' >consistent: they will always be a Koha::Holds iterator. > >To test: >1. Apply the regression tests >2. Run: > $ kshell > k$ prove t/db_dependent/Koha/Acquisition/Order.t >=> FAIL: It doesn't work as expected, cannot call ->count on undef, etc >3. Apply this patch >4. Repeat 2. >=> SUCCESS: Tests pass! >5. Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: Frédéric Demians <f.demians@tamil.fr> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > Koha/Acquisition/Order.pm | 13 ++++++------- > 1 file changed, 6 insertions(+), 7 deletions(-) > >diff --git a/Koha/Acquisition/Order.pm b/Koha/Acquisition/Order.pm >index 0d59f5989d..5135a3372d 100644 >--- a/Koha/Acquisition/Order.pm >+++ b/Koha/Acquisition/Order.pm >@@ -25,6 +25,7 @@ use Koha::Acquisition::Invoices; > use Koha::Database; > use Koha::DateUtils qw( dt_from_string output_pref ); > use Koha::Biblios; >+use Koha::Holds; > use Koha::Items; > use Koha::Subscriptions; > >@@ -182,9 +183,7 @@ sub subscription { > my $holds = $order->current_item_level_holds; > > Returns the current item-level holds associated to the order. It returns a I<Koha::Holds> >-resultset in scalar context or a list of I<Koha::Hold> objects in list context. >- >-It returns B<undef> if no I<biblio> or no I<items> are linked to the order. >+resultset. > > =cut > >@@ -193,11 +192,11 @@ sub current_item_level_holds { > > my $items_rs = $self->_result->aqorders_items; > my @item_numbers = $items_rs->get_column('itemnumber')->all; >+ my $biblio = $self->biblio; > >- return unless @item_numbers; >- >- my $biblio = $self->biblio; >- return unless $biblio; >+ unless ( $biblio and @item_numbers ) { >+ return Koha::Holds->new->empty; >+ } > > return $biblio->current_holds->search( > { >-- >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 25297
:
103813
|
103814
|
104008
|
104009
|
104014
| 104015