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

(-)a/C4/Search.pm (-19 / +6 lines)
Lines 1781-1787 sub searchResults { Link Here
1781
        my $itembinding_count     = 0;
1781
        my $itembinding_count     = 0;
1782
        my $itemdamaged_count     = 0;
1782
        my $itemdamaged_count     = 0;
1783
        my $item_in_transit_count = 0;
1783
        my $item_in_transit_count = 0;
1784
        my $can_place_holds       = 0;
1785
        my $item_onhold_count     = 0;
1784
        my $item_onhold_count     = 0;
1786
        my $notforloan_count      = 0;
1785
        my $notforloan_count      = 0;
1787
        my $items_count           = scalar(@fields);
1786
        my $items_count           = scalar(@fields);
Lines 1852-1860 sub searchResults { Link Here
1852
                    $onloan_items->{$key}->{longoverdue}++;
1851
                    $onloan_items->{$key}->{longoverdue}++;
1853
                    $longoverdue_count++;
1852
                    $longoverdue_count++;
1854
                }
1853
                }
1855
                else {    # can place holds as long as item isn't lost
1856
                    $can_place_holds = 1;
1857
                }
1858
            }
1854
            }
1859
1855
1860
         # items not on loan, but still unavailable ( lost, withdrawn, damaged )
1856
         # items not on loan, but still unavailable ( lost, withdrawn, damaged )
Lines 1916-1933 sub searchResults { Link Here
1916
                    $item_onhold_count++     if $reservestatus eq 'Waiting';
1912
                    $item_onhold_count++     if $reservestatus eq 'Waiting';
1917
                    $item->{status} = ($item->{withdrawn}//q{}) . "-" . ($item->{itemlost}//q{}) . "-" . ($item->{damaged}//q{}) . "-" . ($item->{notforloan}//q{});
1913
                    $item->{status} = ($item->{withdrawn}//q{}) . "-" . ($item->{itemlost}//q{}) . "-" . ($item->{damaged}//q{}) . "-" . ($item->{notforloan}//q{});
1918
1914
1919
                    # can place a hold on a item if
1920
                    # not lost nor withdrawn
1921
                    # not damaged unless AllowHoldsOnDamagedItems is true
1922
                    # item is either for loan or on order (notforloan < 0)
1923
                    $can_place_holds = 1
1924
                      if (
1925
                           !$item->{itemlost}
1926
                        && !$item->{withdrawn}
1927
                        && ( !$item->{damaged} || C4::Context->preference('AllowHoldsOnDamagedItems') )
1928
                        && ( !$item->{notforloan} || $item->{notforloan} < 0 )
1929
                      );
1930
1931
                    $other_count++;
1915
                    $other_count++;
1932
1916
1933
                    my $key = $prefix . $item->{status};
1917
                    my $key = $prefix . $item->{status};
Lines 1944-1950 sub searchResults { Link Here
1944
                }
1928
                }
1945
                # item is available
1929
                # item is available
1946
                else {
1930
                else {
1947
                    $can_place_holds = 1;
1948
                    $available_count++;
1931
                    $available_count++;
1949
                    $available_items->{$prefix}->{count}++ if $item->{$hbranch};
1932
                    $available_items->{$prefix}->{count}++ if $item->{$hbranch};
1950
                    foreach (qw(branchname itemcallnumber description)) {
1933
                    foreach (qw(branchname itemcallnumber description)) {
Lines 2001-2011 sub searchResults { Link Here
2001
            );
1984
            );
2002
        }
1985
        }
2003
1986
1987
        my $biblio_object = Koha::Biblios->find( $oldbiblio->{biblionumber} );
1988
        $oldbiblio->{biblio_object} = $biblio_object;
1989
1990
        my $can_place_holds = 1;
2004
        # if biblio level itypes are used and itemtype is notforloan, it can't be reserved either
1991
        # if biblio level itypes are used and itemtype is notforloan, it can't be reserved either
2005
        if (!C4::Context->preference("item-level_itypes")) {
1992
        if (!C4::Context->preference("item-level_itypes")) {
2006
            if ($itemtype && $itemtype->{notforloan}) {
1993
            if ($itemtype && $itemtype->{notforloan}) {
2007
                $can_place_holds = 0;
1994
                $can_place_holds = 0;
2008
            }
1995
            }
1996
        } else {
1997
            $can_place_holds = $biblio_object->items->filter_by_for_hold()->count;
2009
        }
1998
        }
2010
        $oldbiblio->{norequests} = 1 unless $can_place_holds;
1999
        $oldbiblio->{norequests} = 1 unless $can_place_holds;
2011
        $oldbiblio->{items_count}          = $items_count;
2000
        $oldbiblio->{items_count}          = $items_count;
Lines 2054-2061 sub searchResults { Link Here
2054
            $oldbiblio->{'alternateholdings_count'} = $alternateholdingscount;
2043
            $oldbiblio->{'alternateholdings_count'} = $alternateholdingscount;
2055
        }
2044
        }
2056
2045
2057
        $oldbiblio->{biblio_object} = Koha::Biblios->find( $oldbiblio->{biblionumber} );
2058
2059
        push( @newresults, $oldbiblio );
2046
        push( @newresults, $oldbiblio );
2060
    }
2047
    }
2061
2048
(-)a/Koha/Holds.pm (-15 / +2 lines)
Lines 130-155 sub get_items_that_can_fill { Link Here
130
          }
130
          }
131
      );
131
      );
132
132
133
    my @hold_not_allowed_itypes = Koha::CirculationRules->search(
134
        {
135
            rule_name    => 'holdallowed',
136
            branchcode   => undef,
137
            categorycode => undef,
138
            rule_value   => 'not_allowed',
139
        }
140
    )->get_column('itemtype');
141
142
    return Koha::Items->search(
133
    return Koha::Items->search(
143
        {
134
        {
144
            biblionumber => { in => \@biblionumbers },
135
            biblionumber => { in => \@biblionumbers },
145
            itemlost     => 0,
146
            withdrawn    => 0,
147
            notforloan   => 0,
148
            onloan       => undef,
149
            itemnumber   => { -not_in => [ @branchtransfers, @waiting_holds ] },
136
            itemnumber   => { -not_in => [ @branchtransfers, @waiting_holds ] },
150
            itype        => { -not_in => \@hold_not_allowed_itypes },
137
            onloan       => undef,
151
        }
138
        }
152
    );
139
    )->filter_by_for_hold();
153
}
140
}
154
141
155
=head3 type
142
=head3 type
(-)a/opac/opac-ISBDdetail.pl (-8 / +2 lines)
Lines 167-173 $template->param( Link Here
167
    subscriptionsnumber => $subscriptionsnumber,
167
    subscriptionsnumber => $subscriptionsnumber,
168
);
168
);
169
169
170
my $norequests = 1;
171
my $allow_onshelf_holds;
170
my $allow_onshelf_holds;
172
my $res = GetISBDView({
171
my $res = GetISBDView({
173
    'record'    => $record,
172
    'record'    => $record,
Lines 177-189 my $res = GetISBDView({ Link Here
177
176
178
my $items = $biblio->items;
177
my $items = $biblio->items;
179
while ( my $item = $items->next ) {
178
while ( my $item = $items->next ) {
180
    $norequests = 0
181
      if $norequests
182
        && !$item->withdrawn
183
        && !$item->itemlost
184
        && ($item->notforloan < 0 || not $item->notforloan )
185
        && !Koha::ItemTypes->find($item->effective_itemtype)->notforloan
186
        && $item->itemnumber;
187
179
188
    $allow_onshelf_holds = Koha::CirculationRules->get_onshelfholds_policy( { item => $item, patron => $patron } )
180
    $allow_onshelf_holds = Koha::CirculationRules->get_onshelfholds_policy( { item => $item, patron => $patron } )
189
      unless $allow_onshelf_holds;
181
      unless $allow_onshelf_holds;
Lines 193-198 if( $allow_onshelf_holds || CountItemsIssued($biblionumber) || $biblio->has_item Link Here
193
    $template->param( ReservableItems => 1 );
185
    $template->param( ReservableItems => 1 );
194
}
186
}
195
187
188
my $norequests = ! $items->filter_by_for_hold->count;
189
196
$template->param(
190
$template->param(
197
    RequestOnOpac       => C4::Context->preference("RequestOnOpac"),
191
    RequestOnOpac       => C4::Context->preference("RequestOnOpac"),
198
    norequests   => $norequests,
192
    norequests   => $norequests,
(-)a/opac/opac-MARCdetail.pl (-9 / +1 lines)
Lines 143-161 $template->param( Link Here
143
) if $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} <= 0 && # <=0 OPAC visible.
143
) if $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} <= 0 && # <=0 OPAC visible.
144
     $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} > -8;   # except -8;
144
     $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} > -8;   # except -8;
145
145
146
my $norequests = 1;
147
my $allow_onshelf_holds;
146
my $allow_onshelf_holds;
148
my $items = $biblio->items;
147
my $items = $biblio->items;
149
148
150
while ( my $item = $items->next ) {
149
while ( my $item = $items->next ) {
151
    $norequests = 0
152
      if $norequests
153
        && !$item->withdrawn
154
        && !$item->itemlost
155
        && ($item->notforloan < 0 || not $item->notforloan )
156
        && !Koha::ItemTypes->find($item->effective_itemtype)->notforloan
157
        && $item->itemnumber;
158
159
    $allow_onshelf_holds = Koha::CirculationRules->get_onshelfholds_policy( { item => $item, patron => $patron } )
150
    $allow_onshelf_holds = Koha::CirculationRules->get_onshelfholds_policy( { item => $item, patron => $patron } )
160
      unless $allow_onshelf_holds;
151
      unless $allow_onshelf_holds;
161
}
152
}
Lines 391-396 if( C4::Context->preference('ArticleRequests') ) { Link Here
391
    $template->param( artreqpossible => $artreqpossible );
382
    $template->param( artreqpossible => $artreqpossible );
392
}
383
}
393
384
385
my $norequests = ! $biblio->items->filter_by_for_hold->count;
394
$template->param(
386
$template->param(
395
    item_loop           => \@item_loop,
387
    item_loop           => \@item_loop,
396
    item_header_loop    => \@item_header_loop,
388
    item_header_loop    => \@item_header_loop,
(-)a/opac/opac-detail.pl (-9 / +1 lines)
Lines 668-674 if ( $show_holds_count || $show_priority) { Link Here
668
}
668
}
669
$template->param( show_priority => $has_hold ) ;
669
$template->param( show_priority => $has_hold ) ;
670
670
671
my $norequests = 1;
672
my %itemfields;
671
my %itemfields;
673
my (@itemloop, @otheritemloop);
672
my (@itemloop, @otheritemloop);
674
my $currentbranch = C4::Context->userenv ? C4::Context->userenv->{branch} : undef;
673
my $currentbranch = C4::Context->userenv ? C4::Context->userenv->{branch} : undef;
Lines 712-724 if ( not $viewallitems and @items > $max_items_to_display ) { Link Here
712
    my $item = Koha::Items->find( $itm->{itemnumber} );
711
    my $item = Koha::Items->find( $itm->{itemnumber} );
713
    $itm->{holds_count} = $item_reserves{ $itm->{itemnumber} };
712
    $itm->{holds_count} = $item_reserves{ $itm->{itemnumber} };
714
    $itm->{priority} = $priority{ $itm->{itemnumber} };
713
    $itm->{priority} = $priority{ $itm->{itemnumber} };
715
    $norequests = 0
716
      if $norequests
717
        && !$itm->{'withdrawn'}
718
        && !$itm->{'itemlost'}
719
        && ($itm->{'itemnotforloan'}<0 || not $itm->{'itemnotforloan'})
720
        && !$itemtypes->{$itm->{'itype'}}->{notforloan}
721
        && $itm->{'itemnumber'};
722
714
723
    $allow_onshelf_holds = Koha::CirculationRules->get_onshelfholds_policy( { item => $item, patron => $patron } )
715
    $allow_onshelf_holds = Koha::CirculationRules->get_onshelfholds_policy( { item => $item, patron => $patron } )
724
      unless $allow_onshelf_holds;
716
      unless $allow_onshelf_holds;
Lines 805-810 if( C4::Context->preference('ArticleRequests') ) { Link Here
805
    $template->param( artreqpossible => $artreqpossible );
797
    $template->param( artreqpossible => $artreqpossible );
806
}
798
}
807
799
800
my $norequests = ! $biblio->items->filter_by_for_hold->count;
808
    $template->param(
801
    $template->param(
809
                     MARCNOTES               => $marcnotesarray,
802
                     MARCNOTES               => $marcnotesarray,
810
                     norequests              => $norequests,
803
                     norequests              => $norequests,
811
- 

Return to bug 3142