View | Details | Raw Unified | Return to bug 30132
Collapse All | Expand All

(-)a/misc/cronjobs/overdue_notices.pl (-46 / +45 lines)
Lines 45-119 overdue_notices.pl - prepare messages to be sent to patrons for overdue items Link Here
45
=head1 SYNOPSIS
45
=head1 SYNOPSIS
46
46
47
overdue_notices.pl
47
overdue_notices.pl
48
  [ -n ][ -library <branchcode> ][ -library <branchcode> ... ]
48
  [ -n ][ --library <branchcode> ][ --library <branchcode> ... ]
49
  [ -max <number of days> ][ -csv [<filename>] ][ -itemscontent <field list> ]
49
  [ --max <number of days> ][ --csv [<filename>] ][ --itemscontent <field list> ]
50
  [ -email <email_type> ... ]
50
  [ --email <email_type> ... ]
51
51
52
 Options:
52
 Options:
53
   -help                          Brief help message.
53
   --help                          Brief help message.
54
   -man                           Full documentation.
54
   --man                           Full documentation.
55
   -v                             Verbose mode.
55
   --verbose | -v                  Verbose mode.
56
   -n                             No email will be sent.
56
   --nomail | -n                   No email will be sent.
57
   -max          <days>           Maximum days overdue to deal with.
57
   --max          <days>           Maximum days overdue to deal with.
58
   -library      <branchcode>     Only deal with overdues from this library.
58
   --library      <branchcode>     Only deal with overdues from this library.
59
                                  (repeatable : several libraries can be given)
59
                                   (repeatable : several libraries can be given)
60
   -csv          <filename>       Populate CSV file.
60
   --csv          <filename>       Populate CSV file.
61
   -html         <directory>      Output html to a file in the given directory.
61
   --html         <directory>      Output html to a file in the given directory.
62
   -text         <directory>      Output plain text to a file in the given directory.
62
   --text         <directory>      Output plain text to a file in the given directory.
63
   -itemscontent <list of fields> Item information in templates.
63
   --itemscontent <list of fields> Item information in templates.
64
   -borcat       <categorycode>   Category code that must be included.
64
   --borcat       <categorycode>   Category code that must be included.
65
   -borcatout    <categorycode>   Category code that must be excluded.
65
   --borcatout    <categorycode>   Category code that must be excluded.
66
   -t                             Only include triggered overdues.
66
   --triggered | -t                Only include triggered overdues.
67
   --test                         Run in test mode. No changes will be made on the DB.
67
   --test                          Run in test mode. No changes will be made on the DB.
68
   -list-all                      List all overdues.
68
   --list-all                      List all overdues.
69
   -date         <yyyy-mm-dd>     Emulate overdues run for this date.
69
   --date         <yyyy-mm-dd>     Emulate overdues run for this date.
70
   -email        <email_type>     Type of email that will be used.
70
   --email        <email_type>     Type of email that will be used.
71
                                  Can be 'email', 'emailpro' or 'B_email'. Repeatable.
71
                                   Can be 'email', 'emailpro' or 'B_email'. Repeatable.
72
   --frombranch                   Set the from address for the notice to one of 'item-homebranch' or 'item-issuebranch'.
72
   --frombranch                    Set the from address for the notice to one of 'item-homebranch' or 'item-issuebranch'.
73
73
74
=head1 OPTIONS
74
=head1 OPTIONS
75
75
76
=over 8
76
=over 8
77
77
78
=item B<-help>
78
=item B<--help>
79
79
80
Print a brief help message and exits.
80
Print a brief help message and exits.
81
81
82
=item B<-man>
82
=item B<--man>
83
83
84
Prints the manual page and exits.
84
Prints the manual page and exits.
85
85
86
=item B<-v>
86
=item B<-v> | B<--verbose>
87
87
88
Verbose. Without this flag set, only fatal errors are reported.
88
Verbose. Without this flag set, only fatal errors are reported.
89
89
90
=item B<-n>
90
=item B<-n> | B<--nomail>
91
91
92
Do not send any email. Overdue notices that would have been sent to
92
Do not send any email. Overdue notices that would have been sent to
93
the patrons or to the admin are printed to standard out. CSV data (if
93
the patrons or to the admin are printed to standard out. CSV data (if
94
the -csv flag is set) is written to standard out or to any csv
94
the --csv flag is set) is written to standard out or to any csv
95
filename given.
95
filename given.
96
96
97
=item B<-max>
97
=item B<--max>
98
98
99
Items older than max days are assumed to be handled somewhere else,
99
Items older than max days are assumed to be handled somewhere else,
100
probably the F<longoverdues.pl> script. They are therefore ignored by
100
probably the F<longoverdues.pl> script. They are therefore ignored by
101
this program. No notices are sent for them, and they are not added to
101
this program. No notices are sent for them, and they are not added to
102
any CSV files. Defaults to 90 to match F<longoverdues.pl>.
102
any CSV files. Defaults to 90 to match F<longoverdues.pl>.
103
103
104
=item B<-library>
104
=item B<--library>
105
105
106
select overdues for one specific library. Use the value in the
106
select overdues for one specific library. Use the value in the
107
branches.branchcode table. This option can be repeated in order 
107
branches.branchcode table. This option can be repeated in order 
108
to select overdues for a group of libraries.
108
to select overdues for a group of libraries.
109
109
110
=item B<-csv>
110
=item B<--csv>
111
111
112
Produces CSV data. if -n (no mail) flag is set, then this CSV data is
112
Produces CSV data. if -n (no mail) flag is set, then this CSV data is
113
sent to standard out or to a filename if provided. Otherwise, only
113
sent to standard out or to a filename if provided. Otherwise, only
114
overdues that could not be emailed are sent in CSV format to the admin.
114
overdues that could not be emailed are sent in CSV format to the admin.
115
115
116
=item B<-html>
116
=item B<--html>
117
117
118
Produces html data. If patron does not have an email address or
118
Produces html data. If patron does not have an email address or
119
-n (no mail) flag is set, an HTML file is generated in the specified
119
-n (no mail) flag is set, an HTML file is generated in the specified
Lines 121-127 directory. This can be downloaded or further processed by library staff. Link Here
121
The file will be called notices-YYYY-MM-DD.html and placed in the directory
121
The file will be called notices-YYYY-MM-DD.html and placed in the directory
122
specified.
122
specified.
123
123
124
=item B<-text>
124
=item B<--text>
125
125
126
Produces plain text data. If patron does not have an email address or
126
Produces plain text data. If patron does not have an email address or
127
-n (no mail) flag is set, a text file is generated in the specified
127
-n (no mail) flag is set, a text file is generated in the specified
Lines 129-135 directory. This can be downloaded or further processed by library staff. Link Here
129
The file will be called notices-YYYY-MM-DD.txt and placed in the directory
129
The file will be called notices-YYYY-MM-DD.txt and placed in the directory
130
specified.
130
specified.
131
131
132
=item B<-itemscontent>
132
=item B<--itemscontent>
133
133
134
comma separated list of fields that get substituted into templates in
134
comma separated list of fields that get substituted into templates in
135
places of the E<lt>E<lt>items.contentE<gt>E<gt> placeholder. This
135
places of the E<lt>E<lt>items.contentE<gt>E<gt> placeholder. This
Lines 138-148 defaults to due date,title,barcode,author Link Here
138
Other possible values come from fields in the biblios, items and
138
Other possible values come from fields in the biblios, items and
139
issues tables.
139
issues tables.
140
140
141
=item B<-borcat>
141
=item B<--borcat>
142
142
143
Repeatable field, that permits to select only some patron categories.
143
Repeatable field, that permits to select only some patron categories.
144
144
145
=item B<-borcatout>
145
=item B<--borcatout>
146
146
147
Repeatable field, that permits to exclude some patron categories.
147
Repeatable field, that permits to exclude some patron categories.
148
148
Lines 157-180 the cron schedule to ensure proper behavior. Link Here
157
Add the --triggered option for daily cron, at the risk of no notice 
157
Add the --triggered option for daily cron, at the risk of no notice 
158
being generated if the cron fails to run on time.
158
being generated if the cron fails to run on time.
159
159
160
=item B<-test>
160
=item B<--test>
161
161
162
This option makes the script run in test mode.
162
This option makes the script run in test mode.
163
163
164
In test mode, the script won't make any changes on the DB. This is useful
164
In test mode, the script won't make any changes on the DB. This is useful
165
for debugging configuration.
165
for debugging configuration.
166
166
167
=item B<-list-all>
167
=item B<--list-all>
168
168
169
Default items.content lists only those items that fall in the 
169
Default items.content lists only those items that fall in the 
170
range of the currently processing notice.
170
range of the currently processing notice.
171
Choose list-all to include all overdue items in the list (limited by B<-max> setting).
171
Choose --list-all to include all overdue items in the list (limited by B<--max> setting).
172
172
173
=item B<-date>
173
=item B<--date>
174
174
175
use it in order to send overdues on a specific date and not Now. Format: YYYY-MM-DD.
175
use it in order to send overdues on a specific date and not Now. Format: YYYY-MM-DD.
176
176
177
=item B<-email>
177
=item B<--email>
178
178
179
Allows to specify which type of email will be used. Can be email, emailpro or B_email. Repeatable.
179
Allows to specify which type of email will be used. Can be email, emailpro or B_email. Repeatable.
180
180
Lines 269-279 address are sent in a single attachment to the library administrator's Link Here
269
email address, or to the address in the KohaAdminEmailAddress system
269
email address, or to the address in the KohaAdminEmailAddress system
270
preference.
270
preference.
271
271
272
C<overdue_notices.pl -n -csv /tmp/overdues.csv> - sends no email and
272
C<overdue_notices.pl -n --csv /tmp/overdues.csv> - sends no email and
273
populates F</tmp/overdues.csv> with information about all overdue
273
populates F</tmp/overdues.csv> with information about all overdue
274
items.
274
items.
275
275
276
C<overdue_notices.pl -library MAIN max 14> - prepare notices of
276
C<overdue_notices.pl --library MAIN max 14> - prepare notices of
277
overdues in the last 2 weeks for the MAIN library.
277
overdues in the last 2 weeks for the MAIN library.
278
278
279
=head1 SEE ALSO
279
=head1 SEE ALSO
Lines 310-317 my ( $date_input, $today ); Link Here
310
GetOptions(
310
GetOptions(
311
    'help|?'         => \$help,
311
    'help|?'         => \$help,
312
    'man'            => \$man,
312
    'man'            => \$man,
313
    'v'              => \$verbose,
313
    'v|verbose'      => \$verbose,
314
    'n'              => \$nomail,
314
    'n|nomail'       => \$nomail,
315
    'max=s'          => \$MAX,
315
    'max=s'          => \$MAX,
316
    'library=s'      => \@branchcodes,
316
    'library=s'      => \@branchcodes,
317
    'csv:s'          => \$csvfilename,    # this optional argument gets '' if not supplied.
317
    'csv:s'          => \$csvfilename,    # this optional argument gets '' if not supplied.
318
- 

Return to bug 30132