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

(-)a/Koha/Charges/Fees.pm (-7 / +12 lines)
Lines 88-96 sub new { Link Here
88
=cut
88
=cut
89
89
90
sub accumulate_rentalcharge {
90
sub accumulate_rentalcharge {
91
    my ( $self ) = @_;
91
    my ($self) = @_;
92
92
93
    my $itemtype = Koha::ItemTypes->find( $self->item->effective_itemtype );
93
    my $itemtype     = Koha::ItemTypes->find( $self->item->effective_itemtype );
94
    my $issuing_rule = Koha::IssuingRules->get_effective_issuing_rule(
94
    my $issuing_rule = Koha::IssuingRules->get_effective_issuing_rule(
95
        {
95
        {
96
            categorycode => $self->patron->categorycode,
96
            categorycode => $self->patron->categorycode,
Lines 99-105 sub accumulate_rentalcharge { Link Here
99
        }
99
        }
100
    );
100
    );
101
    my $units = $issuing_rule->lengthunit;
101
    my $units = $issuing_rule->lengthunit;
102
    my $rentalcharge_increment = ( $units eq 'days' ) ? $itemtype->rentalcharge_daily : $itemtype->rentalcharge_hourly;
102
    my $rentalcharge_increment =
103
      ( $units eq 'days' )
104
      ? $itemtype->rentalcharge_daily
105
      : $itemtype->rentalcharge_hourly;
103
106
104
    return 0 unless $rentalcharge_increment && $rentalcharge_increment > 0;
107
    return 0 unless $rentalcharge_increment && $rentalcharge_increment > 0;
105
108
Lines 108-118 sub accumulate_rentalcharge { Link Here
108
111
109
    if ( $units eq 'hours' ) {
112
    if ( $units eq 'hours' ) {
110
        if ( C4::Context->preference('finesCalendar') eq 'noFinesWhenClosed' ) {
113
        if ( C4::Context->preference('finesCalendar') eq 'noFinesWhenClosed' ) {
111
            $duration =
114
            $duration = $calendar->hours_between(
112
              $calendar->hours_between( $self->from_date, $self->to_date );
115
                $self->from_date->truncate( to => 'minute' ),
116
                $self->to_date->truncate( to => 'minute' )
117
            );
113
        }
118
        }
114
        else {
119
        else {
115
            $duration = $self->to_date->delta_ms($self->from_date);
120
            $duration = $self->to_date->truncate( to => 'minute' )
121
              ->delta_ms( $self->from_date->truncate( to => 'minute' ) );
116
        }
122
        }
117
    }
123
    }
118
    else {
124
    else {
119
- 

Return to bug 23382