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

(-)a/Koha/Charges/Fees.pm (-2 / +2 lines)
Lines 112-118 sub accumulate_rentalcharge { Link Here
112
    my $calendar = Koha::Calendar->new( branchcode => $self->library->id );
112
    my $calendar = Koha::Calendar->new( branchcode => $self->library->id );
113
113
114
    if ( $units eq 'hours' ) {
114
    if ( $units eq 'hours' ) {
115
        if ( C4::Context->preference('finesCalendar') eq 'noFinesWhenClosed' ) {
115
        if ( $itemtype->rentalcharge_hourly_calendar && C4::Context->preference('finesCalendar') eq 'noFinesWhenClosed' ) {
116
            $duration = $calendar->hours_between(
116
            $duration = $calendar->hours_between(
117
                $self->from_date->truncate( to => 'minute' ),
117
                $self->from_date->truncate( to => 'minute' ),
118
                $self->to_date->truncate( to => 'minute' )
118
                $self->to_date->truncate( to => 'minute' )
Lines 124-130 sub accumulate_rentalcharge { Link Here
124
        }
124
        }
125
    }
125
    }
126
    else {
126
    else {
127
        if ( C4::Context->preference('finesCalendar') eq 'noFinesWhenClosed' ) {
127
        if ( $itemtype->rentalcharge_daily_calendar && C4::Context->preference('finesCalendar') eq 'noFinesWhenClosed' ) {
128
            $duration =
128
            $duration =
129
              $calendar->days_between( $self->from_date, $self->to_date );
129
              $calendar->days_between( $self->from_date, $self->to_date );
130
        }
130
        }
(-)a/admin/itemtypes.pl (+6 lines)
Lines 105-110 if ( $op eq 'add_form' ) { Link Here
105
    my $checkinmsgtype = $input->param('checkinmsgtype');
105
    my $checkinmsgtype = $input->param('checkinmsgtype');
106
    my $hideinopac     = $input->param('hideinopac') // 0;
106
    my $hideinopac     = $input->param('hideinopac') // 0;
107
    my $searchcategory = $input->param('searchcategory');
107
    my $searchcategory = $input->param('searchcategory');
108
    my $rentalcharge_daily_calendar  = $input->param('rentalcharge_daily_calendar') // 0;
109
    my $rentalcharge_hourly_calendar = $input->param('rentalcharge_hourly_calendar') // 0;
108
110
109
    if ( $itemtype and $is_a_modif ) {    # it's a modification
111
    if ( $itemtype and $is_a_modif ) {    # it's a modification
110
        $itemtype->description($description);
112
        $itemtype->description($description);
Lines 121-126 if ( $op eq 'add_form' ) { Link Here
121
        $itemtype->sip_media_type($sip_media_type);
123
        $itemtype->sip_media_type($sip_media_type);
122
        $itemtype->hideinopac($hideinopac);
124
        $itemtype->hideinopac($hideinopac);
123
        $itemtype->searchcategory($searchcategory);
125
        $itemtype->searchcategory($searchcategory);
126
        $itemtype->rentalcharge_daily_calendar($rentalcharge_daily_calendar);
127
        $itemtype->rentalcharge_hourly_calendar($rentalcharge_hourly_calendar);
124
128
125
        eval {
129
        eval {
126
          $itemtype->store;
130
          $itemtype->store;
Lines 150-155 if ( $op eq 'add_form' ) { Link Here
150
                sip_media_type      => $sip_media_type,
154
                sip_media_type      => $sip_media_type,
151
                hideinopac          => $hideinopac,
155
                hideinopac          => $hideinopac,
152
                searchcategory      => $searchcategory,
156
                searchcategory      => $searchcategory,
157
                rentalcharge_daily_calendar  => $rentalcharge_daily_calendar,
158
                rentalcharge_hourly_calendar => $rentalcharge_hourly_calendar,
153
            }
159
            }
154
        );
160
        );
155
        eval {
161
        eval {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt (-1 / +18 lines)
Lines 241-251 Item types administration Link Here
241
                    <input type="text" id="rentalcharge_daily" name="rentalcharge_daily" size="10" value="[% itemtype.rentalcharge_daily | $Price on_editing => 1 %]" />
241
                    <input type="text" id="rentalcharge_daily" name="rentalcharge_daily" size="10" value="[% itemtype.rentalcharge_daily | $Price on_editing => 1 %]" />
242
                    <span class="hint">This fee is charged at checkout/renewal time for each day between the checkout/renewal date and due date for loans specified in days.</span>
242
                    <span class="hint">This fee is charged at checkout/renewal time for each day between the checkout/renewal date and due date for loans specified in days.</span>
243
                </li>
243
                </li>
244
                <li>
245
                    <label for="rentalcharge_daily_calendar">Daily rentals use calendar: </label>
246
                        [% IF itemtype.rentalcharge_daily_calendar %]
247
                            <input type="checkbox" id="rentalcharge_daily_calendar" name="rentalcharge_daily_calendar" checked="checked" value="1" />
248
                        [% ELSE %]
249
                            <input type="checkbox" id="rentalcharge_daily_calendar" name="rentalcharge_daily_calendar" value="1" />
250
                        [% END %]
251
                        <span class="hint">If checked, daily charge will be calculated based on the value of the system preference <i>finesCalendar</i>. If not checked, the fee will be calculated based on the number of days until due, directly.</span>
252
                </li>
244
                <li>
253
                <li>
245
                    <label for="rentalcharge_hourly">Hourly rental charge: </label>
254
                    <label for="rentalcharge_hourly">Hourly rental charge: </label>
246
                    <input type="text" id="rentalcharge_hourly" name="rentalcharge_hourly" size="10" value="[% itemtype.rentalcharge_hourly | $Price on_editing => 1 %]" />
255
                    <input type="text" id="rentalcharge_hourly" name="rentalcharge_hourly" size="10" value="[% itemtype.rentalcharge_hourly | $Price on_editing => 1 %]" />
247
                    <span class="hint">This fee is charged at checkout/renewal time for each hour between the checkout/renewal date and due date for loans specified in hours.</span>
256
                    <span class="hint">This fee is charged at checkout/renewal time for each hour between the checkout/renewal date and due date for loans specified in hours.</span>
248
                </li>
257
                </li>
258
                <li>
259
                    <label for="rentalcharge_hourly_calendar">Hourly rentals use calendar: </label>
260
                        [% IF itemtype.rentalcharge_hourly_calendar %]
261
                            <input type="checkbox" id="rentalcharge_hourly_calendar" name="rentalcharge_hourly_calendar" checked="checked" value="1" />
262
                        [% ELSE %]
263
                            <input type="checkbox" id="rentalcharge_hourly_calendar" name="rentalcharge_hourly_calendar" value="1" />
264
                        [% END %]
265
                        <span class="hint">If checked, hourly charge will be calculated based on the value of the system preference <i>finesCalendar</i>. If not checked, the fee will be calculated based on the number of hours until due, directly.</span>
266
                </li>
249
                <li>
267
                <li>
250
                    <label for="defaultreplacecost">Default replacement cost: </label>
268
                    <label for="defaultreplacecost">Default replacement cost: </label>
251
                    <input type="text" id="defaultreplacecost" name="defaultreplacecost" size="10" value="[% itemtype.defaultreplacecost | html %]" />
269
                    <input type="text" id="defaultreplacecost" name="defaultreplacecost" size="10" value="[% itemtype.defaultreplacecost | html %]" />
252
- 

Return to bug 21443