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

(-)a/C4/Reserves.pm (+3 lines)
Lines 494-499 sub CanItemBeReserved { Link Here
494
        unless ($branchitemrule->{hold_fulfillment_policy} ne 'holdgroup' || $item_library->validate_hold_sibling( {branchcode => $pickup_branchcode} )) {
494
        unless ($branchitemrule->{hold_fulfillment_policy} ne 'holdgroup' || $item_library->validate_hold_sibling( {branchcode => $pickup_branchcode} )) {
495
            return { status => 'pickupNotInHoldGroup' };
495
            return { status => 'pickupNotInHoldGroup' };
496
        }
496
        }
497
        unless ($branchitemrule->{hold_fulfillment_policy} ne 'patrongroup' || Koha::Libraries->find({branchcode => $borrower->{branchcode}})->validate_hold_sibling({branchcode => $pickup_branchcode})) {
498
            return { status => 'pickupNotInHoldGroup' };
499
        }
497
    }
500
    }
498
501
499
    return { status => 'OK' };
502
    return { status => 'OK' };
(-)a/Koha/Item.pm (-8 / +8 lines)
Lines 316-334 sub pickup_locations { Link Here
316
    my $branchitemrule =
316
    my $branchitemrule =
317
      C4::Circulation::GetBranchItemRule( $circ_control_branch, $self->itype );
317
      C4::Circulation::GetBranchItemRule( $circ_control_branch, $self->itype );
318
318
319
    my $branch_control = C4::Context->preference('HomeOrHoldingBranch');
320
    my $library = $branch_control eq 'holdingbranch' ? $self->holding_branch : $self->home_branch;
321
322
    my @libs;
319
    my @libs;
323
    if(defined $patron) {
320
    if(defined $patron) {
324
        return @libs if $branchitemrule->{holdallowed} == 3 && !$library->validate_hold_sibling( {branchcode => $patron->branchcode} );
321
        return @libs if $branchitemrule->{holdallowed} == 3 && !$self->home_branch->validate_hold_sibling( {branchcode => $patron->branchcode} );
325
        return @libs if $branchitemrule->{holdallowed} == 1 && $library->branchcode ne $patron->branchcode;
322
        return @libs if $branchitemrule->{holdallowed} == 1 && $self->home_branch->branchcode ne $patron->branchcode;
326
    }
323
    }
327
324
328
    if ($branchitemrule->{hold_fulfillment_policy} eq 'holdgroup') {
325
    if ($branchitemrule->{hold_fulfillment_policy} eq 'holdgroup') {
329
        @libs  = $library->get_hold_libraries;
326
        @libs  = $self->home_branch->get_hold_libraries;
330
        my $circ_control_library = Koha::Libraries->find($circ_control_branch);
327
        push @libs, $self->home_branch unless scalar(@libs) > 0;
331
        push @libs, $circ_control_library unless scalar(@libs) > 0;
328
    } elsif ($branchitemrule->{hold_fulfillment_policy} eq 'patrongroup') {
329
        my $plib = Koha::Libraries->find({ branchcode => $patron->branchcode});
330
        @libs  = $plib->get_hold_libraries;
331
        push @libs, $self->home_branch unless scalar(@libs) > 0;
332
    } elsif ($branchitemrule->{hold_fulfillment_policy} eq 'homebranch') {
332
    } elsif ($branchitemrule->{hold_fulfillment_policy} eq 'homebranch') {
333
        push @libs, $self->home_branch;
333
        push @libs, $self->home_branch;
334
    } elsif ($branchitemrule->{hold_fulfillment_policy} eq 'holdingbranch') {
334
    } 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 494-500 foreach my $biblionumber (@biblionumbers) { Link Here
494
                    if($branchitemrule->{'hold_fulfillment_policy'} eq 'any' ) {
494
                    if($branchitemrule->{'hold_fulfillment_policy'} eq 'any' ) {
495
                        $item->{pickup_locations} = 'Any library';
495
                        $item->{pickup_locations} = 'Any library';
496
                    } else {
496
                    } else {
497
                        $item->{pickup_locations} = join (', ', map { $_->{branchname} } Koha::Items->find($itemnumber)->pickup_locations());
497
                        $item->{pickup_locations} = join (', ', map { $_->{branchname} } Koha::Items->find($itemnumber)->pickup_locations({ patron => $patron }));
498
                    }
498
                    }
499
499
500
                    push( @available_itemtypes, $item->{itype} );
500
                    push( @available_itemtypes, $item->{itype} );
501
- 

Return to bug 22284