From a066d19734fd01a1c7f330d8f480474301602844 Mon Sep 17 00:00:00 2001 From: wajasu Date: Thu, 27 Feb 2014 19:33:36 -0600 Subject: [PATCH 3/3] [PATCH] Bug 11573 - display derived account/fines tab description without changing accountlines Followup patch: After applying patches 24485 and 24486 above, this patch will adjust things so that the fines realated Account and Pay Fines tabs will show a description column that is more concise without the duplicated title problem that this bug attempts to address. This templates have been expanded to handle accounttype codes that I could find mentioned in the existing codebase. In the case of the renewal, where no explicit accounttype code exists as of yet, the template checks for 'enewal' in the accountline.description field and adjusts accordingly. The original code that is building description can be historically preserved (though not shown), and we will just depend on the other columns to formulate a description. A barcode is shown if one exists, alongside the title. The set of accounttype codes handled in the template has been expanded. Unhandled codes will just appear untransformed as it does now. Someone with a long history of fines usage can 'select distinct accounttype from accountlines;' to confirm the set is sufficiently handled in the pay.tt and boraccount.tt templates. The reason for this followup was because the original two patches fixed things by modifying accountlines, but inderectly cause 'Pay fines' tab to have duplicate titles. --- .../prog/en/modules/members/boraccount.tt | 23 +++++++++++++++++----- .../intranet-tmpl/prog/en/modules/members/pay.tt | 17 +++++++++++++--- members/boraccount.pl | 2 ++ members/pay.pl | 5 +++++ 4 files changed, 39 insertions(+), 8 deletions(-) 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 e670478..428f755 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt @@ -48,15 +48,28 @@ [% SWITCH account.accounttype %] [% CASE 'Pay' %]Payment,thanks [% CASE 'N' %]New Card - [% CASE 'F' %]Fine, [% account.title %] - [% CASE 'A' %]Account management fee + [% CASE 'F' %]Fine + [% CASE 'FU' %]Fine Adjusted + [% CASE 'FN' %]Fine + [% CASE 'FFOR' %]Fine Forgiven On Return + [% CASE 'A' %]Account Management Fee [% CASE 'M' %]Sundry - [% CASE 'L' %]Lost + [% CASE 'L' %]Lost Item + [% CASE 'LR' %]Lost & Refunded [% CASE 'W' %]Writeoff + [% CASE 'Rent' %]Rental + [% CASE 'REF' %]Refund Cash + [% CASE 'Rep' %]Replaced + [% CASE 'Res' %]Reserve + [% CASE 'O' %]Overdue [% CASE %][% account.accounttype %] [%- END -%] - [%- IF account.description %], [% account.description %][% END %] -  [% IF ( account.itemnumber ) %]View item [% END %] + [%- IF account.accounttype == 'Rent' AND account.description.match('enewal') %] Renewal[% END %] + [%- IF account.title %] ( [% account.title |html_entity %] + [% IF account.item AND account.item.barcode %] [% account.item.barcode |html_entity %][% END %] ) + [% END %] +  [% IF ( account.itemnumber ) %]View item [% END %] + [% account.note | html_line_break %] [% IF ( account.amountcredit ) %][% ELSE %][% END %][% account.amount %] [% IF ( account.amountoutstandingcredit ) %][% ELSE %][% END %][% account.amountoutstanding %] 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 e584588..24b6b35 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt @@ -119,14 +119,25 @@ function enableCheckboxActions(){ [% CASE 'Pay' %]Payment,thanks [% CASE 'N' %]New Card [% CASE 'F' %]Fine - [% CASE 'A' %]Account management fee + [% CASE 'FU' %]Fine Adjusted + [% CASE 'FN' %]Fine + [% CASE 'FFOR' %]Fine Forgiven On Return + [% CASE 'A' %]Account Management Fee [% CASE 'M' %]Sundry [% CASE 'L' %]Lost Item + [% CASE 'LR' %]Lost & Refunded [% CASE 'W' %]Writeoff + [% CASE 'Rent' %]Rental + [% CASE 'REF' %]Refund Cash + [% CASE 'Rep' %]Replaced + [% CASE 'Res' %]Reserve + [% CASE 'O' %]Overdue [% CASE %][% line.accounttype %] [%- END -%] - [%- IF line.description %], [% line.description %][% END %] - [% IF line.title %]([% line.title |html_entity %])[% END %] + [%- IF line.accounttype == 'Rent' AND line.description.match('enewal') %] Renewal[% END %] + [%- IF line.title %] ( [% line.title |html_entity %] + [% IF line.item AND line.item.barcode %] [% line.item.barcode |html_entity %] [% END %]) + [% END %] [% line.accounttype %] diff --git a/members/boraccount.pl b/members/boraccount.pl index 255b1ff..da42603 100755 --- a/members/boraccount.pl +++ b/members/boraccount.pl @@ -32,6 +32,7 @@ use CGI; use C4::Members; use C4::Branch; use C4::Accounts; +use C4::Biblio; use C4::Members::Attributes qw(GetBorrowerAttributes); my $input=new CGI; @@ -88,6 +89,7 @@ foreach my $accountline ( @{$accts}) { $accountline->{payment} = 1; $reverse_col = 1; } + $accountline->{item} = GetBiblioFromItemNumber($accountline->{itemnumber}); } $template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' ); diff --git a/members/pay.pl b/members/pay.pl index 8a8e902..fb66ea7 100755 --- a/members/pay.pl +++ b/members/pay.pl @@ -40,6 +40,7 @@ use C4::Stats; use C4::Koha; use C4::Overdues; use C4::Branch; +use C4::Biblio; use C4::Members::Attributes qw(GetBorrowerAttributes); our $input = CGI->new; @@ -123,6 +124,10 @@ sub add_accounts_to_template { GetBorNotifyAcctRecord( $borrowernumber, $notify_id ); if ( @{$accountlines} ) { my $totalnotify = AmountNotify( $notify_id, $borrowernumber ); + foreach my $accountline (@{$accountlines}) { + my $item = GetBiblioFromItemNumber($accountline->{itemnumber}); + $accountline->{item} = $item; + } push @{$accounts}, { accountlines => $accountlines, notify => $notify_id, -- 1.8.5.3