Fix for bug 1313, silent failure when entering manual invoice with invalid
itemnumber
This commit is contained in:
parent
644e340fdb
commit
bf7eaca974
3 changed files with 30 additions and 7 deletions
|
@ -314,8 +314,7 @@ sub manualinvoice{
|
|||
my $sth=$dbh->prepare("INSERT INTO accountlines
|
||||
(borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding, itemnumber,notify_id)
|
||||
VALUES (?, ?, now(), ?,?, ?,?,?,?)");
|
||||
# $sth->execute($borrowernumber, $accountno, $amount, $desc, $type, $amountleft, $data->{'itemnumber'});
|
||||
$sth->execute($borrowernumber, $accountno, $amount, $desc, $type, $amountleft, $itemnum,$notifyid);
|
||||
$sth->execute($borrowernumber, $accountno, $amount, $desc, $type, $amountleft, $itemnum,$notifyid) || return $sth->errstr;
|
||||
} else {
|
||||
my $sth=$dbh->prepare("INSERT INTO accountlines
|
||||
(borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding,notify_id)
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
|
||||
<title>Koha › Patrons › Create Manual Invoice</title>
|
||||
<title>Koha › Borrowers › Create Manual Invoice</title>
|
||||
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
|
||||
|
||||
<!-- TMPL_INCLUDE NAME="menus.inc" -->
|
||||
<!-- TMPL_INCLUDE NAME="menu-members.inc" -->
|
||||
|
||||
|
||||
<!-- TMPL_IF NAME="ERROR" -->
|
||||
<!-- TMPL_IF NAME="ITEMNUMBER" -->
|
||||
ERROR an invalid itemnumber was entered, please hit back and try again
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- TMPL_ELSE -->
|
||||
<form action="/cgi-bin/koha/members/maninvoice.pl" method="post"><input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR Name="borrowernumber" -->" />
|
||||
<table>
|
||||
<caption>Manual Invoice</caption>
|
||||
|
@ -27,7 +31,7 @@
|
|||
|
||||
<form action="/cgi-bin/koha/members/boraccount.pl" method="get"><input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR Name="borrowernumber" -->" /><input type="submit" value="Cancel" /></form>
|
||||
|
||||
|
||||
<!-- /TMPL_IF -->
|
||||
|
||||
|
||||
<!-- TMPL_INCLUDE Name="intranet-bottom.inc" -->
|
||||
|
|
|
@ -42,8 +42,28 @@ if ($add){
|
|||
my $desc=$input->param('desc');
|
||||
my $amount=$input->param('amount');
|
||||
my $type=$input->param('type');
|
||||
manualinvoice($borrowernumber,$itemnum,$desc,$type,$amount);
|
||||
print $input->redirect("/cgi-bin/koha/members/boraccount.pl?borrowernumber=$borrowernumber");
|
||||
my $error=manualinvoice($borrowernumber,$itemnum,$desc,$type,$amount);
|
||||
if ($error){
|
||||
my ($template, $loggedinuser, $cookie)
|
||||
= get_template_and_user({template_name => "members/maninvoice.tmpl",
|
||||
query => $input,
|
||||
type => "intranet",
|
||||
authnotrequired => 0,
|
||||
flagsrequired => {borrowers => 1},
|
||||
debug => 1,
|
||||
});
|
||||
if ($error =~ /FOREIGN KEY/ && $error =~ /itemnumber/){
|
||||
$template->param('ITEMNUMBER' => 1);
|
||||
}
|
||||
$template->param('ERROR' => $error);
|
||||
print $input->header(
|
||||
-type => 'utf-8',
|
||||
-cookie => $cookie
|
||||
),$template->output;
|
||||
}
|
||||
else {
|
||||
print $input->redirect("/cgi-bin/koha/members/boraccount.pl?borrowernumber=$borrowernumber");
|
||||
}
|
||||
} else {
|
||||
my ($template, $loggedinuser, $cookie)
|
||||
= get_template_and_user({template_name => "members/maninvoice.tmpl",
|
||||
|
|
Loading…
Reference in a new issue