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

(-)a/circ/request-article-do.pl (-62 lines)
Lines 1-62 Link Here
1
#!/usr/bin/perl
2
3
# Copyright ByWater Solutions 2015
4
#
5
# This file is part of Koha.
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
24
use C4::Auth;
25
use C4::Output;
26
27
use Koha::ArticleRequest;
28
29
my $cgi = new CGI;
30
31
checkauth( $cgi, 0, { circulate => 'circulate_remaining_permissions' }, 'intranet' );
32
33
my $biblionumber   = $cgi->param('biblionumber');
34
my $borrowernumber = $cgi->param('borrowernumber');
35
my $branchcode     = $cgi->param('branchcode');
36
37
my $itemnumber = $cgi->param('itemnumber') || undef;
38
my $title      = $cgi->param('title')      || undef;
39
my $author     = $cgi->param('author')     || undef;
40
my $volume     = $cgi->param('volume')     || undef;
41
my $issue      = $cgi->param('issue')      || undef;
42
my $date       = $cgi->param('date')       || undef;
43
my $pages      = $cgi->param('pages')      || undef;
44
my $chapters   = $cgi->param('chapters')   || undef;
45
46
my $ar = Koha::ArticleRequest->new(
47
    {
48
        borrowernumber => $borrowernumber,
49
        biblionumber   => $biblionumber,
50
        branchcode     => $branchcode,
51
        itemnumber     => $itemnumber,
52
        title          => $title,
53
        author         => $author,
54
        volume         => $volume,
55
        issue          => $issue,
56
        date           => $date,
57
        pages          => $pages,
58
        chapters       => $chapters,
59
    }
60
)->store();
61
62
print $cgi->redirect("/cgi-bin/koha/circ/request-article.pl?biblionumber=$biblionumber");
(-)a/circ/request-article.pl (-8 / +41 lines)
Lines 26-51 use Koha::Biblios; Link Here
26
use Koha::Borrowers;
26
use Koha::Borrowers;
27
use Koha::ArticleRequests;
27
use Koha::ArticleRequests;
28
28
29
my $input = new CGI;
29
my $cgi = new CGI;
30
30
31
my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user(
31
my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user(
32
    {
32
    {
33
        template_name   => "circ/request-article.tt",
33
        template_name   => "circ/request-article.tt",
34
        query           => $input,
34
        query           => $cgi,
35
        type            => "intranet",
35
        type            => "intranet",
36
        authnotrequired => 0,
36
        authnotrequired => 0,
37
        flagsrequired   => { circulate => 'circulate_remaining_permissions' },
37
        flagsrequired   => { circulate => 'circulate_remaining_permissions' },
38
    }
38
    }
39
);
39
);
40
40
41
my $biblionumber      = $input->param('biblionumber');
41
my $action            = $cgi->param('action') || q{};
42
my $patron_cardnumber = $input->param('patron_cardnumber');
42
my $biblionumber      = $cgi->param('biblionumber');
43
my $patron_id         = $input->param('patron_id');
43
my $patron_cardnumber = $cgi->param('patron_cardnumber');
44
my $patron_id         = $cgi->param('patron_id');
44
45
45
my $biblio = Koha::Biblios->find($biblionumber);
46
my $biblio = Koha::Biblios->find($biblionumber);
46
my $patron = Koha::Borrowers->find( $patron_id ? $patron_id : { cardnumber => $patron_cardnumber } );
47
my $patron = Koha::Borrowers->find(
48
    $patron_id ? $patron_id : { cardnumber => $patron_cardnumber } );
47
49
48
if (!$patron && $patron_cardnumber) {
50
if ( $action eq 'create' ) {
51
    my $borrowernumber = $cgi->param('borrowernumber');
52
    my $branchcode     = $cgi->param('branchcode');
53
54
    my $itemnumber = $cgi->param('itemnumber') || undef;
55
    my $title      = $cgi->param('title')      || undef;
56
    my $author     = $cgi->param('author')     || undef;
57
    my $volume     = $cgi->param('volume')     || undef;
58
    my $issue      = $cgi->param('issue')      || undef;
59
    my $date       = $cgi->param('date')       || undef;
60
    my $pages      = $cgi->param('pages')      || undef;
61
    my $chapters   = $cgi->param('chapters')   || undef;
62
63
    my $ar = Koha::ArticleRequest->new(
64
        {
65
            borrowernumber => $borrowernumber,
66
            biblionumber   => $biblionumber,
67
            branchcode     => $branchcode,
68
            itemnumber     => $itemnumber,
69
            title          => $title,
70
            author         => $author,
71
            volume         => $volume,
72
            issue          => $issue,
73
            date           => $date,
74
            pages          => $pages,
75
            chapters       => $chapters,
76
        }
77
    )->store();
78
79
}
80
81
if ( !$patron && $patron_cardnumber ) {
49
    my $results = C4::Utils::DataTables::Members::search(
82
    my $results = C4::Utils::DataTables::Members::search(
50
        {
83
        {
51
            searchmember => $patron_cardnumber,
84
            searchmember => $patron_cardnumber,
Lines 71-74 $template->param( Link Here
71
    patron => $patron,
104
    patron => $patron,
72
);
105
);
73
106
74
output_html_with_http_headers $input, $cookie, $template->output;
107
output_html_with_http_headers $cgi, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/request-article.tt (-1 / +2 lines)
Lines 161-167 $(document).ready(function() { Link Here
161
                    [% ELSE %]
161
                    [% ELSE %]
162
                        [% IF biblio.can_article_request( patron ) %]
162
                        [% IF biblio.can_article_request( patron ) %]
163
163
164
                            <form id="place-article-request" method="post" action="/cgi-bin/koha/circ/request-article-do.pl">
164
                            <form id="place-article-request" method="post" action="/cgi-bin/koha/circ/request-article.pl">
165
                                <input type="hidden" name="action" value="create" />
165
                                <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblio.biblionumber %]" />
166
                                <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblio.biblionumber %]" />
166
                                <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.id %]" />
167
                                <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.id %]" />
167
168
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-request-article.tt (-1 / +2 lines)
Lines 25-31 Link Here
25
25
26
            <h3>Place article request for [% biblio.title %]</h3>
26
            <h3>Place article request for [% biblio.title %]</h3>
27
27
28
            <form id="place-article-request" method="post" action="/cgi-bin/koha/opac-request-article-do.pl">
28
            <form id="place-article-request" method="post" action="/cgi-bin/koha/opac-request-article.pl">
29
                <input type="hidden" name="action" value="create" />
29
                <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblio.biblionumber %]" />
30
                <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblio.biblionumber %]" />
30
31
31
                <fieldset class="rows">
32
                <fieldset class="rows">
(-)a/opac/opac-request-article-do.pl (-62 lines)
Lines 1-62 Link Here
1
#!/usr/bin/perl
2
3
# Copyright ByWater Solutions 2015
4
#
5
# This file is part of Koha.
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
24
use C4::Auth;
25
use C4::Output;
26
27
use Koha::ArticleRequest;
28
29
my $cgi = new CGI;
30
31
my ( $userid, $cookie, $sessionID ) = checkauth( $cgi, 0, {}, 'opac' );
32
my $borrowernumber = C4::Context->userenv->{'number'};
33
34
my $biblionumber = $cgi->param('biblionumber');
35
my $branchcode   = $cgi->param('branchcode');
36
37
my $itemnumber = $cgi->param('itemnumber') || undef;
38
my $title      = $cgi->param('title')      || undef;
39
my $author     = $cgi->param('author')     || undef;
40
my $volume     = $cgi->param('volume')     || undef;
41
my $issue      = $cgi->param('issue')      || undef;
42
my $date       = $cgi->param('date')       || undef;
43
my $pages      = $cgi->param('pages')      || undef;
44
my $chapters   = $cgi->param('chapters')   || undef;
45
46
my $ar = Koha::ArticleRequest->new(
47
    {
48
        borrowernumber => $borrowernumber,
49
        biblionumber   => $biblionumber,
50
        branchcode     => $branchcode,
51
        itemnumber     => $itemnumber,
52
        title          => $title,
53
        author         => $author,
54
        volume         => $volume,
55
        issue          => $issue,
56
        date           => $date,
57
        pages          => $pages,
58
        chapters       => $chapters,
59
    }
60
)->store();
61
62
print $cgi->redirect("/cgi-bin/koha/opac-user.pl#opac-user-article-requests");
(-)a/opac/opac-request-article.pl (-1 / +33 lines)
Lines 39-46 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
39
    }
39
    }
40
);
40
);
41
41
42
my $action = $cgi->param('action') || q{};
42
my $biblionumber = $cgi->param('biblionumber');
43
my $biblionumber = $cgi->param('biblionumber');
43
44
45
if ( $action eq 'create' ) {
46
    my $branchcode = $cgi->param('branchcode');
47
48
    my $itemnumber = $cgi->param('itemnumber') || undef;
49
    my $title      = $cgi->param('title')      || undef;
50
    my $author     = $cgi->param('author')     || undef;
51
    my $volume     = $cgi->param('volume')     || undef;
52
    my $issue      = $cgi->param('issue')      || undef;
53
    my $date       = $cgi->param('date')       || undef;
54
    my $pages      = $cgi->param('pages')      || undef;
55
    my $chapters   = $cgi->param('chapters')   || undef;
56
57
    my $ar = Koha::ArticleRequest->new(
58
        {
59
            borrowernumber => $borrowernumber,
60
            biblionumber   => $biblionumber,
61
            branchcode     => $branchcode,
62
            itemnumber     => $itemnumber,
63
            title          => $title,
64
            author         => $author,
65
            volume         => $volume,
66
            issue          => $issue,
67
            date           => $date,
68
            pages          => $pages,
69
            chapters       => $chapters,
70
        }
71
    )->store();
72
73
    print $cgi->redirect("/cgi-bin/koha/opac-user.pl#opac-user-article-requests");
74
    exit;
75
}
76
44
my $biblio = Koha::Biblios->find($biblionumber);
77
my $biblio = Koha::Biblios->find($biblionumber);
45
my $patron = Koha::Borrowers->find($borrowernumber);
78
my $patron = Koha::Borrowers->find($borrowernumber);
46
79
47
- 

Return to bug 14610