Bugzilla – Attachment 82520 Details for
Bug 19489
Detailed description of charges on Accounting tab
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19489 - (Object Method) Development for fines and Fees Module - Detailed Description of charges in Patron Account Tab/Fines Tab
Bug-19489---Object-Method-Development-for-fines-an.patch (text/plain), 16.07 KB, created by
Devinim
on 2018-11-19 17:02:07 UTC
(
hide
)
Description:
Bug 19489 - (Object Method) Development for fines and Fees Module - Detailed Description of charges in Patron Account Tab/Fines Tab
Filename:
MIME Type:
Creator:
Devinim
Created:
2018-11-19 17:02:07 UTC
Size:
16.07 KB
patch
obsolete
>From aa119dfa4bedd8cc82f80ffd1765a20b2ab70b65 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Nazl=C4=B1=20=C3=87etin?= <nazli@devinim.com.tr> >Date: Mon, 19 Nov 2018 17:00:12 +0000 >Subject: [PATCH] Bug 19489 - (Object Method) Development for fines and Fees > 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(-) > >diff --git a/Koha/Account/Line.pm b/Koha/Account/Line.pm >index 3573e604e6..5150fa5139 100644 >--- a/Koha/Account/Line.pm >+++ b/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(); >diff --git a/admin/columns_settings.yml b/admin/columns_settings.yml >index eacc02bdd8..a392d55859 100644 >--- a/admin/columns_settings.yml >+++ b/admin/columns_settings.yml >@@ -305,6 +305,12 @@ modules: > - > columnname: description > - >+ columnname: barcode >+ - >+ columnname: date_due >+ - >+ columnname: returndate >+ - > columnname: note > - > columnname: amount >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/accountline-details.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/accountline-details.tt >index ae66f7ed52..d1df40713e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/accountline-details.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/accountline-details.tt >@@ -31,6 +31,9 @@ > <tr> > <th class="title-string">Date</th> > <th>Description of charges</th> >+ <th>Barcode</th> >+ <th>Due date</th> >+ <th>Return date</th> > <th>Note</th> > <th>Amount</th> > <th>Outstanding</th> >@@ -59,6 +62,21 @@ > </td> > > <td> >+ [% IF ( accountline.itemnumber ) %] >+ <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% accountline.item.biblionumber | uri %]&itemnumber=[% accountline.itemnumber | uri %]#item[% accountline.itemnumber | uri %]">[% accountline.item.barcode | html %]</a> >+ [% END %] >+ </td> >+ <td> >+ [% IF ( accountline.issue_id ) %] >+ [% accountline.issue.date_due | $KohaDates with_hours => 1 | html %] >+ [% END %] >+ </td> >+ <td> >+ [% IF ( accountline.issue_id ) %] >+ [% accountline.issue.returndate | $KohaDates with_hours => 1 | html %] >+ [% END %] >+ </td> >+ <td> > [% accountline.note | html_line_break %] > </td> > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt >index e9680a5c55..c1ac655667 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt >@@ -46,6 +46,9 @@ > <tr> > <th class="title-string">Date</th> > <th>Description of charges</th> >+ <th>Barcode</th> >+ <th>Due date</th> >+ <th>Return date</th> > <th>Home library</th> > <th>Note</th> > <th>Amount</th> >@@ -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 ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% account.item.biblionumber | uri %]&itemnumber=[% account.itemnumber | uri %]">[% account.item.biblio.title | html %]</a>[% END %]</td> >+ <td>[% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% account.itemnumber | uri %]&biblionumber=[% account.item.biblionumber | uri %]#item[% account.itemnumber | uri %]">[% account.item.barcode | html %]</a>[% END %]</td> >+ <td>[% IF ( account.issue_id ) %][% account.issue.date_due | $KohaDates with_hours => 1 | html %][% END %]</td> >+ <td>[% IF ( account.issue_id ) %][% account.issue.returndate | $KohaDates with_hours => 1 | html %][% END %]</td> > <td>[% IF account.itemnumber %][% Branches.GetName( account.item.homebranch ) | html %][% END %]</td> > <td>[% account.note | html_line_break %]</td> > [% IF account.amount <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amount | $Price %]</td> >@@ -84,7 +90,7 @@ > [% END %] > <tfoot> > <tr> >- <td colspan="5">Total due</td> >+ <td colspan="8">Total due</td> > [% IF ( totalcredit ) %] > <td class="credit" style="text-align: right;">[% total | $Price %]</td> > [% ELSE %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt >index cb49492a94..636964691d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt >+++ b/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 @@ > <th> </th> > <th>Fines & charges</th> > <th>Description</th> >+ <th>Barcode</th> >+ <th>Due date</th> >+ <th>Return date</th> > <th>Payment note</th> > <th>Account type</th> > <th>Amount</th> >@@ -51,7 +55,7 @@ > </thead> > <tfoot> > <tr> >- <td class="total" colspan="6">Total due:</td> >+ <td class="total" colspan="9">Total due:</td> > <td style="text-align: right;">[% total | $Price %]</td> > </tr> > </tfoot> >@@ -70,6 +74,9 @@ > [% END %] > <input type="hidden" name="itemnumber[% line.accountlines_id | html %]" value="[% line.itemnumber | html %]" /> > <input type="hidden" name="description[% line.accountlines_id | html %]" value="[% line.description | html %]" /> >+ <input type="hidden" name="barcode[% line.accountlines_id | html %]" value="[% line.item.barcode | html %]" /> >+ <input type="hidden" name="date_due[% line.accountlines_id | html %]" value="[% line.issue.date_due | html %]" /> >+ <input type="hidden" name="returndate[% line.accountlines_id | html %]" value="[% line.issue.returndate | html %]" /> > <input type="hidden" name="accounttype[% line.accountlines_id | html %]" value="[% line.accounttype | html %]" /> > <input type="hidden" name="amount[% line.accountlines_id | html %]" value="[% line.amount | html %]" /> > <input type="hidden" name="accountlines_id[% line.accountlines_id | html %]" value="[% line.accountlines_id | html %]" /> >@@ -103,6 +110,21 @@ > [%- IF line.description %], [% line.description | html %][% END %] > [% IF line.title %]([% line.title | html %])[% END %] > </td> >+ <td> >+ [% IF line.itemnumber %] >+ <a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% line.itemnumber | uri %]&biblionumber=[% line.biblionumber | uri %]#item[% line.itemnumber | uri %]">[% line.item.barcode | html %]</a> >+ [% END %] >+ </td> >+ <td> >+ [% IF line.issue_id %] >+ [% line.issue.date_due | $KohaDates with_hours => 1 | html %] >+ [% END %] >+ </td> >+ <td> >+ [% IF line.issue_id %] >+ [% line.issue.returndate | $KohaDates with_hours => 1 | html %] >+ [% END %] >+ </td> > <td><input type="text" name="payment_note_[% line.accountlines_id | html %]" /></td> > <td>[% line.accounttype | html %]</td> > <td class="debit" style="text-align: right;">[% line.amount | $Price %]</td> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/printinvoice.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/printinvoice.tt >index a28ac03e34..1e28356c48 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/printinvoice.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/printinvoice.tt >@@ -21,23 +21,23 @@ > <table> > [% IF ( LibraryName ) %] > <tr> >- <th colspan="5" class="centerednames"> >+ <th colspan="8" class="centerednames"> > <h3>[% LibraryName | html %]</h3> > </th> > </tr> > [% END %] > <tr> >- <th colspan="5" class="centerednames"> >+ <th colspan="8" class="centerednames"> > <h2><u>INVOICE</u></h2> > </th> > </tr> > <tr> >- <th colspan="5" class="centerednames"> >+ <th colspan="8" class="centerednames"> > <h2>[% Branches.GetName( patron.branchcode ) | html %]</h2> > </th> > </tr> > <tr> >- <th colspan="5" > >+ <th colspan="8" > > Bill to: [% patron.firstname | html %] [% patron.surname | html %] <br /> > Card number: [% patron.cardnumber | html %]<br /> > </th> >@@ -45,6 +45,9 @@ > <tr> > <th>Date</th> > <th>Description of charges</th> >+ <th>Barcode</th> >+ <th>Due date</th> >+ <th>Return date</th> > <th>Note</th> > <th style="text-align:right;">Amount</th> > <th style="text-align:right;">Amount outstanding</th> >@@ -57,6 +60,9 @@ > [% PROCESS account_type_description account=account %] > [%- IF account.description %], [% account.description | html %][% END %] > </td> >+ <td>[% account.item.barcode | html %]</td> >+ <td>[% account.issue.date_due | $KohaDates with_hours => 1 | html %]</td> >+ <td>[% account.issue.returndate | $KohaDates with_hours => 1 | html %]</td> > <td>[% account.note | html %]</td> > [% IF ( account.amountcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% account.amount | $Price %]</td> > [% IF ( account.amountoutstandingcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% account.amountoutstanding | $Price %]</td> >@@ -65,7 +71,7 @@ > [% END %] > <tfoot> > <tr> >- <td colspan="4">Total outstanding dues as on date: </td> >+ <td colspan="7">Total outstanding dues as on date: </td> > [% IF ( totalcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% total | $Price %]</td> > </tr> > </tfoot> >diff --git a/members/pay.pl b/members/pay.pl >index b2216aa511..0cf13ba08e 100755 >--- a/members/pay.pl >+++ b/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 ); >diff --git a/members/printinvoice.pl b/members/printinvoice.pl >index a6d92f7e3a..25b3d7e026 100755 >--- a/members/printinvoice.pl >+++ b/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 ) { >diff --git a/t/db_dependent/Koha/Account/Lines.t b/t/db_dependent/Koha/Account/Lines.t >index eb8dfdd1c0..ee6228f6a3 100755 >--- a/t/db_dependent/Koha/Account/Lines.t >+++ b/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; >+}; >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 19489
:
81956
|
81989
|
81991
|
82519
|
82520
|
82614
|
82615
|
82846
|
83109
|
83110
|
83242
|
83276
|
83277
|
83299
|
83300
|
83301
|
83618
|
83619
|
83620
|
85236
|
85237
|
85275
|
85315
|
85668
|
85669
|
85670
|
85671
|
85672
|
85673
|
85674
|
85675
|
85731
|
85732
|
85733
|
85734
|
85735
|
85736
|
85737
|
85738