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

(-)a/C4/Reserves.pm (-2 / +2 lines)
Lines 314-320 sub CanBookBeReserved{ Link Here
314
    # Check that patron have not checked out this biblio (if AllowHoldsOnPatronsPossessions set)
314
    # Check that patron have not checked out this biblio (if AllowHoldsOnPatronsPossessions set)
315
    if ( !C4::Context->preference('AllowHoldsOnPatronsPossessions')
315
    if ( !C4::Context->preference('AllowHoldsOnPatronsPossessions')
316
        && C4::Circulation::CheckIfIssuedToPatron( $borrowernumber, $biblionumber ) ) {
316
        && C4::Circulation::CheckIfIssuedToPatron( $borrowernumber, $biblionumber ) ) {
317
        return { status =>'itemAlreadyOnLoan' };
317
        return { status =>'alreadypossession' };
318
    }
318
    }
319
319
320
    my @itemnumbers = Koha::Items->search({ biblionumber => $biblionumber})->get_column("itemnumber");
320
    my @itemnumbers = Koha::Items->search({ biblionumber => $biblionumber})->get_column("itemnumber");
Lines 384-390 sub CanItemBeReserved { Link Here
384
    # Check that patron have not checked out this biblio (if AllowHoldsOnPatronsPossessions set)
384
    # Check that patron have not checked out this biblio (if AllowHoldsOnPatronsPossessions set)
385
    if ( !C4::Context->preference('AllowHoldsOnPatronsPossessions')
385
    if ( !C4::Context->preference('AllowHoldsOnPatronsPossessions')
386
        && C4::Circulation::CheckIfIssuedToPatron( $patron->borrowernumber, $biblio->biblionumber ) ) {
386
        && C4::Circulation::CheckIfIssuedToPatron( $patron->borrowernumber, $biblio->biblionumber ) ) {
387
        return { status =>'itemAlreadyOnLoan' };
387
        return { status =>'alreadypossession' };
388
    }
388
    }
389
389
390
    my $controlbranch = C4::Context->preference('ReservesControlBranch');
390
    my $controlbranch = C4::Context->preference('ReservesControlBranch');
(-)a/opac/opac-reserve.pl (-5 lines)
Lines 602-612 foreach my $biblioNum (@biblionumbers) { Link Here
602
        $biblioLoopIter{holdable} = undef;
602
        $biblioLoopIter{holdable} = undef;
603
        $biblioLoopIter{itemholdable} = undef;
603
        $biblioLoopIter{itemholdable} = undef;
604
    }
604
    }
605
    if(not C4::Context->preference('AllowHoldsOnPatronsPossessions') and CheckIfIssuedToPatron($borrowernumber,$biblioNum)) {
606
        $biblioLoopIter{holdable} = undef;
607
        $biblioLoopIter{already_patron_possession} = 1;
608
    }
609
610
    if ( $biblioLoopIter{holdable} ) {
605
    if ( $biblioLoopIter{holdable} ) {
611
        @not_available_at = uniq @not_available_at;
606
        @not_available_at = uniq @not_available_at;
612
        $biblioLoopIter{not_available_at} = \@not_available_at ;
607
        $biblioLoopIter{not_available_at} = \@not_available_at ;
(-)a/reserve/request.pl (-10 / +4 lines)
Lines 314-319 foreach my $biblionumber (@biblionumbers) { Link Here
314
                $template->param( $canReserve->{status} => 1 );
314
                $template->param( $canReserve->{status} => 1 );
315
                $biblioloopiter{ $canReserve->{status} } = 1;
315
                $biblioloopiter{ $canReserve->{status} } = 1;
316
            }
316
            }
317
	    elsif ( $canReserve->{status} eq 'alreadypossession' ) {
318
		$template->param( $canReserve->{status} => 1);
319
		$biblioloopiter{ $canReserve->{status} } = 1;
320
	    }
317
            else {
321
            else {
318
                $biblioloopiter{ $canReserve->{status} } = 1;
322
                $biblioloopiter{ $canReserve->{status} } = 1;
319
            }
323
            }
Lines 342-357 foreach my $biblionumber (@biblionumbers) { Link Here
342
        $biblioloopiter{remaining_holds_for_record} = $max_holds_for_record;
346
        $biblioloopiter{remaining_holds_for_record} = $max_holds_for_record;
343
        $template->param( max_holds_for_record => $max_holds_for_record );
347
        $template->param( max_holds_for_record => $max_holds_for_record );
344
        $template->param( remaining_holds_for_record => $remaining_holds_for_record );
348
        $template->param( remaining_holds_for_record => $remaining_holds_for_record );
345
346
        { # alreadypossession
347
            # Check to see if patron is allowed to place holds on records where the
348
            # patron already has an item from that record checked out
349
            if ( !C4::Context->preference('AllowHoldsOnPatronsPossessions')
350
                && CheckIfIssuedToPatron( $patron->borrowernumber, $biblionumber ) )
351
            {
352
                $template->param( alreadypossession => 1, );
353
            }
354
        }
355
    }
349
    }
356
350
357
351
(-)a/t/db_dependent/ILSDI_Services.t (-1 / +1 lines)
Lines 462-468 subtest 'Holds test' => sub { Link Here
462
    $query->param( 'item_id', $item3->{itemnumber});
462
    $query->param( 'item_id', $item3->{itemnumber});
463
    $reply = C4::ILSDI::Services::HoldItem( $query );
463
    $reply = C4::ILSDI::Services::HoldItem( $query );
464
464
465
    is( $reply->{code}, 'itemAlreadyOnLoan', "Patron has issued same book" );
465
    is( $reply->{code}, 'alreadypossession', "Patron has issued same book" );
466
    is( $reply->{pickup_location}, undef, "No reserve placed");
466
    is( $reply->{pickup_location}, undef, "No reserve placed");
467
467
468
    $schema->storage->txn_rollback;
468
    $schema->storage->txn_rollback;
(-)a/t/db_dependent/Reserves.t (-3 / +2 lines)
Lines 1052-1063 subtest 'AllowHoldOnPatronPossession test' => sub { Link Here
1052
1052
1053
    is(C4::Reserves::CanBookBeReserved($patron->borrowernumber,
1053
    is(C4::Reserves::CanBookBeReserved($patron->borrowernumber,
1054
                                       $item->biblionumber)->{status},
1054
                                       $item->biblionumber)->{status},
1055
       'itemAlreadyOnLoan',
1055
       'alreadypossession',
1056
       'Patron cannot place hold on a book loaned to itself');
1056
       'Patron cannot place hold on a book loaned to itself');
1057
1057
1058
    is(C4::Reserves::CanItemBeReserved($patron->borrowernumber,
1058
    is(C4::Reserves::CanItemBeReserved($patron->borrowernumber,
1059
                                       $item->itemnumber)->{status},
1059
                                       $item->itemnumber)->{status},
1060
       'itemAlreadyOnLoan',
1060
       'alreadypossession',
1061
       'Patron cannot place hold on an item loaned to itself');
1061
       'Patron cannot place hold on an item loaned to itself');
1062
1062
1063
    t::lib::Mocks::mock_preference('AllowHoldsOnPatronsPossessions', 1);
1063
    t::lib::Mocks::mock_preference('AllowHoldsOnPatronsPossessions', 1);
1064
- 

Return to bug 22806