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


PHP Vtiger_Functions::getCRMRecordMetadata方法代码示例

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


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

示例1: getDisplayValue

 /**
  * Getting value to display
  * @param type $value
  * @return type
  */
 public function getDisplayValue($value)
 {
     if ($value == 0) {
         return '';
     }
     $metaData = Vtiger_Functions::getCRMRecordMetadata($value);
     $linkValue = '<a class="moduleColor_' . $metaData['setype'] . '" href="index.php?module=' . $metaData['setype'] . '&view=Detail&record=' . $value . '" title="' . vtranslate($metaData['setype'], $metaData['setype']) . '">' . $metaData['label'] . '</a>';
     return $linkValue;
 }
开发者ID:awflu,项目名称:YetiForceCRM,代码行数:14,代码来源:Reference.php

示例2: handleEvent

 function handleEvent($eventName, $entityData)
 {
     if ($eventName == 'vtiger.entity.aftersave.final' && vglobal('shared_owners') == true) {
         $moduleName = $entityData->getModuleName();
         $recordId = $entityData->getId();
         $vtEntityDelta = new VTEntityDelta();
         $delta = $vtEntityDelta->getEntityDelta($moduleName, $recordId, true);
         if (array_key_exists('assigned_user_id', $delta)) {
             $usersUpadated = TRUE;
             $oldValue = Vtiger_Functions::getArrayFromValue($delta['assigned_user_id']['oldValue']);
             $currentValue = Vtiger_Functions::getArrayFromValue($delta['assigned_user_id']['currentValue']);
             $addUsers = $currentValue;
             $removeUser = array_diff($oldValue, $currentValue);
             Users_Privileges_Model::setSharedOwnerRecursively($recordId, $addUsers, $removeUser, $moduleName);
         }
     }
     if ($eventName == 'vtiger.entity.link.after' && vglobal('shared_owners') == true && Vtiger_Processes_Model::getConfig('sales', 'popup', 'update_shared_permissions') == 'true') {
         $destinationModule = ['Products', 'Services'];
         if ($entityData['sourceModule'] == 'Potentials' && in_array($entityData['destinationModule'], $destinationModule)) {
             $db = PearDatabase::getInstance();
             $sourceRecordId =& $entityData['sourceRecordId'];
             $destinationRecordId =& $entityData['destinationRecordId'];
             $recordMetaData = Vtiger_Functions::getCRMRecordMetadata($sourceRecordId);
             $shownerIds = Vtiger_SharedOwner_UIType::getSharedOwners($sourceRecordId, $entityData['sourceModule']);
             $shownerIds[] = $recordMetaData['smownerid'];
             $shownerIds = array_unique($shownerIds);
             $usersExist = [];
             $shownersTable = Vtiger_SharedOwner_UIType::getShownerTable($entityData['destinationModule']);
             $result = $db->pquery('SELECT crmid, userid FROM ' . $shownersTable . ' WHERE userid IN(' . implode(',', $shownerIds) . ') AND crmid = ?', [$destinationRecordId]);
             while ($row = $db->getRow($result)) {
                 $usersExist[$row['crmid']][$row['userid']] = true;
             }
             foreach ($shownerIds as $userId) {
                 if (!isset($usersExist[$destinationRecordId][$userId])) {
                     $db->insert($shownersTable, ['crmid' => $destinationRecordId, 'userid' => $userId]);
                 }
             }
         }
     }
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:40,代码来源:SharingPrivileges.php

示例3: isPermitted


//.........这里部分代码省略.........
        $others_permission_id = $defaultOrgSharingPermission[$tabid];
        if (in_array($current_user->id, $shownerids) || count(array_intersect($shownerids, $current_user_groups)) > 0) {
            $permission = 'yes';
            $log->debug('Exiting isPermitted method ... - Shared Owner');
            return $permission;
        }
        if ($recOwnType == 'Users') {
            //Checking if the Record Owner is the current User
            if ($current_user->id == $recOwnId) {
                $permission = 'yes';
                $log->debug('Exiting isPermitted method ...');
                return $permission;
            }
            //Checking if the Record Owner is the Subordinate User
            foreach ($subordinate_roles_users as $roleid => $userids) {
                if (in_array($recOwnId, $userids)) {
                    $permission = 'yes';
                    $log->debug('Exiting isPermitted method ...');
                    return $permission;
                }
            }
        } elseif ($recOwnType == 'Groups') {
            //Checking if the record owner is the current user's group
            if (in_array($recOwnId, $current_user_groups)) {
                $permission = 'yes';
                $log->debug("Exiting isPermitted method ...");
                return $permission;
            }
        }
        $role = getRoleInformation($current_user->roleid);
        if (($actionid == 3 || $actionid == 4) && $role['previewrelatedrecord'] != 0 || ($actionid == 0 || $actionid == 1) && $role['editrelatedrecord'] != 0) {
            $parentRecord = Users_Privileges_Model::getParentRecord($record_id, $module, $role['previewrelatedrecord']);
            if ($parentRecord) {
                $recordMetaData = Vtiger_Functions::getCRMRecordMetadata($parentRecord);
                if ($role['permissionsrelatedfield'] == 0) {
                    $relatedPermission = $current_user->id == $recordMetaData['smownerid'];
                } else {
                    if ($role['permissionsrelatedfield'] == 1) {
                        $relatedPermission = in_array($current_user->id, Vtiger_SharedOwner_UIType::getSharedOwners($parentRecord, $recordMetaData['setype']));
                    } else {
                        if ($role['permissionsrelatedfield'] == 2) {
                            $relatedPermission = $current_user->id == $recordMetaData['smownerid'] || in_array($current_user->id, Vtiger_SharedOwner_UIType::getSharedOwners($parentRecord, $recordMetaData['setype']));
                        }
                    }
                }
                if ($relatedPermission) {
                    $permission = 'yes';
                    $log->debug('Exiting isPermitted method ... - Parent Record Owner');
                    return $permission;
                }
            }
        }
        //Checking for Default Org Sharing permission
        if ($others_permission_id == 0) {
            if ($actionid == 1 || $actionid == 0) {
                $permission = isReadWritePermittedBySharing($module, $tabid, $actionid, $record_id);
                $log->debug("Exiting isPermitted method ...");
                return $permission;
            } elseif ($actionid == 2) {
                $permission = 'no';
                $log->debug("Exiting isPermitted method ...");
                return $permission;
            } else {
                $permission = 'yes';
                $log->debug("Exiting isPermitted method ...");
                return $permission;
开发者ID:nikdejan,项目名称:YetiForceCRM,代码行数:67,代码来源:UserInfoUtil.php

示例4: getRecordOwnerId

/** Function to get a user id or group id for a given entity
 * @param $record -- entity id :: Type integer
 * @returns $ownerArr -- owner id :: Type array
 */
function getRecordOwnerId($record)
{
    $log = vglobal('log');
    $log->debug("Entering getRecordOwnerId(" . $record . ") method ...");
    $adb = PearDatabase::getInstance();
    $ownerArr = [];
    $recordMetaData = Vtiger_Functions::getCRMRecordMetadata($record);
    if ($recordMetaData) {
        $ownerId = $recordMetaData['smownerid'];
        // Look at cache first for information
        $count = VTCacheUtils::lookupOwnerType($ownerId);
        if ($count === false) {
            $sql_result = $adb->pquery("select count(*) as count from vtiger_users where id = ?", array($ownerId));
            $count = $adb->query_result($sql_result, 0, 'count');
            // Update cache for re-use
            VTCacheUtils::updateOwnerType($ownerId, $count);
        }
        if ($count > 0) {
            $ownerArr['Users'] = $ownerId;
        } else {
            $ownerArr['Groups'] = $ownerId;
        }
    }
    $log->debug("Exiting getRecordOwnerId method ...");
    return $ownerArr;
}
开发者ID:nikdejan,项目名称:YetiForceCRM,代码行数:30,代码来源:utils.php

示例5: getParentRecord

	public function getParentRecord($record, $moduleName = false, $type = 1)
	{
		if (isset(self::$parentRecordCache[$record])) {
			return self::$parentRecordCache[$record];
		}
		if (!$moduleName) {
			$recordMetaData = Vtiger_Functions::getCRMRecordMetadata($record);
			$moduleName = $recordMetaData['setype'];
		}
		if ($moduleName == 'Events') {
			$moduleName = 'Calendar';
		}

		$parentRecord = false;
		include('user_privileges/moduleHierarchy.php');
		if (key_exists($moduleName, $modulesMap1M)) {
			$parentModule = $modulesMap1M[$moduleName];
			$parentModuleModel = Vtiger_Module_Model::getInstance($moduleName);
			$parentModelFields = $parentModuleModel->getFields();

			foreach ($parentModelFields as $fieldName => $fieldModel) {
				if ($fieldModel->getFieldDataType() == Vtiger_Field_Model::REFERENCE_TYPE && count(array_intersect($parentModule, $fieldModel->getReferenceList())) > 0) {
					$recordModel = Vtiger_Record_Model::getInstanceById($record);
					$value = $recordModel->get($fieldName);
					if ($value != '' && $value != 0) {
						$parentRecord = $value;
						continue;
					}
				}
			}
			if ($parentRecord && $type == 2) {
				$rparentRecord = self::getParentRecord($parentRecord, false, $type);
				if ($rparentRecord) {
					$parentRecord = $rparentRecord;
				}
			}
			return $record != $parentRecord ? $parentRecord : false;
		} else if (in_array($moduleName, $modulesMapMMBase)) {
			$currentUser = vglobal('current_user');
			$db = PearDatabase::getInstance();
			$result = $db->pquery('SELECT * FROM vtiger_crmentityrel WHERE crmid=? OR relcrmid =?', [$record, $record]);
			while ($row = $db->fetch_array($result)) {
				$id = $row['crmid'] == $record ? $row['relcrmid'] : $row['crmid'];
				$recordMetaData = Vtiger_Functions::getCRMRecordMetadata($id);
				if ($currentUser->id == $recordMetaData['smownerid']) {
					$parentRecord = $id;
					break;
				} else if ($type == 2) {
					$rparentRecord = self::getParentRecord($id, $recordMetaData['setype'], $type);
					if ($rparentRecord) {
						$parentRecord = $rparentRecord;
					}
				}
			}
		} else if (key_exists($moduleName, $modulesMapMMCustom)) {
			$currentUser = vglobal('current_user');
			$relationInfo = $modulesMapMMCustom[$moduleName];
			$db = PearDatabase::getInstance();
			$query = 'SELECT ' . $relationInfo['rel'] . ' AS crmid FROM `' . $relationInfo['table'] . '` WHERE ' . $relationInfo['base'] . ' = ?';
			$result = $db->pquery($query, [$record]);
			while ($row = $db->fetch_array($result)) {
				$recordMetaData = Vtiger_Functions::getCRMRecordMetadata($row['crmid']);
				if ($currentUser->id == $recordMetaData['smownerid']) {
					$parentRecord = $row['crmid'];
					break;
				} else if ($type == 2) {
					$rparentRecord = self::getParentRecord($row['crmid'], $recordMetaData['setype'], $type);
					if ($rparentRecord) {
						$parentRecord = $rparentRecord;
					}
				}
			}
		}
		self::$parentRecordCache[$record] = $parentRecord;
		return $parentRecord;
	}
开发者ID:rubichcube,项目名称:YetiForceCRM,代码行数:76,代码来源:Privileges.php

示例6: 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

示例7: 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

示例8: getSharedOwners

 /**
  * Function to get the share users list
  * @param int $record record ID
  * @param bool $returnArray whether return data in an array
  * @return array
  */
 public static function getSharedOwners($record, $moduleName = false)
 {
     $shownerid = Vtiger_Cache::get('SharedOwner', $record);
     if ($shownerid) {
         return $shownerid;
     }
     $db = PearDatabase::getInstance();
     if ($moduleName === false) {
         $recordMetaData = Vtiger_Functions::getCRMRecordMetadata($parentRecord);
         $moduleName = $recordMetaData['setype'];
     }
     $shownersTable = self::getShownerTable($moduleName);
     $result = $db->pquery('SELECT DISTINCT userid FROM ' . $shownersTable . ' WHERE crmid = ?', [$record]);
     $values = [];
     while (($shownerid = $db->getSingleValue($result)) !== false) {
         $values[] = $shownerid;
     }
     Vtiger_Cache::set('SharedOwner', $record, $values);
     return $values;
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:26,代码来源:SharedOwner.php

示例9: getUserAccessConditionsQuerySR

 function getUserAccessConditionsQuerySR($module, $current_user = false, $relatedRecord = false)
 {
     if ($current_user == false) {
         $current_user = vglobal('current_user');
     }
     require 'user_privileges/user_privileges_' . $current_user->id . '.php';
     require 'user_privileges/sharing_privileges_' . $current_user->id . '.php';
     global $shared_owners;
     $is_admin = is_admin($current_user);
     $sharedParameter = $securityParameter = '';
     $query = '';
     $tabId = getTabid($module);
     if ($relatedRecord) {
         $role = getRoleInformation($current_user->roleid);
         if ($role['listrelatedrecord'] != 0) {
             $rparentRecord = Users_Privileges_Model::getParentRecord($relatedRecord, false, $role['listrelatedrecord']);
             if ($rparentRecord) {
                 $relatedRecord = $rparentRecord;
             }
             $recordMetaData = Vtiger_Functions::getCRMRecordMetadata($relatedRecord);
             $recordPermission = Users_Privileges_Model::isPermitted($recordMetaData['setype'], 'DetailView', $relatedRecord);
             if (!$recordPermission) {
                 throw new AppException('LBL_PERMISSION_DENIED');
             }
             if ($recordMetaData['smownerid'] == $current_user->id) {
                 return '';
             }
         }
     }
     if ($is_admin == false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[$tabId] == 3) {
         $securityParameter = $this->getUserAccessConditionsQuery($module, $current_user);
         $shownerid = array_merge([$current_user->id], $current_user_groups);
         $sharedParameter .= 'vtiger_crmentity.crmid IN (SELECT DISTINCT crmid FROM u_yf_crmentity_showners WHERE userid IN (' . implode(',', $shownerid) . '))';
     }
     if ($shared_owners == true) {
         if ($securityParameter != '') {
             $query .= " AND ( ({$securityParameter}) OR ({$sharedParameter}) )";
         } elseif ($sharedParameter != '') {
             $query .= ' AND (' . $sharedParameter . ')';
         }
     } else {
         $query .= $securityParameter;
     }
     return $query;
 }
开发者ID:nikdejan,项目名称:YetiForceCRM,代码行数:45,代码来源:CRMEntity.php

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