Lines 29-34
or, in crontab:
Link Here
|
29 |
|
29 |
|
30 |
0 1 * * * membership_expiry.pl -c |
30 |
0 1 * * * membership_expiry.pl -c |
31 |
|
31 |
|
|
|
32 |
Options: |
33 |
--help brief help message |
34 |
--man full documentation |
35 |
--where <conditions> where clause to add to the query |
36 |
-v -verbose verbose mode |
37 |
-n --nomail if supplied messages will be output to STDOUT and not sent |
38 |
-c --confirm commit changes to db, no action will be taken unless this switch is included |
39 |
-b --branch <branchname> only deal with patrons from this library/branch |
40 |
--before=X inclue patrons expiring a number of days BEFORE the date set by the preference |
41 |
--after=X inclue patrons expiring a number of days AFTER the date set by the preference |
42 |
-l --letter <lettercode> use a specific notice rather than the default |
43 |
|
32 |
=head1 DESCRIPTION |
44 |
=head1 DESCRIPTION |
33 |
|
45 |
|
34 |
This script sends membership expiry reminder notices to patrons. |
46 |
This script sends membership expiry reminder notices to patrons. |
Lines 75-89
the date set by the preference.
Link Here
|
75 |
Optional parameter to extend the selection with a number of days AFTER |
87 |
Optional parameter to extend the selection with a number of days AFTER |
76 |
the date set by the preference. |
88 |
the date set by the preference. |
77 |
|
89 |
|
|
|
90 |
=item B<-where> |
91 |
|
92 |
Use this option to specify a condition built with columns from the borrowers table |
93 |
|
94 |
e.g. |
95 |
--where 'lastseen IS NOT NULL' |
96 |
will only notify patrons who have been seen. |
97 |
|
78 |
=item B<-letter> |
98 |
=item B<-letter> |
79 |
|
99 |
|
80 |
Optional parameter to use another notice than the default one. |
100 |
Optional parameter to use another notice than the default: MEMBERSHIP_EXPIRY |
81 |
|
101 |
|
82 |
=back |
102 |
=back |
83 |
|
103 |
|
84 |
=head1 CONFIGURATION |
104 |
=head1 CONFIGURATION |
85 |
|
105 |
|
86 |
The content of the messages is configured in Tools -> Notices and slips. Use the MEMBERSHIP_EXPIRY notice. |
106 |
The content of the messages is configured in Tools -> Notices and slips. Use the MEMBERSHIP_EXPIRY notice or |
|
|
107 |
supply another via the parameters. |
87 |
|
108 |
|
88 |
Typically, messages are prepared for each patron when the memberships are going to expire. |
109 |
Typically, messages are prepared for each patron when the memberships are going to expire. |
89 |
|
110 |
|
Lines 142-147
my $man = 0;
Link Here
|
142 |
my $before = 0; |
163 |
my $before = 0; |
143 |
my $after = 0; |
164 |
my $after = 0; |
144 |
my ( $branch, $letter_type ); |
165 |
my ( $branch, $letter_type ); |
|
|
166 |
my @where; |
145 |
|
167 |
|
146 |
GetOptions( |
168 |
GetOptions( |
147 |
'help|?' => \$help, |
169 |
'help|?' => \$help, |
Lines 153-158
GetOptions(
Link Here
|
153 |
'before:i' => \$before, |
175 |
'before:i' => \$before, |
154 |
'after:i' => \$after, |
176 |
'after:i' => \$after, |
155 |
'letter:s' => \$letter_type, |
177 |
'letter:s' => \$letter_type, |
|
|
178 |
'where=s' => \@where, |
156 |
) or pod2usage(2); |
179 |
) or pod2usage(2); |
157 |
|
180 |
|
158 |
pod2usage( -verbose => 2 ) if $man; |
181 |
pod2usage( -verbose => 2 ) if $man; |
Lines 177-182
my $upcoming_mem_expires = Koha::Patrons->search_upcoming_membership_expires(
Link Here
|
177 |
after => $after, |
200 |
after => $after, |
178 |
} |
201 |
} |
179 |
); |
202 |
); |
|
|
203 |
|
204 |
my $where_literal = join ' AND ', @where; |
205 |
$upcoming_mem_expires = $upcoming_mem_expires->search( \$where_literal ) if @where; |
206 |
|
180 |
warn 'found ' . $upcoming_mem_expires->count . ' soon expiring members' |
207 |
warn 'found ' . $upcoming_mem_expires->count . ' soon expiring members' |
181 |
if $verbose; |
208 |
if $verbose; |
182 |
|
209 |
|
183 |
- |
|
|