return the query restriction for active filter. returns false if there
is no active restriction for this item.

@return string
357169
public function GetQueryRestrictionForActiveFilter()
    {
        $sQuery = $this->GetFromInternalCache('sQueryRestrictionForActiveFilter');
        if (is_null($sQuery)) {
            $aValues = $this->aActiveFilterData;
            if (!is_array($aValues)) {
                if (empty($aValues)) {
                    $aValues = array();
                } else {
                    $aValues = array($aValues);
                }
            }
            if (count($aValues) > 0) {
                $aValues = TTools::MysqlRealEscapeArray($aValues);
                //          $oVariantType = $this->GetVariantType();

                $sItemListQuery = "SELECT DISTINCT `shop_article`.`variant_parent_id`
                      FROM `shop_variant_type_value`
                INNER JOIN `shop_article_shop_variant_type_value_mlt` ON `shop_variant_type_value`.`id` = `shop_article_shop_variant_type_value_mlt`.`target_id`
                INNER JOIN `shop_article` ON `shop_article_shop_variant_type_value_mlt`.`source_id` = `shop_article`.`id`
                INNER JOIN `shop_article` AS PARENTARTICLE ON `shop_article`.`variant_parent_id` = PARENTARTICLE.`id`
                INNER JOIN `shop_variant_type` ON `shop_variant_type_value`.`shop_variant_type_id` = `shop_variant_type`.`id`
                     WHERE (`shop_variant_type_value`.`name` IN ('".implode("','", $aValues)."') OR `shop_variant_type_value`.`name_grouped` IN ('".implode("','", $aValues)."'))
                       AND `shop_variant_type`.`identifier` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->sVariantTypeIdentifier)."'
                       AND PARENTARTICLE.`active` = '1'
                   ";
                $sActiveRestrictions = TdbShopArticleList::GetActiveArticleQueryRestriction(false);
                if (!empty($sActiveRestrictions)) {
                    $sItemListQuery .= ' AND ('.$sActiveRestrictions.')';
                }
                $tRes = MySqlLegacySupport::getInstance()->query($sItemListQuery);
                //echo $sItemListQuery;echo "\n\n";
                $aIdList = array();
                while ($aItemRow = MySqlLegacySupport::getInstance()->fetch_assoc($tRes)) {
                    $aIdList[] = MySqlLegacySupport::getInstance()->real_escape_string($aItemRow['variant_parent_id']);
                }

                if (count($aIdList) > 0) {
                    $sQuery = "`shop_article`.`id` IN ('".implode("','", $aIdList)."')";
                }
            }

            $this->SetInternalCache('sQueryRestrictionForActiveFilter', $sQuery);
        }

        return $sQuery;
    }
381728
public function sqlFilters()
    {
        if (!$this->hasFilters()) {
            return '';
        }

        $criteria = $this->createFilter([
            'filters' => $this->filters()
        ]);

        $sql = $criteria->sql();
        if (strlen($sql) > 0) {
            $sql = ' WHERE '.$sql;
        }

        return $sql;
    }
838571
public function isFilterable()
    {
        $hasFilters = false;

        foreach ($this->columns as $column) {
            if ($column->isFilterable()) {
                $hasFilters = true;
                break;
            }
        }

        return $hasFilters;
    }
728951
public function getQuery()
    {
        $query = parent::getQuery();
        if ( $this->hasLimit )
        {
            $max = $this->offset + $this->limit;
            if ( $this->offset > 0 ) 
            {
                $min = $this->offset + 1;
                $query = "SELECT * FROM (SELECT a.*, ROWNUM rn FROM ( {$query} ) a WHERE rownum <= {$max} ) WHERE rn >= {$min}";
            }
            else 
            {
                $query = "SELECT a.* FROM ( {$query} ) a WHERE ROWNUM <= {$max}";
            }            
        }
        return $query;
    }
224474
protected function _GetFilter() {
      $Filter = $this->Request->Get('Filter');
      if ($Filter) {
         $Parts = explode(' ', $Filter, 3);
         if (count($Parts) < 2)
            return FALSE;
         
         $Field = $Parts[0];
         if (count($Parts) == 2) {
            $Op = '=';
            $FilterValue = $Parts[1];
         } else {
            $Op = $Parts[1];
            if (!in_array($Op, array('=', 'like'))) {
               $Op = '=';
            }
            $FilterValue = $Parts[2];
         }
         
         if (strpos($Field, '.') !== FALSE)
            $Field = array_pop(explode('.', $Field));
         
         if (!in_array($Field, array('Name', 'Email', 'LastIPAddress', 'InsertIPAddress', 'RankID', 'DateFirstVisit', 'DateLastVisit')))
            return FALSE;

         return array("$Field $Op" => $FilterValue);
      }
      return FALSE;
   }
1298094
public function isIdInPostAllowed()
    {
        $isAllowed = true;
        if (isset($this->schema->{'x-id-in-post-allowed'})) {
            $isAllowed = $this->schema->{'x-id-in-post-allowed'};
        }
        return $isAllowed;
    }
1300702
public function filtering()
    {
        if ($this->request->hasHeader('search-protection')) {
            $this->request->setSearchableColumnIndex($this->columns, $this->columnDef['filter']);
        }
        $columns          = $this->request['columns'];
        $this->collection = $this->collection->filter(function ($row) use ($columns) {
            $data                  = $this->serialize($row);
            $this->isFilterApplied = true;
            $found                 = [];

            $keyword = $this->request->keyword();
            foreach ($this->request->searchableColumnIndex() as $index) {
                $column = $this->getColumnName($index);
                if (!$value  = Arr::get($data, $column)) {
                    continue;
                }

                if ($this->isCaseInsensitive()) {
                    $found[] = Str::contains(Str::lower($value), Str::lower($keyword));
                } else {
                    $found[] = Str::contains($value, $keyword);
                }
            }

            return in_array(true, $found);
        }
        );
    }
1121603
protected function _getFilter()
    {
        $sQ = '';
        $oConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
        $aFilter = $oConfig->getRequestParameter('aFilter');
        if (is_array($aFilter) && count($aFilter)) {
            $aCols = $this->_getVisibleColNames();
            $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
            $oStr = getStr();

            foreach ($aFilter as $sCol => $sValue) {
                // skipping empty filters
                if ($sValue === '') {
                    continue;
                }

                $iCol = (int) str_replace('_', '', $sCol);
                if (isset($aCols[$iCol])) {
                    if ($sQ) {
                        $sQ .= ' and ';
                    }

                    // escaping special characters
                    $sValue = str_replace(['%', '_'], ['\%', '\_'], $sValue);

                    // possibility to search in the middle ..
                    $sValue = $oStr->preg_replace('/^\*/', '%', $sValue);

                    $sQ .= $this->_getViewName($aCols[$iCol][1]) . '.' . $aCols[$iCol][0];
                    $sQ .= ' like ' . $oDb->Quote('%' . $sValue . '%') . ' ';
                }
            }
        }

        return $sQ;
    }
567726
public static function GetActiveCategoryQueryRestriction()
    {
        if (true === TGlobal::IsCMSMode()) {
            return '';
        }

        $databaseConnection = self::getConnection();
        $fieldTranslationUtil = self::getFieldTranslationUtil();
        $activeFieldName = $fieldTranslationUtil->getTranslatedFieldName('shop_category', 'active');
        $treeActiveFieldName = $fieldTranslationUtil->getTranslatedFieldName('shop_category', 'tree_active');

        return sprintf("(`shop_category`.%s = '1' AND `shop_category`.%s = '1')",
            $databaseConnection->quoteIdentifier($activeFieldName),
            $databaseConnection->quoteIdentifier($treeActiveFieldName)
        );
    }
1146522
public function getBlocksWithFilter($onlyActive = true)
    {
        $query = Block::query()->with(self::$loadRelations)
            ->where('filter', '!=', null);

        if ($onlyActive) {
            $query->where('is_active', '=', true);
        }

        $blocks = $query->orderBy('weight', 'ASC')->get();

        return $blocks;
    }
247753
public function queryObject()
    {
        $bindingType = $this->options['bindingType'];

        $queryObj = [];
        $queryObj['queryString'] = $this->query;
        $queryObj['allowLiterals'] = (bool) $this->options['allowLiterals'];

        $bindings = $this->mapBindings($bindingType, $this->options['bindings']);
        if (!empty($bindings)) {
            $queryObj[$this->options['bindingType']] = $bindings;
        }

        return $queryObj;
    }
702921
public function getAllowedValues()
    {
        $inArrayFilters = $this->getRequirements()->filter(
            function($value) {
                return $value instanceof InArray;
            }
        );

        if (count($inArrayFilters) > 0) {
            return $inArrayFilters->first()->getValues();
        }
        return [];
    }
1245691
protected function getAttributeFilter()
    {
        if ($this->attributeFilter) {
            return $this->attributeFilter;
        }

        return function ($key, $value) {
            if (in_array($key, $this->getNonScalarAttributes())) {
                return !is_scalar($value);
            }

            if (ends_with($key, '_id') && trim($value) === '') {
                return false;
            }

            return is_scalar($value) || $value instanceof DateTime;
        };
    }
200082
protected function getFilter()
    {
        $supports = $this->supports();
        $filters = $this->entityManager->getFilters()->getEnabledFilters();
        $fFilter = null;

        foreach ($filters as $name => $filter) {
            if ($filter instanceof $supports) {
                $fFilter = $filter;

                break;
            }
        }

        return $fFilter;
    }
589792
public function query()
    {
        $currentUser = $this->request->user($this->request->route('guard'));

        $query = $currentUser->isA('superadmin') ? app($this->model)->query() : app($this->model)->query()->whereIn('id', $currentUser->roles->pluck('id')->toArray());

        return $this->applyScopes($query);
    }
707477
public function get()
    {

        $result = $this->query->select([$this->pageTable().'.*'])->get();

        if ($this->withHidden) {
            return $result;
        }

        return $this->menuFilters->filteredChildren($result,'');

    }
60889
public function GetSearchRestrictionLink()
    {
        // get current search... then add filter
        $oShop = TdbShop::GetInstance();
        $oSearchCache = &$oShop->GetActiveSearchObject();
        //$oSearchCache->aFilter[TdbShopManufacturer::FILTER_KEY_NAME] = $this->id;
        return $oSearchCache->GetSearchLink(array(TdbShopManufacturer::FILTER_KEY_NAME => $this->id));
    }