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

(-)a/C4/Circulation.pm (-1 / +2 lines)
Lines 2781-2788 sub CanBookBeRenewed { Link Here
2781
            foreach my $b (@borrowernumbers) {
2781
            foreach my $b (@borrowernumbers) {
2782
                my ($borr) = C4::Members::GetMember( borrowernumber => $b);
2782
                my ($borr) = C4::Members::GetMember( borrowernumber => $b);
2783
                foreach my $i (@itemnumbers) {
2783
                foreach my $i (@itemnumbers) {
2784
                    my $hold = Koha::Holds->find( { itemnumber => $i } );
2784
                    my $item = GetItem($i);
2785
                    my $item = GetItem($i);
2785
                    if (  !IsItemOnHoldAndFound($i)
2786
                    if (  ( not $hold or not $hold->is_found )
2786
                        && IsAvailableForItemLevelRequest( $item, $borr )
2787
                        && IsAvailableForItemLevelRequest( $item, $borr )
2787
                        && CanItemBeReserved( $b, $i ) )
2788
                        && CanItemBeReserved( $b, $i ) )
2788
                    {
2789
                    {
(-)a/C4/Reserves.pm (-28 / +2 lines)
Lines 145-152 BEGIN { Link Here
145
145
146
        &GetReservesControlBranch
146
        &GetReservesControlBranch
147
147
148
        IsItemOnHoldAndFound
149
150
        GetMaxPatronHoldsForRecord
148
        GetMaxPatronHoldsForRecord
151
    );
149
    );
152
    @EXPORT_OK = qw( MergeHolds );
150
    @EXPORT_OK = qw( MergeHolds );
Lines 1512-1523 sub IsAvailableForItemLevelRequest { Link Here
1512
        my $any_available = 0;
1510
        my $any_available = 0;
1513
1511
1514
        foreach my $i (@items) {
1512
        foreach my $i (@items) {
1513
            my $hold = Koha::Holds->find( { itemnumber => $i } );
1515
            $any_available = 1
1514
            $any_available = 1
1516
              unless $i->itemlost
1515
              unless $i->itemlost
1517
              || $i->{notforloan} > 0
1516
              || $i->{notforloan} > 0
1518
              || $i->withdrawn
1517
              || $i->withdrawn
1519
              || $i->onloan
1518
              || $i->onloan
1520
              || IsItemOnHoldAndFound( $i->id )
1519
              || ( $hold and $hold->is_found )
1521
              || ( $i->damaged
1520
              || ( $i->damaged
1522
                && !C4::Context->preference('AllowHoldsOnDamagedItems') )
1521
                && !C4::Context->preference('AllowHoldsOnDamagedItems') )
1523
              || Koha::ItemTypes->find( $i->effective_itemtype() )->notforloan;
1522
              || Koha::ItemTypes->find( $i->effective_itemtype() )->notforloan;
Lines 2445-2474 sub CalculatePriority { Link Here
2445
    return @row ? $row[0]+1 : 1;
2444
    return @row ? $row[0]+1 : 1;
2446
}
2445
}
2447
2446
2448
=head2 IsItemOnHoldAndFound
2449
2450
    my $bool = IsItemFoundHold( $itemnumber );
2451
2452
    Returns true if the item is currently on hold
2453
    and that hold has a non-null found status ( W, T, etc. )
2454
2455
=cut
2456
2457
sub IsItemOnHoldAndFound {
2458
    my ($itemnumber) = @_;
2459
2460
    my $rs = Koha::Database->new()->schema()->resultset('Reserve');
2461
2462
    my $found = $rs->count(
2463
        {
2464
            itemnumber => $itemnumber,
2465
            found      => { '!=' => undef }
2466
        }
2467
    );
2468
2469
    return $found;
2470
}
2471
2472
=head2 GetMaxPatronHoldsForRecord
2447
=head2 GetMaxPatronHoldsForRecord
2473
2448
2474
my $holds_per_record = ReservesControlBranch( $borrowernumber, $biblionumber );
2449
my $holds_per_record = ReservesControlBranch( $borrowernumber, $biblionumber );
2475
- 

Return to bug 17729