Skip to content

Commit

Permalink
Corrected more undefined index errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamil Tunkiewicz committed Jul 25, 2014
1 parent d4316ef commit 9465ef9
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions src/Bllim/Datatables/Datatables.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* @package Laravel
* @category Bundle
* @version 1.4.0
* @version 1.4.1
* @author Bilal Gultekin <[email protected]>
*/

Expand Down Expand Up @@ -514,10 +514,10 @@ protected function filtering()

for ($i=0,$c=count($this->input['columns']);$i<$c;$i++)
{
if ($this->input['columns'][$i]['orderable'] == "true")
if (isset($columns_copy[$i]) && $this->input['columns'][$i]['orderable'] == "true")
{
// if filter column exists for this columns then use user defined method
if (isset($columns_copy[$i]) && isset($this->filter_columns[$columns_copy[$i]]))
if (isset($this->filter_columns[$columns_copy[$i]]))
{
// check if "or" equivalent exists for given function
// and if the number of parameters given is not excess
Expand Down Expand Up @@ -557,16 +557,12 @@ protected function filtering()
$cast_end = " as TEXT)";
}

// When there's an added column during filtering DT return it and the number of $this->input['search'] is greater than $columns_clean
if (count($columns_clean) > $i)
{
$column = $db_prefix . $columns_clean[$i];

if(Config::get('datatables.search.case_insensitive', false)) {
$query->orwhere(DB::raw('LOWER('.$cast_begin.$column.$cast_end.')'), 'LIKE', strtolower($keyword));
} else {
$query->orwhere(DB::raw($cast_begin.$column.$cast_end), 'LIKE', $keyword);
}
$column = $db_prefix . $columns_clean[$i];

if(Config::get('datatables.search.case_insensitive', false)) {
$query->orwhere(DB::raw('LOWER('.$cast_begin.$column.$cast_end.')'), 'LIKE', strtolower($keyword));
} else {
$query->orwhere(DB::raw($cast_begin.$column.$cast_end), 'LIKE', $keyword);
}
}
}
Expand All @@ -580,10 +576,10 @@ protected function filtering()
// column search
for ($i=0,$c=count($this->input['columns']);$i<$c;$i++)
{
if ($this->input['columns'][$i]['orderable'] == "true" && $this->input['columns'][$i]['search']['value'] != '')
if (isset($columns_copy[$i]) && $this->input['columns'][$i]['orderable'] == "true" && $this->input['columns'][$i]['search']['value'] != '')
{
// if filter column exists for this columns then use user defined method
if (isset($columns_copy[$i]) && isset($this->filter_columns[$columns_copy[$i]]))
if (isset($this->filter_columns[$columns_copy[$i]]))
{
call_user_func_array(
array(
Expand Down

0 comments on commit 9465ef9

Please sign in to comment.