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

(-)a/misc/cronjobs/membership_expiry.pl (-9 / +20 lines)
Lines 65-70 statement otherwise. Link Here
65
65
66
Optional branchcode to restrict the cronjob to that branch.
66
Optional branchcode to restrict the cronjob to that branch.
67
67
68
=item B<-category>
69
70
Optional categorycode to restrict the cronjob to that category.
71
68
=item B<-before>
72
=item B<-before>
69
73
70
Optional parameter to extend the selection with a number of days BEFORE
74
Optional parameter to extend the selection with a number of days BEFORE
Lines 141-147 my $help = 0; Link Here
141
my $man     = 0;
145
my $man     = 0;
142
my $before  = 0;
146
my $before  = 0;
143
my $after   = 0;
147
my $after   = 0;
144
my ( $branch, $letter_type );
148
my ( $branch, $letter_type, $category );
145
149
146
GetOptions(
150
GetOptions(
147
    'help|?'         => \$help,
151
    'help|?'         => \$help,
Lines 153-158 GetOptions( Link Here
153
    'before:i'       => \$before,
157
    'before:i'       => \$before,
154
    'after:i'        => \$after,
158
    'after:i'        => \$after,
155
    'letter:s'       => \$letter_type,
159
    'letter:s'       => \$letter_type,
160
    'category:s'     => \$category,
156
) or pod2usage(2);
161
) or pod2usage(2);
157
162
158
pod2usage( -verbose => 2 ) if $man;
163
pod2usage( -verbose => 2 ) if $man;
Lines 168-182 if( !$expdays ) { Link Here
168
    exit;
173
    exit;
169
}
174
}
170
175
176
my $filter = {
177
    before => $before,
178
    after  => $after,
179
};
180
181
if ( $branch ) {
182
    $filter->{'me.branchcode'} = $branch;
183
}
184
185
if ( $category ) {
186
    $filter->{'me.categorycode'} = $category;
187
}
188
171
my $admin_adress = C4::Context->preference('KohaAdminEmailAddress');
189
my $admin_adress = C4::Context->preference('KohaAdminEmailAddress');
172
warn 'getting upcoming membership expires' if $verbose;
190
warn 'getting upcoming membership expires' if $verbose;
173
my $upcoming_mem_expires = Koha::Patrons->search_upcoming_membership_expires(
191
my $upcoming_mem_expires = Koha::Patrons->search_upcoming_membership_expires($filter);
174
    {
175
        ( $branch ? ( 'me.branchcode' => $branch ) : () ),
176
        before => $before,
177
        after  => $after,
178
    }
179
);
180
warn 'found ' . $upcoming_mem_expires->count . ' soon expiring members'
192
warn 'found ' . $upcoming_mem_expires->count . ' soon expiring members'
181
    if $verbose;
193
    if $verbose;
182
194
183
- 

Return to bug 26062