Bugzilla – Attachment 100274 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.77 KB, created by
Devinim
on 2020-03-06 14:36:06 UTC
(
hide
)
Description:
Bug 22562: Add option ItemHoldingLibrary to ReservesControlBranch
Filename:
MIME Type:
Creator:
Devinim
Created:
2020-03-06 14:36:06 UTC
Size:
4.77 KB
patch
obsolete
>From 187ec446651efee5f46bf5b89d70bd513feaf64a 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 >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >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. > >Signed-off-by: Nazlı Ãetin <nazli@devinim.com.tr> >--- > C4/Reserves.pm | 6 ++++++ > installer/data/mysql/atomicupdate/bug_22562.perl | 11 +++++++++++ > .../prog/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 00d921d77e..554876ba1d 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -392,6 +392,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}; >@@ -2098,6 +2102,7 @@ sub GetReservesControlBranch { > > my $branchcode = > ( $reserves_control eq 'ItemHomeLibrary' ) ? $item->{'homebranch'} >+ : ( $reserves_control eq 'ItemHoldingLibrary' ) ? $item->{'holdingbranch'} > : ( $reserves_control eq 'PatronLibrary' ) ? $borrower->{'branchcode'} > : undef; > >@@ -2202,6 +2207,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 1683d9f034..2937bdb46a 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 >@@ -642,6 +642,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 ef47e26473..36a9c4e1be 100755 >--- a/t/db_dependent/Reserves.t >+++ b/t/db_dependent/Reserves.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 62; >+use Test::More tests => 63; > 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.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 22562
:
86906
|
100273
|
100274
|
120617
|
166965