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

(-)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 506-512 foreach my $biblionumber (@biblionumbers) { Link Here
506
                    if($branchitemrule->{'hold_fulfillment_policy'} eq 'any' ) {
506
                    if($branchitemrule->{'hold_fulfillment_policy'} eq 'any' ) {
507
                        $item->{pickup_locations} = 'Any library';
507
                        $item->{pickup_locations} = 'Any library';
508
                    } else {
508
                    } else {
509
                        $item->{pickup_locations} = join (', ', map { $_->{branchname} } Koha::Items->find($itemnumber)->pickup_locations());
509
                        $item->{pickup_locations} = join (', ', map { $_->{branchname} } Koha::Items->find($itemnumber)->pickup_locations({ patron => $patron }));
510
                    }
510
                    }
511
511
512
                    push( @available_itemtypes, $item->{itype} );
512
                    push( @available_itemtypes, $item->{itype} );
513
- 

Return to bug 22284