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

(-)a/Koha/REST/V1/Acquisitions/Baskets.pm (+62 lines)
Line 0 Link Here
1
package Koha::REST::V1::Acquisitions::Baskets;
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
use Modern::Perl;
19
20
use Mojo::Base 'Mojolicious::Controller';
21
22
use Try::Tiny qw( catch try );
23
24
=head1 NAME
25
26
Koha::REST::V1::Acquisitions::Baskets
27
28
=head1 API
29
30
=head2 Class methods
31
32
=head3 list
33
34
Controller function that handles baskets
35
36
=cut
37
38
=head3 list_managers
39
40
Return the list of possible orders' managers
41
42
=cut
43
44
sub list_managers {
45
    my $c = shift->openapi->valid_input or return;
46
47
    return try {
48
49
        my $patrons_rs = Koha::Patrons->search->filter_by_have_subpermission('acquisition.order_manage');
50
        my $patrons    = $c->objects->search( $patrons_rs );
51
52
        return $c->render(
53
            status  => 200,
54
            openapi => $patrons
55
        );
56
    }
57
    catch {
58
        $c->unhandled_exception($_);
59
    };
60
}
61
62
1;
(-)a/acqui/add_user_search.pl (-64 lines)
Lines 1-64 Link Here
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Copyright 2014 BibLibre
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
use Modern::Perl;
21
22
use CGI qw ( -utf8 );
23
use C4::Auth qw( get_template_and_user );
24
use C4::Output qw( output_html_with_http_headers );
25
use C4::Members;
26
27
use Koha::Patron::Categories ;
28
29
my $input = CGI->new;
30
31
my $dbh = C4::Context->dbh;
32
33
my ( $template, $loggedinuser, $cookie, $staff_flags ) = get_template_and_user(
34
    {   template_name   => "common/patron_search.tt",
35
        query           => $input,
36
        type            => "intranet",
37
        flagsrequired   => { acquisition => 'order_manage' },
38
    }
39
);
40
41
my $q = $input->param('q') || '';
42
my $op = $input->param('op') || '';
43
44
my $referer = $input->referer();
45
46
# If this script is called by acqui/basket.pl
47
# the patrons to return should be superlibrarian or have the order_manage
48
# acquisition flag.
49
my $search_patrons_with_acq_perm_only =
50
    ( $referer =~ m|acqui/basket.pl| )
51
        ? 1 : 0;
52
53
my $patron_categories = Koha::Patron::Categories->search_with_library_limits;
54
$template->param(
55
    patrons_with_acq_perm_only => $search_patrons_with_acq_perm_only,
56
    view => ( $input->request_method() eq "GET" ) ? "show_form" : "show_results",
57
    columns => ['cardnumber', 'name', 'branch', 'category', 'action'],
58
    json_template => 'acqui/tables/members_results.tt',
59
    selection_type => 'add',
60
    alphabet        => ( C4::Context->preference('alphabet') || join ' ', 'A' .. 'Z' ),
61
    categories      => $patron_categories,
62
    aaSorting       => 1,
63
);
64
output_html_with_http_headers( $input, $cookie, $template->output );
(-)a/api/v1/swagger/swagger.yaml (+2 lines)
Lines 65-70 definitions: Link Here
65
  vendor:
65
  vendor:
66
    $ref: ./definitions/vendor.yaml
66
    $ref: ./definitions/vendor.yaml
67
paths:
67
paths:
68
  /acquisitions/baskets/managers:
69
    $ref: paths/acquisitions_baskets.yaml#/~1acquisitions~1baskets~1managers
68
  /acquisitions/funds:
70
  /acquisitions/funds:
69
    $ref: ./paths/acquisitions_funds.yaml#/~1acquisitions~1funds
71
    $ref: ./paths/acquisitions_funds.yaml#/~1acquisitions~1funds
70
  /acquisitions/orders:
72
  /acquisitions/orders:
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt (-1 / +1 lines)
Lines 1010-1016 Link Here
1010
1010
1011
        function UserSearchPopup(f) {
1011
        function UserSearchPopup(f) {
1012
            window.open(
1012
            window.open(
1013
                "/cgi-bin/koha/acqui/add_user_search.pl",
1013
                "/cgi-bin/koha/members/search.pl?columns=cardnumber,name,category,branch,action&selection_type=add&filter=baskets_managers",
1014
                'UserSearchPopup',
1014
                'UserSearchPopup',
1015
                'width=840, height=500, scrollbars=yes, toolbar=no,'
1015
                'width=840, height=500, scrollbars=yes, toolbar=no,'
1016
             );
1016
             );
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/search.tt (-1 / +2 lines)
Lines 167-172 Link Here
167
                    [% SWITCH filter %]
167
                    [% SWITCH filter %]
168
                    [% CASE 'suggestions_managers' %]
168
                    [% CASE 'suggestions_managers' %]
169
                        "url": '/api/v1/suggestions/managers'
169
                        "url": '/api/v1/suggestions/managers'
170
                    [% CASE 'baskets_managers' %]
171
                        "url": '/api/v1/acquisitions/baskets/managers'
170
                    [% CASE %]
172
                    [% CASE %]
171
                        "url": '/api/v1/patrons'
173
                        "url": '/api/v1/patrons'
172
                    [% END %]
174
                    [% END %]
173
- 

Return to bug 30055