use Koha::Account::Lines;
use Koha::Account::Offsets;
use Koha::DateUtils qw( dt_from_string );
+use Koha::Exceptions;
use Koha::Exceptions::Account;
=head1 NAME
my $patron = Koha::Patrons->find( $self->{patron_id} );
my $manager_id = $userenv ? $userenv->{number} : 0;
+ my $interface = $params ? ( $params->{interface} || C4::Context->interface ) : C4::Context->interface;
my @fines_paid; # List of account lines paid on with this payment
$fine->amountoutstanding($new_amountoutstanding)->store();
$balance_remaining = $balance_remaining - $amount_to_pay;
- if ( $fine->itemnumber && $fine->accounttype && ( $fine->accounttype eq 'Rep' || $fine->accounttype eq 'L' ) )
+ if ( $fine->itemnumber && $fine->accounttype && ( $fine->accounttype eq 'L' ) )
{
C4::Circulation::ReturnLostItem( $self->{patron_id}, $fine->itemnumber );
}
manager_id => $manager_id,
note => $note,
}
- )
+ ),
+ $interface
);
push( @fines_paid, $fine->id );
}
manager_id => $manager_id,
note => $note,
}
- )
+ ),
+ $interface
);
push( @fines_paid, $fine->id );
}
payment_type => $payment_type,
amountoutstanding => 0 - $balance_remaining,
manager_id => $manager_id,
+ interface => $interface,
branchcode => $library_id,
note => $note,
}
accountlines_paid => \@fines_paid,
manager_id => $manager_id,
}
- )
+ ),
+ $interface
);
}
description => $description,
note => $note,
user_id => $user_id,
+ interface => $interface,
library_id => $library_id,
sip => $sip,
payment_type => $payment_type,
my $description = $params->{description} // q{};
my $note = $params->{note} // q{};
my $user_id = $params->{user_id};
+ my $interface = $params->{interface};
my $library_id = $params->{library_id};
my $sip = $params->{sip};
my $payment_type = $params->{payment_type};
my $type = $params->{type} || 'payment';
my $item_id = $params->{item_id};
+ unless ( $interface ) {
+ Koha::Exceptions::MissingParameter->throw(
+ error => 'The interface parameter is mandatory'
+ );
+ }
+
my $schema = Koha::Database->new->schema;
my $account_type = $Koha::Account::account_type_credit->{$type};
payment_type => $payment_type,
note => $note,
manager_id => $user_id,
+ interface => $interface,
branchcode => $library_id,
itemnumber => $item_id,
}
manager_id => $user_id,
branchcode => $library_id,
}
- )
+ ),
+ $interface
);
}
}
description => $description,
note => $note,
user_id => $user_id,
+ interface => $interface,
library_id => $library_id,
type => $debit_type,
item_id => $item_id,
);
$debit_type can be any of:
- - fine
+ - overdue
- lost_item
- new_card
- account
my $description = $params->{description} // q{};
my $note = $params->{note} // q{};
my $user_id = $params->{user_id};
+ my $interface = $params->{interface};
my $library_id = $params->{library_id};
my $type = $params->{type};
my $item_id = $params->{item_id};
my $issue_id = $params->{issue_id};
+ unless ( $interface ) {
+ Koha::Exceptions::MissingParameter->throw(
+ error => 'The interface parameter is mandatory'
+ );
+ }
+
my $schema = Koha::Database->new->schema;
unless ( exists($Koha::Account::account_type_debit->{$type}) ) {
payment_type => undef,
note => $note,
manager_id => $user_id,
+ interface => $interface,
itemnumber => $item_id,
issue_id => $issue_id,
branchcode => $library_id,
+ ( $type eq 'overdue' ? ( status => 'UNRETURNED' ) : ()),
}
)->store();
itemnumber => $item_id,
manager_id => $user_id,
}
- )
+ ),
+ $interface
);
}
}
'processing' => 'Processing Fee',
'lost_item' => 'Lost Item',
'rent' => 'Rental Fee',
- 'fine' => 'Fine',
+ 'overdue' => 'OVERDUE',
'manual_debit' => 'Manual Debit',
'hold_expired' => 'Hold Expired'
};
our $account_type_debit = {
'account' => 'A',
- 'fine' => 'FU',
+ 'overdue' => 'OVERDUE',
'lost_item' => 'L',
'new_card' => 'N',
'sundry' => 'M',