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

(-)a/C4/Circulation.pm (-9 / +9 lines)
Lines 701-707 sub CanBookBeIssued { Link Here
701
    }
701
    }
702
    if ($duedate) {
702
    if ($duedate) {
703
        my $today = $now->clone();
703
        my $today = $now->clone();
704
        $today->truncate( to => 'minutes');
704
        $today->truncate( to => 'minute');
705
        if (DateTime->compare($duedate,$today) == -1 ) { # duedate cannot be before now
705
        if (DateTime->compare($duedate,$today) == -1 ) { # duedate cannot be before now
706
            $needsconfirmation{INVALID_DATE} = output_pref($duedate);
706
            $needsconfirmation{INVALID_DATE} = output_pref($duedate);
707
        }
707
        }
Lines 738-745 sub CanBookBeIssued { Link Here
738
                day   => $d,
738
                day   => $d,
739
                time_zone => C4::Context->tz,
739
                time_zone => C4::Context->tz,
740
            );
740
            );
741
            $expiry_dt->truncate( to => 'days');
741
            $expiry_dt->truncate( to => 'day');
742
            my $today = $now->clone()->truncate(to => 'days');
742
            my $today = $now->clone()->truncate(to => 'day');
743
            if (DateTime->compare($today, $expiry_dt) == 1) {
743
            if (DateTime->compare($today, $expiry_dt) == 1) {
744
                $issuingimpossible{EXPIRED} = 1;
744
                $issuingimpossible{EXPIRED} = 1;
745
            }
745
            }
Lines 1051-1057 sub AddIssue { Link Here
1051
            $datedue = CalcDateDue( $issuedate, $itype, $branch, $borrower );
1051
            $datedue = CalcDateDue( $issuedate, $itype, $branch, $borrower );
1052
1052
1053
        }
1053
        }
1054
        $datedue->truncate( to => 'minutes');
1054
        $datedue->truncate( to => 'minute');
1055
        $sth->execute(
1055
        $sth->execute(
1056
            $borrower->{'borrowernumber'},      # borrowernumber
1056
            $borrower->{'borrowernumber'},      # borrowernumber
1057
            $item->{'itemnumber'},              # itemnumber
1057
            $item->{'itemnumber'},              # itemnumber
Lines 2084-2093 sub GetItemIssue { Link Here
2084
    my $data = $sth->fetchrow_hashref;
2084
    my $data = $sth->fetchrow_hashref;
2085
    return unless $data;
2085
    return unless $data;
2086
    $data->{issuedate} = dt_from_string($data->{issuedate}, 'sql');
2086
    $data->{issuedate} = dt_from_string($data->{issuedate}, 'sql');
2087
    $data->{issuedate}->truncate(to => 'minutes');
2087
    $data->{issuedate}->truncate(to => 'minute');
2088
    $data->{date_due} = dt_from_string($data->{date_due}, 'sql');
2088
    $data->{date_due} = dt_from_string($data->{date_due}, 'sql');
2089
    $data->{date_due}->truncate(to => 'minutes');
2089
    $data->{date_due}->truncate(to => 'minute');
2090
    my $dt = DateTime->now( time_zone => C4::Context->tz)->truncate( to => 'minutes');
2090
    my $dt = DateTime->now( time_zone => C4::Context->tz)->truncate( to => 'minute');
2091
    $data->{'overdue'} = DateTime->compare($data->{'date_due'}, $dt ) == -1 ? 1 : 0;
2091
    $data->{'overdue'} = DateTime->compare($data->{'date_due'}, $dt ) == -1 ? 1 : 0;
2092
    return $data;
2092
    return $data;
2093
}
2093
}
Lines 2132-2138 sub GetItemIssues { Link Here
2132
    my ( $itemnumber, $history ) = @_;
2132
    my ( $itemnumber, $history ) = @_;
2133
    
2133
    
2134
    my $today = DateTime->now( time_zome => C4::Context->tz);  # get today date
2134
    my $today = DateTime->now( time_zome => C4::Context->tz);  # get today date
2135
    $today->truncate( to => 'minutes' );
2135
    $today->truncate( to => 'minute' );
2136
    my $sql = "SELECT * FROM issues
2136
    my $sql = "SELECT * FROM issues
2137
              JOIN borrowers USING (borrowernumber)
2137
              JOIN borrowers USING (borrowernumber)
2138
              JOIN items     USING (itemnumber)
2138
              JOIN items     USING (itemnumber)
Lines 2154-2160 sub GetItemIssues { Link Here
2154
    my $results = $sth->fetchall_arrayref({});
2154
    my $results = $sth->fetchall_arrayref({});
2155
    foreach (@$results) {
2155
    foreach (@$results) {
2156
        my $date_due = dt_from_string($_->{date_due},'sql');
2156
        my $date_due = dt_from_string($_->{date_due},'sql');
2157
        $date_due->truncate( to => 'minutes' );
2157
        $date_due->truncate( to => 'minute' );
2158
2158
2159
        $_->{overdue} = (DateTime->compare($date_due, $today) == -1) ? 1 : 0;
2159
        $_->{overdue} = (DateTime->compare($date_due, $today) == -1) ? 1 : 0;
2160
    }
2160
    }
(-)a/Koha/Calendar.pm (-3 / +3 lines)
Lines 147-153 sub is_holiday { Link Here
147
    if ( $self->{weekly_closed_days}->[$dow] == 1 ) {
147
    if ( $self->{weekly_closed_days}->[$dow] == 1 ) {
148
        return 1;
148
        return 1;
149
    }
149
    }
150
    $dt->truncate( to => 'days' );
150
    $dt->truncate( to => 'day' );
151
    my $day   = $dt->day;
151
    my $day   = $dt->day;
152
    my $month = $dt->month;
152
    my $month = $dt->month;
153
    if ( exists $self->{day_month_closed_days}->{$month}->{$day} ) {
153
    if ( exists $self->{day_month_closed_days}->{$month}->{$day} ) {
Lines 189-196 sub days_between { Link Here
189
sub hours_between {
189
sub hours_between {
190
    my ($self, $start_dt, $end_dt) = @_;
190
    my ($self, $start_dt, $end_dt) = @_;
191
    my $duration = $end_dt->delta_ms($start_dt);
191
    my $duration = $end_dt->delta_ms($start_dt);
192
    $start_dt->truncate( to => 'days' );
192
    $start_dt->truncate( to => 'day' );
193
    $end_dt->truncate( to => 'days' );
193
    $end_dt->truncate( to => 'day' );
194
    # NB this is a kludge in that it assumes all days are 24 hours
194
    # NB this is a kludge in that it assumes all days are 24 hours
195
    # However for hourly loans the logic should be expanded to
195
    # However for hourly loans the logic should be expanded to
196
    # take into account open/close times then it would be a duration
196
    # take into account open/close times then it would be a duration
(-)a/Koha/DateUtils.pm (-2 / +2 lines)
Lines 158-164 sub format_sqldatetime { Link Here
158
    my $force_pref = shift;    # if testing we want to override Context
158
    my $force_pref = shift;    # if testing we want to override Context
159
    if ( defined $str && $str =~ m/^\d{4}-\d{2}-\d{2}/ ) {
159
    if ( defined $str && $str =~ m/^\d{4}-\d{2}-\d{2}/ ) {
160
        my $dt = dt_from_string( $str, 'sql' );
160
        my $dt = dt_from_string( $str, 'sql' );
161
        $dt->truncate( to => 'minutes' );
161
        $dt->truncate( to => 'minute' );
162
        return output_pref( $dt, $force_pref );
162
        return output_pref( $dt, $force_pref );
163
    }
163
    }
164
    return q{};
164
    return q{};
Lines 178-184 sub format_sqlduedatetime { Link Here
178
    my $force_pref = shift;    # if testing we want to override Context
178
    my $force_pref = shift;    # if testing we want to override Context
179
    if ( defined $str && $str =~ m/^\d{4}-\d{2}-\d{2}/ ) {
179
    if ( defined $str && $str =~ m/^\d{4}-\d{2}-\d{2}/ ) {
180
        my $dt = dt_from_string( $str, 'sql' );
180
        my $dt = dt_from_string( $str, 'sql' );
181
        $dt->truncate( to => 'minutes' );
181
        $dt->truncate( to => 'minute' );
182
        return output_pref_due( $dt, $force_pref );
182
        return output_pref_due( $dt, $force_pref );
183
    }
183
    }
184
    return q{};
184
    return q{};
(-)a/circ/overdue.pl (-1 / +1 lines)
Lines 239-245 if ($noreport) { Link Here
239
239
240
240
241
    my $today_dt = DateTime->now(time_zone => C4::Context->tz);
241
    my $today_dt = DateTime->now(time_zone => C4::Context->tz);
242
    $today_dt->truncate(to => 'minutes');
242
    $today_dt->truncate(to => 'minute');
243
    my $todaysdate = $today_dt->strftime('%Y-%m-%d %H:%M');
243
    my $todaysdate = $today_dt->strftime('%Y-%m-%d %H:%M');
244
244
245
    $bornamefilter =~s/\*/\%/g;
245
    $bornamefilter =~s/\*/\%/g;
(-)a/circ/returns.pl (-1 / +1 lines)
Lines 250-256 if ($barcode) { Link Here
250
    );
250
    );
251
251
252
    if ($returned) {
252
    if ($returned) {
253
        my $time_now = DateTime->now( time_zone => C4::Context->tz )->truncate( to => 'minutes');
253
        my $time_now = DateTime->now( time_zone => C4::Context->tz )->truncate( to => 'minute');
254
        my $duedate = $issueinformation->{date_due}->strftime('%Y-%m-%d %H:%M');
254
        my $duedate = $issueinformation->{date_due}->strftime('%Y-%m-%d %H:%M');
255
        $returneditems{0}      = $barcode;
255
        $returneditems{0}      = $barcode;
256
        $riborrowernumber{0}   = $borrower->{'borrowernumber'};
256
        $riborrowernumber{0}   = $borrower->{'borrowernumber'};
(-)a/members/moremember.pl (-3 / +2 lines)
Lines 251-257 if ( @borrowernumbers ) { Link Here
251
}
251
}
252
my $roaddetails = &GetRoadTypeDetails( $data->{'streettype'} );
252
my $roaddetails = &GetRoadTypeDetails( $data->{'streettype'} );
253
my $today       = DateTime->now( time_zone => C4::Context->tz);
253
my $today       = DateTime->now( time_zone => C4::Context->tz);
254
$today->truncate(to => 'days');
254
$today->truncate(to => 'day');
255
my @borrowers_with_issues;
255
my @borrowers_with_issues;
256
my $overdues_exist = 0;
256
my $overdues_exist = 0;
257
my $totalprice = 0;
257
my $totalprice = 0;
Lines 494-500 sub build_issue_data { Link Here
494
            $row{red} = 1;
494
            $row{red} = 1;
495
        }
495
        }
496
        if ($issuedate) {
496
        if ($issuedate) {
497
            $issuedate->truncate( to => 'days' );
497
            $issuedate->truncate( to => 'day' );
498
            if ( DateTime->compare( $issuedate, $today ) == 0 ) {
498
            if ( DateTime->compare( $issuedate, $today ) == 0 ) {
499
                $row{today} = 1;
499
                $row{today} = 1;
500
            }
500
            }
501
- 

Return to bug 8251