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

(-)a/C4/Reserves.pm (-3 / +14 lines)
Lines 352-357 sub CanBookBeReserved{ Link Here
352
  current checkout against the high holds threshold
352
  current checkout against the high holds threshold
353
353
354
@RETURNS { status => OK },              if the Item can be reserved.
354
@RETURNS { status => OK },              if the Item can be reserved.
355
         { status => onShelfHoldsNotAllowed },  if onShelfHoldsAllowed parameter and item availability combination doesn't allow holds.
355
         { status => ageRestricted },   if the Item is age restricted for this borrower.
356
         { status => ageRestricted },   if the Item is age restricted for this borrower.
356
         { status => damaged },         if the Item is damaged.
357
         { status => damaged },         if the Item is damaged.
357
         { status => cannotReserveFromOtherBranches }, if syspref 'canreservefromotherbranches' is OK.
358
         { status => cannotReserveFromOtherBranches }, if syspref 'canreservefromotherbranches' is OK.
Lines 371-376 sub CanItemBeReserved { Link Here
371
    my $dbh = C4::Context->dbh;
372
    my $dbh = C4::Context->dbh;
372
    my $ruleitemtype;    # itemtype of the matching issuing rule
373
    my $ruleitemtype;    # itemtype of the matching issuing rule
373
    my $allowedreserves  = 0; # Total number of holds allowed across all records, default to none
374
    my $allowedreserves  = 0; # Total number of holds allowed across all records, default to none
375
    my $holds_per_record = 1; # Total number of holds allowed for this one given record
376
    my $holds_per_day;        # Default to unlimited
377
    my $opacitemholds = 'Y';  # Itemlevel holds default to allowed
378
    my $on_shelf_holds = 0;   # Default to "if any unavailable"
379
    my $context = $params->{context} // '';
374
380
375
    # we retrieve borrowers and items informations #
381
    # we retrieve borrowers and items informations #
376
    # item->{itype} will come for biblioitems if necessery
382
    # item->{itype} will come for biblioitems if necessery
Lines 442-451 sub CanItemBeReserved { Link Here
442
        categorycode => $borrower->{'categorycode'},
448
        categorycode => $borrower->{'categorycode'},
443
        itemtype     => $item->effective_itemtype,
449
        itemtype     => $item->effective_itemtype,
444
        branchcode   => $branchcode,
450
        branchcode   => $branchcode,
445
        rules        => ['holds_per_record','holds_per_day']
451
        rules        => ['holds_per_record','holds_per_day','onshelfholds']
446
    });
452
    });
447
    my $holds_per_record = $rights->{holds_per_record} // 1;
453
    $holds_per_record = $rights->{holds_per_record} // 1;
448
    my $holds_per_day    = $rights->{holds_per_day};
454
    $holds_per_day    = $rights->{holds_per_day};
455
    $on_shelf_holds   = $rights->{onshelfholds};
449
456
450
    my $search_params = {
457
    my $search_params = {
451
        borrowernumber => $borrowernumber,
458
        borrowernumber => $borrowernumber,
Lines 453-458 sub CanItemBeReserved { Link Here
453
    };
460
    };
454
    $search_params->{found} = undef if $params->{ignore_found_holds};
461
    $search_params->{found} = undef if $params->{ignore_found_holds};
455
462
463
    # Check for item on shelves and OnShelfHoldsAllowed
464
    return { status => 'onShelfHoldsNotAllowed' }
465
    unless IsAvailableForItemLevelRequest($item, $patron, $pickup_branchcode,1);
466
456
    my $holds = Koha::Holds->search($search_params);
467
    my $holds = Koha::Holds->search($search_params);
457
    if (   defined $holds_per_record && $holds_per_record ne ''
468
    if (   defined $holds_per_record && $holds_per_record ne ''
458
        && $holds->count() >= $holds_per_record ) {
469
        && $holds->count() >= $holds_per_record ) {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (+1 lines)
Lines 1010-1015 Link Here
1010
            tooManyReservesToday: _("Daily hold limit reached for patron"),
1010
            tooManyReservesToday: _("Daily hold limit reached for patron"),
1011
            tooManyReserves: _("Too many holds"),
1011
            tooManyReserves: _("Too many holds"),
1012
            notReservable: _("Not holdable"),
1012
            notReservable: _("Not holdable"),
1013
            onShelfHoldsNotAllowed: _("Not holdable"),
1013
            cannotReserveFromOtherBranches: _("Patron is from different library"),
1014
            cannotReserveFromOtherBranches: _("Patron is from different library"),
1014
            itemAlreadyOnHold: _("Patron already has hold for this item"),
1015
            itemAlreadyOnHold: _("Patron already has hold for this item"),
1015
            cannotBeTransferred: _("Cannot be transferred to pickup library")
1016
            cannotBeTransferred: _("Cannot be transferred to pickup library")
(-)a/t/db_dependent/Reserves.t (-9 / +8 lines)
Lines 1234-1247 subtest 'AllowHoldOnPatronPossession test' => sub { Link Here
1234
                                          value => { branchcode => $item->homebranch }});
1234
                                          value => { branchcode => $item->homebranch }});
1235
1235
1236
    Koha::CirculationRules->set_rules(
1236
    Koha::CirculationRules->set_rules(
1237
	{
1237
        {
1238
	    branchcode   => undef,
1238
            branchcode   => undef,
1239
	    categorycode => undef,
1239
            categorycode => undef,
1240
	    itemtype     => undef,
1240
            itemtype     => undef,
1241
	    rules        => {
1241
            rules        => {
1242
		onshelfholds => 1,
1242
                onshelfholds => 1,
1243
	    }
1243
            }
1244
	}
1244
        }
1245
    );
1245
    );
1246
1246
1247
    C4::Circulation::AddIssue($patron->unblessed,
1247
    C4::Circulation::AddIssue($patron->unblessed,
1248
- 

Return to bug 20985