@@ -, +, @@ default checkprevcheckout to 'inherit' --- Koha/Patron/Category.pm | 7 +++++++ t/db_dependent/Koha/Patron/Categories.t | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) --- a/Koha/Patron/Category.pm +++ a/Koha/Patron/Category.pm @@ -35,6 +35,13 @@ Koha::Patron;;Category - Koha Patron;;Category Object class =cut +sub store { + my ( $self ) = @_; + $self->checkprevcheckout('inherit') + unless defined $self->checkprevcheckout; + return $self->SUPER::store; +} + =head3 default_messaging my $messaging = $category->default_messaging(); --- a/t/db_dependent/Koha/Patron/Categories.t +++ a/t/db_dependent/Koha/Patron/Categories.t @@ -19,7 +19,7 @@ use Modern::Perl; -use Test::More tests => 5; +use Test::More tests => 7; use Koha::Database; use Koha::Patron::Category; @@ -40,6 +40,7 @@ $new_category_1->add_branch_limitation( $branch->{branchcode} ); my $new_category_2 = Koha::Patron::Category->new({ categorycode => 'mycatcodeY', description => 'mycatdescY', + checkprevcheckout => undef, })->store; is( Koha::Patron::Categories->search->count, $nb_of_categories + 2, 'The 2 patron categories should have been added' ); @@ -49,6 +50,10 @@ is( $retrieved_category_1->categorycode, $new_category_1->categorycode, 'Find a is_deeply( $retrieved_category_1->branch_limitations, [ $branch->{branchcode} ], 'The branch limitation should have been stored and retrieved' ); is_deeply( $retrieved_category_1->default_messaging, [], 'By default there is not messaging option' ); +my $retrieved_category_2 = Koha::Patron::Categories->find( $new_category_2->categorycode ); +is( $retrieved_category_1->checkprevcheckout, 'inherit', 'Koha::Patron::Category->store should default checkprevcheckout to inherit' ); +is( $retrieved_category_2->checkprevcheckout, 'inherit', 'Koha::Patron::Category->store should default checkprevcheckout to inherit' ); + $retrieved_category_1->delete; is( Koha::Patron::Categories->search->count, $nb_of_categories + 1, 'Delete should have deleted the patron category' ); --