View | Details | Raw Unified | Return to bug 25683
Collapse All | Expand All

(-)a/Koha/Patrons.pm (-1 / +1 lines)
Lines 397-403 sub search_patrons_to_update_category { Link Here
397
    }
397
    }
398
    if ($params->{fine_min} || $params->{fine_max}) {
398
    if ($params->{fine_min} || $params->{fine_max}) {
399
        $query{join} = ["accountlines"];
399
        $query{join} = ["accountlines"];
400
        $query{select} = ["borrowernumber", "accountlines.amountoutstanding" ];
400
        $query{columns} = ["borrowernumber"];
401
        $query{group_by} = ["borrowernumber"];
401
        $query{group_by} = ["borrowernumber"];
402
        $query{having} = \['IFNULL(sum(accountlines.amountoutstanding),0) <= ?',$params->{fine_max}] if defined $params->{fine_max};
402
        $query{having} = \['IFNULL(sum(accountlines.amountoutstanding),0) <= ?',$params->{fine_max}] if defined $params->{fine_max};
403
        $query{having} = \['IFNULL(sum(accountlines.amountoutstanding),0) >= ?',$params->{fine_min}] if defined $params->{fine_min};
403
        $query{having} = \['IFNULL(sum(accountlines.amountoutstanding),0) >= ?',$params->{fine_min}] if defined $params->{fine_min};
(-)a/misc/cronjobs/update_patrons_category.pl (-5 / +5 lines)
Lines 74-80 Print a brief help message and exits. Link Here
74
74
75
Prints the manual page and exits.
75
Prints the manual page and exits.
76
76
77
=item B<--verbosse | -v>
77
=item B<--verbose | -v>
78
78
79
Verbose. Without this flag set, only fatal errors are reported.
79
Verbose. Without this flag set, only fatal errors are reported.
80
80
Lines 248-264 my $target_patrons = Koha::Patrons->search(\%params)->search_patrons_to_update_c Link Here
248
        fine_max      => $fine_max,
248
        fine_max      => $fine_max,
249
    }
249
    }
250
);
250
);
251
251
my $patrons_found    = $target_patrons->count;
252
my $patrons_found    = $target_patrons->count;
252
my $actually_updated = 0;
253
my $actually_updated = 0;
253
my $testdisplay      = $doit ? "" : "WOULD HAVE ";
254
my $testdisplay      = $doit ? "" : "WOULD HAVE ";
254
if ($verbose) {
255
if ($verbose) {
255
    while ( my $target_patron = $target_patrons->next() ) {
256
    while ( my $target_patron = $target_patrons->next() ) {
256
        my $target = Koha::Patrons->find( $target_patron->borrowernumber );
257
        $target_patron->discard_changes();
257
        $verbose
258
        $verbose
258
          and print $testdisplay
259
          and print $testdisplay
259
          . "Updated "
260
          . "Updated "
260
          . $target->firstname . " "
261
          . $target_patron->firstname() . " "
261
          . $target->surname
262
          . $target_patron->surname()
262
          . " from $fromcat to $tocat\n";
263
          . " from $fromcat to $tocat\n";
263
    }
264
    }
264
    $target_patrons->reset;
265
    $target_patrons->reset;
265
- 

Return to bug 25683