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


PHP SugarBean::get_linked_beans方法代码示例

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


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

示例1: getEmailFromParams

 private function getEmailFromParams(SugarBean $bean, $params)
 {
     if (!array_key_exists('email_target_type', $params)) {
         return '';
     }
     switch ($params['email_target_type']) {
         case 'Email Address':
             return array_key_exists('email', $params) ? $params['email'] : '';
         case 'Specify User':
             $user = new User();
             $user->retrieve($params['email_user_id']);
             return $user->emailAddress->getPrimaryAddress($user);
             break;
         case 'Related Field':
             $emailTarget = $params['email_target'];
             $relatedFields = $bean->get_related_fields();
             $field = $relatedFields[$emailTarget];
             $linkedBeans = $bean->get_linked_beans($field['link'], $field['module']);
             if ($linkedBeans) {
                 $linkedBean = $linkedBeans[0];
                 return $linkedBean->emailAddress->getPrimaryAddress($linkedBean);
             }
             break;
         case 'Record Email':
             return $bean->emailAddress->getPrimaryAddress($bean);
             break;
         default:
             return '';
     }
     return "";
 }
开发者ID:isrealconsulting,项目名称:ic-suite,代码行数:31,代码来源:actionSendEmail.php

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

示例3: getUpdateDisplayHead

function getUpdateDisplayHead(SugarBean $update)
{
    if ($update->contact_id) {
        $name = $update->getUpdateContact()->name;
    } elseif ($update->assigned_user_id) {
        $name = $update->getUpdateUser()->name;
    } else {
        $name = "Unknown";
    }
    $html = "<a href='' onclick='toggleCaseUpdate(\"" . $update->id . "\");return false;'>";
    $html .= "<img  id='caseUpdate" . $update->id . "Image' class='caseUpdateImage' src='" . SugarThemeRegistry::current()->getImageURL('basic_search.gif') . "'>";
    $html .= "</a>";
    $html .= "<span>" . ($update->internal ? "<strong>Internal</strong> " : '') . $name . " at " . $update->date_entered . "</span><br>";
    $notes = $update->get_linked_beans('notes', 'Notes');
    if ($notes) {
        $html .= "Attachments: ";
        foreach ($notes as $note) {
            $html .= "<a href='index.php?module=Notes&action=DetailView&record={$note->id}'>{$note->filename}</a>&nbsp;";
        }
    }
    return $html;
}
开发者ID:omusico,项目名称:windcrm,代码行数:22,代码来源:Case_Updates.php

示例4: array

 function parse_template(SugarBean $bean, &$template, $object_override = array())
 {
     global $sugar_config;
     require_once 'modules/AOW_Actions/actions/templateParser.php';
     $object_arr[$bean->module_dir] = $bean->id;
     foreach ($bean->field_defs as $bean_arr) {
         if ($bean_arr['type'] == 'relate') {
             if (isset($bean_arr['module']) && $bean_arr['module'] != '' && isset($bean_arr['id_name']) && $bean_arr['id_name'] != '' && $bean_arr['module'] != 'EmailAddress') {
                 $idName = $bean_arr['id_name'];
                 if (isset($bean->field_defs[$idName]) && $bean->field_defs[$idName]['source'] != 'non-db') {
                     if (!isset($object_arr[$bean_arr['module']])) {
                         $object_arr[$bean_arr['module']] = $bean->{$idName};
                     }
                 }
             }
         } else {
             if ($bean_arr['type'] == 'link') {
                 if (!isset($bean_arr['module']) || $bean_arr['module'] == '') {
                     $bean_arr['module'] = getRelatedModule($bean->module_dir, $bean_arr['name']);
                 }
                 if (isset($bean_arr['module']) && $bean_arr['module'] != '' && !isset($object_arr[$bean_arr['module']]) && $bean_arr['module'] != 'EmailAddress') {
                     $linkedBeans = $bean->get_linked_beans($bean_arr['name'], $bean_arr['module'], array(), 0, 1);
                     if ($linkedBeans) {
                         $linkedBean = $linkedBeans[0];
                         if (!isset($object_arr[$linkedBean->module_dir])) {
                             $object_arr[$linkedBean->module_dir] = $linkedBean->id;
                         }
                     }
                 }
             }
         }
     }
     $object_arr['Users'] = is_a($bean, 'User') ? $bean->id : $bean->assigned_user_id;
     $object_arr = array_merge($object_arr, $object_override);
     $parsedSiteUrl = parse_url($sugar_config['site_url']);
     $host = $parsedSiteUrl['host'];
     if (!isset($parsedSiteUrl['port'])) {
         $parsedSiteUrl['port'] = 80;
     }
     $port = $parsedSiteUrl['port'] != 80 ? ":" . $parsedSiteUrl['port'] : '';
     $path = !empty($parsedSiteUrl['path']) ? $parsedSiteUrl['path'] : "";
     $cleanUrl = "{$parsedSiteUrl['scheme']}://{$host}{$port}{$path}";
     $url = $cleanUrl . "/index.php?module={$bean->module_dir}&action=DetailView&record={$bean->id}";
     $template->subject = str_replace("\$contact_user", "\$user", $template->subject);
     $template->body_html = str_replace("\$contact_user", "\$user", $template->body_html);
     $template->body = str_replace("\$contact_user", "\$user", $template->body);
     $template->subject = aowTemplateParser::parse_template($template->subject, $object_arr);
     $template->body_html = aowTemplateParser::parse_template($template->body_html, $object_arr);
     $template->body_html = str_replace("\$url", $url, $template->body_html);
     $template->body = aowTemplateParser::parse_template($template->body, $object_arr);
     $template->body = str_replace("\$url", $url, $template->body);
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:52,代码来源:actionSendEmail.php

示例5: array

 function run_action(SugarBean $bean, $params = array(), $in_save = false)
 {
     global $sugar_config, $beanList;
     include_once 'modules/EmailTemplates/EmailTemplate.php';
     require_once 'modules/AOW_Actions/actions/templateParser.php';
     $emailTemp = new EmailTemplate();
     $emailTemp->retrieve($params['email_template']);
     if ($emailTemp->id == '') {
         return false;
     }
     $object_arr[$bean->module_dir] = $bean->id;
     foreach ($bean->field_defs as $bean_arr) {
         if ($bean_arr['type'] == 'relate') {
             if (isset($bean_arr['module']) && $bean_arr['module'] != '' && isset($bean_arr['id_name']) && $bean_arr['id_name'] != '' && $bean_arr['module'] != 'EmailAddress') {
                 $relate_bean = new $beanList[$bean_arr['module']]();
                 if (!isset($object_arr[$relate_bean->module_dir])) {
                     $object_arr[$relate_bean->module_dir] = $bean->{$bean_arr}['id_name'];
                 }
             }
         } else {
             if ($bean_arr['type'] == 'link') {
                 if (!isset($bean_arr['module']) || $bean_arr['module'] == '') {
                     $bean_arr['module'] = getRelatedModule($bean->module_dir, $bean_arr['name']);
                 }
                 if (isset($bean_arr['module']) && $bean_arr['module'] != '' && !isset($object_arr[$bean_arr['module']]) && $bean_arr['module'] != 'EmailAddress') {
                     $linkedBeans = $bean->get_linked_beans($bean_arr['name'], $bean_arr['module']);
                     if ($linkedBeans) {
                         $linkedBean = $linkedBeans[0];
                         if (!isset($object_arr[$linkedBean->module_dir])) {
                             $object_arr[$linkedBean->module_dir] = $linkedBean->id;
                         }
                     }
                 }
             }
         }
     }
     $object_arr['Users'] = $bean->assigned_user_id;
     $parsedSiteUrl = parse_url($sugar_config['site_url']);
     $host = $parsedSiteUrl['host'];
     if (!isset($parsedSiteUrl['port'])) {
         $parsedSiteUrl['port'] = 80;
     }
     $port = $parsedSiteUrl['port'] != 80 ? ":" . $parsedSiteUrl['port'] : '';
     $path = !empty($parsedSiteUrl['path']) ? $parsedSiteUrl['path'] : "";
     $cleanUrl = "{$parsedSiteUrl['scheme']}://{$host}{$port}{$path}";
     $url = $cleanUrl . "/index.php?module={$bean->module_dir}&action=DetailView&record={$bean->id}";
     $subject = str_replace("\$contact_user", "\$user", $emailTemp->subject);
     $body_html = str_replace("\$contact_user", "\$user", $emailTemp->body_html);
     $body_plain = str_replace("\$contact_user", "\$user", $emailTemp->body);
     $subject = aowTemplateParser::parse_template($subject, $object_arr);
     $body_html = aowTemplateParser::parse_template($body_html, $object_arr);
     $body_html = str_replace("\$url", $url, $body_html);
     $body_plain = aowTemplateParser::parse_template($body_plain, $object_arr);
     $body_plain = str_replace("\$url", $url, $body_plain);
     $emails = $this->getEmailsFromParams($bean, $params);
     return $this->sendEmail($emails['to'], $subject, $body_html, $body_plain, $bean, $emails['cc'], $emails['bcc']);
 }
开发者ID:omusico,项目名称:SelkirkCRM,代码行数:57,代码来源:actionSendEmail.php


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