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

(-)a/Koha/Libraries.pm (-28 / +1 lines)
Lines 65-84 If no parameters are given, all libraries with pickup_location => 1 are returned Link Here
65
sub pickup_locations {
65
sub pickup_locations {
66
    my ($self, $params) = @_;
66
    my ($self, $params) = @_;
67
67
68
    my $item = $params->{'item'};
69
    my $biblio = $params->{'biblio'};
70
    my $patron = $params->{'patron'};
71
72
    if ($biblio && $item) {
73
        Koha::Exceptions::BadParameter->throw(
74
            error => "Koha::Libraries->pickup_locations takes either 'biblio' or "
75
            ." 'item' as parameter, but not both."
76
        );
77
    }
78
    unless (! defined $patron || ref($patron) eq 'Koha::Patron') {
79
        $patron = Koha::Patrons->find($patron);
80
    }
81
82
    # Select libraries that are configured as pickup locations
68
    # Select libraries that are configured as pickup locations
83
    my $libraries = $self->search({
69
    my $libraries = $self->search({
84
        pickup_location => 1
70
        pickup_location => 1
Lines 86-105 sub pickup_locations { Link Here
86
        order_by => ['branchname']
72
        order_by => ['branchname']
87
    });
73
    });
88
74
89
    return $libraries unless $item or $biblio;
75
    return $libraries;
90
    if($item) {
91
        unless (ref($item) eq 'Koha::Item') {
92
            $item = Koha::Items->find($item);
93
            return $libraries unless $item;
94
        }
95
        return $item->pickup_locations( {patron => $patron} );
96
    } else {
97
        unless (ref($biblio) eq 'Koha::Biblio') {
98
            $biblio = Koha::Biblios->find($biblio);
99
            return $libraries unless $biblio;
100
        }
101
        return $biblio->pickup_locations( {patron => $patron} );
102
    }
103
}
76
}
104
77
105
=head3 search_filtered
78
=head3 search_filtered
(-)a/Koha/Template/Plugin/Branches.pm (-2 / +22 lines)
Lines 87-96 sub InIndependentBranchesMode { Link Here
87
87
88
sub pickup_locations {
88
sub pickup_locations {
89
    my ( $self, $params ) = @_;
89
    my ( $self, $params ) = @_;
90
91
    my $search_params = $params->{search_params} || {};
90
    my $search_params = $params->{search_params} || {};
92
    my $selected      = $params->{selected};
91
    my $selected      = $params->{selected};
93
    my $libraries     = Koha::Libraries->pickup_locations($search_params);
92
    my $libraries;
93
94
    if(defined $search_params->{item} || defined $search_params->{biblio}) {
95
        my $item = $search_params->{'item'};
96
        my $biblio = $search_params->{'biblio'};
97
        my $patron = $search_params->{'patron'};
98
99
        unless (! defined $patron || ref($patron) eq 'Koha::Patron') {
100
            $patron = Koha::Patrons->find($patron);
101
        }
102
103
        if($item) {
104
            $item = Koha::Items->find($item) unless ref($item) eq 'Koha::Item';
105
            $libraries = $item->pickup_locations( {patron => $patron} ) if defined $item;
106
        } elsif($biblio) {
107
            $biblio = Koha::Biblios->find($biblio) unless ref($biblio) eq 'Koha::Biblio';
108
            $libraries = $biblio->pickup_locations( {patron => $patron} ) if defined $biblio;
109
        }
110
        
111
    }
112
    
113
    $libraries = Koha::Libraries->pickup_locations()->as_list unless defined $libraries;
94
114
95
    for my $l (@$libraries) {
115
    for my $l (@$libraries) {
96
        $l = $l->unblessed;
116
        $l = $l->unblessed;
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc (-2 / +1 lines)
Lines 131-137 Link Here
131
                        [% Branches.GetName(hold.branchcode) | html %] <input type="hidden" name="pickup" value="[% hold.branchcode | html %]" />
131
                        [% Branches.GetName(hold.branchcode) | html %] <input type="hidden" name="pickup" value="[% hold.branchcode | html %]" />
132
                    [% ELSE %]
132
                    [% ELSE %]
133
                        <select name="pickup">
133
                        <select name="pickup">
134
                            [% PROCESS options_for_libraries libraries => Branches.pickup_locations( { search_params => { item => hold.itemnumber, patron => hold.patron }, selected => hold.branchcode }) %]
134
                            [% PROCESS options_for_libraries libraries => Branches.pickup_locations( { search_params => { item => hold.itemnumber, biblio => hold.biblionumber, patron => hold.patron }, selected => hold.branchcode }) %]
135
                        </select>
135
                        </select>
136
                    [% END %]
136
                    [% END %]
137
                [% END %]
137
                [% END %]
138
- 

Return to bug 24350