Lines 34-40
sub usage {
Link Here
|
34 |
|
34 |
|
35 |
|
35 |
|
36 |
sub force_borrower_messaging_defaults { |
36 |
sub force_borrower_messaging_defaults { |
37 |
my ($doit, $since, $not_expired, $no_overwrite, $category, $branchcode ) = @_; |
37 |
my ($doit, $since, $not_expired, $no_overwrite, $category, $branchcode, $message_name ) = @_; |
38 |
|
38 |
|
39 |
print "Since: $since\n" if $since; |
39 |
print "Since: $since\n" if $since; |
40 |
|
40 |
|
Lines 63-72
WHERE 1|;
Link Here
|
63 |
while ( my ($borrowernumber, $categorycode) = $sth->fetchrow ) { |
63 |
while ( my ($borrowernumber, $categorycode) = $sth->fetchrow ) { |
64 |
print "$borrowernumber: $categorycode\n"; |
64 |
print "$borrowernumber: $categorycode\n"; |
65 |
next unless $doit; |
65 |
next unless $doit; |
66 |
C4::Members::Messaging::SetMessagingPreferencesFromDefaults( { |
66 |
my $options = { |
67 |
borrowernumber => $borrowernumber, |
67 |
borrowernumber => $borrowernumber, |
68 |
categorycode => $categorycode, |
68 |
categorycode => $categorycode, |
69 |
} ); |
69 |
}; |
|
|
70 |
$options->{message_name} = $message_name if defined $message_name; |
71 |
C4::Members::Messaging::SetMessagingPreferencesFromDefaults($options); |
70 |
$cnt++; |
72 |
$cnt++; |
71 |
} |
73 |
} |
72 |
$dbh->commit(); |
74 |
$dbh->commit(); |
Lines 74-80
WHERE 1|;
Link Here
|
74 |
} |
76 |
} |
75 |
|
77 |
|
76 |
|
78 |
|
77 |
my ( $doit, $since, $help, $not_expired, $no_overwrite, $category, $branchcode ); |
79 |
my ( $doit, $since, $help, $not_expired, $no_overwrite, $category, $branchcode, $message_name ); |
78 |
my $result = GetOptions( |
80 |
my $result = GetOptions( |
79 |
'doit' => \$doit, |
81 |
'doit' => \$doit, |
80 |
'since:s' => \$since, |
82 |
'since:s' => \$since, |
Lines 82-93
my $result = GetOptions(
Link Here
|
82 |
'no-overwrite' => \$no_overwrite, |
84 |
'no-overwrite' => \$no_overwrite, |
83 |
'category:s' => \$category, |
85 |
'category:s' => \$category, |
84 |
'library:s' => \$branchcode, |
86 |
'library:s' => \$branchcode, |
|
|
87 |
'message-name:s' => \$message_name, |
85 |
'help|h' => \$help, |
88 |
'help|h' => \$help, |
86 |
); |
89 |
); |
87 |
|
90 |
|
88 |
usage() if $help; |
91 |
usage() if $help; |
89 |
|
92 |
|
90 |
force_borrower_messaging_defaults( $doit, $since, $not_expired, $no_overwrite, $category, $branchcode ); |
93 |
force_borrower_messaging_defaults( $doit, $since, $not_expired, $no_overwrite, $category, $branchcode, $message_name ); |
91 |
|
94 |
|
92 |
=head1 NAME |
95 |
=head1 NAME |
93 |
|
96 |
|
Lines 101-106
borrowers-force-messaging-defaults.pl
Link Here
|
101 |
borrowers-force-messaging-defaults.pl --doit --not-expired |
104 |
borrowers-force-messaging-defaults.pl --doit --not-expired |
102 |
borrowers-force-messaging-defaults.pl --doit --category PT |
105 |
borrowers-force-messaging-defaults.pl --doit --category PT |
103 |
borrowers-force-messaging-defaults.pl --doit --library CPL |
106 |
borrowers-force-messaging-defaults.pl --doit --library CPL |
|
|
107 |
borrowers-force-messaging-defaults.pl --doit --message-name 'Item_Due' |
104 |
|
108 |
|
105 |
=head1 DESCRIPTION |
109 |
=head1 DESCRIPTION |
106 |
|
110 |
|
Lines 141-146
Will only update patrons in the category specified.
Link Here
|
141 |
|
145 |
|
142 |
Will only update patrons whose home library matches the given library id |
146 |
Will only update patrons whose home library matches the given library id |
143 |
|
147 |
|
|
|
148 |
=item B<--message-name> |
149 |
|
150 |
Will only update the specified message name. |
151 |
List of values can be found in installer/data/mysql/mandatory/sample_notices_message_attributes.sql |
152 |
|
144 |
=item B<--since> |
153 |
=item B<--since> |
145 |
|
154 |
|
146 |
Will only update borrowers enrolled since the specified date. |
155 |
Will only update borrowers enrolled since the specified date. |
147 |
- |
|
|