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


PHP Vtiger_Functions::getOwnerRecordLabel方法代码示例

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


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

示例1: getRelatedSummary

 public function getRelatedSummary($query)
 {
     $db = PearDatabase::getInstance();
     $relationQuery = preg_replace("/[ \t\n\r]+/", " ", $query);
     $position = stripos($relationQuery, ' from ');
     if ($position) {
         $split = explode(' FROM ', $relationQuery);
         $mainQuery = '';
         for ($i = 1; $i < count($split); $i++) {
             $mainQuery = $mainQuery . ' FROM ' . $split[$i];
         }
     }
     // Calculate total working time
     $result = $db->query('SELECT SUM(vtiger_osstimecontrol.sum_time) AS sumtime' . $mainQuery);
     $totalTime = $db->getSingleValue($result);
     // Calculate total working time divided into users
     $result = $db->query('SELECT SUM(vtiger_osstimecontrol.sum_time) AS sumtime, vtiger_crmentity.smownerid' . $mainQuery . ' GROUP BY vtiger_crmentity.smownerid');
     $userTime = [];
     $count = 1;
     while ($row = $db->fetch_array($result)) {
         $smownerid = Vtiger_Functions::getOwnerRecordLabel($row['smownerid']);
         $userTime[] = ['name' => [$count, $smownerid], 'initial' => [$count, Vtiger_Functions::getInitials($smownerid)], 'data' => [$count, $row['sumtime']]];
         $count++;
     }
     return ['totalTime' => $totalTime, 'userTime' => $userTime];
 }
开发者ID:reeid,项目名称:YetiForceCRM,代码行数:26,代码来源:Module.php

示例2: getProductsServices

 function getProductsServices(Vtiger_Request $request)
 {
     $fromModule = $request->get('fromModule');
     $record = $request->get('record');
     $mod = $request->get('mod');
     if (!in_array($mod, ['Products', 'Services'])) {
         die('Not supported Module');
     }
     $db = PearDatabase::getInstance();
     $limit = 10;
     $params = [];
     if (!empty($request->get('limit'))) {
         $limit = $request->get('limit');
     }
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $instance = CRMEntity::getInstance($mod);
     $securityParameter = $instance->getUserAccessConditionsQuerySR($mod, $currentUser);
     if ($mod == 'Products') {
         $sql = 'SELECT vtiger_products.productid, vtiger_products.pscategory, vtiger_products.productname, vtiger_crmentity.smownerid, vtiger_crmentity.shownerid ' . 'FROM vtiger_products ' . 'INNER JOIN vtiger_crmentity ON vtiger_products.productid = vtiger_crmentity.crmid ' . 'INNER JOIN vtiger_seproductsrel ON vtiger_products.productid = vtiger_seproductsrel.productid ' . 'LEFT JOIN vtiger_users ON vtiger_crmentity.smownerid = vtiger_users.id ' . 'LEFT JOIN vtiger_groups ON vtiger_crmentity.smownerid = vtiger_groups.groupid ' . 'WHERE vtiger_crmentity.deleted=0 AND vtiger_products.productid > 0 AND vtiger_seproductsrel.setype = ?';
         $params[] = $fromModule;
     } elseif ($mod == 'Services') {
         $sql = 'SELECT vtiger_service.serviceid, vtiger_service.pscategory, vtiger_service.servicename, vtiger_crmentity.smownerid, vtiger_crmentity.shownerid ' . 'FROM vtiger_service ' . 'INNER JOIN vtiger_crmentity ON vtiger_service.serviceid = vtiger_crmentity.crmid ' . 'INNER JOIN vtiger_crmentityrel ON (vtiger_crmentityrel.relcrmid = vtiger_crmentity.crmid OR vtiger_crmentityrel.crmid = vtiger_crmentity.crmid)' . 'LEFT JOIN vtiger_users ON vtiger_crmentity.smownerid = vtiger_users.id ' . 'LEFT JOIN vtiger_groups ON vtiger_crmentity.smownerid = vtiger_groups.groupid ' . 'WHERE vtiger_crmentity.deleted=0 AND vtiger_service.serviceid > 0 AND (vtiger_crmentityrel.crmid IN (?) OR vtiger_crmentityrel.relcrmid IN (?))';
         $params[] = $record;
         $params[] = $record;
     }
     if ($securityParameter != '') {
         $sql .= $securityParameter;
     }
     $sql .= ' LIMIT ' . $limit;
     $result = $db->pquery($sql, $params);
     $returnData = array();
     for ($i = 0; $i < $db->num_rows($result); $i++) {
         $row = $db->query_result_rowdata($result, $i);
         $shownerid = [];
         $row['smownerid'] = Vtiger_Functions::getOwnerRecordLabel($row['smownerid']);
         if ($row['shownerid'] != '') {
             foreach (explode(",", $row['shownerid']) as $value) {
                 $shownerid[] = Vtiger_Functions::getOwnerRecordLabel($value);
             }
         }
         $row['shownerid'] = $shownerid;
         $returnData[] = $row;
     }
     $showMore = (int) $limit == count($returnData) ? 1 : 0;
     return ['data' => $returnData, 'showMore' => $showMore];
 }
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:46,代码来源:SummaryWidget.php

示例3: process

 function process($data)
 {
     $adb = PearDatabase::getInstance();
     $html = '';
     if ($data['record'] != '') {
         $vtEntityDelta = new VTEntityDelta();
         $delta = $vtEntityDelta->getEntityDelta($data['module'], $data['record']);
         if (count($delta) == 0) {
             return '';
         }
         $tabid = getTabid($data['module']);
         $html = '<ul>';
         foreach ($delta as $fieldName => $values) {
             if ($fieldName != 'modifiedtime' && in_array($fieldName, array('record_id', 'record_module')) == false && strstr($fieldName, 'label') === false) {
                 $result = $adb->pquery("SELECT uitype,fieldlabel FROM vtiger_field WHERE fieldname = ? AND tabid = ?", array($fieldName, $tabid), true);
                 $fieldlabel = $adb->query_result_raw($result, 0, 'fieldlabel');
                 $uitype = $adb->query_result_raw($result, 0, 'uitype');
                 $oldValue = $values['oldValue'];
                 if ($oldValue == '') {
                     $oldValue = 'LBL_NULL_VALUE';
                 }
                 $currentValue = $values['currentValue'];
                 if ($currentValue == '') {
                     $currentValue = 'LBL_NULL_VALUE';
                 }
                 if ($uitype == 10 && $oldValue != 'LBL_NULL_VALUE' && $currentValue != 'LBL_NULL_VALUE') {
                     $oldValue = Vtiger_Functions::getCRMRecordLabel($oldValue);
                     $currentValue = Vtiger_Functions::getCRMRecordLabel($currentValue);
                 } elseif (in_array($uitype, array('53', '52', '77')) && $oldValue != 'LBL_NULL_VALUE' && $currentValue != 'LBL_NULL_VALUE') {
                     $oldValue = Vtiger_Functions::getOwnerRecordLabel($oldValue);
                     $currentValue = Vtiger_Functions::getOwnerRecordLabel($currentValue);
                 } elseif ($uitype == 56 && $oldValue != 'LBL_NULL_VALUE' && $currentValue != 'LBL_NULL_VALUE') {
                     $oldValue = $oldValue == 1 ? vtranslate('LBL_YES', $data['module']) : vtranslate('LBL_NO', $data['module']);
                     $currentValue = $currentValue == 1 ? vtranslate('LBL_YES', $data['module']) : vtranslate('LBL_NO', $data['module']);
                 } else {
                     $oldValue = vtranslate($oldValue, $data['module']);
                     $currentValue = vtranslate($currentValue, $data['module']);
                 }
                 $html .= '<li>' . vtranslate('LBL_CHANGED', $data['module']) . ' <strong>' . vtranslate($fieldlabel, $data['module']) . '</strong> ' . vtranslate('LBL_FROM') . ' <i>' . $oldValue . '</i> ' . vtranslate('LBL_TO') . ' <i>' . $currentValue . '</i></li>';
             }
         }
         $html .= '</ul>';
         return $html;
     }
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:45,代码来源:ChangesList.php

示例4: replaceRelVar

 function replaceRelVar($fieldId, $tpl, $recordId, $module, $start, $positionLength, $allLength)
 {
     $db = PearDatabase::getInstance();
     vimport("~~modules/{$module}/{$module}.php");
     $IDs = explode('||', $fieldId);
     $getFieldInfoSql = "SELECT * FROM vtiger_field WHERE fieldid = '" . $IDs[0] . "'";
     $getFieldInfoResult = $db->query($getFieldInfoSql, true);
     $fieldTab = $db->query_result_raw($getFieldInfoResult, 0, 'tablename');
     $fieldname = $db->query_result_raw($getFieldInfoResult, 0, 'fieldname');
     $fieldColumnName = $db->query_result_raw($getFieldInfoResult, 0, 'columnname');
     $tabid = $db->query_result_raw($getFieldInfoResult, 0, 'tabid');
     $uitype = $db->query_result_raw($getFieldInfoResult, 0, 'uitype');
     $moduleNameResult = $db->pquery("SELECT name FROM vtiger_tab WHERE tabid = ?", array($tabid), true);
     $fieldModule = $db->query_result_raw($moduleNameResult, 0, 'name');
     $moduleInstance = Vtiger_Record_Model::getInstanceById($recordId, $module);
     $getFieldInfoSql2 = "SELECT * FROM vtiger_field WHERE fieldid = ?";
     $getFieldInfoResult2 = $db->pquery($getFieldInfoSql2, array($IDs[1]), true);
     $rel_id = $moduleInstance->get($db->query_result_raw($getFieldInfoResult2, 0, 'fieldname'));
     $modObj = CRMEntity::getInstance($fieldModule);
     $primaryKey = $modObj->tab_name_index[$fieldTab];
     $getValueSql = "SELECT {$fieldColumnName} FROM {$fieldTab} WHERE {$primaryKey} = ?;";
     $getValueResult = $db->pquery($getValueSql, array($rel_id), true);
     $finalValue = $db->query_result_raw($getValueResult, 0, $fieldColumnName);
     if ($uitype == 10 || $uitype == 51 || $uitype == 73 || $uitype == 66 || $uitype == 57) {
         $finalValue = Vtiger_Functions::getCRMRecordLabel($finalValue);
     } elseif ($uitype == 15 || $uitype == 16) {
         $finalValue = vtranslate($finalValue, $module);
     } elseif ($uitype == 53 || $uitype == 52) {
         $finalValue = Vtiger_Functions::getOwnerRecordLabel($finalValue);
     }
     $tpl = substr_replace($tpl, $finalValue, $start, $allLength + $positionLength);
     return $tpl;
 }
开发者ID:yozhi,项目名称:YetiForceCRM,代码行数:33,代码来源:Record.php

示例5: get_details


//.........这里部分代码省略.........
            $fieldid = $adb->query_result($res, 0, 'notesid');
            $filename = $fieldvalue;
            $folderid = $adb->query_result($res, 0, 'folderid');
            $filestatus = $adb->query_result($res, 0, 'filestatus');
            $filetype = $adb->query_result($res, 0, 'filelocationtype');
            if ($fieldname == 'filename') {
                if ($filestatus == 1) {
                    if ($filetype == 'I') {
                        $fieldvalue = '<a href="index.php?downloadfile=true&folderid=' . $folderid . '&filename=' . $filename . '&module=Documents&action=index&id=' . $fieldid . '" >' . $fieldvalue . '</a>';
                    } elseif ($filetype == 'E') {
                        $fieldvalue = '<a target="_blank" href="' . $filename . '" onclick = "updateCount(' . $fieldid . ');">' . $filename . '</a>';
                    }
                }
            }
            if ($fieldname == 'folderid') {
                $fieldvalue = Vtiger_Language_Handler::getTranslatedString($adb->query_result($res, 0, 'foldername'), $module, vglobal('default_language'));
            }
            if ($fieldname == 'filesize') {
                if ($filetype == 'I') {
                    $fieldvalue = $fieldvalue . ' B';
                } elseif ($filetype == 'E') {
                    $fieldvalue = '--';
                }
            }
            if ($fieldname == 'filelocationtype') {
                if ($fieldvalue == 'I') {
                    $fieldvalue = Vtiger_Language_Handler::getTranslatedString('LBL_INTERNAL', $module, vglobal('default_language'));
                } elseif ($fieldvalue == 'E') {
                    $fieldvalue = Vtiger_Language_Handler::getTranslatedString('LBL_EXTERNAL', $module, vglobal('default_language'));
                } else {
                    $fieldvalue = '---';
                }
            }
        }
        if ($columnname == 'product_id') {
            $fieldvalues = getEntityName('Products', array($fieldvalue));
            $fieldvalue = '<a href="index.php?module=Products&action=index&productid=' . $fieldvalue . '">' . $fieldvalues[$fieldvalue] . '</a>';
        }
        if ($module == 'Products') {
            if ($fieldname == 'vendor_id') {
                $fieldvalue = get_vendor_name($fieldvalue);
            }
        }
        if ($module == 'Assets') {
            if ($fieldname == 'account') {
                $accountid = $adb->query_result($res, 0, 'account');
                $accountres = $adb->pquery("select vtiger_account.accountname from vtiger_account where accountid=?", array($accountid));
                $accountname = $adb->query_result($accountres, 0, 'accountname');
                $fieldvalue = $accountname;
            }
            if ($fieldname == 'product') {
                $productid = $adb->query_result($res, 0, 'product');
                $productres = $adb->pquery("select vtiger_products.productname from vtiger_products where productid=?", array($productid));
                $productname = $adb->query_result($productres, 0, 'productname');
                $fieldvalue = $productname;
            }
            if ($fieldname == 'invoiceid') {
                $invoiceid = $adb->query_result($res, 0, 'invoiceid');
                $invoiceres = $adb->pquery("select vtiger_invoice.subject from vtiger_invoice where invoiceid=?", array($invoiceid));
                $invoicename = $adb->query_result($invoiceres, 0, 'subject');
                $fieldvalue = $invoicename;
            }
        }
        if (in_array($uitype, array('15', '16', '120'))) {
            $output[0][$module][$i]['orgfieldvalue'] = $fieldvalue;
            $fieldvalue = Vtiger_Language_Handler::getTranslatedString($fieldvalue, $module, vglobal('default_language'));
        }
        if (in_array($uitype, array('10'))) {
            $fieldvalue = Vtiger_Functions::getCRMRecordLabel($fieldvalue);
        }
        if (in_array($uitype, array('53', '52', '77'))) {
            $fieldvalue = Vtiger_Functions::getOwnerRecordLabel($fieldvalue);
        }
        if ($fieldname == 'unit_price') {
            $sym = getCurrencySymbol($res, 0, 'currency_id');
            $fieldvalue = round($fieldvalue, 2);
            $fieldvalue = $sym . $fieldvalue;
        }
        $output[0][$module][$i]['fieldvalue'] = $fieldvalue;
    }
    if ($module == 'HelpDesk') {
        $ticketid = $adb->query_result($res, 0, 'ticketid');
        $sc_info = getRelatedServiceContracts($ticketid);
        if (!empty($sc_info)) {
            $modulename = 'ServiceContracts';
            $blocklable = Vtiger_Language_Handler::getTranslatedString('LBL_SERVICE_CONTRACT_INFORMATION', $modulename, vglobal('default_language'));
            $j = $i;
            for ($k = 0; $k < count($sc_info); $k++) {
                foreach ($sc_info[$k] as $label => $value) {
                    $output[0][$module][$j]['fieldlabel'] = Vtiger_Language_Handler::getTranslatedString($label, $modulename, vglobal('default_language'));
                    $output[0][$module][$j]['fieldvalue'] = $value;
                    $output[0][$module][$j]['blockname'] = $blocklable;
                    $j++;
                }
            }
        }
    }
    $log->debug("Existing customer portal function get_details ..");
    return $output;
}
开发者ID:JeRRimix,项目名称:YetiForceCRM,代码行数:101,代码来源:yetiportal.php

示例6: getOwnerName

/** Function to get owner name either user or group */
function getOwnerName($id)
{
    return Vtiger_Functions::getOwnerRecordLabel($id);
}
开发者ID:jmangarret,项目名称:vtigercrm,代码行数:5,代码来源:CommonUtils.php

示例7: process

    public function process($moduleName, $iD, $recordForm, $config)
    {
        $db = PearDatabase::getInstance();
        $params = [];
        $hierarchyAll = [];
        $save = true;
        $where = '';
        $hierarchyCheck = false;
        if ($iD != 0 && $iD != '' && !array_key_exists('vat_id', $recordForm)) {
            $recordModel = Vtiger_Record_Model::getInstanceById($iD, $moduleName);
            $vatId = $recordModel->get('vat_id');
        } else {
            if (array_key_exists('vat_id', $recordForm)) {
                $vatId = $recordForm['vat_id'];
            }
        }
        if ($iD != 0 && $iD != '' && !array_key_exists('accountname', $recordForm)) {
            $recordModel = Vtiger_Record_Model::getInstanceById($iD, $moduleName);
            $accountName = $recordModel->get('accountname');
        } else {
            if (array_key_exists('accountname', $recordForm)) {
                $accountName = $recordForm['accountname'];
            }
        }
        if ($vatId) {
            $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
            $hierarchyField = Vtiger_Field_Model::getInstance('account_id', $moduleModel);
            if ($hierarchyField->isActiveField()) {
                if (array_key_exists('account_id', $recordForm)) {
                    $hierarchyValue = $recordForm['account_id'];
                } elseif ($iD != 0 && $iD != '' && !array_key_exists('account_id', $recordForm)) {
                    $recordModel = Vtiger_Record_Model::getInstanceById($iD, $moduleName);
                    $hierarchyValue = $recordModel->get('account_id');
                }
                if ($hierarchyValue) {
                    $hierarchyAll = $this->getHierarchy($hierarchyValue, $moduleName, $iD);
                } elseif ($iD) {
                    $hierarchyAll = $this->getHierarchy($iD, $moduleName, $iD);
                }
            }
            $params[] = $vatId;
            $where .= ' vat_id = ?';
        } else {
            $params[] = $accountName;
            $where .= ' accountname = ?';
        }
        if ($iD != 0 && $iD != '') {
            $params[] = $iD;
            $where .= ' AND accountid <> ?';
        }
        if ($hierarchyAll && $vatId) {
            $hierarchyParams = array_merge($params, array_keys($hierarchyAll));
            $hierarchyQuery = 'SELECT accountid,accountname FROM vtiger_account WHERE ' . $where . ' AND accountid IN (' . $db->generateQuestionMarks($hierarchyAll) . ')';
            $result = $db->pquery($hierarchyQuery, $hierarchyParams);
            if ($db->getRowCount($result)) {
                $hierarchyCheck = true;
            }
            while ($row = $db->getRow($result)) {
                if ($row['accountname'] == $accountName) {
                    $metaData = Vtiger_Functions::getCRMRecordMetadata($row['accountid']);
                    $save = false;
                    $fieldlabel .= '<a target="_blank" href="index.php?module=Accounts&view=Detail&record=' . $row['accountid'] . '">&bull; ' . Vtiger_Functions::getCRMRecordLabel($row['accountid']) . '</a> (' . Vtiger_Functions::getOwnerRecordLabel($metaData['smownerid']) . '),<br/>';
                }
            }
        }
        if (!$hierarchyCheck) {
            $sql = "SELECT accountid FROM vtiger_account WHERE {$where};";
            $result = $db->pquery($sql, $params);
            while ($id = $db->getSingleValue($result)) {
                $metaData = Vtiger_Functions::getCRMRecordMetadata($id);
                $save = false;
                $deletedLabel = $metaData['deleted'] ? ' - ' . vtranslate('LBL_RECORD_DELETED', 'DataAccess') : '';
                $fieldlabel .= '<a target="_blank" href="index.php?module=Accounts&view=Detail&record=' . $id . '">&bull; ' . Vtiger_Functions::getCRMRecordLabel($id) . '</a> (' . Vtiger_Functions::getOwnerRecordLabel($metaData['smownerid']) . ')' . $deletedLabel . ',<br/>';
            }
        }
        if (!$save) {
            $permission = Users_Privileges_Model::isPermitted($moduleName, 'DuplicateRecord');
            $text = '<div class="marginLeft10">' . vtranslate('LBL_DUPLICATED_FOUND', 'DataAccess') . ': <br/ >' . trim($fieldlabel, ',') . '</div>';
            if ($permission) {
                $title = '<strong>' . vtranslate('LBL_DUPLICTAE_CREATION_CONFIRMATION', 'DataAccess') . '</strong>';
                if (!empty($iD)) {
                    $text .= '<form class="form-horizontal"><div class="checkbox">
							<label>
								<input type="checkbox" name="cache"> ' . vtranslate('LBL_DONT_ASK_AGAIN', 'DataAccess') . '
							</label>
						</div></form>';
                }
                if ($recordForm['view'] == 'quick_edit') {
                    $text = '<div class="alert alert-warning" role="alert">' . vtranslate('LBL_DUPLICTAE_QUICK_EDIT_CONFIRMATION', 'DataAccess') . '</div>' . $text;
                }
            }
            return array('save_record' => $save, 'type' => 3, 'info' => ['text' => $text, 'title' => $title, 'type' => $permission ? 1 : 0]);
        } else {
            return array('save_record' => true);
        }
    }
开发者ID:reeid,项目名称:YetiForceCRM,代码行数:96,代码来源:unique_account.php

示例8: showSearchResults

 /**
  * Function to display the Search Results
  * @param Vtiger_Request $request
  */
 function showSearchResults(Vtiger_Request $request)
 {
     $db = PearDatabase::getInstance();
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $advFilterList = $request->get('advfilterlist');
     //used to show the save modify filter option
     $isAdvanceSearch = false;
     $matchingRecords = array();
     if (is_array($advFilterList) && count($advFilterList) > 0) {
         $isAdvanceSearch = true;
         $user = Users_Record_Model::getCurrentUserModel();
         $queryGenerator = new QueryGenerator($moduleName, $user);
         $queryGenerator->setFields(['id']);
         vimport('~modules/CustomView/CustomView.php');
         $customView = new CustomView($moduleName);
         $dateSpecificConditions = $customView->getStdFilterConditions();
         foreach ($advFilterList as $groupindex => $groupcolumns) {
             $filtercolumns = $groupcolumns['columns'];
             if (count($filtercolumns) > 0) {
                 $queryGenerator->startGroup('');
                 foreach ($filtercolumns as $index => $filter) {
                     $nameComponents = explode(':', $filter['columnname']);
                     if (empty($nameComponents[2]) && $nameComponents[1] == 'crmid' && $nameComponents[0] == 'vtiger_crmentity') {
                         $name = $queryGenerator->getSQLColumn('id');
                     } else {
                         $name = $nameComponents[2];
                     }
                     if (($nameComponents[4] == 'D' || $nameComponents[4] == 'DT') && in_array($filter['comparator'], $dateSpecificConditions)) {
                         $filter['stdfilter'] = $filter['comparator'];
                         $valueComponents = explode(',', $filter['value']);
                         if ($filter['comparator'] == 'custom') {
                             $filter['startdate'] = DateTimeField::convertToDBFormat($valueComponents[0]);
                             $filter['enddate'] = DateTimeField::convertToDBFormat($valueComponents[1]);
                         }
                         $dateFilterResolvedList = $customView->resolveDateFilterValue($filter);
                         $value[] = $queryGenerator->fixDateTimeValue($name, $dateFilterResolvedList['startdate']);
                         $value[] = $queryGenerator->fixDateTimeValue($name, $dateFilterResolvedList['enddate'], false);
                         $queryGenerator->addCondition($name, $value, 'BETWEEN');
                     } else {
                         $queryGenerator->addCondition($name, $filter['value'], $filter['comparator']);
                     }
                     $columncondition = $filter['column_condition'];
                     if (!empty($columncondition) && array_key_exists($index + 1, $filtercolumns)) {
                         $queryGenerator->addConditionGlue($columncondition);
                     }
                 }
                 $queryGenerator->endGroup();
                 $groupConditionGlue = $groupcolumns['condition'];
                 if (!empty($groupConditionGlue)) {
                     $queryGenerator->addConditionGlue($groupConditionGlue);
                 }
             }
         }
         $query = $queryGenerator->getQuery();
         //Remove the ordering for now to improve the speed
         //$query .= ' ORDER BY createdtime DESC';
         $result = $db->query($query);
         while ($row = $db->fetch_array($result)) {
             $recordInstance = Vtiger_Record_Model::getInstanceById(current($row));
             $moduleName = $recordInstance->getModuleName();
             $recordInstance->set('permitted', true);
             $matchingRecords[$moduleName][current($row)] = $recordInstance;
         }
         $viewer->assign('SEARCH_MODULE', $moduleName);
     } else {
         $searchKey = $request->get('value');
         $searchModule = false;
         if ($request->get('searchModule')) {
             $searchModule = $request->get('searchModule');
         }
         $viewer->assign('SEARCH_KEY', $searchKey);
         $viewer->assign('SEARCH_MODULE', $searchModule);
         $matchingRecords = Vtiger_Record_Model::getSearchResult($searchKey, $searchModule, $request->get('limit'));
     }
     $recordsList = $matchingRecordsList = [];
     if ($matchingRecords[$moduleName]) {
         $matchingRecordsList[$moduleName] = $matchingRecords[$moduleName];
     }
     foreach ($matchingRecords as $module => $recordModelsList) {
         $matchingRecordsList[$module] = $recordModelsList;
     }
     if ($request->get('html') == 'true') {
         $viewer->assign('MODULE', $moduleName);
         $viewer->assign('MATCHING_RECORDS', $matchingRecordsList);
         $viewer->assign('IS_ADVANCE_SEARCH', $isAdvanceSearch);
         echo $viewer->view('UnifiedSearchResults.tpl', '', true);
     } else {
         foreach ($matchingRecordsList as $module => $modules) {
             foreach ($modules as $recordID => $recordModel) {
                 $label = decode_html($recordModel->getName());
                 $label .= ' (' . Vtiger_Functions::getOwnerRecordLabel($recordModel->get('smownerid')) . ')';
                 if (!$recordModel->get('permitted')) {
                     $label .= ' <span class="glyphicon glyphicon-warning-sign" aria-hidden="true"></span>';
                 }
                 $recordsList[] = ['id' => $recordID, 'module' => $module, 'category' => vtranslate($module, $module), 'label' => $label, 'permitted' => $recordModel->get('permitted')];
//.........这里部分代码省略.........
开发者ID:rcrrich,项目名称:YetiForceCRM,代码行数:101,代码来源:BasicAjax.php

示例9: process

 public function process($ModuleName, $ID, $record_form, $config)
 {
     $db = PearDatabase::getInstance();
     $ModuleNameID = Vtiger_Functions::getModuleId($ModuleName);
     $fieldlabel = $sql_ext = '';
     $save_record1 = true;
     $save_record2 = true;
     $save_record = true;
     $type = 0;
     $typeInfo = 'info';
     $info = false;
     if ($ID != 0 && $ID != '' && !array_key_exists($config['what1'], $record_form)) {
         $Record_Model = Vtiger_Record_Model::getInstanceById($ID, $ModuleName);
         $value1 = $Record_Model->get($config['what1']);
     } else {
         if (array_key_exists($config['what1'], $record_form)) {
             $value1 = $record_form[$config['what1']];
         }
     }
     if ($ID != 0 && $ID != '' && !array_key_exists($config['what2'], $record_form)) {
         $Record_Model = Vtiger_Record_Model::getInstanceById($ID, $ModuleName);
         $value2 = $Record_Model->get($config['what2']);
     } else {
         if (array_key_exists($config['what2'], $record_form)) {
             $value2 = $record_form[$config['what2']];
         }
     }
     if (!is_array($config['where1'])) {
         $wheres1[] = $config['where1'];
     } else {
         $wheres1 = $config['where1'];
     }
     if (!is_array($config['where2'])) {
         $wheres2[] = $config['where2'];
     } else {
         $wheres2 = $config['where2'];
     }
     if ($value1 != '') {
         foreach ($wheres1 as $where) {
             $where = explode('=', $where);
             $DestModuleName = Vtiger_Functions::getModuleName($where[2]);
             $ModuleInstance = CRMEntity::getInstance($DestModuleName);
             $tab_name_index = $ModuleInstance->tab_name_index;
             $index = $tab_name_index[$where[0]];
             $sql_param = array($value1);
             $sql_ext = '';
             $spacialCondition = '';
             $sqlSpecial = '';
             if ($ModuleNameID == $where[2] && $ID != 0 && $ID != '') {
                 $sql_param[] = $ID;
                 $sql_ext = 'AND ' . $index . ' <> ?';
             }
             if ($DestModuleName == 'Leads') {
                 $spacialCondition = ' AND `converted` = 0';
                 if ('vtiger_crmentity' == $where[0]) {
                     $sqlSpecial = 'INNER JOIN vtiger_leaddetails ON vtiger_crmentity.crmid = vtiger_leaddetails.leadid ';
                 }
             }
             $result = $db->pquery("SELECT {$index} FROM {$where[0]} {$sqlSpecial} WHERE {$where[1]} = ? {$sql_ext} {$spacialCondition};", $sql_param, true);
             $num = $db->num_rows($result);
             for ($i = 0; $i < $num; $i++) {
                 $id = $db->query_result_raw($result, $i, $index);
                 $metadata = Vtiger_Functions::getCRMRecordMetadata($id);
                 if ($metadata['setype'] == $DestModuleName) {
                     $save_record1 = false;
                     $deletedLabel = $metadata['deleted'] ? ' - ' . vtranslate('LBL_RECORD_DELETED', 'DataAccess') : '';
                     $fieldlabel .= '<a target="_blank" href="index.php?module=' . $DestModuleName . '&view=Detail&record=' . $id . '">&bull; ' . Vtiger_Functions::getCRMRecordLabel($id) . '</a> (' . Vtiger_Functions::getOwnerRecordLabel($metadata['smownerid']) . ')' . $deletedLabel . ',<br/>';
                 }
             }
         }
     }
     if ($value2 != '') {
         foreach ($wheres2 as $where) {
             $where = explode('=', $where);
             $DestModuleName = Vtiger_Functions::getModuleName($where[2]);
             $ModuleInstance = CRMEntity::getInstance($DestModuleName);
             $tab_name_index = $ModuleInstance->tab_name_index;
             $index = $tab_name_index[$where[0]];
             $sql_param = array($value2);
             $sql_ext = '';
             $spacialCondition = '';
             $sqlSpecial = '';
             if ($ModuleNameID == $where[2] && $ID != 0 && $ID != '') {
                 $sql_param[] = $ID;
                 $sql_ext = 'AND ' . $index . ' <> ?';
             }
             if ($DestModuleName == 'Leads') {
                 $spacialCondition = ' AND `converted` = 0';
                 if ('vtiger_crmentity' == $where[0]) {
                     $sqlSpecial = 'INNER JOIN vtiger_leaddetails ON vtiger_crmentity.crmid = vtiger_leaddetails.leadid ';
                 }
             }
             $result = $db->pquery("SELECT {$index} FROM {$where[0]} WHERE {$where[1]} = ? {$sql_ext};", $sql_param, true);
             $num = $db->num_rows($result);
             for ($i = 0; $i < $num; $i++) {
                 $id = $db->query_result_raw($result, $i, $index);
                 $metadata = Vtiger_Functions::getCRMRecordMetadata($id);
                 if ($metadata['setype'] == $DestModuleName) {
                     $save_record2 = false;
                     $deletedLabel = $metadata['deleted'] ? ' - ' . vtranslate('LBL_RECORD_DELETED', 'DataAccess') : '';
//.........这里部分代码省略.........
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:101,代码来源:unique_value.php

示例10: getEntity

 public function getEntity()
 {
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $db = PearDatabase::getInstance();
     $data = $this->getQuery();
     $result = $db->pquery($data['query'], $data['params']);
     $return = [];
     while ($record = $db->fetch_array($result)) {
         $item = [];
         $crmid = $record['activityid'];
         $activitytype = $record['activitytype'];
         $item['id'] = $crmid;
         $item['module'] = $this->getModuleName();
         $item['title'] = $record['subject'];
         $item['url'] = 'index.php?module=' . $this->getModuleName() . '&view=Detail&record=' . $crmid;
         $item['set'] = $record['activitytype'] == 'Task' ? 'Task' : 'Event';
         $item['lok'] = $record['location'];
         $item['pri'] = $record['priority'];
         $item['sta'] = $record['status'];
         $item['vis'] = $record['visibility'];
         $item['state'] = $record['state'];
         $item['smownerid'] = Vtiger_Functions::getOwnerRecordLabel($record['smownerid']);
         //translate
         $item['labels']['sta'] = vtranslate($record['status'], $this->getModuleName());
         $item['labels']['pri'] = vtranslate($record['priority'], $this->getModuleName());
         $item['labels']['state'] = vtranslate($record['state'], $this->getModuleName());
         //Relation
         $item['link'] = $record['link'];
         $item['linkl'] = $record['linklabel'];
         $item['linkm'] = $record['linkmod'];
         //Process
         $item['process'] = $record['process'];
         $item['procl'] = $record['processlabel'];
         $item['procm'] = $record['processmod'];
         if ($record['linkmod'] != 'Accounts' && (!empty($record['link']) || !empty($record['process']))) {
             $findId = 0;
             $findMod = '';
             if (!empty($record['link'])) {
                 $findId = $record['link'];
                 $findMod = $record['linkmod'];
             }
             if (!empty($record['process'])) {
                 $findId = $record['process'];
                 $findMod = $record['processmod'];
             }
             $tabInfo = $this->relationAcounts[$findMod];
             if ($tabInfo) {
                 $findResult = $db->pquery('SELECT accountid, accountname FROM vtiger_account ' . 'INNER JOIN ' . $tabInfo[0] . ' ON vtiger_account.accountid = ' . $tabInfo[0] . '.' . $tabInfo[2] . ' WHERE ' . $tabInfo[1] . ' = ?;', [$findId]);
                 if ($db->num_rows($findResult) > 0) {
                     $item['accid'] = $db->query_result_raw($findResult, 0, 'accountid');
                     $item['accname'] = $db->query_result_raw($findResult, 0, 'accountname');
                 }
             }
         }
         $dateTimeFieldInstance = new DateTimeField($record['date_start'] . ' ' . $record['time_start']);
         $userDateTimeString = $dateTimeFieldInstance->getFullcalenderDateTimevalue($currentUser);
         $dateTimeComponents = explode(' ', $userDateTimeString);
         $dateComponent = $dateTimeComponents[0];
         $startTimeFormated = $dateTimeComponents[1];
         //Conveting the date format in to Y-m-d . since full calendar expects in the same format
         $startDateFormated = DateTimeField::__convertToDBFormat($dateComponent, $currentUser->get('date_format'));
         $dateTimeFieldInstance = new DateTimeField($record['due_date'] . ' ' . $record['time_end']);
         $userDateTimeString = $dateTimeFieldInstance->getFullcalenderDateTimevalue($currentUser);
         $dateTimeComponents = explode(' ', $userDateTimeString);
         $dateComponent = $dateTimeComponents[0];
         $endTimeFormated = $dateTimeComponents[1];
         //Conveting the date format in to Y-m-d . since full calendar expects in the same format
         $endDateFormated = DateTimeField::__convertToDBFormat($dateComponent, $currentUser->get('date_format'));
         $item['start'] = $startDateFormated . ' ' . $startTimeFormated;
         $item['end'] = $endDateFormated . ' ' . $endTimeFormated;
         $item['allDay'] = $record['allday'] == 1 ? true : false;
         $item['className'] = ' userCol_' . $record['smownerid'] . ' calCol_' . $activitytype;
         $return[] = $item;
     }
     return $return;
 }
开发者ID:yozhi,项目名称:YetiForceCRM,代码行数:76,代码来源:Calendar.php

示例11: process

 public function process($ModuleName, $ID, $record_form, $config)
 {
     $db = PearDatabase::getInstance();
     $ModuleNameID = Vtiger_Functions::getModuleId($ModuleName);
     $sql_ext = '';
     $save_record1 = true;
     $save_record2 = true;
     $save_record = true;
     $type = 'info';
     $info = false;
     if ($ID != 0 && $ID != '' && !array_key_exists($config['what1'], $record_form)) {
         $Record_Model = Vtiger_Record_Model::getInstanceById($ID, $ModuleName);
         $value1 = $Record_Model->get($config['what1']);
     } else {
         if (array_key_exists($config['what1'], $record_form)) {
             $value1 = $record_form[$config['what1']];
         }
     }
     if ($ID != 0 && $ID != '' && !array_key_exists($config['what2'], $record_form)) {
         $Record_Model = Vtiger_Record_Model::getInstanceById($ID, $ModuleName);
         $value2 = $Record_Model->get($config['what2']);
     } else {
         if (array_key_exists($config['what2'], $record_form)) {
             $value2 = $record_form[$config['what2']];
         }
     }
     if (!is_array($config['where1'])) {
         $wheres1[] = $config['where1'];
     } else {
         $wheres1 = $config['where1'];
     }
     if (!is_array($config['where2'])) {
         $wheres2[] = $config['where2'];
     } else {
         $wheres2 = $config['where2'];
     }
     if ($value1 != '') {
         foreach ($wheres1 as $where) {
             $where = explode('=', $where);
             $DestModuleName = Vtiger_Functions::getModuleName($where[2]);
             $ModuleInstance = CRMEntity::getInstance($DestModuleName);
             $tab_name_index = $ModuleInstance->tab_name_index;
             $index = $tab_name_index[$where[0]];
             $sql_param = array($value1);
             $sql_ext = '';
             if ($ModuleNameID == $where[2] && $ID != 0 && $ID != '') {
                 $sql_param[] = $ID;
                 $sql_ext = 'AND ' . $index . ' <> ?';
             }
             $result = $db->pquery("SELECT {$index} FROM {$where[0]} WHERE {$where[1]} = ? {$sql_ext};", $sql_param, true);
             for ($i = 0; $i < $db->num_rows($result); $i++) {
                 $save_record1 = false;
                 $id = $db->query_result_raw($result, $i, $index);
                 $result = $db->pquery("SELECT smownerid FROM vtiger_crmentity WHERE crmid = ?", array($id), true);
                 $fieldlabel .= '<a target="_blank" href="index.php?module=' . $DestModuleName . '&view=Detail&record=' . $id . '">&bull; ' . Vtiger_Functions::getCRMRecordLabel($id) . '</a> (' . Vtiger_Functions::getOwnerRecordLabel($db->query_result($result, 0, 'smownerid')) . '),';
             }
         }
     }
     if ($value2 != '') {
         foreach ($wheres2 as $where) {
             $where = explode('=', $where);
             $DestModuleName = Vtiger_Functions::getModuleName($where[2]);
             $ModuleInstance = CRMEntity::getInstance($DestModuleName);
             $tab_name_index = $ModuleInstance->tab_name_index;
             $index = $tab_name_index[$where[0]];
             $sql_param = array($value1);
             $sql_ext = '';
             if ($ModuleNameID == $where[2] && $ID != 0 && $ID != '') {
                 $sql_param[] = $ID;
                 $sql_ext = 'AND ' . $index . ' <> ?';
             }
             $result = $db->pquery("SELECT {$index} FROM {$where[0]} WHERE {$where[1]} = ? {$sql_ext};", $sql_param, true);
             for ($i = 0; $i < $db->num_rows($result); $i++) {
                 $save_record2 = false;
                 $id = $db->query_result_raw($result, $i, $index);
                 $result = $db->pquery("SELECT smownerid FROM vtiger_crmentity WHERE crmid = ?", array($id), true);
                 $fieldlabel .= '<a target="_blank" href="index.php?module=' . $DestModuleName . '&view=Detail&record=' . $id . '">&bull; ' . Vtiger_Functions::getCRMRecordLabel($id) . '</a> (' . Vtiger_Functions::getOwnerRecordLabel($db->query_result($result, 0, 'smownerid')) . '),';
             }
         }
     }
     if ($config['locksave'] == 0 && $ID == '') {
         $info = $config['info0'];
     } elseif (!$save_record1 && !$save_record2) {
         $type = 'error';
         $save_record = false;
         $info = $config['info2'];
     } elseif (!$save_record1 || !$save_record2) {
         $type = 'error';
         $save_record = false;
         $info = $config['info1'];
     }
     if (!$save_record || $info) {
         return array('save_record' => $save_record, 'type' => 0, 'info' => array('title' => vtranslate($info, 'DataAccess') . ' <br/ >' . trim($fieldlabel, ','), 'type' => $type, 'hide' => false));
     } else {
         return array('save_record' => true);
     }
 }
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:97,代码来源:unique_value.php

示例12: process

    public function process($moduleName, $iD, $record_form, $config)
    {
        $db = PearDatabase::getInstance();
        $moduleNameID = Vtiger_Functions::getModuleId($moduleName);
        $fieldlabel = $sql_ext = '';
        $save_record1 = true;
        $save_record2 = true;
        $save_record = true;
        $type = 0;
        $typeInfo = 'info';
        $info = false;
        if ($iD != 0 && $iD != '' && !array_key_exists($config['what1'], $record_form)) {
            $Record_Model = Vtiger_Record_Model::getInstanceById($iD, $moduleName);
            $value1 = $Record_Model->get($config['what1']);
        } else {
            if (array_key_exists($config['what1'], $record_form)) {
                $value1 = $record_form[$config['what1']];
            }
        }
        if ($iD != 0 && $iD != '' && !array_key_exists($config['what2'], $record_form)) {
            $Record_Model = Vtiger_Record_Model::getInstanceById($iD, $moduleName);
            $value2 = $Record_Model->get($config['what2']);
        } else {
            if (array_key_exists($config['what2'], $record_form)) {
                $value2 = $record_form[$config['what2']];
            }
        }
        if (!is_array($config['where1'])) {
            $wheres1[] = $config['where1'];
        } else {
            $wheres1 = $config['where1'];
        }
        if (!is_array($config['where2'])) {
            $wheres2[] = $config['where2'];
        } else {
            $wheres2 = $config['where2'];
        }
        if ($value1 != '') {
            foreach ($wheres1 as $where) {
                $where = explode('=', $where);
                $DestModuleName = Vtiger_Functions::getModuleName($where[2]);
                $ModuleInstance = CRMEntity::getInstance($DestModuleName);
                $tab_name_index = $ModuleInstance->tab_name_index;
                $index = $tab_name_index[$where[0]];
                $sql_param = array($value1);
                $sql_ext = '';
                $spacialCondition = '';
                $sqlSpecial = '';
                if ($moduleNameID == $where[2] && $iD != 0 && $iD != '') {
                    $sql_param[] = $iD;
                    $sql_ext = 'AND ' . $index . ' <> ?';
                }
                if ($DestModuleName == 'Leads') {
                    $spacialCondition = ' AND `converted` = 0';
                    if ('vtiger_crmentity' == $where[0]) {
                        $sqlSpecial = 'INNER JOIN vtiger_leaddetails ON vtiger_crmentity.crmid = vtiger_leaddetails.leadid ';
                    }
                }
                $result = $db->pquery("SELECT {$index} FROM {$where[0]} {$sqlSpecial} WHERE {$where[1]} = ? {$sql_ext} {$spacialCondition};", $sql_param, true);
                $num = $db->num_rows($result);
                for ($i = 0; $i < $num; $i++) {
                    $id = $db->query_result_raw($result, $i, $index);
                    $metadata = Vtiger_Functions::getCRMRecordMetadata($id);
                    if ($metadata['setype'] == $DestModuleName) {
                        $save_record1 = false;
                        $deletedLabel = $metadata['deleted'] ? ' - ' . vtranslate('LBL_RECORD_DELETED', 'DataAccess') : '';
                        $fieldlabel .= '<li><a target="_blank" href="index.php?module=' . $DestModuleName . '&view=Detail&record=' . $id . '"><strong>' . Vtiger_Functions::getCRMRecordLabel($id) . '</strong></a> (' . Vtiger_Functions::getOwnerRecordLabel($metadata['smownerid']) . ')' . $deletedLabel . ',</li>';
                    }
                }
            }
        }
        if ($value2 != '') {
            foreach ($wheres2 as $where) {
                $where = explode('=', $where);
                $DestModuleName = Vtiger_Functions::getModuleName($where[2]);
                $ModuleInstance = CRMEntity::getInstance($DestModuleName);
                $tab_name_index = $ModuleInstance->tab_name_index;
                $index = $tab_name_index[$where[0]];
                $sql_param = array($value2);
                $sql_ext = '';
                $spacialCondition = '';
                $sqlSpecial = '';
                if ($moduleNameID == $where[2] && $iD != 0 && $iD != '') {
                    $sql_param[] = $iD;
                    $sql_ext = 'AND ' . $index . ' <> ?';
                }
                if ($DestModuleName == 'Leads') {
                    $spacialCondition = ' AND `converted` = 0';
                    if ('vtiger_crmentity' == $where[0]) {
                        $sqlSpecial = 'INNER JOIN vtiger_leaddetails ON vtiger_crmentity.crmid = vtiger_leaddetails.leadid ';
                    }
                }
                $result = $db->pquery("SELECT {$index} FROM {$where[0]} WHERE {$where[1]} = ? {$sql_ext};", $sql_param, true);
                $num = $db->num_rows($result);
                for ($i = 0; $i < $num; $i++) {
                    $id = $db->query_result_raw($result, $i, $index);
                    $metadata = Vtiger_Functions::getCRMRecordMetadata($id);
                    if ($metadata['setype'] == $DestModuleName) {
                        $save_record2 = false;
                        $deletedLabel = $metadata['deleted'] ? ' - ' . vtranslate('LBL_RECORD_DELETED', 'DataAccess') : '';
//.........这里部分代码省略.........
开发者ID:HoererUndFlamme,项目名称:YetiForceCRM,代码行数:101,代码来源:unique_value.php


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