@@ -, +, @@ to have guarantees --- Koha/Patron.pm | 4 ++-- t/db_dependent/Koha/Patrons.t | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) --- a/Koha/Patron.pm +++ a/Koha/Patron.pm @@ -1982,13 +1982,13 @@ sub is_superlibrarian { my $is_adult = $patron->is_adult -Return true if the patron has a category with a type Adult (A) or Organization (I) +Return true if the patron has a category with a type Adult (A), Organization (I) or Staff (S) =cut sub is_adult { my ( $self ) = @_; - return $self->category->category_type =~ /^(A|I)$/ ? 1 : 0; + return $self->category->category_type =~ /^(A|I|S)$/ ? 1 : 0; } =head3 is_child --- a/t/db_dependent/Koha/Patrons.t +++ a/t/db_dependent/Koha/Patrons.t @@ -1414,7 +1414,7 @@ subtest 'account_locked' => sub { }; subtest 'is_child | is_adult' => sub { - plan tests => 8; + plan tests => 10; my $category = $builder->build_object( { class => 'Koha::Patron::Categories', @@ -1463,21 +1463,36 @@ subtest 'is_child | is_adult' => sub { value => { categorycode => $category->categorycode } } ); + $category = $builder->build_object( + { + class => 'Koha::Patron::Categories', + value => { category_type => 'S' } + } + ); + my $patron_staff = $builder->build_object( + { + class => 'Koha::Patrons', + value => { categorycode => $category->categorycode } + } + ); is( $patron_adult->is_adult, 1, 'Patron from category A should be considered adult' ); is( $patron_adult_i->is_adult, 1, 'Patron from category I should be considered adult' ); is( $patron_child->is_adult, 0, 'Patron from category C should not be considered adult' ); is( $patron_other->is_adult, 0, 'Patron from category O should not be considered adult' ); + is( $patron_staff->is_adult, 1, 'Patron from category S should be considered adult' ); is( $patron_adult->is_child, 0, 'Patron from category A should be considered child' ); is( $patron_adult_i->is_child, 0, 'Patron from category I should be considered child' ); is( $patron_child->is_child, 1, 'Patron from category C should not be considered child' ); is( $patron_other->is_child, 0, 'Patron from category O should not be considered child' ); + is( $patron_staff->is_child, 0, 'Patron from category S should not be considered child' ); # Clean up $patron_adult->delete; $patron_adult_i->delete; $patron_child->delete; $patron_other->delete; + $patron_staff->delete; }; subtest 'overdues' => sub { --