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

(-)a/C4/Circulation.pm (-7 / +8 lines)
Lines 768-787 sub CanBookBeIssued { Link Here
768
        $issuingimpossible{EXPIRED} = 1;
768
        $issuingimpossible{EXPIRED} = 1;
769
    } else {
769
    } else {
770
        my ($y, $m, $d) =  split /-/,$borrower->{'dateexpiry'};
770
        my ($y, $m, $d) =  split /-/,$borrower->{'dateexpiry'};
771
        if ($y && $m && $d) { # are we really writing oinvalid dates to borrs
771
        if ($y && $m && $d) { # are we really writing invalid dates to borrs
772
            my $expiry_dt = DateTime->new(
772
            my $expiry_dt = DateTime->new(
773
                year => $y,
773
                year => $y,
774
                month => $m,
774
                month => $m,
775
                day   => $d,
775
                day   => $d,
776
                time_zone => C4::Context->tz,
776
                time_zone => 'floating', #prevent trouble with future dates in named timezones (see bug 13242, 14494)
777
            );
777
            );
778
            $expiry_dt->truncate( to => 'day');
778
            $expiry_dt->truncate( to => 'day');
779
            my $today = $now->clone()->truncate(to => 'day');
779
            my $today = $now->clone()->truncate(to => 'day');
780
            $today->set_time_zone( 'floating' );
780
            if (DateTime->compare($today, $expiry_dt) == 1) {
781
            if (DateTime->compare($today, $expiry_dt) == 1) {
781
                $issuingimpossible{EXPIRED} = 1;
782
                $issuingimpossible{EXPIRED} = 1;
782
            }
783
            }
783
        } else {
784
        } else {
784
            carp("Invalid expity date in borr");
785
            carp("Invalid expiry date in borr");
785
            $issuingimpossible{EXPIRED} = 1;
786
            $issuingimpossible{EXPIRED} = 1;
786
        }
787
        }
787
    }
788
    }
Lines 3457-3466 sub CalcDateDue { Link Here
3457
3458
3458
    # if ReturnBeforeExpiry ON the datedue can't be after borrower expirydate
3459
    # if ReturnBeforeExpiry ON the datedue can't be after borrower expirydate
3459
    if ( C4::Context->preference('ReturnBeforeExpiry') ) {
3460
    if ( C4::Context->preference('ReturnBeforeExpiry') ) {
3460
        my $expiry_dt = dt_from_string( $borrower->{dateexpiry}, 'iso' );
3461
        my $expiry_dt = dt_from_string( $borrower->{dateexpiry}, 'iso', 'floating');
3461
        $expiry_dt->set( hour => 23, minute => 59);
3462
        $expiry_dt->set( hour => 23, minute => 59);
3462
        if ( DateTime->compare( $datedue, $expiry_dt ) == 1 ) {
3463
        my $d1= $datedue->clone->set_time_zone('floating');
3463
            $datedue = $expiry_dt->clone;
3464
        if ( DateTime->compare( $d1, $expiry_dt ) == 1 ) {
3465
            $datedue = $expiry_dt->clone->set_time_zone( C4::Context->tz );
3464
        }
3466
        }
3465
    }
3467
    }
3466
3468
3467
- 

Return to bug 14494