Bug 22066: Record library_id for manual credits

On creating manual credits, the (newly introduced) branchcode should be
set now. This trivial patch makes it work.

To test:
- Create a manual credit for a known patron
- Using MySQL check the result:
  $ sudo mysql
  > SELECT * FROM accountlines WHERE borrowernumber=<known_id>;
=> FAIL: The created accountline row has NULL for the branchcode
- Apply this patch
- Create a manual credit for the patron
- Run:
  > SELECT * FROM accountlines WHERE borrowernumber=<known_id>;
=> SUCCESS: branchcode is set correctly
-Sign off :-D

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Tomas Cohen Arazi 2019-01-07 14:06:01 -03:00 committed by Nick Clemens
parent 63f897c06e
commit 094a1cb070
1 changed files with 3 additions and 0 deletions

View File

@ -81,10 +81,13 @@ if ($add){
my $amount = $input->param('amount') || 0;
my $type = $input->param('type');
my $library_id = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef;
$patron->account->add_credit({
amount => $amount,
description => $description,
item_id => $item_id,
library_id => $library_id,
note => $note,
type => $type,
user_id => $logged_in_user->id