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; |