Bugzilla – Attachment 67704 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), 3.40 KB, created by
Alex Arnaud
on 2017-10-06 13:03:00 UTC
(
hide
)
Description:
Bug 4319 followup - [OPAC] allow to holds items in transit
Filename:
MIME Type:
Creator:
Alex Arnaud
Created:
2017-10-06 13:03:00 UTC
Size:
3.40 KB
patch
obsolete
>From 13ae42fca8677dff317470e1bdb864255552e83b 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 +++++++- > .../Holds/DisallowHoldIfItemsAvailable.t | 44 +++++++++++++++++++++- > 2 files changed, 57 insertions(+), 2 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index fbf03fb..ab07840 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -1119,6 +1119,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, >@@ -1135,6 +1136,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 >@@ -1178,7 +1180,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/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