% include( 'elements/edit.html',
'name_singular' => 'log email condition',
'table' => 'log_email',
'fields' => [
{ 'field' => 'context',
'type' => 'select',
'options' => [ '', @contexts ],
'labels' => { '' => '(all)', map { $_ => $_ } @contexts },
'curr_value' => scalar($cgi->param('context')),
},
{ 'field' => 'context_height',
'type' => 'checkbox',
'postfix' => 'Only match most specific context',
'value' => 1,
'curr_value' => scalar($cgi->param('context_height')),
},
{ 'field' => 'min_level',
'type' => 'select',
'options' => [ &FS::Log::levelnums ],
'labels' => { &FS::Log::levelmap },
'curr_value' => scalar($cgi->param('min_level')),
},
'to_addr',
{ 'field' => 'msgnum',
'type' => 'select-msg_template',
'empty_label' => 'Select template',
'value' => $msgnum,
'required' => 1,
},
],
'labels' => {
'context' => 'Context',
'context_height' => '',
'min_level' => 'Min. Level',
'to_addr' => 'To',
'msgnum' => 'Message',
},
'viewall_dir' => 'browse',
'popup' => $opts{'popup'},
'form_init' => $opts{'popup'} ? q() : '',
)
%>
<%once>
my @contexts = sort FS::log_context->contexts;
%once>
<%init>
my %opts = @_;
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right([ 'View system logs', 'Configuration' ]);
my $msgnum = $cgi->param('msgnum');
# XXX This attempt to set a default message isn't working, not sure why
# $msgnum gets set correctly, but isn't selected in the popup window...fix later
unless ($msgnum) {
my ($msg_template) = qsearch('msg_template',{ msgname => 'System log' });
# doesn't seem worth having a config just for the default selected template
# if they've deleted the system-generated one, just default to empty "Select template"
if ($msg_template) {
$msgnum = $msg_template->msgnum;
}
}
%init>