From eca0fcb083fb6c55df609614fdbc889dae8a4a45 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 16 Jul 2025 12:39:23 +0200 Subject: [PATCH] Bug 40410: Remove warning from Letters. t/db_dependent/Letters.t .. 95/104 Use of uninitialized value in string eq at /kohadevbox/koha/Koha/Patron.pm line 389. contactname can be NULL in DB. --- Koha/Patron.pm | 2 +- t/db_dependent/Letters.t | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Koha/Patron.pm b/Koha/Patron.pm index e5713dfe710..84e7d2babba 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 4edf7c80f58..5cdf9b289d3 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; -- 2.34.1