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 1524-1529
sub _process_tt {
Link Here
|
1524 |
my $tables = $params->{tables}; |
1529 |
my $tables = $params->{tables}; |
1525 |
my $loops = $params->{loops}; |
1530 |
my $loops = $params->{loops}; |
1526 |
my $substitute = $params->{substitute} || {}; |
1531 |
my $substitute = $params->{substitute} || {}; |
|
|
1532 |
my $lang = defined($params->{lang}) && $params->{lang} ne 'default' ? $params->{lang} : 'en'; |
1533 |
my ($theme, $activethemes); |
1534 |
|
1535 |
my $htdocs = C4::Context->config('intrahtdocs'); |
1536 |
($theme, $lang, $activethemes)= C4::Templates::activethemes( $htdocs, 'about.tt', 'intranet', $lang); |
1537 |
my @includes; |
1538 |
foreach (@$activethemes) { |
1539 |
push @includes, "$htdocs/$_/$lang/includes"; |
1540 |
push @includes, "$htdocs/$_/en/includes" unless $lang eq 'en'; |
1541 |
} |
1527 |
|
1542 |
|
1528 |
my $use_template_cache = C4::Context->config('template_cache_dir') && defined $ENV{GATEWAY_INTERFACE}; |
1543 |
my $use_template_cache = C4::Context->config('template_cache_dir') && defined $ENV{GATEWAY_INTERFACE}; |
1529 |
my $template = Template->new( |
1544 |
my $template = Template->new( |
Lines 1533-1538
sub _process_tt {
Link Here
|
1533 |
PLUGIN_BASE => 'Koha::Template::Plugin', |
1548 |
PLUGIN_BASE => 'Koha::Template::Plugin', |
1534 |
COMPILE_EXT => $use_template_cache ? '.ttc' : '', |
1549 |
COMPILE_EXT => $use_template_cache ? '.ttc' : '', |
1535 |
COMPILE_DIR => $use_template_cache ? C4::Context->config('template_cache_dir') : '', |
1550 |
COMPILE_DIR => $use_template_cache ? C4::Context->config('template_cache_dir') : '', |
|
|
1551 |
INCLUDE_PATH => \@includes, |
1536 |
FILTERS => {}, |
1552 |
FILTERS => {}, |
1537 |
ENCODING => 'UTF-8', |
1553 |
ENCODING => 'UTF-8', |
1538 |
} |
1554 |
} |
Lines 1592-1597
sub _get_tt_params {
Link Here
|
1592 |
plural => 'branches', |
1608 |
plural => 'branches', |
1593 |
pk => 'branchcode', |
1609 |
pk => 'branchcode', |
1594 |
}, |
1610 |
}, |
|
|
1611 |
credits => { |
1612 |
module => 'Koha::Account::Lines', |
1613 |
singular => 'credit', |
1614 |
plural => 'credits', |
1615 |
pk => 'accountlines_id', |
1616 |
}, |
1617 |
debits => { |
1618 |
module => 'Koha::Account::Lines', |
1619 |
singular => 'debit', |
1620 |
plural => 'debits', |
1621 |
pk => 'accountlines_id', |
1622 |
}, |
1595 |
items => { |
1623 |
items => { |
1596 |
module => 'Koha::Items', |
1624 |
module => 'Koha::Items', |
1597 |
singular => 'item', |
1625 |
singular => 'item', |