Bugzilla – Attachment 69205 Details for
Bug 19454
Add the ability to filter on patron category for borrowers-force-messaging-defaults.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19454: Add -category parameter to borrowers-force-messaging-defaults.pl
Bug-19454-Add--category-parameter-to-borrowers-for.patch (text/plain), 3.49 KB, created by
Charles Farmer
on 2017-11-17 20:36:11 UTC
(
hide
)
Description:
Bug 19454: Add -category parameter to borrowers-force-messaging-defaults.pl
Filename:
MIME Type:
Creator:
Charles Farmer
Created:
2017-11-17 20:36:11 UTC
Size:
3.49 KB
patch
obsolete
>From bca1c9b5924bf117c4257e9d5ef15787dbf25141 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 12 Oct 2017 15:36:10 +0200 >Subject: [PATCH] Bug 19454: Add -category parameter to > borrowers-force-messaging-defaults.pl > >Instead of updating patrons over all patron categories, it would be >helpful if we could filter on a specified category. > >Test plan: >[1] Select two patrons A and B in say categories C1 and C2. >[2] Change the msg prefs for A and B away from defaults. >[3] Run borrowers-force-messaging-defaults.pl -doit -cat C1 > Verify that patron A changed and patron B did not. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Signed-off-by: Charles Farmer <charles.farmer@inLibro.com> >--- > misc/maintenance/borrowers-force-messaging-defaults.pl | 17 ++++++++++++----- > 1 file changed, 12 insertions(+), 5 deletions(-) > >diff --git a/misc/maintenance/borrowers-force-messaging-defaults.pl b/misc/maintenance/borrowers-force-messaging-defaults.pl >index 8951990..e9745f9 100755 >--- a/misc/maintenance/borrowers-force-messaging-defaults.pl >+++ b/misc/maintenance/borrowers-force-messaging-defaults.pl >@@ -39,7 +39,7 @@ sub usage { > > > sub force_borrower_messaging_defaults { >- my ($doit, $since, $not_expired, $no_overwrite) = @_; >+ my ($doit, $since, $not_expired, $no_overwrite, $category ) = @_; > > $since = '0000-00-00' if (!$since); > print "Since: $since\n"; >@@ -54,8 +54,9 @@ sub force_borrower_messaging_defaults { > if( $no_overwrite ) { > $sql .= " AND (SELECT COUNT(*) FROM borrower_message_preferences mp WHERE mp.borrowernumber=bo.borrowernumber) = 0" > } >+ $sql .= " AND categorycode = ?" if $category; > my $sth = $dbh->prepare($sql); >- $sth->execute($since); >+ $sth->execute($since, $category || () ); > while ( my ($borrowernumber, $categorycode) = $sth->fetchrow ) { > print "$borrowernumber: $categorycode\n"; > next unless $doit; >@@ -68,18 +69,19 @@ sub force_borrower_messaging_defaults { > } > > >-my ( $doit, $since, $help, $not_expired, $no_overwrite ); >+my ( $doit, $since, $help, $not_expired, $no_overwrite, $category ); > my $result = GetOptions( > 'doit' => \$doit, > 'since:s' => \$since, > 'not-expired' => \$not_expired, > 'no_overwrite' => \$no_overwrite, >+ 'category:s' => \$category, > 'help|h' => \$help, > ); > > usage() if $help; > >-force_borrower_messaging_defaults( $doit, $since, $not_expired, $no_overwrite ); >+force_borrower_messaging_defaults( $doit, $since, $not_expired, $no_overwrite, $category ); > > =head1 NAME > >@@ -91,6 +93,7 @@ borrowers-force-messaging-defaults.pl > borrowers-force-messaging-defaults.pl --help > borrowers-force-messaging-defaults.pl --doit > borrowers-force-messaging-defaults.pl --doit --not-expired >+ borrowers-force-messaging-defaults.pl --doit -category PT > > =head1 DESCRIPTION > >@@ -102,7 +105,7 @@ Filled' notice for example. > > This script creates/overwrites messaging preferences for all borrowers and sets > them to default values defined for the category they belong to (unless you >-use the options -not-expired or -no_overwrite to update a subset). >+use the options -not-expired, -no_overwrite or -category to update a subset). > > =over 8 > >@@ -123,6 +126,10 @@ Will only update active borrowers (borrowers who didn't pass their expiration da > Will only update patrons without messaging preferences and skip patrons that > already set their preferences. > >+=item B<-category> >+ >+Will only update patrons in the category specified. >+ > =back > > =cut >-- >2.7.4
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 19454
:
68176
|
68177
|
68202
|
68203
|
69205
|
69206
|
71654
|
71655
|
72849
|
72850
|
72851
|
72852
|
72853
|
72854
|
73067
|
73068
|
73069