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

(-)a/Koha/Patron/Category.pm (+7 lines)
Lines 35-40 Koha::Patron;;Category - Koha Patron;;Category Object class Link Here
35
35
36
=cut
36
=cut
37
37
38
sub store {
39
    my ( $self ) = @_;
40
    $self->checkprevcheckout('inherit')
41
        unless defined $self->checkprevcheckout;
42
    return $self->SUPER::store;
43
}
44
38
=head3 default_messaging
45
=head3 default_messaging
39
46
40
my $messaging = $category->default_messaging();
47
my $messaging = $category->default_messaging();
(-)a/t/db_dependent/Koha/Patron/Categories.t (-2 / +6 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 5;
22
use Test::More tests => 7;
23
23
24
use Koha::Database;
24
use Koha::Database;
25
use Koha::Patron::Category;
25
use Koha::Patron::Category;
Lines 40-45 $new_category_1->add_branch_limitation( $branch->{branchcode} ); Link Here
40
my $new_category_2 = Koha::Patron::Category->new({
40
my $new_category_2 = Koha::Patron::Category->new({
41
    categorycode => 'mycatcodeY',
41
    categorycode => 'mycatcodeY',
42
    description  => 'mycatdescY',
42
    description  => 'mycatdescY',
43
    checkprevcheckout => undef,
43
})->store;
44
})->store;
44
45
45
is( Koha::Patron::Categories->search->count, $nb_of_categories + 2, 'The 2 patron categories should have been added' );
46
is( Koha::Patron::Categories->search->count, $nb_of_categories + 2, 'The 2 patron categories should have been added' );
Lines 49-54 is( $retrieved_category_1->categorycode, $new_category_1->categorycode, 'Find a Link Here
49
is_deeply( $retrieved_category_1->branch_limitations, [ $branch->{branchcode} ], 'The branch limitation should have been stored and retrieved' );
50
is_deeply( $retrieved_category_1->branch_limitations, [ $branch->{branchcode} ], 'The branch limitation should have been stored and retrieved' );
50
is_deeply( $retrieved_category_1->default_messaging, [], 'By default there is not messaging option' );
51
is_deeply( $retrieved_category_1->default_messaging, [], 'By default there is not messaging option' );
51
52
53
my $retrieved_category_2 = Koha::Patron::Categories->find( $new_category_2->categorycode );
54
is( $retrieved_category_1->checkprevcheckout, 'inherit', 'Koha::Patron::Category->store should default checkprevcheckout to inherit' );
55
is( $retrieved_category_2->checkprevcheckout, 'inherit', 'Koha::Patron::Category->store should default checkprevcheckout to inherit' );
56
52
$retrieved_category_1->delete;
57
$retrieved_category_1->delete;
53
is( Koha::Patron::Categories->search->count, $nb_of_categories + 1, 'Delete should have deleted the patron category' );
58
is( Koha::Patron::Categories->search->count, $nb_of_categories + 1, 'Delete should have deleted the patron category' );
54
59
55
- 

Return to bug 17069