Bugzilla – Attachment 77896 Details for
Bug 7614
Use branch transfer limits for determining available opac holds pickup locations
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7614: Check transfer limit in CanBookBeReserved and CanItemBeReserved
Bug-7614-Check-transfer-limit-in-CanBookBeReserved.patch (text/plain), 3.46 KB, created by
Kyle M Hall (khall)
on 2018-08-16 11:31:30 UTC
(
hide
)
Description:
Bug 7614: Check transfer limit in CanBookBeReserved and CanItemBeReserved
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2018-08-16 11:31:30 UTC
Size:
3.46 KB
patch
obsolete
>From fcdd8b375f227a35c6ef9f81d5e0a143b5b700d5 Mon Sep 17 00:00:00 2001 >From: Lari Taskula <lari.taskula@jns.fi> >Date: Tue, 7 Feb 2017 17:51:18 +0200 >Subject: [PATCH] Bug 7614: Check transfer limit in CanBookBeReserved and > CanItemBeReserved > >This patch adds $branchcode_to parameter to CanBookBeReserved and >CanItemBeReserved. It represents the pickup location for the hold. This patch >checks if the library is configured to be a pickup location (see Bug 7534), and >also if the item can be transferred into the given library (see Bug 18072). > >To test: >1. prove t/db_dependent/Holds.t >--- > C4/Reserves.pm | 5 +++++ > t/db_dependent/Holds.t | 14 +++++++++++--- > 2 files changed, 16 insertions(+), 3 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 13c142c411..e3c9a74c5d 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -303,6 +303,7 @@ sub CanBookBeReserved{ > notReservable, if holds on this item are not allowed > libraryNotFound if given branchcode is not an existing library > libraryNotPickupLocation if given branchcode is not configured to be a pickup location >+ cannotBeTransferred if branch transfer limit applies on given item and branchcode > > =cut > >@@ -441,12 +442,16 @@ sub CanItemBeReserved { > my $destination = Koha::Libraries->find({ > branchcode => $pickup_branchcode, > }); >+ > unless ($destination) { > return 'libraryNotFound'; > } > unless ($destination->pickup_location) { > return 'libraryNotPickupLocation'; > } >+ unless ($item->can_be_transferred({ to => $destination->branchcode })) { >+ return 'cannotBeTransferred'; >+ } > } > > return 'OK'; >diff --git a/t/db_dependent/Holds.t b/t/db_dependent/Holds.t >index a83f98b84e..5969766d32 100755 >--- a/t/db_dependent/Holds.t >+++ b/t/db_dependent/Holds.t >@@ -19,6 +19,7 @@ use Koha::Database; > use Koha::DateUtils qw( dt_from_string output_pref ); > use Koha::Biblios; > use Koha::Holds; >+use Koha::Item::Transfer::Limits; > use Koha::Items; > use Koha::Libraries; > >@@ -422,20 +423,27 @@ subtest 'Pickup location availability tests' => sub { > my $item = Koha::Items->find($itemnumber); > my $branch_to = $builder->build({ source => 'Branch' })->{ branchcode }; > my $library = Koha::Libraries->find($branch_to); >+ $library->pickup_location('1')->store; > my $patron = $builder->build({ source => 'Borrower' })->{ borrowernumber }; > > t::lib::Mocks::mock_preference('UseBranchTransferLimits', 1); > t::lib::Mocks::mock_preference('BranchTransferLimitsType', 'itemtype'); >- $library->pickup_location('1')->store; >+ >+ my $limit = Koha::Item::Transfer::Limit->new({ >+ fromBranch => $item->holdingbranch, >+ toBranch => $branch_to, >+ itemtype => $item->effective_itemtype, >+ })->store; > is(CanItemBeReserved($patron, $item->itemnumber, $branch_to), >- 'OK', 'Library is a pickup location'); >+ 'cannotBeTransferred', 'Item cannot be transferred'); >+ $limit->delete; > $library->pickup_location('0')->store; > is(CanItemBeReserved($patron, $item->itemnumber, $branch_to), > 'libraryNotPickupLocation', 'Library is not a pickup location'); > is(CanItemBeReserved($patron, $item->itemnumber, 'nonexistent'), > 'libraryNotFound', 'Cannot set unknown library as pickup location'); > }; >- >+my ( $bibnum, $title, $bibitemnum ); > # Helper method to set up a Biblio. > sub create_helper_biblio { > my $itemtype = shift; >-- >2.11.0
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 7614
:
60141
|
60142
|
60143
|
60144
|
60145
|
60785
|
60786
|
60787
|
60938
|
60946
|
70047
|
77895
|
77896
|
77897
|
77898
|
77899
|
77900
|
78020
|
84295
|
84296
|
84297
|
84298
|
84299
|
84300
|
84301
|
84302
|
84303
|
84304
|
84305
|
84306
|
84307
|
84308
|
84309
|
84310
|
84311