@@ -, +, @@
using the new 'Details' button available on boraccount.pl
---
Koha/Account/Offset.pm | 23 +++++++++++++++++++
.../prog/en/modules/members/boraccount.tt | 26 ++--------------------
t/db_dependent/Accounts.t | 8 ++++++-
3 files changed, 32 insertions(+), 25 deletions(-)
--- a/Koha/Account/Offset.pm
+++ a/Koha/Account/Offset.pm
@@ -20,6 +20,7 @@ use Modern::Perl;
use Carp;
use Koha::Database;
+use Koha::Account::Line;
use base qw(Koha::Object);
@@ -35,6 +36,28 @@ Account offsets are used to track the changes in account lines
=cut
+=head3 debit
+
+=cut
+
+sub debit {
+ my ( $self ) = @_;
+ my $debit_rs = $self->_result->debit;
+ return unless $debit_rs;
+ return Koha::Account::Line->_new_from_dbic( $debit_rs );
+}
+
+=head3 credit
+
+=cut
+
+sub credit {
+ my ( $self ) = @_;
+ my $credit_rs = $self->_result->credit;
+ return unless $credit_rs;
+ return Koha::Account::Line->_new_from_dbic( $credit_rs );
+}
+
=head3 _type
=cut
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt
@@ -55,30 +55,7 @@
[% account.date |$KohaDates %] |
- [% SWITCH account.accounttype %]
- [% CASE 'Pay' %]Payment, thanks
- [% CASE 'Pay00' %]Payment, thanks (cash via SIP2)
- [% CASE 'Pay01' %]Payment, thanks (VISA via SIP2)
- [% CASE 'Pay02' %]Payment, thanks (credit card via SIP2)
- [% CASE 'VOID' %]Payment, Voided
- [% CASE 'N' %]New card
- [% CASE 'F' %]Fine
- [% CASE 'A' %]Account management fee
- [% CASE 'M' %]Sundry
- [% CASE 'L' %]Lost item
- [% CASE 'W' %]Writeoff
- [% CASE 'FU' %]Accruing fine
- [% CASE 'HE' %]Hold waiting too long
- [% CASE 'Rent' %]Rental fee
- [% CASE 'FOR' %]Forgiven
- [% CASE 'LR' %]Lost item fee refund
- [% CASE 'PF' %]Processing fee
- [% CASE 'PAY' %]Payment
- [% CASE 'WO' %]Writeoff
- [% CASE 'C' %]Credit
- [% CASE 'CR' %]Credit
- [% CASE %][% account.accounttype %]
- [%- END -%]
+ [% INCLUDE 'accounttype.inc' accountline => account %]
[%- IF account.payment_type %], [% AuthorisedValues.GetByCode('PAYMENT_TYPE', account.payment_type) %][% END %]
[%- IF account.description %], [% account.description %][% END %]
[% IF ( account.itemnumber ) %][% account.title |html %][% END %] |
@@ -91,6 +68,7 @@
[% ELSE %]
Print
[% END %]
+ Details
[% IF ( reverse_col) %]
[% IF ( account.payment ) %]
Reverse
--- a/t/db_dependent/Accounts.t
+++ a/t/db_dependent/Accounts.t
@@ -632,7 +632,7 @@ subtest "Koha::Account::chargelostitem tests" => sub {
subtest "Koha::Account::Line::void tests" => sub {
- plan tests => 12;
+ plan tests => 14;
# Create a borrower
my $categorycode = $builder->build({ source => 'Category' })->{ categorycode };
@@ -662,6 +662,12 @@ subtest "Koha::Account::Line::void tests" => sub {
amount => 30,
}
);
+
+ # Test debit and credit methods fo Koha::Account::Offset
+ my $account_offset = Koha::Account::Offsets->find( { credit_id => $id, debit_id => $line1->id } );
+ is( $account_offset->debit->id, $line1->id, "Koha::Account::Offset->debit gets correct accountline" );
+ is( $account_offset->credit->id, $id, "Koha::Account::Offset->credit gets correct accountline" );
+
my $account_payment = Koha::Account::Lines->find( $id );
is( $account->balance(), "0.000000", "Account balance is 0" );
--