Lines 23-28
use C4::Context;
Link Here
|
23 |
use Koha::AuthUtils qw( get_script_name ); |
23 |
use Koha::AuthUtils qw( get_script_name ); |
24 |
use Koha::Database; |
24 |
use Koha::Database; |
25 |
use Koha::Patrons; |
25 |
use Koha::Patrons; |
|
|
26 |
use C4::Letters qw( GetPreparedLetter EnqueueLetter ); |
26 |
use C4::Members::Messaging; |
27 |
use C4::Members::Messaging; |
27 |
use Carp qw( carp ); |
28 |
use Carp qw( carp ); |
28 |
use List::MoreUtils qw( any ); |
29 |
use List::MoreUtils qw( any ); |
Lines 134-141
sub _autocreate {
Link Here
|
134 |
} |
135 |
} |
135 |
|
136 |
|
136 |
my $patron = Koha::Patron->new( \%borrower )->store; |
137 |
my $patron = Koha::Patron->new( \%borrower )->store; |
137 |
C4::Members::Messaging::SetMessagingPreferencesFromDefaults( { borrowernumber => $patron->borrowernumber, categorycode => $patron->categorycode } ); |
138 |
C4::Members::Messaging::SetMessagingPreferencesFromDefaults( |
138 |
|
139 |
{ |
|
|
140 |
borrowernumber => $patron->borrowernumber, |
141 |
categorycode => $patron->categorycode |
142 |
} |
143 |
); |
144 |
|
145 |
# Send welcome email if enabled |
146 |
if ( $config->{welcome} ) { |
147 |
my $emailaddr = $patron->notice_email_address; |
148 |
|
149 |
# if we manage to find a valid email address, send notice |
150 |
if ($emailaddr) { |
151 |
my $letter = C4::Letters::GetPreparedLetter( |
152 |
module => 'members', |
153 |
letter_code => 'WELCOME', |
154 |
branchcode => $patron->branchcode, |
155 |
, |
156 |
lang => $patron->lang || 'default', |
157 |
tables => { |
158 |
'branches' => $patron->branchcode, |
159 |
'borrowers' => $patron->borrowernumber, |
160 |
}, |
161 |
want_librarian => 1, |
162 |
) or return; |
163 |
|
164 |
my $message_id = C4::Letters::EnqueueLetter( |
165 |
{ |
166 |
letter => $letter, |
167 |
borrowernumber => $patron->id, |
168 |
to_address => $emailaddr, |
169 |
message_transport_type => 'email' |
170 |
} |
171 |
); |
172 |
} |
173 |
} |
139 |
return ( 1, $patron->cardnumber, $patron->userid ); |
174 |
return ( 1, $patron->cardnumber, $patron->userid ); |
140 |
} |
175 |
} |
141 |
|
176 |
|
142 |
- |
|
|