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

(-)a/misc/cronjobs/fines.pl (-8 / +21 lines)
Lines 41-46 use Try::Tiny qw( catch try ); Link Here
41
use Koha::Calendar;
41
use Koha::Calendar;
42
use Koha::DateUtils qw( dt_from_string output_pref );
42
use Koha::DateUtils qw( dt_from_string output_pref );
43
use Koha::Patrons;
43
use Koha::Patrons;
44
use Koha::Database;
44
use C4::Log qw( cronlogaction );
45
use C4::Log qw( cronlogaction );
45
46
46
my $help;
47
my $help;
Lines 100-105 my $libname = C4::Context->preference('LibraryName'); Link Here
100
my $control      = C4::Context->preference('CircControl');
101
my $control      = C4::Context->preference('CircControl');
101
my $mode         = C4::Context->preference('finesMode');
102
my $mode         = C4::Context->preference('finesMode');
102
my $delim = "\t";    # ?  C4::Context->preference('CSVDelimiter') || "\t";
103
my $delim = "\t";    # ?  C4::Context->preference('CSVDelimiter') || "\t";
104
my $dbh = Koha::Database->dbh;
103
105
104
my %is_holiday;
106
my %is_holiday;
105
my $today = dt_from_string();
107
my $today = dt_from_string();
Lines 157-172 for my $overdue ( @{$overdues} ) { Link Here
157
        && ( $amount && $amount > 0 )
159
        && ( $amount && $amount > 0 )
158
      )
160
      )
159
    {
161
    {
160
        UpdateFine(
162
        # Make sure the fine hasn't changed since the script started.
163
        $dbh->do('LOCK TABLES accountlines');
164
        my $fines = Koha::Account::Lines->search(
161
            {
165
            {
162
                issue_id       => $overdue->{issue_id},
166
                issue_id => $overdue->{issue_id},
163
                itemnumber     => $overdue->{itemnumber},
167
                debit_type_code => 'OVERDUE',
164
                borrowernumber => $overdue->{borrowernumber},
168
                status => 'UNRETURNED',
165
                amount         => $amount,
166
                due            => output_pref($datedue),
167
            }
169
            }
168
        );
170
        );
169
        $updated++;
171
        if ( $fines->count == 1 ) {
172
            UpdateFine(
173
                {
174
                    issue_id       => $overdue->{issue_id},
175
                    itemnumber     => $overdue->{itemnumber},
176
                    borrowernumber => $overdue->{borrowernumber},
177
                    amount         => $amount,
178
                    due            => output_pref($datedue),
179
                }
180
            );
181
            $updated++;
182
        }
183
        $dbh->do('UNLOCK TABLES');
170
    }
184
    }
171
    my $borrower = $patron->unblessed;
185
    my $borrower = $patron->unblessed;
172
    if ($filename) {
186
    if ($filename) {
173
- 

Return to bug 18855