View | Details | Raw Unified | Return to bug 30214
Collapse All | Expand All

(-)a/opac/opac-registration-verify.pl (-1 / +34 lines)
Lines 21-26 use CGI qw ( -utf8 ); Link Here
21
21
22
use C4::Auth qw( get_template_and_user );
22
use C4::Auth qw( get_template_and_user );
23
use C4::Output qw( output_html_with_http_headers );
23
use C4::Output qw( output_html_with_http_headers );
24
use C4::Letters qw( GetPreparedLetter EnqueueLetter SendQueuedMessages );
24
use C4::Members;
25
use C4::Members;
25
use C4::Form::MessagingPreferences;
26
use C4::Form::MessagingPreferences;
26
use Koha::AuthUtils;
27
use Koha::AuthUtils;
Lines 76-81 if ( Link Here
76
77
77
        $template->param( password_cleartext => $patron->plain_text_password );
78
        $template->param( password_cleartext => $patron->plain_text_password );
78
        $template->param( borrower => $patron );
79
        $template->param( borrower => $patron );
80
81
        # If 'AutoEmailOpacUser' syspref is on, email user their account details from the 'notice' that matches the user's branchcode.
82
        if ( C4::Context->preference("AutoEmailOpacUser") ) {
83
            #look for defined primary email address, if blank - attempt to use borr.email and borr.emailpro instead
84
            my $emailaddr = $patron->notice_email_address;
85
            # if we manage to find a valid email address, send notice
86
            if ($emailaddr) {
87
                eval {
88
                    my $letter = GetPreparedLetter(
89
                        module      => 'members',
90
                        letter_code => 'ACCTDETAILS',
91
                        branchcode  => $patron->branchcode,,
92
                        lang        => $patron->lang || 'default',
93
                        tables      => {
94
                            'branches'  => $patron->branchcode,
95
                            'borrowers' => $patron->borrowernumber,
96
                        },
97
                        want_librarian => 1,
98
                    ) or return;
99
100
                    my $message_id = EnqueueLetter(
101
                        {
102
                            letter                 => $letter,
103
                            borrowernumber         => $patron->id,
104
                            to_address             => $emailaddr,
105
                            message_transport_type => 'email'
106
                        }
107
                    );
108
                    SendQueuedMessages({ message_id => $message_id });
109
                };
110
            }
111
        }
112
79
        $template->param(
113
        $template->param(
80
            PatronSelfRegistrationAdditionalInstructions =>
114
            PatronSelfRegistrationAdditionalInstructions =>
81
              C4::Context->preference(
115
              C4::Context->preference(
82
- 

Return to bug 30214