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

PHP vtws_getOwnerType函数代码示例

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

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



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

示例1: getSearchParams

 function getSearchParams($stage, $assignedto, $dates)
 {
     $listSearchParams = array();
     $conditions = array();
     array_push($conditions, array("sales_stage", "e", $stage));
     if ($assignedto == '') {
         $currenUserModel = Users_Record_Model::getCurrentUserModel();
         $assignedto = $currenUserModel->getId();
     }
     if ($assignedto != 'all') {
         $ownerType = vtws_getOwnerType($assignedto);
         if ($ownerType == 'Users') {
             array_push($conditions, array("assigned_user_id", "e", getUserFullName($assignedto)));
         } else {
             $groupName = getGroupName($assignedto);
             $groupName = $groupName[0];
             array_push($conditions, array("assigned_user_id", "e", $groupName));
         }
     }
     if (!empty($dates)) {
         array_push($conditions, array("closingdate", "bw", $dates['start'] . ',' . $dates['end']));
     }
     $listSearchParams[] = $conditions;
     return '&search_params=' . json_encode($listSearchParams);
 }
开发者ID:yozhi,项目名称:YetiForceCRM,代码行数:25,代码来源:CampaignsWidget.php


示例2: process

 public function process(Vtiger_Request $request)
 {
     $recordId = $request->get('record');
     $modules = $request->get('modules');
     $assignId = $request->get('assigned_user_id');
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $entityValues = array();
     $entityValues['transferRelatedRecordsTo'] = $request->get('transferModule');
     //■権限なぜか、エラーになるので権限を固定するinouchi
     //$entityValues['assignedTo'] = vtws_getWebserviceEntityId(vtws_getOwnerType($assignId), $assignId);
     $entityValues['assignedTo'] = vtws_getWebserviceEntityId(vtws_getOwnerType(1), 1);
     $entityValues['leadId'] = vtws_getWebserviceEntityId($request->getModule(), $recordId);
     $recordModel = Vtiger_Record_Model::getInstanceById($recordId, $request->getModule());
     $convertLeadFields = $recordModel->getConvertLeadFields();
     $availableModules = array('Accounts', 'Contacts', 'Potentials');
     foreach ($availableModules as $module) {
         if (vtlib_isModuleActive($module) && in_array($module, $modules)) {
             $entityValues['entities'][$module]['create'] = true;
             $entityValues['entities'][$module]['name'] = $module;
             foreach ($convertLeadFields[$module] as $fieldModel) {
                 $fieldName = $fieldModel->getName();
                 $fieldValue = $request->get($fieldName);
                 //Potential Amount Field value converting into DB format
                 if ($fieldModel->getFieldDataType() === 'currency') {
                     $fieldValue = Vtiger_Currency_UIType::convertToDBFormat($fieldValue);
                 } elseif ($fieldModel->getFieldDataType() === 'date') {
                     $fieldValue = DateTimeField::convertToDBFormat($fieldValue);
                 } elseif ($fieldModel->getFieldDataType() === 'reference' && $fieldValue) {
                     $ids = vtws_getIdComponents($fieldValue);
                     if (count($ids) === 1) {
                         $fieldValue = vtws_getWebserviceEntityId(getSalesEntityType($fieldValue), $fieldValue);
                     }
                 }
                 $entityValues['entities'][$module][$fieldName] = $fieldValue;
             }
         }
     }
     try {
         $result = vtws_convertlead($entityValues, $currentUser);
     } catch (Exception $e) {
         $this->showError($request, $e);
         exit;
     }
     if (!empty($result['Accounts'])) {
         $accountIdComponents = vtws_getIdComponents($result['Accounts']);
         $accountId = $accountIdComponents[1];
     }
     if (!empty($result['Contacts'])) {
         $contactIdComponents = vtws_getIdComponents($result['Contacts']);
         $contactId = $contactIdComponents[1];
     }
     if (!empty($accountId)) {
         header("Location: index.php?view=Detail&module=Accounts&record={$accountId}");
     } elseif (!empty($contactId)) {
         header("Location: index.php?view=Detail&module=Contacts&record={$contactId}");
     } else {
         $this->showError($request);
         exit;
     }
 }
开发者ID:cin-system,项目名称:cinrepo,代码行数:60,代码来源:SaveConvertLead.php


示例3: HelpDesk_notifyOwnerOnTicketChange

function HelpDesk_notifyOwnerOnTicketChange($entityData)
{
    global $HELPDESK_SUPPORT_NAME, $HELPDESK_SUPPORT_EMAIL_ID;
    $moduleName = $entityData->getModuleName();
    $wsId = $entityData->getId();
    $parts = explode('x', $wsId);
    $entityId = $parts[1];
    $isNew = $entityData->isNew();
    if (!$isNew) {
        $reply = 'Re : ';
    } else {
        $reply = '';
    }
    // SalesPlatform.ru begin
    $subject = ' [ ' . getTranslatedString('Ticket No', $moduleName) . ' ' . $entityData->get('ticket_no') . ' ] ' . $reply . $entityData->get('ticket_title');
    //$subject = $entityData->get('ticket_no') . ' [ '.getTranslatedString('LBL_TICKET_ID', $moduleName)
    //					.' : '.$entityId.' ] '.$reply.$entityData->get('ticket_title');
    // SalesPlatform.ru end
    $email_body = HelpDesk::getTicketEmailContents($entityData, true);
    if (PerformancePrefs::getBoolean('NOTIFY_OWNER_EMAILS', true) === true) {
        //send mail to the assigned to user and the parent to whom this ticket is assigned
        require_once 'modules/Emails/mail.php';
        $wsAssignedUserId = $entityData->get('assigned_user_id');
        $userIdParts = explode('x', $wsAssignedUserId);
        $ownerId = $userIdParts[1];
        $ownerType = vtws_getOwnerType($ownerId);
        if ($ownerType == 'Users') {
            $to_email = getUserEmailId('id', $ownerId);
        }
        if ($ownerType == 'Groups') {
            $to_email = implode(',', getDefaultAssigneeEmailIds($ownerId));
        }
        if ($to_email != '') {
            if ($isNew) {
                $mail_status = send_mail('HelpDesk', $to_email, $HELPDESK_SUPPORT_NAME, $HELPDESK_SUPPORT_EMAIL_ID, $subject, $email_body);
            } else {
                $entityDelta = new VTEntityDelta();
                $statusHasChanged = $entityDelta->hasChanged($entityData->getModuleName(), $entityId, 'ticketstatus');
                $solutionHasChanged = $entityDelta->hasChanged($entityData->getModuleName(), $entityId, 'solution');
                $ownerHasChanged = $entityDelta->hasChanged($entityData->getModuleName(), $entityId, 'assigned_user_id');
                $descriptionHasChanged = $entityDelta->hasChanged($entityData->getModuleName(), $entityId, 'description');
                if ($statusHasChanged && $entityData->get('ticketstatus') == "Closed" || $solutionHasChanged || $ownerHasChanged || $descriptionHasChanged) {
                    $mail_status = send_mail('HelpDesk', $to_email, $HELPDESK_SUPPORT_NAME, $HELPDESK_SUPPORT_EMAIL_ID, $subject, $email_body);
                }
            }
            $mail_status_str = $to_email . "=" . $mail_status . "&&&";
        } else {
            $mail_status_str = "'" . $to_email . "'=0&&&";
        }
        if ($mail_status != '') {
            $mail_error_status = getMailErrorString($mail_status_str);
        }
    }
}
开发者ID:gitter-badger,项目名称:openshift-salesplatform,代码行数:54,代码来源:HelpDeskHandler.php


示例4: sanitizeOwnerFields

 function sanitizeOwnerFields($row, $meta, $t = null)
 {
     global $adb;
     $ownerFields = $meta->getOwnerFields();
     foreach ($ownerFields as $index => $field) {
         if (isset($row[$field]) && $row[$field] != null) {
             $ownerType = vtws_getOwnerType($row[$field]);
             $webserviceObject = VtigerWebserviceObject::fromName($adb, $ownerType);
             $row[$field] = vtws_getId($webserviceObject->getEntityId(), $row[$field]);
         }
     }
     return $row;
 }
开发者ID:jgjermeni,项目名称:corebos,代码行数:13,代码来源:DataTransform.php


示例5: HeldDeskNewCommentOwner

function HeldDeskNewCommentOwner($entityData)
{
    $log = vglobal('log');
    $log->debug('Entering HeldDeskNewCommentAccount');
    $db = PearDatabase::getInstance();
    $wsId = $entityData->getId();
    $parts = explode('x', $wsId);
    $entityId = $parts[1];
    $data = $entityData->getData();
    $relatedToWSId = $data['related_to'];
    $relatedToId = explode('x', $relatedToWSId);
    $mails = [];
    $sql = 'SELECT smownerid FROM vtiger_crmentity WHERE deleted = 0 AND crmid = ? ';
    $result = $db->pquery($sql, [$relatedToId[1]]);
    if ($result->rowCount() > 0) {
        $smownerid = $db->getSingleValue($result);
        $ownerType = vtws_getOwnerType($smownerid);
        if ($ownerType == 'Users') {
            $user = new Users();
            $currentUser = $user->retrieveCurrentUserInfoFromFile($smownerid);
            if ($currentUser->column_fields['emailoptout'] == '1') {
                $mails[] = $currentUser->column_fields['email1'];
            }
        } else {
            require_once 'include/utils/GetGroupUsers.php';
            $ggu = new GetGroupUsers();
            $ggu->getAllUsersInGroup($smownerid);
            foreach ($ggu->group_users as $userId) {
                $user = new Users();
                $currentUser = $user->retrieveCurrentUserInfoFromFile($userId);
                if ($currentUser->column_fields['emailoptout'] == '1') {
                    $mails[] = $currentUser->column_fields['email1'];
                }
            }
        }
    }
    if (count($mails) > 0) {
        $mails = implode(',', $mails);
        $data = ['sysname' => 'NewCommentAddedToTicketOwner', 'to_email' => $mails, 'module' => 'ModComments', 'record' => $entityId];
        $recordModel = Vtiger_Record_Model::getCleanInstance('OSSMailTemplates');
        if ($recordModel->sendMailFromTemplate($data)) {
            $log->debug('HeldDeskNewCommentAccount');
            return true;
        }
    }
    $log->debug('HeldDeskNewCommentAccount');
    return false;
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:48,代码来源:HelpDeskWorkflow.php


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


示例7: process

 public function process($params)
 {
     $module = $this->module;
     $recordId = $this->recordId;
     $variableList = $this->getTemplateVariableListForModule($module);
     $handler = vtws_getModuleHandlerFromName($module, $this->user);
     $meta = $handler->getMeta();
     $referenceFields = $meta->getReferenceFieldDetails();
     $fieldColumnMapping = $meta->getFieldColumnMapping();
     $columnTableMapping = $meta->getColumnTableMapping();
     if ($this->isProcessingReferenceField($params)) {
         $parentFieldColumnMapping = $meta->getFieldColumnMapping();
         $module = $params['referencedMeta']->getEntityName();
         if ($this->processedmodules[$module] || !$this->isModuleActive($module)) {
             return;
         }
         $recordId = $params['id'];
         $meta = $params['referencedMeta'];
         $referenceFields = $meta->getReferenceFieldDetails();
         $fieldColumnMapping = $meta->getFieldColumnMapping();
         $columnTableMapping = $meta->getColumnTableMapping();
         $referenceColumn = $parentFieldColumnMapping[$params['field']];
         $variableList = $this->referencedFields[$referenceColumn];
     }
     $tableList = array();
     $columnList = array();
     $allColumnList = $meta->getUserAccessibleColumns();
     $fieldList = array();
     if (count($variableList) > 0) {
         foreach ($variableList as $column) {
             if (in_array($column, $allColumnList)) {
                 $fieldList[] = array_search($column, $fieldColumnMapping);
                 $columnList[] = $column;
             }
         }
         foreach ($fieldList as $field) {
             if (!empty($columnTableMapping[$fieldColumnMapping[$field]])) {
                 $tableList[$columnTableMapping[$fieldColumnMapping[$field]]] = '';
             }
         }
         $tableList = array_keys($tableList);
         $defaultTableList = $meta->getEntityDefaultTableList();
         foreach ($defaultTableList as $defaultTable) {
             if (!in_array($defaultTable, $tableList)) {
                 $tableList[] = $defaultTable;
             }
         }
         if (count($tableList) > 0 && count($columnList) > 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];
                 }
             }
             //If module is Leads and if you are not selected any leads fields then query failure is happening.
             //By default we are checking where condition on base table.
             if ($module == 'Leads' && !in_array('vtiger_leaddetails', $tableList)) {
                 $sql .= ' INNER JOIN vtiger_leaddetails ON vtiger_leaddetails.leadid = vtiger_crmentity.crmid';
             }
             $sql .= ' WHERE';
             $deleteQuery = $meta->getEntityDeletedQuery();
             if (!empty($deleteQuery)) {
                 $sql .= ' ' . $meta->getEntityDeletedQuery() . ' AND';
             }
             $sql .= ' ' . $tableList[0] . '.' . $moduleTableIndexList[$tableList[0]] . '=?';
             $sqlparams = array($recordId);
             $db = PearDatabase::getInstance();
             $result = $db->pquery($sql, $sqlparams);
             $it = new SqlResultIterator($db, $result);
             //assuming there can only be one row.
             $values = array();
             foreach ($it as $row) {
                 foreach ($fieldList as $field) {
                     $values[$field] = $row->get($fieldColumnMapping[$field]);
                 }
             }
             $moduleFields = $meta->getModuleFields();
             foreach ($moduleFields as $fieldName => $webserviceField) {
                 $presence = $webserviceField->getPresence();
                 if (!in_array($presence, array(0, 2))) {
                     continue;
                 }
                 if (isset($values[$fieldName]) && $values[$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[$fieldName]);
                             $referencedObjectHandler = vtws_getModuleHandlerFromName($type, $this->user);
                         }
                         $referencedObjectMeta = $referencedObjectHandler->getMeta();
                         if (!$this->isProcessingReferenceField($params) && !empty($values[$fieldName])) {
                             $this->process(array('parentMeta' => $meta, 'referencedMeta' => $referencedObjectMeta, 'field' => $fieldName, 'id' => $values[$fieldName]));
                         }
                         $values[$fieldName] = $referencedObjectMeta->getName(vtws_getId($referencedObjectMeta->getEntityId(), $values[$fieldName]));
                     } elseif (strcasecmp($webserviceField->getFieldDataType(), 'owner') === 0) {
                         $referencedObjectHandler = vtws_getModuleHandlerFromName(vtws_getOwnerType($values[$fieldName]), $this->user);
                         $referencedObjectMeta = $referencedObjectHandler->getMeta();
//.........这里部分代码省略.........
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:101,代码来源:EmailTemplate.php


示例8: process

    public function process()
    {
        global $site_URL;
        $imagefound = false;
        $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();
        $columnList_full = array();
        $allColumnList = $meta->getUserAccessibleColumns();
        if (count($variableList) > 0) {
            foreach ($variableList as $column) {
                if (in_array($column, $allColumnList)) {
                    $columnList[] = $column;
                    $columnList_full[] = $columnTableMapping[$column] . '.' . $column;
                }
            }
            foreach ($columnList as $column) {
                if (!empty($columnTableMapping[$column])) {
                    $tableList[$columnTableMapping[$column]] = '';
                }
            }
            $tableList = array_keys($tableList);
            $defaultTableList = $meta->getEntityDefaultTableList();
            $tableList = array_merge($tableList, $defaultTableList);
            $leadtables = array('vtiger_leadsubdetails', 'vtiger_leadaddress', 'vtiger_leadscf');
            $leadmerge = array_intersect($tableList, $leadtables);
            if (count($leadmerge) > 0 and !in_array('vtiger_leaddetails', $tableList)) {
                // we need this one because the where condition for Leads uses the converted column from the main table
                $tableList[] = 'vtiger_leaddetails';
            }
            // 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_full) . ' 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 .= " {$deleteQuery} 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) {
                        $fieldtype = $webserviceField->getFieldDataType();
                        if (strcasecmp($fieldtype, '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($fieldtype, '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($fieldtype, 'picklist') === 0 or $fieldName == 'salutationtype') {
                            $values[$fieldColumnMapping[$fieldName]] = getTranslatedString($values[$fieldColumnMapping[$fieldName]], $this->module);
                        } elseif (strcasecmp($fieldtype, 'datetime') === 0) {
                            $values[$fieldColumnMapping[$fieldName]] = $values[$fieldColumnMapping[$fieldName]] . ' ' . DateTimeField::getDBTimeZone();
                        } elseif (strcasecmp($fieldtype, 'currency') === 0 or strcasecmp($fieldtype, 'double') === 0) {
                            $currencyField = new CurrencyField($values[$fieldColumnMapping[$fieldName]]);
                            $values[$fieldColumnMapping[$fieldName]] = $currencyField->getDisplayValue(null, true);
                        } elseif ($webserviceField->getUIType() == 69) {
                            $query = 'select vtiger_attachments.name, vtiger_attachments.type, vtiger_attachments.attachmentsid, vtiger_attachments.path
									from vtiger_attachments
									inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_attachments.attachmentsid
									inner join vtiger_seattachmentsrel on vtiger_attachments.attachmentsid=vtiger_seattachmentsrel.attachmentsid
									where (vtiger_crmentity.setype LIKE "%Image" or vtiger_crmentity.setype LIKE "%Attachment")
									  and deleted=0 and vtiger_seattachmentsrel.crmid=?';
                            $params = array($this->recordId);
                            if (!empty($values[$fieldColumnMapping[$fieldName]])) {
                                $query .= ' and vtiger_attachments.name = ?';
//.........这里部分代码省略.........
开发者ID:kduqi,项目名称:corebos,代码行数:101,代码来源:EmailTemplate.php


示例9: process

 public function process(Vtiger_Request $request)
 {
     $recordId = $request->get('record');
     $modules = $request->get('modules');
     $assignId = $request->get('assigned_user_id');
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $entityValues = array();
     $entityValues['transferRelatedRecordsTo'] = $request->get('transferModule');
     $entityValues['assignedTo'] = vtws_getWebserviceEntityId(vtws_getOwnerType($assignId), $assignId);
     $entityValues['leadId'] = vtws_getWebserviceEntityId($request->getModule(), $recordId);
     $createAlways = Vtiger_Processes_Model::getConfig('marketing', 'conversion', 'create_always');
     $recordModel = Vtiger_Record_Model::getInstanceById($recordId, $request->getModule());
     $convertLeadFields = $recordModel->getConvertLeadFields();
     $availableModules = array('Accounts', 'Contacts', 'Potentials');
     foreach ($availableModules as $module) {
         if (vtlib_isModuleActive($module) && in_array($module, $modules)) {
             $entityValues['entities'][$module]['create'] = true;
             $entityValues['entities'][$module]['name'] = $module;
             foreach ($convertLeadFields[$module] as $fieldModel) {
                 $fieldName = $fieldModel->getName();
                 $fieldValue = $request->get($fieldName);
                 //Potential Amount Field value converting into DB format
                 if ($fieldModel->getFieldDataType() === 'currency') {
                     $fieldValue = Vtiger_Currency_UIType::convertToDBFormat($fieldValue);
                 } elseif ($fieldModel->getFieldDataType() === 'date') {
                     $fieldValue = DateTimeField::convertToDBFormat($fieldValue);
                 } elseif ($fieldModel->getFieldDataType() === 'reference' && $fieldValue) {
                     $ids = vtws_getIdComponents($fieldValue);
                     if (count($ids) === 1) {
                         $fieldValue = vtws_getWebserviceEntityId(getSalesEntityType($fieldValue), $fieldValue);
                     }
                 }
                 $entityValues['entities'][$module][$fieldName] = $fieldValue;
             }
         }
     }
     try {
         $results = true;
         if ($createAlways === true || $createAlways === 'true') {
             $leadModel = Vtiger_Module_Model::getCleanInstance($request->getModule());
             $results = $leadModel->searchAccountsToConvert($recordModel);
             $entityValues['entities']['Accounts']['convert_to_id'] = $results;
         }
         if (!$results) {
             $message = vtranslate('LBL_TOO_MANY_ACCOUNTS_TO_CONVERT', $request->getModule(), '');
             if ($currentUser->isAdminUser()) {
                 $message = vtranslate('LBL_TOO_MANY_ACCOUNTS_TO_CONVERT', $request->getModule(), '<a href="index.php?module=MarketingProcesses&view=Index&parent=Settings"><span class="glyphicon glyphicon-folder-open"></span></a>');
             }
             $this->showError($request, '', $message);
             exit;
         }
     } catch (Exception $e) {
         $this->showError($request, $e);
         exit;
     }
     try {
         $result = vtws_convertlead($entityValues, $currentUser);
     } catch (Exception $e) {
         $this->showError($request, $e);
         exit;
     }
     if (!empty($result['Accounts'])) {
         $accountIdComponents = vtws_getIdComponents($result['Accounts']);
         $accountId = $accountIdComponents[1];
     }
     if (!empty($result['Contacts'])) {
         $contactIdComponents = vtws_getIdComponents($result['Contacts']);
         $contactId = $contactIdComponents[1];
     }
     if (!empty($accountId)) {
         ModTracker_Record_Model::addConvertToAccountRelation('Accounts', $accountId, $assignId);
         header("Location: index.php?view=Detail&module=Accounts&record={$accountId}");
     } elseif (!empty($contactId)) {
         header("Location: index.php?view=Detail&module=Contacts&record={$contactId}");
     } else {
         $this->showError($request);
         exit;
     }
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:79,代码来源:SaveConvertLead.php


示例10: __CreateNewEmail

 /**
  * Create new Email record (and link to given record) including attachements
  */
 function __CreateNewEmail($mailrecord, $module, $linkfocus)
 {
     global $current_user, $adb;
     if (!$current_user) {
         $current_user = Users::getActiveAdminUser();
     }
     $assignedToId = $linkfocus->column_fields['assigned_user_id'];
     if (vtws_getOwnerType($assignedToId) == 'Groups') {
         $assignedToId = Users::getActiveAdminId();
     }
     $focus = new Emails();
     $focus->column_fields['parent_type'] = $module;
     $focus->column_fields['activitytype'] = 'Emails';
     $focus->column_fields['parent_id'] = "{$linkfocus->id}@-1|";
     $focus->column_fields['subject'] = $mailrecord->_subject;
     $focus->column_fields['description'] = $mailrecord->getBodyHTML();
     $focus->column_fields['assigned_user_id'] = $assignedToId;
     $focus->column_fields["date_start"] = date('Y-m-d', $mailrecord->_date);
     $focus->column_fields["time_start"] = gmdate("H:i:s");
     $focus->column_fields["email_flag"] = 'MAILSCANNER';
     $from = $mailrecord->_from[0];
     $to = $mailrecord->_to[0];
     $cc = !empty($mailrecord->_cc) ? implode(',', $mailrecord->_cc) : '';
     $bcc = !empty($mailrecord->_bcc) ? implode(',', $mailrecord->_bcc) : '';
     $flag = '';
     // 'SENT'/'SAVED'
     //emails field were restructured and to,bcc and cc field are JSON arrays
     $focus->column_fields['from_email'] = $from;
     $focus->column_fields['saved_toid'] = $to;
     $focus->column_fields['ccmail'] = $cc;
     $focus->column_fields['bccmail'] = $bcc;
     $focus->save('Emails');
     $emailid = $focus->id;
     $this->log("Created [{$focus->id}]: {$mailrecord->_subject} linked it to " . $linkfocus->id);
     // TODO: Handle attachments of the mail (inline/file)
     $this->__SaveAttachements($mailrecord, 'Emails', $focus);
     return $emailid;
 }
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:41,代码来源:MailScannerAction.php


示例11: captureNow

 function captureNow($request)
 {
     $currentLanguage = Vtiger_Language_Handler::getLanguage();
     $moduleLanguageStrings = Vtiger_Language_Handler::getModuleStringsFromFile($currentLanguage);
     vglobal('app_strings', $moduleLanguageStrings['languageStrings']);
     $returnURL = false;
     try {
         if (!vtlib_isModuleActive('Webforms')) {
             throw new Exception('webforms is not active');
         }
         $webform = Webforms_Model::retrieveWithPublicId(vtlib_purify($request['publicid']));
         if (empty($webform)) {
             throw new Exception("Webform not found.");
         }
         $returnURL = $webform->getReturnUrl();
         $roundrobin = $webform->getRoundrobin();
         // Retrieve user information
         $user = CRMEntity::getInstance('Users');
         $user->id = $user->getActiveAdminId();
         $user->retrieve_entity_info($user->id, 'Users');
         // Prepare the parametets
         $parameters = array();
         $webformFields = $webform->getFields();
         foreach ($webformFields as $webformField) {
             if ($webformField->getDefaultValue() != null) {
                 $parameters[$webformField->getFieldName()] = decode_html($webformField->getDefaultValue());
             } else {
                 $webformNeutralizedField = html_entity_decode($webformField->getNeutralizedField(), ENT_COMPAT, "UTF-8");
                 if (is_array(vtlib_purify($request[$webformNeutralizedField]))) {
                     $fieldData = implode(" |##| ", vtlib_purify($request[$webformNeutralizedField]));
                 } else {
                     $fieldData = vtlib_purify($request[$webformNeutralizedField]);
                     $fieldData = decode_html($fieldData);
                 }
                 $parameters[$webformField->getFieldName()] = stripslashes($fieldData);
             }
             if ($webformField->getRequired()) {
                 if (!isset($parameters[$webformField->getFieldName()])) {
                     throw new Exception("Required fields not filled");
                 }
             }
         }
         if ($roundrobin) {
             $ownerId = $webform->getRoundrobinOwnerId();
             $ownerType = vtws_getOwnerType($ownerId);
             $parameters['assigned_user_id'] = vtws_getWebserviceEntityId($ownerType, $ownerId);
         } else {
             $ownerId = $webform->getOwnerId();
             $ownerType = vtws_getOwnerType($ownerId);
             $parameters['assigned_user_id'] = vtws_getWebserviceEntityId($ownerType, $ownerId);
         }
         // Create the record
         $record = vtws_create($webform->getTargetModule(), $parameters, $user);
         $this->sendResponse($returnURL, 'ok');
         return;
     } catch (Exception $e) {
         $this->sendResponse($returnURL, false, $e->getMessage());
         return;
     }
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:60,代码来源:capture.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP vtws_getWebserviceEntityId函数代码示例发布时间:2022-05-23
下一篇:
PHP vtws_getModuleHandlerFromName函数代码示例发布时间: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