Lines 56-61
Options:
Link Here
|
56 |
-rb=date --regbefore update if registration date is before given date |
56 |
-rb=date --regbefore update if registration date is before given date |
57 |
-ra=date --regafter update if registration date is after a given date |
57 |
-ra=date --regafter update if registration date is after a given date |
58 |
-d --dbfield name=value where <name> is a column in the borrowers table, patrons will be updated if the field is equal to given <value> |
58 |
-d --dbfield name=value where <name> is a column in the borrowers table, patrons will be updated if the field is equal to given <value> |
|
|
59 |
-dn --notfield name=value where <name> is a column in the borrowers table, patrons will be updated if the field is equal to given <value> |
60 |
-dl --likefield name=value where <name> is a column in the borrowers table, patrons will be updated if the field is equal to given <value> |
61 |
-dnl --notlikefield name=value where <name> is a column in the borrowers table, patrons will be updated if the field is equal to given <value> |
59 |
-v -verbose verbose mode |
62 |
-v -verbose verbose mode |
60 |
-c --confirm commit changes to db, no action will be taken unless this switch is included |
63 |
-c --confirm commit changes to db, no action will be taken unless this switch is included |
61 |
-b --branch <branchname> only deal with patrons from this library/branch |
64 |
-b --branch <branchname> only deal with patrons from this library/branch |
Lines 121-132
Enter a date in ISO format YYYY-MM-DD and only patrons registered after this dat
Link Here
|
121 |
|
124 |
|
122 |
=item B<--field column=value | -d column=value> |
125 |
=item B<--field column=value | -d column=value> |
123 |
|
126 |
|
124 |
Use this flag to specify a column in the borrowers table and update only patrons whose value in that column matches the value supplied (repeatable) |
127 |
Use this flag to specify a column in the borrowers table and update only patrons whose value in that column equals the value supplied (repeatable) |
125 |
|
128 |
|
126 |
e.g. |
129 |
e.g. |
127 |
--field dateexpiry=2016-01-01 |
130 |
--field dateexpiry=2016-01-01 |
128 |
will update all patrons who expired on that date, useful for schools etc. |
131 |
will update all patrons who expired on that date, useful for schools etc. |
129 |
|
132 |
|
|
|
133 |
=item B<--notfield column=value | -dn column=value> |
134 |
|
135 |
Use this flag to specify a column in the borrowers table and update only patrons whose value in that column does not equal the value supplied (repeatable) |
136 |
|
137 |
e.g. |
138 |
--notfield email=NULL |
139 |
will update all patrons with no value for email |
140 |
|
130 |
=back |
141 |
=back |
131 |
|
142 |
|
132 |
=head1 DESCRIPTION |
143 |
=head1 DESCRIPTION |
Lines 163-168
my $reg_bef;
Link Here
|
163 |
my $reg_aft; |
174 |
my $reg_aft; |
164 |
my $branch_lim; |
175 |
my $branch_lim; |
165 |
my %fields; |
176 |
my %fields; |
|
|
177 |
my %not_fields; |
178 |
my %like_fields; |
179 |
my %not_like_fields; |
166 |
|
180 |
|
167 |
GetOptions( |
181 |
GetOptions( |
168 |
'help|?' => \$help, |
182 |
'help|?' => \$help, |
Lines 178-184
GetOptions(
Link Here
|
178 |
'rb|regbefore=s' => \$reg_bef, |
192 |
'rb|regbefore=s' => \$reg_bef, |
179 |
'ra|regafter=s' => \$reg_aft, |
193 |
'ra|regafter=s' => \$reg_aft, |
180 |
'b|branch=s' => \$branch_lim, |
194 |
'b|branch=s' => \$branch_lim, |
181 |
'd|field=s' => \%fields |
195 |
'd|field=s' => \%fields, |
|
|
196 |
'dn|notfield=s' => \%not_fields, |
197 |
'dl|likefield=s' => \%like_fields, |
198 |
'dnl|notlikefield=s' => \%not_like_fields |
182 |
); |
199 |
); |
183 |
|
200 |
|
184 |
pod2usage(1) if $help; |
201 |
pod2usage(1) if $help; |
Lines 235-243
if ($verbose) {
Link Here
|
235 |
} |
252 |
} |
236 |
|
253 |
|
237 |
while ( my ( $key, $value ) = each %fields ) { |
254 |
while ( my ( $key, $value ) = each %fields ) { |
238 |
$verbose and print " Borrower column $key is equal to $value\n"; |
255 |
$verbose and print " Borrower column $key is $value\n"; |
|
|
256 |
$value = undef if lc($value) eq 'null'; |
239 |
$params{ "me." . $key } = $value; |
257 |
$params{ "me." . $key } = $value; |
240 |
} |
258 |
} |
|
|
259 |
while ( my ( $key, $value ) = each %not_fields ) { |
260 |
$verbose and print " Borrower column $key is not $value\n"; |
261 |
$value = undef if lc($value) eq 'null'; |
262 |
$params{ "me." . $key } = { '!=' => $value }; |
263 |
} |
264 |
while ( my ( $key, $value ) = each %like_fields ) { |
265 |
$verbose and print " Borrower column $key is like $value\n"; |
266 |
$params{ "me." . $key } = { 'LIKE' => $value }; |
267 |
} |
268 |
while ( my ( $key, $value ) = each %not_like_fields ) { |
269 |
$verbose and print " Borrower column $key is not like $value\n"; |
270 |
$params{ "me." . $key } = { 'NOT LIKE' => $value }; |
271 |
} |
241 |
my $target_patrons = Koha::Patrons->search(\%params)->search_patrons_to_update_category( |
272 |
my $target_patrons = Koha::Patrons->search(\%params)->search_patrons_to_update_category( |
242 |
{ |
273 |
{ |
243 |
from => $fromcat, |
274 |
from => $fromcat, |
244 |
- |
|
|