@@ -, +, @@
Module - Detailed Description of charges in Patron Account Tab/Fines Tab
---
Koha/Account/Line.pm | 14 ++++++
admin/columns_settings.yml | 6 +++
.../prog/en/modules/members/accountline-details.tt | 18 ++++++++
.../prog/en/modules/members/boraccount.tt | 8 +++-
.../intranet-tmpl/prog/en/modules/members/pay.tt | 24 +++++++++-
.../prog/en/modules/members/printinvoice.tt | 16 +++++--
members/pay.pl | 13 ++++--
members/printinvoice.pl | 5 +-
t/db_dependent/Koha/Account/Lines.t | 54 +++++++++++++++++++++-
9 files changed, 146 insertions(+), 12 deletions(-)
--- a/Koha/Account/Line.pm
+++ a/Koha/Account/Line.pm
@@ -51,6 +51,20 @@ sub item {
return Koha::Item->_new_from_dbic( $rs );
}
+=head3 issue
+
+Return the issue linked to this account line if exists
+
+=cut
+
+sub issue {
+ my ( $self ) = @_;
+ my $rs = $self->_result->issue_id;
+ my $issue = Koha::Checkouts->find( $rs );
+ $issue = Koha::Old::Checkouts->find( $rs ) unless $issue;
+ return $issue;
+}
+
=head3 void
$payment_accountline->void();
--- a/admin/columns_settings.yml
+++ a/admin/columns_settings.yml
@@ -305,6 +305,12 @@ modules:
-
columnname: description
-
+ columnname: barcode
+ -
+ columnname: date_due
+ -
+ columnname: returndate
+ -
columnname: note
-
columnname: amount
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/accountline-details.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/accountline-details.tt
@@ -31,6 +31,9 @@
Date
Description of charges
+ Barcode
+ Due date
+ Return date
Note
Amount
Outstanding
@@ -59,6 +62,21 @@
+ [% IF ( accountline.itemnumber ) %]
+ [% accountline.item.barcode | html %]
+ [% END %]
+
+
+ [% IF ( accountline.issue_id ) %]
+ [% accountline.issue.date_due | $KohaDates with_hours => 1 | html %]
+ [% END %]
+
+
+ [% IF ( accountline.issue_id ) %]
+ [% accountline.issue.returndate | $KohaDates with_hours => 1 | html %]
+ [% END %]
+
+
[% accountline.note | html_line_break %]
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt
@@ -46,6 +46,9 @@
Date
Description of charges
+ Barcode
+ Due date
+ Return date
Home library
Note
Amount
@@ -64,6 +67,9 @@
[%- IF account.payment_type %], [% AuthorisedValues.GetByCode('PAYMENT_TYPE', account.payment_type) | html %][% END %]
[%- IF account.description %], [% account.description | html %][% END %]
[% IF ( account.itemnumber ) %][% account.item.biblio.title | html %] [% END %]
+ [% IF ( account.itemnumber ) %][% account.item.barcode | html %] [% END %]
+ [% IF ( account.issue_id ) %][% account.issue.date_due | $KohaDates with_hours => 1 | html %][% END %]
+ [% IF ( account.issue_id ) %][% account.issue.returndate | $KohaDates with_hours => 1 | html %][% END %]
[% IF account.itemnumber %][% Branches.GetName( account.item.homebranch ) | html %][% END %]
[% account.note | html_line_break %]
[% IF account.amount <= 0 %][% ELSE %] [% END %][% account.amount | $Price %]
@@ -84,7 +90,7 @@
[% END %]
- Total due
+ Total due
[% IF ( totalcredit ) %]
[% total | $Price %]
[% ELSE %]
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt
@@ -1,6 +1,7 @@
[% USE raw %]
[% USE Asset %]
[% USE Koha %]
+[% USE KohaDates %]
[% USE AuthorisedValues %]
[% USE Branches %]
[% USE Price %]
@@ -43,6 +44,9 @@
Fines & charges
Description
+ Barcode
+ Due date
+ Return date
Payment note
Account type
Amount
@@ -51,7 +55,7 @@
- Total due:
+ Total due:
[% total | $Price %]
@@ -70,6 +74,9 @@
[% END %]
+
+
+
@@ -103,6 +110,21 @@
[%- IF line.description %], [% line.description | html %][% END %]
[% IF line.title %]([% line.title | html %])[% END %]
+
+ [% IF line.itemnumber %]
+ [% line.item.barcode | html %]
+ [% END %]
+
+
+ [% IF line.issue_id %]
+ [% line.issue.date_due | $KohaDates with_hours => 1 | html %]
+ [% END %]
+
+
+ [% IF line.issue_id %]
+ [% line.issue.returndate | $KohaDates with_hours => 1 | html %]
+ [% END %]
+
[% line.accounttype | html %]
[% line.amount | $Price %]
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/printinvoice.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/printinvoice.tt
@@ -21,23 +21,23 @@
[% IF ( LibraryName ) %]
-
+
[% LibraryName | html %]
[% END %]
-
+
INVOICE
-
+
[% Branches.GetName( patron.branchcode ) | html %]
-
+
Bill to: [% patron.firstname | html %] [% patron.surname | html %]
Card number: [% patron.cardnumber | html %]
@@ -45,6 +45,9 @@
Date
Description of charges
+ Barcode
+ Due date
+ Return date
Note
Amount
Amount outstanding
@@ -57,6 +60,9 @@
[% PROCESS account_type_description account=account %]
[%- IF account.description %], [% account.description | html %][% END %]
+ [% account.item.barcode | html %]
+ [% account.issue.date_due | $KohaDates with_hours => 1 | html %]
+ [% account.issue.returndate | $KohaDates with_hours => 1 | html %]
[% account.note | html %]
[% IF ( account.amountcredit ) %][% ELSE %] [% END %][% account.amount | $Price %]
[% IF ( account.amountoutstandingcredit ) %][% ELSE %] [% END %][% account.amountoutstanding | $Price %]
@@ -65,7 +71,7 @@
[% END %]
- Total outstanding dues as on date:
+ Total outstanding dues as on date:
[% IF ( totalcredit ) %][% ELSE %] [% END %][% total | $Price %]
--- a/members/pay.pl
+++ a/members/pay.pl
@@ -141,13 +141,17 @@ sub add_accounts_to_template {
my $account_lines = $patron->account->outstanding_debits;
my $total = $account_lines->total_outstanding;
my @accounts;
- while ( my $account_line = $account_lines->next ) {
- $account_line = $account_line->unblessed;
+ while ( my $account_line_object = $account_lines->next ) {
+ my $account_line = $account_line_object->unblessed;
if ( $account_line->{itemnumber} ) {
- my $item = Koha::Items->find( $account_line->{itemnumber} );
+ my $item = $account_line_object->item;
my $biblio = $item->biblio;
$account_line->{biblionumber} = $biblio->biblionumber;
$account_line->{title} = $biblio->title;
+ $account_line->{item} = $item;
+ }
+ if ( $account_line->{issue_id} ) {
+ $account_line->{issue} = $account_line_object->issue;
}
push @accounts, $account_line;
}
@@ -191,6 +195,9 @@ sub redirect_to_paycollect {
$redirect .=
get_for_redirect( 'amountoutstanding', "amountoutstanding$line_no", 1 );
$redirect .= get_for_redirect( 'description', "description$line_no", 0 );
+ $redirect .= get_for_redirect( 'barcode', "barcode$line_no", 0 );
+ $redirect .= get_for_redirect( 'date_due', "date_due$line_no", 0 );
+ $redirect .= get_for_redirect( 'returndate', "returndate$line_no", 0 );
$redirect .= get_for_redirect( 'title', "title$line_no", 0 );
$redirect .= get_for_redirect( 'itemnumber', "itemnumber$line_no", 0 );
$redirect .= get_for_redirect( 'accountlines_id', "accountlines_id$line_no", 0 );
--- a/members/printinvoice.pl
+++ a/members/printinvoice.pl
@@ -55,7 +55,10 @@ output_and_exit_if_error( $input, $cookie, $template, { module => 'members', log
#get account details
my $total = $patron->account->balance;
-my $accountline = Koha::Account::Lines->find($accountlines_id)->unblessed;
+my $accountline_object = Koha::Account::Lines->find($accountlines_id);
+my $accountline = $accountline_object->unblessed;
+$accountline->{'item'} = $accountline->{itemnumber} ? $accountline_object->item : "" ;
+$accountline->{'issue'} = $accountline->{issue_id} ? $accountline_object->issue : "" ;
my $totalcredit;
if ( $total <= 0 ) {
--- a/t/db_dependent/Koha/Account/Lines.t
+++ a/t/db_dependent/Koha/Account/Lines.t
@@ -19,7 +19,7 @@
use Modern::Perl;
-use Test::More tests => 4;
+use Test::More tests => 5;
use Test::Exception;
use Koha::Account;
@@ -268,3 +268,55 @@ subtest 'apply() tests' => sub {
$schema->storage->txn_rollback;
};
+
+subtest 'issue() tests' => sub {
+
+ plan tests => 5;
+
+ $schema->storage->txn_begin;
+
+ my $library = $builder->build( { source => 'Branch' } );
+ my $biblioitem = $builder->build( { source => 'Biblioitem' } );
+ my $categorycode = $builder->build({ source => 'Category' })->{ categorycode };
+ my $patron = Koha::Patron->new( {
+ cardnumber => 'kohadevinim',
+ surname => 'CETIN',
+ firstname => 'Nazli',
+ branchcode => $library->{branchcode},
+ categorycode => $categorycode
+ } )->store;
+
+ my $item = $builder->build( { source => 'Item' } );
+
+ my $checkout = Koha::Checkout->new(
+ { borrowernumber => $patron->borrowernumber,
+ itemnumber => $item->{itemnumber},
+ branchcode => $library->{branchcode},
+ })->store;
+
+ my $line = Koha::Account::Line->new(
+ {
+ borrowernumber => $patron->borrowernumber,
+ itemnumber => $item->{itemnumber},
+ issue_id => $checkout->issue_id,
+ accounttype => "F",
+ amount => 10,
+ })->store;
+
+ my $line_issue = $line->issue;
+
+ is( $line_issue->issue_id, $checkout->issue_id, 'Koha::Account::Line->issue should return the correct issue' );
+
+ my ( $returned, undef, $old_checkout) = C4::Circulation::AddReturn( $item->{barcode} ,$library->{branchcode} );
+
+ is( $returned, 1, 'The item should have been returned' );
+
+ my $old_line = Koha::Account::Lines->find( $line->id );
+ my $old_line_issue = $old_line->issue;
+
+ is( $old_checkout->issue_id, $old_line_issue->issue_id, 'Koha::Account::Line->issue should return the correct old_issue' );
+ is( $old_line_issue->issue_id, $old_line->issue_id, 'Koha::Account::Line->issue should return the correct old_issue' );
+ is( $old_checkout->issue_id, $old_line->issue_id, 'Koha::Account::Line->issue should return the correct old_issue' );
+
+ $schema->storage->txn_rollback;
+};
--