Bugzilla – Attachment 86906 Details for
Bug 22562
Add option ItemHoldingLibrary to ReservesControlBranch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22562: Add option ItemHoldingLibrary to ReservesControlBranch
Bug-22562-Add-option-ItemHoldingLibrary-to-Reserve.patch (text/plain), 4.60 KB, created by
Julian Maurice
on 2019-03-22 12:34:14 UTC
(
hide
)
Description:
Bug 22562: Add option ItemHoldingLibrary to ReservesControlBranch
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2019-03-22 12:34:14 UTC
Size:
4.60 KB
patch
obsolete
>From 12abc36ef7c5965dc29e1b182a189a0ddc5a8528 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Fri, 22 Mar 2019 11:42:28 +0100 >Subject: [PATCH] Bug 22562: Add option ItemHoldingLibrary to > ReservesControlBranch > >Test plan: >1. Apply patch >2. Run updatedatabase >3. Set syspref ReservesControlBranch to "item's holding library" >4. Create biblios, items, patrons on different libraries and define >circulation (hold) rules for them >5. Verify that these rules are taken into account and that they use the >holding library >6. Verify that the behaviour for other values of ReservesControlBranch >still work as expected. >--- > C4/Reserves.pm | 6 ++++++ > installer/data/mysql/atomicupdate/bug_22562.perl | 11 +++++++++++ > .../en/modules/admin/preferences/circulation.pref | 1 + > t/db_dependent/Reserves.t | 9 ++++++++- > 4 files changed, 26 insertions(+), 1 deletion(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_22562.perl > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 3617549582..cb36d18e17 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -357,6 +357,10 @@ sub CanItemBeReserved { > $branchfield = "items.homebranch"; > $branchcode = $item->homebranch; > } >+ elsif ( $controlbranch eq "ItemHoldingLibrary" ) { >+ $branchfield = "items.holdingbranch"; >+ $branchcode = $item->{holdingbranch}; >+ } > elsif ( $controlbranch eq "PatronLibrary" ) { > $branchfield = "borrowers.branchcode"; > $branchcode = $borrower->{branchcode}; >@@ -2019,6 +2023,7 @@ sub GetReservesControlBranch { > > my $branchcode = > ( $reserves_control eq 'ItemHomeLibrary' ) ? $item->{'homebranch'} >+ : ( $reserves_control eq 'ItemHoldingLibrary' ) ? $item->{'holdingbranch'} > : ( $reserves_control eq 'PatronLibrary' ) ? $borrower->{'branchcode'} > : undef; > >@@ -2123,6 +2128,7 @@ sub GetMaxPatronHoldsForRecord { > my $itemtype = $item->effective_itemtype(); > > $branchcode = $item->homebranch if ( $controlbranch eq "ItemHomeLibrary" ); >+ $branchcode = $item->holdingbranch if ( $controlbranch eq "ItemHoldingLibrary" ); > > my $rule = GetHoldRule( $categorycode, $itemtype, $branchcode ); > my $holds_per_record = $rule ? $rule->{holds_per_record} : 0; >diff --git a/installer/data/mysql/atomicupdate/bug_22562.perl b/installer/data/mysql/atomicupdate/bug_22562.perl >new file mode 100644 >index 0000000000..5ec73361ef >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_22562.perl >@@ -0,0 +1,11 @@ >+$DBversion = 'XXX'; >+if( CheckVersion( $DBversion ) ) { >+ $dbh->do(q{ >+ UPDATE systempreferences >+ SET options = 'ItemHomeLibrary|ItemHoldingLibrary|PatronLibrary' >+ WHERE variable = 'ReservesControlBranch' >+ }); >+ >+ SetVersion( $DBversion ); >+ print "Upgrade to $DBversion done (Bug 22562 - Add ItemHoldingLibrary to ReservesControlBranch)\n"; >+} >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >index 9720430bf3..13277d3957 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >@@ -611,6 +611,7 @@ Circulation: > - pref: ReservesControlBranch > choices: > ItemHomeLibrary: "item's home library" >+ ItemHoldingLibrary: "item's holding library" > PatronLibrary: "patron's home library" > - to see if the patron can place a hold on the item. > - >diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t >index 9b526258a7..040c0bf262 100755 >--- a/t/db_dependent/Reserves.t >+++ b/t/db_dependent/Reserves.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 59; >+use Test::More tests => 60; > use Test::MockModule; > use Test::Warn; > >@@ -147,6 +147,13 @@ ok( > { branchcode => 'PatronHomeLib' } > ), "GetReservesControlBranch returns item home branch when set to ItemHomeLibrary" > ); >+t::lib::Mocks::mock_preference( 'ReservesControlBranch', 'ItemHoldingLibrary' ); >+ok( >+ 'ItemHoldingLib' eq GetReservesControlBranch( >+ { holdingbranch => 'ItemHoldingLib' }, >+ { branchcode => 'PatronHomeLib' } >+ ), "GetReservesControlBranch returns item holding branch when set to ItemHoldingLibrary" >+); > t::lib::Mocks::mock_preference( 'ReservesControlBranch', 'PatronLibrary' ); > ok( > 'PatronHomeLib' eq GetReservesControlBranch( >-- >2.20.1
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 22562
:
86906
|
100273
|
100274
|
120617
|
166965