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

(-)a/C4/Letters.pm (+25 lines)
Lines 31-36 use Try::Tiny; Link Here
31
use C4::Members;
31
use C4::Members;
32
use C4::Log;
32
use C4::Log;
33
use C4::SMS;
33
use C4::SMS;
34
use C4::Templates;
34
use C4::Debug;
35
use C4::Debug;
35
use Koha::DateUtils;
36
use Koha::DateUtils;
36
use Koha::SMS::Providers;
37
use Koha::SMS::Providers;
Lines 784-791 sub _parseletter_sth { Link Here
784
    #       broke things for the rest of us. prepare_cached is a better
785
    #       broke things for the rest of us. prepare_cached is a better
785
    #       way to cache statement handles anyway.
786
    #       way to cache statement handles anyway.
786
    my $query = 
787
    my $query = 
788
    ($table eq 'accountlines' )    ? "SELECT * FROM $table WHERE   accountlines_id = ?"                               :
787
    ($table eq 'biblio'       )    ? "SELECT * FROM $table WHERE   biblionumber = ?"                                  :
789
    ($table eq 'biblio'       )    ? "SELECT * FROM $table WHERE   biblionumber = ?"                                  :
788
    ($table eq 'biblioitems'  )    ? "SELECT * FROM $table WHERE   biblionumber = ?"                                  :
790
    ($table eq 'biblioitems'  )    ? "SELECT * FROM $table WHERE   biblionumber = ?"                                  :
791
    ($table eq 'credits'      )    ? "SELECT * FROM accountlines WHERE   accountlines_id = ?"                         :
792
    ($table eq 'debits'       )    ? "SELECT * FROM accountlines WHERE   accountlines_id = ?"                         :
789
    ($table eq 'items'        )    ? "SELECT * FROM $table WHERE     itemnumber = ?"                                  :
793
    ($table eq 'items'        )    ? "SELECT * FROM $table WHERE     itemnumber = ?"                                  :
790
    ($table eq 'issues'       )    ? "SELECT * FROM $table WHERE     itemnumber = ?"                                  :
794
    ($table eq 'issues'       )    ? "SELECT * FROM $table WHERE     itemnumber = ?"                                  :
791
    ($table eq 'old_issues'   )    ? "SELECT * FROM $table WHERE     itemnumber = ? ORDER BY timestamp DESC LIMIT 1"  :
795
    ($table eq 'old_issues'   )    ? "SELECT * FROM $table WHERE     itemnumber = ? ORDER BY timestamp DESC LIMIT 1"  :
Lines 1520-1525 sub _process_tt { Link Here
1520
    my $loops = $params->{loops};
1524
    my $loops = $params->{loops};
1521
    my $substitute = $params->{substitute} || {};
1525
    my $substitute = $params->{substitute} || {};
1522
1526
1527
    my $htdocs = C4::Context->config('intrahtdocs');
1528
    my ($theme, $lang, $activethemes)= C4::Templates::themelanguage( $htdocs, 'about.tt', 'intranet');
1529
    my @includes;
1530
    foreach (@$activethemes) {
1531
        push @includes, "$htdocs/$_/$lang/includes";
1532
        push @includes, "$htdocs/$_/en/includes" unless $lang eq 'en';
1533
    }
1534
1523
    my $use_template_cache = C4::Context->config('template_cache_dir') && defined $ENV{GATEWAY_INTERFACE};
1535
    my $use_template_cache = C4::Context->config('template_cache_dir') && defined $ENV{GATEWAY_INTERFACE};
1524
    my $template           = Template->new(
1536
    my $template           = Template->new(
1525
        {
1537
        {
Lines 1528-1533 sub _process_tt { Link Here
1528
            PLUGIN_BASE  => 'Koha::Template::Plugin',
1540
            PLUGIN_BASE  => 'Koha::Template::Plugin',
1529
            COMPILE_EXT  => $use_template_cache ? '.ttc' : '',
1541
            COMPILE_EXT  => $use_template_cache ? '.ttc' : '',
1530
            COMPILE_DIR  => $use_template_cache ? C4::Context->config('template_cache_dir') : '',
1542
            COMPILE_DIR  => $use_template_cache ? C4::Context->config('template_cache_dir') : '',
1543
            INCLUDE_PATH => \@includes,
1531
            FILTERS      => {},
1544
            FILTERS      => {},
1532
            ENCODING     => 'UTF-8',
1545
            ENCODING     => 'UTF-8',
1533
        }
1546
        }
Lines 1587-1592 sub _get_tt_params { Link Here
1587
            plural   => 'branches',
1600
            plural   => 'branches',
1588
            pk       => 'branchcode',
1601
            pk       => 'branchcode',
1589
        },
1602
        },
1603
        credits => {
1604
            module => 'Koha::Account::Lines',
1605
            singular => 'credit',
1606
            plural => 'credits',
1607
            pk => 'accountlines_id',
1608
        },
1609
        debits => {
1610
            module => 'Koha::Account::Lines',
1611
            singular => 'debit',
1612
            plural => 'debits',
1613
            pk => 'accountlines_id',
1614
        },
1590
        items => {
1615
        items => {
1591
            module   => 'Koha::Items',
1616
            module   => 'Koha::Items',
1592
            singular => 'item',
1617
            singular => 'item',
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/printfeercpt.tt (-6 / +15 lines)
Lines 1-16 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE Asset %]
2
[% USE Asset %]
3
[% USE Koha %]
3
[% USE Koha %]
4
[% USE KohaDates %]
5
[% USE Branches %]
6
[% USE Price %]
7
[% SET footerjs = 1 %]
4
[% SET footerjs = 1 %]
8
5
9
[% PROCESS 'accounts.inc' %]
10
11
[% INCLUDE 'doc-head-open.inc' %]
6
[% INCLUDE 'doc-head-open.inc' %]
12
<title>Print receipt for [% patron.cardnumber | html %]</title>
7
<title>Print receipt for [% patron.cardnumber | html %]</title>
13
[% INCLUDE 'doc-head-close.inc' %]
8
[% INCLUDE 'doc-head-close.inc' %]
9
10
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
11
<link rel="shortcut icon" href="[% IF ( IntranetFavicon ) %][% IntranetFavicon | url %][% ELSE %][% interface | html %]/[% theme | html %]/img/favicon.ico[% END %]" type="image/x-icon" />
12
14
[% Asset.css("css/printreceiptinvoice.css") | $raw %]
13
[% Asset.css("css/printreceiptinvoice.css") | $raw %]
15
[% INCLUDE 'blocking_errors.inc' %]
14
[% INCLUDE 'blocking_errors.inc' %]
16
</head>
15
</head>
Lines 18-24 Link Here
18
<body id="pat_printfeercpt" class="pat">
17
<body id="pat_printfeercpt" class="pat">
19
18
20
<div id="receipt">
19
<div id="receipt">
21
    [% letter.content | $raw | evaltt %]
20
  [% IF slip %]
21
    [% IF plain %]
22
    <pre>
23
      [% slip | html %]
24
    </pre>
25
    [% ELSE %]
26
      [% slip | $raw %]
27
    [% END %]
28
  [% ELSE %]
29
    No print template found
30
  [% END %]
22
</div>
31
</div>
23
32
24
[% MACRO jsinclude BLOCK %]
33
[% MACRO jsinclude BLOCK %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/printinvoice.tt (-6 / +16 lines)
Lines 1-23 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE Asset %]
2
[% USE Asset %]
3
[% USE Koha %]
3
[% USE Koha %]
4
[% USE Branches %]
5
[% USE KohaDates %]
6
[% USE Price %]
7
[% SET footerjs = 1 %]
4
[% SET footerjs = 1 %]
8
5
9
[% PROCESS 'accounts.inc' %]
10
11
[% INCLUDE 'doc-head-open.inc' %]
6
[% INCLUDE 'doc-head-open.inc' %]
12
<title>Print receipt for [% patron.cardnumber | html %]</title>
7
<title>Print receipt for [% patron.cardnumber | html %]</title>
13
[% INCLUDE 'doc-head-close.inc' %]
8
[% INCLUDE 'doc-head-close.inc' %]
9
10
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
11
<link rel="shortcut icon" href="[% IF ( IntranetFavicon ) %][% IntranetFavicon | url %][% ELSE %][% interface | html %]/[% theme | html %]/img/favicon.ico[% END %]" type="image/x-icon" />
12
14
[% Asset.css("css/printreceiptinvoice.css") | $raw %]
13
[% Asset.css("css/printreceiptinvoice.css") | $raw %]
14
[% INCLUDE 'blocking_errors.inc' %]
15
</head>
15
</head>
16
16
17
<body id="printinvoice" class="pat">
17
<body id="printinvoice" class="pat">
18
18
19
<div id="receipt">
19
<div id="receipt">
20
    [% letter.content | $raw | evaltt %]
20
  [% IF slip %]
21
    [% IF plain %]
22
    <pre>
23
      [% slip | html %]
24
    </pre>
25
    [% ELSE %]
26
      [% slip | $raw %]
27
    [% END %]
28
  [% ELSE %]
29
    No print template found
30
  [% END %]
21
</div>
31
</div>
22
32
23
[% MACRO jsinclude BLOCK %]
33
[% MACRO jsinclude BLOCK %]
(-)a/members/printfeercpt.pl (-11 / +22 lines)
Lines 30-39 my $input = CGI->new; Link Here
30
30
31
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
31
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
32
    {
32
    {
33
        template_name   => "members/printfeercpt.tt",
33
        template_name => "members/printfeercpt.tt",
34
        query           => $input,
34
        query         => $input,
35
        type            => "intranet",
35
        type          => "intranet",
36
        flagsrequired   => {
36
        flagsrequired => {
37
            borrowers     => 'edit_borrowers',
37
            borrowers     => 'edit_borrowers',
38
            updatecharges => 'remaining_permissions'
38
            updatecharges => 'remaining_permissions'
39
        }
39
        }
Lines 55-69 output_and_exit_if_error( Link Here
55
    }
55
    }
56
);
56
);
57
57
58
my $letter = C4::Letters::getletter( 'circulation', 'ACCOUNT_CREDIT',
58
my $letter = C4::Letters::GetPreparedLetter(
59
    C4::Context::mybranch, 'print', $patron->lang );
59
    module                 => 'circulation',
60
    letter_code            => 'ACCOUNT_CREDIT',
61
    branchcode             => C4::Context::mybranch,
62
    message_transport_type => 'print',
63
    lang                   => $patron->lang,
64
    tables                 => {
65
        credits   => $credit_id,
66
        borrowers => $patron->borrowernumber
67
    },
68
    substitute => {
69
        tendered => scalar $input->param('tendered'),
70
        change   => scalar $input->param('change')
71
    }
72
);
60
73
61
$template->param(
74
$template->param(
62
    letter => $letter,
75
    slip   => $letter->{content},
63
    credit => $credit,
76
    plain  => !$letter->{is_html},
64
77
    patron => $patron,
65
    tendered => scalar $input->param('tendered'),
66
    change   => scalar $input->param('change')
67
);
78
);
68
79
69
output_html_with_http_headers $input, $cookie, $template->output;
80
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/members/printinvoice.pl (-12 / +20 lines)
Lines 30-39 my $input = CGI->new; Link Here
30
30
31
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
31
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
32
    {
32
    {
33
        template_name   => "members/printinvoice.tt",
33
        template_name => "members/printinvoice.tt",
34
        query           => $input,
34
        query         => $input,
35
        type            => "intranet",
35
        type          => "intranet",
36
        flagsrequired   => {
36
        flagsrequired => {
37
            borrowers     => 'edit_borrowers',
37
            borrowers     => 'edit_borrowers',
38
            updatecharges => 'remaining_permissions'
38
            updatecharges => 'remaining_permissions'
39
        }
39
        }
Lines 41-48 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
41
);
41
);
42
42
43
my $debit_id = $input->param('accountlines_id');
43
my $debit_id = $input->param('accountlines_id');
44
my $debit = Koha::Account::Lines->find($debit_id);
44
my $debit    = Koha::Account::Lines->find($debit_id);
45
my $patron = $debit->patron;
45
my $patron   = $debit->patron;
46
46
47
my $logged_in_user = Koha::Patrons->find($loggedinuser) or die "Not logged in";
47
my $logged_in_user = Koha::Patrons->find($loggedinuser) or die "Not logged in";
48
output_and_exit_if_error(
48
output_and_exit_if_error(
Lines 55-67 output_and_exit_if_error( Link Here
55
    }
55
    }
56
);
56
);
57
57
58
my $letter = C4::Letters::getletter( 'circulation', 'ACCOUNT_DEBIT',
58
my $letter = C4::Letters::GetPreparedLetter(
59
    C4::Context::mybranch, 'print', $patron->lang );
59
    module                 => 'circulation',
60
    letter_code            => 'ACCOUNT_DEBIT',
61
    branchcode             => C4::Context::mybranch,
62
    message_transport_type => 'print',
63
    lang                   => $patron->lang,
64
    tables                 => {
65
        debits    => $debit_id,
66
        borrowers => $patron->borrowernumber
67
    }
68
);
60
69
61
$template->param(
70
$template->param(
62
    letter  => $letter,
71
    slip   => $letter->{content},
63
    debit   => $debit
72
    plain  => !$letter->{is_html},
64
73
    patron => $patron,
65
);
74
);
66
75
67
output_html_with_http_headers $input, $cookie, $template->output;
76
output_html_with_http_headers $input, $cookie, $template->output;
68
- 

Return to bug 26734