user pref for # of customers on dashboard, RT#29794
authorIvan Kohler <ivan@freeside.biz>
Sun, 17 Aug 2014 23:26:41 +0000 (16:26 -0700)
committerIvan Kohler <ivan@freeside.biz>
Sun, 17 Aug 2014 23:26:41 +0000 (16:26 -0700)
httemplate/index.html
httemplate/pref/pref-process.html
httemplate/pref/pref.html

index 342d88c..ea8d757 100644 (file)
 %
 <& /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;
 
-  <TR>
-    <TH CLASS="grid" BGCOLOR="#cccccc" COLSPAN=1><% mt('Customers I recently added or modified') |h %></TH>
-  </TR>
+        <TR>
+          <TH CLASS="grid" BGCOLOR="#cccccc" COLSPAN=1><% mt('Customers I recently added or modified') |h %></TH>
+        </TR>
 
-% 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; 
 
-    <TR>
-      <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><A HREF="view/cust_main.cgi?<% $custnum %>"><% $cust_main->display_custnum %>: <% $cust_main->name |h %></A></TD>
-    </TR>
+        <TR>
+          <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><A HREF="view/cust_main.cgi?<% $custnum %>"><% $cust_main->display_custnum %>: <% $cust_main->name |h %></A></TD>
+        </TR>
 
 %       if ( $bgcolor eq $bgcolor1 ) {
 %          $bgcolor = $bgcolor2;
 %          $bgcolor = $bgcolor1;
 %        }
 %    
-% } 
+%     
 
-  </TABLE>
+      </TABLE>
 
-% } 
+%   } 
+% }
 
 <& /elements/footer.html &>
index 6d4f89a..887e58b 100644 (file)
@@ -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
index eaa7d32..5455e42 100644 (file)
@@ -80,7 +80,7 @@ Interface
 
   <TR>
     <TH ALIGN="right">Hide package changes: </TH>
-    <TD>
+    <TD COLSPAN=2>
     <& /elements/select.html,
       field   => 'hide_package_changes',
       options => [ '', 'location', 'all' ],
@@ -160,6 +160,13 @@ Interface
     </TD>
   </TR>
 
+  <TR>
+    <TH ALIGN="right">How many recently-modified customers displayed on dashboard</TH>
+    <TD ALIGN="left" COLSPAN=2>
+      <INPUT TYPE="text" NAME="dashboard_customers" VALUE="<% $curuser->option('dashboard_customers') %>"></TD>
+    </TD>
+  </TR>
+
 </TABLE>
 <BR>