From: Ivan Kohler Date: Sun, 17 Aug 2014 23:26:41 +0000 (-0700) Subject: user pref for # of customers on dashboard, RT#29794 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=2f55a20e4ca789d73cda7463f5edfce0049ee18d user pref for # of customers on dashboard, RT#29794 --- diff --git a/httemplate/index.html b/httemplate/index.html index 342d88c77..ea8d7578e 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -11,45 +11,49 @@ % <& /elements/dashboard-toplist.html &> -% warn time.": fetching recently changed customers\n" if $debug; +% my $curuser = $FS::CurrentUser::CurrentUser; +% my $numcust = $curuser->option('dashboard_customers'); +% $numcust ||= 10 unless $numcust =~ /^\s*0+\s*$/; +% if ( $numcust ) { % -% my $sth = dbh->prepare( -% #"SELECT DISTINCT custnum FROM h_cust_main JOIN cust_main USING ( custnum ) -% "SELECT custnum FROM h_cust_main JOIN cust_main USING ( custnum ) -% WHERE ( history_action = 'insert' OR history_action = 'replace_new' ) -% AND ( history_usernum = ? OR history_user = ? ) -% ORDER BY history_date desc" # LIMIT 10 -% ) or die dbh->errstr; +% warn time.": fetching recently changed customers\n" if $debug; % -% my $curuser = $FS::CurrentUser::CurrentUser; +% my $sth = dbh->prepare( +% #"SELECT DISTINCT custnum FROM h_cust_main JOIN cust_main USING ( custnum ) +% "SELECT custnum FROM h_cust_main JOIN cust_main USING ( custnum ) +% WHERE ( history_action = 'insert' OR history_action = 'replace_new' ) +% AND ( history_usernum = ? OR history_user = ? ) +% ORDER BY history_date desc LIMIT 1000" # LIMIT 10 +% ) or die dbh->errstr; % -% $sth->execute( $curuser->usernum, $curuser->username ) or die $sth->errstr; % -% my %saw = (); -% my @custnums = grep { !$saw{$_}++ } map $_->[0], @{ $sth->fetchall_arrayref }; +% $sth->execute( $curuser->usernum, $curuser->username ) or die $sth->errstr; % -% @custnums = splice(@custnums, 0, 10); +% my %saw = (); +% my @custnums = grep { !$saw{$_}++ } map $_->[0], @{ $sth->fetchall_arrayref }; % -% if ( @custnums ) { -% warn time.": displaying recently changed customers\n" if $debug; +% @custnums = splice(@custnums, 0, $numcust); +% +% if ( @custnums ) { +% warn time.": displaying recently changed customers\n" if $debug; - <& /elements/table-grid.html &> + <& /elements/table-grid.html &> -% my $bgcolor1 = '#eeeeee'; +% my $bgcolor1 = '#eeeeee'; % my $bgcolor2 = '#ffffff'; % my $bgcolor = $bgcolor2; - - <% mt('Customers I recently added or modified') |h %> - + + <% mt('Customers I recently added or modified') |h %> + -% foreach my $custnum ( @custnums ) { -% my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ); -% next unless $cust_main; +% foreach my $custnum ( @custnums ) { +% my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ); +% next unless $cust_main; - - <% $cust_main->display_custnum %>: <% $cust_main->name |h %> - + + <% $cust_main->display_custnum %>: <% $cust_main->name |h %> + % if ( $bgcolor eq $bgcolor1 ) { % $bgcolor = $bgcolor2; @@ -57,10 +61,11 @@ % $bgcolor = $bgcolor1; % } % -% } +% } - + -% } +% } +% } <& /elements/footer.html &> diff --git a/httemplate/pref/pref-process.html b/httemplate/pref/pref-process.html index 6d4f89a77..887e58bde 100644 --- a/httemplate/pref/pref-process.html +++ b/httemplate/pref/pref-process.html @@ -54,7 +54,7 @@ unless ( $error ) { # if ($access_user) { spreadsheet_format mobile_menu enable_fuzzy_on_exact disable_html_editor disable_enter_submit_onetimecharge - enable_mask_clipboard_hack + enable_mask_clipboard_hack dashboard_customers email_address snom-ip snom-username snom-password vonage-fromnumber vonage-username vonage-password diff --git a/httemplate/pref/pref.html b/httemplate/pref/pref.html index eaa7d3281..5455e428e 100644 --- a/httemplate/pref/pref.html +++ b/httemplate/pref/pref.html @@ -80,7 +80,7 @@ Interface Hide package changes: - + <& /elements/select.html, field => 'hide_package_changes', options => [ '', 'location', 'all' ], @@ -160,6 +160,13 @@ Interface + + How many recently-modified customers displayed on dashboard + + + + +