X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fsearch%2Faccess_user_log.html;h=75bfa13efc0a029b5d28020809ff1100065c01d5;hp=529ae8698f879c3d6c1903d9dbd697c13984644e;hb=e7c2e62ad9e8bbcf6d5c9f2a19c9de77f2a71e64;hpb=53c4589b2950b3ed85bcacfb707430c60cd1021e diff --git a/httemplate/search/access_user_log.html b/httemplate/search/access_user_log.html index 529ae8698..75bfa13ef 100644 --- a/httemplate/search/access_user_log.html +++ b/httemplate/search/access_user_log.html @@ -8,37 +8,60 @@ '#', 'Avg time', ], - 'fields' => [ sub { shift->path }, + 'fields' => [ sub { shift->pretty_path }, sub { shift->num_entries }, sub { shift->avg_render_seconds }, ], - 'sort_fields' => [qw( path num_entries avg_render_seconds )], + 'sort_fields' => [qw( pretty_path num_entries avg_render_seconds )], &> <%init> die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + unless $FS::CurrentUser::CurrentUser->access_right('Employee Reports'); my %hashref = (); my @extra_sql = (); -my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi, '_date'); +my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi); push @extra_sql, "_date >= $beginning" if $beginning; push @extra_sql, "_date <= $ending" if $ending; -$hashref{usernum} = $cgi->param('usernum') if $cgi->param('usernum') =~ /^\d+$/; +my $count_hr = ''; +if ( $cgi->param('usernum') =~ /^\d+$/ ) { + $hashref{usernum} = $cgi->param('usernum'); + $count_hr = "WHERE usernum = ".$hashref{usernum}; +} + +if ( $cgi->param('skip_components') ) { + push @extra_sql, "path NOT IN ( '". join("','", + map "/var/www/html/freeside/$_", qw( + view/REAL_logo.cgi + misc/jsrsServer.html + misc/xmlhttp-reason-hint.html + config/config-image.cgi + misc/xmlhttp-part_pkg_taxproduct.html + misc/progress-popup.html + misc/file-upload.html + misc/confirm-censustract.html + misc/xmlhttp-address_standardize.html + misc/confirm-address_standardize.html + misc/xmlhttp-part_pkg_usageprice.html + ) + ). + "' )"; +} my $extra_sql = ''; $extra_sql .= (keys(%hashref) ? ' AND ' : ' WHERE ' ). join(' AND ', @extra_sql) if @extra_sql; -$extra_sql .= ' GROUP BY path ' +my $count_extra = $extra_sql; +$extra_sql .= ' GROUP BY pretty_path ' if $cgi->param('group_by') eq 'path'; -warn $extra_sql; my $query = { 'select' => join(' , ', - 'path', + "regexp_replace(path, '^/var/www/(html/)?freeside/', '') as pretty_path", 'COUNT(*) AS num_entries', 'ROUND(AVG(COALESCE(render_seconds,0)),1) '. ' AS avg_render_seconds', @@ -48,7 +71,6 @@ my $query = { 'extra_sql' => $extra_sql, }; -#uuh, no, need dates and usernum too, but whatever for now -my $count_query = 'SELECT COUNT(DISTINCT path) FROM access_user_log'; +my $count_query = "SELECT COUNT(DISTINCT path) FROM access_user_log $count_hr $count_extra";