Lines 39-45
sub usage {
Link Here
|
39 |
|
39 |
|
40 |
|
40 |
|
41 |
sub force_borrower_messaging_defaults { |
41 |
sub force_borrower_messaging_defaults { |
42 |
my ($doit, $since, $not_expired, $no_overwrite) = @_; |
42 |
my ($doit, $since, $not_expired, $no_overwrite, $category ) = @_; |
43 |
|
43 |
|
44 |
$since = '0000-00-00' if (!$since); |
44 |
$since = '0000-00-00' if (!$since); |
45 |
print "Since: $since\n"; |
45 |
print "Since: $since\n"; |
Lines 57-64
WHERE bo.dateenrolled >= ?|;
Link Here
|
57 |
if( $no_overwrite ) { |
57 |
if( $no_overwrite ) { |
58 |
$sql .= " AND mp.borrowernumber IS NULL"; |
58 |
$sql .= " AND mp.borrowernumber IS NULL"; |
59 |
} |
59 |
} |
|
|
60 |
$sql .= " AND categorycode = ?" if $category; |
60 |
my $sth = $dbh->prepare($sql); |
61 |
my $sth = $dbh->prepare($sql); |
61 |
$sth->execute($since); |
62 |
$sth->execute($since, $category || () ); |
62 |
while ( my ($borrowernumber, $categorycode) = $sth->fetchrow ) { |
63 |
while ( my ($borrowernumber, $categorycode) = $sth->fetchrow ) { |
63 |
print "$borrowernumber: $categorycode\n"; |
64 |
print "$borrowernumber: $categorycode\n"; |
64 |
next unless $doit; |
65 |
next unless $doit; |
Lines 71-88
WHERE bo.dateenrolled >= ?|;
Link Here
|
71 |
} |
72 |
} |
72 |
|
73 |
|
73 |
|
74 |
|
74 |
my ( $doit, $since, $help, $not_expired, $no_overwrite ); |
75 |
my ( $doit, $since, $help, $not_expired, $no_overwrite, $category ); |
75 |
my $result = GetOptions( |
76 |
my $result = GetOptions( |
76 |
'doit' => \$doit, |
77 |
'doit' => \$doit, |
77 |
'since:s' => \$since, |
78 |
'since:s' => \$since, |
78 |
'not-expired' => \$not_expired, |
79 |
'not-expired' => \$not_expired, |
79 |
'no-overwrite' => \$no_overwrite, |
80 |
'no-overwrite' => \$no_overwrite, |
|
|
81 |
'category:s' => \$category, |
80 |
'help|h' => \$help, |
82 |
'help|h' => \$help, |
81 |
); |
83 |
); |
82 |
|
84 |
|
83 |
usage() if $help; |
85 |
usage() if $help; |
84 |
|
86 |
|
85 |
force_borrower_messaging_defaults( $doit, $since, $not_expired, $no_overwrite ); |
87 |
force_borrower_messaging_defaults( $doit, $since, $not_expired, $no_overwrite, $category ); |
86 |
|
88 |
|
87 |
=head1 NAME |
89 |
=head1 NAME |
88 |
|
90 |
|
Lines 94-99
borrowers-force-messaging-defaults.pl
Link Here
|
94 |
borrowers-force-messaging-defaults.pl --help |
96 |
borrowers-force-messaging-defaults.pl --help |
95 |
borrowers-force-messaging-defaults.pl --doit |
97 |
borrowers-force-messaging-defaults.pl --doit |
96 |
borrowers-force-messaging-defaults.pl --doit --not-expired |
98 |
borrowers-force-messaging-defaults.pl --doit --not-expired |
|
|
99 |
borrowers-force-messaging-defaults.pl --doit --category PT |
97 |
|
100 |
|
98 |
=head1 DESCRIPTION |
101 |
=head1 DESCRIPTION |
99 |
|
102 |
|
Lines 126-131
Will only update active borrowers (borrowers who didn't pass their expiration da
Link Here
|
126 |
Will only update patrons without messaging preferences and skip patrons that |
129 |
Will only update patrons without messaging preferences and skip patrons that |
127 |
already set their preferences. |
130 |
already set their preferences. |
128 |
|
131 |
|
|
|
132 |
=item B<--category> |
133 |
|
134 |
Will only update patrons in the category specified. |
135 |
|
129 |
=back |
136 |
=back |
130 |
|
137 |
|
131 |
=cut |
138 |
=cut |
132 |
- |
|
|