Operator: Move search limit to config from pref
authorBen Klang <ben@alkaloid.net>
Sun, 10 Jan 2010 21:06:33 +0000 (16:06 -0500)
committerBen Klang <ben@alkaloid.net>
Sun, 10 Jan 2010 21:06:33 +0000 (16:06 -0500)
Also fix pref descriptions

operator/config/conf.xml
operator/config/prefs.php.dist
operator/search.php

index 3d96910..3990892 100644 (file)
@@ -12,6 +12,8 @@
     </configsection>
    </case>
   </configswitch>
+  <configinteger name="searchlimit" desc="Maximum number of records to include in CDR searches.  Does not apply to graphs.">5000
+  </configinteger>
  </configsection>
 
  <configstring name="ttf_font" desc="Full path to a True-Type font to use when rendering the graph" required="false" />
index 2c5160e..9b691b8 100644 (file)
@@ -17,15 +17,7 @@ $_prefs['rowsperpage'] = array(
     'locked' => false,
     'shared' => false,
     'type' => 'number',
-    'desc' => _("The columns to be displayed on the Call Detail Review screen")
-);
-
-$_prefs['resultlimit'] = array(
-    'value' => 100,
-    'locked' => false,
-    'shared' => false,
-    'type' => 'number',
-    'desc' => _("Limit the number of CDR results when searching to this number")
+    'desc' => _("Maximum number of call records to show per search result page.")
 );
 
 $_prefs['columns'] = array(
index 30e7cc5..0cda93a 100644 (file)
@@ -27,12 +27,6 @@ if (!$vars->exists('rowstart')) {
     $rowstart = 0;
 }
 
-$numrows = $prefs->getValue('resultlimit');
-if (!is_numeric($numrows)) {
-    $notification->push(_("Invalid number for rows for search limit.  Using 100."));
-    $numrows = 100;
-}
-
 $form = new SearchCDRForm(_("Search Call Detail Records"), $vars);
 if ($form->isSubmitted() && $form->validate($vars, true)) {
     $accountcode = $vars->get('accountcode');
@@ -47,7 +41,8 @@ if ($form->isSubmitted() && $form->validate($vars, true)) {
         $notification->push(_("Invalid date requested."));
     } else {
         $data = $operator->driver->getRecords($start, $end, $accountcode,
-                                             $dcontext, $rowstart, $numrows);
+                                              $dcontext, $rowstart,
+                                              $GLOBALS['conf']['storage']['searchlimit']);
         if (is_a($data, 'PEAR_Error')) {
             $notification->push($data);
             $data = array();