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 299-317 sub pickup_locations { Link Here
299
    my $branchitemrule =
299
    my $branchitemrule =
300
      C4::Circulation::GetBranchItemRule( $circ_control_branch, $self->itype );
300
      C4::Circulation::GetBranchItemRule( $circ_control_branch, $self->itype );
301
301
302
    my $branch_control = C4::Context->preference('HomeOrHoldingBranch');
303
    my $library = $branch_control eq 'holdingbranch' ? $self->holding_branch : $self->home_branch;
304
305
    my @libs;
302
    my @libs;
306
    if(defined $patron) {
303
    if(defined $patron) {
307
        return @libs if $branchitemrule->{holdallowed} == 3 && !$library->validate_hold_sibling( {branchcode => $patron->branchcode} );
304
        return @libs if $branchitemrule->{holdallowed} == 3 && !$self->home_branch->validate_hold_sibling( {branchcode => $patron->branchcode} );
308
        return @libs if $branchitemrule->{holdallowed} == 1 && $library->branchcode ne $patron->branchcode;
305
        return @libs if $branchitemrule->{holdallowed} == 1 && $self->home_branch->branchcode ne $patron->branchcode;
309
    }
306
    }
310
307
311
    if ($branchitemrule->{hold_fulfillment_policy} eq 'holdgroup') {
308
    if ($branchitemrule->{hold_fulfillment_policy} eq 'holdgroup') {
312
        @libs  = $library->get_hold_libraries;
309
        @libs  = $self->home_branch->get_hold_libraries;
313
        my $circ_control_library = Koha::Libraries->find($circ_control_branch);
310
        push @libs, $self->home_branch unless scalar(@libs) > 0;
314
        push @libs, $circ_control_library unless scalar(@libs) > 0;
311
    } elsif ($branchitemrule->{hold_fulfillment_policy} eq 'patrongroup') {
312
        my $plib = Koha::Libraries->find({ branchcode => $patron->branchcode});
313
        @libs  = $plib->get_hold_libraries;
314
        push @libs, $self->home_branch unless scalar(@libs) > 0;
315
    } elsif ($branchitemrule->{hold_fulfillment_policy} eq 'homebranch') {
315
    } elsif ($branchitemrule->{hold_fulfillment_policy} eq 'homebranch') {
316
        push @libs, $self->home_branch;
316
        push @libs, $self->home_branch;
317
    } elsif ($branchitemrule->{hold_fulfillment_policy} eq 'holdingbranch') {
317
    } 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 490-495 Link Here
490
                                </option>
490
                                </option>
491
                            [% END %]
491
                            [% END %]
492
492
493
                            [% IF hold_fulfillment_policy == 'patrongroup' %]
494
                                <option value="patrongroup" selected="selected">
495
                                    patron's hold group
496
                                </option>
497
                            [% ELSE %]
498
                                <option value="patrongroup">
499
                                    patron's hold group
500
                                </option>
501
                            [% END %]
502
493
                            [% IF hold_fulfillment_policy == 'homebranch' %]
503
                            [% IF hold_fulfillment_policy == 'homebranch' %]
494
                                <option value="homebranch" selected="selected">
504
                                <option value="homebranch" selected="selected">
495
                                    item's home library
505
                                    item's home library
Lines 768-773 Link Here
768
                                    <span>item's home library</span>
778
                                    <span>item's home library</span>
769
                                [% ELSIF hold_fulfillment_policy == 'holdgroup' %]
779
                                [% ELSIF hold_fulfillment_policy == 'holdgroup' %]
770
                                    <span>item's hold group</span>
780
                                    <span>item's hold group</span>
781
                                [% ELSIF hold_fulfillment_policy == 'patrongroup' %]
782
                                    <span>patron's hold group</span>
771
                                [% ELSIF hold_fulfillment_policy == 'holdingbranch' %]
783
                                [% ELSIF hold_fulfillment_policy == 'holdingbranch' %]
772
                                    <span>item's holding library</span>
784
                                    <span>item's holding library</span>
773
                                [% END %]
785
                                [% END %]
Lines 813-818 Link Here
813
                                item's hold group
825
                                item's hold group
814
                            </option>
826
                            </option>
815
827
828
                            <option value="patrongroup">
829
                                patron's hold group
830
                            </option>
831
816
                            <option value="homebranch">
832
                            <option value="homebranch">
817
                                item's home library
833
                                item's home library
818
                            </option>
834
                            </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