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

(-)a/C4/Reserves.pm (-13 / +8 lines)
Lines 25-31 use Modern::Perl; Link Here
25
25
26
use C4::Accounts;
26
use C4::Accounts;
27
use C4::Biblio qw( GetMarcFromKohaField );
27
use C4::Biblio qw( GetMarcFromKohaField );
28
use C4::Circulation qw( CheckIfIssuedToPatron GetAgeRestriction GetBranchItemRule );
28
use C4::Circulation qw( GetAgeRestriction GetBranchItemRule );
29
use C4::Context;
29
use C4::Context;
30
use C4::Items qw( CartToShelf get_hostitemnumbers_of );
30
use C4::Items qw( CartToShelf get_hostitemnumbers_of );
31
use C4::Letters;
31
use C4::Letters;
Lines 335-346 See CanItemBeReserved() for possible return values. Link Here
335
sub CanBookBeReserved{
335
sub CanBookBeReserved{
336
    my ($borrowernumber, $biblionumber, $pickup_branchcode, $params) = @_;
336
    my ($borrowernumber, $biblionumber, $pickup_branchcode, $params) = @_;
337
337
338
    # Check that patron have not checked out this biblio (if AllowHoldsOnPatronsPossessions set)
339
    if ( !C4::Context->preference('AllowHoldsOnPatronsPossessions')
340
        && C4::Circulation::CheckIfIssuedToPatron( $borrowernumber, $biblionumber ) ) {
341
        return { status =>'alreadypossession' };
342
    }
343
344
    if ( $params->{itemtype} ) {
338
    if ( $params->{itemtype} ) {
345
339
346
        # biblio-level, item type-contrained
340
        # biblio-level, item type-contrained
Lines 472-483 sub CanItemBeReserved { Link Here
472
    return _cache { status =>'itemAlreadyOnHold' }
466
    return _cache { status =>'itemAlreadyOnHold' }
473
      if ( !$params->{ignore_hold_counts} && Koha::Holds->search( { borrowernumber => $patron->borrowernumber, itemnumber => $item->itemnumber } )->count() );
467
      if ( !$params->{ignore_hold_counts} && Koha::Holds->search( { borrowernumber => $patron->borrowernumber, itemnumber => $item->itemnumber } )->count() );
474
468
475
    # Check that patron have not checked out this biblio (if AllowHoldsOnPatronsPossessions set)
476
    if ( !C4::Context->preference('AllowHoldsOnPatronsPossessions')
477
        && C4::Circulation::CheckIfIssuedToPatron( $patron->borrowernumber, $item->biblionumber ) ) {
478
        return _cache { status =>'alreadypossession' };
479
    }
480
481
    # check if a recall exists on this item from this borrower
469
    # check if a recall exists on this item from this borrower
482
    return _cache { status => 'recall' }
470
    return _cache { status => 'recall' }
483
      if $patron->recalls->filter_by_current->search({ item_id => $item->itemnumber })->count;
471
      if $patron->recalls->filter_by_current->search({ item_id => $item->itemnumber })->count;
Lines 532-537 sub CanItemBeReserved { Link Here
532
            };
520
            };
533
            my $holds = Koha::Holds->search($search_params);
521
            my $holds = Koha::Holds->search($search_params);
534
            return _cache { status => "tooManyHoldsForThisRecord", limit => $holds_per_record } if $holds->count() >= $holds_per_record;
522
            return _cache { status => "tooManyHoldsForThisRecord", limit => $holds_per_record } if $holds->count() >= $holds_per_record;
523
524
            # Check that patron have not checked out this biblio (if AllowHoldsOnPatronsPossessions set)
525
            if ( !C4::Context->preference('AllowHoldsOnPatronsPossessions')
526
                && $patron->checkouts->find( { itemnumber => $item->itemnumber } ) )
527
            {
528
                return _cache { status => 'alreadypossession' };
529
            }
535
        }
530
        }
536
    }
531
    }
537
532
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (-3 / +3 lines)
Lines 421-427 Link Here
421
                    </div>
421
                    </div>
422
                [% END %]
422
                [% END %]
423
423
424
                [% IF ( no_reserves_allowed || exceeded_maxreserves || exceeded_holds_per_record || alreadyreserved || none_available || alreadypossession || ageRestricted || recall ) %]
424
                [% IF ( no_reserves_allowed || exceeded_maxreserves || exceeded_holds_per_record || alreadyreserved || none_available || ageRestricted || recall ) %]
425
                    <div class="dialog alert">
425
                    <div class="dialog alert">
426
426
427
                        [% UNLESS ( multi_hold ) %]
427
                        [% UNLESS ( multi_hold ) %]
Lines 433-440 Link Here
433
                                    <li><strong>Too many holds:</strong> [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] can only place a maximum of [% maxreserves | html %] total holds.</li>
433
                                    <li><strong>Too many holds:</strong> [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] can only place a maximum of [% maxreserves | html %] total holds.</li>
434
                                [% ELSIF ( exceeded_holds_per_record ) %]
434
                                [% ELSIF ( exceeded_holds_per_record ) %]
435
                                    <li><strong>Too many holds for this record:</strong> [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] can only place a maximum of [% max_holds_for_record | html %] hold(s) on this record.</li>
435
                                    <li><strong>Too many holds for this record:</strong> [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] can only place a maximum of [% max_holds_for_record | html %] hold(s) on this record.</li>
436
                                [% ELSIF ( alreadypossession ) %]
437
                                    <li>[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 hide_patron_infos_if_needed => 1 %] <strong>is already in possession</strong> of one item.</li>
438
                                [% ELSIF ( alreadyreserved ) %]
436
                                [% ELSIF ( alreadyreserved ) %]
439
                                    <li>[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] <strong>already has a hold</strong> on this item.</li>
437
                                    <li>[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] <strong>already has a hold</strong> on this item.</li>
440
                                [% ELSIF ( ageRestricted ) %]
438
                                [% ELSIF ( ageRestricted ) %]
Lines 782-787 Link Here
782
                                                                    <span>No valid pickup location</span>
780
                                                                    <span>No valid pickup location</span>
783
                                                                [% ELSIF itemloo.not_holdable == 'notforloan' %]
781
                                                                [% ELSIF itemloo.not_holdable == 'notforloan' %]
784
                                                                    <span>Not for loan</span>
782
                                                                    <span>Not for loan</span>
783
                                                                [% ELSIF itemloo.not_holdable == 'alreadypossession' %]
784
                                                                    <span>Patron is already in posession of this item</span>
785
                                                                [% ELSE %]
785
                                                                [% ELSE %]
786
                                                                    <span>[% itemloo.not_holdable | html %]</span>
786
                                                                    <span>[% itemloo.not_holdable | html %]</span>
787
                                                                [% END %]
787
                                                                [% END %]
(-)a/reserve/request.pl (-5 lines)
Lines 330-339 if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) Link Here
330
                    $template->param( $canReserve->{status} => 1 );
330
                    $template->param( $canReserve->{status} => 1 );
331
                    $biblioloopiter{ $canReserve->{status} } = 1;
331
                    $biblioloopiter{ $canReserve->{status} } = 1;
332
                }
332
                }
333
                elsif ( $canReserve->{status} eq 'alreadypossession' ) {
334
                    $template->param( $canReserve->{status} => 1);
335
                    $biblioloopiter{ $canReserve->{status} } = 1;
336
                }
337
                elsif ( $canReserve->{status} eq 'recall' ) {
333
                elsif ( $canReserve->{status} eq 'recall' ) {
338
                    $template->param( $canReserve->{status} => 1 );
334
                    $template->param( $canReserve->{status} => 1 );
339
                    $biblioloopiter{ $canReserve->{status} } = 1;
335
                    $biblioloopiter{ $canReserve->{status} } = 1;
340
- 

Return to bug 16260