Lines 47-53
overdue_notices.pl - prepare messages to be sent to patrons for overdue items
Link Here
|
47 |
|
47 |
|
48 |
=head1 SYNOPSIS |
48 |
=head1 SYNOPSIS |
49 |
|
49 |
|
50 |
overdue_notices.pl [ -n ] [ -library <branchcode> ] [ -library <branchcode>...] [ -max <number of days> ] [ -csv [ <filename> ] ] [ -itemscontent <field list> ] |
50 |
overdue_notices.pl [ -n ] [ -library <branchcode> ] [ -library <branchcode>...] [ -max <number of days> ] [ -csv [ <filename> ] ] [ -itemscontent <field list> ] [ -email <email_type>...] |
51 |
|
51 |
|
52 |
Options: |
52 |
Options: |
53 |
-help brief help message |
53 |
-help brief help message |
Lines 60-65
overdue_notices.pl [ -n ] [ -library <branchcode> ] [ -library <branchcode>...]
Link Here
|
60 |
-itemscontent <list of fields> item information in templates |
60 |
-itemscontent <list of fields> item information in templates |
61 |
-borcat <categorycode> category code that must be included |
61 |
-borcat <categorycode> category code that must be included |
62 |
-borcatout <categorycode> category code that must be excluded |
62 |
-borcatout <categorycode> category code that must be excluded |
|
|
63 |
-email <email_type> type of email that will be used. Can be 'email', 'emailpro' or 'B_email'. Repeatable. |
63 |
|
64 |
|
64 |
=head1 OPTIONS |
65 |
=head1 OPTIONS |
65 |
|
66 |
|
Lines 143-148
Default items.content lists only those items that fall in the
Link Here
|
143 |
range of the currently processing notice. |
144 |
range of the currently processing notice. |
144 |
Choose list-all to include all overdue items in the list (limited by B<-max> setting). |
145 |
Choose list-all to include all overdue items in the list (limited by B<-max> setting). |
145 |
|
146 |
|
|
|
147 |
=item B<-email> |
148 |
|
149 |
Allows to specify which type of email will be used. Can be email, emailpro or B_email. Repeatable. |
150 |
|
146 |
=back |
151 |
=back |
147 |
|
152 |
|
148 |
=head1 DESCRIPTION |
153 |
=head1 DESCRIPTION |
Lines 252-257
my $verbose = 0;
Link Here
|
252 |
my $nomail = 0; |
257 |
my $nomail = 0; |
253 |
my $MAX = 90; |
258 |
my $MAX = 90; |
254 |
my @branchcodes; # Branch(es) passed as parameter |
259 |
my @branchcodes; # Branch(es) passed as parameter |
|
|
260 |
my @emails_to_use; # Emails to use for messaging |
261 |
my @emails; # Emails given in command-line parameters |
255 |
my $csvfilename; |
262 |
my $csvfilename; |
256 |
my $htmlfilename; |
263 |
my $htmlfilename; |
257 |
my $triggered = 0; |
264 |
my $triggered = 0; |
Lines 274-279
GetOptions(
Link Here
|
274 |
't|triggered' => \$triggered, |
281 |
't|triggered' => \$triggered, |
275 |
'borcat=s' => \@myborcat, |
282 |
'borcat=s' => \@myborcat, |
276 |
'borcatout=s' => \@myborcatout, |
283 |
'borcatout=s' => \@myborcatout, |
|
|
284 |
'email=s' => \@emails, |
277 |
) or pod2usage(2); |
285 |
) or pod2usage(2); |
278 |
pod2usage(1) if $help; |
286 |
pod2usage(1) if $help; |
279 |
pod2usage( -verbose => 2 ) if $man; |
287 |
pod2usage( -verbose => 2 ) if $man; |
Lines 458-463
END_SQL
Link Here
|
458 |
$address1, $address2, $city, $postcode, $country, $email, |
466 |
$address1, $address2, $city, $postcode, $country, $email, |
459 |
$longest_issue ) = $sth->fetchrow ) |
467 |
$longest_issue ) = $sth->fetchrow ) |
460 |
{ |
468 |
{ |
|
|
469 |
@emails_to_use = (); |
470 |
if (@emails && !$nomail) { |
471 |
my $validemails = C4::Members::GetValidEmailAddresses($borrowernumber); |
472 |
foreach (@emails) { |
473 |
push @emails_to_use, $validemails->{$_} if (defined $validemails->{$_}); |
474 |
} |
475 |
$email = 1 if (@emails_to_use); |
476 |
} else { |
477 |
$email=C4::Members::GetFirstValidEmailAddress($borrowernumber); |
478 |
push @emails_to_use, $email; |
479 |
} |
480 |
|
461 |
$verbose and warn "borrower $firstname, $lastname ($borrowernumber) has $itemcount items triggering level $i."; |
481 |
$verbose and warn "borrower $firstname, $lastname ($borrowernumber) has $itemcount items triggering level $i."; |
462 |
|
482 |
|
463 |
my $letter = C4::Letters::getletter( 'circulation', $overdue_rules->{"letter$i"} ); |
483 |
my $letter = C4::Letters::getletter( 'circulation', $overdue_rules->{"letter$i"} ); |
Lines 539-550
END_SQL
Link Here
|
539 |
} |
559 |
} |
540 |
); |
560 |
); |
541 |
} else { |
561 |
} else { |
542 |
if ($email) { |
562 |
if (scalar(@emails_to_use) > 0 ) { |
543 |
C4::Letters::EnqueueLetter( |
563 |
C4::Letters::EnqueueLetter( |
544 |
{ letter => $letter, |
564 |
{ letter => $letter, |
545 |
borrowernumber => $borrowernumber, |
565 |
borrowernumber => $borrowernumber, |
546 |
message_transport_type => 'email', |
566 |
message_transport_type => 'email', |
547 |
from_address => $admin_email_address, |
567 |
from_address => $admin_email_address, |
|
|
568 |
to_address => join(',', @emails_to_use), |
548 |
} |
569 |
} |
549 |
); |
570 |
); |
550 |
} else { |
571 |
} else { |
551 |
- |
|
|