Bug 33204: Add the ability to filter on patron library for borrowers-force-messaging-defaults.pl
Like filter on category Bug 19454, it would be helpful to filter on a specified library for misc/maintenance/borrowers-force-messaging-defaults.pl Test plan: 1) Select two patrons A and B in say libraries L1 and L2. 2) Change the msg prefs for A and B away from defaults. 3) Run misc/maintenance/borrowers-force-messaging-defaults.pl -doit -library L1 Verify that patron A changed and patron B did not. 4) Run with both category and library filters Signed-off-by: Sam Lau <samalau@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
813aaa6969
commit
20a3b13516
1 changed files with 11 additions and 4 deletions
|
@ -34,7 +34,7 @@ sub usage {
|
|||
|
||||
|
||||
sub force_borrower_messaging_defaults {
|
||||
my ($doit, $since, $not_expired, $no_overwrite, $category ) = @_;
|
||||
my ($doit, $since, $not_expired, $no_overwrite, $category, $branchcode ) = @_;
|
||||
|
||||
print "Since: $since\n" if $since;
|
||||
|
||||
|
@ -56,8 +56,9 @@ WHERE 1|;
|
|||
$sql .= " AND mp.borrowernumber IS NULL";
|
||||
}
|
||||
$sql .= " AND bo.categorycode = ?" if $category;
|
||||
$sql .= " AND bo.branchcode = ?" if $branchcode;
|
||||
my $sth = $dbh->prepare($sql);
|
||||
$sth->execute($since || (), $category || () );
|
||||
$sth->execute($since || (), $category || (), $branchcode || () );
|
||||
my $cnt = 0;
|
||||
while ( my ($borrowernumber, $categorycode) = $sth->fetchrow ) {
|
||||
print "$borrowernumber: $categorycode\n";
|
||||
|
@ -73,19 +74,20 @@ WHERE 1|;
|
|||
}
|
||||
|
||||
|
||||
my ( $doit, $since, $help, $not_expired, $no_overwrite, $category );
|
||||
my ( $doit, $since, $help, $not_expired, $no_overwrite, $category, $branchcode );
|
||||
my $result = GetOptions(
|
||||
'doit' => \$doit,
|
||||
'since:s' => \$since,
|
||||
'not-expired' => \$not_expired,
|
||||
'no-overwrite' => \$no_overwrite,
|
||||
'category:s' => \$category,
|
||||
'library:s' => \$branchcode,
|
||||
'help|h' => \$help,
|
||||
);
|
||||
|
||||
usage() if $help;
|
||||
|
||||
force_borrower_messaging_defaults( $doit, $since, $not_expired, $no_overwrite, $category );
|
||||
force_borrower_messaging_defaults( $doit, $since, $not_expired, $no_overwrite, $category, $branchcode );
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
@ -98,6 +100,7 @@ borrowers-force-messaging-defaults.pl
|
|||
borrowers-force-messaging-defaults.pl --doit
|
||||
borrowers-force-messaging-defaults.pl --doit --not-expired
|
||||
borrowers-force-messaging-defaults.pl --doit --category PT
|
||||
borrowers-force-messaging-defaults.pl --doit --library CPL
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
|
@ -134,6 +137,10 @@ already set their preferences.
|
|||
|
||||
Will only update patrons in the category specified.
|
||||
|
||||
=item B<--library>
|
||||
|
||||
Will only update patrons in the library specified.
|
||||
|
||||
=item B<--since>
|
||||
|
||||
Will only update borrowers enrolled since the specified date.
|
||||
|
|
Loading…
Reference in a new issue