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


PHP SugarBean::get_linked_fields方法代码示例

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


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

示例1: array

 function run_action(SugarBean $bean, $params = array(), $in_save = false)
 {
     if (isset($params['rel_type']) && $params['rel_type'] != '' && $bean->module_dir != $params['rel_type']) {
         $relatedFields = $bean->get_linked_fields();
         $field = $relatedFields[$params['rel_type']];
         if (!isset($field['module']) || $field['module'] == '') {
             $field['module'] = getRelatedModule($bean->module_dir, $field['name']);
         }
         $linkedBeans = $bean->get_linked_beans($field['name'], $field['module']);
         if ($linkedBeans) {
             foreach ($linkedBeans as $linkedBean) {
                 $this->set_record($linkedBean, $bean, $params, 'false');
                 $this->set_relationships($linkedBean, $bean, $params);
             }
         }
     } else {
         $this->set_record($bean, $bean, $params, $in_save);
         $this->set_relationships($bean, $bean, $params);
     }
     return true;
 }
开发者ID:omusico,项目名称:windcrm,代码行数:21,代码来源:actionModifyRecord.php

示例2: getEmailsFromParams

 private function getEmailsFromParams(SugarBean $bean, $params)
 {
     $emails = array();
     //backward compatible
     if (isset($params['email_target_type']) && !is_array($params['email_target_type'])) {
         $email = '';
         switch ($params['email_target_type']) {
             case 'Email Address':
                 $params['email'] = array($params['email']);
                 break;
             case 'Specify User':
                 $params['email'] = array($params['email_user_id']);
                 break;
             case 'Related Field':
                 $params['email'] = array($params['email_target']);
                 break;
         }
         $params['email_target_type'] = array($params['email_target_type']);
         $params['email_to_type'] = array('to');
     }
     //end backward compatible
     if (isset($params['email_target_type'])) {
         foreach ($params['email_target_type'] as $key => $field) {
             switch ($field) {
                 case 'Email Address':
                     if (trim($params['email'][$key]) != '') {
                         $emails[$params['email_to_type'][$key]][] = $params['email'][$key];
                     }
                     break;
                 case 'Specify User':
                     $user = new User();
                     $user->retrieve($params['email'][$key]);
                     $user_email = $user->emailAddress->getPrimaryAddress($user);
                     if (trim($user_email) != '') {
                         $emails[$params['email_to_type'][$key]][] = $user_email;
                         $emails['template_override'][$user_email] = array('Users' => $user->id);
                     }
                     break;
                 case 'Users':
                     $users = array();
                     switch ($params['email'][$key][0]) {
                         case 'security_group':
                             if (file_exists('modules/SecurityGroups/SecurityGroup.php')) {
                                 require_once 'modules/SecurityGroups/SecurityGroup.php';
                                 $security_group = new SecurityGroup();
                                 $security_group->retrieve($params['email'][$key][1]);
                                 $users = $security_group->get_linked_beans('users', 'User');
                                 $r_users = array();
                                 if ($params['email'][$key][2] != '') {
                                     require_once 'modules/ACLRoles/ACLRole.php';
                                     $role = new ACLRole();
                                     $role->retrieve($params['email'][$key][2]);
                                     $role_users = $role->get_linked_beans('users', 'User');
                                     foreach ($role_users as $role_user) {
                                         $r_users[$role_user->id] = $role_user->name;
                                     }
                                 }
                                 foreach ($users as $user_id => $user) {
                                     if ($params['email'][$key][2] != '' && !isset($r_users[$user->id])) {
                                         unset($users[$user_id]);
                                     }
                                 }
                                 break;
                             }
                             //No Security Group module found - fall through.
                         //No Security Group module found - fall through.
                         case 'role':
                             require_once 'modules/ACLRoles/ACLRole.php';
                             $role = new ACLRole();
                             $role->retrieve($params['email'][$key][2]);
                             $users = $role->get_linked_beans('users', 'User');
                             break;
                         case 'all':
                         default:
                             global $db;
                             $sql = "SELECT id from users WHERE status='Active' AND portal_only=0 ";
                             $result = $db->query($sql);
                             while ($row = $db->fetchByAssoc($result)) {
                                 $user = new User();
                                 $user->retrieve($row['id']);
                                 $users[$user->id] = $user;
                             }
                             break;
                     }
                     foreach ($users as $user) {
                         $user_email = $user->emailAddress->getPrimaryAddress($user);
                         if (trim($user_email) != '') {
                             $emails[$params['email_to_type'][$key]][] = $user_email;
                             $emails['template_override'][$user_email] = array('Users' => $user->id);
                         }
                     }
                     break;
                 case 'Related Field':
                     $emailTarget = $params['email'][$key];
                     $relatedFields = array_merge($bean->get_related_fields(), $bean->get_linked_fields());
                     $field = $relatedFields[$emailTarget];
                     if ($field['type'] == 'relate') {
                         $linkedBeans = array();
                         $idName = $field['id_name'];
                         $id = $bean->{$idName};
//.........这里部分代码省略.........
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:101,代码来源:actionSendEmail.php


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