• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP vtws_getModuleHandlerFromName函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中vtws_getModuleHandlerFromName函数的典型用法代码示例。如果您正苦于以下问题:PHP vtws_getModuleHandlerFromName函数的具体用法?PHP vtws_getModuleHandlerFromName怎么用?PHP vtws_getModuleHandlerFromName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: getModuleMeta

 public static function getModuleMeta($moduleName, $user)
 {
     if (empty(self::$_cached_module_meta[$moduleName][$user->id])) {
         $moduleHandler = vtws_getModuleHandlerFromName($moduleName, $user);
         self::$_cached_module_meta[$moduleName][$user->id] = $moduleHandler->getMeta();
     }
     return self::$_cached_module_meta[$moduleName][$user->id];
 }
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:8,代码来源:Import_ListView_Controller.php


示例2: translateReferenceFieldNamesToIds

 public function translateReferenceFieldNamesToIds($entityRecords, $user)
 {
     $entityRecordList = array();
     foreach ($entityRecords as $index => $record) {
         $entityRecordList[$record['module']][$index] = $record;
     }
     foreach ($entityRecordList as $module => $records) {
         $handler = vtws_getModuleHandlerFromName($module, $user);
         $meta = $handler->getMeta();
         $referenceFieldDetails = $meta->getReferenceFieldDetails();
         foreach ($referenceFieldDetails as $referenceFieldName => $referenceModuleDetails) {
             $recordReferenceFieldNames = array();
             foreach ($records as $index => $recordDetails) {
                 if (!empty($recordDetails[$referenceFieldName])) {
                     $recordReferenceFieldNames[] = $recordDetails[$referenceFieldName];
                 }
             }
             $entityNameIds = wsapp_getRecordEntityNameIds(array_values($recordReferenceFieldNames), $referenceModuleDetails, $user);
             if (is_array($entityNameIds)) {
                 $entityNameIds = array_change_key_case($entityNameIds, CASE_LOWER);
             }
             foreach ($records as $index => $recordInfo) {
                 if (!empty($entityNameIds[strtolower($recordInfo[$referenceFieldName])])) {
                     $recordInfo[$referenceFieldName] = $entityNameIds[strtolower($recordInfo[$referenceFieldName])];
                 } else {
                     if ($referenceFieldName == 'account_id') {
                         if ($recordInfo[$referenceFieldName] != NULL) {
                             $element['accountname'] = $recordInfo[$referenceFieldName];
                             $element['assigned_user_id'] = vtws_getWebserviceEntityId('Users', $user->id);
                             $element['module'] = "Accounts";
                             $createRecord = array($element);
                             $createRecord = $this->fillNonExistingMandatoryPicklistValues($createRecord);
                             $createRecord = $this->fillMandatoryFields($createRecord, $user);
                             foreach ($createRecord as $key => $record) {
                                 vtws_create($record['module'], $record, $user);
                             }
                             $entityNameIds = wsapp_getRecordEntityNameIds(array_values($recordReferenceFieldNames), $referenceModuleDetails, $user);
                             $recordInfo[$referenceFieldName] = $entityNameIds[$recordInfo[$referenceFieldName]];
                         }
                     } else {
                         $recordInfo[$referenceFieldName] = "";
                     }
                 }
                 $records[$index] = $recordInfo;
             }
         }
         $entityRecordList[$module] = $records;
     }
     $crmRecords = array();
     foreach ($entityRecordList as $module => $entityRecords) {
         foreach ($entityRecords as $index => $record) {
             $crmRecords[$index] = $record;
         }
     }
     return $crmRecords;
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:56,代码来源:OutlookVtigerCRMHandler.php


示例3: getMeta

 /**
  *
  * @param String:ModuleName $module
  * @return EntityMeta
  */
 public function getMeta($module, $user)
 {
     $db = PearDatabase::getInstance();
     if (empty($this->moduleMetaInfo[$module])) {
         $handler = vtws_getModuleHandlerFromName($module, $user);
         $meta = $handler->getMeta();
         $this->moduleMetaInfo[$module] = $meta;
     }
     return $this->moduleMetaInfo[$module];
 }
开发者ID:hardikk,项目名称:HNH,代码行数:15,代码来源:CustomView.php


示例4: vtws_retrieve_inventory

/**
 * Retrieve inventory record with LineItems
 */
function vtws_retrieve_inventory($id)
{
    $current_user = vglobal('current_user');
    $record = vtws_retrieve($id, $current_user);
    $handler = vtws_getModuleHandlerFromName('LineItem', $user);
    $id = vtws_getIdComponents($id);
    $id = $id[1];
    $inventoryLineItems = $handler->getAllLineItemForParent($id);
    $record['LineItems'] = $inventoryLineItems;
    return $record;
}
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:14,代码来源:RetrieveInventory.php


示例5: getInstance

 /**
  * creates an instance of Vtiger_ModuleMeta_Model
  * @param <String> $name - module name
  * @param <Object> $user - Users Object
  * @return Vtiger_ModuleMeta_Model
  */
 public static function getInstance($name, $user)
 {
     $self = new Vtiger_ModuleMeta_Model();
     $self->moduleName = $name;
     $self->user = $user;
     if (!empty(self::$_cached_module_meta[$name][$user->id])) {
         $self->webserviceMeta = self::$_cached_module_meta[$name][$user->id];
         return $self;
     }
     $handler = vtws_getModuleHandlerFromName($self->moduleName, $user);
     $self->webserviceMeta = $handler->getMeta();
     self::$_cached_module_meta[$name][$user->id] = $self->webserviceMeta;
     return $self;
 }
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:20,代码来源:ModuleMeta.php


示例6: isAssignToChanged

 function isAssignToChanged($moduleName, $recordId, $user)
 {
     $wsModuleName = $this->getWsModuleName($moduleName);
     $handler = vtws_getModuleHandlerFromName($wsModuleName, $user);
     $meta = $handler->getMeta();
     $moduleOwnerFields = $meta->getOwnerFields();
     $assignToChanged = false;
     $vtEntityDelta = new VTEntityDelta();
     foreach ($moduleOwnerFields as $ownerField) {
         $assignToChanged = $vtEntityDelta->hasChanged($moduleName, $recordId, $ownerField);
         if ($assignToChanged) {
             break;
         }
     }
     return $assignToChanged;
 }
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:16,代码来源:WSAPPAssignToTracker.php


示例7: getAccessibleFields

	public function getAccessibleFields($moduleName) {
		global $current_user;

		if(empty(self::$_cached_module_meta[$moduleName][$current_user->id])) {
			$moduleHandler = vtws_getModuleHandlerFromName($moduleName, $current_user);
			self::$_cached_module_meta[$moduleName][$current_user->id] = $moduleHandler->getMeta();
		}
		$meta = self::$_cached_module_meta[$moduleName][$current_user->id];
		$moduleFields = $meta->getModuleFields();
		$accessibleFields = array();
		foreach($moduleFields as $fieldName => $fieldInstance) {
			if($fieldInstance->getPresence() === 1) {
				continue;
			}
			$accessibleFields[$fieldName] = $fieldInstance;
		}
		return $accessibleFields;
	}
开发者ID:nvh3010,项目名称:quancrm,代码行数:18,代码来源:Import_Index_Controller.php


示例8: wsapp_getRecordEntityNameIds

function wsapp_getRecordEntityNameIds($entityNames, $modules, $user)
{
    $entityMetaList = array();
    $db = PearDatabase::getInstance();
    if (empty($entityNames)) {
        return;
    }
    if (!is_array($entityNames)) {
        $entityNames = array($entityNames);
    }
    if (empty($modules)) {
        return array();
    }
    if (!is_array($modules)) {
        $modules = array($modules);
    }
    $entityNameIds = array();
    foreach ($modules as $moduleName) {
        if (empty($entityMetaList[$moduleName])) {
            $handler = vtws_getModuleHandlerFromName($moduleName, $user);
            $meta = $handler->getMeta();
            $entityMetaList[$moduleName] = $meta;
        }
        $meta = $entityMetaList[$moduleName];
        $nameFieldsArray = explode(",", $meta->getNameFields());
        if (count($nameFieldsArray) > 1) {
            $nameFields = "concat(" . implode(",' ',", $nameFieldsArray) . ")";
        } else {
            $nameFields = $nameFieldsArray[0];
        }
        $query = "SELECT " . $meta->getObectIndexColumn() . " as id,{$nameFields} as entityname FROM " . $meta->getEntityBaseTable() . " as moduleentity INNER JOIN vtiger_crmentity as crmentity WHERE {$nameFields} IN(" . generateQuestionMarks($entityNames) . ") AND crmentity.deleted=0 AND crmentity.crmid = moduleentity." . $meta->getObectIndexColumn() . "";
        $result = $db->pquery($query, $entityNames);
        $num_rows = $db->num_rows($result);
        for ($i = 0; $i < $num_rows; $i++) {
            $id = $db->query_result($result, $i, 'id');
            $entityName = $db->query_result($result, $i, 'entityname');
            $entityNameIds[decode_html($entityName)] = vtws_getWebserviceEntityId($moduleName, $id);
        }
    }
    return $entityNameIds;
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:41,代码来源:Utils.php


示例9: lookupMailInVtiger

 static function lookupMailInVtiger($searchTerm, $user)
 {
     $handler = vtws_getModuleHandlerFromName('Emails', $user);
     $meta = $handler->getMeta();
     $moduleFields = $meta->getModuleFields();
     $parentIdFieldInstance = $moduleFields['parent_id'];
     $referenceModules = $parentIdFieldInstance->getReferenceList();
     $filteredResult = array();
     foreach ($referenceModules as $referenceModule) {
         $referenceModuleHandler = vtws_getModuleHandlerFromName($referenceModule, $user);
         $referenceModuleMeta = $referenceModuleHandler->getMeta();
         $referenceModuleEmailFields = $referenceModuleMeta->getEmailFields();
         $referenceModuleEntityFields = $referenceModuleMeta->getNameFields();
         $referenceModuleEntityFieldsArray = explode(',', $referenceModuleEntityFields);
         $searchFieldList = array_merge($referenceModuleEmailFields, $referenceModuleEntityFieldsArray);
         if (!empty($searchFieldList) && !empty($referenceModuleEmailFields)) {
             $searchFieldListString = implode(',', $referenceModuleEmailFields);
             $where = null;
             for ($i = 0; $i < count($searchFieldList); $i++) {
                 if ($i == count($searchFieldList) - 1) {
                     $where .= sprintf($searchFieldList[$i] . " like '%s'", $searchTerm);
                 } else {
                     $where .= sprintf($searchFieldList[$i] . " like '%s' or ", $searchTerm);
                 }
             }
             if (!empty($where)) {
                 $where = "WHERE {$where}";
             }
             $result = vtws_query("select {$searchFieldListString} from {$referenceModule} {$where};", $user);
             foreach ($result as $record) {
                 foreach ($searchFieldList as $searchField) {
                     if (!empty($record[$searchField])) {
                         $filteredResult[] = array('id' => $record[$searchField], 'name' => $record[$searchField] . " - " . getTranslatedString($referenceModule), 'record' => $record['id']);
                     }
                 }
             }
         }
     }
     return $filteredResult;
 }
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:40,代码来源:MailManager.php


示例10: __CreateNewEmail

 /**
  * Create new Email record (and link to given record) including attachments
  * @global Users $current_user
  * @global PearDataBase $db
  * @param  MailManager_Message_Model $mailrecord
  * @param String $module
  * @param CRMEntity $linkfocus
  * @return Integer
  */
 public function __CreateNewEmail($mailrecord, $module, $linkfocus)
 {
     $currentUserModel = Users_Record_Model::getCurrentUserModel();
     $handler = vtws_getModuleHandlerFromName('Emails', $currentUserModel);
     $meta = $handler->getMeta();
     if ($meta->hasWriteAccess() != true) {
         return false;
     }
     $recordModel = Vtiger_Record_Model::getCleanInstance('Emails');
     $recordModel->set('subject', $mailrecord->_subject);
     if (!empty($module)) {
         $recordModel->set('parent_type', $module);
     }
     if (!empty($linkfocus->id)) {
         $recordModel->set('parent_id', "{$linkfocus->id}@-1|");
     }
     $recordModel->set('description', $mailrecord->getBodyHTML());
     $recordModel->set('assigned_user_id', $currentUserModel->get('id'));
     //Opensource fix mailmanager related data
     $recordModel->set('date_start', date('Y-m-d', $mailrecord->_date));
     $recordModel->set('time_start', date('H:i', $mailrecord->_date));
     $recordModel->set('email_flag', 'MailManager');
     $from = $mailrecord->_from[0];
     $to = $mailrecord->_to[0];
     $cc = !empty($mailrecord->_cc) ? implode(',', $mailrecord->_cc) : '';
     $bcc = !empty($mailrecord->_bcc) ? implode(',', $mailrecord->_bcc) : '';
     //emails field were restructured and to,bcc and cc field are JSON arrays
     $recordModel->set('from_email', $from);
     $recordModel->set('saved_toid', $to);
     $recordModel->set('ccmail', $cc);
     $recordModel->set('bccmail', $bcc);
     $recordModel->save();
     // TODO: Handle attachments of the mail (inline/file)
     $this->__SaveAttachements($mailrecord, 'Emails', $recordModel);
     return $recordModel->getId();
 }
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:45,代码来源:Relate.php


示例11: yy_r41

 function yy_r41()
 {
     global $adb;
     if (!$this->out['meta']) {
         $module = $this->out['moduleName'];
         $handler = vtws_getModuleHandlerFromName($module, $this->user);
         $objectMeta = $handler->getMeta();
         $this->out['meta'] = $objectMeta;
         $meta = $this->out['meta'];
         $fieldcol = $meta->getFieldColumnMapping();
         $columns = array();
         if (in_array('*', $this->out['column_list'])) {
             $columns = array_values($fieldcol);
         } elseif (!in_array('count(*)', array_map(strtolower, $this->out['column_list']))) {
             foreach ($this->out['column_list'] as $ind => $field) {
                 $columns[] = $fieldcol[$field];
             }
         }
         if ($this->out['where_condition']) {
             foreach ($this->out['where_condition']['column_names'] as $ind => $field) {
                 $columns[] = $fieldcol[$field];
             }
         }
         $tables = $this->getTables($this->out, $columns);
         if (!in_array($objectMeta->getEntityBaseTable(), $tables)) {
             $tables[] = $objectMeta->getEntityBaseTable();
         }
         $defaultTableList = $objectMeta->getEntityDefaultTableList();
         foreach ($defaultTableList as $tableName) {
             if (!in_array($tableName, $tables)) {
                 array_push($tables, $tableName);
             }
         }
         $firstTable = $objectMeta->getEntityBaseTable();
         $tabNameIndex = $objectMeta->getEntityTableIndexList();
         $firstIndex = $tabNameIndex[$firstTable];
         foreach ($tables as $ind => $table) {
             if ($firstTable != $table) {
                 if (!isset($tabNameIndex[$table]) && $table == "vtiger_crmentity") {
                     $this->out['defaultJoinConditions'] = $this->out['defaultJoinConditions'] . " LEFT JOIN {$table} ON {$firstTable}.{$firstIndex}={$table}.crmid";
                 } else {
                     $this->out['defaultJoinConditions'] = $this->out['defaultJoinConditions'] . " LEFT JOIN {$table} ON {$firstTable}.{$firstIndex}={$table}.{$tabNameIndex[$table]}";
                 }
             } else {
                 $this->out['tableName'] = $table;
             }
         }
     }
 }
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:49,代码来源:VTQL_Parser.php


示例12: createEntityRecord

 public function createEntityRecord($moduleName, $entityLabel)
 {
     $moduleHandler = vtws_getModuleHandlerFromName($moduleName, $this->user);
     $moduleMeta = $moduleHandler->getMeta();
     $moduleFields = $moduleMeta->getModuleFields();
     $mandatoryFields = $moduleMeta->getMandatoryFields();
     $entityNameFieldsString = $moduleMeta->getNameFields();
     $entityNameFields = explode(',', $entityNameFieldsString);
     $fieldData = array();
     foreach ($entityNameFields as $entityNameField) {
         $entityNameField = trim($entityNameField);
         if (in_array($entityNameField, $mandatoryFields)) {
             $fieldData[$entityNameField] = $entityLabel;
         }
     }
     foreach ($mandatoryFields as $mandatoryField) {
         if (empty($fieldData[$mandatoryField])) {
             $fieldInstance = $moduleFields[$mandatoryField];
             if ($fieldInstance->getFieldDataType() == 'owner') {
                 $fieldData[$mandatoryField] = $this->user->id;
             } else {
                 $defaultValue = $fieldInstance->getDefault();
                 if (!empty($defaultValue)) {
                     $fieldData[$mandatoryField] = $defaultValue;
                 } else {
                     $fieldData[$mandatoryField] = '????';
                 }
             }
         }
     }
     $fieldData = DataTransform::sanitizeData($fieldData, $moduleMeta);
     $entityIdInfo = vtws_create($moduleName, $fieldData, $this->user);
     $focus = CRMEntity::getInstance($moduleName);
     $focus->updateMissingSeqNumber($moduleName);
     return $entityIdInfo;
 }
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:36,代码来源:Import_Data_Controller.php


示例13: getWhereClause


//.........这里部分代码省略.........
                     $endDateValue = explode(' ', $values[1]);
                     if ($startDateValue[1] == '00:00:00' && ($endDateValue[1] == '00:00:00' || $endDateValue[1] == '23:59:59')) {
                         $fieldSql .= "{$fieldGlue} CAST(" . $field->getTableName() . '.' . $field->getColumnName() . " AS DATE) {$valueSql}";
                     } else {
                         $fieldSql .= "{$fieldGlue} " . $field->getTableName() . '.' . $field->getColumnName() . ' ' . $valueSql;
                     }
                 } elseif ($operator == 'between' || $operator == 'notequal' || $operator == 'a' || $operator == 'b') {
                     $fieldSql .= "{$fieldGlue} " . $field->getTableName() . '.' . $field->getColumnName() . ' ' . $valueSql;
                 } else {
                     $values = explode(' ', $value);
                     if ($values[1] == '00:00:00') {
                         $fieldSql .= "{$fieldGlue} CAST(" . $field->getTableName() . '.' . $field->getColumnName() . " AS DATE) {$valueSql}";
                     } else {
                         $fieldSql .= "{$fieldGlue} " . $field->getTableName() . '.' . $field->getColumnName() . ' ' . $valueSql;
                     }
                 }
             } else {
                 if (($baseModule == 'Events' || $baseModule == 'Calendar') && ($field->getColumnName() == 'status' || $field->getColumnName() == 'eventstatus')) {
                     $otherFieldName = 'eventstatus';
                     if ($field->getColumnName() == 'eventstatus') {
                         $otherFieldName = 'taskstatus';
                     }
                     $otherField = $moduleFieldList[$otherFieldName];
                     $specialCondition = '';
                     $specialConditionForOtherField = '';
                     $conditionGlue = ' OR ';
                     if ($conditionInfo['operator'] == 'n' || $conditionInfo['operator'] == 'k' || $conditionInfo['operator'] == 'y') {
                         $conditionGlue = ' AND ';
                         if ($conditionInfo['operator'] == 'n') {
                             $specialCondition = ' OR ' . $field->getTableName() . '.' . $field->getColumnName() . ' IS NULL ';
                             if (!empty($otherField)) {
                                 $specialConditionForOtherField = ' OR ' . $otherField->getTableName() . '.' . $otherField->getColumnName() . ' IS NULL ';
                             }
                         }
                     }
                     $otherFieldValueSql = $valueSql;
                     if ($conditionInfo['operator'] == 'ny' && !empty($otherField)) {
                         $otherFieldValueSql = "IS NOT NULL AND " . $otherField->getTableName() . '.' . $otherField->getColumnName() . " != ''";
                     }
                     $fieldSql .= "{$fieldGlue} ((" . $field->getTableName() . '.' . $field->getColumnName() . ' ' . $valueSql . " {$specialCondition}) ";
                     if (!empty($otherField)) {
                         $fieldSql .= $conditionGlue . '(' . $otherField->getTableName() . '.' . $otherField->getColumnName() . ' ' . $otherFieldValueSql . ' ' . $specialConditionForOtherField . '))';
                     } else {
                         $fieldSql .= ')';
                     }
                 } else {
                     if ($fieldName == 'birthday' && !$this->isRelativeSearchOperators($conditionInfo['operator'])) {
                         $fieldSql .= "{$fieldGlue} DATE_FORMAT(" . $field->getTableName() . '.' . $field->getColumnName() . ",'%m%d') " . $valueSql;
                     } else {
                         $fieldSql .= "{$fieldGlue} " . $field->getTableName() . '.' . $field->getColumnName() . ' ' . $valueSql;
                     }
                 }
             }
             if (($conditionInfo['operator'] == 'n' || $conditionInfo['operator'] == 'k') && ($field->getFieldDataType() == 'owner' || $field->getFieldDataType() == 'picklist')) {
                 $fieldGlue = ' AND';
             } else {
                 $fieldGlue = ' OR';
             }
         }
         $fieldSql .= ')';
         $fieldSqlList[$index] = $fieldSql;
     }
     foreach ($this->manyToManyRelatedModuleConditions as $index => $conditionInfo) {
         $relatedModuleMeta = RelatedModuleMeta::getInstance($this->meta->getTabName(), $conditionInfo['relatedModule']);
         $relationInfo = $relatedModuleMeta->getRelationMeta();
         $relatedModule = $this->meta->getTabName();
         $fieldSql = "(" . $relationInfo['relationTable'] . '.' . $relationInfo[$conditionInfo['column']] . $conditionInfo['SQLOperator'] . $conditionInfo['value'] . ")";
         $fieldSqlList[$index] = $fieldSql;
     }
     // This is added to support reference module fields
     if ($this->referenceModuleField) {
         foreach ($this->referenceModuleField as $index => $conditionInfo) {
             $handler = vtws_getModuleHandlerFromName($conditionInfo['relatedModule'], $current_user);
             $meta = $handler->getMeta();
             $fieldName = $conditionInfo['fieldName'];
             $fields = $meta->getModuleFields();
             $fieldObject = $fields[$fieldName];
             $columnName = $fieldObject->getColumnName();
             $tableName = $fieldObject->getTableName();
             $valueSQL = $this->getConditionValue($conditionInfo['value'], $conditionInfo['SQLOperator'], $fieldObject);
             $fieldSql = "(" . $tableName . $conditionInfo['referenceField'] . '.' . $columnName . ' ' . $valueSQL[0] . ")";
             $fieldSqlList[$index] = $fieldSql;
         }
     }
     // This is needed as there can be condition in different order and there is an assumption in makeGroupSqlReplacements API
     // that it expects the array in an order and then replaces the sql with its the corresponding place
     ksort($fieldSqlList);
     $groupSql = $this->makeGroupSqlReplacements($fieldSqlList, $groupSql);
     if ($this->conditionInstanceCount > 0) {
         $this->conditionalWhere = $groupSql;
         $sql .= $groupSql;
     }
     if (!$onlyWhereQuery) {
         $sql .= " AND {$baseTable}.{$baseTableIndex} > 0";
         $instance = CRMEntity::getInstance($baseModule);
         $sql .= $instance->getUserAccessConditionsQuerySR($baseModule, $current_user);
     }
     $this->whereClause = $sql;
     return $sql;
 }
开发者ID:artisan4710,项目名称:YetiForceCRM,代码行数:101,代码来源:QueryGenerator.php


示例14: fillNonExistingMandatoryPicklistValues

	public function fillNonExistingMandatoryPicklistValues($recordList){
		//Meta is cached to eliminate overhead of doing the query every time to get the meta details(retrieveMeta)
		$modulesMetaCache = array();
		foreach($recordList as $index=>$recordDetails){
			if(!array_key_exists($recordDetails['module'], $modulesMetaCache)){
				$handler = vtws_getModuleHandlerFromName($recordDetails['module'], $this->user);
				$meta = $handler->getMeta();
				$modulesMetaCache[$recordDetails['module']] = $meta;
			}
			$moduleMeta = $modulesMetaCache[$recordDetails['module']];
			$mandatoryFieldsList = $meta->getMandatoryFields();
			$moduleFields = $meta->getModuleFields();
			foreach($mandatoryFieldsList as $fieldName){
				$fieldInstance = $moduleFields[$fieldName];
				if(empty($recordDetails[$fieldName]) &&
						($fieldInstance->getFieldDataType()=="multipicklist" || $fieldInstance->getFieldDataType()=="picklist")){
					$pickListDetails = $fieldInstance->getPicklistDetails($webserviceField);
					$defaultValue = $pickListDetails[0]['value'];
					$recordDetails[$fieldName] = $defaultValue;
				}
			}
			$recordList[$index]= $recordDetails;
		}
		return $recordList;
	}
开发者ID:nvh3010,项目名称:quancrm,代码行数:25,代码来源:vtigerCRMHandler.php


示例15: vtws_updateConvertLeadStatus

function vtws_updateConvertLeadStatus($entityIds, $leadId, $user)
{
    global $adb, $log;
    $leadIdComponents = vtws_getIdComponents($leadId);
    if ($entityIds['Accounts'] != '' || $entityIds['Contacts'] != '') {
        $sql = "UPDATE vtiger_leaddetails SET converted = 1 where leadid=?";
        $result = $adb->pquery($sql, array($leadIdComponents[1]));
        if ($result === false) {
            throw new WebServiceException(WebServiceErrorCode::$FAILED_TO_MARK_CONVERTED, "Failed mark lead converted");
        }
        //updating the campaign-lead relation --Minnie
        $sql = "DELETE FROM vtiger_campaignleadrel WHERE leadid=?";
        $adb->pquery($sql, array($leadIdComponents[1]));
        $sql = "DELETE FROM vtiger_tracker WHERE item_id=?";
        $adb->pquery($sql, array($leadIdComponents[1]));
        //update the modifiedtime and modified by information for the record
        $leadModifiedTime = $adb->formatDate(date('Y-m-d H:i:s'), true);
        $crmentityUpdateSql = "UPDATE vtiger_crmentity SET modifiedtime=?, modifiedby=? WHERE crmid=?";
        $adb->pquery($crmentityUpdateSql, array($leadModifiedTime, $user->id, $leadIdComponents[1]));
    }
    $moduleArray = array('Accounts', 'Contacts', 'Potentials');
    foreach ($moduleArray as $module) {
        if (!empty($entityIds[$module])) {
            $idComponents = vtws_getIdComponents($entityIds[$module]);
            $id = $idComponents[1];
            $webserviceModule = vtws_getModuleHandlerFromName($module, $user);
            $meta = $webserviceModule->getMeta();
            $fields = $meta->getModuleFields();
            $field = $fields['isconvertedfromlead'];
            $tablename = $field->getTableName();
            $tableList = $meta->getEntityTableIndexList();
            $tableIndex = $tableList[$tablename];
            $adb->pquery("UPDATE {$tablename} SET isconvertedfromlead = ? WHERE {$tableIndex} = ?", array(1, $id));
        }
    }
}
开发者ID:nouphet,项目名称:vtigercrm-6.0.0-ja,代码行数:36,代码来源:ConvertLead.php


示例16: process

 public function process()
 {
     $variableList = $this->getTemplateVariableListForModule($this->module);
     $handler = vtws_getModuleHandlerFromName($this->module, $this->user);
     $meta = $handler->getMeta();
     $referenceFields = $meta->getReferenceFieldDetails();
     $fieldColumnMapping = $meta->getFieldColumnMapping();
     $columnTableMapping = $meta->getColumnTableMapping();
     $tableList = array();
     $columnList = array();
     $allColumnList = $meta->getUserAccessibleColumns();
     if (count($variableList) > 0) {
         foreach ($variableList as $column) {
             if (in_array($column, $allColumnList)) {
                 $columnList[] = $column;
             }
         }
         foreach ($columnList as $column) {
             if (!empty($columnTableMapping[$column])) {
                 $tableList[$columnTableMapping[$column]] = '';
             }
         }
         $tableList = array_keys($tableList);
         $defaultTableList = $meta->getEntityDefaultTableList();
         foreach ($defaultTableList as $defaultTable) {
             if (!in_array($defaultTable, $tableList)) {
                 $tableList[] = $defaultTable;
             }
         }
         // right now this is will be limited to module type, entities.
         // need to extend it to non-module entities when we have a reliable way of getting
         // record type from the given record id. non webservice id.
         // can extend to non-module entity without many changes as long as the reference field
         // refers to one type of entity, either module entities or non-module entities.
         if (count($tableList) > 0) {
             $sql = 'select ' . implode(', ', $columnList) . ' from ' . $tableList[0];
             $moduleTableIndexList = $meta->getEntityTableIndexList();
             foreach ($tableList as $index => $tableName) {
                 if ($tableName != $tableList[0]) {
                     $sql .= ' INNER JOIN ' . $tableName . ' ON ' . $tableList[0] . '.' . $moduleTableIndexList[$tableList[0]] . '=' . $tableName . '.' . $moduleTableIndexList[$tableName];
                 }
             }
             $sql .= ' WHERE';
             $deleteQuery = $meta->getEntityDeletedQuery();
             if (!empty($deleteQuery)) {
                 $sql .= ' ' . $meta->getEntityDeletedQuery() . ' AND';
             }
             $sql .= ' ' . $tableList[0] . '.' . $moduleTableIndexList[$tableList[0]] . '=?';
             $params = array($this->recordId);
             $db = PearDatabase::getInstance();
             $result = $db->pquery($sql, $params);
             $it = new SqlResultIterator($db, $result);
             //assuming there can only be one row.
             $values = array();
             foreach ($it as $row) {
                 foreach ($columnList as $column) {
                     $values[$column] = $row->get($column);
                 }
             }
             $moduleFields = $meta->getModuleFields();
             foreach ($moduleFields as $fieldName => $webserviceField) {
                 if (isset($values[$fieldColumnMapping[$fieldName]]) && $values[$fieldColumnMapping[$fieldName]] !== null) {
                     if (strcasecmp($webserviceField->getFieldDataType(), 'reference') === 0) {
                         $details = $webserviceField->getReferenceList();
                         if (count($details) == 1) {
                             $referencedObjectHandler = vtws_getModuleHandlerFromName($details[0], $this->user);
                         } else {
                             $type = getSalesEntityType($values[$fieldColumnMapping[$fieldName]]);
                             $referencedObjectHandler = vtws_getModuleHandlerFromName($type, $this->user);
                         }
                         $referencedObjectMeta = $referencedObjectHandler->getMeta();
                         $values[$fieldColumnMapping[$fieldName]] = $referencedObjectMeta->getName(vtws_getId($referencedObjectMeta->getEntityId(), $values[$fieldColumnMapping[$fieldName]]));
                     } elseif (strcasecmp($webserviceField->getFieldDataType(), 'owner') === 0) {
                         $referencedObjectHandler = vtws_getModuleHandlerFromName(vtws_getOwnerType($values[$fieldColumnMapping[$fieldName]]), $this->user);
                         $referencedObjectMeta = $referencedObjectHandler->getMeta();
                         $values[$fieldColumnMapping[$fieldName]] = $referencedObjectMeta->getName(vtws_getId($referencedObjectMeta->getEntityId(), $values[$fieldColumnMapping[$fieldName]]));
                     } elseif (strcasecmp($webserviceField->getFieldDataType(), 'picklist') === 0) {
                         $values[$fieldColumnMapping[$fieldName]] = getTranslatedString($values[$fieldColumnMapping[$fieldName]], $this->module);
                     } elseif (strcasecmp($webserviceField->getFieldDataType(), 'datetime') === 0) {
                         $values[$fieldColumnMapping[$fieldName]] = $values[$fieldColumnMapping[$fieldName]] . ' ' . DateTimeField::getDBTimeZone();
                     }
                 }
             }
             foreach ($columnList as $column) {
                 $needle = '$' . strtolower($this->module) . "-{$column}\$";
                 $this->processedDescription = str_replace($needle, $values[$column], $this->processedDescription);
             }
         }
     }
     $this->processed = true;
 }
开发者ID:sacredwebsite,项目名称:vtigercrm,代码行数:91,代码来源:EmailTemplate.php


示例17: getAdvancedSearchCriteriaList

function getAdvancedSearchCriteriaList($advft_criteria, $advft_criteria_groups, $module = '')
{
    global $currentModule, $current_user;
    if (empty($module)) {
        $module = $currentModule;
    }
    $advfilterlist = array();
    $moduleHandler = vtws_getModuleHandlerFromName($module, $current_user);
    $moduleMeta = $moduleHandler->getMeta();
    $moduleFields = $moduleMeta->getModuleFields();
    foreach ($advft_criteria as $column_index => $column_condition) {
        if (empty($column_condition)) {
            continue;
        }
        $adv_filter_column = $column_condition["columnname"];
        $adv_filter_comparator = $column_condition["comparator"];
        $adv_filter_value = $column_condition["value"];
        $adv_filter_column_condition = $column_condition["columncondition"];
        $adv_filter_groupid = $column_condition["groupid"];
        $column_info = explode(":", $adv_filter_column);
        $fieldName = $column_info[2];
        $fieldObj = $moduleFields[$fieldName];
        $fieldType = $fieldObj->getFieldDataType();
        if ($fieldType == 'currency') {
            // Some of the currency fields like Unit Price, Total, Sub-total etc of Inventory modules, do not need currency conversion
            if ($fieldObj->getUIType() == '72') {
                $adv_filter_value = CurrencyField::convertToDBFormat($adv_filter_value, null, true);
            } else {
                $currencyField = new CurrencyField($adv_filter_value);
                if ($module == 'Potentials' && $fieldName == 'amount') {
                    $currencyField->setNumberofDecimals(2);
                }
                $adv_filter_value = $currencyField->getDBInsertedValue();
            }
        }
        $criteria = array();
        $criteria['columnname'] = $adv_filter_column;
        $criteria['comparator'] = $adv_filter_comparator;
        $criteria['value'] = $adv_filter_value;
        $criteria['column_condition'] = $adv_filter_column_condition;
        $advfilterlist[$adv_filter_groupid]['columns'][] = $criteria;
    }
    foreach ($advft_criteria_groups as $group_index => $group_condition_info) {
        if (empty($group_condition_info)) {
            continue;
        }
        if (empty($advfilterlist[$group_index])) {
            continue;
        }
        $advfilterlist[$group_index]['condition'] = $group_condition_info["groupcondition"];
        $noOfGroupColumns = count($advfilterlist[$group_index]['columns']);
        if (!empty($advfilterlist[$group_index]['columns'][$noOfGroupColumns - 1]['column_condition'])) {
            $advfilterlist[$group_index]['columns'][$noOfGroupColumns - 1]['column_condition'] = '';
        }
    }
    $noOfGroups = count($advfilterlist);
    if (!empty($advfilterlist[$noOfGroups]['condition'])) {
        $advfilterlist[$noOfGroups]['condition'] = '';
    }
    return $advfilterlist;
}
开发者ID:sacredwebsite,项目名称:vtigercrm,代码行数:61,代码来源:SearchUtils.php


示例18: Array

 /** to get the getModuleColumnsList for the given module
 	 * @param $module :: Type String
 	 * @returns  $ret_module_list Array in the following format
 	 * $ret_module_list =
 	  Array ('module' =>
 	  Array('BlockLabel1' =>
 	  Array('$fieldtablename:$fieldcolname:$fieldname:$module_$fieldlabel1:$fieldtypeofdata'=>$fieldlabel,
 	  Array('$fieldtablename1:$fieldcolname1:$fieldname1:$module_$fieldlabel11:$fieldtypeofdata1'=>$fieldlabel1,
 	  Array('BlockLabel2' =>
 	  Array('$fieldtablename:$fieldcolname:$fieldname:$module_$fieldlabel1:$fieldtypeofdata'=>$fieldlabel,
 	  Array('$fieldtablename1:$fieldcolname1:$fieldname1:$module_$fieldlabel11:$fieldtypeofdata1'=>$fieldlabel1,
 	  |
 	  Array('BlockLabeln' =>
 	  Array('$fieldtablename:$fieldcolname:$fieldname:$module_$fieldlabel1:$fieldtypeofdata'=>$fieldlabel,
 	  Array('$fieldtablename1:$fieldcolname1:$fieldname1:$module_$fieldlabel11:$fieldtypeofdata1'=>$fieldlabel1,
 	 */
 function getModuleColumnsList($module)
 {
     global $current_user;
     $module_info = $this->getCustomViewModuleInfo($module);
     foreach ($this->module_list[$module] as $key => $value) {
         $columnlist = $this->getColumnsListbyBlock($module, $value, true);
         if (isset($columnlist)) {
             $ret_module_list[$module][$key] = $columnlist;
         }
     }
     $handler = vtws_getModuleHandlerFromName($module, $current_user);
     $meta = $handler->getMeta();
     $reffields = $meta->getReferenceFieldDetails();
     foreach ($reffields as $fld => $mods) {
         foreach ($mods as $mod) {
             if (!vtlib_isEntityModule($mod)) {
                 continue;
             }
             // reference to a module without fields
             if (isset($ret_module_list[$mod])) {
                 continue;
             }
             // we already have this one
             $module_info = $this->getCustomViewModuleInfo($mod);
             foreach ($this->module_list[$mod] as $key => $value) {
                 $columnlist = $this->getColumnsListbyBlock($mod, $value, false);
                 if (isset($columnlist)) {
                     $ret_module_list[$mod][$key] = $columnlist;
                 }
             }
         }
     }
     return $ret_module_list;
 }
开发者ID:kikojover,项目名称:corebos,代码行数:50,代码来源:CustomView.php


示例19: unset

     $enddate = DateTimeField::convertToDBFormat($enddate);
 }
 $std_filter_list["startdate"] = $startdate;
 $std_filter_list["enddate"] = $enddate;
 if (empty($startdat 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP vtws_getOwnerType函数代码示例发布时间:2022-05-23
下一篇:
PHP vtws_getIdComponents函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap