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

(-)a/C4/Search.pm (-19 / +6 lines)
Lines 1803-1809 sub searchResults { Link Here
1803
        my $itembinding_count     = 0;
1803
        my $itembinding_count     = 0;
1804
        my $itemdamaged_count     = 0;
1804
        my $itemdamaged_count     = 0;
1805
        my $item_in_transit_count = 0;
1805
        my $item_in_transit_count = 0;
1806
        my $can_place_holds       = 0;
1807
        my $item_onhold_count     = 0;
1806
        my $item_onhold_count     = 0;
1808
        my $notforloan_count      = 0;
1807
        my $notforloan_count      = 0;
1809
        my $items_count           = scalar(@fields);
1808
        my $items_count           = scalar(@fields);
Lines 1874-1882 sub searchResults { Link Here
1874
                    $onloan_items->{$key}->{longoverdue}++;
1873
                    $onloan_items->{$key}->{longoverdue}++;
1875
                    $longoverdue_count++;
1874
                    $longoverdue_count++;
1876
                }
1875
                }
1877
                else {    # can place holds as long as item isn't lost
1878
                    $can_place_holds = 1;
1879
                }
1880
            }
1876
            }
1881
1877
1882
         # items not on loan, but still unavailable ( lost, withdrawn, damaged )
1878
         # items not on loan, but still unavailable ( lost, withdrawn, damaged )
Lines 1938-1955 sub searchResults { Link Here
1938
                    $item_onhold_count++     if $reservestatus eq 'Waiting';
1934
                    $item_onhold_count++     if $reservestatus eq 'Waiting';
1939
                    $item->{status} = ($item->{withdrawn}//q{}) . "-" . ($item->{itemlost}//q{}) . "-" . ($item->{damaged}//q{}) . "-" . ($item->{notforloan}//q{});
1935
                    $item->{status} = ($item->{withdrawn}//q{}) . "-" . ($item->{itemlost}//q{}) . "-" . ($item->{damaged}//q{}) . "-" . ($item->{notforloan}//q{});
1940
1936
1941
                    # can place a hold on a item if
1942
                    # not lost nor withdrawn
1943
                    # not damaged unless AllowHoldsOnDamagedItems is true
1944
                    # item is either for loan or on order (notforloan < 0)
1945
                    $can_place_holds = 1
1946
                      if (
1947
                           !$item->{itemlost}
1948
                        && !$item->{withdrawn}
1949
                        && ( !$item->{damaged} || C4::Context->preference('AllowHoldsOnDamagedItems') )
1950
                        && ( !$item->{notforloan} || $item->{notforloan} < 0 )
1951
                      );
1952
1953
                    $other_count++;
1937
                    $other_count++;
1954
1938
1955
                    my $key = $prefix . $item->{status};
1939
                    my $key = $prefix . $item->{status};
Lines 1966-1972 sub searchResults { Link Here
1966
                }
1950
                }
1967
                # item is available
1951
                # item is available
1968
                else {
1952
                else {
1969
                    $can_place_holds = 1;
1970
                    $available_count++;
1953
                    $available_count++;
1971
                    $available_items->{$prefix}->{count}++ if $item->{$hbranch};
1954
                    $available_items->{$prefix}->{count}++ if $item->{$hbranch};
1972
                    foreach (qw(branchname itemcallnumber description)) {
1955
                    foreach (qw(branchname itemcallnumber description)) {
Lines 2009-2019 sub searchResults { Link Here
2009
            $oldbiblio->{XSLTResultsRecord} = XSLTParse4Display($oldbiblio->{biblionumber}, $marcrecord, $xslsyspref, 1, \@hiddenitems, $sysxml, $xslfile, $lang, $xslt_variables);
1992
            $oldbiblio->{XSLTResultsRecord} = XSLTParse4Display($oldbiblio->{biblionumber}, $marcrecord, $xslsyspref, 1, \@hiddenitems, $sysxml, $xslfile, $lang, $xslt_variables);
2010
        }
1993
        }
2011
1994
1995
        my $biblio_object = Koha::Biblios->find( $oldbiblio->{biblionumber} );
1996
        $oldbiblio->{biblio_object} = $biblio_object;
1997
1998
        my $can_place_holds = 1;
2012
        # if biblio level itypes are used and itemtype is notforloan, it can't be reserved either
1999
        # if biblio level itypes are used and itemtype is notforloan, it can't be reserved either
2013
        if (!C4::Context->preference("item-level_itypes")) {
2000
        if (!C4::Context->preference("item-level_itypes")) {
2014
            if ($itemtype && $itemtype->{notforloan}) {
2001
            if ($itemtype && $itemtype->{notforloan}) {
2015
                $can_place_holds = 0;
2002
                $can_place_holds = 0;
2016
            }
2003
            }
2004
        } else {
2005
            $can_place_holds = $biblio_object->items->filter_by_for_hold()->count;
2017
        }
2006
        }
2018
        $oldbiblio->{norequests} = 1 unless $can_place_holds;
2007
        $oldbiblio->{norequests} = 1 unless $can_place_holds;
2019
        $oldbiblio->{items_count}          = $items_count;
2008
        $oldbiblio->{items_count}          = $items_count;
Lines 2062-2069 sub searchResults { Link Here
2062
            $oldbiblio->{'alternateholdings_count'} = $alternateholdingscount;
2051
            $oldbiblio->{'alternateholdings_count'} = $alternateholdingscount;
2063
        }
2052
        }
2064
2053
2065
        $oldbiblio->{biblio_object} = Koha::Biblios->find( $oldbiblio->{biblionumber} );
2066
2067
        push( @newresults, $oldbiblio );
2054
        push( @newresults, $oldbiblio );
2068
    }
2055
    }
2069
2056
(-)a/Koha/Holds.pm (-15 / +1 lines)
Lines 131-156 sub get_items_that_can_fill { Link Here
131
          }
131
          }
132
      );
132
      );
133
133
134
    my @hold_not_allowed_itypes = Koha::CirculationRules->search(
135
        {
136
            rule_name    => 'holdallowed',
137
            branchcode   => undef,
138
            categorycode => undef,
139
            rule_value   => 'not_allowed',
140
        }
141
    )->get_column('itemtype');
142
143
    return Koha::Items->search(
134
    return Koha::Items->search(
144
        {
135
        {
145
            biblionumber => { in => \@biblionumbers },
136
            biblionumber => { in => \@biblionumbers },
146
            itemlost     => 0,
147
            withdrawn    => 0,
148
            notforloan   => 0,
149
            onloan       => undef,
150
            itemnumber   => { -not_in => [ @branchtransfers, @waiting_holds ] },
137
            itemnumber   => { -not_in => [ @branchtransfers, @waiting_holds ] },
151
            itype        => { -not_in => \@hold_not_allowed_itypes },
152
        }
138
        }
153
    );
139
    )->filter_by_for_hold();
154
}
140
}
155
141
156
=head3 type
142
=head3 type
(-)a/opac/opac-ISBDdetail.pl (-8 / +2 lines)
Lines 155-161 $template->param( Link Here
155
    subscriptionsnumber => $subscriptionsnumber,
155
    subscriptionsnumber => $subscriptionsnumber,
156
);
156
);
157
157
158
my $norequests = 1;
159
my $allow_onshelf_holds;
158
my $allow_onshelf_holds;
160
my $res = GetISBDView({
159
my $res = GetISBDView({
161
    'record'    => $record,
160
    'record'    => $record,
Lines 165-177 my $res = GetISBDView({ Link Here
165
164
166
my $items = $biblio->items;
165
my $items = $biblio->items;
167
while ( my $item = $items->next ) {
166
while ( my $item = $items->next ) {
168
    $norequests = 0
169
      if $norequests
170
        && !$item->withdrawn
171
        && !$item->itemlost
172
        && ($item->notforloan < 0 || not $item->notforloan )
173
        && !Koha::ItemTypes->find($item->effective_itemtype)->notforloan
174
        && $item->itemnumber;
175
167
176
    $allow_onshelf_holds = Koha::CirculationRules->get_onshelfholds_policy( { item => $item, patron => $patron } )
168
    $allow_onshelf_holds = Koha::CirculationRules->get_onshelfholds_policy( { item => $item, patron => $patron } )
177
      unless $allow_onshelf_holds;
169
      unless $allow_onshelf_holds;
Lines 181-186 if( $allow_onshelf_holds || CountItemsIssued($biblionumber) || $biblio->has_item Link Here
181
    $template->param( ReservableItems => 1 );
173
    $template->param( ReservableItems => 1 );
182
}
174
}
183
175
176
my $norequests = ! $items->filter_by_for_hold->count;
177
184
$template->param(
178
$template->param(
185
    RequestOnOpac       => C4::Context->preference("RequestOnOpac"),
179
    RequestOnOpac       => C4::Context->preference("RequestOnOpac"),
186
    norequests   => $norequests,
180
    norequests   => $norequests,
(-)a/opac/opac-MARCdetail.pl (-9 / +1 lines)
Lines 137-155 $template->param( Link Here
137
) if $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} <= 0 && # <=0 OPAC visible.
137
) if $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} <= 0 && # <=0 OPAC visible.
138
     $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} > -8;   # except -8;
138
     $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} > -8;   # except -8;
139
139
140
my $norequests = 1;
141
my $allow_onshelf_holds;
140
my $allow_onshelf_holds;
142
my $items = $biblio->items;
141
my $items = $biblio->items;
143
142
144
while ( my $item = $items->next ) {
143
while ( my $item = $items->next ) {
145
    $norequests = 0
146
      if $norequests
147
        && !$item->withdrawn
148
        && !$item->itemlost
149
        && ($item->notforloan < 0 || not $item->notforloan )
150
        && !Koha::ItemTypes->find($item->effective_itemtype)->notforloan
151
        && $item->itemnumber;
152
153
    $allow_onshelf_holds = Koha::CirculationRules->get_onshelfholds_policy( { item => $item, patron => $patron } )
144
    $allow_onshelf_holds = Koha::CirculationRules->get_onshelfholds_policy( { item => $item, patron => $patron } )
154
      unless $allow_onshelf_holds;
145
      unless $allow_onshelf_holds;
155
}
146
}
Lines 385-390 if( C4::Context->preference('ArticleRequests') ) { Link Here
385
    $template->param( artreqpossible => $artreqpossible );
376
    $template->param( artreqpossible => $artreqpossible );
386
}
377
}
387
378
379
my $norequests = ! $biblio->items->filter_by_for_hold->count;
388
$template->param(
380
$template->param(
389
    item_loop           => \@item_loop,
381
    item_loop           => \@item_loop,
390
    item_header_loop    => \@item_header_loop,
382
    item_header_loop    => \@item_header_loop,
(-)a/opac/opac-detail.pl (-9 / +1 lines)
Lines 674-680 if ( $show_holds_count || $show_priority) { Link Here
674
}
674
}
675
$template->param( show_priority => $has_hold ) ;
675
$template->param( show_priority => $has_hold ) ;
676
676
677
my $norequests = 1;
678
my %itemfields;
677
my %itemfields;
679
my (@itemloop, @otheritemloop);
678
my (@itemloop, @otheritemloop);
680
my $currentbranch = C4::Context->userenv ? C4::Context->userenv->{branch} : undef;
679
my $currentbranch = C4::Context->userenv ? C4::Context->userenv->{branch} : undef;
Lines 718-730 if ( not $viewallitems and @items > $max_items_to_display ) { Link Here
718
    my $item = Koha::Items->find( $itm->{itemnumber} );
717
    my $item = Koha::Items->find( $itm->{itemnumber} );
719
    $itm->{holds_count} = $item_reserves{ $itm->{itemnumber} };
718
    $itm->{holds_count} = $item_reserves{ $itm->{itemnumber} };
720
    $itm->{priority} = $priority{ $itm->{itemnumber} };
719
    $itm->{priority} = $priority{ $itm->{itemnumber} };
721
    $norequests = 0
722
      if $norequests
723
        && !$itm->{'withdrawn'}
724
        && !$itm->{'itemlost'}
725
        && ($itm->{'itemnotforloan'}<0 || not $itm->{'itemnotforloan'})
726
        && !$itemtypes->{$itm->{'itype'}}->{notforloan}
727
        && $itm->{'itemnumber'};
728
720
729
    $allow_onshelf_holds = Koha::CirculationRules->get_onshelfholds_policy( { item => $item, patron => $patron } )
721
    $allow_onshelf_holds = Koha::CirculationRules->get_onshelfholds_policy( { item => $item, patron => $patron } )
730
      unless $allow_onshelf_holds;
722
      unless $allow_onshelf_holds;
Lines 828-833 if( C4::Context->preference('ArticleRequests') ) { Link Here
828
    $template->param( artreqpossible => $artreqpossible );
820
    $template->param( artreqpossible => $artreqpossible );
829
}
821
}
830
822
823
my $norequests = ! $biblio->items->filter_by_for_hold->count;
831
    $template->param(
824
    $template->param(
832
                     MARCNOTES               => $marcnotesarray,
825
                     MARCNOTES               => $marcnotesarray,
833
                     norequests              => $norequests,
826
                     norequests              => $norequests,
834
- 

Return to bug 3142