Bugzilla – Attachment 67137 Details for
Bug 19303
Move C4::Members::GetFirstValidEmailAddress to Koha::Patron->first_valid_email_address
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19303: Move C4::Members::GetFirstValidEmailAddress to Koha::Patron->first_valid_email_address
Bug-19303-Move-C4MembersGetFirstValidEmailAddress-.patch (text/plain), 3.78 KB, created by
Jonathan Druart
on 2017-09-14 14:19:17 UTC
(
hide
)
Description:
Bug 19303: Move C4::Members::GetFirstValidEmailAddress to Koha::Patron->first_valid_email_address
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-09-14 14:19:17 UTC
Size:
3.78 KB
patch
obsolete
>From dc8e9f363823041824aa5463c0ca969ad4d5f0e7 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 12 Sep 2017 15:28:07 -0300 >Subject: [PATCH] Bug 19303: Move C4::Members::GetFirstValidEmailAddress to > Koha::Patron->first_valid_email_address > >This new Koha::Patron->first_valid_email_address already exists, it >should be called directly > >Test plan: >- With a logged in user who have an email address defined, send a basket. >The email should be marked sent by this email address > >- On the "Holds awaiting pickup", the email address must be displayed as well >--- > C4/Members.pm | 22 ++-------------------- > Koha/Patron.pm | 6 ++++++ > circ/waitingreserves.pl | 2 +- > opac/opac-sendbasket.pl | 2 +- > 4 files changed, 10 insertions(+), 22 deletions(-) > >diff --git a/C4/Members.pm b/C4/Members.pm >index f31ef8d40c..2179ed47e1 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -64,7 +64,6 @@ BEGIN { > &GetPendingIssues > &GetAllIssues > >- &GetFirstValidEmailAddress > &GetNoticeEmailAddress > > &GetMemberAccountRecords >@@ -918,24 +917,6 @@ sub get_cardnumber_length { > return ( $min, $max ); > } > >-=head2 GetFirstValidEmailAddress >- >- $email = GetFirstValidEmailAddress($borrowernumber); >- >-Return the first valid email address for a borrower, given the borrowernumber. For now, the order >-is defined as email, emailpro, B_email. Returns the empty string if the borrower has no email >-addresses. >- >-=cut >- >-sub GetFirstValidEmailAddress { >- my $borrowernumber = shift; >- >- my $borrower = Koha::Patrons->find( $borrowernumber ); >- >- return $borrower->first_valid_email_address(); >-} >- > =head2 GetNoticeEmailAddress > > $email = GetNoticeEmailAddress($borrowernumber); >@@ -951,7 +932,8 @@ sub GetNoticeEmailAddress { > my $which_address = C4::Context->preference("AutoEmailPrimaryAddress"); > # if syspref is set to 'first valid' (value == OFF), look up email address > if ( $which_address eq 'OFF' ) { >- return GetFirstValidEmailAddress($borrowernumber); >+ my $patron = Koha::Patrons->find( $borrowernumber ); >+ return $patron->first_valid_email_address(); > } > # specified email address field > my $dbh = C4::Context->dbh; >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index f7970eacf9..3c4b727e23 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -593,6 +593,12 @@ sub holds { > > =head3 first_valid_email_address > >+my $first_valid_email_address = $patron->first_valid_email_address >+ >+Return the first valid email address for a patron. >+For now, the order is defined as email, emailpro, B_email. >+Returns the empty string if the borrower has no email addresses. >+ > =cut > > sub first_valid_email_address { >diff --git a/circ/waitingreserves.pl b/circ/waitingreserves.pl >index 8527f2df9f..e33898fdaf 100755 >--- a/circ/waitingreserves.pl >+++ b/circ/waitingreserves.pl >@@ -131,7 +131,7 @@ foreach my $num (@getreserves) { > $getreserv{'borrowerfirstname'} = $patron->firstname; > $getreserv{'borrowerphone'} = $patron->phone; > >- my $borEmail = GetFirstValidEmailAddress( $borrowernum ); >+ my $borEmail = $patron->first_valid_email_address; > > if ( $borEmail ) { > $getreserv{'borrowermail'} = $borEmail; >diff --git a/opac/opac-sendbasket.pl b/opac/opac-sendbasket.pl >index c51e8c434d..6ae9dfe938 100755 >--- a/opac/opac-sendbasket.pl >+++ b/opac/opac-sendbasket.pl >@@ -59,7 +59,7 @@ if ( $email_add ) { > }); > my $email = Koha::Email->new(); > my $patron = Koha::Patrons->find( $borrowernumber ); >- my $user_email = GetFirstValidEmailAddress($borrowernumber) >+ my $user_email = $patron->first_valid_email_address > || C4::Context->preference('KohaAdminEmailAddress'); > > my $email_replyto = $patron->firstname . " " . $patron->surname . " <$user_email>"; >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 19303
:
67125
|
67137
|
68107
|
70221