Bugzilla – Attachment 91750 Details for
Bug 22284
Add ability to define groups of locations for hold pickup
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22284: (follow-up) fixes after 18936
Bug-22284-follow-up-fixes-after-18936.patch (text/plain), 45.48 KB, created by
Agustín Moyano
on 2019-07-23 17:18:55 UTC
(
hide
)
Description:
Bug 22284: (follow-up) fixes after 18936
Filename:
MIME Type:
Creator:
Agustín Moyano
Created:
2019-07-23 17:18:55 UTC
Size:
45.48 KB
patch
obsolete
>From fdb710fe2bb985697ad046c9f47389e5f91b6406 Mon Sep 17 00:00:00 2001 >From: Agustin Moyano <agustinmoyano@theke.io> >Date: Tue, 30 Apr 2019 04:56:19 +0000 >Subject: [PATCH] Bug 22284: (follow-up) fixes after 18936 > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > ...ft_local_hold_group_to_library_groups.perl | 7 +- > .../prog/en/modules/admin/smart-rules.tt | 6 +- > t/db_dependent/Holds.t | 269 +++++++++++------- > t/db_dependent/Koha/Biblios.t | 246 +++++++++++----- > t/db_dependent/Koha/Items.t | 246 +++++++++++----- > t/db_dependent/Koha/Libraries.t | 4 + > 6 files changed, 532 insertions(+), 246 deletions(-) > >diff --git a/installer/data/mysql/atomicupdate/bug_22284_add_ft_local_hold_group_to_library_groups.perl b/installer/data/mysql/atomicupdate/bug_22284_add_ft_local_hold_group_to_library_groups.perl >index fba0b32faf..d996afa356 100644 >--- a/installer/data/mysql/atomicupdate/bug_22284_add_ft_local_hold_group_to_library_groups.perl >+++ b/installer/data/mysql/atomicupdate/bug_22284_add_ft_local_hold_group_to_library_groups.perl >@@ -5,12 +5,7 @@ if( CheckVersion( $DBversion ) ) { > $dbh->do( "ALTER TABLE library_groups ADD COLUMN ft_local_hold_group tinyint(1) NOT NULL DEFAULT 0 AFTER ft_search_groups_staff" ); > } > >- $dbh->do("ALTER TABLE default_branch_circ_rules MODIFY hold_fulfillment_policy ENUM('any', 'holdgroup', 'homebranch', 'holdingbranch') NOT NULL DEFAULT 'any'"); >- $dbh->do("ALTER TABLE default_circ_rules MODIFY hold_fulfillment_policy ENUM('any', 'holdgroup', 'homebranch', 'holdingbranch') NOT NULL DEFAULT 'any'"); >- $dbh->do("ALTER TABLE default_branch_item_rules MODIFY hold_fulfillment_policy ENUM('any', 'holdgroup', 'homebranch', 'holdingbranch') NOT NULL DEFAULT 'any'"); >- $dbh->do("ALTER TABLE branch_item_rules MODIFY hold_fulfillment_policy ENUM('any', 'holdgroup', 'homebranch', 'holdingbranch') NOT NULL DEFAULT 'any'"); >- > # Always end with this (adjust the bug info) > SetVersion( $DBversion ); >- print "Upgrade to $DBversion done (Bug 22284 - Add ft_local_hold_group column to library_groups and alter hold_fulfillment_policy in rules tables)\n"; >+ print "Upgrade to $DBversion done (Bug 22284 - Add ft_local_hold_group column to library_groups)\n"; > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >index 3229a60015..2773b18256 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >@@ -437,7 +437,7 @@ > From any library > </option> > >- [% IF holdallowed == 3 %] >+ [% IF holdallowed == 3 %] > <option value="3" selected="selected"> > [% ELSE %] > <option value="3"> >@@ -480,7 +480,7 @@ > </option> > [% END %] > >- [% IF hold_fulfillment_policy == 'holdgroup' %] >+ [% IF hold_fulfillment_policy == 'holdgroup' %] > <option value="holdgroup" selected="selected"> > item's hold group > </option> >@@ -753,7 +753,7 @@ > <td> > [% IF holdallowed == 2 %] > <span>From any library</span> >- [% ELSIF holdallowed == 3 %] >+ [% ELSIF holdallowed == 3 %] > <span>From local hold group</span> > [% ELSIF holdallowed == 1 %] > <span>From home library</span> >diff --git a/t/db_dependent/Holds.t b/t/db_dependent/Holds.t >index 7a7de26561..2ecbdb4d9a 100755 >--- a/t/db_dependent/Holds.t >+++ b/t/db_dependent/Holds.t >@@ -245,17 +245,13 @@ my $foreign_biblio = $builder->build_sample_biblio({ itemtype => 'DUMMY' }); > my ($foreign_item_bibnum, $foreign_item_bibitemnum, $foreign_itemnumber) > = AddItem({ homebranch => $branch_2, holdingbranch => $branch_2 } , $foreign_biblio->biblionumber); > # Cleanup circulation rules >-$dbh->do('DELETE FROM issuingrules'); >-$dbh->do('DELETE FROM branch_item_rules'); >-$dbh->do('DELETE FROM default_branch_item_rules'); >-$dbh->do('DELETE FROM default_branch_circ_rules'); >-$dbh->do('DELETE FROM default_circ_rules'); >-$dbh->do( >- q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed, holds_per_record) >- VALUES (?, ?, ?, ?, ?)}, >- {}, >- '*', '*', '*', 25, 99 >-); >+$dbh->do('DELETE FROM circulation_rules'); >+# $dbh->do( >+# q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed, holds_per_record) >+# VALUES (?, ?, ?, ?, ?)}, >+# {}, >+# '*', '*', '*', 25, 99 >+# ); > $dbh->do( > q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed, holds_per_record) > VALUES (?, ?, ?, ?, ?)}, >@@ -571,10 +567,7 @@ subtest 'CanItemBeReserved / holds_per_day tests' => sub { > Koha::Holds->search->delete; > $dbh->do('DELETE FROM issues'); > $dbh->do('DELETE FROM issuingrules'); >- $dbh->do('DELETE FROM branch_item_rules'); >- $dbh->do('DELETE FROM default_branch_item_rules'); >- $dbh->do('DELETE FROM default_branch_circ_rules'); >- $dbh->do('DELETE FROM default_circ_rules'); >+ $dbh->do('DELETE FROM circulation_rules'); > Koha::Items->search->delete; > Koha::Biblios->search->delete; > >@@ -715,10 +708,7 @@ subtest 'CanItemBeReserved / branch_not_in_hold_group' => sub { > {}, > '*', '*', '*', 25 > ); >- $dbh->do('DELETE FROM branch_item_rules'); >- $dbh->do('DELETE FROM default_branch_circ_rules'); >- $dbh->do('DELETE FROM default_branch_item_rules'); >- $dbh->do('DELETE FROM default_circ_rules'); >+ $dbh->do('DELETE FROM circulation_rules'); > > Koha::Items->search->delete; > Koha::Biblios->search->delete; >@@ -772,11 +762,17 @@ subtest 'CanItemBeReserved / branch_not_in_hold_group' => sub { > ); > > # Insert default circ rule of holds allowed only from local hold group for all libraries >- $dbh->do( >- q{INSERT INTO default_circ_rules (holdallowed, hold_fulfillment_policy, returnbranch) >- VALUES (?,?,?)}, >- {}, >- 3, 'any', 'any' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 3, >+ hold_fulfillment_policy => 'any', >+ returnbranch => 'any' >+ } >+ } > ); > > # Test 2: Patron 1 can place hold >@@ -794,14 +790,20 @@ subtest 'CanItemBeReserved / branch_not_in_hold_group' => sub { > ); > > # Cleanup default_cirt_rules >- $dbh->do('DELETE FROM default_circ_rules'); >+ $dbh->do('DELETE FROM circulation_rules'); > > # Insert default circ rule to "any" for library 2 >- $dbh->do( >- q{INSERT INTO default_branch_circ_rules (branchcode, holdallowed, hold_fulfillment_policy, returnbranch) >- VALUES (?,?,?,?)}, >- {}, >- $library2->branchcode, 2, 'any', 'any' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => $library2->branchcode, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 2, >+ hold_fulfillment_policy => 'any', >+ returnbranch => 'any' >+ } >+ } > ); > > # Test 4: Patron 3 can place hold >@@ -812,11 +814,17 @@ subtest 'CanItemBeReserved / branch_not_in_hold_group' => sub { > ); > > # Update default circ rule to "hold group" for library 2 >- $dbh->do( >- q{UPDATE default_branch_circ_rules set holdallowed = ? >- WHERE branchcode = ?}, >- {}, >- 3, $library2->branchcode >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => $library2->branchcode, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 3, >+ hold_fulfillment_policy => 'any', >+ returnbranch => 'any' >+ } >+ } > ); > > # Test 5: Patron 3 cannot place hold >@@ -827,14 +835,20 @@ subtest 'CanItemBeReserved / branch_not_in_hold_group' => sub { > ); > > # Cleanup default_branch_cirt_rules >- $dbh->do('DELETE FROM default_branch_circ_rules'); >+ $dbh->do('DELETE FROM circulation_rules'); > > # Insert default item rule to "any" for itemtype 2 >- $dbh->do( >- q{INSERT INTO default_branch_item_rules (itemtype, holdallowed, hold_fulfillment_policy, returnbranch) >- VALUES (?,?,?,?)}, >- {}, >- $itemtype2->itemtype, 2, 'any', 'any' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => $itemtype2->itemtype, >+ categorycode => undef, >+ rules => { >+ holdallowed => 2, >+ hold_fulfillment_policy => 'any', >+ returnbranch => 'any' >+ } >+ } > ); > > # Test 6: Patron 3 can place hold >@@ -845,11 +859,17 @@ subtest 'CanItemBeReserved / branch_not_in_hold_group' => sub { > ); > > # Update default item rule to "hold group" for itemtype 2 >- $dbh->do( >- q{UPDATE default_branch_item_rules set holdallowed = ? >- WHERE itemtype = ?}, >- {}, >- 3, $itemtype2->itemtype >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => $itemtype2->itemtype, >+ categorycode => undef, >+ rules => { >+ holdallowed => 3, >+ hold_fulfillment_policy => 'any', >+ returnbranch => 'any' >+ } >+ } > ); > > # Test 7: Patron 3 cannot place hold >@@ -860,14 +880,20 @@ subtest 'CanItemBeReserved / branch_not_in_hold_group' => sub { > ); > > # Cleanup default_branch_item_rules >- $dbh->do('DELETE FROM default_branch_item_rules'); >+ $dbh->do('DELETE FROM circulation_rules'); > > # Insert branch item rule to "any" for itemtype 2 and library 2 >- $dbh->do( >- q{INSERT INTO branch_item_rules (branchcode, itemtype, holdallowed, hold_fulfillment_policy, returnbranch) >- VALUES (?,?,?,?,?)}, >- {}, >- $library2->branchcode, $itemtype2->itemtype, 2, 'any', 'any' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => $library2->branchcode, >+ itemtype => $itemtype2->itemtype, >+ categorycode => undef, >+ rules => { >+ holdallowed => 2, >+ hold_fulfillment_policy => 'any', >+ returnbranch => 'any' >+ } >+ } > ); > > # Test 8: Patron 3 can place hold >@@ -878,11 +904,17 @@ subtest 'CanItemBeReserved / branch_not_in_hold_group' => sub { > ); > > # Update branch item rule to "hold group" for itemtype 2 and library 2 >- $dbh->do( >- q{UPDATE branch_item_rules set holdallowed = ? >- WHERE branchcode = ? and itemtype = ?}, >- {}, >- 3, $library2->branchcode, $itemtype2->itemtype >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => $library2->branchcode, >+ itemtype => $itemtype2->itemtype, >+ categorycode => undef, >+ rules => { >+ holdallowed => 3, >+ hold_fulfillment_policy => 'any', >+ returnbranch => 'any' >+ } >+ } > ); > > # Test 9: Patron 3 cannot place hold >@@ -911,10 +943,7 @@ subtest 'CanItemBeReserved / pickup_not_in_hold_group' => sub { > {}, > '*', '*', '*', 25 > ); >- $dbh->do('DELETE FROM branch_item_rules'); >- $dbh->do('DELETE FROM default_branch_circ_rules'); >- $dbh->do('DELETE FROM default_branch_item_rules'); >- $dbh->do('DELETE FROM default_circ_rules'); >+ $dbh->do('DELETE FROM circulation_rules'); > > Koha::Items->search->delete; > Koha::Biblios->search->delete; >@@ -968,11 +997,17 @@ subtest 'CanItemBeReserved / pickup_not_in_hold_group' => sub { > ); > > # Insert default circ rule of holds allowed only from local hold group for all libraries >- $dbh->do( >- q{INSERT INTO default_circ_rules (holdallowed, hold_fulfillment_policy, returnbranch) >- VALUES (?,?,?)}, >- {}, >- 2, 'holdgroup', 'any' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 2, >+ hold_fulfillment_policy => 'holdgroup', >+ returnbranch => 'any' >+ } >+ } > ); > > # Test 2: Patron 1 can place hold >@@ -990,14 +1025,20 @@ subtest 'CanItemBeReserved / pickup_not_in_hold_group' => sub { > ); > > # Cleanup default_cirt_rules >- $dbh->do('DELETE FROM default_circ_rules'); >+ $dbh->do('DELETE FROM circulation_rules'); > > # Insert default circ rule to "any" for library 2 >- $dbh->do( >- q{INSERT INTO default_branch_circ_rules (branchcode, holdallowed, hold_fulfillment_policy, returnbranch) >- VALUES (?,?,?,?)}, >- {}, >- $library2->branchcode, 2, 'any', 'any' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => $library2->branchcode, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 2, >+ hold_fulfillment_policy => 'any', >+ returnbranch => 'any' >+ } >+ } > ); > > # Test 4: Patron 3 can place hold >@@ -1008,11 +1049,17 @@ subtest 'CanItemBeReserved / pickup_not_in_hold_group' => sub { > ); > > # Update default circ rule to "hold group" for library 2 >- $dbh->do( >- q{UPDATE default_branch_circ_rules set hold_fulfillment_policy = ? >- WHERE branchcode = ?}, >- {}, >- 'holdgroup', $library2->branchcode >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => $library2->branchcode, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 2, >+ hold_fulfillment_policy => 'holdgroup', >+ returnbranch => 'any' >+ } >+ } > ); > > # Test 5: Patron 3 cannot place hold >@@ -1023,14 +1070,20 @@ subtest 'CanItemBeReserved / pickup_not_in_hold_group' => sub { > ); > > # Cleanup default_branch_cirt_rules >- $dbh->do('DELETE FROM default_branch_circ_rules'); >+ $dbh->do('DELETE FROM circulation_rules'); > > # Insert default item rule to "any" for itemtype 2 >- $dbh->do( >- q{INSERT INTO default_branch_item_rules (itemtype, holdallowed, hold_fulfillment_policy, returnbranch) >- VALUES (?,?,?,?)}, >- {}, >- $itemtype2->itemtype, 2, 'any', 'any' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => $itemtype2->itemtype, >+ categorycode => undef, >+ rules => { >+ holdallowed => 2, >+ hold_fulfillment_policy => 'any', >+ returnbranch => 'any' >+ } >+ } > ); > > # Test 6: Patron 3 can place hold >@@ -1041,11 +1094,17 @@ subtest 'CanItemBeReserved / pickup_not_in_hold_group' => sub { > ); > > # Update default item rule to "hold group" for itemtype 2 >- $dbh->do( >- q{UPDATE default_branch_item_rules set hold_fulfillment_policy = ? >- WHERE itemtype = ?}, >- {}, >- 'holdgroup', $itemtype2->itemtype >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => $itemtype2->itemtype, >+ categorycode => undef, >+ rules => { >+ holdallowed => 2, >+ hold_fulfillment_policy => 'holdgroup', >+ returnbranch => 'any' >+ } >+ } > ); > > # Test 7: Patron 3 cannot place hold >@@ -1056,14 +1115,20 @@ subtest 'CanItemBeReserved / pickup_not_in_hold_group' => sub { > ); > > # Cleanup default_branch_item_rules >- $dbh->do('DELETE FROM default_branch_item_rules'); >+ $dbh->do('DELETE FROM circulation_rules'); > > # Insert branch item rule to "any" for itemtype 2 and library 2 >- $dbh->do( >- q{INSERT INTO branch_item_rules (branchcode, itemtype, holdallowed, hold_fulfillment_policy, returnbranch) >- VALUES (?,?,?,?,?)}, >- {}, >- $library2->branchcode, $itemtype2->itemtype, 2, 'any', 'any' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => $library2->branchcode, >+ itemtype => $itemtype2->itemtype, >+ categorycode => undef, >+ rules => { >+ holdallowed => 2, >+ hold_fulfillment_policy => 'any', >+ returnbranch => 'any' >+ } >+ } > ); > > # Test 8: Patron 3 can place hold >@@ -1074,11 +1139,17 @@ subtest 'CanItemBeReserved / pickup_not_in_hold_group' => sub { > ); > > # Update branch item rule to "hold group" for itemtype 2 and library 2 >- $dbh->do( >- q{UPDATE branch_item_rules set hold_fulfillment_policy = ? >- WHERE branchcode = ? and itemtype = ?}, >- {}, >- 'holdgroup', $library2->branchcode, $itemtype2->itemtype >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => $library2->branchcode, >+ itemtype => $itemtype2->itemtype, >+ categorycode => undef, >+ rules => { >+ holdallowed => 2, >+ hold_fulfillment_policy => 'holdgroup', >+ returnbranch => 'any' >+ } >+ } > ); > > # Test 9: Patron 3 cannot place hold >diff --git a/t/db_dependent/Koha/Biblios.t b/t/db_dependent/Koha/Biblios.t >index 9d3bca16bd..c03d28434e 100644 >--- a/t/db_dependent/Koha/Biblios.t >+++ b/t/db_dependent/Koha/Biblios.t >@@ -209,10 +209,7 @@ subtest 'pickup_locations' => sub { > {}, > '*', '*', '*', 25 > ); >- $dbh->do('DELETE FROM branch_item_rules'); >- $dbh->do('DELETE FROM default_branch_circ_rules'); >- $dbh->do('DELETE FROM default_branch_item_rules'); >- $dbh->do('DELETE FROM default_circ_rules'); >+ $dbh->do('DELETE FROM circulation_rules'); > > my $root1 = $builder->build_object( { class => 'Koha::Library::Groups', value => { ft_local_hold_group => 1 } } ); > my $root2 = $builder->build_object( { class => 'Koha::Library::Groups', value => { ft_local_hold_group => 1 } } ); >@@ -290,11 +287,17 @@ subtest 'pickup_locations' => sub { > t::lib::Mocks::mock_preference('HomeOrHoldingBranch', 'homebranch'); > > #Case 1: holdallowed any, hold_fulfillment_policy any >- $dbh->do( >- q{INSERT INTO default_circ_rules (holdallowed, hold_fulfillment_policy, returnbranch) >- VALUES (?,?,?)}, >- {}, >- 2, 'any', 'any' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 2, >+ hold_fulfillment_policy => 'any', >+ returnbranch => 'any' >+ } >+ } > ); > > my @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } ); >@@ -306,10 +309,17 @@ subtest 'pickup_locations' => sub { > ok(scalar(@pl_1_1) == 5 && scalar(@pl_1_4) == 5 && scalar(@pl_2_1) == 5 && scalar(@pl_2_4) == 5, 'Returns all libraries that are pickup locations'); > > #Case 2: holdallowed homebranch, hold_fulfillment_policy any, HomeOrHoldingBranch 'homebranch' >- $dbh->do( >- q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, >- {}, >- 1, 'any' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 1, >+ hold_fulfillment_policy => 'any', >+ returnbranch => 'any' >+ } >+ } > ); > > @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } ); >@@ -321,10 +331,17 @@ subtest 'pickup_locations' => sub { > ok(scalar(@pl_1_4) == 0 && scalar(@pl_2_1) == 0, 'Returns no pickup locations'); > > #Case 3: holdallowed holdgroup, hold_fulfillment_policy any >- $dbh->do( >- q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, >- {}, >- 3, 'any' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 3, >+ hold_fulfillment_policy => 'any', >+ returnbranch => 'any' >+ } >+ } > ); > > @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } ); >@@ -335,10 +352,17 @@ subtest 'pickup_locations' => sub { > ok(scalar(@pl_1_1) == 5 && scalar(@pl_2_4) == 5 && scalar(@pl_1_4) == 5 && scalar(@pl_2_1) == 5, 'Returns all libraries that are pickup_locations, when item\'s hombebranch is in patron\' holdgroup'); > > #Case 4: holdallowed any, hold_fulfillment_policy holdgroup >- $dbh->do( >- q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, >- {}, >- 2, 'holdgroup' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 2, >+ hold_fulfillment_policy => 'holdgroup', >+ returnbranch => 'any' >+ } >+ } > ); > > @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } ); >@@ -349,10 +373,17 @@ subtest 'pickup_locations' => sub { > ok(scalar(@pl_1_1) == 3 && scalar(@pl_2_4) == 3 && scalar(@pl_1_4) == 3 && scalar(@pl_2_1) == 3, 'Returns libraries in item\'s holdgroup, and that are pickup_locations'); > > #Case 5: holdallowed homebranch, hold_fulfillment_policy holdgroup, HomeOrHoldingBranch 'homebranch' >- $dbh->do( >- q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, >- {}, >- 1, 'holdgroup' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 1, >+ hold_fulfillment_policy => 'holdgroup', >+ returnbranch => 'any' >+ } >+ } > ); > > @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } ); >@@ -364,10 +395,17 @@ subtest 'pickup_locations' => sub { > ok(scalar(@pl_1_4) == 0 && scalar(@pl_2_1) == 0, 'Returns no pickup locations'); > > #Case 6: holdallowed holdgroup, hold_fulfillment_policy holdgroup >- $dbh->do( >- q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, >- {}, >- 3, 'holdgroup' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 3, >+ hold_fulfillment_policy => 'holdgroup', >+ returnbranch => 'any' >+ } >+ } > ); > > @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } ); >@@ -378,10 +416,17 @@ subtest 'pickup_locations' => sub { > ok(scalar(@pl_1_1) == 2 && scalar(@pl_2_1) == 2 && scalar(@pl_2_4) == 1 && scalar(@pl_1_4) == 1, 'Returns libraries in item\'s holdgroup whose homebranch is included patron\'s holdgroup, and that are pickup_locations'); > > #Case 7: holdallowed any, hold_fulfillment_policy homebranch >- $dbh->do( >- q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, >- {}, >- 2, 'homebranch' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 2, >+ hold_fulfillment_policy => 'homebranch', >+ returnbranch => 'any' >+ } >+ } > ); > > @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } ); >@@ -392,10 +437,17 @@ subtest 'pickup_locations' => sub { > ok(scalar(@pl_1_1) == 1 && scalar(@pl_1_4) == 1 && scalar(@pl_2_1) == 2 && scalar(@pl_2_4) == 2, 'Returns homebranch of items in biblio, that are pickup_locations'); > > #Case 8: holdallowed homebranch, hold_fulfillment_policy homebranch, HomeOrHoldingBranch 'homebranch' >- $dbh->do( >- q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, >- {}, >- 1, 'homebranch' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 1, >+ hold_fulfillment_policy => 'homebranch', >+ returnbranch => 'any' >+ } >+ } > ); > > @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } ); >@@ -407,10 +459,17 @@ subtest 'pickup_locations' => sub { > ok(scalar(@pl_1_4) == 0 && scalar(@pl_2_1) == 0, 'No pickup locations returned'); > > #Case 9: holdallowed holdgroup, hold_fulfillment_policy homebranch >- $dbh->do( >- q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, >- {}, >- 3, 'homebranch' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 3, >+ hold_fulfillment_policy => 'homebranch', >+ returnbranch => 'any' >+ } >+ } > ); > > @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } ); >@@ -422,10 +481,17 @@ subtest 'pickup_locations' => sub { > ok(scalar(@pl_1_4) == 0, 'No pickup locations returned'); > > #Case 10: holdallowed any, hold_fulfillment_policy holdingbranch >- $dbh->do( >- q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, >- {}, >- 2, 'holdingbranch' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 2, >+ hold_fulfillment_policy => 'holdingbranch', >+ returnbranch => 'any' >+ } >+ } > ); > > @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } ); >@@ -436,10 +502,17 @@ subtest 'pickup_locations' => sub { > ok(scalar(@pl_1_1) == 2 && scalar(@pl_1_4) == 2 && scalar(@pl_2_1) == 2 && scalar(@pl_2_4) == 2, 'Returns holdingbranch of items in biblio, that are pickup_locations'); > > #Case 11: holdallowed homebranch, hold_fulfillment_policy holdingbranch, HomeOrHoldingBranch 'homebranch' >- $dbh->do( >- q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, >- {}, >- 1, 'holdingbranch' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 1, >+ hold_fulfillment_policy => 'holdingbranch', >+ returnbranch => 'any' >+ } >+ } > ); > > @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } ); >@@ -451,10 +524,17 @@ subtest 'pickup_locations' => sub { > ok(scalar(@pl_1_4) == 0 && scalar(@pl_2_1) == 0, 'No pickup locations returned'); > > #Case 12: holdallowed holdgroup, hold_fulfillment_policy holdingbranch >- $dbh->do( >- q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, >- {}, >- 3, 'holdingbranch' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 3, >+ hold_fulfillment_policy => 'holdingbranch', >+ returnbranch => 'any' >+ } >+ } > ); > > @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } ); >@@ -467,10 +547,17 @@ subtest 'pickup_locations' => sub { > t::lib::Mocks::mock_preference('HomeOrHoldingBranch', 'holdingbranch'); > > #Case 13: holdallowed homebranch, hold_fulfillment_policy any, HomeOrHoldingBranch 'holdingbranch' >- $dbh->do( >- q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, >- {}, >- 1, 'any' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 1, >+ hold_fulfillment_policy => 'any', >+ returnbranch => 'any' >+ } >+ } > ); > > @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } ); >@@ -482,10 +569,17 @@ subtest 'pickup_locations' => sub { > ok(scalar(@pl_1_1) == 0, 'No pickup locations returned'); > > #Case 14: holdallowed homebranch, hold_fulfillment_policy holdgroup, HomeOrHoldingBranch 'holdingbranch' >- $dbh->do( >- q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, >- {}, >- 1, 'holdgroup' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 1, >+ hold_fulfillment_policy => 'holdgroup', >+ returnbranch => 'any' >+ } >+ } > ); > > @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } ); >@@ -497,10 +591,17 @@ subtest 'pickup_locations' => sub { > ok(scalar(@pl_1_1) == 0, 'No pickup locations returned'); > > #Case 15: holdallowed homebranch, hold_fulfillment_policy homebranch, HomeOrHoldingBranch 'holdingbranch' >- $dbh->do( >- q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, >- {}, >- 1, 'homebranch' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 1, >+ hold_fulfillment_policy => 'homebranch', >+ returnbranch => 'any' >+ } >+ } > ); > > @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } ); >@@ -513,10 +614,17 @@ subtest 'pickup_locations' => sub { > ok(scalar(@pl_1_1) == 0 && scalar(@pl_1_4) == 0, 'No pickup locations returned'); > > #Case 16: holdallowed homebranch, hold_fulfillment_policy holdingbranch, HomeOrHoldingBranch 'holdingbranch' >- $dbh->do( >- q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, >- {}, >- 1, 'holdingbranch' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 1, >+ hold_fulfillment_policy => 'holdingbranch', >+ returnbranch => 'any' >+ } >+ } > ); > > @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } ); >diff --git a/t/db_dependent/Koha/Items.t b/t/db_dependent/Koha/Items.t >index e0e5faeedc..3629806647 100644 >--- a/t/db_dependent/Koha/Items.t >+++ b/t/db_dependent/Koha/Items.t >@@ -186,10 +186,7 @@ subtest 'pickup_locations' => sub { > {}, > '*', '*', '*', 25 > ); >- $dbh->do('DELETE FROM branch_item_rules'); >- $dbh->do('DELETE FROM default_branch_circ_rules'); >- $dbh->do('DELETE FROM default_branch_item_rules'); >- $dbh->do('DELETE FROM default_circ_rules'); >+ $dbh->do('DELETE FROM circulation_rules'); > > my $root1 = $builder->build_object( { class => 'Koha::Library::Groups', value => { ft_local_hold_group => 1 } } ); > my $root2 = $builder->build_object( { class => 'Koha::Library::Groups', value => { ft_local_hold_group => 1 } } ); >@@ -231,11 +228,17 @@ subtest 'pickup_locations' => sub { > t::lib::Mocks::mock_preference('HomeOrHoldingBranch', 'homebranch'); > > #Case 1: holdallowed any, hold_fulfillment_policy any >- $dbh->do( >- q{INSERT INTO default_circ_rules (holdallowed, hold_fulfillment_policy, returnbranch) >- VALUES (?,?,?)}, >- {}, >- 2, 'any', 'any' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 2, >+ hold_fulfillment_policy => 'any', >+ returnbranch => 'any' >+ } >+ } > ); > > my @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } ); >@@ -246,10 +249,17 @@ subtest 'pickup_locations' => sub { > ok(scalar(@pl_1_1) == scalar(@pl_1_4) && scalar(@pl_1_1) == scalar(@pl_3_1) && scalar(@pl_1_1) == scalar(@pl_3_4), 'All combinations of patron/item renders the same number of locations'); > > #Case 2: holdallowed homebranch, hold_fulfillment_policy any, HomeOrHoldingBranch 'homebranch' >- $dbh->do( >- q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, >- {}, >- 1, 'any' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 1, >+ hold_fulfillment_policy => 'any', >+ returnbranch => 'any' >+ } >+ } > ); > > @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } ); >@@ -261,10 +271,17 @@ subtest 'pickup_locations' => sub { > ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_3_4) == 0, 'Any other combination renders no locations'); > > #Case 3: holdallowed holdgroup, hold_fulfillment_policy any >- $dbh->do( >- q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, >- {}, >- 3, 'any' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 3, >+ hold_fulfillment_policy => 'any', >+ returnbranch => 'any' >+ } >+ } > ); > > @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } ); >@@ -277,10 +294,17 @@ subtest 'pickup_locations' => sub { > ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0, 'Any other combination renders no locations'); > > #Case 4: holdallowed any, hold_fulfillment_policy holdgroup >- $dbh->do( >- q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, >- {}, >- 2, 'holdgroup' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 2, >+ hold_fulfillment_policy => 'holdgroup', >+ returnbranch => 'any' >+ } >+ } > ); > > @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } ); >@@ -292,10 +316,17 @@ subtest 'pickup_locations' => sub { > ok(scalar(@pl_3_1) == 1 && scalar(@pl_3_4) == 1, 'Pickup locations for item 3 renders all libraries in items\'s holdgroup that are pickup_locations'); > > #Case 5: holdallowed homebranch, hold_fulfillment_policy holdgroup, HomeOrHoldingBranch 'homebranch' >- $dbh->do( >- q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, >- {}, >- 1, 'holdgroup' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 1, >+ hold_fulfillment_policy => 'holdgroup', >+ returnbranch => 'any' >+ } >+ } > ); > > @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } ); >@@ -307,10 +338,17 @@ subtest 'pickup_locations' => sub { > ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_3_4) == 0, 'Any other combination renders no locations'); > > #Case 6: holdallowed holdgroup, hold_fulfillment_policy holdgroup >- $dbh->do( >- q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, >- {}, >- 3, 'holdgroup' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 3, >+ hold_fulfillment_policy => 'holdgroup', >+ returnbranch => 'any' >+ } >+ } > ); > > @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } ); >@@ -323,10 +361,17 @@ subtest 'pickup_locations' => sub { > ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0, 'Any other combination renders no locations'); > > #Case 7: holdallowed any, hold_fulfillment_policy homebranch >- $dbh->do( >- q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, >- {}, >- 2, 'homebranch' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 2, >+ hold_fulfillment_policy => 'homebranch', >+ returnbranch => 'any' >+ } >+ } > ); > > @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } ); >@@ -338,10 +383,17 @@ subtest 'pickup_locations' => sub { > ok(scalar(@pl_3_1) == 0 && scalar(@pl_3_4) == 0, 'Any other combination renders no locations, because library3 is not pickup_location'); > > #Case 8: holdallowed homebranch, hold_fulfillment_policy homebranch, HomeOrHoldingBranch 'homebranch' >- $dbh->do( >- q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, >- {}, >- 1, 'homebranch' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 1, >+ hold_fulfillment_policy => 'homebranch', >+ returnbranch => 'any' >+ } >+ } > ); > > @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } ); >@@ -353,10 +405,17 @@ subtest 'pickup_locations' => sub { > ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_3_4) == 0, 'Any other combination renders no locations'); > > #Case 9: holdallowed holdgroup, hold_fulfillment_policy homebranch >- $dbh->do( >- q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, >- {}, >- 3, 'homebranch' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 3, >+ hold_fulfillment_policy => 'homebranch', >+ returnbranch => 'any' >+ } >+ } > ); > > @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } ); >@@ -368,10 +427,17 @@ subtest 'pickup_locations' => sub { > ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_3_4) == 0, 'Any other combination renders no locations'); > > #Case 10: holdallowed any, hold_fulfillment_policy holdingbranch >- $dbh->do( >- q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, >- {}, >- 2, 'holdingbranch' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 2, >+ hold_fulfillment_policy => 'holdingbranch', >+ returnbranch => 'any' >+ } >+ } > ); > > @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } ); >@@ -384,10 +450,17 @@ subtest 'pickup_locations' => sub { > > > #Case 11: holdallowed homebranch, hold_fulfillment_policy holdingbranch, HomeOrHoldingBranch 'homebranch' >- $dbh->do( >- q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, >- {}, >- 1, 'holdingbranch' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 1, >+ hold_fulfillment_policy => 'holdingbranch', >+ returnbranch => 'any' >+ } >+ } > ); > > @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } ); >@@ -399,10 +472,17 @@ subtest 'pickup_locations' => sub { > ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_3_4) == 0, 'Any other combination renders no locations'); > > #Case 12: holdallowed holdgroup, hold_fulfillment_policy holdingbranch >- $dbh->do( >- q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, >- {}, >- 3, 'holdingbranch' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 3, >+ hold_fulfillment_policy => 'holdingbranch', >+ returnbranch => 'any' >+ } >+ } > ); > > @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } ); >@@ -417,10 +497,17 @@ subtest 'pickup_locations' => sub { > t::lib::Mocks::mock_preference('HomeOrHoldingBranch', 'holdingbranch'); > > #Case 13: holdallowed homebranch, hold_fulfillment_policy any, HomeOrHoldingBranch 'holdingbranch' >- $dbh->do( >- q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, >- {}, >- 1, 'any' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 1, >+ hold_fulfillment_policy => 'any', >+ returnbranch => 'any' >+ } >+ } > ); > > @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } ); >@@ -432,10 +519,17 @@ subtest 'pickup_locations' => sub { > ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_1_1) == 0, 'Any other combination renders no locations'); > > #Case 14: holdallowed homebranch, hold_fulfillment_policy holdgroup, HomeOrHoldingBranch 'holdingbranch' >- $dbh->do( >- q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, >- {}, >- 1, 'holdgroup' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 1, >+ hold_fulfillment_policy => 'holdgroup', >+ returnbranch => 'any' >+ } >+ } > ); > > @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } ); >@@ -447,10 +541,17 @@ subtest 'pickup_locations' => sub { > ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_1_1) == 0, 'Any other combination renders no locations'); > > #Case 15: holdallowed homebranch, hold_fulfillment_policy homebranch, HomeOrHoldingBranch 'holdingbranch' >- $dbh->do( >- q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, >- {}, >- 1, 'homebranch' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 1, >+ hold_fulfillment_policy => 'homebranch', >+ returnbranch => 'any' >+ } >+ } > ); > > @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } ); >@@ -462,10 +563,17 @@ subtest 'pickup_locations' => sub { > ok(scalar(@pl_3_4) == 0 && scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_1_1) == 0, 'Any combination of patron/item renders no locations'); > > #Case 16: holdallowed homebranch, hold_fulfillment_policy holdingbranch, HomeOrHoldingBranch 'holdingbranch' >- $dbh->do( >- q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, >- {}, >- 1, 'holdingbranch' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ itemtype => undef, >+ categorycode => undef, >+ rules => { >+ holdallowed => 1, >+ hold_fulfillment_policy => 'holdingbranch', >+ returnbranch => 'any' >+ } >+ } > ); > > @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } ); >diff --git a/t/db_dependent/Koha/Libraries.t b/t/db_dependent/Koha/Libraries.t >index 0b2f7271dd..cfa7382c29 100644 >--- a/t/db_dependent/Koha/Libraries.t >+++ b/t/db_dependent/Koha/Libraries.t >@@ -38,6 +38,10 @@ use t::lib::TestBuilder; > my $schema = Koha::Database->new->schema; > $schema->storage->txn_begin; > >+# Cleanup default_branch_item_rules >+my $dbh = C4::Context->dbh; >+$dbh->do('DELETE FROM circulation_rules'); >+ > my $builder = t::lib::TestBuilder->new; > my $nb_of_libraries = Koha::Libraries->search->count; > my $new_library_1 = Koha::Library->new({ >-- >2.17.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 22284
:
88138
|
88139
|
88140
|
88141
|
88142
|
88143
|
88144
|
88145
|
88369
|
88561
|
88793
|
88794
|
88795
|
88796
|
88797
|
88798
|
88799
|
88800
|
88801
|
88802
|
88939
|
88940
|
88941
|
88942
|
88943
|
88944
|
88945
|
88946
|
88947
|
88948
|
88949
|
88955
|
88956
|
88957
|
88958
|
88959
|
88960
|
88961
|
88962
|
88963
|
88964
|
88965
|
89060
|
89061
|
89062
|
89063
|
89064
|
89065
|
89066
|
89067
|
89068
|
89069
|
89070
|
89071
|
89072
|
89073
|
89074
|
89075
|
89076
|
89077
|
89078
|
89079
|
89080
|
89081
|
89082
|
89083
|
89084
|
89085
|
89122
|
89123
|
89124
|
89125
|
89126
|
89127
|
89128
|
89129
|
89130
|
89131
|
89132
|
89133
|
89134
|
89135
|
89523
|
89836
|
89837
|
89838
|
89839
|
89840
|
89841
|
89842
|
89843
|
89844
|
89845
|
89846
|
89847
|
89848
|
89849
|
90133
|
90134
|
90197
|
90198
|
90199
|
90200
|
90201
|
90469
|
90525
|
91261
|
91262
|
91263
|
91264
|
91265
|
91266
|
91267
|
91268
|
91269
|
91270
|
91271
|
91272
|
91273
|
91274
|
91275
|
91276
|
91277
|
91278
|
91279
|
91280
|
91282
|
91701
|
91702
|
91703
|
91704
|
91705
|
91706
|
91707
|
91708
|
91709
|
91710
|
91711
|
91712
|
91713
|
91714
|
91715
|
91716
|
91717
|
91718
|
91719
|
91720
|
91721
|
91750
|
91751
|
91752
|
91753
|
91754
|
91755
|
91756
|
91757
|
91758
|
92554
|
92555
|
92556
|
92557
|
92558
|
92559
|
92560
|
92561
|
92562
|
92563
|
92564
|
92565
|
92566
|
92567
|
92568
|
92569
|
92570
|
92571
|
92572
|
92573
|
92574
|
92752
|
92753
|
92754
|
92755
|
92756
|
92757
|
92758
|
92759
|
92760
|
92761
|
92762
|
92763
|
92764
|
92849
|
92850
|
92851
|
92852
|
92853
|
92854
|
92855
|
92856
|
92857
|
92858
|
92859
|
92860
|
92861
|
94483
|
94484
|
94485
|
94486
|
94487
|
94488
|
94489
|
94490
|
94491
|
94492
|
94493
|
94494
|
94495
|
96437
|
96438
|
96439
|
96440
|
96441
|
96442
|
96443
|
96444
|
96445
|
96446
|
96447
|
96448
|
96449
|
96450
|
96544
|
96545
|
96546
|
96547
|
96548
|
96549
|
96550
|
96551
|
96552
|
96553
|
96554
|
96555
|
96556
|
96557
|
96558
|
115202