Bugzilla – Attachment 107367 Details for
Bug 26062
Membership Expiry can not be limited by Patron Category
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26062: Add --category option to membership_expiry.pl
Bug-26062-Add---category-option-to-membershipexpir.patch (text/plain), 2.53 KB, created by
Tomás Cohen Arazi (tcohen)
on 2020-07-24 19:21:41 UTC
(
hide
)
Description:
Bug 26062: Add --category option to membership_expiry.pl
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2020-07-24 19:21:41 UTC
Size:
2.53 KB
patch
obsolete
>From 26a8cf37f5726f40e0e65e20f04ce58ef703a71f Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 24 Jul 2020 16:16:46 -0300 >Subject: [PATCH] Bug 26062: Add --category option to membership_expiry.pl > >This patch adds a new option switch to the script, allowing to restrict >the query for upcoming expirying patrons to a specific category. > >To test: >1. Apply this patch >2. Have upcoming expirying patrons with a certain category, and some > others matching the expiry params (before/after), but with a > different category >3. Run the script passing --category CAT (CAT being the chosen category) >=> SUCCESS: Only those on the specified category are picked >4. Sign off :-D > >Sponsored-by: ByWater Solutions >--- > misc/cronjobs/membership_expiry.pl | 28 ++++++++++++++++++++-------- > 1 file changed, 20 insertions(+), 8 deletions(-) > >diff --git a/misc/cronjobs/membership_expiry.pl b/misc/cronjobs/membership_expiry.pl >index 5038ce1f9f..1fddd060db 100755 >--- a/misc/cronjobs/membership_expiry.pl >+++ b/misc/cronjobs/membership_expiry.pl >@@ -65,6 +65,10 @@ statement otherwise. > > Optional branchcode to restrict the cronjob to that branch. > >+=item B<-category> >+ >+Optional categorycode to restrict the cronjob to that category. >+ > =item B<-before> > > Optional parameter to extend the selection with a number of days BEFORE >@@ -141,7 +145,7 @@ my $help = 0; > my $man = 0; > my $before = 0; > my $after = 0; >-my ( $branch, $letter_type ); >+my ( $branch, $letter_type, $category ); > > GetOptions( > 'help|?' => \$help, >@@ -153,6 +157,7 @@ GetOptions( > 'before:i' => \$before, > 'after:i' => \$after, > 'letter:s' => \$letter_type, >+ 'category:s' => \$category, > ) or pod2usage(2); > > pod2usage( -verbose => 2 ) if $man; >@@ -168,15 +173,22 @@ if( !$expdays ) { > exit; > } > >+my $filter = { >+ before => $before, >+ after => $after, >+}; >+ >+if ( $branch ) { >+ $filter->{'me.branchcode'} = $branch; >+} >+ >+if ( $category ) { >+ $filter->{'me.categorycode'} = $category; >+} >+ > my $admin_adress = C4::Context->preference('KohaAdminEmailAddress'); > warn 'getting upcoming membership expires' if $verbose; >-my $upcoming_mem_expires = Koha::Patrons->search_upcoming_membership_expires( >- { >- ( $branch ? ( 'me.branchcode' => $branch ) : () ), >- before => $before, >- after => $after, >- } >-); >+my $upcoming_mem_expires = Koha::Patrons->search_upcoming_membership_expires($filter); > warn 'found ' . $upcoming_mem_expires->count . ' soon expiring members' > if $verbose; > >-- >2.27.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 26062
: 107367