Lines 28-33
use C4::Log qw( logaction );
Link Here
|
28 |
use C4::Stats qw( UpdateStats ); |
28 |
use C4::Stats qw( UpdateStats ); |
29 |
use C4::Overdues qw(GetFine); |
29 |
use C4::Overdues qw(GetFine); |
30 |
use C4::Context; |
30 |
use C4::Context; |
|
|
31 |
use C4::Circulation; |
31 |
|
32 |
|
32 |
use Koha::Patrons; |
33 |
use Koha::Patrons; |
33 |
use Koha::Account::Credits; |
34 |
use Koha::Account::Credits; |
Lines 509-514
sub add_debit {
Link Here
|
509 |
$schema->txn_do( |
510 |
$schema->txn_do( |
510 |
sub { |
511 |
sub { |
511 |
|
512 |
|
|
|
513 |
my $branch_source = C4::Context->preference('AccountLinesBranchSource'); |
514 |
my $branchcode; |
515 |
|
516 |
if ( $branch_source eq 'patronhomebranch' ) { |
517 |
my $patron = Koha::Patrons->find( $self->{patron_id} ); |
518 |
$branchcode = $patron ? $patron->branchcode : undef; |
519 |
|
520 |
} elsif ( $branch_source eq 'itemhomebranch' && $item_id ) { |
521 |
my $item = Koha::Items->find($item_id); |
522 |
$branchcode = $item ? $item->homebranch : undef; |
523 |
|
524 |
} elsif ( $branch_source eq 'checkoutbranch' && $issue_id ) { |
525 |
my $issue = Koha::Checkouts->find($issue_id); |
526 |
$branchcode = $issue ? $issue->branchcode : undef; |
527 |
|
528 |
} elsif ( $branch_source eq 'circcontrolbranch' && $item_id ) { |
529 |
my $item = Koha::Items->find($item_id); |
530 |
my $patron = Koha::Patrons->find( $self->{patron_id} ); |
531 |
$branchcode = |
532 |
( $item && $patron ) |
533 |
? C4::Circulation::_GetCircControlBranch( $item, $patron ) |
534 |
: undef; |
535 |
} |
536 |
|
512 |
# Insert the account line |
537 |
# Insert the account line |
513 |
$line = Koha::Account::Line->new( |
538 |
$line = Koha::Account::Line->new( |
514 |
{ |
539 |
{ |
Lines 533-539
sub add_debit {
Link Here
|
533 |
? ( old_issue_id => $old_issue_id ) |
558 |
? ( old_issue_id => $old_issue_id ) |
534 |
: () |
559 |
: () |
535 |
), |
560 |
), |
536 |
branchcode => $library_id, |
561 |
branchcode => $branchcode, |
537 |
register_id => $cash_register, |
562 |
register_id => $cash_register, |
538 |
( |
563 |
( |
539 |
$debit_type eq 'OVERDUE' |
564 |
$debit_type eq 'OVERDUE' |
540 |
- |
|
|