diff --git a/Koha/Patron.pm b/Koha/Patron.pm index ecfe7d40bb..203fa212c3 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -388,7 +388,7 @@ sub store { if ( C4::Context->preference('ChildNeedsGuarantor') and ( $self->is_child or $self->category->can_be_guarantee ) - and $self->contactname eq "" + and ( !defined $self->contactname || $self->contactname eq "" ) and !@$guarantors ) { Koha::Exceptions::Patron::Relationship::NoGuarantor->throw(); diff --git a/t/db_dependent/Letters.t b/t/db_dependent/Letters.t index 4edf7c80f5..5cdf9b289d 100755 --- a/t/db_dependent/Letters.t +++ b/t/db_dependent/Letters.t @@ -19,7 +19,8 @@ use Modern::Perl; use File::Basename qw(dirname); -use Test::More tests => 104; +use Test::More tests => 105; +use Test::NoWarnings; use Test::MockModule; use Test::Warn;