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

(-)a/C4/Reserves.pm (-3 / +13 lines)
Lines 355-360 sub CanBookBeReserved{ Link Here
355
  should not check if there are too many holds as we only csre about reservability
355
  should not check if there are too many holds as we only csre about reservability
356
356
357
@RETURNS { status => OK },              if the Item can be reserved.
357
@RETURNS { status => OK },              if the Item can be reserved.
358
         { status => onShelfHoldsNotAllowed },  if onShelfHoldsAllowed parameter and item availability combination doesn't allow holds.
358
         { status => ageRestricted },   if the Item is age restricted for this borrower.
359
         { status => ageRestricted },   if the Item is age restricted for this borrower.
359
         { status => damaged },         if the Item is damaged.
360
         { status => damaged },         if the Item is damaged.
360
         { status => cannotReserveFromOtherBranches }, if syspref 'canreservefromotherbranches' is OK.
361
         { status => cannotReserveFromOtherBranches }, if syspref 'canreservefromotherbranches' is OK.
Lines 374-379 sub CanItemBeReserved { Link Here
374
    my $dbh = C4::Context->dbh;
375
    my $dbh = C4::Context->dbh;
375
    my $ruleitemtype;    # itemtype of the matching issuing rule
376
    my $ruleitemtype;    # itemtype of the matching issuing rule
376
    my $allowedreserves  = 0; # Total number of holds allowed across all records, default to none
377
    my $allowedreserves  = 0; # Total number of holds allowed across all records, default to none
378
    my $holds_per_record = 1; # Total number of holds allowed for this one given record
379
    my $holds_per_day;        # Default to unlimited
380
    my $on_shelf_holds = 0;   # Default to "if any unavailable"
381
    my $context = $params->{context} // '';
377
382
378
    # we retrieve borrowers and items informations #
383
    # we retrieve borrowers and items informations #
379
    # item->{itype} will come for biblioitems if necessery
384
    # item->{itype} will come for biblioitems if necessery
Lines 445-454 sub CanItemBeReserved { Link Here
445
        categorycode => $borrower->{'categorycode'},
450
        categorycode => $borrower->{'categorycode'},
446
        itemtype     => $item->effective_itemtype,
451
        itemtype     => $item->effective_itemtype,
447
        branchcode   => $branchcode,
452
        branchcode   => $branchcode,
448
        rules        => ['holds_per_record','holds_per_day']
453
        rules        => ['holds_per_record','holds_per_day','onshelfholds']
449
    });
454
    });
450
    my $holds_per_record = $rights->{holds_per_record} // 1;
455
    $holds_per_record = $rights->{holds_per_record} // 1;
451
    my $holds_per_day    = $rights->{holds_per_day};
456
    $holds_per_day    = $rights->{holds_per_day};
457
    $on_shelf_holds   = $rights->{onshelfholds};
452
458
453
    my $search_params = {
459
    my $search_params = {
454
        borrowernumber => $borrowernumber,
460
        borrowernumber => $borrowernumber,
Lines 456-461 sub CanItemBeReserved { Link Here
456
    };
462
    };
457
    $search_params->{found} = undef if $params->{ignore_found_holds};
463
    $search_params->{found} = undef if $params->{ignore_found_holds};
458
464
465
    # Check for item on shelves and OnShelfHoldsAllowed
466
    return { status => 'onShelfHoldsNotAllowed' }
467
    unless IsAvailableForItemLevelRequest($item, $patron, $pickup_branchcode,1);
468
459
    my $holds = Koha::Holds->search($search_params);
469
    my $holds = Koha::Holds->search($search_params);
460
    if (   defined $holds_per_record && $holds_per_record ne '' ){
470
    if (   defined $holds_per_record && $holds_per_record ne '' ){
461
        if ( $holds_per_record == 0 ) {
471
        if ( $holds_per_record == 0 ) {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (+1 lines)
Lines 1051-1056 Link Here
1051
            tooManyReserves: _("Too many holds"),
1051
            tooManyReserves: _("Too many holds"),
1052
            notReservable: _("Not holdable"),
1052
            notReservable: _("Not holdable"),
1053
            noReservesAllowed: _("No reserves allowed"),
1053
            noReservesAllowed: _("No reserves allowed"),
1054
            onShelfHoldsNotAllowed: _("Not holdable"),
1054
            cannotReserveFromOtherBranches: _("Patron is from different library"),
1055
            cannotReserveFromOtherBranches: _("Patron is from different library"),
1055
            itemAlreadyOnHold: _("Patron already has hold for this item"),
1056
            itemAlreadyOnHold: _("Patron already has hold for this item"),
1056
            cannotBeTransferred: _("Cannot be transferred to pickup library"),
1057
            cannotBeTransferred: _("Cannot be transferred to pickup library"),
(-)a/t/db_dependent/Reserves.t (-9 / +8 lines)
Lines 1236-1249 subtest 'AllowHoldOnPatronPossession test' => sub { Link Here
1236
                                          value => { branchcode => $item->homebranch }});
1236
                                          value => { branchcode => $item->homebranch }});
1237
1237
1238
    Koha::CirculationRules->set_rules(
1238
    Koha::CirculationRules->set_rules(
1239
	{
1239
        {
1240
	    branchcode   => undef,
1240
            branchcode   => undef,
1241
	    categorycode => undef,
1241
            categorycode => undef,
1242
	    itemtype     => undef,
1242
            itemtype     => undef,
1243
	    rules        => {
1243
            rules        => {
1244
		onshelfholds => 1,
1244
                onshelfholds => 1,
1245
	    }
1245
            }
1246
	}
1246
        }
1247
    );
1247
    );
1248
1248
1249
    C4::Circulation::AddIssue($patron->unblessed,
1249
    C4::Circulation::AddIssue($patron->unblessed,
1250
- 

Return to bug 20985