Bugzilla – Attachment 68194 Details for
Bug 4319
waiting and in transit items cannot be reserved
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 4319 followup - [OPAC] allow to holds items in transit
Bug-4319-followup---OPAC-allow-to-holds-items-in-t.patch (text/plain), 4.32 KB, created by
Alex Arnaud
on 2017-10-17 07:07:37 UTC
(
hide
)
Description:
Bug 4319 followup - [OPAC] allow to holds items in transit
Filename:
MIME Type:
Creator:
Alex Arnaud
Created:
2017-10-17 07:07:37 UTC
Size:
4.32 KB
patch
obsolete
>From ab95f6feb9b2db49878c820e09e6d4ce308ea6ba Mon Sep 17 00:00:00 2001 >From: Alex Arnaud <alex.arnaud@biblibre.com> >Date: Fri, 6 Oct 2017 13:00:33 +0000 >Subject: [PATCH] Bug 4319 followup - [OPAC] allow to holds items in transit > >Changes on C4::Reserves::IsAvailableForItemLevelRequest > >Make sure this tests pass: > - t/db_dependent/Reserves.t > - t/db_dependent/Holds/DisallowHoldIfItemsAvailable.t >--- > C4/Reserves.pm | 15 +++++++- > opac/opac-detail.pl | 12 +++++- > .../Holds/DisallowHoldIfItemsAvailable.t | 44 +++++++++++++++++++++- > 3 files changed, 68 insertions(+), 3 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 78f5ca3..cf5c3df 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -1115,6 +1115,7 @@ item-level hold request. An item is available if > * it is not lost AND > * it is not damaged AND > * it is not withdrawn AND >+* a waiting or in transit reserve is placed on > * does not have a not for loan value > 0 > > Need to check the issuingrules onshelfholds column, >@@ -1131,6 +1132,7 @@ and canreservefromotherbranches. > sub IsAvailableForItemLevelRequest { > my $item = shift; > my $borrower = shift; >+ my $flag = shift; > > my $dbh = C4::Context->dbh; > # must check the notforloan setting of the itemtype >@@ -1174,7 +1176,18 @@ sub IsAvailableForItemLevelRequest { > return $any_available ? 0 : 1; > } > >- return $item->{onloan} || GetReserveStatus($item->{itemnumber}) eq "Waiting"; >+ if ($item->{onloan}) { >+ return 1; >+ } >+ >+ if (Koha::Holds->search({itemnumber => $item->{itemnumber}, >+ found => ['W', 'T']}, >+ {order_by => {-asc => 'priority'}})) { >+ return 1; >+ } >+ >+ return 0; >+ return GetReserveStatus($item->{itemnumber}) eq "Waiting"; > } > > =head2 OnShelfHoldsAllowed >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index d371f44..ab5de4c 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -459,9 +459,19 @@ if ($session->param('busc')) { > } > } > >+my $itemsWaitingOrInTransit = Koha::Holds->search( >+ { >+ biblionumber => $biblionumber, >+ found => ['W', 'T'] >+ })->count(); >+ >+foreach my $item ( Koha::Items->search(biblionumber => $biblionumber) ) { >+ $itemsWaitingOrInTransit = 1 if $item->get_transfer; >+} >+ > $template->param( > ItemsIssued => CountItemsIssued( $biblionumber ), >- ItemsWaitingOrInTransit => Koha::Holds->search({biblionumber => $biblionumber, found => ['W', 'T']})->count(), >+ ItemsWaitingOrInTransit => $itemsWaitingOrInTransit, > OPACShowCheckoutName => C4::Context->preference("OPACShowCheckoutName"), > OPACShowBarcode => C4::Context->preference("OPACShowBarcode") > ); >diff --git a/t/db_dependent/Holds/DisallowHoldIfItemsAvailable.t b/t/db_dependent/Holds/DisallowHoldIfItemsAvailable.t >index ec76403..e8791de 100755 >--- a/t/db_dependent/Holds/DisallowHoldIfItemsAvailable.t >+++ b/t/db_dependent/Holds/DisallowHoldIfItemsAvailable.t >@@ -7,7 +7,7 @@ use C4::Items; > use C4::Circulation; > use Koha::IssuingRule; > >-use Test::More tests => 4; >+use Test::More tests => 5; > > use t::lib::TestBuilder; > >@@ -114,5 +114,47 @@ AddIssue( $borrower2, $item2->{barcode} ); > $is = IsAvailableForItemLevelRequest( $item1, $borrower1); > is( $is, 1, "Item can be held, no items available" ); > >+my $biblio = $builder->build({ >+ source => 'Biblio', >+}); >+ >+my $item3 = $builder->build({ >+ source => 'Item', >+ value => { >+ biblionumber => $biblio->{biblionumber}, >+ itemlost => 0, >+ notforloan => 0, >+ withdrawn => 0, >+ damaged => 0, >+ onloan => 0 >+ } >+}); >+ >+my $hold = $builder->build({ >+ source => 'Reserve', >+ value =>{ >+ itemnumber => $item3->{itemnumber}, >+ found => 'T' >+ } >+}); >+ >+$dbh->do("DELETE FROM issuingrules"); >+$rule = Koha::IssuingRule->new( >+ { >+ categorycode => '*', >+ itemtype => '*', >+ branchcode => '*', >+ maxissueqty => 99, >+ issuelength => 7, >+ lengthunit => 8, >+ reservesallowed => 99, >+ onshelfholds => 0, >+ } >+); >+$rule->store(); >+ >+$is = IsAvailableForItemLevelRequest( $item3, $borrower1, 'ici'); >+is( $is, 1, "Item can be held, items in transit are not available" ); >+ > # Cleanup > $schema->storage->txn_rollback; >-- >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 4319
:
3740
|
4099
|
4110
|
4327
|
4329
|
16965
|
67558
|
67584
|
67637
|
67704
|
67970
|
68194
|
68197
|
68198
|
68199
|
68531
|
68782
|
68786
|
69724
|
69725
|
69728
|
69815
|
69816
|
69817
|
70457