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

(-)a/C4/Reserves.pm (-3 / +5 lines)
Lines 1099-1108 sub IsAvailableForItemLevelRequest { Link Here
1099
    # FIXME - a lot of places in the code do this
1099
    # FIXME - a lot of places in the code do this
1100
    #         or something similar - need to be
1100
    #         or something similar - need to be
1101
    #         consolidated
1101
    #         consolidated
1102
    my $itype = _get_itype($item);
1102
    my $patron = Koha::Patrons->find( $borrower->{borrowernumber} );
1103
    my $item_object = Koha::Items->find( $item->{itemnumber } );
1104
    my $itemtype = $item_object->effective_itemtype;
1103
    my $notforloan_per_itemtype
1105
    my $notforloan_per_itemtype
1104
      = $dbh->selectrow_array("SELECT notforloan FROM itemtypes WHERE itemtype = ?",
1106
      = $dbh->selectrow_array("SELECT notforloan FROM itemtypes WHERE itemtype = ?",
1105
                              undef, $itype);
1107
                              undef, $itemtype);
1106
1108
1107
    return 0 if
1109
    return 0 if
1108
        $notforloan_per_itemtype ||
1110
        $notforloan_per_itemtype ||
Lines 1111-1117 sub IsAvailableForItemLevelRequest { Link Here
1111
        $item->{withdrawn}        ||
1113
        $item->{withdrawn}        ||
1112
        ($item->{damaged} && !C4::Context->preference('AllowHoldsOnDamagedItems'));
1114
        ($item->{damaged} && !C4::Context->preference('AllowHoldsOnDamagedItems'));
1113
1115
1114
    my $on_shelf_holds = _OnShelfHoldsAllowed($itype,$borrower->{categorycode},$item->{holdingbranch});
1116
    my $on_shelf_holds = Koha::IssuingRules->get_onshelfholds_policy( { item => $item_object, patron => $patron } );
1115
1117
1116
    if ( $on_shelf_holds == 1 ) {
1118
    if ( $on_shelf_holds == 1 ) {
1117
        return 1;
1119
        return 1;
(-)a/Koha/IssuingRules.pm (+15 lines)
Lines 100-105 sub get_opacitemholds_policy { Link Here
100
    return $issuing_rule ? $issuing_rule->opacitemholds : undef;
100
    return $issuing_rule ? $issuing_rule->opacitemholds : undef;
101
}
101
}
102
102
103
sub get_onshelfholds_policy {
104
    my ( $class, $params ) = @_;
105
    my $item = $params->{item};
106
    my $itemtype = $item->effective_itemtype;
107
    my $patron = $params->{patron};
108
    my $issuing_rule = Koha::IssuingRules->get_effective_issuing_rule(
109
        {
110
            ( $patron ? ( categorycode => $patron->categorycode ) : () ),
111
            itemtype   => $itemtype,
112
            branchcode => $item->holdingbranch
113
        }
114
    );
115
    return $issuing_rule ? $issuing_rule->onshelfholds : undef;
116
}
117
103
=head3 type
118
=head3 type
104
119
105
=cut
120
=cut
(-)a/opac/opac-ISBDdetail.pl (-1 / +4 lines)
Lines 52-57 use C4::Reserves; Link Here
52
use C4::Acquisition;
52
use C4::Acquisition;
53
use C4::Serials;    # uses getsubscriptionfrom biblionumber
53
use C4::Serials;    # uses getsubscriptionfrom biblionumber
54
use C4::Koha;
54
use C4::Koha;
55
use Koha::IssuingRules;
56
use Koha::Items;
55
use Koha::ItemTypes;
57
use Koha::ItemTypes;
56
use Koha::Patrons;
58
use Koha::Patrons;
57
use Koha::RecordProcessor;
59
use Koha::RecordProcessor;
Lines 168-173 my $res = GetISBDView({ Link Here
168
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
170
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
169
my $patron = Koha::Patrons->find( $loggedinuser );
171
my $patron = Koha::Patrons->find( $loggedinuser );
170
for my $itm (@items) {
172
for my $itm (@items) {
173
    my $item = Koha::Items->find( $itm->{itemnumber} );
171
    $norequests = 0
174
    $norequests = 0
172
      if $norequests
175
      if $norequests
173
        && !$itm->{'withdrawn'}
176
        && !$itm->{'withdrawn'}
Lines 176-182 for my $itm (@items) { Link Here
176
        && !$itemtypes->{$itm->{'itype'}}->{notforloan}
179
        && !$itemtypes->{$itm->{'itype'}}->{notforloan}
177
        && $itm->{'itemnumber'};
180
        && $itm->{'itemnumber'};
178
181
179
    $allow_onshelf_holds = C4::Reserves::OnShelfHoldsAllowed( $itm, ( $patron ? $patron->unblessed : {} ) )
182
    $allow_onshelf_holds = Koha::IssuingRules->get_onshelfholds_policy( { item => $item, patron => $patron } )
180
      unless $allow_onshelf_holds;
183
      unless $allow_onshelf_holds;
181
}
184
}
182
185
(-)a/opac/opac-MARCdetail.pl (-1 / +2 lines)
Lines 132-138 if(my $cart_list = $query->cookie("bib_list")){ Link Here
132
my $allow_onshelf_holds;
132
my $allow_onshelf_holds;
133
my $patron = Koha::Patrons->find( $loggedinuser );
133
my $patron = Koha::Patrons->find( $loggedinuser );
134
for my $itm (@all_items) {
134
for my $itm (@all_items) {
135
    $allow_onshelf_holds = C4::Reserves::OnShelfHoldsAllowed( $itm, ( $patron ? $patron->unblessed : {} ) );
135
    my $items = Koha::Items->find( $itm->{itemnumber} );
136
    $allow_onshelf_holds = Koha::IssuingRules->get_onshelfholds_policy( { item => $item, patron => $patron } );
136
    last if $allow_onshelf_holds;
137
    last if $allow_onshelf_holds;
137
}
138
}
138
139
(-)a/opac/opac-detail.pl (-1 / +2 lines)
Lines 660-665 if ( not $viewallitems and @items > $max_items_to_display ) { Link Here
660
  my $allow_onshelf_holds;
660
  my $allow_onshelf_holds;
661
  my $patron = Koha::Patrons->find( $borrowernumber );
661
  my $patron = Koha::Patrons->find( $borrowernumber );
662
  for my $itm (@items) {
662
  for my $itm (@items) {
663
    my $item = Koha::Items->find( $itm->{itemnumber} );
663
    $itm->{holds_count} = $item_reserves{ $itm->{itemnumber} };
664
    $itm->{holds_count} = $item_reserves{ $itm->{itemnumber} };
664
    $itm->{priority} = $priority{ $itm->{itemnumber} };
665
    $itm->{priority} = $priority{ $itm->{itemnumber} };
665
    $norequests = 0
666
    $norequests = 0
Lines 670-676 if ( not $viewallitems and @items > $max_items_to_display ) { Link Here
670
        && !$itemtypes->{$itm->{'itype'}}->{notforloan}
671
        && !$itemtypes->{$itm->{'itype'}}->{notforloan}
671
        && $itm->{'itemnumber'};
672
        && $itm->{'itemnumber'};
672
673
673
    $allow_onshelf_holds = C4::Reserves::OnShelfHoldsAllowed( $itm, ( $patron ? $patron->unblessed : {} ) )
674
    $allow_onshelf_holds = Koha::IssuingRules->get_onshelfholds_policy( { item => $item, patron => $patron } )
674
      unless $allow_onshelf_holds;
675
      unless $allow_onshelf_holds;
675
676
676
    # get collection code description, too
677
    # get collection code description, too
(-)a/opac/opac-shelves.pl (-2 / +2 lines)
Lines 31-36 use C4::XSLT; Link Here
31
31
32
use Koha::Biblios;
32
use Koha::Biblios;
33
use Koha::Biblioitems;
33
use Koha::Biblioitems;
34
use Koha::IssuingRules;
34
use Koha::Items;
35
use Koha::Items;
35
use Koha::ItemTypes;
36
use Koha::ItemTypes;
36
use Koha::Patrons;
37
use Koha::Patrons;
Lines 319-325 if ( $op eq 'view' ) { Link Here
319
320
320
                my $items = $biblio->items;
321
                my $items = $biblio->items;
321
                while ( my $item = $items->next ) {
322
                while ( my $item = $items->next ) {
322
                    $this_item->{allow_onshelf_holds} = C4::Reserves::OnShelfHoldsAllowed($item->unblessed, $patron);
323
                    $this_item->{allow_onshelf_holds} = Koha::IssuingRules->get_onshelfholds_policy( { item => $item, patron => $patron } );
323
                    last if $this_item->{allow_onshelf_holds};
324
                    last if $this_item->{allow_onshelf_holds};
324
                }
325
                }
325
326
326
- 

Return to bug 19301