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