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

(-)a/C4/Reserves.pm (+3 lines)
Lines 510-515 sub CanItemBeReserved { Link Here
510
        unless ($branchitemrule->{hold_fulfillment_policy} ne 'holdgroup' || $item_library->validate_hold_sibling( {branchcode => $pickup_branchcode} )) {
510
        unless ($branchitemrule->{hold_fulfillment_policy} ne 'holdgroup' || $item_library->validate_hold_sibling( {branchcode => $pickup_branchcode} )) {
511
            return { status => 'pickupNotInHoldGroup' };
511
            return { status => 'pickupNotInHoldGroup' };
512
        }
512
        }
513
        unless ($branchitemrule->{hold_fulfillment_policy} ne 'patrongroup' || Koha::Libraries->find({branchcode => $borrower->{branchcode}})->validate_hold_sibling({branchcode => $pickup_branchcode})) {
514
            return { status => 'pickupNotInHoldGroup' };
515
        }
513
    }
516
    }
514
517
515
    return { status => 'OK' };
518
    return { status => 'OK' };
(-)a/Koha/Item.pm (-8 / +8 lines)
Lines 313-331 sub pickup_locations { Link Here
313
    my $branchitemrule =
313
    my $branchitemrule =
314
      C4::Circulation::GetBranchItemRule( $circ_control_branch, $self->itype );
314
      C4::Circulation::GetBranchItemRule( $circ_control_branch, $self->itype );
315
315
316
    my $branch_control = C4::Context->preference('HomeOrHoldingBranch');
317
    my $library = $branch_control eq 'holdingbranch' ? $self->holding_branch : $self->home_branch;
318
319
    my @libs;
316
    my @libs;
320
    if(defined $patron) {
317
    if(defined $patron) {
321
        return @libs if $branchitemrule->{holdallowed} == 3 && !$library->validate_hold_sibling( {branchcode => $patron->branchcode} );
318
        return @libs if $branchitemrule->{holdallowed} == 3 && !$self->home_branch->validate_hold_sibling( {branchcode => $patron->branchcode} );
322
        return @libs if $branchitemrule->{holdallowed} == 1 && $library->branchcode ne $patron->branchcode;
319
        return @libs if $branchitemrule->{holdallowed} == 1 && $self->home_branch->branchcode ne $patron->branchcode;
323
    }
320
    }
324
321
325
    if ($branchitemrule->{hold_fulfillment_policy} eq 'holdgroup') {
322
    if ($branchitemrule->{hold_fulfillment_policy} eq 'holdgroup') {
326
        @libs  = $library->get_hold_libraries;
323
        @libs  = $self->home_branch->get_hold_libraries;
327
        my $circ_control_library = Koha::Libraries->find($circ_control_branch);
324
        push @libs, $self->home_branch unless scalar(@libs) > 0;
328
        push @libs, $circ_control_library unless scalar(@libs) > 0;
325
    } elsif ($branchitemrule->{hold_fulfillment_policy} eq 'patrongroup') {
326
        my $plib = Koha::Libraries->find({ branchcode => $patron->branchcode});
327
        @libs  = $plib->get_hold_libraries;
328
        push @libs, $self->home_branch unless scalar(@libs) > 0;
329
    } elsif ($branchitemrule->{hold_fulfillment_policy} eq 'homebranch') {
329
    } elsif ($branchitemrule->{hold_fulfillment_policy} eq 'homebranch') {
330
        push @libs, $self->home_branch;
330
        push @libs, $self->home_branch;
331
    } elsif ($branchitemrule->{hold_fulfillment_policy} eq 'holdingbranch') {
331
    } elsif ($branchitemrule->{hold_fulfillment_policy} eq 'holdingbranch') {
(-)a/Koha/Libraries.pm (-1 / +2 lines)
Lines 28-33 use Koha::Database; Link Here
28
use Koha::Item::Transfer::Limits;
28
use Koha::Item::Transfer::Limits;
29
use Koha::Items;
29
use Koha::Items;
30
use Koha::Library;
30
use Koha::Library;
31
use Koha::Patrons;
31
32
32
use base qw(Koha::Objects);
33
use base qw(Koha::Objects);
33
34
Lines 75-81 sub pickup_locations { Link Here
75
        );
76
        );
76
    }
77
    }
77
    unless (! defined $patron || ref($patron) eq 'Koha::Patron') {
78
    unless (! defined $patron || ref($patron) eq 'Koha::Patron') {
78
        $patron = Koha::Items->find($patron);
79
        $patron = Koha::Patrons->find($patron);
79
    }
80
    }
80
81
81
    # Select libraries that are configured as pickup locations
82
    # Select libraries that are configured as pickup locations
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (+16 lines)
Lines 496-501 Link Here
496
                                </option>
496
                                </option>
497
                            [% END %]
497
                            [% END %]
498
498
499
                            [% IF hold_fulfillment_policy == 'patrongroup' %]
500
                                <option value="patrongroup" selected="selected">
501
                                    patron's hold group
502
                                </option>
503
                            [% ELSE %]
504
                                <option value="patrongroup">
505
                                    patron's hold group
506
                                </option>
507
                            [% END %]
508
499
                            [% IF hold_fulfillment_policy == 'homebranch' %]
509
                            [% IF hold_fulfillment_policy == 'homebranch' %]
500
                                <option value="homebranch" selected="selected">
510
                                <option value="homebranch" selected="selected">
501
                                    item's home library
511
                                    item's home library
Lines 774-779 Link Here
774
                                    <span>item's home library</span>
784
                                    <span>item's home library</span>
775
                                [% ELSIF hold_fulfillment_policy == 'holdgroup' %]
785
                                [% ELSIF hold_fulfillment_policy == 'holdgroup' %]
776
                                    <span>item's hold group</span>
786
                                    <span>item's hold group</span>
787
                                [% ELSIF hold_fulfillment_policy == 'patrongroup' %]
788
                                    <span>patron's hold group</span>
777
                                [% ELSIF hold_fulfillment_policy == 'holdingbranch' %]
789
                                [% ELSIF hold_fulfillment_policy == 'holdingbranch' %]
778
                                    <span>item's holding library</span>
790
                                    <span>item's holding library</span>
779
                                [% END %]
791
                                [% END %]
Lines 819-824 Link Here
819
                                item's hold group
831
                                item's hold group
820
                            </option>
832
                            </option>
821
833
834
                            <option value="patrongroup">
835
                                patron's hold group
836
                            </option>
837
822
                            <option value="homebranch">
838
                            <option value="homebranch">
823
                                item's home library
839
                                item's home library
824
                            </option>
840
                            </option>
(-)a/reserve/request.pl (-2 / +1 lines)
Lines 565-571 foreach my $biblionumber (@biblionumbers) { Link Here
565
                    if($branchitemrule->{'hold_fulfillment_policy'} eq 'any' ) {
565
                    if($branchitemrule->{'hold_fulfillment_policy'} eq 'any' ) {
566
                        $item->{pickup_locations} = 'Any library';
566
                        $item->{pickup_locations} = 'Any library';
567
                    } else {
567
                    } else {
568
                        $item->{pickup_locations} = join (', ', map { $_->{branchname} } Koha::Items->find($itemnumber)->pickup_locations());
568
                        $item->{pickup_locations} = join (', ', map { $_->{branchname} } Koha::Items->find($itemnumber)->pickup_locations({ patron => $patron }));
569
                    }
569
                    }
570
570
571
                    push( @available_itemtypes, $item->{itype} );
571
                    push( @available_itemtypes, $item->{itype} );
572
- 

Return to bug 22284