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

(-)a/C4/Reserves.pm (-3 / +5 lines)
Lines 1101-1110 sub IsAvailableForItemLevelRequest { Link Here
1101
    # FIXME - a lot of places in the code do this
1101
    # FIXME - a lot of places in the code do this
1102
    #         or something similar - need to be
1102
    #         or something similar - need to be
1103
    #         consolidated
1103
    #         consolidated
1104
    my $itype = _get_itype($item);
1104
    my $patron = Koha::Patrons->find( $borrower->{borrowernumber} );
1105
    my $item_object = Koha::Items->find( $item->{itemnumber } );
1106
    my $itemtype = $item_object->effective_itemtype;
1105
    my $notforloan_per_itemtype
1107
    my $notforloan_per_itemtype
1106
      = $dbh->selectrow_array("SELECT notforloan FROM itemtypes WHERE itemtype = ?",
1108
      = $dbh->selectrow_array("SELECT notforloan FROM itemtypes WHERE itemtype = ?",
1107
                              undef, $itype);
1109
                              undef, $itemtype);
1108
1110
1109
    return 0 if
1111
    return 0 if
1110
        $notforloan_per_itemtype ||
1112
        $notforloan_per_itemtype ||
Lines 1113-1119 sub IsAvailableForItemLevelRequest { Link Here
1113
        $item->{withdrawn}        ||
1115
        $item->{withdrawn}        ||
1114
        ($item->{damaged} && !C4::Context->preference('AllowHoldsOnDamagedItems'));
1116
        ($item->{damaged} && !C4::Context->preference('AllowHoldsOnDamagedItems'));
1115
1117
1116
    my $on_shelf_holds = _OnShelfHoldsAllowed($itype,$borrower->{categorycode},$item->{holdingbranch});
1118
    my $on_shelf_holds = Koha::IssuingRules->get_onshelfholds_policy( { item => $item_object, patron => $patron } );
1117
1119
1118
    if ( $on_shelf_holds == 1 ) {
1120
    if ( $on_shelf_holds == 1 ) {
1119
        return 1;
1121
        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 169-174 my $res = GetISBDView({ Link Here
169
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
171
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
170
my $patron = Koha::Patrons->find( $loggedinuser );
172
my $patron = Koha::Patrons->find( $loggedinuser );
171
for my $itm (@items) {
173
for my $itm (@items) {
174
    my $item = Koha::Items->find( $itm->{itemnumber} );
172
    $norequests = 0
175
    $norequests = 0
173
      if $norequests
176
      if $norequests
174
        && !$itm->{'withdrawn'}
177
        && !$itm->{'withdrawn'}
Lines 177-183 for my $itm (@items) { Link Here
177
        && !$itemtypes->{$itm->{'itype'}}->{notforloan}
180
        && !$itemtypes->{$itm->{'itype'}}->{notforloan}
178
        && $itm->{'itemnumber'};
181
        && $itm->{'itemnumber'};
179
182
180
    $allow_onshelf_holds = C4::Reserves::OnShelfHoldsAllowed( $itm, ( $patron ? $patron->unblessed : {} ) )
183
    $allow_onshelf_holds = Koha::IssuingRules->get_onshelfholds_policy( { item => $item, patron => $patron } )
181
      unless $allow_onshelf_holds;
184
      unless $allow_onshelf_holds;
182
}
185
}
183
186
(-)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 661-666 if ( not $viewallitems and @items > $max_items_to_display ) { Link Here
661
} else {
661
} else {
662
  my $patron = Koha::Patrons->find( $borrowernumber );
662
  my $patron = Koha::Patrons->find( $borrowernumber );
663
  for my $itm (@items) {
663
  for my $itm (@items) {
664
    my $item = Koha::Items->find( $itm->{itemnumber} );
664
    $itm->{holds_count} = $item_reserves{ $itm->{itemnumber} };
665
    $itm->{holds_count} = $item_reserves{ $itm->{itemnumber} };
665
    $itm->{priority} = $priority{ $itm->{itemnumber} };
666
    $itm->{priority} = $priority{ $itm->{itemnumber} };
666
    $norequests = 0
667
    $norequests = 0
Lines 671-677 if ( not $viewallitems and @items > $max_items_to_display ) { Link Here
671
        && !$itemtypes->{$itm->{'itype'}}->{notforloan}
672
        && !$itemtypes->{$itm->{'itype'}}->{notforloan}
672
        && $itm->{'itemnumber'};
673
        && $itm->{'itemnumber'};
673
674
674
    $allow_onshelf_holds = C4::Reserves::OnShelfHoldsAllowed( $itm, ( $patron ? $patron->unblessed : {} ) )
675
    $allow_onshelf_holds = Koha::IssuingRules->get_onshelfholds_policy( { item => $item, patron => $patron } )
675
      unless $allow_onshelf_holds;
676
      unless $allow_onshelf_holds;
676
677
677
    # get collection code description, too
678
    # 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