diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t index 24d5909d82..d23db86b5e 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -157,7 +157,7 @@ my $patron_category = $builder->build( value => { category_type => 'P', enrolmentfee => 0, - BlockExpiredPatronOpacActions => -1, # Pick the pref value + BlockExpiredPatronOpacActions => 'follow_syspref_BlockExpiredPatronOpacActions', } } ); @@ -1340,20 +1340,20 @@ subtest "CanBookBeRenewed tests" => sub { my $ten_days_before = dt_from_string->add( days => -10 ); my $ten_days_ahead = dt_from_string->add( days => 10 ); - # Patron is expired and BlockExpiredPatronOpacActions=0 + # Patron is expired and BlockExpiredPatronOpacActions='' # => auto renew is allowed - t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 0); + t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', ''); my $issue = AddIssue( $expired_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, undef, { auto_renew => 1 } ); ( $renewokay, $error ) = CanBookBeRenewed( $expired_borrower_obj, $issue ); is( $renewokay, 1, 'Renew, even if renewal is automatic' ); - is( $error, 'auto_renew', 'Can auto renew, patron is expired but BlockExpiredPatronOpacActions=0' ); + is( $error, 'auto_renew', 'Can auto renew, patron is expired but BlockExpiredPatronOpacActions=\'\'' ); Koha::Checkouts->find( $issue->issue_id )->delete; - # Patron is expired and BlockExpiredPatronOpacActions=1 + # Patron is expired and BlockExpiredPatronOpacActions='renew' # => auto renew is not allowed - t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 1); + t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 'renew'); $issue = AddIssue( $expired_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, undef, { auto_renew => 1 } ); ( $renewokay, $error ) = CanBookBeRenewed( $expired_borrower_obj, $issue ); @@ -1363,12 +1363,12 @@ subtest "CanBookBeRenewed tests" => sub { # Patron is not expired and BlockExpiredPatronOpacActions=1 # => auto renew is allowed - t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 1); + t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 'renew'); $issue = AddIssue( $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, undef, { auto_renew => 1 } ); ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue ); is( $renewokay, 1, 'Renew, even if renewal is automatic' ); - is( $error, 'auto_renew', 'Can auto renew, BlockExpiredPatronOpacActions=1 but patron is not expired' ); + is( $error, 'auto_renew', 'Can auto renew, BlockExpiredPatronOpacActions=\'renew\' but patron is not expired' ); $issue->delete; }; @@ -1983,7 +1983,7 @@ subtest "AllowRenewalIfOtherItemsAvailable tests" => sub { value => { category_type => 'P', enrolmentfee => 0, - BlockExpiredPatronOpacActions => -1, # Pick the pref value + BlockExpiredPatronOpacActions => 'follow_syspref_BlockExpiredPatronOpacActions', } } ); diff --git a/t/db_dependent/ILSDI_Services.t b/t/db_dependent/ILSDI_Services.t index 442f1c2402..c7e728a3fb 100755 --- a/t/db_dependent/ILSDI_Services.t +++ b/t/db_dependent/ILSDI_Services.t @@ -274,7 +274,7 @@ subtest 'GetPatronInfo/GetBorrowerAttributes test for extended patron attributes source => 'Category', value => { category_type => 'A', - BlockExpiredPatronOpacActions => -1, + BlockExpiredPatronOpacActions => 'follow_syspref_BlockExpiredPatronOpacActions', } } ); @@ -584,7 +584,7 @@ subtest 'Holds test' => sub { # Test Patron cannot reserve if expired and BlockExpiredPatronOpacActions my $category = $builder->build({ source => 'Category', - value => { BlockExpiredPatronOpacActions => -1 } + value => { BlockExpiredPatronOpacActions => 'follow_syspref_BlockExpiredPatronOpacActions' } }); my $branch_1 = $builder->build({ source => 'Branch' })->{ branchcode }; @@ -597,7 +597,7 @@ subtest 'Holds test' => sub { dateexpiry => '2000-01-01', })->store->borrowernumber; - t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 1); + t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 'hold,renew'); my $item5 = $builder->build({ source => 'Item', diff --git a/t/db_dependent/Koha/Object.t b/t/db_dependent/Koha/Object.t index 28ac6e5e94..b1c6bb5172 100755 --- a/t/db_dependent/Koha/Object.t +++ b/t/db_dependent/Koha/Object.t @@ -1049,7 +1049,7 @@ subtest 'unblessed_all_relateds' => sub { value => { category_type => 'P', enrolmentfee => 0, - BlockExpiredPatronOpacActions => -1, # Pick the pref value + BlockExpiredPatronOpacActions => 'follow_syspref_BlockExpiredPatronOpacActions', } } ); diff --git a/t/db_dependent/Koha/Patron/Categories.t b/t/db_dependent/Koha/Patron/Categories.t index 6a7b8bcd6f..b0c13d38a6 100755 --- a/t/db_dependent/Koha/Patron/Categories.t +++ b/t/db_dependent/Koha/Patron/Categories.t @@ -103,18 +103,19 @@ subtest 'get_expiry_date' => sub { }; subtest 'BlockExpiredPatronOpacActions' => sub { - plan tests => 2; - t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 42); + plan tests => 3; + t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 'hold'); my $category = Koha::Patron::Category->new({ categorycode => 'ya_cat', category_type => 'A', description => 'yacatdesc', enrolmentperiod => undef, - BlockExpiredPatronOpacActions => -1, + BlockExpiredPatronOpacActions => 'follow_syspref_BlockExpiredPatronOpacActions', })->store; - is( $category->effective_BlockExpiredPatronOpacActions, 42 ); - $category->BlockExpiredPatronOpacActions(24)->store; - is( $category->effective_BlockExpiredPatronOpacActions, 24 ); + is( $category->effective_BlockExpiredPatronOpacActions_contains('hold'), 1 ); + is( $category->effective_BlockExpiredPatronOpacActions_contains('renew'), undef ); + $category->BlockExpiredPatronOpacActions('renew')->store; + is( $category->effective_BlockExpiredPatronOpacActions_contains('renew'), 1 ); $category->delete; };