View | Details | Raw Unified | Return to bug 17578
Collapse All | Expand All

(-)a/Koha/Patron/Category.pm (+14 lines)
Lines 36-41 Koha::Patron;;Category - Koha Patron;;Category Object class Link Here
36
36
37
=cut
37
=cut
38
38
39
=head3 effective_BlockExpiredPatronOpacActions
40
41
my $BlockExpiredPatronOpacActions = $category->effective_BlockExpiredPatronOpacActions
42
43
Return the effective BlockExpiredPatronOpacActions value.
44
45
=cut
46
47
sub effective_BlockExpiredPatronOpacActions {
48
    my( $self) = @_;
49
    return C4::Context->preference('BlockExpiredPatronOpacActions') if $self->BlockExpiredPatronOpacActions == -1;
50
    return $self->BlockExpiredPatronOpacActions
51
}
52
39
=head3 default_messaging
53
=head3 default_messaging
40
54
41
my $messaging = $category->default_messaging();
55
my $messaging = $category->default_messaging();
(-)a/t/db_dependent/Koha/Patron/Categories.t (-2 / +18 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 8;
22
use Test::More tests => 9;
23
23
24
use C4::Context;
24
use C4::Context;
25
use Koha::Database;
25
use Koha::Database;
Lines 27-32 use Koha::DateUtils; Link Here
27
use Koha::Patron::Category;
27
use Koha::Patron::Category;
28
use Koha::Patron::Categories;
28
use Koha::Patron::Categories;
29
use t::lib::TestBuilder;
29
use t::lib::TestBuilder;
30
use t::lib::Mocks;
30
31
31
my $schema = Koha::Database->new->schema;
32
my $schema = Koha::Database->new->schema;
32
$schema->storage->txn_begin;
33
$schema->storage->txn_begin;
Lines 83-88 subtest 'get_expiry_date' => sub { Link Here
83
    $category->delete;
84
    $category->delete;
84
};
85
};
85
86
87
subtest 'BlockExpiredPatronOpacActions' => sub {
88
    plan tests => 2;
89
    t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 42);
90
    my $category = Koha::Patron::Category->new({
91
        categorycode => 'ya_cat',
92
        category_type => 'A',
93
        description  => 'yacatdesc',
94
        enrolmentperiod => undef,
95
        BlockExpiredPatronOpacActions => -1,
96
    })->store;
97
    is( $category->effective_BlockExpiredPatronOpacActions, 42 );
98
    $category->BlockExpiredPatronOpacActions(24)->store;
99
    is( $category->effective_BlockExpiredPatronOpacActions, 24 );
100
    $category->delete;
101
};
102
86
$retrieved_category_1->delete;
103
$retrieved_category_1->delete;
87
is( Koha::Patron::Categories->search->count, $nb_of_categories + 1, 'Delete should have deleted the patron category' );
104
is( Koha::Patron::Categories->search->count, $nb_of_categories + 1, 'Delete should have deleted the patron category' );
88
105
89
- 

Return to bug 17578