1 <& 'elements/search.html',
5 'count_query' => $count_query,
15 my $date = $_[0]->_date;
16 $date ? time2str('%Y-%m-%d %T',$_[0]->_date) : ''
21 sub { encode_entities($_[0]->error) },
32 'color' => [ ('') x 3,
36 'html_init' => $html_init,
37 'really_disable_download' => 1,
42 unless $FS::CurrentUser::CurrentUser->access_right('View customers of all agents');
44 my $conf = new FS::Conf;
46 my $title = 'Outgoing Message Log';
49 if ( $cgi->param('status') =~ /^(\w+)$/ ) {
50 push @where, "status = '$1'";
52 my ($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi, '');
53 push @where, "(_date >= $beginning AND _date <= $ending)";
55 my $order_by = '_date';
56 if ( $cgi->param('order_by') =~ /^(\w+)$/ ) {
61 $where = ' WHERE '.join(' AND ', @where) if @where;
63 'table' => 'cust_msg',
64 'select' => join(', ',
66 'msg_template.msgname',
68 'addl_from' => ' LEFT JOIN msg_template USING ( msgnum )',
70 'extra_sql' => $where,
71 'order_by' => "ORDER BY $order_by",
73 my $count_query = 'SELECT COUNT(*) FROM cust_msg'.$where;
75 my $sub_popup_link = sub {
76 my $custmsgnum = $_[0]->custmsgnum;
77 include('/elements/popup_link_onclick.html',
78 'action' => $p. 'view/cust_msg.html?' . $custmsgnum,
79 'actionlabel' => 'Message detail',
86 'prepared' => '0000FF',
90 my $statuscolor = sub { $color{$_[0]->status} };
92 my $html_init = qq!<FORM ACTION="$p/search/cust_msg.html" METHOD="GET">
93 <TABLE cellspacing="10">!.
95 include('/elements/input-date-field.html',
96 { 'name' => 'beginning', 'value' => $cgi->param('beginning') }
99 include('/elements/input-date-field.html',
100 { 'name' => 'ending', 'value' => ($cgi->param('ending') || ''),
104 include('/elements/select.html',
106 'curr_value' => $cgi->param('status') || '',
107 'options' => [ '', 'failed', 'sent', 'prepared' ],
108 'labels' => { '' => '(any)',
109 'failed' => 'failed',
111 'prepared'=> 'prepared' },
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}