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

(-)a/misc/cronjobs/membership_expiry.pl (-3 / +29 lines)
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               include patrons expiring a number of days BEFORE the date set by the preference
41
   --after=X                include 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 141-146 my $man = 0; Link Here
141
my $before  = 0;
162
my $before  = 0;
142
my $after   = 0;
163
my $after   = 0;
143
my ( $branch, $letter_type );
164
my ( $branch, $letter_type );
165
my @where;
144
166
145
GetOptions(
167
GetOptions(
146
    'help|?'         => \$help,
168
    'help|?'         => \$help,
Lines 152-157 GetOptions( Link Here
152
    'before:i'       => \$before,
174
    'before:i'       => \$before,
153
    'after:i'        => \$after,
175
    'after:i'        => \$after,
154
    'letter:s'       => \$letter_type,
176
    'letter:s'       => \$letter_type,
177
    'where=s'        => \@where,
155
) or pod2usage(2);
178
) or pod2usage(2);
156
179
157
pod2usage( -verbose => 2 ) if $man;
180
pod2usage( -verbose => 2 ) if $man;
Lines 175-180 my $upcoming_mem_expires = Koha::Patrons->search_upcoming_membership_expires( Link Here
175
        after  => $after,
198
        after  => $after,
176
    }
199
    }
177
);
200
);
201
202
my $where_literal = join ' AND ', @where;
203
$upcoming_mem_expires = $upcoming_mem_expires->search( \$where_literal ) if @where;
204
178
warn 'found ' . $upcoming_mem_expires->count . ' soon expiring members'
205
warn 'found ' . $upcoming_mem_expires->count . ' soon expiring members'
179
    if $verbose;
206
    if $verbose;
180
207
181
- 

Return to bug 28456