Beispiel #1
0
$controls = new EditControlsContainer(null, $pSet, PAGE_LIST, $cipherer);
$result = array();
// traversing searchable fields
foreach ($allSearchFields as $f) {
    // filter fields by type
    $fType = $pSet->getFieldType($f);
    if (!IsCharType($fType) && !IsNumberType($fType) && !IsGuid($fType) || in_array($f, $detailKeys)) {
        continue;
    }
    if ($_connection->dbType == nDATABASE_Oracle && IsTextType($fType)) {
        continue;
    }
    if ($searchField != '' && $searchField != GoodFieldName($f) || !$pSet->checkFieldPermissions($f)) {
        continue;
    }
    $fieldControl = $controls->getControl($f);
    $isAggregateField = $pSet->isAggregateField($f);
    $where = $fieldControl->getSuggestWhere($searchOpt, $searchFor, $isAggregateField);
    $having = $fieldControl->getSuggestHaving($searchOpt, $searchFor, $isAggregateField);
    if (!strlen($where) && !strlen($having)) {
        continue;
    }
    $where = whereAdd($where . $masterWhere, $strSecuritySql);
    $clausesData = $fieldControl->getSelectColumnsAndJoinFromPart($searchFor, $searchOpt, true);
    $selectColumns = $clausesData["selectColumns"];
    $fromClause = $gQuery->FromToSql() . $clausesData["joinFromPart"];
    $distinct = "DISTINCT";
    if ($_connection->dbType == nDATABASE_MSSQLServer || $_connection->dbType == nDATABASE_Access) {
        if (IsTextType($fType)) {
            $distinct = "";
        }
}
require_once getabspath('classes/controls/EditControlsContainer.php');
$detailKeys = array();
$masterWhere = "";
$cipherer = new RunnerCipherer($strTableName);
$controls = new EditControlsContainer(null, $pSet, PAGE_LIST, $cipherer);
if (@$_SESSION[$strTableName . "_mastertable"] != "") {
    $masterTablesInfoArr = $pSet->getMasterTablesArr($strTableName);
    for ($i = 0; $i < count($masterTablesInfoArr); $i++) {
        if ($_SESSION[$strTableName . "_mastertable"] != $masterTablesInfoArr[$i]['mDataSourceTable']) {
            continue;
        }
        if ($masterTablesInfoArr[$i]['dispInfo']) {
            $detailKeys = $masterTablesInfoArr[$i]['detailKeys'];
            for ($j = 0; $j < count($detailKeys); $j++) {
                $masterWhere .= " and " . $controls->getControl($detailKeys[$j])->getSuggestWhere('Equals', @$_SESSION[$strTableName . "_masterkey" . ($j + 1)]);
            }
        }
        break;
    }
}
$result = array();
// traversing searchable fields
foreach ($allSearchFields as $f) {
    // filter fields by type
    $fType = $pSet->getFieldType($f);
    if (!IsCharType($fType) && !IsNumberType($fType) && !IsGuid($fType) || in_array($f, $detailKeys)) {
        continue;
    }
    if ($_connection->dbType == nDATABASE_Oracle && IsTextType($fType)) {
        continue;
Beispiel #3
0
}
$controls = new EditControlsContainer(null, $pSet, PAGE_LIST, $cipherer);
// proccess fields and create sql
foreach ($allSearchFields as $f) {
    $fType = $pSet->getFieldType($f);
    // filter fields by type
    if (!IsCharType($fType) && !IsNumberType($fType) && !IsGuid($fType) || in_array($f, $detailKeys)) {
        continue;
    } else {
    }
    // get suggest for field
    if (($searchField == '' || $searchField == GoodFieldName($f)) && $pSet->checkFieldPermissions($f)) {
        $where = "";
        $having = "";
        if (!$gQuery->IsAggrFuncField($pSet->getFieldIndex($f) - 1)) {
            $where = $searchClauseObj->getSuggestWhere($controls->getControl($f), $suggestAllContent, $searchFor);
        } elseif ($gQuery->IsAggrFuncField($pSet->getFieldIndex($f) - 1)) {
            $having = $searchClauseObj->getSuggestWhere($controls->getControl($f), $suggestAllContent, $searchFor);
        }
        if (!strlen($where) && !strlen($having)) {
            continue;
        }
        // prepare common vals
        $where = whereAdd($where . $masterWhere, $strSecuritySql);
        $distinct = "DISTINCT";
        $sqlHead = "SELECT " . $distinct . " " . GetFullFieldName($f) . " ";
        if ($gQuery->HasGroupBy()) {
            $strSQL = $gQuery->gSQLWhere_having_fromQuery("", $where, $having);
            $strSQL = "SELECT DISTINCT st." . AddFieldWrappers($f) . " from (" . $strSQL . ") st";
        } else {
            $strSQL = SQLQuery::gSQLWhere_having($sqlHead, $gQuery->FromToSql(), $gQuery->WhereToSql(), $gQuery->GroupByToSql(), $gQuery->Having()->toSql($gQuery), $where, $having);