Lines 42-47
Link Here
|
42 |
|
42 |
|
43 |
use Modern::Perl; |
43 |
use Modern::Perl; |
44 |
use CGI qw ( -utf8 ); |
44 |
use CGI qw ( -utf8 ); |
|
|
45 |
use Template; |
46 |
|
45 |
use C4::Auth qw( get_template_and_user ); |
47 |
use C4::Auth qw( get_template_and_user ); |
46 |
use C4::Context; |
48 |
use C4::Context; |
47 |
use C4::Output qw( output_html_with_http_headers ); |
49 |
use C4::Output qw( output_html_with_http_headers ); |
Lines 90-101
our $my_branch = C4::Context->preference("IndependentBranches") && !$staffflags-
Link Here
|
90 |
|
92 |
|
91 |
$template->param( |
93 |
$template->param( |
92 |
independant_branch => $my_branch, |
94 |
independant_branch => $my_branch, |
93 |
script_name => $script_name, |
95 |
script_name => $script_name, |
94 |
searchfield => $searchfield, |
96 |
searchfield => $searchfield, |
95 |
branchcode => $branchcode, |
97 |
branchcode => $branchcode, |
96 |
section => $section, |
98 |
section => $section, |
97 |
langtab => $langtab, |
99 |
langtab => $langtab, |
98 |
action => $script_name |
100 |
action => $script_name |
99 |
); |
101 |
); |
100 |
|
102 |
|
101 |
if ( $op eq 'add_validate' or $op eq 'copy_validate' ) { |
103 |
if ( $op eq 'add_validate' or $op eq 'copy_validate' ) { |
Lines 196-201
sub add_form {
Link Here
|
196 |
my $lang; |
198 |
my $lang; |
197 |
# The letter name is contained into each mtt row. |
199 |
# The letter name is contained into each mtt row. |
198 |
# So we can only sent the first one to the template. |
200 |
# So we can only sent the first one to the template. |
|
|
201 |
my $tt = Template->new( |
202 |
{ |
203 |
EVAL_PERL => 1, |
204 |
ABSOLUTE => 1, |
205 |
PLUGIN_BASE => 'Koha::Template::Plugin', |
206 |
FILTERS => {}, |
207 |
ENCODING => 'UTF-8', |
208 |
} |
209 |
); |
210 |
|
199 |
for my $letter ( @$letters ) { |
211 |
for my $letter ( @$letters ) { |
200 |
# The letter_name |
212 |
# The letter_name |
201 |
if ( $first_flag_name and $letter->{name} ) { |
213 |
if ( $first_flag_name and $letter->{name} ) { |
Lines 205-210
sub add_form {
Link Here
|
205 |
$first_flag_name = 0; |
217 |
$first_flag_name = 0; |
206 |
} |
218 |
} |
207 |
|
219 |
|
|
|
220 |
my $output; |
221 |
my $template = $letter->{content}; |
222 |
unless ( $tt->process( \$template, {}, \$output ) ) { |
223 |
$letter->{tt_error} = $tt->error(); |
224 |
} |
225 |
|
208 |
my $lang = $letter->{lang}; |
226 |
my $lang = $letter->{lang}; |
209 |
my $mtt = $letter->{message_transport_type}; |
227 |
my $mtt = $letter->{message_transport_type}; |
210 |
$letters{ $lang }{templates}{$mtt} = { |
228 |
$letters{ $lang }{templates}{$mtt} = { |
Lines 213-218
sub add_form {
Link Here
|
213 |
updated_on => $letter->{updated_on}, |
231 |
updated_on => $letter->{updated_on}, |
214 |
title => $letter->{title}, |
232 |
title => $letter->{title}, |
215 |
content => $letter->{content} // '', |
233 |
content => $letter->{content} // '', |
|
|
234 |
tt_error => $letter->{tt_error}, |
216 |
}; |
235 |
}; |
217 |
} |
236 |
} |
218 |
} |
237 |
} |
Lines 445-450
sub default_display {
Link Here
|
445 |
|
464 |
|
446 |
my $loop_data = []; |
465 |
my $loop_data = []; |
447 |
my $protected_letters = protected_letters(); |
466 |
my $protected_letters = protected_letters(); |
|
|
467 |
|
448 |
foreach my $row (@{$results}) { |
468 |
foreach my $row (@{$results}) { |
449 |
$row->{protected} = !$row->{branchcode} && $protected_letters->{ $row->{code} }; |
469 |
$row->{protected} = !$row->{branchcode} && $protected_letters->{ $row->{code} }; |
450 |
push @{$loop_data}, $row; |
470 |
push @{$loop_data}, $row; |
451 |
- |
|
|