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 314-332 sub pickup_locations { Link Here
314
    my $branchitemrule =
314
    my $branchitemrule =
315
      C4::Circulation::GetBranchItemRule( $circ_control_branch, $self->itype );
315
      C4::Circulation::GetBranchItemRule( $circ_control_branch, $self->itype );
316
316
317
    my $branch_control = C4::Context->preference('HomeOrHoldingBranch');
318
    my $library = $branch_control eq 'holdingbranch' ? $self->holding_branch : $self->home_branch;
319
320
    my @libs;
317
    my @libs;
321
    if(defined $patron) {
318
    if(defined $patron) {
322
        return @libs if $branchitemrule->{holdallowed} == 3 && !$library->validate_hold_sibling( {branchcode => $patron->branchcode} );
319
        return @libs if $branchitemrule->{holdallowed} == 3 && !$self->home_branch->validate_hold_sibling( {branchcode => $patron->branchcode} );
323
        return @libs if $branchitemrule->{holdallowed} == 1 && $library->branchcode ne $patron->branchcode;
320
        return @libs if $branchitemrule->{holdallowed} == 1 && $self->home_branch->branchcode ne $patron->branchcode;
324
    }
321
    }
325
322
326
    if ($branchitemrule->{hold_fulfillment_policy} eq 'holdgroup') {
323
    if ($branchitemrule->{hold_fulfillment_policy} eq 'holdgroup') {
327
        @libs  = $library->get_hold_libraries;
324
        @libs  = $self->home_branch->get_hold_libraries;
328
        my $circ_control_library = Koha::Libraries->find($circ_control_branch);
325
        push @libs, $self->home_branch unless scalar(@libs) > 0;
329
        push @libs, $circ_control_library unless scalar(@libs) > 0;
326
    } elsif ($branchitemrule->{hold_fulfillment_policy} eq 'patrongroup') {
327
        my $plib = Koha::Libraries->find({ branchcode => $patron->branchcode});
328
        @libs  = $plib->get_hold_libraries;
329
        push @libs, $self->home_branch unless scalar(@libs) > 0;
330
    } elsif ($branchitemrule->{hold_fulfillment_policy} eq 'homebranch') {
330
    } elsif ($branchitemrule->{hold_fulfillment_policy} eq 'homebranch') {
331
        push @libs, $self->home_branch;
331
        push @libs, $self->home_branch;
332
    } elsif ($branchitemrule->{hold_fulfillment_policy} eq 'holdingbranch') {
332
    } 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