- my $desc = $input->param('desc');
- my $note = $input->param('note');
- my $amount = $input->param('amount') || 0;
- $amount = -$amount;
- my $type = $input->param('type');
- manualinvoice( $borrowernumber, $itemnum, $desc, $type, $amount, $note );
+ my $description = $input->param('desc');
+ my $note = $input->param('note');
+ my $amount = $input->param('amount') || 0;
+ my $type = $input->param('type');
+
+ Koha::Account->new({ patron_id => $borrowernumber })->add_credit({
+ amount => $amount,
+ description => $description,
+ item_id => $item_id,
+ note => $note,
+ type => $type,
+ user_id => $user_id
+ });
+