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

(-)a/C4/Circulation.pm (-34 / +33 lines)
Lines 1151-1173 sub CanBookBeIssued { Link Here
1151
            }
1151
            }
1152
        }
1152
        }
1153
1153
1154
        my $now = dt_from_string();
1154
        if ( C4::Context->preference("PreventCheckoutOnSameReservePeriod") ) {
1155
        my $preventCheckoutOnSameReservePeriod =
1155
            my $now = dt_from_string();
1156
            C4::Context->preference("PreventCheckoutOnSameReservePeriod");
1156
            my $reserves_on_same_period =
1157
        my $reserves_on_same_period =
1157
                ReservesOnSamePeriod($item_object->biblionumber, $item_object->itemnumber, $now->ymd, $duedate->ymd);
1158
            ReservesOnSamePeriod($item_object->biblionumber, $item_object->itemnumber, $now->ymd, $duedate->ymd);
1158
            if ($reserves_on_same_period) {
1159
        if ($preventCheckoutOnSameReservePeriod && $reserves_on_same_period) {
1159
                my $reserve = $reserves_on_same_period->[0];
1160
            my $reserve = $reserves_on_same_period->[0];
1160
                if ($reserve->{borrowernumber} ne $patron->borrowernumber) {
1161
            if ($reserve->{borrowernumber} ne $patron->borrowernumber) {
1161
                    my $patron = Koha::Patrons->find( $reserve->{borrowernumber} );
1162
                my $patron = Koha::Patrons->find( $reserve->{borrowernumber} );
1162
                    $needsconfirmation{RESERVED} = 1;
1163
                $needsconfirmation{RESERVED} = 1;
1163
                    $needsconfirmation{resfirstname} = $patron->firstname;
1164
                $needsconfirmation{resfirstname} = $patron->firstname;
1164
                    $needsconfirmation{ressurname} = $patron->surname;
1165
                $needsconfirmation{ressurname} = $patron->surname;
1165
                    $needsconfirmation{rescardnumber} = $patron->cardnumber;
1166
                $needsconfirmation{rescardnumber} = $patron->cardnumber;
1166
                    $needsconfirmation{resborrowernumber} = $patron->borrowernumber;
1167
                $needsconfirmation{resborrowernumber} = $patron->borrowernumber;
1167
                    $needsconfirmation{resbranchcode} = $patron->branchcode;
1168
                $needsconfirmation{resbranchcode} = $patron->branchcode;
1168
                    $needsconfirmation{resreservedate} = $reserve->{reservedate};
1169
                $needsconfirmation{resreservedate} = $reserve->{reservedate};
1169
                    $needsconfirmation{reserve_id} = $reserve->{reserve_id};
1170
                $needsconfirmation{reserve_id} = $reserve->{reserve_id};
1170
                }
1171
            }
1171
            }
1172
        }
1172
        }
1173
1173
Lines 2849-2871 sub CanBookBeRenewed { Link Here
2849
        }
2849
        }
2850
    }
2850
    }
2851
2851
2852
    unless ($date_due) {
2852
    if ( C4::Context->preference("PreventCheckoutOnSameReservePeriod") ) {
2853
        my $itemtype = $item->effective_itemtype;
2853
        unless ($date_due) {
2854
        my $patron_unblessed = $patron->unblessed;
2854
            my $itemtype = $item->effective_itemtype;
2855
        $date_due = (C4::Context->preference('RenewalPeriodBase') eq 'date_due') ?
2855
            my $patron_unblessed = $patron->unblessed;
2856
                                        dt_from_string( $issue->date_due, 'sql' ) :
2856
            $date_due = (C4::Context->preference('RenewalPeriodBase') eq 'date_due') ?
2857
                                        dt_from_string();
2857
                                            dt_from_string( $issue->date_due, 'sql' ) :
2858
        $date_due =  CalcDateDue($date_due, $itemtype, _GetCircControlBranch($item->unblessed(), $patron_unblessed), $patron_unblessed, 'is a renewal');
2858
                                            dt_from_string();
2859
    }
2859
            $date_due =  CalcDateDue($date_due, $itemtype, _GetCircControlBranch($item->unblessed(), $patron_unblessed), $patron_unblessed, 'is a renewal');
2860
2860
        }
2861
    my $now = dt_from_string();
2861
        my $now = dt_from_string();
2862
    my $biblionumber = $item->biblionumber;
2862
        my $biblionumber = $item->biblionumber;
2863
    my $preventCheckoutOnSameReservePeriod =
2863
        my $reserves_on_same_period =
2864
        C4::Context->preference("PreventCheckoutOnSameReservePeriod");
2864
            ReservesOnSamePeriod($biblionumber, $itemnumber, $now->ymd, $date_due->ymd);
2865
    my $reserves_on_same_period =
2865
        if ($reserves_on_same_period) {
2866
        ReservesOnSamePeriod($biblionumber, $itemnumber, $now->ymd, $date_due->ymd);
2866
            $resfound = 1;
2867
    if ($preventCheckoutOnSameReservePeriod && $reserves_on_same_period) {
2867
        }
2868
        $resfound = 1;
2869
    }
2868
    }
2870
2869
2871
    if( $cron ) { #The cron wants to return 'too_soon' over 'on_reserve'
2870
    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