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

(-)a/C4/Reserves.pm (-5 / +24 lines)
Lines 1060-1066 sub CancelExpiredReserves { Link Here
1060
    # Cancel reserves that have been waiting too long
1060
    # Cancel reserves that have been waiting too long
1061
    if ( C4::Context->preference("ExpireReservesMaxPickUpDelay") ) {
1061
    if ( C4::Context->preference("ExpireReservesMaxPickUpDelay") ) {
1062
        my $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay");
1062
        my $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay");
1063
        my $charge = C4::Context->preference("ExpireReservesMaxPickUpDelayCharge");
1064
        my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays');
1063
        my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays');
1065
1064
1066
        my $today = dt_from_string();
1065
        my $today = dt_from_string();
Lines 1081-1090 sub CancelExpiredReserves { Link Here
1081
            }
1080
            }
1082
1081
1083
            if ( $do_cancel ) {
1082
            if ( $do_cancel ) {
1084
                if ( $charge ) {
1085
                    manualinvoice($res->{'borrowernumber'}, $res->{'itemnumber'}, 'Hold waiting too long', 'F', $charge);
1086
                }
1087
1088
                CancelReserve({ reserve_id => $res->{'reserve_id'} });
1083
                CancelReserve({ reserve_id => $res->{'reserve_id'} });
1089
            }
1084
            }
1090
        }
1085
        }
Lines 1130-1135 sub CancelReserve { Link Here
1130
1125
1131
    my $reserve = GetReserve( $reserve_id );
1126
    my $reserve = GetReserve( $reserve_id );
1132
    if ($reserve) {
1127
    if ($reserve) {
1128
        # Charge for canceled reserves that have been waiting too long
1129
        if (   $reserve->{found} eq 'W'
1130
            && $reserve->{priority} == 0
1131
            && C4::Context->preference("ExpireReservesMaxPickUpDelay") )
1132
        {
1133
            my $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay");
1134
1135
            my $now          = dt_from_string();
1136
            my $waitingdate  = dt_from_string( $reserve->{waitingdate} );
1137
            my $duration     = $waitingdate->delta_days($now);
1138
            my $days_waiting = $duration->in_units('days');
1139
            if ( $days_waiting > $max_pickup_delay ) {
1140
                my $charge = C4::Context->preference("ExpireReservesMaxPickUpDelayCharge");
1141
                if ($charge) {
1142
                    manualinvoice(
1143
                        $reserve->{'borrowernumber'},
1144
                        $reserve->{'itemnumber'},
1145
                        'Hold waiting too long',
1146
                        'F', $charge
1147
                    );
1148
                }
1149
            }
1150
        }
1151
1133
        my $query = "
1152
        my $query = "
1134
            UPDATE reserves
1153
            UPDATE reserves
1135
            SET    cancellationdate = now(),
1154
            SET    cancellationdate = now(),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (-2 / +1 lines)
Lines 480-486 Circulation: Link Here
480
                  no: "Don't allow"
480
                  no: "Don't allow"
481
            - "holds to expire automatically if they have not been picked by within the time period specified in ReservesMaxPickUpDelay"
481
            - "holds to expire automatically if they have not been picked by within the time period specified in ReservesMaxPickUpDelay"
482
        -
482
        -
483
            - If using ExpireReservesMaxPickUpDelay, charge a borrower who allows his or her waiting hold to expire a fee of
483
            - Charge a borrower who allows his or her waiting hold to expire be canceled a fee of
484
            - pref: ExpireReservesMaxPickUpDelayCharge
484
            - pref: ExpireReservesMaxPickUpDelayCharge
485
              class: currency
485
              class: currency
486
        -
486
        -
487
- 

Return to bug 14137