|
Lines 80-88
if ($add){
Link Here
|
| 80 |
my $amount=$input->param('amount'); |
80 |
my $amount=$input->param('amount'); |
| 81 |
my $type=$input->param('type'); |
81 |
my $type=$input->param('type'); |
| 82 |
my $note = $input->param('note'); |
82 |
my $note = $input->param('note'); |
|
|
83 |
my $account = $patron->account; |
| 83 |
try { |
84 |
try { |
| 84 |
my $account = $patron->account; |
85 |
$account->add_debit( |
| 85 |
my $invoice = $account->add_debit( |
|
|
| 86 |
{ |
86 |
{ |
| 87 |
amount => $amount, |
87 |
amount => $amount, |
| 88 |
item_id => $itemnum, |
88 |
item_id => $itemnum, |
|
Lines 93-109
if ($add){
Link Here
|
| 93 |
); |
93 |
); |
| 94 |
|
94 |
|
| 95 |
if ( C4::Context->preference('AccountAutoReconcile') ) { |
95 |
if ( C4::Context->preference('AccountAutoReconcile') ) { |
| 96 |
$patron->account->reconcile_balance; |
96 |
$account->reconcile_balance; |
| 97 |
} |
97 |
} |
| 98 |
} |
98 |
} |
| 99 |
catch { |
99 |
catch { |
| 100 |
if ( $_->isa('Koha::Exceptions::Object::FKConstraint') $error =~ /FOREIGN KEY/ && $error =~ /itemnumber/ ) { |
100 |
if ( $_->isa('Koha::Exceptions::Object::FKConstraint') && $_->error =~ /FOREIGN KEY/ && $_->error =~ /itemnumber/ ) { |
| 101 |
$template->param( 'ITEMNUMBER' => 1 ) if ($_->broken_fk eq 'itemnumber'); |
101 |
$template->param( 'ITEMNUMBER' => 1 ) if ($_->broken_fk eq 'itemnumber'); |
| 102 |
$template->param( 'ERROR' => $_->message ); |
102 |
$template->param( 'ERROR' => $_->message ); |
| 103 |
} |
103 |
} |
| 104 |
$template->param( csrf_token => Koha::Token->new->generate_csrf({ session_id => scalar $input->cookie('CGISESSID') }) ); |
104 |
$template->param( csrf_token => Koha::Token->new->generate_csrf({ session_id => scalar $input->cookie('CGISESSID') }) ); |
| 105 |
output_html_with_http_headers $input, $cookie, $template->output; |
105 |
output_html_with_http_headers $input, $cookie, $template->output; |
| 106 |
}; |
106 |
} |
| 107 |
|
107 |
|
| 108 |
print $input->redirect("/cgi-bin/koha/members/boraccount.pl?borrowernumber=$borrowernumber"); |
108 |
print $input->redirect("/cgi-bin/koha/members/boraccount.pl?borrowernumber=$borrowernumber"); |
| 109 |
exit; |
109 |
exit; |
| 110 |
- |
|
|