=cut
+sub store {
+ my ( $self ) = @_;
+ $self->checkprevcheckout('inherit')
+ unless defined $self->checkprevcheckout;
+ return $self->SUPER::store;
+}
+
=head3 default_messaging
my $messaging = $category->default_messaging();
use Modern::Perl;
-use Test::More tests => 5;
+use Test::More tests => 7;
use Koha::Database;
use Koha::Patron::Category;
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' );
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' );