1 <& 'elements/search.html',
5 'count_query' => $count_query,
15 my $date = $_[0]->_date;
16 $date ? time2str('%Y-%m-%d %T',$_[0]->_date) : ''
20 join('<BR>', split(/,\s*/, $_[0]->env_to) )
23 sub { encode_entities($_[0]->error) },
34 'color' => [ ('') x 3,
38 'html_init' => $html_init,
39 'really_disable_download' => 1,
44 unless $FS::CurrentUser::CurrentUser->access_right('View email logs')
45 || $FS::CurrentUser::CurrentUser->access_right('Configuration');
47 my $conf = new FS::Conf;
49 my $title = 'Outgoing Message Log';
52 if ( $cgi->param('status') =~ /^(\w+)$/ ) {
53 push @where, "status = '$1'";
55 my ($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi, '');
56 push @where, "(_date >= $beginning AND _date <= $ending)";
58 my $order_by = '_date';
59 if ( $cgi->param('order_by') =~ /^(\w+)$/ ) {
64 $where = ' WHERE '.join(' AND ', @where) if @where;
66 'table' => 'cust_msg',
67 'select' => join(', ',
69 'msg_template.msgname',
71 'addl_from' => ' LEFT JOIN msg_template USING ( msgnum )',
73 'extra_sql' => $where,
74 'order_by' => "ORDER BY $order_by",
76 my $count_query = 'SELECT COUNT(*) FROM cust_msg'.$where;
78 my $sub_popup_link = sub {
79 my $custmsgnum = $_[0]->custmsgnum;
80 include('/elements/popup_link_onclick.html',
81 'action' => $p. 'view/cust_msg.html?' . $custmsgnum,
82 'actionlabel' => 'Message detail',
92 my $statuscolor = sub { $color{$_[0]->status} };
94 my $html_init = qq!<FORM ACTION="$p/search/cust_msg.html" METHOD="GET">
95 <TABLE cellspacing="10">!.
97 include('/elements/input-date-field.html',
98 { 'name' => 'beginning', 'value' => $cgi->param('beginning') }
101 include('/elements/input-date-field.html',
102 { 'name' => 'ending', 'value' => ($cgi->param('ending') || ''),
106 include('/elements/select.html',
108 'curr_value' => $cgi->param('status') || '',
109 'options' => [ '', 'failed', 'sent', ],
110 'labels' => { '' => '(any)',
111 'failed' => 'failed',
115 <TD><INPUT type="submit" value="Search"></TD></TR>
117 <STYLE type="text/css">
118 a:link {text-decoration: none}
119 a:visited {text-decoration: none}
120 a:hover {text-decoration: underline}