View | Details | Raw Unified | Return to bug 24381
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt (-3 / +3 lines)
Lines 79-87 Link Here
79
      [% IF account.amountoutstanding <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amountoutstanding | $Price %]</td>
79
      [% IF account.amountoutstanding <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amountoutstanding | $Price %]</td>
80
      <td class="actions">
80
      <td class="actions">
81
        [% IF ( account.is_credit ) %]
81
        [% IF ( account.is_credit ) %]
82
          <a target="_blank" href="printfeercpt.pl?action=print&amp;accountlines_id=[% account.accountlines_id | uri %]&amp;borrowernumber=[% account.borrowernumber | uri %]" class="btn btn-default btn-xs"><i class="fa fa-print"></i> Print</a>
82
          <a target="_blank" href="printfeercpt.pl?action=print&amp;accountlines_id=[% account.accountlines_id | uri %]" class="btn btn-default btn-xs"><i class="fa fa-print"></i> Print</a>
83
        [% ELSE %]
83
        [% ELSE %]
84
          <a target="_blank" href="printinvoice.pl?action=print&amp;accountlines_id=[% account.accountlines_id | uri %]&amp;borrowernumber=[% account.borrowernumber | uri %]" class="btn btn-default btn-xs"><i class="fa fa-print"></i> Print</a>
84
          <a target="_blank" href="printinvoice.pl?action=print&amp;accountlines_id=[% account.accountlines_id | uri %]" class="btn btn-default btn-xs"><i class="fa fa-print"></i> Print</a>
85
        [% END %]
85
        [% END %]
86
        <a href="accountline-details.pl?accountlines_id=[% account.accountlines_id | uri %]" class="btn btn-default btn-xs"><i class="fa fa-list"></i> Details</a>
86
        <a href="accountline-details.pl?accountlines_id=[% account.accountlines_id | uri %]" class="btn btn-default btn-xs"><i class="fa fa-list"></i> Details</a>
87
        [% IF account.is_debit && account.amountoutstanding > 0 %]
87
        [% IF account.is_debit && account.amountoutstanding > 0 %]
Lines 308-314 Link Here
308
    <script>
308
    <script>
309
        $(document).ready(function() {
309
        $(document).ready(function() {
310
            [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
310
            [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
311
                window.open('/cgi-bin/koha/members/printfeercpt.pl?action=print&change_given=[% change_given | html %]&accountlines_id=[% payment_id | html %]&borrowernumber=[% patron.borrowernumber | html %]', '_blank');
311
                window.open('/cgi-bin/koha/members/printfeercpt.pl?action=print&change_given=[% change_given | html %]&accountlines_id=[% payment_id | html %]', '_blank');
312
            [% END %]
312
            [% END %]
313
313
314
            var txtActivefilter = _("Filter paid transactions");
314
            var txtActivefilter = _("Filter paid transactions");
(-)a/members/printfeercpt.pl (-66 / +36 lines)
Lines 1-11 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
2
3
3
# Copyright Koustubha Kale 2010
4
#written 3rd May 2010 by kmkale@anantcorp.com adapted from boraccount.pl by chris@katipo.oc.nz
4
# Copyright PTFS Europe 2020
5
#script to print fee receipts
6
7
8
# Copyright Koustubha Kale
9
#
5
#
10
# This file is part of Koha.
6
# This file is part of Koha.
11
#
7
#
Lines 27-100 use Modern::Perl; Link Here
27
use C4::Auth;
23
use C4::Auth;
28
use C4::Output;
24
use C4::Output;
29
use CGI qw ( -utf8 );
25
use CGI qw ( -utf8 );
30
use C4::Members;
31
use C4::Accounts;
32
use C4::Letters;
26
use C4::Letters;
33
use Koha::Account::Lines;
27
use Koha::Account::Lines;
34
use Koha::DateUtils;
35
use Koha::Patrons;
36
use Koha::Patron::Categories;
37
38
my $input=new CGI;
39
40
41
my ($template, $loggedinuser, $cookie)
42
    = get_template_and_user({template_name => "members/printfeercpt.tt",
43
                            query => $input,
44
                            type => "intranet",
45
                            authnotrequired => 0,
46
                            flagsrequired => {borrowers => 'edit_borrowers', updatecharges => 'remaining_permissions'},
47
                            debug => 1,
48
                            });
49
50
my $borrowernumber=$input->param('borrowernumber');
51
my $action = $input->param('action') || '';
52
my $accountlines_id = $input->param('accountlines_id');
53
my $change_given = $input->param('change_given');
54
28
55
my $logged_in_user = Koha::Patrons->find( $loggedinuser );
29
my $input = CGI->new;
56
my $patron         = Koha::Patrons->find( $borrowernumber );
30
57
output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
31
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
58
32
    {
59
#get account details
33
        template_name   => "members/printfeercpt.tt",
60
my $total = $patron->account->balance;
34
        query           => $input,
61
35
        type            => "intranet",
62
# FIXME This whole stuff is ugly and should be rewritten
36
        authnotrequired => 0,
63
# FIXME We should pass the $accts iterator to the template and do this formatting part there
37
        flagsrequired   => {
64
my $accountline_object = Koha::Account::Lines->find($accountlines_id);
38
            borrowers     => 'edit_borrowers',
65
my $accountline = $accountline_object->unblessed;
39
            updatecharges => 'remaining_permissions'
66
my $totalcredit;
40
        }
67
if($total <= 0){
41
    }
68
        $totalcredit = 1;
42
);
69
}
70
71
$accountline->{'amount'} += 0.00;
72
if ( $accountline->{'amount'} <= 0 ) {
73
    $accountline->{'amountcredit'} = 1;
74
    $accountline->{'amount'} *= -1.00;
75
}
76
$accountline->{'amountoutstanding'} += 0.00;
77
if ( $accountline->{'amountoutstanding'} <= 0 ) {
78
    $accountline->{'amountoutstandingcredit'} = 1;
79
}
80
43
81
my $letter = C4::Letters::getletter( 'circulation', 'ACCOUNT_CREDIT', C4::Context::mybranch, 'print', $patron->lang );
44
my $credit_id = $input->param('accountlines_id');
45
my $credit    = Koha::Account::Lines->find($credit_id);
46
my $patron    = $credit->patron;
47
48
my $logged_in_user = Koha::Patrons->find($loggedinuser) or die "Not logged in";
49
output_and_exit_if_error(
50
    $input, $cookie,
51
    $template,
52
    {
53
        module         => 'members',
54
        logged_in_user => $logged_in_user,
55
        current_patron => $patron
56
    }
57
);
82
58
83
my @account_offsets = Koha::Account::Offsets->search( { credit_id => $accountline_object->id } );
59
my $letter = C4::Letters::getletter( 'circulation', 'ACCOUNT_CREDIT',
60
    C4::Context::mybranch, 'print', $patron->lang );
84
61
85
$template->param(
62
$template->param(
86
    letter      => $letter,
63
    letter => $letter,
87
    patron      => $patron,
64
    credit => $credit,
88
    library     => C4::Context::mybranch,
89
    offsets     => \@account_offsets,
90
    credit      => $accountline_object,
91
92
    finesview   => 1,
93
    total       => $total,
94
    totalcredit => $totalcredit,
95
    accounts    => [$accountline],        # FIXME There is always only 1 row!
96
65
97
    change_given => $change_given,
66
    tendered => scalar $input->param('tendered'),
67
    change   => scalar $input->param('change')
98
);
68
);
99
69
100
output_html_with_http_headers $input, $cookie, $template->output;
70
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/members/printinvoice.pl (-53 / +27 lines)
Lines 1-9 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
2
3
#written 3rd May 2010 by kmkale@anantcorp.com adapted from boraccount.pl by chris@katipo.oc.nz
3
# Copyright Koustubha Kale 2010
4
#script to print fee receipts
4
# Copyright PTFS Europe 2020
5
6
# Copyright Koustubha Kale
7
#
5
#
8
# This file is part of Koha.
6
# This file is part of Koha.
9
#
7
#
Lines 24-94 use Modern::Perl; Link Here
24
22
25
use C4::Auth;
23
use C4::Auth;
26
use C4::Output;
24
use C4::Output;
27
use Koha::DateUtils;
28
use CGI qw ( -utf8 );
25
use CGI qw ( -utf8 );
29
use C4::Members;
26
use C4::Letters;
30
use C4::Accounts;
31
32
use Koha::Account::Lines;
27
use Koha::Account::Lines;
33
use Koha::Patrons;
34
use Koha::Patron::Categories;
35
28
36
my $input = new CGI;
29
my $input = CGI->new;
37
30
38
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
31
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
39
    {   template_name   => "members/printinvoice.tt",
32
    {
33
        template_name   => "members/printinvoice.tt",
40
        query           => $input,
34
        query           => $input,
41
        type            => "intranet",
35
        type            => "intranet",
42
        authnotrequired => 0,
36
        authnotrequired => 0,
43
        flagsrequired => { borrowers => 'edit_borrowers', updatecharges => 'remaining_permissions' },
37
        flagsrequired   => {
44
        debug           => 1,
38
            borrowers     => 'edit_borrowers',
39
            updatecharges => 'remaining_permissions'
40
        }
45
    }
41
    }
46
);
42
);
47
43
48
my $borrowernumber  = $input->param('borrowernumber');
44
my $debit_id = $input->param('accountlines_id');
49
my $action          = $input->param('action') || '';
45
my $debit = Koha::Account::Lines->find($debit_id);
50
my $accountlines_id = $input->param('accountlines_id');
46
my $patron = $debit->patron;
51
47
52
my $logged_in_user = Koha::Patrons->find( $loggedinuser );
48
my $logged_in_user = Koha::Patrons->find($loggedinuser) or die "Not logged in";
53
my $patron         = Koha::Patrons->find( $borrowernumber );
49
output_and_exit_if_error(
54
output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
50
    $input, $cookie,
55
51
    $template,
56
#get account details
52
    {
57
my $total = $patron->account->balance;
53
        module         => 'members',
58
my $accountline_object = Koha::Account::Lines->find($accountlines_id);
54
        logged_in_user => $logged_in_user,
59
my $accountline = $accountline_object->unblessed;
55
        current_patron => $patron
60
56
    }
61
my $totalcredit;
57
);
62
if ( $total <= 0 ) {
63
    $totalcredit = 1;
64
}
65
66
67
$accountline->{'amount'} += 0.00;
68
if ( $accountline->{'amount'} <= 0 ) {
69
    $accountline->{'amountcredit'} = 1;
70
    $accountline->{'amount'} *= -1.00;
71
}
72
$accountline->{'amountoutstanding'} += 0.00;
73
if ( $accountline->{'amountoutstanding'} <= 0 ) {
74
    $accountline->{'amountoutstandingcredit'} = 1;
75
}
76
77
my @account_offsets = Koha::Account::Offsets->search( { debit_id => $accountline_object->id } );
78
58
79
my $letter = C4::Letters::getletter( 'circulation', 'ACCOUNT_DEBIT', C4::Context::mybranch, 'print', $patron->lang );
59
my $letter = C4::Letters::getletter( 'circulation', 'ACCOUNT_DEBIT',
60
    C4::Context::mybranch, 'print', $patron->lang );
80
61
81
$template->param(
62
$template->param(
82
    letter  => $letter,
63
    letter  => $letter,
83
    patron  => $patron,
64
    debit   => $debit
84
    library => C4::Context::mybranch,
85
    offsets => \@account_offsets,
86
    debit   => $accountline_object,
87
65
88
    finesview   => 1,
89
    total       => sprintf( "%.2f", $total ),
90
    totalcredit => $totalcredit,
91
    accounts    => [$accountline],           # FIXME There is always only 1 row!
92
);
66
);
93
67
94
output_html_with_http_headers $input, $cookie, $template->output;
68
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/pos/printreceipt.pl (-14 / +12 lines)
Lines 37-67 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
37
    }
37
    }
38
);
38
);
39
39
40
my $action = $input->param('action') || '';
41
my $payment_id = $input->param('accountlines_id');
40
my $payment_id = $input->param('accountlines_id');
41
my $payment    = Koha::Account::Lines->find($payment_id);
42
my $patron     = $payment->patron;
42
43
43
my $logged_in_user = Koha::Patrons->find($loggedinuser) or die "Not logged in";
44
my $logged_in_user = Koha::Patrons->find($loggedinuser) or die "Not logged in";
44
output_and_exit_if_error(
45
output_and_exit_if_error(
45
    $input, $cookie,
46
    $input, $cookie,
46
    $template,
47
    $template,
47
    {
48
    {
48
        module         => 'pos',
49
        module         => 'members',
49
        logged_in_user => $logged_in_user,
50
        logged_in_user => $logged_in_user,
51
        current_patron => $patron
50
    }
52
    }
51
);
53
) if $patron;    # Payment could have been anonymous
52
53
my $payment = Koha::Account::Lines->find($payment_id);
54
my @offsets = Koha::Account::Offsets->search( { credit_id => $payment_id } );
55
54
56
my $letter =
55
my $letter = C4::Letters::getletter( 'pos', 'RECEIPT',
57
  C4::Letters::getletter( 'pos', 'RECEIPT', C4::Context::mybranch, 'print' );
56
    C4::Context::mybranch, 'print', $patron->lang );
58
57
59
$template->param(
58
$template->param(
60
    letter    => $letter,
59
    letter  => $letter,
61
    payment   => $payment,
60
    payment => $payment,
62
    offsets   => \@offsets,
61
63
    collected => scalar $input->param('collected'),
62
    tendered => scalar $input->param('tendered'),
64
    change    => scalar $input->param('change')
63
    change   => scalar $input->param('change')
65
);
64
);
66
65
67
output_html_with_http_headers $input, $cookie, $template->output;
66
output_html_with_http_headers $input, $cookie, $template->output;
68
- 

Return to bug 24381