Issue Bug Closed

#59957Duplicate code respectively not used variable in sysext\backend\Classes\Search\LiveSearch\LiveSearch.php

Gernot Schulmeister 06/28/14, 13:45 updated 10/02/18, 11:54

Description

In the function findByTable($tableName, $pageIdList, $limit) (line 190 in version 6.2.3) the variable $orderBy in line 196 is not used. Instead the function call $this->makeOrderByTable($tableName) is repeated in the next line.

$orderBy = $this->makeOrderByTable($tableName);
$getRecordArray = $this->getRecordArray($tableName, $where, $this->makeOrderByTable($tableName), $limit)
protected function findByTable($tableName, $pageIdList, $limit) {
        $fieldsToSearchWithin = $this->extractSearchableFieldsFromTable($tableName);
        $getRecordArray = array();
        if (count($fieldsToSearchWithin) > 0) {
            $pageBasedPermission = $tableName == 'pages' && $this->userPermissions ? $this->userPermissions : '1=1 ';
            $where = 'pid IN (' . $pageIdList . ') AND ' . $pageBasedPermission . $this->makeQuerySearchByTable($tableName, $fieldsToSearchWithin);
            $orderBy = $this->makeOrderByTable($tableName);
            $getRecordArray = $this->getRecordArray($tableName, $where, $this->makeOrderByTable($tableName), $limit);
        }
        return $getRecordArray;
    }

Solution: remove line 196 or use varible $orderBy in line 197.

Reviews 2