Bugzilla – Attachment 83753 Details for
Bug 21738
[ILS-DI] Error placing a hold on a title without item
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21738: make call of CanBookBeReserved more safe
Bug-21738-make-call-of-CanBookBeReserved-more-safe.patch (text/plain), 2.47 KB, created by
Kyle M Hall (khall)
on 2019-01-09 15:15:45 UTC
(
hide
)
Description:
Bug 21738: make call of CanBookBeReserved more safe
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2019-01-09 15:15:45 UTC
Size:
2.47 KB
patch
obsolete
>From c3ff56f9177478e82d5d8d3327d2c84f99e4978e Mon Sep 17 00:00:00 2001 >From: Alex Arnaud <alex.arnaud@biblibre.com> >Date: Fri, 4 Jan 2019 16:33:39 +0100 >Subject: [PATCH] Bug 21738: make call of CanBookBeReserved more safe > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/Reserves.pm | 2 +- > reserve/request.pl | 1 - > t/db_dependent/Reserves.t | 8 +++++++- > 3 files changed, 8 insertions(+), 3 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 9e85854012..a4c2b282b5 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -284,7 +284,7 @@ sub CanBookBeReserved{ > push (@itemnumbers, @hostitems); > } > >- my $canReserve; >+ my $canReserve = { status => '' }; > foreach my $itemnumber (@itemnumbers) { > $canReserve = CanItemBeReserved( $borrowernumber, $itemnumber, $pickup_branchcode ); > return { status => 'OK' } if $canReserve->{status} eq 'OK'; >diff --git a/reserve/request.pl b/reserve/request.pl >index 2534fe2580..4094510edd 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -222,7 +222,6 @@ foreach my $biblionumber (@biblionumbers) { > if ( $patron ) { > { # CanBookBeReserved > my $canReserve = CanBookBeReserved( $patron->borrowernumber, $biblionumber ); >- $canReserve->{status} //= ''; > if ( $canReserve->{status} eq 'OK' ) { > > #All is OK and we can continue >diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t >index 25bc0eafc8..83319b565e 100755 >--- a/t/db_dependent/Reserves.t >+++ b/t/db_dependent/Reserves.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 58; >+use Test::More tests => 59; > use Test::MockModule; > use Test::Warn; > >@@ -105,6 +105,10 @@ my ( $item_bibnum, $item_bibitemnum, $itemnumber ) = AddItem( > $bibnum > ); > >+my $biblio_with_no_item = $builder->build({ >+ source => 'Biblio' >+}); >+ > > # Modify item; setting barcode. > my $testbarcode = '97531'; >@@ -533,6 +537,8 @@ $borrower->{dateofbirth} = DateTime->now->add( years => -30 ); > Koha::Patrons->find( $borrowernumber )->set({ dateofbirth => $borrower->{dateofbirth} })->store; > > is( C4::Reserves::CanBookBeReserved($borrowernumber, $biblionumber)->{status} , 'OK', "Reserving a 'PEGI 16' Biblio by a 30 year old borrower succeeds"); >+ >+is( C4::Reserves::CanBookBeReserved($borrowernumber, $biblio_with_no_item->{biblionumber})->{status} , '', "Biblio with no item. Status is empty"); > #### > ####### EO Bug 13113 <<< > #### >-- >2.17.2 (Apple Git-113)
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 21738
:
81754
|
82251
|
83637
|
83752
|
83753
|
84673
|
84674
|
84853