my $module = $input->param('module') || '';
my $content = $input->param('content');
my $op = $input->param('op') || '';
-my $redirect = $input->param('redirect');
+my $redirect = $input->param('redirect');
+my $section = $input->param('section');
+
my $dbh = C4::Context->dbh;
our ( $template, $borrowernumber, $cookie, $staffflags ) = get_template_and_user(
template_name => 'tools/letter.tt',
query => $input,
type => 'intranet',
- authnotrequired => 0,
flagsrequired => { tools => 'edit_notices' },
debug => 1,
}
script_name => $script_name,
searchfield => $searchfield,
branchcode => $branchcode,
+ section => $section,
action => $script_name
);
if ( $op eq 'add_validate' or $op eq 'copy_validate' ) {
add_validate();
if( $redirect eq "just_save" ){
- print $input->redirect("/cgi-bin/koha/tools/letter.pl?op=add_form&branchcode=$branchcode&module=$module&code=$code&redirect=done");
+ print $input->redirect("/cgi-bin/koha/tools/letter.pl?op=add_form&branchcode=$branchcode&module=$module&code=$code&redirect=done§ion=$section");
exit;
} else {
$op = q{}; # we return to the default screen for the next operation
code => $code,
);
my $first_flag_name = 1;
- my ( $lang, @templates );
+ my $lang;
# The letter name is contained into each mtt row.
# So we can only sent the first one to the template.
for my $letter ( @$letters ) {
$letters{ $lang }{templates}{$mtt} = {
message_transport_type => $letter->{message_transport_type},
is_html => $letter->{is_html},
+ updated_on => $letter->{updated_on},
title => $letter->{title},
content => $letter->{content} // '',
};
if ( $module eq 'circulation' and $code and $code =~ /^AR_/ ) {
push @{$field_selection}, add_fields('article_requests');
}
+
+ if ( $module eq 'members' and $code and $code eq 'PROBLEM_REPORT' ) {
+ push @{$field_selection}, add_fields('problem_reports');
+ }
}
my $preview_is_available = 0;
if ($code) {
- $preview_is_available = grep {/^$code$/} qw( CHECKIN CHECKOUT HOLD_SLIP );
+ $preview_is_available = grep {$_ eq $code } qw( CHECKIN CHECKOUT HOLD_SLIP );
}
$template->param(
my @content = $input->multi_param('content');
my @lang = $input->multi_param('lang');
for my $mtt ( @mtt ) {
- my $is_html = $input->param("is_html_$mtt");
+ my $lang = shift @lang;
+ my $is_html = $input->param("is_html_$mtt\_$lang");
my $title = shift @title;
my $content = shift @content;
- my $lang = shift @lang;
my $letter = C4::Letters::getletter( $oldmodule, $code, $branchcode, $mtt, $lang );
# getletter can return the default letter even if we pass a branchcode
my $dbh = C4::Context->dbh;
my ($sql, @where, @args);
- $sql = "SELECT branchcode, module, code, name, branchname
+ $sql = "SELECT branchcode, module, code, name, branchname, MAX(updated_on) as updated_on
FROM letter
LEFT OUTER JOIN branches USING (branchcode)
";