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

(-)a/misc/cronjobs/fines.pl (-3 / +16 lines)
Lines 101-106 my $control = C4::Context->preference('CircControl'); Link Here
101
my $mode         = C4::Context->preference('finesMode');
101
my $mode         = C4::Context->preference('finesMode');
102
my $delim = "\t";    # ?  C4::Context->preference('CSVDelimiter') || "\t";
102
my $delim = "\t";    # ?  C4::Context->preference('CSVDelimiter') || "\t";
103
103
104
my %is_holiday;
104
my $today = dt_from_string();
105
my $today = dt_from_string();
105
my $filename;
106
my $filename;
106
if ($log or $output_dir) {
107
if ($log or $output_dir) {
Lines 130-136 for my $overdue ( @{$overdues} ) { Link Here
130
        ( $control eq 'ItemHomeLibrary' ) ? $overdue->{homebranch}
131
        ( $control eq 'ItemHomeLibrary' ) ? $overdue->{homebranch}
131
      : ( $control eq 'PatronLibrary' )   ? $patron->branchcode
132
      : ( $control eq 'PatronLibrary' )   ? $patron->branchcode
132
      :                                     $overdue->{branchcode};
133
      :                                     $overdue->{branchcode};
133
    # In final case, CircControl must be PickupLibrary. (branchcode comes from issues table here).
134
135
# In final case, CircControl must be PickupLibrary. (branchcode comes from issues table here).
136
    if ( !exists $is_holiday{$branchcode} ) {
137
        $is_holiday{$branchcode} = set_holiday( $branchcode, $today );
138
    }
134
139
135
    my $datedue = dt_from_string( $overdue->{date_due} );
140
    my $datedue = dt_from_string( $overdue->{date_due} );
136
    if ( DateTime->compare( $datedue, $today ) == 1 ) {
141
    if ( DateTime->compare( $datedue, $today ) == 1 ) {
Lines 142-148 for my $overdue ( @{$overdues} ) { Link Here
142
      CalcFine( $overdue, $patron->categorycode,
147
      CalcFine( $overdue, $patron->categorycode,
143
        $branchcode, $datedue, $today );
148
        $branchcode, $datedue, $today );
144
149
145
    if ( $mode eq 'production' ) {
150
    # Don't update the fine if today is a holiday.
151
    # This ensures that dropbox mode will remove the correct amount of fine.
152
    if ( $mode eq 'production' && !$is_holiday{$branchcode} ) {
146
        if ( $amount && $amount > 0 ) {
153
        if ( $amount && $amount > 0 ) {
147
            UpdateFine(
154
            UpdateFine(
148
                {
155
                {
Lines 186-191 Number of Overdue Items: Link Here
186
EOM
193
EOM
187
}
194
}
188
195
196
sub set_holiday {
197
    my ( $branch, $dt ) = @_;
198
199
    my $calendar = Koha::Calendar->new( branchcode => $branch );
200
    return $calendar->is_holiday($dt);
201
}
202
189
sub get_filename {
203
sub get_filename {
190
    my $directory = shift;
204
    my $directory = shift;
191
    if ( !$directory ) {
205
    if ( !$directory ) {
192
- 

Return to bug 27835