Bugzilla – Attachment 91704 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: Control hold groups in C4::Reserves
Bug-22284-Control-hold-groups-in-C4Reserves.patch (text/plain), 22.83 KB, created by
Agustín Moyano
on 2019-07-22 18:41:17 UTC
(
hide
)
Description:
Bug 22284: Control hold groups in C4::Reserves
Filename:
MIME Type:
Creator:
Agustín Moyano
Created:
2019-07-22 18:41:17 UTC
Size:
22.83 KB
patch
obsolete
>From fd2ae19d77c6faa5e828bd518c23918defd92f2b Mon Sep 17 00:00:00 2001 >From: Agustin Moyano <agustinmoyano@theke.io> >Date: Mon, 25 Mar 2019 00:45:58 -0300 >Subject: [PATCH] Bug 22284: Control hold groups in C4::Reserves > >This patch modifies C4::Reserves to control when hold group options where selected >in smart rules. >In CanItemBeReserved adds 2 new error status messages >1) branchNotInHoldGroup: when a patron's homebranch is not in item's hold group >2) pickupNotInHoldGroup: when a selected pickup location is not in item's hold group >Also CheckReserves is modified when item's priority is defined, to control by hold >group when required. >Finally, IsAvailableForItemLevelRequest was also modified to control by hold group when >required. > >To test: >1) Apply this patch >2) prove t/db_dependent/Holds.t >SUCCESS => Result: PASS >3) Sign off > >Sponsored-by: VOKAL > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > C4/Reserves.pm | 33 +++- > t/db_dependent/Holds.t | 395 ++++++++++++++++++++++++++++++++++++++++- > 2 files changed, 425 insertions(+), 3 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index be51d56be2..f6917307a8 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -299,11 +299,13 @@ sub CanBookBeReserved{ > { status => ageRestricted }, if the Item is age restricted for this borrower. > { status => damaged }, if the Item is damaged. > { status => cannotReserveFromOtherBranches }, if syspref 'canreservefromotherbranches' is OK. >+ { status => branchNotInHoldGroup }, if borrower home library is not in hold group, and holds are only allowed from hold groups. > { status => tooManyReserves, limit => $limit }, if the borrower has exceeded their maximum reserve amount. > { status => notReservable }, if holds on this item are not allowed > { status => libraryNotFound }, if given branchcode is not an existing library > { status => libraryNotPickupLocation }, if given branchcode is not configured to be a pickup location > { status => cannotBeTransferred }, if branch transfer limit applies on given item and branchcode >+ { status => pickupNotInHoldGroup }, pickup location is not in hold group, and pickup locations are only allowed from hold groups. > > =cut > >@@ -458,6 +460,15 @@ sub CanItemBeReserved { > return { status => 'cannotReserveFromOtherBranches' }; > } > >+ my $branch_control = C4::Context->preference('HomeOrHoldingBranch'); >+ my $itembranchcode = $branch_control eq 'holdingbranch' ? $item->holdingbranch : $item->homebranch; >+ my $item_library = Koha::Libraries->find( {branchcode => $itembranchcode} ); >+ if ( $branchitemrule->{holdallowed} == 3) { >+ if($borrower->{branchcode} ne $itembranchcode && !$item_library->validate_hold_sibling( {branchcode => $borrower->{branchcode}} )) { >+ return { status => 'branchNotInHoldGroup' }; >+ } >+ } >+ > # If reservecount is ok, we check item branch if IndependentBranches is ON > # and canreservefromotherbranches is OFF > if ( C4::Context->preference('IndependentBranches') >@@ -482,6 +493,9 @@ sub CanItemBeReserved { > unless ($item->can_be_transferred({ to => $destination })) { > return { status => 'cannotBeTransferred' }; > } >+ unless ($branchitemrule->{hold_fulfillment_policy} ne 'holdgroup' || $item_library->validate_hold_sibling( {branchcode => $pickup_branchcode} )) { >+ return { status => 'pickupNotInHoldGroup' }; >+ } > } > > return { status => 'OK' }; >@@ -798,8 +812,12 @@ sub CheckReserves { > my $branchitemrule = C4::Circulation::GetBranchItemRule($branch,$item->effective_itemtype); > next if ($branchitemrule->{'holdallowed'} == 0); > next if (($branchitemrule->{'holdallowed'} == 1) && ($branch ne $patron->branchcode)); >+ my $library = Koha::Libraries->find({branchcode=>$branch}); >+ next if (($branchitemrule->{'holdallowed'} == 3) && (!$library->validate_hold_sibling({branchcode => $patron->branchcode}) )); > my $hold_fulfillment_policy = $branchitemrule->{hold_fulfillment_policy}; >- next if ( ($branchitemrule->{hold_fulfillment_policy} ne 'any') && ($res->{branchcode} ne $item->$hold_fulfillment_policy) ); >+ next if ( ($hold_fulfillment_policy eq 'holdgroup') && (!$library->validate_hold_sibling({branchcode => $res->{branchcode}})) ); >+ next if ( ($hold_fulfillment_policy eq 'homebranch') && ($res->{branchcode} ne $item->$hold_fulfillment_policy) ); >+ next if ( ($hold_fulfillment_policy eq 'holdingbranch') && ($res->{branchcode} ne $item->$hold_fulfillment_policy) ); > next unless $item->can_be_transferred( { to => scalar Koha::Libraries->find( $res->{branchcode} ) } ); > $priority = $res->{'priority'}; > $highest = $res; >@@ -1188,6 +1206,12 @@ sub IsAvailableForItemLevelRequest { > return 0 unless $destination; > return 0 unless $destination->pickup_location; > return 0 unless $item->can_be_transferred( { to => $destination } ); >+ my $reserves_control_branch = >+ GetReservesControlBranch( $item->unblessed(), $patron->unblessed() ); >+ my $branchitemrule = >+ C4::Circulation::GetBranchItemRule( $reserves_control_branch, $item->itype ); >+ my $home_library = Koka::Libraries->find( {branchcode => $item->homebranch} ); >+ return 0 unless $branchitemrule->{hold_fulfillment_policy} ne 'holdgroup' || $home_library->validate_hold_sibling( {branchcode => $pickup_branchcode} ); > } > > if ( $on_shelf_holds == 1 ) { >@@ -1201,6 +1225,10 @@ sub IsAvailableForItemLevelRequest { > foreach my $i (@items) { > my $reserves_control_branch = GetReservesControlBranch( $i->unblessed(), $patron->unblessed ); > my $branchitemrule = C4::Circulation::GetBranchItemRule( $reserves_control_branch, $i->itype ); >+ my $branch_control = C4::Context->preference('HomeOrHoldingBranch'); >+ my $itembranchcode = $branch_control eq 'holdingbranch' ? $item->holdingbranch : $item->homebranch; >+ my $item_library = Koha::Libraries->find( {branchcode => $itembranchcode} ); >+ > > $any_available = 1 > unless $i->itemlost >@@ -1211,7 +1239,8 @@ sub IsAvailableForItemLevelRequest { > || ( $i->damaged > && !C4::Context->preference('AllowHoldsOnDamagedItems') ) > || Koha::ItemTypes->find( $i->effective_itemtype() )->notforloan >- || $branchitemrule->{holdallowed} == 1 && $patron->branchcode ne $i->homebranch; >+ || $branchitemrule->{holdallowed} == 1 && $patron->branchcode ne $i->homebranch >+ || $branchitemrule->{holdallowed} == 3 && !$item_library->validate_hold_sibling( {branchcode => $pickup_branchcode} ); > } > > return $any_available ? 0 : 1; >diff --git a/t/db_dependent/Holds.t b/t/db_dependent/Holds.t >index f7919b3827..92f38c36cf 100755 >--- a/t/db_dependent/Holds.t >+++ b/t/db_dependent/Holds.t >@@ -7,7 +7,7 @@ use t::lib::TestBuilder; > > use C4::Context; > >-use Test::More tests => 59; >+use Test::More tests => 60; > use MARC::Record; > > use C4::Biblio; >@@ -24,6 +24,7 @@ use Koha::IssuingRules; > use Koha::Item::Transfer::Limits; > use Koha::Items; > use Koha::Libraries; >+use Koha::Library::Groups; > use Koha::Patrons; > > BEGIN { >@@ -263,6 +264,7 @@ t::lib::Mocks::mock_preference('item-level_itypes', 1); > > # if IndependentBranches is OFF, a $branch_1 patron can reserve an $branch_2 item > t::lib::Mocks::mock_preference('IndependentBranches', 0); >+ > ok( > CanItemBeReserved($borrowernumbers[0], $foreign_itemnumber)->{status} eq 'OK', > '$branch_1 patron allowed to reserve $branch_2 item with IndependentBranches OFF (bug 2394)' >@@ -687,3 +689,394 @@ subtest 'CanItemBeReserved / holds_per_day tests' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'CanItemBeReserved / branch_not_in_hold_group' => sub { >+ plan tests => 9; >+ >+ $schema->storage->txn_begin; >+ >+ # Cleanup database >+ Koha::Holds->search->delete; >+ $dbh->do('DELETE FROM issues'); >+ $dbh->do('DELETE FROM issuingrules'); >+ $dbh->do( >+ q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed) >+ VALUES (?, ?, ?, ?)}, >+ {}, >+ '*', '*', '*', 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'); >+ >+ Koha::Items->search->delete; >+ Koha::Biblios->search->delete; >+ >+ # Create item types >+ my $itemtype1 = $builder->build_object( { class => 'Koha::ItemTypes' } ); >+ my $itemtype2 = $builder->build_object( { class => 'Koha::ItemTypes' } ); >+ >+ # Create libraries >+ my $library1 = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my $library2 = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my $library3 = $builder->build_object( { class => 'Koha::Libraries' } ); >+ >+ # Create library groups hierarchy >+ my $rootgroup = $builder->build_object( { class => 'Koha::Library::Groups', value => {ft_local_hold_group => 1} } ); >+ my $group1 = $builder->build_object( { class => 'Koha::Library::Groups', value => {parent_id => $rootgroup->id, branchcode => $library1->branchcode}} ); >+ my $group2 = $builder->build_object( { class => 'Koha::Library::Groups', value => {parent_id => $rootgroup->id, branchcode => $library2->branchcode} } ); >+ >+ # Create 2 patrons >+ my $patron1 = $builder->build_object( { class => 'Koha::Patrons', value => {branchcode => $library1->branchcode} } ); >+ my $patron3 = $builder->build_object( { class => 'Koha::Patrons', value => {branchcode => $library3->branchcode} } ); >+ >+ # Create 3 biblios with items >+ my $biblio_1 = $builder->build_sample_biblio({ itemtype => $itemtype1->itemtype }); >+ my ( undef, undef, $itemnumber_1 ) = AddItem( >+ { homebranch => $library1->branchcode, >+ holdingbranch => $library1->branchcode >+ }, >+ $biblio_1->biblionumber >+ ); >+ my $biblio_2 = $builder->build_sample_biblio({ itemtype => $itemtype2->itemtype }); >+ my ( undef, undef, $itemnumber_2 ) = AddItem( >+ { homebranch => $library2->branchcode, >+ holdingbranch => $library2->branchcode >+ }, >+ $biblio_2->biblionumber >+ ); >+ my $biblio_3 = $builder->build_sample_biblio({ itemtype => $itemtype1->itemtype }); >+ my ( undef, undef, $itemnumber_3 ) = AddItem( >+ { homebranch => $library1->branchcode, >+ holdingbranch => $library1->branchcode >+ }, >+ $biblio_3->biblionumber >+ ); >+ >+ # Test 1: Patron 3 can place hold >+ is_deeply( >+ CanItemBeReserved( $patron3->borrowernumber, $itemnumber_2 ), >+ { status => 'OK' }, >+ 'Patron can place hold if no circ_rules where defined' >+ ); >+ >+ # 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' >+ ); >+ >+ # Test 2: Patron 1 can place hold >+ is_deeply( >+ CanItemBeReserved( $patron1->borrowernumber, $itemnumber_2 ), >+ { status => 'OK' }, >+ 'Patron can place hold because patron\'s home library is part of hold group' >+ ); >+ >+ # Test 3: Patron 3 cannot place hold >+ is_deeply( >+ CanItemBeReserved( $patron3->borrowernumber, $itemnumber_2 ), >+ { status => 'branchNotInHoldGroup' }, >+ 'Patron cannot place hold because patron\'s home library is not part of hold group' >+ ); >+ >+ # Cleanup default_cirt_rules >+ $dbh->do('DELETE FROM default_circ_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' >+ ); >+ >+ # Test 4: Patron 3 can place hold >+ is_deeply( >+ CanItemBeReserved( $patron3->borrowernumber, $itemnumber_2 ), >+ { status => 'OK' }, >+ 'Patron can place hold if holdallowed is set to "any" for library 2' >+ ); >+ >+ # 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 >+ ); >+ >+ # Test 5: Patron 3 cannot place hold >+ is_deeply( >+ CanItemBeReserved( $patron3->borrowernumber, $itemnumber_2 ), >+ { status => 'branchNotInHoldGroup' }, >+ 'Patron cannot place hold if holdallowed is set to "hold group" for library 2' >+ ); >+ >+ # Cleanup default_branch_cirt_rules >+ $dbh->do('DELETE FROM default_branch_circ_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' >+ ); >+ >+ # Test 6: Patron 3 can place hold >+ is_deeply( >+ CanItemBeReserved( $patron3->borrowernumber, $itemnumber_2 ), >+ { status => 'OK' }, >+ 'Patron can place hold if holdallowed is set to "any" for itemtype 2' >+ ); >+ >+ # 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 >+ ); >+ >+ # Test 7: Patron 3 cannot place hold >+ is_deeply( >+ CanItemBeReserved( $patron3->borrowernumber, $itemnumber_2 ), >+ { status => 'branchNotInHoldGroup' }, >+ 'Patron cannot place hold if holdallowed is set to "hold group" for itemtype 2' >+ ); >+ >+ # Cleanup default_branch_item_rules >+ $dbh->do('DELETE FROM default_branch_item_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' >+ ); >+ >+ # Test 8: Patron 3 can place hold >+ is_deeply( >+ CanItemBeReserved( $patron3->borrowernumber, $itemnumber_2 ), >+ { status => 'OK' }, >+ 'Patron can place hold if holdallowed is set to "any" for itemtype 2 and library 2' >+ ); >+ >+ # 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 >+ ); >+ >+ # Test 9: Patron 3 cannot place hold >+ is_deeply( >+ CanItemBeReserved( $patron3->borrowernumber, $itemnumber_2 ), >+ { status => 'branchNotInHoldGroup' }, >+ 'Patron cannot place hold if holdallowed is set to "hold group" for itemtype 2 and library 2' >+ ); >+ >+ $schema->storage->txn_rollback; >+ >+}; >+ >+subtest 'CanItemBeReserved / pickup_not_in_hold_group' => sub { >+ plan tests => 9; >+ >+ $schema->storage->txn_begin; >+ >+ # Cleanup database >+ Koha::Holds->search->delete; >+ $dbh->do('DELETE FROM issues'); >+ $dbh->do('DELETE FROM issuingrules'); >+ $dbh->do( >+ q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed) >+ VALUES (?, ?, ?, ?)}, >+ {}, >+ '*', '*', '*', 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'); >+ >+ Koha::Items->search->delete; >+ Koha::Biblios->search->delete; >+ >+ # Create item types >+ my $itemtype1 = $builder->build_object( { class => 'Koha::ItemTypes' } ); >+ my $itemtype2 = $builder->build_object( { class => 'Koha::ItemTypes' } ); >+ >+ # Create libraries >+ my $library1 = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my $library2 = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my $library3 = $builder->build_object( { class => 'Koha::Libraries' } ); >+ >+ # Create library groups hierarchy >+ my $rootgroup = $builder->build_object( { class => 'Koha::Library::Groups', value => {ft_local_hold_group => 1} } ); >+ my $group1 = $builder->build_object( { class => 'Koha::Library::Groups', value => {parent_id => $rootgroup->id, branchcode => $library1->branchcode}} ); >+ my $group2 = $builder->build_object( { class => 'Koha::Library::Groups', value => {parent_id => $rootgroup->id, branchcode => $library2->branchcode} } ); >+ >+ # Create 2 patrons >+ my $patron1 = $builder->build_object( { class => 'Koha::Patrons', value => {branchcode => $library1->branchcode} } ); >+ my $patron3 = $builder->build_object( { class => 'Koha::Patrons', value => {branchcode => $library3->branchcode} } ); >+ >+ # Create 3 biblios with items >+ my $biblio_1 = $builder->build_sample_biblio({ itemtype => $itemtype1->itemtype }); >+ my ( undef, undef, $itemnumber_1 ) = AddItem( >+ { homebranch => $library1->branchcode, >+ holdingbranch => $library1->branchcode >+ }, >+ $biblio_1->biblionumber >+ ); >+ my $biblio_2 = $builder->build_sample_biblio({ itemtype => $itemtype2->itemtype }); >+ my ( undef, undef, $itemnumber_2 ) = AddItem( >+ { homebranch => $library2->branchcode, >+ holdingbranch => $library2->branchcode >+ }, >+ $biblio_2->biblionumber >+ ); >+ my $biblio_3 = $builder->build_sample_biblio({ itemtype => $itemtype1->itemtype }); >+ my ( undef, undef, $itemnumber_3 ) = AddItem( >+ { homebranch => $library1->branchcode, >+ holdingbranch => $library1->branchcode >+ }, >+ $biblio_3->biblionumber >+ ); >+ >+ # Test 1: Patron 3 can place hold >+ is_deeply( >+ CanItemBeReserved( $patron3->borrowernumber, $itemnumber_2, $library3->branchcode ), >+ { status => 'OK' }, >+ 'Patron can place hold if no circ_rules where defined' >+ ); >+ >+ # 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' >+ ); >+ >+ # Test 2: Patron 1 can place hold >+ is_deeply( >+ CanItemBeReserved( $patron3->borrowernumber, $itemnumber_2, $library1->branchcode ), >+ { status => 'OK' }, >+ 'Patron can place hold because pickup location is part of hold group' >+ ); >+ >+ # Test 3: Patron 3 cannot place hold >+ is_deeply( >+ CanItemBeReserved( $patron3->borrowernumber, $itemnumber_2, $library3->branchcode ), >+ { status => 'pickupNotInHoldGroup' }, >+ 'Patron cannot place hold because pickup location is not part of hold group' >+ ); >+ >+ # Cleanup default_cirt_rules >+ $dbh->do('DELETE FROM default_circ_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' >+ ); >+ >+ # Test 4: Patron 3 can place hold >+ is_deeply( >+ CanItemBeReserved( $patron3->borrowernumber, $itemnumber_2, $library3->branchcode ), >+ { status => 'OK' }, >+ 'Patron can place hold if default_branch_circ_rules is set to "any" for library 2' >+ ); >+ >+ # 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 >+ ); >+ >+ # Test 5: Patron 3 cannot place hold >+ is_deeply( >+ CanItemBeReserved( $patron3->borrowernumber, $itemnumber_2, $library3->branchcode ), >+ { status => 'pickupNotInHoldGroup' }, >+ 'Patron cannot place hold if hold_fulfillment_policy is set to "hold group" for library 2' >+ ); >+ >+ # Cleanup default_branch_cirt_rules >+ $dbh->do('DELETE FROM default_branch_circ_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' >+ ); >+ >+ # Test 6: Patron 3 can place hold >+ is_deeply( >+ CanItemBeReserved( $patron3->borrowernumber, $itemnumber_2, $library3->branchcode ), >+ { status => 'OK' }, >+ 'Patron can place hold if hold_fulfillment_policy is set to "any" for itemtype 2' >+ ); >+ >+ # 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 >+ ); >+ >+ # Test 7: Patron 3 cannot place hold >+ is_deeply( >+ CanItemBeReserved( $patron3->borrowernumber, $itemnumber_2, $library3->branchcode ), >+ { status => 'pickupNotInHoldGroup' }, >+ 'Patron cannot place hold if hold_fulfillment_policy is set to "hold group" for itemtype 2' >+ ); >+ >+ # Cleanup default_branch_item_rules >+ $dbh->do('DELETE FROM default_branch_item_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' >+ ); >+ >+ # Test 8: Patron 3 can place hold >+ is_deeply( >+ CanItemBeReserved( $patron3->borrowernumber, $itemnumber_2, $library3->branchcode ), >+ { status => 'OK' }, >+ 'Patron can place hold if hold_fulfillment_policy is set to "any" for itemtype 2 and library 2' >+ ); >+ >+ # 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 >+ ); >+ >+ # Test 9: Patron 3 cannot place hold >+ is_deeply( >+ CanItemBeReserved( $patron3->borrowernumber, $itemnumber_2, $library3->branchcode ), >+ { status => 'pickupNotInHoldGroup' }, >+ 'Patron cannot place hold if hold_fulfillment_policy is set to "hold group" for itemtype 2 and library 2' >+ ); >+ >+ $schema->storage->txn_rollback; >+}; >-- >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