From 9aac06cb0fc1024efdc3bd5651c299fdb64616e3 Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Tue, 27 Mar 2018 19:31:36 +0000 Subject: [PATCH] Bug 19945: Follow up optimization and test correction The double call to CanItemBeReserved was pointless in the C4/Reserves.pm HoldItem, as CanBookBeReserved calls CanItemBeReserved and even returns that code. Additionally, the tests failed, because there were 5 tests not 4. TEST PLAN ---------- prove t/db_dependent/ILSDI_Services.t run koha qa test tools Signed-off-by: Mark Tompsett --- C4/ILSDI/Services.pm | 3 +-- t/db_dependent/ILSDI_Services.t | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/C4/ILSDI/Services.pm b/C4/ILSDI/Services.pm index e970440..318341f 100644 --- a/C4/ILSDI/Services.pm +++ b/C4/ILSDI/Services.pm @@ -738,9 +738,8 @@ sub HoldItem { return { code => 'RecordNotFound' } if $$item{biblionumber} ne $biblio->biblionumber; # Check for item disponibility - my $canitembereserved = C4::Reserves::CanItemBeReserved( $borrowernumber, $itemnumber ); + # CanItemBeReserved codes are passed back too. my $canbookbereserved = C4::Reserves::CanBookBeReserved( $borrowernumber, $biblionumber ); - return { code => $canitembereserved } unless $canitembereserved eq 'OK'; return { code => $canbookbereserved } unless $canbookbereserved eq 'OK'; # Pickup branch management diff --git a/t/db_dependent/ILSDI_Services.t b/t/db_dependent/ILSDI_Services.t index 0b27bd0..9d8a737 100644 --- a/t/db_dependent/ILSDI_Services.t +++ b/t/db_dependent/ILSDI_Services.t @@ -19,7 +19,7 @@ use Modern::Perl; use CGI qw ( -utf8 ); -use Test::More tests => 4; +use Test::More tests => 5; use Test::MockModule; use t::lib::Mocks; use t::lib::TestBuilder; -- 2.1.4