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

(-)a/C4/Circulation.pm (-34 / +33 lines)
Lines 1149-1171 sub CanBookBeIssued { Link Here
1149
            }
1149
            }
1150
        }
1150
        }
1151
1151
1152
        my $now = dt_from_string();
1152
        if ( C4::Context->preference("PreventCheckoutOnSameReservePeriod") ) {
1153
        my $preventCheckoutOnSameReservePeriod =
1153
            my $now = dt_from_string();
1154
            C4::Context->preference("PreventCheckoutOnSameReservePeriod");
1154
            my $reserves_on_same_period =
1155
        my $reserves_on_same_period =
1155
                ReservesOnSamePeriod($item_object->biblionumber, $item_object->itemnumber, $now->ymd, $duedate->ymd);
1156
            ReservesOnSamePeriod($item_object->biblionumber, $item_object->itemnumber, $now->ymd, $duedate->ymd);
1156
            if ($reserves_on_same_period) {
1157
        if ($preventCheckoutOnSameReservePeriod && $reserves_on_same_period) {
1157
                my $reserve = $reserves_on_same_period->[0];
1158
            my $reserve = $reserves_on_same_period->[0];
1158
                if ($reserve->{borrowernumber} ne $patron->borrowernumber) {
1159
            if ($reserve->{borrowernumber} ne $patron->borrowernumber) {
1159
                    my $patron = Koha::Patrons->find( $reserve->{borrowernumber} );
1160
                my $patron = Koha::Patrons->find( $reserve->{borrowernumber} );
1160
                    $needsconfirmation{RESERVED} = 1;
1161
                $needsconfirmation{RESERVED} = 1;
1161
                    $needsconfirmation{resfirstname} = $patron->firstname;
1162
                $needsconfirmation{resfirstname} = $patron->firstname;
1162
                    $needsconfirmation{ressurname} = $patron->surname;
1163
                $needsconfirmation{ressurname} = $patron->surname;
1163
                    $needsconfirmation{rescardnumber} = $patron->cardnumber;
1164
                $needsconfirmation{rescardnumber} = $patron->cardnumber;
1164
                    $needsconfirmation{resborrowernumber} = $patron->borrowernumber;
1165
                $needsconfirmation{resborrowernumber} = $patron->borrowernumber;
1165
                    $needsconfirmation{resbranchcode} = $patron->branchcode;
1166
                $needsconfirmation{resbranchcode} = $patron->branchcode;
1166
                    $needsconfirmation{resreservedate} = $reserve->{reservedate};
1167
                $needsconfirmation{resreservedate} = $reserve->{reservedate};
1167
                    $needsconfirmation{reserve_id} = $reserve->{reserve_id};
1168
                $needsconfirmation{reserve_id} = $reserve->{reserve_id};
1168
                }
1169
            }
1169
            }
1170
        }
1170
        }
1171
1171
Lines 2942-2964 sub CanBookBeRenewed { Link Here
2942
        }
2942
        }
2943
    }
2943
    }
2944
2944
2945
    unless ($date_due) {
2945
    if ( C4::Context->preference("PreventCheckoutOnSameReservePeriod") ) {
2946
        my $itemtype = $item->effective_itemtype;
2946
        unless ($date_due) {
2947
        my $patron_unblessed = $patron->unblessed;
2947
            my $itemtype = $item->effective_itemtype;
2948
        $date_due = (C4::Context->preference('RenewalPeriodBase') eq 'date_due') ?
2948
            my $patron_unblessed = $patron->unblessed;
2949
                                        dt_from_string( $issue->date_due, 'sql' ) :
2949
            $date_due = (C4::Context->preference('RenewalPeriodBase') eq 'date_due') ?
2950
                                        dt_from_string();
2950
                                            dt_from_string( $issue->date_due, 'sql' ) :
2951
        $date_due =  CalcDateDue($date_due, $itemtype, _GetCircControlBranch($item->unblessed(), $patron_unblessed), $patron_unblessed, 'is a renewal');
2951
                                            dt_from_string();
2952
    }
2952
            $date_due =  CalcDateDue($date_due, $itemtype, _GetCircControlBranch($item->unblessed(), $patron_unblessed), $patron_unblessed, 'is a renewal');
2953
2953
        }
2954
    my $now = dt_from_string();
2954
        my $now = dt_from_string();
2955
    my $biblionumber = $item->biblionumber;
2955
        my $biblionumber = $item->biblionumber;
2956
    my $preventCheckoutOnSameReservePeriod =
2956
        my $reserves_on_same_period =
2957
        C4::Context->preference("PreventCheckoutOnSameReservePeriod");
2957
            ReservesOnSamePeriod($biblionumber, $itemnumber, $now->ymd, $date_due->ymd);
2958
    my $reserves_on_same_period =
2958
        if ($reserves_on_same_period) {
2959
        ReservesOnSamePeriod($biblionumber, $itemnumber, $now->ymd, $date_due->ymd);
2959
            $resfound = 1;
2960
    if ($preventCheckoutOnSameReservePeriod && $reserves_on_same_period) {
2960
        }
2961
        $resfound = 1;
2962
    }
2961
    }
2963
2962
2964
    if( $cron ) { #The cron wants to return 'too_soon' over 'on_reserve'
2963
    if( $cron ) { #The cron wants to return 'too_soon' over 'on_reserve'
(-)a/opac/opac-reserve.pl (-4 / +2 lines)
Lines 286-294 if ( $query->param('place_reserve') ) { Link Here
286
            $itemNum = undef;
286
            $itemNum = undef;
287
        }
287
        }
288
288
289
        if ($canreserve) {
289
        if ( $canreserve && C4::Context->preference("PreventReservesOnSamePeriod") ) {
290
            if (C4::Context->preference("PreventReservesOnSamePeriod") &&
290
            if ( ReservesOnSamePeriod($biblioNum, $itemNum, $startdate, $expiration_date) ) {
291
                ReservesOnSamePeriod($biblioNum, $itemNum, $startdate, $expiration_date)) {
292
                $canreserve = 0;
291
                $canreserve = 0;
293
                $failed_holds++;
292
                $failed_holds++;
294
            }
293
            }
295
- 

Return to bug 15261