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');
46 my $conf = new FS::Conf;
48 my $title = 'Outgoing Message Log';
51 if ( $cgi->param('status') =~ /^(\w+)$/ ) {
52 push @where, "status = '$1'";
54 my ($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi, '');
55 push @where, "(_date >= $beginning AND _date <= $ending)";
57 my $order_by = '_date';
58 if ( $cgi->param('order_by') =~ /^(\w+)$/ ) {
63 $where = ' WHERE '.join(' AND ', @where) if @where;
65 'table' => 'cust_msg',
66 'select' => join(', ',
68 'msg_template.msgname',
70 'addl_from' => ' LEFT JOIN msg_template USING ( msgnum )',
72 'extra_sql' => $where,
73 'order_by' => "ORDER BY $order_by",
75 my $count_query = 'SELECT COUNT(*) FROM cust_msg'.$where;
77 my $sub_popup_link = sub {
78 my $custmsgnum = $_[0]->custmsgnum;
79 include('/elements/popup_link_onclick.html',
80 'action' => $p. 'view/cust_msg.html?' . $custmsgnum,
81 'actionlabel' => 'Message detail',
91 my $statuscolor = sub { $color{$_[0]->status} };
93 my $html_init = qq!<FORM ACTION="$p/search/cust_msg.html" METHOD="GET">
94 <TABLE cellspacing="10">!.
96 include('/elements/input-date-field.html',
97 { 'name' => 'beginning', 'value' => $cgi->param('beginning') }
100 include('/elements/input-date-field.html',
101 { 'name' => 'ending', 'value' => ($cgi->param('ending') || ''),
105 include('/elements/select.html',
107 'curr_value' => $cgi->param('status') || '',
108 'options' => [ '', 'failed', 'sent', ],
109 'labels' => { '' => '(any)',
110 'failed' => 'failed',
114 <TD><INPUT type="submit" value="Search"></TD></TR>
116 <STYLE type="text/css">
117 a:link {text-decoration: none}
118 a:visited {text-decoration: none}
119 a:hover {text-decoration: underline}