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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt (+10 lines)
Lines 106-112 Link Here
106
      [% IF account.amountoutstanding <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amountoutstanding | $Price %]</td>
106
      [% IF account.amountoutstanding <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amountoutstanding | $Price %]</td>
107
      <td class="actions">
107
      <td class="actions">
108
        [% IF ( account.is_credit ) %]
108
        [% IF ( account.is_credit ) %]
109
          [% IF Koha.Preference('UseEmailReceipts') %]
110
          <div class="btn-group">
111
          <button class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-receipt"></i> Receipt <span class="caret"></span></button>
112
          <ul class="dropdown-menu dropdown-menu-right">
113
              <li><a target="_blank" href="printfeercpt.pl?action=print&amp;accountlines_id=[% account.accountlines_id | uri %]" class="receipt-print-action"><i class="fa fa-print"></i> Print</a></li>
114
              <li><a target="_blank" href="printfeercpt.pl?action=email&amp;accountlines_id=[% account.accountlines_id | uri %]" class="receipt-email-action"><i class="fa fa-envelope"></i> Email</a></li>
115
          </ul>
116
          </div>
117
          [% ELSE %]
109
          <a target="_blank" href="printfeercpt.pl?action=print&amp;accountlines_id=[% account.accountlines_id | uri %]" class="btn btn-default btn-xs receipt-print-action"><i class="fa fa-print"></i> Print</a>
118
          <a target="_blank" href="printfeercpt.pl?action=print&amp;accountlines_id=[% account.accountlines_id | uri %]" class="btn btn-default btn-xs receipt-print-action"><i class="fa fa-print"></i> Print</a>
119
          [% END %]
110
        [% ELSE %]
120
        [% ELSE %]
111
          <a target="_blank" href="printinvoice.pl?action=print&amp;accountlines_id=[% account.accountlines_id | uri %]" class="btn btn-default btn-xs invoice-print-action"><i class="fa fa-print"></i> Print</a>
121
          <a target="_blank" href="printinvoice.pl?action=print&amp;accountlines_id=[% account.accountlines_id | uri %]" class="btn btn-default btn-xs invoice-print-action"><i class="fa fa-print"></i> Print</a>
112
        [% END %]
122
        [% END %]
(-)a/members/printfeercpt.pl (-38 / +69 lines)
Lines 21-27 Link Here
21
use Modern::Perl;
21
use Modern::Perl;
22
22
23
use C4::Auth qw( get_template_and_user );
23
use C4::Auth qw( get_template_and_user );
24
use C4::Output qw( output_and_exit_if_error output_and_exit output_html_with_http_headers );
24
use C4::Output
25
  qw( output_and_exit_if_error output_and_exit output_html_with_http_headers );
25
use CGI qw ( -utf8 );
26
use CGI qw ( -utf8 );
26
use C4::Letters;
27
use C4::Letters;
27
use Koha::Account::Lines;
28
use Koha::Account::Lines;
Lines 40-45 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
40
    }
41
    }
41
);
42
);
42
43
44
my $action    = $input->param('action');
43
my $credit_id = $input->param('accountlines_id');
45
my $credit_id = $input->param('accountlines_id');
44
my $credit    = Koha::Account::Lines->find($credit_id);
46
my $credit    = Koha::Account::Lines->find($credit_id);
45
my $patron    = $credit->patron;
47
my $patron    = $credit->patron;
Lines 55-96 output_and_exit_if_error( Link Here
55
    }
57
    }
56
);
58
);
57
59
58
my $letter = C4::Letters::GetPreparedLetter(
60
if ( $action eq 'print' ) {
59
    module                 => 'circulation',
61
    my $letter = C4::Letters::GetPreparedLetter(
60
    letter_code            => 'CREDIT_' . $credit->credit_type_code,
62
        module                 => 'circulation',
61
    branchcode             => C4::Context::mybranch,
63
        letter_code            => 'CREDIT_' . $credit->credit_type_code,
62
    message_transport_type => 'print',
64
        branchcode             => C4::Context::mybranch,
63
    lang                   => $patron->lang,
65
        message_transport_type => 'print',
64
    tables                 => {
66
        lang                   => $patron->lang,
65
        credits   => $credit_id,
67
        tables                 => {
66
        borrowers => $patron->borrowernumber
68
            credits   => $credit_id,
67
    },
69
            borrowers => $patron->borrowernumber
68
    substitute => {
70
        },
69
        tendered => scalar $input->param('tendered'),
71
        substitute => {
70
        change   => scalar $input->param('change')
72
            tendered => scalar $input->param('tendered'),
71
    }
73
            change   => scalar $input->param('change')
72
);
74
        }
75
    );
73
76
74
$letter //= C4::Letters::GetPreparedLetter(
77
    $letter //= C4::Letters::GetPreparedLetter(
75
    module                 => 'circulation',
78
        module                 => 'circulation',
76
    letter_code            => 'ACCOUNT_CREDIT',
79
        letter_code            => 'ACCOUNT_CREDIT',
77
    branchcode             => C4::Context::mybranch,
80
        branchcode             => C4::Context::mybranch,
78
    message_transport_type => 'print',
81
        message_transport_type => 'print',
79
    lang                   => $patron->lang,
82
        lang                   => $patron->lang,
80
    tables                 => {
83
        tables                 => {
81
        credits   => $credit_id,
84
            credits   => $credit_id,
82
        borrowers => $patron->borrowernumber
85
            borrowers => $patron->borrowernumber
83
    },
86
        },
84
    substitute => {
87
        substitute => {
85
        tendered => scalar $input->param('tendered'),
88
            tendered => scalar $input->param('tendered'),
86
        change   => scalar $input->param('change')
89
            change   => scalar $input->param('change')
87
    }
90
        }
88
);
91
    );
89
92
90
$template->param(
93
    $template->param(
91
    slip   => $letter->{content},
94
        slip   => $letter->{content},
92
    plain  => !$letter->{is_html},
95
        plain  => !$letter->{is_html},
93
    patron => $patron,
96
        patron => $patron,
94
);
97
    );
98
99
    output_html_with_http_headers $input, $cookie, $template->output;
100
}
101
elsif ( $action eq 'email' ) {
102
    if (
103
        my $letter = C4::Letters::GetPreparedLetter(
104
            module                 => 'circulation',
105
            letter_code            => uc("ACCOUNT_$type"),
106
            message_transport_type => 'email',
107
            lang                   => $patron->lang,
108
            tables                 => {
109
                borrowers => $patron->borrowernumber,
110
                branches  => $library_id,
111
            },
112
            substitute => {
113
                credit  => $payment,
114
                offsets => \@account_offsets,
115
            },
116
        )
117
      )
118
    {
119
        C4::Letters::EnqueueLetter(
120
            {
121
                letter                 => $letter,
122
                borrowernumber         => $patron->borrowernumber,
123
                message_transport_type => 'email',
124
            }
125
        ) or warn "can't enqueue letter $letter";
126
    }
95
127
96
output_html_with_http_headers $input, $cookie, $template->output;
128
}
97
- 

Return to bug 31448