Bugzilla – Attachment 81754 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: Move counting of items in C4::Reserves::CanBookBeReserved
Bug-21738-Move-counting-of-items-in-C4ReservesCanB.patch (text/plain), 3.19 KB, created by
Alex Arnaud
on 2018-10-31 15:46:32 UTC
(
hide
)
Description:
Bug 21738: Move counting of items in C4::Reserves::CanBookBeReserved
Filename:
MIME Type:
Creator:
Alex Arnaud
Created:
2018-10-31 15:46:32 UTC
Size:
3.19 KB
patch
obsolete
>From eb87b4d8de23ba47d48e3155121b6e1ab34c8fa0 Mon Sep 17 00:00:00 2001 >From: Alex Arnaud <alex.arnaud@biblibre.com> >Date: Wed, 31 Oct 2018 16:36:59 +0100 >Subject: [PATCH] Bug 21738: Move counting of items in > C4::Reserves::CanBookBeReserved > >Test plan: > - Try holding a title without items via ILS-DI => error, > - try the same via UI => message is "Cannot place hold: this record > has no items attached." > - apply this patch, > - try to hold a title without items via ILS-DI => > "<code>NotHoldable</code>", > - try again via UI => message is still "<code>NotHoldable</code>" >--- > C4/Reserves.pm | 2 +- > reserve/request.pl | 10 ++++------ > t/db_dependent/Reserves/NoItems.t | 25 +++++++++++++++++++++++++ > 3 files changed, 30 insertions(+), 7 deletions(-) > create mode 100644 t/db_dependent/Reserves/NoItems.t > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 78e8f6a..44557e1 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -283,7 +283,7 @@ sub CanBookBeReserved{ > push (@itemnumbers, @hostitems); > } > >- my $canReserve; >+ my $canReserve = { status => 'NoItems' }; > 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 a1668a4..28bc47a 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -234,6 +234,10 @@ foreach my $biblionumber (@biblionumbers) { > $template->param( $canReserve->{status} => 1 ); > $biblioloopiter{ $canReserve->{status} } = 1; > } >+ elsif ( $canReserve->{status} eq 'NoItems' ) { >+ $template->param('noitems' => 1); >+ $biblioloopiter{noitems} = 1; >+ } > else { > $biblioloopiter{ $canReserve->{status} } = 1; > } >@@ -305,12 +309,6 @@ foreach my $biblionumber (@biblionumbers) { > > my $items = Koha::Items->search({ -or => { biblionumber => $biblionumber, itemnumber => { in => \@itemnumbers } } }); > >- unless ( $items->count ) { >- # FIXME Then why do we continue? >- $template->param('noitems' => 1); >- $biblioloopiter{noitems} = 1; >- } >- > ## Here we go backwards again to create hash of biblioitemnumber to itemnumbers, > ## when by definition all of the itemnumber have the same biblioitemnumber > my ( $iteminfos_of ); >diff --git a/t/db_dependent/Reserves/NoItems.t b/t/db_dependent/Reserves/NoItems.t >new file mode 100644 >index 0000000..37b9f5b >--- /dev/null >+++ b/t/db_dependent/Reserves/NoItems.t >@@ -0,0 +1,25 @@ >+#!/usr/bin/perl >+ >+use Modern::Perl; >+use Test::More tests => 1; >+ >+use C4::Reserves; >+ >+use t::lib::TestBuilder; >+ >+my $schema = Koha::Database->new->schema; >+$schema->storage->txn_begin; >+ >+$schema->storage->txn_rollback; >+ >+my $builder = t::lib::TestBuilder->new(); >+ >+my $biblio = $builder->build({ >+ source => 'Biblio', >+}); >+ >+my $patron = $builder->build({ >+ source => 'Borrower', >+}); >+ >+is( C4::Reserves::CanBookBeReserved($patron->{borrowernumber}, $biblio->{biblionumber})->{status} , 'NoItems', "Reserving a Biblio without items fail." ); >-- >2.7.4
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