Bugzilla – Attachment 68786 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 - [OPAC] allow to holds waiting items
Bug-4319---OPAC-allow-to-holds-waiting-items.patch (text/plain), 5.47 KB, created by
Charles Farmer
on 2017-10-27 18:40:38 UTC
(
hide
)
Description:
Bug 4319 - [OPAC] allow to holds waiting items
Filename:
MIME Type:
Creator:
Charles Farmer
Created:
2017-10-27 18:40:38 UTC
Size:
5.47 KB
patch
obsolete
>From 7dbe6d64eddfad0e6a4bc83cc43ce8eae572c2d7 Mon Sep 17 00:00:00 2001 >From: Alex Arnaud <alex.arnaud@biblibre.com> >Date: Tue, 3 Oct 2017 14:50:36 +0000 >Subject: [PATCH] Bug 4319 - [OPAC] allow to holds waiting items > >Test plan: > > - Checkout an item > - Place hold on this item, > - Return the item > - Make sure the hold is waiting (found W) and AllowOnShelfHolds is > not to 'Allow' > - Check that the button "Place hold" appears in opac detail page of > the biblio > > - do the samewith items/reserves in transit > >Changes on C4::Reserves::IsAvailableForItemLevelRequest > >Make sure this tests pass: > - t/db_dependent/Reserves.t > - t/db_dependent/Holds/DisallowHoldIfItemsAvailable.t > >Signed-off-by: Charles Farmer <charles.farmer@inLibro.com> >--- > C4/Reserves.pm | 12 +++++- > .../bootstrap/en/includes/opac-detail-sidebar.inc | 2 +- > opac/opac-detail.pl | 19 ++++++++- > .../Holds/DisallowHoldIfItemsAvailable.t | 49 +++++++++++++++++++++- > 4 files changed, 77 insertions(+), 5 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 78f5ca3..72cd05f 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, >@@ -1174,7 +1175,16 @@ 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']})->count ) { >+ return 1; >+ } >+ >+ return 0; > } > > =head2 OnShelfHoldsAllowed >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc >index 5e96b0f..a94180c 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc >@@ -3,7 +3,7 @@ > [% UNLESS ( norequests ) %] > [% IF Koha.Preference( 'opacuserlogin' ) == 1 %] > [% IF Koha.Preference( 'RequestOnOpac' ) == 1 %] >- [% IF ( AllowOnShelfHolds OR ItemsIssued ) %] >+ [% IF ( AllowOnShelfHolds OR ItemsIssued OR ItemsWaitingOrInTransit ) %] > <li><a class="reserve" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% biblionumber | html %]">Place hold</a></li> > [% END %] > [% END %] >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index e68d813..6cc3ea6 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -459,9 +459,24 @@ if ($session->param('busc')) { > } > } > >+my $itemsWaitingOrInTransit = Koha::Holds->search( >+ { >+ biblionumber => $biblionumber, >+ found => ['W', 'T'] >+ })->count(); > >-$template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) ); >-$template->param('OPACShowCheckoutName' => C4::Context->preference("OPACShowCheckoutName") ); >+unless ($itemsWaitingOrInTransit) { >+ foreach my $item ( Koha::Items->search(biblionumber => $biblionumber) ) { >+ $itemsWaitingOrInTransit = 1 if $item->get_transfer; >+ } >+} >+ >+$template->param( >+ ItemsIssued => CountItemsIssued( $biblionumber ), >+ ItemsWaitingOrInTransit => $itemsWaitingOrInTransit, >+ OPACShowCheckoutName => C4::Context->preference("OPACShowCheckoutName"), >+ OPACShowBarcode => C4::Context->preference("OPACShowBarcode") >+); > > # adding items linked via host biblios > >diff --git a/t/db_dependent/Holds/DisallowHoldIfItemsAvailable.t b/t/db_dependent/Holds/DisallowHoldIfItemsAvailable.t >index ec76403..60b323b 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 => 6; > > use t::lib::TestBuilder; > >@@ -114,5 +114,52 @@ 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); >+is( $is, 1, "Item can be held, items in transit are not available" ); >+ >+Koha::Holds->find($hold->{reserve_id})->found('F')->store; >+ >+$is = IsAvailableForItemLevelRequest( $item3, $borrower1); >+is( $is, 0, "Item is neither waiting nor in transit." ); >+ > # 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