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 627-639
sub GetPreparedLetter {
Link Here
|
627 |
my %params = @_; |
628 |
my %params = @_; |
628 |
|
629 |
|
629 |
my $letter = $params{letter}; |
630 |
my $letter = $params{letter}; |
|
|
631 |
my $lang = $params{lang} || 'default'; |
630 |
|
632 |
|
631 |
unless ( $letter ) { |
633 |
unless ( $letter ) { |
632 |
my $module = $params{module} or croak "No module"; |
634 |
my $module = $params{module} or croak "No module"; |
633 |
my $letter_code = $params{letter_code} or croak "No letter_code"; |
635 |
my $letter_code = $params{letter_code} or croak "No letter_code"; |
634 |
my $branchcode = $params{branchcode} || ''; |
636 |
my $branchcode = $params{branchcode} || ''; |
635 |
my $mtt = $params{message_transport_type} || 'email'; |
637 |
my $mtt = $params{message_transport_type} || 'email'; |
636 |
my $lang = $params{lang} || 'default'; |
|
|
637 |
|
638 |
|
638 |
$letter = getletter( $module, $letter_code, $branchcode, $mtt, $lang ); |
639 |
$letter = getletter( $module, $letter_code, $branchcode, $mtt, $lang ); |
639 |
|
640 |
|
Lines 728-733
sub GetPreparedLetter {
Link Here
|
728 |
tables => $tables, |
729 |
tables => $tables, |
729 |
loops => $loops, |
730 |
loops => $loops, |
730 |
substitute => $substitute, |
731 |
substitute => $substitute, |
|
|
732 |
lang => $lang |
731 |
} |
733 |
} |
732 |
); |
734 |
); |
733 |
|
735 |
|
Lines 784-791
sub _parseletter_sth {
Link Here
|
784 |
# broke things for the rest of us. prepare_cached is a better |
786 |
# broke things for the rest of us. prepare_cached is a better |
785 |
# way to cache statement handles anyway. |
787 |
# way to cache statement handles anyway. |
786 |
my $query = |
788 |
my $query = |
|
|
789 |
($table eq 'accountlines' ) ? "SELECT * FROM $table WHERE accountlines_id = ?" : |
787 |
($table eq 'biblio' ) ? "SELECT * FROM $table WHERE biblionumber = ?" : |
790 |
($table eq 'biblio' ) ? "SELECT * FROM $table WHERE biblionumber = ?" : |
788 |
($table eq 'biblioitems' ) ? "SELECT * FROM $table WHERE biblionumber = ?" : |
791 |
($table eq 'biblioitems' ) ? "SELECT * FROM $table WHERE biblionumber = ?" : |
|
|
792 |
($table eq 'credits' ) ? "SELECT * FROM accountlines WHERE accountlines_id = ?" : |
793 |
($table eq 'debits' ) ? "SELECT * FROM accountlines WHERE accountlines_id = ?" : |
789 |
($table eq 'items' ) ? "SELECT * FROM $table WHERE itemnumber = ?" : |
794 |
($table eq 'items' ) ? "SELECT * FROM $table WHERE itemnumber = ?" : |
790 |
($table eq 'issues' ) ? "SELECT * FROM $table WHERE itemnumber = ?" : |
795 |
($table eq 'issues' ) ? "SELECT * FROM $table WHERE itemnumber = ?" : |
791 |
($table eq 'old_issues' ) ? "SELECT * FROM $table WHERE itemnumber = ? ORDER BY timestamp DESC LIMIT 1" : |
796 |
($table eq 'old_issues' ) ? "SELECT * FROM $table WHERE itemnumber = ? ORDER BY timestamp DESC LIMIT 1" : |
Lines 1518-1523
sub _process_tt {
Link Here
|
1518 |
my $tables = $params->{tables}; |
1523 |
my $tables = $params->{tables}; |
1519 |
my $loops = $params->{loops}; |
1524 |
my $loops = $params->{loops}; |
1520 |
my $substitute = $params->{substitute} || {}; |
1525 |
my $substitute = $params->{substitute} || {}; |
|
|
1526 |
my $lang = defined($params->{lang}) && $params->{lang} ne 'default' ? $params->{lang} : 'en'; |
1527 |
my ($theme, $activethemes); |
1528 |
|
1529 |
my $htdocs = C4::Context->config('intrahtdocs'); |
1530 |
($theme, $lang, $activethemes)= C4::Templates::activethemes( $htdocs, 'about.tt', 'intranet', $lang); |
1531 |
my @includes; |
1532 |
foreach (@$activethemes) { |
1533 |
push @includes, "$htdocs/$_/$lang/includes"; |
1534 |
push @includes, "$htdocs/$_/en/includes" unless $lang eq 'en'; |
1535 |
} |
1521 |
|
1536 |
|
1522 |
my $use_template_cache = C4::Context->config('template_cache_dir') && defined $ENV{GATEWAY_INTERFACE}; |
1537 |
my $use_template_cache = C4::Context->config('template_cache_dir') && defined $ENV{GATEWAY_INTERFACE}; |
1523 |
my $template = Template->new( |
1538 |
my $template = Template->new( |
Lines 1527-1532
sub _process_tt {
Link Here
|
1527 |
PLUGIN_BASE => 'Koha::Template::Plugin', |
1542 |
PLUGIN_BASE => 'Koha::Template::Plugin', |
1528 |
COMPILE_EXT => $use_template_cache ? '.ttc' : '', |
1543 |
COMPILE_EXT => $use_template_cache ? '.ttc' : '', |
1529 |
COMPILE_DIR => $use_template_cache ? C4::Context->config('template_cache_dir') : '', |
1544 |
COMPILE_DIR => $use_template_cache ? C4::Context->config('template_cache_dir') : '', |
|
|
1545 |
INCLUDE_PATH => \@includes, |
1530 |
FILTERS => {}, |
1546 |
FILTERS => {}, |
1531 |
ENCODING => 'UTF-8', |
1547 |
ENCODING => 'UTF-8', |
1532 |
} |
1548 |
} |
Lines 1586-1591
sub _get_tt_params {
Link Here
|
1586 |
plural => 'branches', |
1602 |
plural => 'branches', |
1587 |
pk => 'branchcode', |
1603 |
pk => 'branchcode', |
1588 |
}, |
1604 |
}, |
|
|
1605 |
credits => { |
1606 |
module => 'Koha::Account::Lines', |
1607 |
singular => 'credit', |
1608 |
plural => 'credits', |
1609 |
pk => 'accountlines_id', |
1610 |
}, |
1611 |
debits => { |
1612 |
module => 'Koha::Account::Lines', |
1613 |
singular => 'debit', |
1614 |
plural => 'debits', |
1615 |
pk => 'accountlines_id', |
1616 |
}, |
1589 |
items => { |
1617 |
items => { |
1590 |
module => 'Koha::Items', |
1618 |
module => 'Koha::Items', |
1591 |
singular => 'item', |
1619 |
singular => 'item', |