Lines 40-45
use Koha::Patron::Categories;
Link Here
|
40 |
|
40 |
|
41 |
my $input=new CGI; |
41 |
my $input=new CGI; |
42 |
my $flagsrequired = { borrowers => 'edit_borrowers' }; |
42 |
my $flagsrequired = { borrowers => 'edit_borrowers' }; |
|
|
43 |
my ( $template, $loggedinuser, $cookie ) = get_template_and_user( |
44 |
{ template_name => "members/maninvoice.tt", |
45 |
query => $input, |
46 |
type => "intranet", |
47 |
authnotrequired => 0, |
48 |
flagsrequired => $flagsrequired, |
49 |
debug => 1, |
50 |
} |
51 |
); |
43 |
|
52 |
|
44 |
my $borrowernumber=$input->param('borrowernumber'); |
53 |
my $borrowernumber=$input->param('borrowernumber'); |
45 |
|
54 |
|
Lines 52-58
unless ( $patron ) {
Link Here
|
52 |
my $add=$input->param('add'); |
61 |
my $add=$input->param('add'); |
53 |
if ($add){ |
62 |
if ($add){ |
54 |
if ( checkauth( $input, 0, $flagsrequired, 'intranet' ) ) { |
63 |
if ( checkauth( $input, 0, $flagsrequired, 'intranet' ) ) { |
55 |
die "Wrong CSRF token" |
64 |
output_and_exit( $input, $cookie, $template, 'wrong_csrf_token' ) |
56 |
unless Koha::Token->new->check_csrf( { |
65 |
unless Koha::Token->new->check_csrf( { |
57 |
session_id => scalar $input->cookie('CGISESSID'), |
66 |
session_id => scalar $input->cookie('CGISESSID'), |
58 |
token => scalar $input->param('csrf_token'), |
67 |
token => scalar $input->param('csrf_token'), |
Lines 71-85
if ($add){
Link Here
|
71 |
my $note = $input->param('note'); |
80 |
my $note = $input->param('note'); |
72 |
my $error = manualinvoice( $borrowernumber, $itemnum, $desc, $type, $amount, $note ); |
81 |
my $error = manualinvoice( $borrowernumber, $itemnum, $desc, $type, $amount, $note ); |
73 |
if ($error) { |
82 |
if ($error) { |
74 |
my ( $template, $loggedinuser, $cookie ) = get_template_and_user( |
|
|
75 |
{ template_name => "members/maninvoice.tt", |
76 |
query => $input, |
77 |
type => "intranet", |
78 |
authnotrequired => 0, |
79 |
flagsrequired => $flagsrequired, |
80 |
debug => 1, |
81 |
} |
82 |
); |
83 |
if ( $error =~ /FOREIGN KEY/ && $error =~ /itemnumber/ ) { |
83 |
if ( $error =~ /FOREIGN KEY/ && $error =~ /itemnumber/ ) { |
84 |
$template->param( 'ITEMNUMBER' => 1 ); |
84 |
$template->param( 'ITEMNUMBER' => 1 ); |
85 |
} |
85 |
} |