本文整理汇总了PHP中Vtiger_Functions::getCRMRecordType方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Functions::getCRMRecordType方法的具体用法?PHP Vtiger_Functions::getCRMRecordType怎么用?PHP Vtiger_Functions::getCRMRecordType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Functions
的用法示例。
在下文中一共展示了Vtiger_Functions::getCRMRecordType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRelatedModuleRecordIds
public function getRelatedModuleRecordIds(Vtiger_Request $request, $recordIds = [])
{
$db = PearDatabase::getInstance();
$basicModule = $request->getModule();
$relatedModules = $request->get('related_modules');
$parentModuleModel = Vtiger_Module_Model::getInstance($basicModule);
$relatedIds = [];
if (!empty($relatedModules)) {
foreach ($relatedModules as $relModData) {
$relModData = explode('::', $relModData);
$relatedModule = $relModData[0];
$type = $relModData[1];
switch ($type) {
case 0:
$field = $relModData[2];
foreach ($recordIds as $recordId) {
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $basicModule);
if ($recordModel->get($field) != 0 && Vtiger_Functions::getCRMRecordType($recordModel->get($field)) == $relatedModule) {
$relatedIds[] = $recordModel->get($field);
}
}
break;
case 1:
$relatedModuleModel = Vtiger_Module_Model::getInstance($relatedModule);
$instance = CRMEntity::getInstance($relatedModule);
$relationModel = Vtiger_Relation_Model::getInstance($parentModuleModel, $relatedModuleModel);
$fieldModel = $relationModel->getRelationField();
$tablename = $fieldModel->get('table');
$tabIndex = $instance->table_index;
$relIndex = $this->getRelatedFieldName($relatedModule, $basicModule);
if (!$relIndex) {
break;
}
$sql = "SELECT vtiger_crmentity.crmid FROM vtiger_crmentity INNER JOIN {$tablename} ON {$tablename}.{$tabIndex} = vtiger_crmentity.crmid\n\t\t\t\t\t\tWHERE {$tablename}.{$relIndex} IN (" . $db->generateQuestionMarks($recordIds) . ")";
$result = $db->pquery($sql, $recordIds);
while ($crmid = $db->getSingleValue($result)) {
$relatedIds[] = $crmid;
}
break;
case 2:
foreach ($recordIds as $recordId) {
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $basicModule);
$relationListView = Vtiger_RelationListView_Model::getInstance($recordModel, $relatedModule);
$query = $relationListView->getRelationQuery();
$queryEx = explode('FROM', $query, 2);
$query = 'SELECT DISTINCT vtiger_crmentity.crmid FROM' . $queryEx[1];
$result = $db->query($query);
while ($crmid = $db->getSingleValue($result)) {
$relatedIds[] = $crmid;
}
}
break;
}
$relatedIds = array_unique($relatedIds);
}
}
return $relatedIds;
}
示例2: bind_prefix
function bind_prefix($user_id, $mail_detail, $folder, $moduleName, $table_name, $table_col)
{
$adb = PearDatabase::getInstance();
if ($mail_detail['ossmailviewid'] == '') {
$result_ossmailview = $adb->pquery("SELECT ossmailviewid FROM vtiger_ossmailview where uid = ? AND rc_user = ? ", [$mail_detail['message_id'], $user_id]);
if ($adb->num_rows($result_ossmailview) == 0) {
return FALSE;
}
$mailViewId = $adb->query_result($result_ossmailview, 0, 'ossmailviewid');
} else {
$mailViewId = $mail_detail['ossmailviewid'];
}
$relationExist = false;
$relationExistResult = $adb->pquery("SELECT crmid FROM vtiger_ossmailview_relation WHERE ossmailviewid = ?;", [$mailViewId]);
for ($i = 0; $i < $adb->num_rows($relationExistResult); $i++) {
$crmid = $adb->query_result_raw($relationExistResult, $i, 'crmid');
$type = Vtiger_Functions::getCRMRecordType($crmid);
if ($type == $moduleName) {
$relationExist = TRUE;
}
}
if ($relationExist) {
return false;
}
$emailNumPrefix = OSSMailScanner_Record_Model::findEmailNumPrefix($moduleName, $mail_detail['subject']);
if (!$emailNumPrefix) {
return false;
}
require_once "modules/{$moduleName}/{$moduleName}.php";
$moduleObject = new $moduleName();
$tableIndex = $moduleObject->table_index;
$return_id = [];
$result = $adb->pquery("SELECT {$tableIndex} FROM " . $table_name . " INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = " . $table_name . "." . $tableIndex . " WHERE vtiger_crmentity.deleted = 0 AND " . $table_col . " = ? ", [$emailNumPrefix]);
if ($adb->num_rows($result) > 0) {
$crmid = $adb->getSingleValue($result);
$resultRelation = $adb->pquery('SELECT * FROM vtiger_ossmailview_relation WHERE ossmailviewid=? AND crmid=?', [$mailViewId, $crmid]);
if ($resultRelation->rowCount() == 0) {
$adb->pquery('INSERT INTO vtiger_ossmailview_relation SET ossmailviewid=?, crmid=?, date=?', [$mailViewId, $crmid, $mail_detail['udate_formated']]);
$return_id[] = $crmid;
}
}
return $return_id;
}
示例3: getActiveTemplatesForRecord
public function getActiveTemplatesForRecord($recordId, $view, $moduleName = false)
{
$log = vglobal('log');
$log->debug('Entering ' . __CLASS__ . '::' . __METHOD__ . '(' . $recordId . ',' . $view . ',' . $moduleName . ') method ...');
if (!isRecordExists($recordId)) {
$log->debug('Exiting ' . __CLASS__ . '::' . __METHOD__ . ' method ...');
return [];
}
if (!$moduleName) {
$moduleName = Vtiger_Functions::getCRMRecordType($recordId);
}
$templates = $this->getTemplatesByModule($moduleName);
foreach ($templates as $id => &$template) {
if (!$template->checkFiltersForRecord($recordId) || !$template->checkUserPermissions() || !Users_Privileges_Model::isPermitted($template->getRelatedName(), 'EditView')) {
unset($templates[$id]);
}
}
$log->debug('Exiting ' . __CLASS__ . '::' . __METHOD__ . ' method ...');
return $templates;
}
示例4: UpdatePotential
function UpdatePotential($potentialId)
{
if (!isRecordExists($potentialId) || Vtiger_Functions::getCRMRecordType($potentialId) != 'Potentials') {
return false;
}
$db = PearDatabase::getInstance();
$potentialTotal = 0;
$paymentsIn = 0;
$paymentsOut = 0;
$sql = 'SELECT SUM(i.`total`) AS total FROM `vtiger_invoice` i INNER JOIN `vtiger_potential` p ON i.`potentialid` = p.`potentialid` WHERE p.`potentialid` = ?;';
$params = array($potentialId);
$result = $db->pquery($sql, $params);
$potentialTotal = $db->query_result($result, 0, 'total');
$sql = 'SELECT i.`invoiceid` FROM `vtiger_invoice` i INNER JOIN `vtiger_potential` p ON i.`potentialid` = p.`potentialid` WHERE p.`potentialid` = ?;';
$params = array($potentialId);
$result = $db->pquery($sql, $params);
$invNum = $db->num_rows($result);
if ($invNum > 0) {
for ($i = 0; $i < $invNum; $i++) {
$invoiceId = $db->query_result($result, $i, 'invoiceid');
if (!isRecordExists($invoiceId)) {
continue;
}
// get sum of payments in
$sql = 'SELECT SUM(`paymentsvalue`) AS suma FROM `vtiger_paymentsin` WHERE `salesid` = ? AND `paymentsin_status` = ?;';
$params = array($invoiceId, 'Paid');
$inResult = $db->pquery($sql, $params);
$paymentsIn += $db->query_result($inResult, 0, 'suma');
// get sum of payments out
$sql = 'SELECT SUM(`paymentsvalue`) AS suma FROM `vtiger_paymentsout` WHERE `salesid` = ? AND `paymentsout_status` = ?;';
$inResult = $db->pquery($sql, $params);
$paymentsOut += $db->query_result($inResult, 0, 'suma');
}
}
$paymentsSum = $paymentsIn - $paymentsOut;
$balance = $potentialTotal - $paymentsSum;
$sql = 'UPDATE `vtiger_potential` SET `payment_balance` = ? WHERE `potentialid` = ? LIMIT 1;';
$params = array($balance, $potentialId);
$db->pquery($sql, $params);
}
示例5: generateBaseRecord
private function generateBaseRecord($templateId, $relId = NULL)
{
$moduleType = $this->templateModuleType($templateId);
require_once "modules/{$moduleType}/{$moduleType}.php";
$baseModule = new $moduleType();
$moduleConfig = $this->moduleModel->getConfigurationForModule($moduleType);
foreach ($moduleConfig as $key => $value) {
require_once "modules/OSSProjectTemplates/fields_action/{$value}.php";
$fieldClass = Field_Model_ . $value;
$field = new $fieldClass();
$baseModule->column_fields[$key] = $field->getValue($key, $relId, $templateId);
}
$baseModule->save($moduleType);
$id = $baseModule->id;
if (!!$relId) {
$this->setRel($relId, Vtiger_Functions::getCRMRecordType($relId), $id, $moduleType);
}
$db = PearDatabase::getInstance();
$db->query("update {$baseModule->table_name} set {$baseModule->list_link_field} = replace({$baseModule->list_link_field}, 'ó', 'ó') WHERE {$baseModule->table_index} = {$id}", TRUE);
$db->query("update vtiger_crmentity set label = replace(label, 'ó', 'ó') WHERE crmid = {$id}", TRUE);
return $id;
}
示例6: process
public function process(Vtiger_Request $request)
{
$adb = PearDatabase::getInstance();
$moduleName = $request->getModule();
$id = $request->get('id');
$sourceModule = $request->get('sourceModule');
$sourceData = array();
if (isRecordExists($id)) {
$record = Vtiger_Record_Model::getInstanceById($id, $sourceModule);
$entity = $record->getEntity();
$sourceData = $entity->column_fields;
if ($sourceModule == 'HelpDesk') {
$sourceData['contact_label'] = Vtiger_Functions::getCRMRecordLabel($sourceData['contact_id']);
if (Vtiger_Functions::getCRMRecordType($sourceData['parent_id']) != 'Accounts') {
unset($sourceData['parent_id']);
} else {
$sourceData['account_label'] = Vtiger_Functions::getCRMRecordLabel($sourceData['parent_id']);
}
} else {
if ($sourceModule == 'Project') {
$ifExist = $adb->query("select * from vtiger_account where accountid = " . $sourceData['linktoaccountscontacts'] . "", true, "Błąd podczas pobierania danych z vtiger_crmentityrel");
if ($adb->num_rows($ifExist) > 0) {
$sourceData['account_label'] = Vtiger_Functions::getCRMRecordLabel($sourceData['linktoaccountscontacts']);
} else {
$sourceData['contact_label'] = Vtiger_Functions::getCRMRecordLabel($sourceData['linktoaccountscontacts']);
}
}
}
}
if ($sourceData === false) {
$result = array('success' => false, 'message' => vtranslate('LBL_FAILED_TO_IMPORT_INFO', $moduleName));
} else {
$result = array('success' => true, 'sourceData' => $sourceData);
}
$response = new Vtiger_Response();
$response->setResult($result);
$response->emit();
}
示例7: HeldDeskNewCommentAccount
function HeldDeskNewCommentAccount($entityData)
{
$log = vglobal('log');
$db = PearDatabase::getInstance();
$log->debug('Entering HeldDeskNewCommentAccount');
$wsId = $entityData->getId();
$parts = explode('x', $wsId);
$entityId = $parts[1];
$data = $entityData->getData();
$relatedToWSId = $data['related_to'];
$relatedToId = explode('x', $relatedToWSId);
$moduleName = Vtiger_Functions::getCRMRecordType($relatedToId[1]);
$mail = false;
if (!empty($relatedToWSId) && $moduleName == 'HelpDesk') {
if ($moduleName == 'HelpDesk') {
$sql = 'SELECT vtiger_account.email1 FROM vtiger_account
INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_account.accountid
INNER JOIN vtiger_troubletickets ON vtiger_troubletickets.parent_id = vtiger_account.accountid
WHERE vtiger_crmentity.deleted = 0 AND vtiger_troubletickets.ticketid = ? AND vtiger_account.emailoptout = 1';
$result = $db->pquery($sql, [$relatedToId[1]]);
if ($result->rowCount() > 0) {
$mail = $db->getSingleValue($result);
}
}
}
if ($mail) {
$data = ['sysname' => 'NewCommentAddedToTicketAccount', 'to_email' => $mail, 'module' => 'ModComments', 'record' => $entityId];
$recordModel = Vtiger_Record_Model::getCleanInstance('OSSMailTemplates');
if ($recordModel->sendMailFromTemplate($data)) {
$log->debug('HeldDeskNewCommentAccount');
return true;
}
}
$log->debug('HeldDeskNewCommentAccount');
return false;
}
示例8: findEmail
public function findEmail($id, $module)
{
if (!isRecordExists($id)) {
return false;
}
$returnEmail = '';
if (strcmp($module, 'HelpDesk') != 0 && strcmp($module, 'Potentials') != 0 && strcmp($module, 'Project') != 0) {
$polaEmail = OSSMailScanner_Record_Model::getEmailSearch($module);
if (count($polaEmail) > 0) {
$recordModel = Vtiger_Record_Model::getInstanceById($id, $module);
foreach ($polaEmail as $em) {
$email = $recordModel->get($em[2]);
if (!empty($email)) {
$returnEmail = $email;
}
}
}
} else {
$kontrahentId = '';
$kontaktId = '';
if (strcmp($module, 'HelpDesk') == 0) {
$helpdeskRecord = Vtiger_Record_Model::getInstanceById($id, $module);
$kontrahentId = $helpdeskRecord->get('parent_id');
$kontaktId = $helpdeskRecord->get('contact_id');
} else {
if (strcmp($module, 'Potentials') == 0) {
$helpdeskRecord = Vtiger_Record_Model::getInstanceById($id, $module);
$kontrahentId = $helpdeskRecord->get('related_to');
} else {
if (strcmp($module, 'Project') == 0) {
$helpdeskRecord = Vtiger_Record_Model::getInstanceById($id, $module);
$kontrahentId = $helpdeskRecord->get('linktoaccountscontacts');
}
}
}
// czy kontrahent istnieje
if (isRecordExists($kontrahentId)) {
$nazwaModulu = Vtiger_Functions::getCRMRecordType($kontrahentId);
$returnEmail = $this->findEmail($kontrahentId, $nazwaModulu);
}
if (isRecordExists($kontaktId)) {
$nazwaModulu = Vtiger_Functions::getCRMRecordType($kontaktId);
$returnEmail = $this->findEmail($kontaktId, $nazwaModulu);
}
}
return $returnEmail;
}
示例9: getSourceRelatedFieldToQuickCreate
public function getSourceRelatedFieldToQuickCreate($moduleName, $sourceModule = false, $sourceRecord = false)
{
$data = [];
if ($sourceModule && $sourceRecord) {
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$sourceModuleModel = Vtiger_Module_Model::getInstance($sourceModule);
$recordModel = Vtiger_Record_Model::getInstanceById($sourceRecord, $sourceModule);
$relationField = false;
$fieldMap = [];
$modelFields = $moduleModel->getFields();
foreach ($modelFields as $fieldName => $fieldModel) {
if ($fieldModel->getFieldDataType() == Vtiger_Field_Model::REFERENCE_TYPE) {
$referenceList = $fieldModel->getReferenceList();
foreach ($referenceList as $referenceModule) {
$fieldMap[$referenceModule] = $fieldName;
}
if (in_array($sourceModule, $referenceList)) {
$relationField = $fieldName;
}
}
}
$sourceModelFields = $sourceModuleModel->getFields();
foreach ($sourceModelFields as $fieldName => $fieldModel) {
if ($fieldModel->getFieldDataType() == Vtiger_Field_Model::REFERENCE_TYPE) {
$referenceList = $fieldModel->getReferenceList();
foreach ($referenceList as $referenceModule) {
if (isset($fieldMap[$referenceModule])) {
$fieldValue = $recordModel->get($fieldName);
if ($fieldValue != 0 && Vtiger_Functions::getCRMRecordType($fieldValue) == $referenceModule) {
$data[$fieldMap[$referenceModule]] = $fieldValue;
}
}
}
}
}
if ($relationField) {
$data[$relationField] = $sourceRecord;
}
}
return $data;
}
示例10: trash
/** Function to delete an entity with given Id */
function trash($module, $id)
{
global $log, $current_user, $adb;
$recordType = Vtiger_Functions::getCRMRecordType($id);
if ($recordType != $module) {
throw new AppException(vtranslate('LBL_PERMISSION_DENIED'));
}
if (!self::isBulkSaveMode()) {
require_once "include/events/include.inc";
$em = new VTEventsManager($adb);
// Initialize Event trigger cache
$em->initTriggerCache();
$entityData = VTEntityData::fromEntityId($adb, $id);
$em->triggerEvent("vtiger.entity.beforedelete", $entityData);
}
$this->mark_deleted($id);
$this->unlinkDependencies($module, $id);
require_once 'libraries/freetag/freetag.class.php';
$freetag = new freetag();
$freetag->delete_all_object_tags_for_user($current_user->id, $id);
$sql_recentviewed = 'DELETE FROM vtiger_tracker WHERE user_id = ? AND item_id = ?';
$this->db->pquery($sql_recentviewed, array($current_user->id, $id));
if ($em) {
$em->triggerEvent("vtiger.entity.afterdelete", $entityData);
}
}
示例11: getSalesEntityType
function getSalesEntityType($crmid)
{
return Vtiger_Functions::getCRMRecordType($crmid);
}
示例12: getActiveTemplatesForRecord
public function getActiveTemplatesForRecord($recordId, $view, $moduleName = false)
{
if (!isRecordExists($recordId)) {
return [];
}
if (!$moduleName) {
$moduleName = Vtiger_Functions::getCRMRecordType($recordId);
}
$templates = $this->getTemplatesByModule($moduleName);
foreach ($templates as $id => &$template) {
$active = true;
if (!$template->isVisible($view) || !$template->checkFiltersForRecord($recordId) || !$template->checkUserPermissions()) {
unset($templates[$id]);
}
}
return $templates;
}
示例13: process
public function process(Vtiger_Request $request)
{
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$record = $request->get('record');
$sourceRecord = $request->get('sourceRecord');
$sourceModule = $request->get('sourceModule');
if (!empty($record) && $request->get('isDuplicate') == true) {
$recordModel = Inventory_Record_Model::getInstanceById($record, $moduleName);
$currencyInfo = $recordModel->getCurrencyInfo();
$taxes = $recordModel->getProductTaxes();
$relatedProducts = $recordModel->getProducts();
$viewer->assign('MODE', '');
} elseif (!empty($record)) {
$recordModel = Inventory_Record_Model::getInstanceById($record, $moduleName);
$currencyInfo = $recordModel->getCurrencyInfo();
$taxes = $recordModel->getProductTaxes();
$relatedProducts = $recordModel->getProducts();
$viewer->assign('RECORD_ID', $record);
$viewer->assign('MODE', 'edit');
} elseif ($request->get('salesorder_id') || $request->get('quote_id') || $request->get('reference_id')) {
if ($request->get('salesorder_id')) {
$referenceId = $request->get('salesorder_id');
} else {
if ($request->get('quote_id')) {
$referenceId = $request->get('quote_id');
} else {
$referenceId = $request->get('reference_id');
}
}
$recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
if (Vtiger_Functions::getCRMRecordType($referenceId) == 'RequirementCards') {
$parentRecordModel = Vtiger_Record_Model::getInstanceById($referenceId);
$recordModel->setRecordFieldValues($parentRecordModel);
$recordModel->set('requirementcardsid', $referenceId);
} else {
$parentRecordModel = Inventory_Record_Model::getInstanceById($referenceId);
$currencyInfo = $parentRecordModel->getCurrencyInfo();
$taxes = $parentRecordModel->getProductTaxes();
$relatedProducts = $parentRecordModel->getProducts();
$recordModel->setRecordFieldValues($parentRecordModel);
}
} else {
$taxes = Inventory_Module_Model::getAllProductTaxes();
$recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
$viewer->assign('MODE', '');
//The creation of Inventory record from action and Related list of product/service detailview the product/service details will calculated by following code
if ($request->get('product_id') || $sourceModule === 'Products') {
if ($sourceRecord) {
$productRecordModel = Products_Record_Model::getInstanceById($sourceRecord);
} else {
$productRecordModel = Products_Record_Model::getInstanceById($request->get('product_id'));
}
$relatedProducts = $productRecordModel->getDetailsForInventoryModule($recordModel);
} elseif ($request->get('service_id') || $sourceModule === 'Services') {
if ($sourceRecord) {
$serviceRecordModel = Services_Record_Model::getInstanceById($sourceRecord);
} else {
$serviceRecordModel = Services_Record_Model::getInstanceById($request->get('service_id'));
}
$relatedProducts = $serviceRecordModel->getDetailsForInventoryModule($recordModel);
} elseif ($sourceRecord && ($sourceModule === 'Accounts' || $sourceModule === 'Contacts' || $sourceModule === 'Potentials' || $sourceModule === 'Vendors' && $moduleName === 'PurchaseOrder')) {
$parentRecordModel = Vtiger_Record_Model::getInstanceById($sourceRecord, $sourceModule);
$recordModel->setParentRecordData($parentRecordModel);
}
}
$moduleModel = $recordModel->getModule();
$fieldList = $moduleModel->getFields();
$requestFieldList = array_intersect_key($request->getAll(), $fieldList);
//get the inventory terms and conditions
$inventoryRecordModel = Inventory_Record_Model::getCleanInstance($moduleName);
$termsAndConditions = $inventoryRecordModel->getInventoryTermsandConditions();
foreach ($requestFieldList as $fieldName => $fieldValue) {
$fieldModel = $fieldList[$fieldName];
if ($fieldModel->isEditable()) {
$recordModel->set($fieldName, $fieldModel->getDBInsertValue($fieldValue));
// Load data from related fields
if ($fieldModel->isReferenceField() && $fieldValue != '') {
$fieldValueModule = Vtiger_Functions::getCRMRecordType($fieldValue);
$mapping = $moduleModel->getMappingRelatedField($moduleName, $fieldName);
$mappingModule = $mapping[$sourceModule];
if (count($mappingModule) > 0) {
$relatedRecordModel = Vtiger_Record_Model::getInstanceById($fieldValue, $fieldValueModule);
foreach ($mappingModule as $fieldDest => $fieldSource) {
$fieldDestModel = $fieldList[$fieldDest];
$fieldDestValue = $relatedRecordModel->get($fieldSource[0]);
$recordModel->set($fieldDest, $fieldDestModel->getDBInsertValue($fieldDestValue));
}
}
}
}
}
$recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($recordModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_EDIT);
$viewer->assign('VIEW_MODE', "fullForm");
$isRelationOperation = $request->get('relationOperation');
//if it is relation edit
$viewer->assign('IS_RELATION_OPERATION', $isRelationOperation);
if ($isRelationOperation) {
$viewer->assign('SOURCE_MODULE', $sourceModule);
$viewer->assign('SOURCE_RECORD', $sourceRecord);
//.........这里部分代码省略.........
示例14: sanitizeInventoryValues
function sanitizeInventoryValues($inventoryRow, $inventoryFields)
{
$inventoryEntries = [];
foreach ($inventoryFields as $field) {
$value = $inventoryRow[$field->getColumnName()];
if (in_array($field->getName(), ['Name', 'Reference'])) {
$value = trim($value);
if (!empty($value)) {
$recordModule = Vtiger_Functions::getCRMRecordType($value);
$displayValueArray = Vtiger_Functions::computeCRMRecordLabels($recordModule, $value);
if (!empty($displayValueArray)) {
foreach ($displayValueArray as $k => $v) {
$displayValue = $v;
}
}
if (!empty($recordModule) && !empty($displayValue)) {
$value = $recordModule . '::::' . $displayValue;
} else {
$value = '';
}
} else {
$value = '';
}
} else {
$value = $field->getDisplayValue($value);
}
$inventoryEntries['inv_' . $field->getColumnName()] = $value;
}
return $inventoryEntries;
}
示例15: getEmployeeHierarchy
/**
* Function to get Employees hierarchy of the given Employees
* @param integer $id - employeeid
* returns Employees hierarchy in array format
*/
function getEmployeeHierarchy($id)
{
global $log, $adb, $current_user;
$log->debug("Entering getEmployeeHierarchy(" . $id . ") method ...");
require 'user_privileges/user_privileges_' . $current_user->id . '.php';
$listview_header = array();
$listview_entries = array();
foreach ($this->list_fields_name as $fieldname => $colname) {
if (getFieldVisibilityPermission('OSSEmployees', $current_user->id, $colname) == '0') {
$listview_header[] = getTranslatedString($fieldname);
}
}
$rows_list = array();
$encountered_accounts = array($id);
$rows_list = $this->__getParentEmployees($id, $rows_list, $encountered_accounts);
$rows_list = $this->__getChildEmployees($id, $rows_list, $rows_list[$id]['depth']);
foreach ($rows_list as $employees_id => $account_info) {
$account_info_data = array();
$hasRecordViewAccess = is_admin($current_user) || isPermitted('OSSEmployees', 'DetailView', $employees_id) == 'yes';
foreach ($this->list_fields_name as $fieldname => $colname) {
if (!$hasRecordViewAccess && $colname != 'name') {
$account_info_data[] = '';
} else {
if (getFieldVisibilityPermission('OSSEmployees', $current_user->id, $colname) == '0') {
$data = $account_info[$colname];
if ($colname == 'ossemployees_no') {
if ($employees_id != $id) {
if ($hasRecordViewAccess) {
$data = '<a href="index.php?module=OSSEmployees&view=Detail&record=' . $employees_id . '">' . $data . '</a>';
} else {
$data = '<i>' . $data . '</i>';
}
} else {
$data = '<b>' . $data . '</b>';
}
$account_depth = str_repeat(" .. ", $account_info['depth'] * 2);
$data = $account_depth . $data;
//} else if ($colname == 'last_name') {
//$data = '<a href="http://'. $data .'" target="_blank">'.$data.'</a>';
} else {
if ($colname == 'parentid' || $colname == 'projectid' || $colname == 'ticketid' || $colname == 'relategid') {
$data = '<a href="index.php?module=' . Vtiger_Functions::getCRMRecordType($data) . '&action=DetailView&record=' . $data . '">' . Vtiger_Functions::getCRMRecordLabel($data) . '</a>';
}
}
$account_info_data[] = $data;
}
}
}
$listview_entries[$employees_id] = $account_info_data;
}
$hierarchy = array('header' => $listview_header, 'entries' => $listview_entries);
$log->debug("Exiting getEmployeeHierarchy method ...");
return $hierarchy;
}