当前位置: 首页>>代码示例>>PHP>>正文


PHP QueryGenerator::getQuery方法代码示例

本文整理汇总了PHP中QueryGenerator::getQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP QueryGenerator::getQuery方法的具体用法?PHP QueryGenerator::getQuery怎么用?PHP QueryGenerator::getQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QueryGenerator的用法示例。


在下文中一共展示了QueryGenerator::getQuery方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: populateTo

 public function populateTo($request)
 {
     $viewer = $this->getViewer($request);
     $inventoryRecordId = $request->get('record');
     $recordModel = Vtiger_Record_Model::getInstanceById($inventoryRecordId, $request->getModule());
     $inventoryModule = $recordModel->getModule();
     $inventotyfields = $inventoryModule->getFields();
     $toEmailConsiderableFields = array('contact_id', 'account_id', 'vendor_id');
     $db = PearDatabase::getInstance();
     $to = array();
     $to_info = array();
     $toMailNamesList = array();
     foreach ($toEmailConsiderableFields as $fieldName) {
         if (!array_key_exists($fieldName, $inventotyfields)) {
             continue;
         }
         $fieldModel = $inventotyfields[$fieldName];
         if (!$fieldModel->isViewable()) {
             continue;
         }
         $fieldValue = $recordModel->get($fieldName);
         if (empty($fieldValue)) {
             continue;
         }
         $referenceList = $fieldModel->getReferenceList();
         $referenceModule = $referenceList[0];
         $fieldLabel = Vtiger_Util_Helper::getLabel($fieldValue);
         $referenceModuleModel = Vtiger_Module_Model::getInstance($referenceModule);
         $emailFields = $referenceModuleModel->getFieldsByType('email');
         if (count($emailFields) <= 0) {
             continue;
         }
         $current_user = Users_Record_Model::getCurrentUserModel();
         $queryGenerator = new QueryGenerator($referenceModule, $current_user);
         $queryGenerator->setFields(array_keys($emailFields));
         $query = $queryGenerator->getQuery();
         $query .= ' AND crmid = ' . $fieldValue;
         $result = $db->pquery($query, array());
         $num_rows = $db->num_rows($result);
         if ($num_rows <= 0) {
             continue;
         }
         foreach ($emailFields as $fieldName => $emailFieldModel) {
             $emailValue = $db->query_result($result, 0, $fieldName);
             if (!empty($emailValue)) {
                 $to[] = $emailValue;
                 $to_info[$fieldValue][] = $emailValue;
                 $toMailNamesList[$fieldValue][] = array('label' => $fieldLabel, 'value' => $emailValue);
                 break;
             }
         }
         if (!empty($to)) {
             break;
         }
     }
     $viewer->assign('TO', $to);
     $viewer->assign('TOMAIL_NAMES_LIST', $toMailNamesList);
     $viewer->assign('TOMAIL_INFO', $to_info);
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:59,代码来源:SendEmail.php

示例2: getKeyMetricsWithCount

 protected function getKeyMetricsWithCount()
 {
     global $current_user, $adb;
     $current_user = Users_Record_Model::getCurrentUserModel();
     require_once 'modules/CustomView/ListViewTop.php';
     $metriclists = getMetricList();
     foreach ($metriclists as $key => $metriclist) {
         $metricresult = NULL;
         if ($metriclist['module'] == "Calendar") {
             $listquery = getListQuery($metriclist['module']);
             $oCustomView = new CustomView($metriclist['module']);
             $metricsql = $oCustomView->getModifiedCvListQuery($metriclist['id'], $listquery, $metriclist['module']);
             $metricresult = $adb->query(Vtiger_Functions::mkCountQuery($metricsql));
         } else {
             $queryGenerator = new QueryGenerator($metriclist['module'], $current_user);
             $queryGenerator->initForCustomViewById($metriclist['id']);
             $metricsql = $queryGenerator->getQuery();
             $metricresult = $adb->query(Vtiger_Functions::mkCountQuery($metricsql));
         }
         if ($metricresult) {
             $rowcount = $adb->fetch_array($metricresult);
             $metriclists[$key]['count'] = $rowcount['count'];
         }
     }
     return $metriclists;
 }
开发者ID:nouphet,项目名称:vtigercrm-6.0.0-ja,代码行数:26,代码来源:Notebook.php

示例3: render

 public static function render($userInputObject, $user)
 {
     global $list_max_entries_per_page;
     $adb = PearDatabase::getInstance();
     $viewer = new Import_UI_Viewer();
     $ownerId = $userInputObject->get('foruser');
     $owner = new Users();
     $owner->id = $ownerId;
     $owner->retrieve_entity_info($ownerId, 'Users');
     if (!is_admin($user) && $user->id != $owner->id) {
         $viewer->display('OperationNotPermitted.tpl', 'Vtiger');
         exit;
     }
     $userDBTableName = Import_Utils::getDbTableName($owner);
     $moduleName = $userInputObject->get('module');
     $moduleMeta = self::getModuleMeta($moduleName, $user);
     $result = $adb->query('SELECT recordid FROM ' . $userDBTableName . ' WHERE status is NOT NULL AND recordid IS NOT NULL');
     $noOfRecords = $adb->num_rows($result);
     $importedRecordIds = array();
     for ($i = 0; $i < $noOfRecords; ++$i) {
         $importedRecordIds[] = $adb->query_result($result, $i, 'recordid');
     }
     if (count($importedRecordIds) == 0) {
         $importedRecordIds[] = 0;
     }
     $focus = CRMEntity::getInstance($moduleName);
     $queryGenerator = new QueryGenerator($moduleName, $user);
     $customView = new CustomView($moduleName);
     $viewId = $customView->getViewIdByName('All', $moduleName);
     $queryGenerator->initForCustomViewById($viewId);
     $list_query = $queryGenerator->getQuery();
     // Fetch only last imported records
     $list_query .= ' AND ' . $focus->table_name . '.' . $focus->table_index . ' IN (' . implode(',', $importedRecordIds) . ')';
     if (PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false) === true) {
         $count_result = $adb->query(mkCountQuery($list_query));
         $noofrows = $adb->query_result($count_result, 0, "count");
     } else {
         $noofrows = null;
     }
     $start = ListViewSession::getRequestCurrentPage($moduleName, $list_query, $viewId, false);
     $navigation_array = VT_getSimpleNavigationValues($start, $list_max_entries_per_page, $noofrows);
     $limit_start_rec = ($start - 1) * $list_max_entries_per_page;
     $list_result = $adb->pquery($list_query . " LIMIT {$limit_start_rec}, {$list_max_entries_per_page}", array());
     $recordListRangeMsg = getRecordRangeMessage($list_result, $limit_start_rec, $noofrows);
     $viewer->assign('recordListRange', $recordListRangeMsg);
     $controller = new ListViewController($adb, $user, $queryGenerator);
     $listview_header = $controller->getListViewHeader($focus, $moduleName, $url_string, $sorder, $order_by, true);
     $listview_entries = $controller->getListViewEntries($focus, $moduleName, $list_result, $navigation_array, true);
     $viewer->assign('CURRENT_PAGE', $start);
     $viewer->assign('LISTHEADER', $listview_header);
     $viewer->assign('LISTENTITY', $listview_entries);
     $viewer->assign('FOR_MODULE', $moduleName);
     $viewer->assign('FOR_USER', $ownerId);
     $isAjax = $userInputObject->get('ajax');
     if (!empty($isAjax)) {
         echo $viewer->fetch('ListViewEntries.tpl');
     } else {
         $viewer->display('ImportListView.tpl');
     }
 }
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:60,代码来源:Import_ListView_Controller.php

示例4: addRelationsFromRelatedModuleViewId

 /**
  * Function to add relations using related module viewid
  * @param Vtiger_Request $request
  */
 public function addRelationsFromRelatedModuleViewId(Vtiger_Request $request)
 {
     $sourceRecordId = $request->get('sourceRecord');
     $relatedModuleName = $request->get('relatedModule');
     $viewId = $request->get('viewId');
     if ($viewId) {
         $sourceModuleModel = Vtiger_Module_Model::getInstance($request->getModule());
         $relatedModuleModel = Vtiger_Module_Model::getInstance($relatedModuleName);
         $relationModel = Vtiger_Relation_Model::getInstance($sourceModuleModel, $relatedModuleModel);
         $emailEnabledModulesInfo = $relationModel->getEmailEnabledModulesInfoForDetailView();
         if (array_key_exists($relatedModuleName, $emailEnabledModulesInfo)) {
             $fieldName = $emailEnabledModulesInfo[$relatedModuleName]['fieldName'];
             $db = PearDatabase::getInstance();
             $currentUserModel = Users_Record_Model::getCurrentUserModel();
             $queryGenerator = new QueryGenerator($relatedModuleName, $currentUserModel);
             $queryGenerator->initForCustomViewById($viewId);
             $query = $queryGenerator->getQuery();
             $result = $db->pquery($query, array());
             $numOfRows = $db->num_rows($result);
             for ($i = 0; $i < $numOfRows; $i++) {
                 $relatedRecordIdsList[] = $db->query_result($result, $i, $fieldName);
             }
             if (empty($relatedRecordIdsList)) {
                 $response = new Vtiger_Response();
                 $response->setResult(array(false));
                 $response->emit();
             } else {
                 foreach ($relatedRecordIdsList as $relatedRecordId) {
                     $relationModel->addRelation($sourceRecordId, $relatedRecordId);
                 }
             }
         }
     }
 }
开发者ID:yozhi,项目名称:YetiForceCRM,代码行数:38,代码来源:RelationAjax.php

示例5: getKeyMetricsWithCount

 protected function getKeyMetricsWithCount()
 {
     global $log;
     $log->debug("Entering ./dashboards/KeyMetrics.php::getKeyMetricsWithCount");
     global $current_user, $adb;
     $current_user = Users_Record_Model::getCurrentUserModel();
     require_once 'modules/CustomView/ListViewTop.php';
     $metriclists = getMetricList();
     foreach ($metriclists as $key => $metriclist) {
         $metricresult = NULL;
         $queryGenerator = new QueryGenerator($metriclist['module'], $current_user);
         $queryGenerator->initForCustomViewById($metriclist['id']);
         if ($metriclist['module'] == "Calendar") {
             // For calendar we need to eliminate emails or else it will break in status empty condition
             $queryGenerator->addCondition('activitytype', "Emails", 'n', QueryGenerator::$AND);
         }
         $metricsql = $queryGenerator->getQuery();
         $metricresult = $adb->query(Vtiger_Functions::mkCountQuery($metricsql));
         if ($metricresult) {
             $rowcount = $adb->fetch_array($metricresult);
             $metriclists[$key]['count'] = $rowcount['count'];
         }
     }
     return $metriclists;
 }
开发者ID:cin-system,项目名称:cinrepo,代码行数:25,代码来源:KeyMetrics.php

示例6: getContent

 function getContent(Mobile_API_Request $request)
 {
     global $current_user, $adb;
     $current_user = $this->getActiveUser();
     $module = $request->get('module');
     $limit = $request->get('number');
     $offset = $request->get('offset');
     $search = isset($_REQUEST['src_str']) ? $request->get('src_str') : '';
     $customView = new CustomView($module);
     if (!empty($_REQUEST['view'])) {
         $viewid = $_REQUEST['view'];
     } else {
         $viewid = $customView->getViewId($module);
     }
     $queryGenerator = new QueryGenerator($module, $current_user);
     if ($viewid != "0") {
         $queryGenerator->initForCustomViewById($viewid);
     } else {
         $queryGenerator->initForDefaultCustomView();
     }
     $list_query = $queryGenerator->getQuery();
     //get entity fields for each module
     $entity_sql = "select fieldname,tablename,entityidfield from vtiger_entityname where modulename =?";
     $ws_entity = $adb->pquery($entity_sql, array($module));
     $fieldname = $adb->query_result($ws_entity, 0, 'fieldname');
     $tablename = $adb->query_result($ws_entity, 0, 'tablename');
     //set the list and content order
     if ($module == 'Contacts' || $module == 'Leads') {
         $list_query .= " AND (lastname LIKE '%{$search}%' OR firstname LIKE '%{$search}%') ORDER BY lastname";
     } elseif ($module != 'Calendar' and $module != 'Events') {
         $list_query .= " AND " . $tablename . "." . $fieldname . " LIKE '%{$search}%' ORDER BY " . $tablename . "." . $fieldname;
     } elseif ($module == 'Calendar' || $module == 'Events') {
         $calendarview_selected = $request->get('viewName');
         $list_query .= " AND vtiger_activity.activitytype!='Emails'";
         if ($calendarview_selected == 'week') {
             $list_query .= " AND week(date_start) = week(NOW()) AND year(date_start) = year(NOW())";
         } elseif ($calendarview_selected == 'month') {
             $list_query .= " AND month(date_start) = month(NOW()) AND year(date_start) = year(NOW())";
         } elseif ($calendarview_selected == 'year') {
             $list_query .= " AND year(date_start) = year(NOW())";
         } elseif ($calendarview_selected == 'today') {
             $list_query .= " AND DATE(date_start) = DATE(NOW())";
         }
         $list_query .= " AND subject LIKE '%{$search}%' ORDER BY date_start DESC";
     } else {
         $list_query .= " AND " . $tablename . "." . $fieldname . " LIKE '%{$search}%' ORDER BY " . $tablename . "." . $fieldname;
     }
     $list_query .= " LIMIT {$offset}, {$limit};";
     $listview_entries = $adb->pquery($list_query, array());
     $response = new Mobile_API_Response();
     $response->setResult(array('records' => $listview_entries, 'module' => $module));
     return $response;
 }
开发者ID:kduqi,项目名称:corebos,代码行数:53,代码来源:getScrollContent.php

示例7: getCalculations

 function getCalculations(Vtiger_Request $request)
 {
     $fromModule = $request->get('fromModule');
     $record = $request->get('record');
     $showtype = $request->get('showtype');
     $rqLimit = $request->get('limit');
     $db = PearDatabase::getInstance();
     $fields = ['id', 'name', 'calculationsstatus'];
     $limit = 10;
     $params = [];
     if (!empty($rqLimit)) {
         $limit = $rqLimit;
     }
     if ($fromModule == 'Accounts') {
         $fields[] = 'potentialid';
     } elseif ($fromModule == 'Potentials') {
         $fields[] = 'assigned_user_id';
     }
     $calculationConfig = Settings_SalesProcesses_Module_Model::getConfig('calculation');
     $calculationsStatus = $calculationConfig['calculationsstatus'];
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $module = 'Calculations';
     $instance = CRMEntity::getInstance($module);
     $securityParameter = $instance->getUserAccessConditionsQuerySR($module, $currentUser);
     $queryGenerator = new QueryGenerator($module, $currentUser);
     $queryGenerator->setFields($fields);
     $sql = $queryGenerator->getQuery();
     if ($securityParameter != '') {
         $sql .= $securityParameter;
     }
     $calculationsStatusSearch = implode("','", $calculationsStatus);
     $showtype = $request->get('showtype');
     if ($showtype == 'archive') {
         $sql .= " AND vtiger_calculations.calculationsstatus IN ('{$calculationsStatusSearch}')";
     } else {
         $sql .= " AND vtiger_calculations.calculationsstatus NOT IN ('{$calculationsStatusSearch}')";
     }
     if ($fromModule == 'Accounts') {
         $sql .= ' AND vtiger_calculations.relatedid = ?';
         $params[] = $record;
     } elseif ($fromModule == 'Potentials') {
         $sql .= ' AND vtiger_calculations.potentialid = ?';
         $params[] = $record;
     }
     $sql .= ' LIMIT ' . $limit;
     $result = $db->pquery($sql, $params);
     $returnData = array();
     for ($i = 0; $i < $db->num_rows($result); $i++) {
         $returnData[] = $db->query_result_rowdata($result, $i);
     }
     return $returnData;
 }
开发者ID:yozhi,项目名称:YetiForceCRM,代码行数:52,代码来源:Module.php

示例8: getExportQuery

 /**
  * Function that generates Export Query based on the mode
  * @param Vtiger_Request $request
  * @return <String> export query
  */
 function getExportQuery(Vtiger_Request $request)
 {
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $cvId = $request->get('viewname');
     $moduleName = $request->get('source_module');
     $queryGenerator = new QueryGenerator($moduleName, $currentUser);
     if (!empty($cvId)) {
         $queryGenerator->initForCustomViewById($cvId);
     }
     $acceptedFields = array('user_name', 'title', 'first_name', 'last_name', 'email1', 'email2', 'secondaryemail', 'phone_work', 'phone_mobile', 'phone_fax', 'address_street', 'address_city', 'address_state', 'address_country', 'address_postalcode');
     $queryGenerator->setFields($acceptedFields);
     $query = $queryGenerator->getQuery();
     return $query;
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:19,代码来源:ExportData.php

示例9: convertMap2Array

 private function convertMap2Array()
 {
     global $adb, $current_user;
     $xml = $this->getXMLContent();
     if (isset($xml->records)) {
         foreach ($xml->records->record as $k => $v) {
             if (isset($v->action)) {
                 $action = strtolower((string) $v->action);
                 if (!in_array($action, $this->actions)) {
                     $action = $this->default_action;
                 }
             } else {
                 $action = $this->default_action;
             }
             if (isset($v->id)) {
                 $rs = $adb->pquery('select setype from vtiger_crmentity where crmid=? and deleted=0', array((int) $v->id));
                 if ($adb->num_rows($rs) == 1) {
                     $recinfo = $adb->fetch_array($rs);
                     $this->mapping[$action]['ids'][] = (int) $v->id;
                     $this->mapping[$action][$recinfo['setype']][] = (int) $v->id;
                     if (!in_array($recinfo['setype'], $this->mapping['modules'])) {
                         $this->mapping['modules'][] = $recinfo['setype'];
                     }
                 }
             } else {
                 $tabid = getTabid((string) $v->module);
                 $ui4rs = $adb->pquery('select fieldname from vtiger_field where uitype=4 and tabid=?', array($tabid));
                 $ui4 = $adb->query_result($ui4rs, 0, 0);
                 $queryGenerator = new QueryGenerator((string) $v->module, $current_user);
                 $queryGenerator->setFields(array('id'));
                 $queryGenerator->addCondition($ui4, (string) $v->value, 'e');
                 $query = $queryGenerator->getQuery();
                 $idrs = $adb->pquery($query, array());
                 if ($idrs and $adb->num_rows($idrs) > 0) {
                     $id = $adb->query_result($idrs, 0, 0);
                     $this->mapping[$action]['ids'][] = (int) $id;
                     $this->mapping[$action][(string) $v->module][] = (int) $id;
                     if (!in_array($recinfo['setype'], $this->mapping['modules'])) {
                         $this->mapping['modules'][] = $recinfo['setype'];
                     }
                 }
             }
         }
     }
 }
开发者ID:kduqi,项目名称:corebos,代码行数:45,代码来源:RecordSetMapping.php

示例10: getRecordsList

 public function getRecordsList()
 {
     $moduleName = $this->api->getModuleName();
     $user = new Users();
     $currentUser = $user->retrieveCurrentUserInfoFromFile(Users::getActiveAdminId());
     vglobal('current_user', $currentUser);
     $listQuery = '';
     $queryGenerator = new QueryGenerator($moduleName, $currentUser);
     $queryGenerator->initForDefaultCustomView();
     $listQuery = $queryGenerator->getQuery();
     $db = PearDatabase::getInstance();
     $listResult = $db->query($listQuery);
     $records = [];
     while ($row = $db->fetch_array($listResult)) {
         $records[] = $row;
     }
     //$listQuery = getListQuery('OSSTimeControl', '');
     return ['headers' => $queryGenerator->getFields(), 'records' => $records, 'count' => 456];
 }
开发者ID:snowflakelady,项目名称:YetiForceCRM,代码行数:19,代码来源:GetRecordsList.php

示例11: getData

 public function getData(Vtiger_Request $request, $widget)
 {
     $db = PearDatabase::getInstance();
     $fields = ['id', 'name', 'calculationsstatus', 'relatedid', 'hdnGrandTotal', 'assigned_user_id'];
     $limit = 10;
     $params = [];
     if (!empty($widget->get('limit'))) {
         $limit = $widget->get('limit');
     }
     $calculationConfig = Settings_SalesProcesses_Module_Model::getConfig('calculation');
     $calculationsStatus = $calculationConfig['calculationsstatus'];
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $module = 'Calculations';
     $instance = CRMEntity::getInstance($module);
     $securityParameter = $instance->getUserAccessConditionsQuerySR($module, $currentUser);
     $queryGenerator = new QueryGenerator($module, $currentUser);
     $queryGenerator->setFields($fields);
     $sql = $queryGenerator->getQuery();
     if ($securityParameter != '') {
         $sql .= $securityParameter;
     }
     if (!empty($calculationsStatus)) {
         $calculationsStatusSearch = implode("','", $calculationsStatus);
         $sql .= " AND vtiger_calculations.calculationsstatus NOT IN ('{$calculationsStatusSearch}')";
     }
     $showtype = $request->get('showtype');
     if ($showtype == 'common') {
         $shownersTable = Vtiger_SharedOwner_UIType::getShownerTable($module);
         $sql .= ' AND vtiger_crmentity.crmid IN (SELECT DISTINCT crmid FROM ' . $shownersTable . ' WHERE userid = ?';
     } else {
         $sql .= ' AND vtiger_crmentity.smownerid = ?';
     }
     $params[] = $currentUser->getId();
     $sql .= ' LIMIT ' . $limit;
     $result = $db->pquery($sql, $params);
     $returnData = array();
     for ($i = 0; $i < $db->num_rows($result); $i++) {
         $returnData[] = $db->query_result_rowdata($result, $i);
     }
     return $returnData;
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:41,代码来源:Calculations.php

示例12: getData

 public function getData(Vtiger_Request $request, $widget)
 {
     $db = PearDatabase::getInstance();
     $fields = ['id', 'potentialname', 'sales_stage', 'related_to', 'assigned_user_id'];
     $limit = 10;
     $params = [];
     if (!empty($widget->get('limit'))) {
         $limit = $widget->get('limit');
     }
     $potentialConfig = Settings_SalesProcesses_Module_Model::getConfig('potential');
     $potentialSalesStage = $potentialConfig['salesstage'];
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $module = 'Potentials';
     $instance = CRMEntity::getInstance($module);
     $securityParameter = $instance->getUserAccessConditionsQuerySR($module, $currentUser);
     $queryGenerator = new QueryGenerator($module, $currentUser);
     $queryGenerator->setFields($fields);
     $sql = $queryGenerator->getQuery();
     if ($securityParameter != '') {
         $sql .= $securityParameter;
     }
     if (!empty($potentialSalesStage)) {
         $potentialSalesStageSearch = implode("','", $potentialSalesStage);
         $sql .= " AND vtiger_potential.sales_stage NOT IN ('{$potentialSalesStageSearch}')";
     }
     $showtype = $request->get('showtype');
     if ($showtype == 'common') {
         $sql .= ' AND FIND_IN_SET( ?, vtiger_crmentity.shownerid )';
     } else {
         $sql .= ' AND vtiger_crmentity.smownerid = ?';
     }
     $params[] = $currentUser->getId();
     $sql .= ' LIMIT ' . $limit;
     $result = $db->pquery($sql, $params);
     $returnData = array();
     for ($i = 0; $i < $db->num_rows($result); $i++) {
         $returnData[] = $db->query_result_rowdata($result, $i);
     }
     return $returnData;
 }
开发者ID:rcrrich,项目名称:YetiForceCRM,代码行数:40,代码来源:PotentialsList.php

示例13: getData

 public function getData(Vtiger_Request $request, $widget)
 {
     $db = PearDatabase::getInstance();
     $fields = ['id', 'assetname', 'dateinservice', 'parent_id'];
     $limit = 10;
     $params = [];
     if (!empty($widget->get('limit'))) {
         $limit = $widget->get('limit');
     }
     $assetConfig = Settings_SalesProcesses_Module_Model::getConfig('asset');
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $module = 'Assets';
     $instance = CRMEntity::getInstance($module);
     $securityParameter = $instance->getUserAccessConditionsQuerySR($module, $currentUser);
     $queryGenerator = new QueryGenerator($module, $currentUser);
     $queryGenerator->setFields($fields);
     $sql = $queryGenerator->getQuery();
     if ($securityParameter != '') {
         $sql .= $securityParameter;
     }
     if (!empty($assetStatus)) {
         $assetStatus = implode("','", $assetConfig['assetstatus']);
         $sql .= " AND vtiger_assets.assetstatus NOT IN ('{$assetStatus}')";
     }
     $showtype = $request->get('showtype');
     if ($showtype == 'common') {
         $sql .= ' AND FIND_IN_SET( ?, vtiger_crmentity.shownerid )';
     } else {
         $sql .= ' AND vtiger_crmentity.smownerid = ?';
     }
     $sql .= ' AND vtiger_assets.pot_renewal = 0';
     $params[] = $currentUser->getId();
     $sql .= ' ORDER BY vtiger_assets.dateinservice ASC LIMIT ' . $limit;
     $result = $db->pquery($sql, $params);
     $returnData = array();
     for ($i = 0; $i < $db->num_rows($result); $i++) {
         $returnData[] = $db->query_result_rowdata($result, $i);
     }
     return $returnData;
 }
开发者ID:rcrrich,项目名称:YetiForceCRM,代码行数:40,代码来源:ExpiringSoldProducts.php

示例14: getPicklistValues

 /**
  * Function to get all the available picklist values for the current field
  * @return <Array> List of picklist values if the field is of type MultiReferenceValue.
  */
 public function getPicklistValues()
 {
     if (!empty($this->get('picklistValues'))) {
         return $this->get('picklistValues');
     }
     $params = $this->get('field')->getFieldParams();
     $db = PearDatabase::getInstance();
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $fieldInfo = Vtiger_Functions::getModuleFieldInfoWithId($params['field']);
     $queryGenerator = new QueryGenerator($params['module'], $currentUser);
     $queryGenerator->setFields([$fieldInfo['columnname']]);
     if ($params['filterField'] != '-') {
         $queryGenerator->addCondition($params['filterField'], $params['filterValue'], 'e');
     }
     $query = $queryGenerator->getQuery();
     $result = $db->query($query);
     $values = [];
     while ($value = $db->getSingleValue($result)) {
         $values[$value] = vtranslate($value, $params['module']);
     }
     $this->set('picklistValues', $values);
     return $values;
 }
开发者ID:noclav,项目名称:UpdatePackages,代码行数:27,代码来源:MultiReferenceValue.php

示例15: CustomView

$focus = CRMEntity::getInstance($select_module);
if (count($module_name) > 0) {
    $cur_mod_view = new CustomView($select_module);
    $viewid = $cur_mod_view->getViewIdByName('All', $select_module);
    global $current_user;
    $queryGenerator = new QueryGenerator($select_module, $current_user);
    $queryGenerator->initForCustomViewById($viewid);
    // Enabling Module Search
    $url_string = '';
    if ($_REQUEST['query'] == 'true') {
        $queryGenerator->addUserSearchConditions($_REQUEST);
        $ustring = getSearchURL($_REQUEST);
        $url_string .= "&query=true{$ustring}";
        $smarty->assign('SEARCH_URL', $url_string);
    }
    $list_query = $queryGenerator->getQuery();
    $list_query = preg_replace("/vtiger_crmentity.deleted\\s*=\\s*0/i", 'vtiger_crmentity.deleted = 1', $list_query);
    //Search criteria added to the list Query
    if (isset($where) && $where != '') {
        $list_query .= ' AND ' . $where;
    }
    $count_result = $adb->query(mkCountQuery($list_query));
    $noofrows = $adb->query_result($count_result, 0, "count");
    $controller = new ListViewController($adb, $current_user, $queryGenerator);
    $rb_listview_header = $controller->getListViewHeader($focus, $select_module, $url_string, $sorder, $order_by, true);
    $listview_header_search = $controller->getBasicSearchFieldInfoList();
    $smarty->assign("SEARCHLISTHEADER", $listview_header_search);
    if (isset($_REQUEST['start']) && $_REQUEST['start'] != '') {
        $start = vtlib_purify($_REQUEST['start']);
    } else {
        $start = 1;
开发者ID:hbsman,项目名称:vtigercrm-5.3.0-ja,代码行数:31,代码来源:ListView.php


注:本文中的QueryGenerator::getQuery方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。