Undefined index error fixed by returning a default error if none is set in the database.

This commit is contained in:
Rudi Grinberg 2012-09-11 13:56:48 -04:00
parent e1f4010346
commit 63b1ead363
2 changed files with 10 additions and 4 deletions

View file

@ -73,13 +73,12 @@ class Application_Model_Datatables
$orig2searchTerm[$index] = $d; $orig2searchTerm[$index] = $d;
} }
} }
// map that maps current column position to original position
$current2orig = $librarySetting['ColReorder'];
// map that maps dbname to searchTerm // map that maps dbname to searchTerm
$dbname2searchTerm = array(); $dbname2searchTerm = array();
foreach ($current2dbname as $currentPos=>$dbname) { foreach ($current2dbname as $currentPos=>$dbname) {
$dbname2searchTerm[$dbname] = $orig2searchTerm[$current2orig[$currentPos]]; $dbname2searchTerm[$dbname] =
$orig2searchTerm[$librarySetting($currentPos)];
} }
$where = array(); $where = array();

View file

@ -1130,6 +1130,13 @@ class Application_Model_Preference
public static function getCurrentLibraryTableSetting() public static function getCurrentLibraryTableSetting()
{ {
return unserialize(self::getValue("library_datatable")); $v = self::getValue("library_datatable");
if( $v === '' ) {
return function ($x) { return $x; };
} else {
$ds = unserialize($v);
return function ($x) use ($ds) { return $ds['ColReorder'][$x]; } ;
}
//return unserialize(self::getValue("library_datatable"));
} }
} }