Koha/members/accountline-details.pl
Martin Renvoize c475d4d97b 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 template and controller
to show the full history of what's happend to the accountline passed.
This includes the creation, any increments/decrements (for fines), and
finally any offsets against the total (payments, cancellations, 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.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-08-04 14:06:43 +02:00

69 lines
2 KiB
Perl
Executable file

#!/usr/bin/perl
# This file is part of Koha.
#
# Copyright 2017 ByWater Solutions
#
# Koha is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# Koha is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
use Modern::Perl;
use CGI qw ( -utf8 );
use C4::Auth qw( get_template_and_user );
use C4::Output qw( output_html_with_http_headers );
use C4::Context;
use Koha::Patrons;
use Koha::Account::Lines;
my $input = CGI->new;
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
template_name => "members/accountline-details.tt",
query => $input,
type => "intranet",
flagsrequired => {
borrowers => 'edit_borrowers',
updatecharges => 'remaining_permissions'
},
}
);
my $accountlines_id = $input->param('accountlines_id');
my $accountline = Koha::Account::Lines->find($accountlines_id);
if ($accountline) {
my $account_offsets = Koha::Account::Offsets->search(
[
{
credit_id => $accountline->accountlines_id
},
{
debit_id => $accountline->accountlines_id
}
],
{ order_by => 'created_on' }
);
$template->param(
accountline => $accountline,
account_offsets => $account_offsets,
);
my $patron = Koha::Patrons->find( $accountline->borrowernumber );
$template->param( patron => $patron );
}
output_html_with_http_headers $input, $cookie, $template->output;