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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt (-3 / +3 lines)
Lines 87-95 Link Here
87
      [% IF account.amountoutstanding <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amountoutstanding | $Price %]</td>
87
      [% IF account.amountoutstanding <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amountoutstanding | $Price %]</td>
88
      <td class="actions">
88
      <td class="actions">
89
        [% IF ( account.is_credit ) %]
89
        [% IF ( account.is_credit ) %]
90
          <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>
90
          <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>
91
        [% ELSE %]
91
        [% ELSE %]
92
          <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>
92
          <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>
93
        [% END %]
93
        [% END %]
94
        <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>
94
        <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>
95
        [% IF account.is_debit && account.amountoutstanding > 0 %]
95
        [% IF account.is_debit && account.amountoutstanding > 0 %]
Lines 316-322 Link Here
316
    <script>
316
    <script>
317
        $(document).ready(function() {
317
        $(document).ready(function() {
318
            [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
318
            [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
319
                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');
319
                window.open('/cgi-bin/koha/members/printfeercpt.pl?action=print&change_given=[% change_given | html %]&accountlines_id=[% payment_id | html %]', '_blank');
320
            [% END %]
320
            [% END %]
321
321
322
            var txtActivefilter = _("Filter paid transactions");
322
            var txtActivefilter = _("Filter paid transactions");
(-)a/members/printfeercpt.pl (-65 / +35 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-99 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=CGI->new;
39
40
41
my ($template, $loggedinuser, $cookie)
42
    = get_template_and_user({template_name => "members/printfeercpt.tt",
43
                            query => $input,
44
                            type => "intranet",
45
                            flagsrequired => {borrowers => 'edit_borrowers', updatecharges => 'remaining_permissions'},
46
                            debug => 1,
47
                            });
48
49
my $borrowernumber=$input->param('borrowernumber');
50
my $action = $input->param('action') || '';
51
my $accountlines_id = $input->param('accountlines_id');
52
my $change_given = $input->param('change_given');
53
28
54
my $logged_in_user = Koha::Patrons->find( $loggedinuser );
29
my $input = CGI->new;
55
my $patron         = Koha::Patrons->find( $borrowernumber );
30
56
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(
57
32
    {
58
#get account details
33
        template_name   => "members/printfeercpt.tt",
59
my $total = $patron->account->balance;
34
        query           => $input,
60
35
        type            => "intranet",
61
# FIXME This whole stuff is ugly and should be rewritten
36
        flagsrequired   => {
62
# FIXME We should pass the $accts iterator to the template and do this formatting part there
37
            borrowers     => 'edit_borrowers',
63
my $accountline_object = Koha::Account::Lines->find($accountlines_id);
38
            updatecharges => 'remaining_permissions'
64
my $accountline = $accountline_object->unblessed;
39
        }
65
my $totalcredit;
40
    }
66
if($total <= 0){
41
);
67
        $totalcredit = 1;
68
}
69
70
$accountline->{'amount'} += 0.00;
71
if ( $accountline->{'amount'} <= 0 ) {
72
    $accountline->{'amountcredit'} = 1;
73
    $accountline->{'amount'} *= -1.00;
74
}
75
$accountline->{'amountoutstanding'} += 0.00;
76
if ( $accountline->{'amountoutstanding'} <= 0 ) {
77
    $accountline->{'amountoutstandingcredit'} = 1;
78
}
79
42
80
my $letter = C4::Letters::getletter( 'circulation', 'ACCOUNT_CREDIT', C4::Context::mybranch, 'print', $patron->lang );
43
my $credit_id = $input->param('accountlines_id');
44
my $credit    = Koha::Account::Lines->find($credit_id);
45
my $patron    = $credit->patron;
46
47
my $logged_in_user = Koha::Patrons->find($loggedinuser) or die "Not logged in";
48
output_and_exit_if_error(
49
    $input, $cookie,
50
    $template,
51
    {
52
        module         => 'members',
53
        logged_in_user => $logged_in_user,
54
        current_patron => $patron
55
    }
56
);
81
57
82
my @account_offsets = Koha::Account::Offsets->search( { credit_id => $accountline_object->id } );
58
my $letter = C4::Letters::getletter( 'circulation', 'ACCOUNT_CREDIT',
59
    C4::Context::mybranch, 'print', $patron->lang );
83
60
84
$template->param(
61
$template->param(
85
    letter      => $letter,
62
    letter => $letter,
86
    patron      => $patron,
63
    credit => $credit,
87
    library     => C4::Context::mybranch,
88
    offsets     => \@account_offsets,
89
    credit      => $accountline_object,
90
91
    finesview   => 1,
92
    total       => $total,
93
    totalcredit => $totalcredit,
94
    accounts    => [$accountline],        # FIXME There is always only 1 row!
95
64
96
    change_given => $change_given,
65
    tendered => scalar $input->param('tendered'),
66
    change   => scalar $input->param('change')
97
);
67
);
98
68
99
output_html_with_http_headers $input, $cookie, $template->output;
69
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/members/printinvoice.pl (-52 / +26 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-93 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 = CGI->new;
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
        flagsrequired => { borrowers => 'edit_borrowers', updatecharges => 'remaining_permissions' },
36
        flagsrequired   => {
43
        debug           => 1,
37
            borrowers     => 'edit_borrowers',
38
            updatecharges => 'remaining_permissions'
39
        }
44
    }
40
    }
45
);
41
);
46
42
47
my $borrowernumber  = $input->param('borrowernumber');
43
my $debit_id = $input->param('accountlines_id');
48
my $action          = $input->param('action') || '';
44
my $debit = Koha::Account::Lines->find($debit_id);
49
my $accountlines_id = $input->param('accountlines_id');
45
my $patron = $debit->patron;
50
46
51
my $logged_in_user = Koha::Patrons->find( $loggedinuser );
47
my $logged_in_user = Koha::Patrons->find($loggedinuser) or die "Not logged in";
52
my $patron         = Koha::Patrons->find( $borrowernumber );
48
output_and_exit_if_error(
53
output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
49
    $input, $cookie,
54
50
    $template,
55
#get account details
51
    {
56
my $total = $patron->account->balance;
52
        module         => 'members',
57
my $accountline_object = Koha::Account::Lines->find($accountlines_id);
53
        logged_in_user => $logged_in_user,
58
my $accountline = $accountline_object->unblessed;
54
        current_patron => $patron
59
55
    }
60
my $totalcredit;
56
);
61
if ( $total <= 0 ) {
62
    $totalcredit = 1;
63
}
64
65
66
$accountline->{'amount'} += 0.00;
67
if ( $accountline->{'amount'} <= 0 ) {
68
    $accountline->{'amountcredit'} = 1;
69
    $accountline->{'amount'} *= -1.00;
70
}
71
$accountline->{'amountoutstanding'} += 0.00;
72
if ( $accountline->{'amountoutstanding'} <= 0 ) {
73
    $accountline->{'amountoutstandingcredit'} = 1;
74
}
75
76
my @account_offsets = Koha::Account::Offsets->search( { debit_id => $accountline_object->id } );
77
57
78
my $letter = C4::Letters::getletter( 'circulation', 'ACCOUNT_DEBIT', C4::Context::mybranch, 'print', $patron->lang );
58
my $letter = C4::Letters::getletter( 'circulation', 'ACCOUNT_DEBIT',
59
    C4::Context::mybranch, 'print', $patron->lang );
79
60
80
$template->param(
61
$template->param(
81
    letter  => $letter,
62
    letter  => $letter,
82
    patron  => $patron,
63
    debit   => $debit
83
    library => C4::Context::mybranch,
84
    offsets => \@account_offsets,
85
    debit   => $accountline_object,
86
64
87
    finesview   => 1,
88
    total       => sprintf( "%.2f", $total ),
89
    totalcredit => $totalcredit,
90
    accounts    => [$accountline],           # FIXME There is always only 1 row!
91
);
65
);
92
66
93
output_html_with_http_headers $input, $cookie, $template->output;
67
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/pos/printreceipt.pl (-14 / +12 lines)
Lines 36-66 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
36
    }
36
    }
37
);
37
);
38
38
39
my $action = $input->param('action') || '';
40
my $payment_id = $input->param('accountlines_id');
39
my $payment_id = $input->param('accountlines_id');
40
my $payment    = Koha::Account::Lines->find($payment_id);
41
my $patron     = $payment->patron;
41
42
42
my $logged_in_user = Koha::Patrons->find($loggedinuser) or die "Not logged in";
43
my $logged_in_user = Koha::Patrons->find($loggedinuser) or die "Not logged in";
43
output_and_exit_if_error(
44
output_and_exit_if_error(
44
    $input, $cookie,
45
    $input, $cookie,
45
    $template,
46
    $template,
46
    {
47
    {
47
        module         => 'pos',
48
        module         => 'members',
48
        logged_in_user => $logged_in_user,
49
        logged_in_user => $logged_in_user,
50
        current_patron => $patron
49
    }
51
    }
50
);
52
) if $patron;    # Payment could have been anonymous
51
52
my $payment = Koha::Account::Lines->find($payment_id);
53
my @offsets = Koha::Account::Offsets->search( { credit_id => $payment_id } );
54
53
55
my $letter =
54
my $letter = C4::Letters::getletter( 'pos', 'RECEIPT',
56
  C4::Letters::getletter( 'pos', 'RECEIPT', C4::Context::mybranch, 'print' );
55
    C4::Context::mybranch, 'print', $patron->lang );
57
56
58
$template->param(
57
$template->param(
59
    letter    => $letter,
58
    letter  => $letter,
60
    payment   => $payment,
59
    payment => $payment,
61
    offsets   => \@offsets,
60
62
    collected => scalar $input->param('collected'),
61
    tendered => scalar $input->param('tendered'),
63
    change    => scalar $input->param('change')
62
    change   => scalar $input->param('change')
64
);
63
);
65
64
66
output_html_with_http_headers $input, $cookie, $template->output;
65
output_html_with_http_headers $input, $cookie, $template->output;
67
- 

Return to bug 26734