|
Lines 1329-1339
sub generic_confirm {
Link Here
|
| 1329 |
my $to = $params->{partners}; |
1329 |
my $to = $params->{partners}; |
| 1330 |
if ( defined $to ) { |
1330 |
if ( defined $to ) { |
| 1331 |
$to =~ s/^\x00//; # Strip leading NULLs |
1331 |
$to =~ s/^\x00//; # Strip leading NULLs |
| 1332 |
$to =~ s/\x00/; /; # Replace others with '; ' |
|
|
| 1333 |
} |
1332 |
} |
| 1334 |
Koha::Exceptions::Ill::NoTargetEmail->throw( |
1333 |
Koha::Exceptions::Ill::NoTargetEmail->throw( |
| 1335 |
"No target email addresses found. Either select at least one partner or check your ILL partner library records.") |
1334 |
"No target email addresses found. Either select at least one partner or check your ILL partner library records.") |
| 1336 |
if ( !$to ); |
1335 |
if ( !$to ); |
|
|
1336 |
|
| 1337 |
# Take the null delimited string that we receive and create |
| 1338 |
# an array of associated patron objects |
| 1339 |
my @to_patrons = map { |
| 1340 |
Koha::Patrons->find({ borrowernumber => $_ }) |
| 1341 |
} split(/\x00/, $to); |
| 1342 |
|
| 1337 |
# Create the from, replyto and sender headers |
1343 |
# Create the from, replyto and sender headers |
| 1338 |
my $from = $branch->from_email_address; |
1344 |
my $from = $branch->from_email_address; |
| 1339 |
my $replyto = $branch->inbound_ill_address; |
1345 |
my $replyto = $branch->inbound_ill_address; |
|
Lines 1350-1374
sub generic_confirm {
Link Here
|
| 1350 |
$letter->{title} = $params->{subject}; |
1356 |
$letter->{title} = $params->{subject}; |
| 1351 |
$letter->{content} = $params->{body}; |
1357 |
$letter->{content} = $params->{body}; |
| 1352 |
|
1358 |
|
| 1353 |
# Queue the notice |
|
|
| 1354 |
my $params = { |
| 1355 |
letter => $letter, |
| 1356 |
borrowernumber => $self->borrowernumber, |
| 1357 |
message_transport_type => 'email', |
| 1358 |
to_address => $to, |
| 1359 |
from_address => $from, |
| 1360 |
reply_address => $replyto |
| 1361 |
}; |
| 1362 |
|
| 1363 |
if ($letter) { |
1359 |
if ($letter) { |
| 1364 |
my $result = C4::Letters::EnqueueLetter($params); |
1360 |
|
| 1365 |
if ( $result ) { |
1361 |
# Keep track of who received this notice |
|
|
1362 |
my @queued = (); |
| 1363 |
# Iterate our array of recipient patron objects |
| 1364 |
foreach my $patron(@to_patrons) { |
| 1365 |
# Create the params we pass to the notice |
| 1366 |
my $params = { |
| 1367 |
letter => $letter, |
| 1368 |
borrowernumber => $patron->borrowernumber, |
| 1369 |
message_transport_type => 'email', |
| 1370 |
to_address => $patron->email, |
| 1371 |
from_address => $from, |
| 1372 |
reply_address => $replyto |
| 1373 |
}; |
| 1374 |
my $result = C4::Letters::EnqueueLetter($params); |
| 1375 |
if ( $result ) { |
| 1376 |
push @queued, $patron->email; |
| 1377 |
} |
| 1378 |
} |
| 1379 |
|
| 1380 |
# If all notices were queued successfully, |
| 1381 |
# store that |
| 1382 |
if (scalar @queued == scalar @to_patrons) { |
| 1366 |
$self->status("GENREQ")->store; |
1383 |
$self->status("GENREQ")->store; |
| 1367 |
$self->_backend_capability( |
1384 |
$self->_backend_capability( |
| 1368 |
'set_requested_partners', |
1385 |
'set_requested_partners', |
| 1369 |
{ |
1386 |
{ |
| 1370 |
request => $self, |
1387 |
request => $self, |
| 1371 |
to => $to |
1388 |
to => join("; ", @queued) |
| 1372 |
} |
1389 |
} |
| 1373 |
); |
1390 |
); |
| 1374 |
return { |
1391 |
return { |
|
Lines 1380-1385
sub generic_confirm {
Link Here
|
| 1380 |
next => 'illview', |
1397 |
next => 'illview', |
| 1381 |
}; |
1398 |
}; |
| 1382 |
} |
1399 |
} |
|
|
1400 |
|
| 1383 |
} |
1401 |
} |
| 1384 |
return { |
1402 |
return { |
| 1385 |
error => 1, |
1403 |
error => 1, |