Bug 42645: Use notice_email_address in ModSuggestion SMS fallback check

The FallbackToSMSIfNoEmail transport selection in ModSuggestion() was
checking $patron->email (the raw borrowers.email column) rather than
$patron->notice_email_address, which respects the EmailFieldPrimary and
EmailFieldPrecedence system preferences. Patrons with only emailpro or
B_email set were incorrectly receiving suggestion status-change notices
via SMS even when a valid email address was available.

Sponsored-by: OpenFifth <https://openfifth.co.uk/>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Martin Renvoize 2026-05-19 16:40:34 +01:00 committed by Pedro Amorim
parent c0477bc9f1
commit 57e110ee2c
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
1 changed files with 1 additions and 1 deletions

View File

@ -106,7 +106,7 @@ sub ModSuggestion {
my $transport = my $transport =
( C4::Context->preference("FallbackToSMSIfNoEmail") ) ( C4::Context->preference("FallbackToSMSIfNoEmail") )
&& ( $patron->smsalertnumber ) && ( $patron->smsalertnumber )
&& ( !$patron->email ) ? 'sms' : 'email'; && ( !$patron->notice_email_address ) ? 'sms' : 'email';
if ( if (
my $letter = C4::Letters::GetPreparedLetter( my $letter = C4::Letters::GetPreparedLetter(