From 1be5bf75d39e19c988581bb32394cd9ec6867e36 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. Signed-off-by: David Nind Signed-off-by: Martin Renvoize Signed-off-by: Lucas Gass (cherry picked from commit 45493d0f06cfdeadce89e2e90f0c47090deaa46b) Signed-off-by: Paul Derscheid (cherry picked from commit 1f2dffb43f40033ccfbac724b1e83d1b74827100) Signed-off-by: Fridolin Somers --- 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 12c5357a3a..601a23812d 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -379,7 +379,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 a1526f8e22..0816544827 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;