Lines 182-209
if ( $action eq 'create' ) {
Link Here
|
182 |
|
182 |
|
183 |
Koha::Patron::Modification->new( \%borrower )->store(); |
183 |
Koha::Patron::Modification->new( \%borrower )->store(); |
184 |
|
184 |
|
185 |
#Send verification email |
185 |
my $verificationrecipient = C4::Context->preference("PatronSelfRegistrationVerificationRecipient"); |
186 |
my $letter = C4::Letters::GetPreparedLetter( |
186 |
my $customverificationrecipient = C4::Context->preference("PatronSelfRegistrationVerificationRecipientAddress"); |
187 |
module => 'members', |
187 |
# Determine the 'to_address' of the verification email |
188 |
letter_code => 'OPAC_REG_VERIFY', |
188 |
my $toaddress; |
189 |
lang => 'default', # Patron does not have a preferred language defined yet |
189 |
if ($verificationrecipient eq "BranchEmailAddress" ) { |
190 |
tables => { |
190 |
my $library = Koha::Libraries->find( $borrower{branchcode} ); |
191 |
borrower_modifications => $verification_token, |
191 |
$toaddress = $library->branchreplyto |
192 |
}, |
192 |
|| $library->branchemail |
193 |
); |
193 |
|| C4::Context->preferences('ReplytoDefault') |
|
|
194 |
|| C4::Context->preferences('KohaAdminEmailAddress') |
195 |
} |
196 |
elsif ( $verificationrecipient eq "KohaAdminEmailAddress" ) { |
197 |
$toaddress = C4::Context->preference('ReplytoDefault') |
198 |
|| C4::Context->preference('KohaAdminEmailAddress'); |
199 |
|
200 |
} elsif ( $verificationrecipient eq "RegisteringPatron" ) { |
201 |
$toaddress = $borrower{'email'} |
202 |
} else { |
203 |
$toaddress = |
204 |
$customverificationrecipient |
205 |
|| C4::Context->preference('ReplytoDefault') |
206 |
|| C4::Context->preference('KohaAdminEmailAddress'); |
207 |
} |
208 |
$template->param( verificationrecipient => $verificationrecipient ); |
209 |
|
210 |
my $letter; |
211 |
if ($verificationrecipient eq "RegisteringPatron" ) { |
212 |
# Send verification email directly to registering patron |
213 |
$letter = C4::Letters::GetPreparedLetter( |
214 |
module => 'members', |
215 |
letter_code => 'OPAC_REG_VERIFY', |
216 |
lang => 'default', # Patron does not have a preferred language defined yet |
217 |
tables => { |
218 |
borrower_modifications => $verification_token, |
219 |
}, |
220 |
); |
221 |
} else { |
222 |
# Send verification email to library |
223 |
$letter = C4::Letters::GetPreparedLetter( |
224 |
module => 'members', |
225 |
letter_code => 'STAFF_VER_OPAC_REG', |
226 |
lang => 'default', # Patron does not have a preferred language defined yet |
227 |
tables => { |
228 |
borrower_modifications => $verification_token, |
229 |
}, |
230 |
); |
231 |
} |
194 |
|
232 |
|
195 |
C4::Letters::EnqueueLetter( |
233 |
C4::Letters::EnqueueLetter( |
196 |
{ |
234 |
{ |
197 |
letter => $letter, |
235 |
letter => $letter, |
198 |
message_transport_type => 'email', |
236 |
message_transport_type => 'email', |
199 |
to_address => $borrower{'email'}, |
237 |
to_address => $toaddress, |
200 |
from_address => |
238 |
from_address => |
201 |
C4::Context->preference('KohaAdminEmailAddress'), |
239 |
C4::Context->preference('KohaAdminEmailAddress'), |
202 |
} |
240 |
} |
203 |
); |
241 |
); |
204 |
my $num_letters_attempted = C4::Letters::SendQueuedMessages( { |
242 |
if ($verificationrecipient eq "RegisteringPatron") { |
|
|
243 |
my $num_letters_attempted = C4::Letters::SendQueuedMessages( { |
205 |
letter_code => 'OPAC_REG_VERIFY' |
244 |
letter_code => 'OPAC_REG_VERIFY' |
206 |
} ); |
245 |
} ); |
|
|
246 |
} else { |
247 |
my $num_letters_attempted = C4::Letters::SendQueuedMessages( { |
248 |
letter_code => 'STAFF_VER_OPAC_REG' |
249 |
} ); |
250 |
} |
207 |
} |
251 |
} |
208 |
else { |
252 |
else { |
209 |
( $template, $borrowernumber, $cookie ) = get_template_and_user( |
253 |
( $template, $borrowernumber, $cookie ) = get_template_and_user( |