From 3b609ef26ff9f437eea9b6d79d18f565b68001e1 Mon Sep 17 00:00:00 2001 From: Victor Grousset/tuxayo Date: Tue, 22 Jun 2021 07:21:59 +0200 Subject: [PATCH] Bug 28503: REVERT ALL - see ticket Signed-off-by: Victor Grousset/tuxayo --- C4/Reserves.pm | 2 +- .../admin/preferences/circulation.pref | 2 +- misc/cronjobs/update_patrons_category.pl | 1 - t/db_dependent/Reserves.t | 73 +------------------ 4 files changed, 6 insertions(+), 72 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index ad4aaa0575..bb510f1bc4 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -874,7 +874,7 @@ sub CheckReserves { my $branch = GetReservesControlBranch( $item->unblessed, $patron->unblessed ); my $branchitemrule = C4::Circulation::GetBranchItemRule($branch,$item->effective_itemtype); next if ($branchitemrule->{'holdallowed'} == 0); - next if (($branchitemrule->{'holdallowed'} == 1) && ($item->homebranch ne $patron->branchcode)); + next if (($branchitemrule->{'holdallowed'} == 1) && ($branch ne $patron->branchcode)); my $library = Koha::Libraries->find({branchcode=>$item->homebranch}); next if (($branchitemrule->{'holdallowed'} == 3) && (!$library->validate_hold_sibling({branchcode => $patron->branchcode}) )); my $hold_fulfillment_policy = $branchitemrule->{hold_fulfillment_policy}; 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 374a05594a..820596088b 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 @@ -684,7 +684,7 @@ Circulation: class: integer - days from now) at checkin time. Note that this number of days will be used too in calculating the default end date for the Holds to pull-report. But it does not interfere with issuing, renewing or transferring books. - - - Check the rule from the + - Check the - pref: ReservesControlBranch choices: ItemHomeLibrary: "item's home library" diff --git a/misc/cronjobs/update_patrons_category.pl b/misc/cronjobs/update_patrons_category.pl index fd4bc4a7ea..86541a818d 100755 --- a/misc/cronjobs/update_patrons_category.pl +++ b/misc/cronjobs/update_patrons_category.pl @@ -47,7 +47,6 @@ update_patrons_category.pl -f=categorycode -t=categorycode update_patrons_category.pl --help | --man Options: - --help brief help message --man full documentation -too_old update if over maximum age for current category diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t index a3b79e9097..a058735b0d 100755 --- a/t/db_dependent/Reserves.t +++ b/t/db_dependent/Reserves.t @@ -1079,9 +1079,9 @@ subtest 'RevertWaitingStatus' => sub { ); }; -subtest 'CheckReserves additional tests' => sub { +subtest 'CheckReserves additional test' => sub { - plan tests => 8; + plan tests => 3; my $item = $builder->build_sample_item; my $reserve1 = $builder->build_object( @@ -1155,67 +1155,6 @@ subtest 'CheckReserves additional tests' => sub { $reserve1->reserve_id, "We got the Transit reserve" ); is( scalar @$possible_reserves, 2, 'We do get both reserves' ); - my $patron_B = $builder->build_object({ class => "Koha::Patrons" }); - my $item_A = $builder->build_sample_item; - my $item_B = $builder->build_sample_item({ - homebranch => $patron_B->branchcode, - biblionumber => $item_A->biblionumber, - itype => $item_A->itype - }); - Koha::CirculationRules->set_rules( - { - branchcode => undef, - categorycode => undef, - itemtype => $item_A->itype, - rules => { - reservesallowed => 25, - holds_per_record => 1, - } - } - ); - Koha::CirculationRules->set_rule({ - branchcode => undef, - itemtype => $item_A->itype, - rule_name => 'holdallowed', - rule_value => 1 - }); - my $reserve_id = AddReserve( - { - branchcode => $patron_B->branchcode, - borrowernumber => $patron_B->borrowernumber, - biblionumber => $item_A->biblionumber, - priority => 1, - itemnumber => undef, - } - ); - - ok( $reserve_id, "We can place a record level hold because one item is owned by patron's home library"); - t::lib::Mocks::mock_preference('ReservesControlBranch', 'ItemHomeLibrary'); - ( $status, $matched_reserve, $possible_reserves ) = CheckReserves( $item_A->itemnumber ); - is( $status, "", "We do not fill the hold with item A because it is not from the patron's homebranch"); - Koha::CirculationRules->set_rule({ - branchcode => $item_A->homebranch, - itemtype => $item_A->itype, - rule_name => 'holdallowed', - rule_value => 2 - }); - ( $status, $matched_reserve, $possible_reserves ) = CheckReserves( $item_A->itemnumber ); - is( $status, "Reserved", "We fill the hold with item A because item's branch rule says allow any"); - - - # Changing the control branch should change only the rule we get - t::lib::Mocks::mock_preference('ReservesControlBranch', 'PatronLibrary'); - ( $status, $matched_reserve, $possible_reserves ) = CheckReserves( $item_A->itemnumber ); - is( $status, "", "We do not fill the hold with item A because it is not from the patron's homebranch"); - Koha::CirculationRules->set_rule({ - branchcode => $patron_B->branchcode, - itemtype => $item_A->itype, - rule_name => 'holdallowed', - rule_value => 2 - }); - ( $status, $matched_reserve, $possible_reserves ) = CheckReserves( $item_A->itemnumber ); - is( $status, "Reserved", "We fill the hold with item A because patron's branch rule says allow any"); - }; subtest 'ModReserveAffect logging' => sub { @@ -1250,15 +1189,11 @@ subtest 'ModReserveAffect logging' => sub { $hold = Koha::Holds->find($reserve_id); is( $hold->timestamp, $previous_timestamp, 'Make sure the previous timestamp has been used' ); - # Avoid warnings - my $reserve_mock = Test::MockModule->new('C4::Reserves'); - $reserve_mock->mock( '_koha_notify_reserve', undef ); - # Mark it waiting ModReserveAffect( $item->itemnumber, $patron->borrowernumber ); - $hold->discard_changes; - ok( $hold->is_waiting, 'Hold has been set waiting' ); + $hold = Koha::Holds->find($reserve_id); + is( $hold->found, 'W', 'Hold has been set waiting' ); isnt( $hold->timestamp, $previous_timestamp, 'The timestamp has been modified' ); my $log = Koha::ActionLogs->search({ module => 'HOLDS', action => 'MODIFY', object => $hold->reserve_id })->next; -- 2.39.5