From 94bbbe85a6ce344b2f8e9278a28fff0ec997b503 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 14 May 2021 15:39:03 +0100 Subject: [PATCH] Bug 22435: Update accountline-details page to show all history The accountline-details page took a simplistic approach to displaying the history of an accountline. This patch drops the now defunct offset_type_description template block from it's respective include files, and then updates the accountline-details teplate and controller to show a full history of what's happend to the accountlines passed, including creation, increment/decrement, payments, cancellation and voids. Test plan 1/ Create some credits and debits and apply them to each other in various combinations 2/ View the 'Details' page for some of the debit/credits 3/ Compare before patch and after for the Details page. --- .../prog/en/includes/accounts.inc | 14 ---- .../en/modules/members/accountline-details.tt | 84 ++++++++++--------- .../bootstrap/en/includes/accounts.inc | 14 ---- members/accountline-details.pl | 17 ++-- 4 files changed, 53 insertions(+), 76 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc index 6c5450b0de..e57195717c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc @@ -56,17 +56,3 @@ [%- CASE -%] [%- END -%] [%- END -%] - -[%- BLOCK offset_type_description -%] - [%- SWITCH account_offset.type -%] - [%- CASE 'Credit Applied' -%]Credit applied - [%- CASE 'Payment' -%]Payment - [%- CASE 'Manual Credit' -%]Manual credit - [%- CASE 'Manual Debit' -%]Manual invoice - [%- CASE 'Lost Item' -%]Lost item returned - [%- CASE 'Writeoff' -%]Writeoff - [%- CASE 'Void Payment' -%]Void payment - [%- CASE 'CANCELLATION' -%]Cancelled charge - [%- CASE -%][% account_offset.type | html %] - [%- END -%] -[%- END -%] 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 c8d50f0a5e..d3d8a30f74 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 @@ -60,9 +60,9 @@ [% INCLUDE 'members-toolbar.inc' borrowernumber=patron.borrowernumber %] [% IF accountline %] - [% IF type == 'credit' %] + [% IF accountline.credit_type_code %]

Details of payment

- [% ELSIF type == 'debit' %] + [% ELSIF accountline.debit_type_code %]

Details of fee

[% END %] @@ -134,63 +134,67 @@ - - [% IF type == 'credit' %] -

Fees paid

- [% ELSIF type == 'debit' %] -

Payments

- [% END %] - +

History

- - - - - - + + + - - - + [% FOREACH ao IN account_offsets %] - [% IF type == 'credit' %] - [% SET offset_accountline = ao.debit %] - [% ELSIF type == 'debit' %] - [% SET offset_accountline = ao.credit %] - [% END %] + [% IF ao.credit_id == accountlines.accountlines_id %] + [% SET offset_accountline = ao.debit %] + [% ELSIF ao.debit_id == accountline.accountlines_id %] + [% SET offset_accountline = ao.credit %] + [% END %] + + [%- BLOCK ao_description -%] + [%- SWITCH ao.type -%] + [%- CASE 'Credit Applied' -%]Credit applied + [%- CASE 'Payment' -%]Payment + [%- CASE 'Manual Credit' -%]Manual credit + [%- CASE 'Manual Debit' -%]Manual invoice + [%- CASE 'Lost Item' -%]Lost item returned + [%- CASE 'Writeoff' -%]Writeoff + [%- CASE 'Void Payment' -%]Void payment + [%- CASE 'CANCELLATION' -%]Cancelled charge + [%- CASE 'APPLY' -%]Applied + [%- CASE 'CREATE' -%]Created + [%- CASE -%][% ao.type | html %] + [%- END -%] + [%- END -%] - [% IF offset_accountline %] - - - - - - - - + - - + + + + - [% END %] [% END %]
Date createdDate updatedAmountAmount outstandingTypeNoteDateChange amountChange type Transacting librarianDate/time of changeAmount of changeType of changeNote  
[% offset_accountline.date | $KohaDates %][% offset_accountline.timestamp | $KohaDates with_hours => 1 %][% offset_accountline.amount | $Price %][% offset_accountline.amountoutstanding | $Price %][% PROCESS account_type_description account=offset_accountline %][% offset_accountline.note | html %][% IF offset_accountline.manager_id %][% offset_accountline.manager_id | html %][% END %][% ao.created_on | $KohaDates with_hours => 1 %][% ao.created_on | $KohaDates with_hours => 1%] [% ao.amount | $Price %][% PROCESS offset_type_description account_offset=ao %] Details + [%- IF offset_accountline -%] + [% PROCESS account_type_description account=offset_accountline %] ([% PROCESS ao_description ao=ao %]) + [%- ELSE -%] + [% PROCESS ao_description ao=ao %] + [%- END -%] + [% IF offset_accountline.manager_id %][% offset_accountline.manager_id | html %][% END %][% offset_accountline.note | html %] + [%- IF offset_accountline -%] + Details + [%- END -%] +
[% ELSE %]
- [% IF type == 'credit' %] - Payment not found - [% ELSIF type == 'debit' %] - Fee not found - [% END %] + Account not found
[% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/accounts.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/accounts.inc index 6c5450b0de..e57195717c 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/accounts.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/accounts.inc @@ -56,17 +56,3 @@ [%- CASE -%] [%- END -%] [%- END -%] - -[%- BLOCK offset_type_description -%] - [%- SWITCH account_offset.type -%] - [%- CASE 'Credit Applied' -%]Credit applied - [%- CASE 'Payment' -%]Payment - [%- CASE 'Manual Credit' -%]Manual credit - [%- CASE 'Manual Debit' -%]Manual invoice - [%- CASE 'Lost Item' -%]Lost item returned - [%- CASE 'Writeoff' -%]Writeoff - [%- CASE 'Void Payment' -%]Void payment - [%- CASE 'CANCELLATION' -%]Cancelled charge - [%- CASE -%][% account_offset.type | html %] - [%- END -%] -[%- END -%] diff --git a/members/accountline-details.pl b/members/accountline-details.pl index a5c37079aa..ee2b9fc758 100755 --- a/members/accountline-details.pl +++ b/members/accountline-details.pl @@ -45,20 +45,21 @@ my $accountlines_id = $input->param('accountlines_id'); my $accountline = Koha::Account::Lines->find($accountlines_id); if ($accountline) { - my $type = $accountline->amount < 0 ? 'credit' : 'debit'; - my $column = $type eq 'credit' ? 'credit_id' : 'debit_id'; - my $account_offsets = Koha::Account::Offsets->search( - { $column => $accountlines_id }, - { order_by => 'created_on' }, + [ + { + credit_id => $accountline->accountlines_id + }, + { + debit_id => $accountline->accountlines_id + } + ], + { order_by => 'created_on' } ); $template->param( - type => $type, accountline => $accountline, account_offsets => $account_offsets, - - finesview => 1, ); my $patron = Koha::Patrons->find( $accountline->borrowernumber ); -- 2.20.1