Koha › Patrons › Account for [% INCLUDE 'patron-title.inc' %]
+[% INCLUDE 'doc-head-close.inc' %]
+
+
+[% INCLUDE 'datatables.inc' %]
+[% INCLUDE 'browser-strings.inc' %]
+
+
+
+
+[% INCLUDE 'header.inc' %]
+[% INCLUDE 'patron-search.inc' %]
+
+
Home › Patrons › Account for [% INCLUDE 'patron-title.inc' %]
+
+[% INCLUDE 'intranet-bottom.inc' %]
--- a/members/account.pl
+++ a/members/account.pl
@@ -0,0 +1,112 @@
+#!/usr/bin/perl
+
+# Copyright 2000-2002 Katipo Communications
+# Copyright 2013 ByWater Solutions
+#
+# This file is part of Koha.
+#
+# 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, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+use Modern::Perl;
+
+use CGI;
+
+use C4::Auth;
+use C4::Output;
+use C4::Dates qw/format_date/;
+use C4::Members;
+use C4::Branch;
+use C4::Members::Attributes qw(GetBorrowerAttributes);
+use Koha::Database;
+
+my $cgi = new CGI;
+
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+ {
+ template_name => "members/account.tt",
+ query => $cgi,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => { borrowers => 1, updatecharges => 1 },
+ debug => 1,
+ }
+);
+
+my $borrowernumber = $cgi->param('borrowernumber');
+
+my $borrower = GetMember( 'borrowernumber' => $borrowernumber );
+
+my @debits = Koha::Database->new()->schema->resultset('AccountDebit')->search(
+ { 'me.borrowernumber' => $borrowernumber },
+ { prefetch => { account_offsets => 'credit' } }
+);
+
+my @credits = Koha::Database->new()->schema->resultset('AccountCredit')->search(
+ { 'me.borrowernumber' => $borrowernumber },
+ { prefetch => { account_offsets => 'debit' } }
+);
+
+$template->param(
+ debits => \@debits,
+ credits => \@credits,
+ borrower => $borrower,
+);
+
+# Standard /members/ borrower details data
+## FIXME: This code is in every /members/ script and should be unified
+
+if ( $borrower->{'category_type'} eq 'C' ) {
+ my ( $catcodes, $labels ) =
+ GetborCatFromCatType( 'A', 'WHERE category_type = ?' );
+ my $cnt = scalar(@$catcodes);
+ $template->param( 'CATCODE_MULTI' => 1 ) if $cnt > 1;
+ $template->param( 'catcode' => $catcodes->[0] ) if $cnt == 1;
+}
+
+my ( $picture, $dberror ) = GetPatronImage( $borrower->{'borrowernumber'} );
+$template->param( picture => 1 ) if $picture;
+
+if ( C4::Context->preference('ExtendedPatronAttributes') ) {
+ my $attributes = GetBorrowerAttributes($borrowernumber);
+ $template->param(
+ ExtendedPatronAttributes => 1,
+ extendedattributes => $attributes
+ );
+}
+
+$template->param(
+ borrowernumber => $borrowernumber,
+ firstname => $borrower->{'firstname'},
+ surname => $borrower->{'surname'},
+ cardnumber => $borrower->{'cardnumber'},
+ categorycode => $borrower->{'categorycode'},
+ category_type => $borrower->{'category_type'},
+ categoryname => $borrower->{'description'},
+ address => $borrower->{'address'},
+ address2 => $borrower->{'address2'},
+ city => $borrower->{'city'},
+ state => $borrower->{'state'},
+ zipcode => $borrower->{'zipcode'},
+ country => $borrower->{'country'},
+ phone => $borrower->{'phone'},
+ email => $borrower->{'email'},
+ branchcode => $borrower->{'branchcode'},
+ branchname => GetBranchName( $borrower->{'branchcode'} ),
+ is_child => ( $borrower->{'category_type'} eq 'C' ),
+ activeBorrowerRelationship =>
+ ( C4::Context->preference('borrowerRelationship') ne '' ),
+ RoutingSerials => C4::Context->preference('RoutingSerials'),
+);
+
+output_html_with_http_headers $cgi, $cookie, $template->output;
--- a/members/account_credit.pl
+++ a/members/account_credit.pl
@@ -0,0 +1,103 @@
+#!/usr/bin/perl
+
+#written 11/1/2000 by chris@katipo.oc.nz
+#script to display borrowers account details
+
+# Copyright 2000-2002 Katipo Communications
+# Copyright 2010 BibLibre
+#
+# This file is part of Koha.
+#
+# 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, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+use strict;
+use warnings;
+
+use C4::Auth;
+use C4::Output;
+use CGI;
+
+use C4::Koha;
+use C4::Members;
+use C4::Branch;
+use C4::Items;
+use C4::Members::Attributes qw(GetBorrowerAttributes);
+use Koha::Database;
+
+my $cgi = new CGI;
+
+my $borrowernumber = $cgi->param('borrowernumber');
+
+my $borrower = GetMember( 'borrowernumber' => $borrowernumber );
+
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+ {
+ template_name => "members/account_credit.tt",
+ query => $cgi,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => { borrowers => 1, updatecharges => 1 },
+ debug => 1,
+ }
+);
+
+$template->param( credit_types_loop => GetAuthorisedValues('MANUAL_CREDIT') );
+
+# Standard /members/ borrower details data
+## FIXME: This code is in every /members/ script and should be unified
+
+if ( $borrower->{'category_type'} eq 'C' ) {
+ my ( $catcodes, $labels ) =
+ GetborCatFromCatType( 'A', 'WHERE category_type = ?' );
+ my $cnt = scalar(@$catcodes);
+ $template->param( 'CATCODE_MULTI' => 1 ) if $cnt > 1;
+ $template->param( 'catcode' => $catcodes->[0] ) if $cnt == 1;
+}
+
+my ( $picture, $dberror ) = GetPatronImage( $borrower->{'borrowernumber'} );
+$template->param( picture => 1 ) if $picture;
+
+if ( C4::Context->preference('ExtendedPatronAttributes') ) {
+ my $attributes = GetBorrowerAttributes($borrowernumber);
+ $template->param(
+ ExtendedPatronAttributes => 1,
+ extendedattributes => $attributes
+ );
+}
+
+$template->param(
+ borrowernumber => $borrowernumber,
+ firstname => $borrower->{'firstname'},
+ surname => $borrower->{'surname'},
+ cardnumber => $borrower->{'cardnumber'},
+ categorycode => $borrower->{'categorycode'},
+ category_type => $borrower->{'category_type'},
+ categoryname => $borrower->{'description'},
+ address => $borrower->{'address'},
+ address2 => $borrower->{'address2'},
+ city => $borrower->{'city'},
+ state => $borrower->{'state'},
+ zipcode => $borrower->{'zipcode'},
+ country => $borrower->{'country'},
+ phone => $borrower->{'phone'},
+ email => $borrower->{'email'},
+ branchcode => $borrower->{'branchcode'},
+ branchname => GetBranchName( $borrower->{'branchcode'} ),
+ is_child => ( $borrower->{'category_type'} eq 'C' ),
+ activeBorrowerRelationship =>
+ ( C4::Context->preference('borrowerRelationship') ne '' ),
+ RoutingSerials => C4::Context->preference('RoutingSerials'),
+);
+
+output_html_with_http_headers $cgi, $cookie, $template->output;
--- a/members/account_credit_do.pl
+++ a/members/account_credit_do.pl
@@ -0,0 +1,66 @@
+#!/usr/bin/perl
+
+# Copyright 2013 ByWater Solutions
+#
+# This file is part of Koha.
+#
+# 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, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+use Modern::Perl;
+
+use CGI;
+
+use C4::Auth;
+use C4::Output;
+use C4::Members;
+use C4::Items;
+use C4::Branch;
+use C4::Members::Attributes qw(GetBorrowerAttributes);
+use Koha::Accounts;
+use Koha::Database;
+
+my $cgi = new CGI;
+
+my $borrowernumber = $cgi->param('borrowernumber');
+my $borrower =
+ Koha::Database->new()->schema->resultset('Borrower')->find($borrowernumber);
+
+if ( checkauth( $cgi, 0, { borrowers => 1 }, 'intranet' ) ) {
+
+ my $barcode = $cgi->param('barcode');
+ my $itemnumber = $cgi->param('itemnumber');
+ my $description = $cgi->param('description');
+ my $amount = $cgi->param('amount');
+ my $type = $cgi->param('type');
+ my $notes = $cgi->param('notes');
+
+ if ( !$itemnumber && $barcode ) {
+ $itemnumber = GetItemnumberFromBarcode($barcode);
+ }
+
+ my $debit = AddCredit(
+ {
+ borrower => $borrower,
+ amount => $amount,
+ type => $type,
+ itemnumber => $itemnumber,
+ description => $description,
+ notes => $notes,
+
+ }
+ );
+
+ print $cgi->redirect(
+ "/cgi-bin/koha/members/account.pl?borrowernumber=$borrowernumber");
+}
--- a/members/account_debit.pl
+++ a/members/account_debit.pl
@@ -0,0 +1,104 @@
+#!/usr/bin/perl
+
+#written 11/1/2000 by chris@katipo.oc.nz
+#script to display borrowers account details
+
+# Copyright 2000-2002 Katipo Communications
+# Copyright 2010 BibLibre
+#
+# This file is part of Koha.
+#
+# 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, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+use strict;
+use warnings;
+
+use CGI;
+
+use C4::Auth;
+use C4::Output;
+use C4::Members;
+use C4::Items;
+use C4::Branch;
+use C4::Members::Attributes qw(GetBorrowerAttributes);
+use C4::Koha;
+use Koha::Accounts;
+use Koha::Database;
+
+my $input = new CGI;
+
+my $borrowernumber = $input->param('borrowernumber');
+
+my $borrower = GetMember( 'borrowernumber' => $borrowernumber );
+
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+ {
+ template_name => "members/account_debit.tt",
+ query => $input,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => { borrowers => 1, updatecharges => 1 },
+ debug => 1,
+ }
+);
+
+$template->param( invoice_types_loop => GetAuthorisedValues('MANUAL_INV') );
+
+# Standard /members/ borrower details data
+## FIXME: This code is in every /members/ script and should be unified
+
+if ( $borrower->{'category_type'} eq 'C' ) {
+ my ( $catcodes, $labels ) =
+ GetborCatFromCatType( 'A', 'WHERE category_type = ?' );
+ my $cnt = scalar(@$catcodes);
+ $template->param( 'CATCODE_MULTI' => 1 ) if $cnt > 1;
+ $template->param( 'catcode' => $catcodes->[0] ) if $cnt == 1;
+}
+
+my ( $picture, $dberror ) = GetPatronImage( $borrower->{'borrowernumber'} );
+$template->param( picture => 1 ) if $picture;
+
+if ( C4::Context->preference('ExtendedPatronAttributes') ) {
+ my $attributes = GetBorrowerAttributes($borrowernumber);
+ $template->param(
+ ExtendedPatronAttributes => 1,
+ extendedattributes => $attributes
+ );
+}
+
+$template->param(
+ borrowernumber => $borrowernumber,
+ firstname => $borrower->{'firstname'},
+ surname => $borrower->{'surname'},
+ cardnumber => $borrower->{'cardnumber'},
+ categorycode => $borrower->{'categorycode'},
+ category_type => $borrower->{'category_type'},
+ categoryname => $borrower->{'description'},
+ address => $borrower->{'address'},
+ address2 => $borrower->{'address2'},
+ city => $borrower->{'city'},
+ state => $borrower->{'state'},
+ zipcode => $borrower->{'zipcode'},
+ country => $borrower->{'country'},
+ phone => $borrower->{'phone'},
+ email => $borrower->{'email'},
+ branchcode => $borrower->{'branchcode'},
+ branchname => GetBranchName( $borrower->{'branchcode'} ),
+ is_child => ( $borrower->{'category_type'} eq 'C' ),
+ activeBorrowerRelationship =>
+ ( C4::Context->preference('borrowerRelationship') ne '' ),
+ RoutingSerials => C4::Context->preference('RoutingSerials'),
+);
+
+output_html_with_http_headers $input, $cookie, $template->output;
--- a/members/account_debit_do.pl
+++ a/members/account_debit_do.pl
@@ -0,0 +1,69 @@
+#!/usr/bin/perl
+
+# Copyright 2013 ByWater Solutions
+#
+# This file is part of Koha.
+#
+# 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, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+use Modern::Perl;
+
+use CGI;
+
+use C4::Auth;
+use C4::Output;
+use C4::Members;
+use C4::Items;
+use C4::Branch;
+use C4::Members::Attributes qw(GetBorrowerAttributes);
+use Koha::Accounts;
+use Koha::Database;
+
+my $cgi = new CGI;
+
+my $borrowernumber = $cgi->param('borrowernumber');
+my $borrower =
+ Koha::Database->new()->schema->resultset('Borrower')->find($borrowernumber);
+
+if ( checkauth( $cgi, 0, { borrowers => 1 }, 'intranet' ) ) {
+
+ # print $cgi->header;
+ my $barcode = $cgi->param('barcode');
+ my $itemnumber = $cgi->param('itemnumber');
+ my $description = $cgi->param('description');
+ my $amount = $cgi->param('amount');
+ my $type = $cgi->param('type');
+ my $notes = $cgi->param('notes');
+
+ if ( !$itemnumber && $barcode ) {
+ $itemnumber = GetItemnumberFromBarcode($barcode);
+ }
+
+ my $debit = AddDebit(
+ {
+ borrower => $borrower,
+ amount => $amount,
+ type => $type,
+ itemnumber => $itemnumber,
+ description => $description,
+ notes => $notes,
+
+ }
+ );
+
+ my $debit_id = $debit->debit_id();
+
+ print $cgi->redirect(
+ "/cgi-bin/koha/members/account.pl?borrowernumber=$borrowernumber");
+}
--- a/members/account_payment.pl
+++ a/members/account_payment.pl
@@ -0,0 +1,123 @@
+#!/usr/bin/perl
+
+# Copyright 2000-2002 Katipo Communications
+# Copyright 2010 BibLibre
+# Copyright 2010,2011 PTFS-Europe Ltd
+# Copyright 2013 ByWater Solutions
+#
+# This file is part of Koha.
+#
+# 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, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+=head1 account_payment.pl
+
+ written 11/1/2000 by chris@katipo.oc.nz
+ part of the koha library system, script to facilitate paying off fines
+
+=cut
+
+use Modern::Perl;
+
+use CGI;
+
+use URI::Escape;
+
+use C4::Context;
+use C4::Auth;
+use C4::Output;
+use C4::Members;
+use C4::Stats;
+use C4::Koha;
+use C4::Overdues;
+use C4::Branch;
+use C4::Members::Attributes qw(GetBorrowerAttributes);
+use Koha::Database;
+
+our $cgi = CGI->new;
+
+our ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+ {
+ template_name => 'members/account_payment.tt',
+ query => $cgi,
+ type => 'intranet',
+ authnotrequired => 0,
+ flagsrequired => { borrowers => 1, updatecharges => 1 },
+ debug => 1,
+ }
+);
+
+my $borrowernumber = $cgi->param('borrowernumber');
+
+my $borrower = GetMember( borrowernumber => $borrowernumber );
+
+my @debits = Koha::Database->new()->schema->resultset('AccountDebit')->search(
+ {
+ 'me.borrowernumber' => $borrowernumber,
+ amount_outstanding => { '>' => 0 }
+ }
+);
+
+$template->param(
+ debits => \@debits,
+ borrower => $borrower,
+ credit_types_loop => GetAuthorisedValues('MANUAL_CREDIT'),
+);
+
+# Standard /members/ borrower details data
+## FIXME: This code is in every /members/ script and should be unified
+
+if ( $borrower->{'category_type'} eq 'C' ) {
+ my ( $catcodes, $labels ) =
+ GetborCatFromCatType( 'A', 'WHERE category_type = ?' );
+ my $cnt = scalar(@$catcodes);
+ $template->param( 'CATCODE_MULTI' => 1 ) if $cnt > 1;
+ $template->param( 'catcode' => $catcodes->[0] ) if $cnt == 1;
+}
+
+my ( $picture, $dberror ) = GetPatronImage( $borrower->{'borrowernumber'} );
+$template->param( picture => 1 ) if $picture;
+
+if ( C4::Context->preference('ExtendedPatronAttributes') ) {
+ my $attributes = GetBorrowerAttributes($borrowernumber);
+ $template->param(
+ ExtendedPatronAttributes => 1,
+ extendedattributes => $attributes
+ );
+}
+
+$template->param(
+ borrowernumber => $borrowernumber,
+ firstname => $borrower->{'firstname'},
+ surname => $borrower->{'surname'},
+ cardnumber => $borrower->{'cardnumber'},
+ categorycode => $borrower->{'categorycode'},
+ category_type => $borrower->{'category_type'},
+ categoryname => $borrower->{'description'},
+ address => $borrower->{'address'},
+ address2 => $borrower->{'address2'},
+ city => $borrower->{'city'},
+ state => $borrower->{'state'},
+ zipcode => $borrower->{'zipcode'},
+ country => $borrower->{'country'},
+ phone => $borrower->{'phone'},
+ email => $borrower->{'email'},
+ branchcode => $borrower->{'branchcode'},
+ branchname => GetBranchName( $borrower->{'branchcode'} ),
+ is_child => ( $borrower->{'category_type'} eq 'C' ),
+ activeBorrowerRelationship =>
+ ( C4::Context->preference('borrowerRelationship') ne '' ),
+ RoutingSerials => C4::Context->preference('RoutingSerials'),
+);
+
+output_html_with_http_headers $cgi, $cookie, $template->output;
--- a/members/account_payment_do.pl
+++ a/members/account_payment_do.pl
@@ -0,0 +1,64 @@
+#!/usr/bin/perl
+
+# Copyright 2013 ByWater Solutions
+#
+# This file is part of Koha.
+#
+# 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, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+use Modern::Perl;
+
+use CGI;
+
+use C4::Auth;
+use C4::Members;
+use C4::Items;
+use C4::Branch;
+use C4::Members::Attributes qw(GetBorrowerAttributes);
+use Koha::Accounts;
+use Koha::Database;
+
+my $cgi = new CGI;
+
+if ( checkauth( $cgi, 0, { borrowers => 1 }, 'intranet' ) ) {
+ my $borrowernumber = $cgi->param('borrowernumber');
+
+ my $borrower =
+ Koha::Database->new()->schema->resultset('Borrower')
+ ->find($borrowernumber);
+
+ my $amount_to_pay = $cgi->param('amount_to_pay');
+ my $amount_received = $cgi->param('amount_received');
+ my $type = $cgi->param('type');
+ my $notes = $cgi->param('notes');
+ my @debit_id = $cgi->param('debit_id');
+
+ $amount_received ||= $amount_to_pay
+ if $type eq Koha::Accounts::CreditTypes::Payment();
+
+ my $debit = AddCredit(
+ {
+ borrower => $borrower,
+ amount_received => $amount_received,
+ amount => $amount_to_pay,
+ type => $type,
+ notes => $notes,
+ debit_id => \@debit_id,
+
+ }
+ );
+
+ print $cgi->redirect(
+ "/cgi-bin/koha/members/account.pl?borrowernumber=$borrowernumber");
+}
--- a/members/account_print.pl
+++ a/members/account_print.pl
@@ -0,0 +1,60 @@
+#!/usr/bin/perl
+
+# Copyright 2013 ByWater Solutions
+#
+# This file is part of Koha.
+#
+# 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, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+use Modern::Perl;
+
+use CGI;
+
+use C4::Auth;
+use C4::Output;
+use Koha::Database;
+
+my $cgi = new CGI;
+
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+ {
+ template_name => "members/account_print.tt",
+ query => $cgi,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => { borrowers => 1, updatecharges => 1 },
+ debug => 1,
+ }
+);
+
+my $type = $cgi->param('type');
+my $id = $cgi->param('id');
+
+warn "No type passed in!" unless $type;
+warn "No id passed in!" unless $id;
+
+if ( $type eq 'debit' ) {
+ my $debit =
+ Koha::Database->new()->schema->resultset('AccountDebit')->find($id);
+ $template->param( debit => $debit );
+}
+elsif ( $type eq 'credit' ) {
+ my $credit =
+ Koha::Database->new()->schema->resultset('AccountCredit')->find($id);
+ $template->param( credit => $credit );
+}
+
+$template->param( type => $type );
+
+output_html_with_http_headers $cgi, $cookie, $template->output;
--