public static function CountBySearch($intCategoryId = null, $intManufacturerId = null, $strDescription = null, $strAssetModelCode = null, $arrCustomFields = null, $strDateModified = null, $strDateModifiedFirst = null, $strDateModifiedLast = null, $blnAttachment = null, $objExpansionMap = null) { // Call to QueryHelper to Get the Database Object AssetModel::QueryHelper($objDatabase); // Setup QueryExpansion $objQueryExpansion = new QQueryExpansion(); if ($objExpansionMap) { try { AssetModel::ExpandQuery('asset_model', null, $objExpansionMap, $objQueryExpansion); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } $arrSearchSql = AssetModel::GenerateSearchSql($intCategoryId, $intManufacturerId, $strDescription, $strAssetModelCode, $arrCustomFields, $strDateModified, $strDateModifiedFirst, $strDateModifiedLast, $blnAttachment); $arrCustomFieldSql = CustomField::GenerateSql(EntityQtype::AssetModel); $arrAttachmentSql = Attachment::GenerateSql(EntityQtype::AssetModel); $strQuery = sprintf(' SELECT COUNT(asset_model.asset_model_id) AS row_count FROM `asset_model` AS `asset_model` %s %s %s WHERE 1=1 %s %s %s %s %s %s %s %s ', $objQueryExpansion->GetFromSql("", "\n\t\t\t\t\t"), $arrAttachmentSql['strFrom'], $arrCustomFieldSql['strFrom'], $arrSearchSql['strCategorySql'], $arrSearchSql['strManufacturerSql'], $arrSearchSql['strDescriptionSql'], $arrSearchSql['strAssetModelCodeSql'], $arrSearchSql['strCustomFieldsSql'], $arrSearchSql['strDateModifiedSql'], $arrSearchSql['strAttachmentSql'], $arrSearchSql['strAuthorizationSql']); //echo($strQuery); exit; $objDbResult = $objDatabase->Query($strQuery); $strDbRow = $objDbResult->FetchRow(); return QType::Cast($strDbRow[0], QType::Integer); }