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

PHP SugarBean类代码示例

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

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



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

示例1: get_merge_query

/**
 * Create merge query depending on the modules being merged
 * @param SugarBean $seed Object being queried
 * @param string $merge_module Module being merged
 * @param string $key ID of the record in module being merged
 */
function get_merge_query($seed, $merge_module, $key)
{
    $selQuery = array('Contacts' => array('Accounts' => 'SELECT contacts.first_name, contacts.last_name, contacts.id, contacts.date_entered FROM contacts LEFT JOIN accounts_contacts ON contacts.id=accounts_contacts.contact_id AND (accounts_contacts.deleted is NULL or accounts_contacts.deleted=0)', 'Opportunities' => 'SELECT contacts.first_name, contacts.last_name, contacts.id, contacts.date_entered FROM contacts LEFT JOIN opportunities_contacts ON contacts.id=opportunities_contacts.contact_id AND (opportunities_contacts.deleted is NULL or opportunities_contacts.deleted=0)', 'Cases' => 'SELECT contacts.first_name, contacts.last_name, contacts.id, contacts.date_entered FROM contacts LEFT JOIN contacts_cases ON contacts.id=contacts_cases.contact_id AND (contacts_cases.deleted is NULL or contacts_cases.deleted=0)', 'Bugs' => 'SELECT contacts.first_name, contacts.last_name, contacts.id, contacts.date_entered FROM contacts LEFT JOIN contacts_bugs ON contacts.id=contacts_bugs.contact_id AND (contacts_bugs.deleted is NULL or contacts_bugs.deleted=0)', 'Quotes' => 'SELECT contacts.first_name, contacts.last_name, contacts.id, contacts.date_entered FROM contacts LEFT JOIN quotes_contacts ON contacts.id=quotes_contacts.contact_id AND (quotes_contacts.deleted is NULL or quotes_contacts.deleted=0)'), 'Opportunities' => array("Accounts" => 'SELECT opportunities.id, opportunities.name FROM opportunities LEFT JOIN accounts_opportunities ON opportunities.id = accounts_opportunities.opportunity_id AND (accounts_opportunities.deleted is NULL or accounts_opportunities.deleted=0)'), 'Accounts' => array("Opportunities" => 'SELECT accounts.id, accounts.name FROM accounts LEFT JOIN accounts_opportunities ON accounts.id = accounts_opportunities.account_id AND (accounts_opportunities.deleted is NULL or accounts_opportunities.deleted=0)'));
    $whereQuery = array('Contacts' => array('Accounts' => 'accounts_contacts.contact_id = contacts.id AND accounts_contacts.account_id = ', 'Opportunities' => 'opportunities_contacts.contact_id = contacts.id AND opportunities_contacts.opportunity_id = ', 'Cases' => 'contacts_cases.contact_id = contacts.id AND contacts_cases.case_id = ', 'Bugs' => 'contacts_bugs.contact_id = contacts.id AND contacts_bugs.bug_id = ', 'Quotes' => 'quotes_contacts.contact_id = contacts.id AND quotes_contacts.quote_id = '), 'Opportunities' => array('Accounts' => 'accounts_opportunities.opportunity_id = opportunities.id AND accounts_opportunities.account_id = '), 'Accounts' => array('Opportunities' => 'accounts_opportunities.account_id = accounts.id  AND accounts_opportunities.opportunity_id = '));
    $relModule = $seed->module_dir;
    $select = "";
    if (!empty($selQuery[$relModule][$merge_module])) {
        $select = $selQuery[$relModule][$merge_module];
    } else {
        $lowerRelModule = strtolower($relModule);
        if ($seed->load_relationship($lowerRelModule)) {
            $params = array('join_table_alias' => 'r1', 'join_table_link_alias' => 'r2', 'join_type' => 'LEFT JOIN');
            $join = $seed->{$lowerRelModule}->getJoin($params);
            $select = "SELECT {$seed->table_name}.* FROM {$seed->table_name} {$join}";
        }
    }
    if (empty($select)) {
        $select = "SELECT contacts.first_name, contacts.last_name, contacts.id, contacts.date_entered FROM contacts";
    }
    if (empty($whereQuery[$relModule][$merge_module])) {
        $select .= " WHERE {$seed->table_name}.id = '{$seed->db->quote($key)}'";
    } else {
        $select .= " WHERE " . $whereQuery[$relModule][$merge_module] . "'{$seed->db->quote($key)}'";
    }
    $select .= " ORDER BY {$seed->table_name}.date_entered";
    return $select;
}
开发者ID:omusico,项目名称:sugar_work,代码行数:33,代码来源:merge_query.php


示例2: isPortalOwner

 /**
  * Determines if a portal user "owns" a record
  * @param SugarBean $bean
  */
 protected function isPortalOwner(SugarBean $bean)
 {
     if (empty($bean->id) || $bean->new_with_id) {
         // New record, they are the owner.
         $bean->portal_owner = true;
     }
     // Cache portal owner on bean so that we aren't loading Contacts for each ACL check
     // Performance Bug58133
     if (!isset($bean->portal_owner)) {
         switch ($bean->module_dir) {
             case 'Contacts':
                 $bean->portal_owner = $bean->id == $_SESSION['contact_id'];
                 break;
                 // Cases & Bugs work the same way, so handily enough we can share the code.
             // Cases & Bugs work the same way, so handily enough we can share the code.
             case 'Cases':
             case 'Bugs':
                 $bean->load_relationship('contacts');
                 $rows = $bean->contacts->query(array('where' => array('lhs_field' => 'id', 'operator' => '=', 'rhs_value' => $GLOBALS['db']->quote($_SESSION['contact_id']))));
                 $bean->portal_owner = count($rows) > 0;
                 break;
             default:
                 // Unless we know how to find the "owner", they can't own it.
                 $bean->portal_owner = false;
         }
     }
     return $bean->portal_owner;
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:32,代码来源:SugarACLSupportPortal.php


示例3: get_message_scope_dom

function get_message_scope_dom($campaign_id, $campaign_name, $db = null, $mod_strings = array())
{
    //find prospect list attached to this campaign..
    $query = "SELECT prospect_list_id, prospect_lists.name ";
    $query .= "FROM prospect_list_campaigns ";
    $query .= "INNER join prospect_lists on prospect_lists.id = prospect_list_campaigns.prospect_list_id ";
    // We need to confirm that the user is a member of the team of the item.
    $bean = new SugarBean();
    $bean->disable_row_level_security = false;
    $bean->add_team_security_where_clause($query, "prospect_lists");
    $query .= "WHERE prospect_lists.deleted = 0 ";
    $query .= "AND prospect_list_campaigns.deleted=0 ";
    $query .= "AND campaign_id='" . $campaign_id . "'";
    $query .= " and prospect_lists.list_type not like 'exempt%'";
    if (empty($db)) {
        $db = DBManagerFactory::getInstance();
    }
    if (empty($mod_strings) or !isset($mod_strings['LBL_DEFAULT'])) {
        global $current_language;
        $mod_strings = return_module_language($current_language, 'Campaigns');
    }
    //add campaign to the result array.
    //$return_array[$campaign_id]= $campaign_name . ' (' . $mod_strings['LBL_DEFAULT'] . ')';
    $result = $db->query($query);
    while (($row = $db->fetchByAssoc($result)) != null) {
        $return_array[$row['prospect_list_id']] = $row['name'];
    }
    if (empty($return_array)) {
        $return_array = array();
    } else {
        return $return_array;
    }
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:33,代码来源:utils.php


示例4: build_related_list_by_user_id

/**
 * @param SugarBean $bean
 * @param string $user_id
 * @param string $where
 *
 * @return array
 */
function build_related_list_by_user_id($bean, $user_id, $where)
{
    $bean_id_name = strtolower($bean->object_name) . '_id';
    $select = "SELECT {$bean->table_name}.* from {$bean->rel_users_table},{$bean->table_name} ";
    $auto_where = ' WHERE ';
    if (!empty($where)) {
        $auto_where .= $where . ' AND ';
    }
    $auto_where .= " {$bean->rel_users_table}.{$bean_id_name}={$bean->table_name}.id AND {$bean->rel_users_table}.user_id='{$user_id}' AND {$bean->table_name}.deleted=0 AND {$bean->rel_users_table}.deleted=0";
    $query = $select . $auto_where;
    $result = $bean->db->query($query, true);
    $list = [];
    while ($row = $bean->db->fetchByAssoc($result)) {
        $row = $bean->convertRow($row);
        $bean->fetched_row = $row;
        $bean->fromArray($row);
        $bean->processed_dates_times = [];
        $bean->check_date_relationships_load();
        $bean->fill_in_additional_detail_fields();
        /**
         * PHP  5+ always treats objects as passed by reference
         * Need to clone it if we're using 5.0+
         * clone() not supported by 4.x
         */
        if (version_compare(phpversion(), "5.0", ">=")) {
            $newBean = clone $bean;
        } else {
            $newBean = $bean;
        }
        $list[] = $newBean;
    }
    return $list;
}
开发者ID:butschster,项目名称:sugarcrm_dev,代码行数:40,代码来源:activity_utils.php


示例5: testIsOwner

 /**
  * Test asserts that fetched row has more priority then property
  *
  * @group 60442
  * @return void
  */
 public function testIsOwner()
 {
     $bean = new SugarBean();
     $bean->id = create_guid();
     $bean->fetched_row['assigned_user_id'] = 1;
     $bean->assigned_user_id = 2;
     $this->assertTrue($bean->isOwner(1), 'Incorrect ownership');
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:14,代码来源:Bug60442Test.php


示例6: add

 /**
  * @param SugarBean $lhs              SugarBean left side bean to add to the relationship.
  * @param SugarBean $rhs              SugarBean right side bean to add to the relationship.
  * @param array     $additionalFields key=>value pairs of fields to save on the relationship
  *
  * @return bool true if successful
  */
 public function add($lhs, $rhs, $additionalFields = [])
 {
     $lhsLinkName = $this->lhsLink;
     //In a one to one, any existing links from both sides must be removed first.
     //one2Many will take care of the right side, so we'll do the left.
     $lhs->load_relationship($lhsLinkName);
     $this->removeAll($lhs->{$lhsLinkName});
     return parent::add($lhs, $rhs, $additionalFields);
 }
开发者ID:butschster,项目名称:sugarcrm_dev,代码行数:16,代码来源:One2OneBeanRelationship.php


示例7: testChangingOfRelation

 /**
  * Test tries to emulate changing of related field and assert correct result
  *
  * @group 44930
  * @return void
  */
 public function testChangingOfRelation()
 {
     $_REQUEST['relate_id'] = '2';
     $_REQUEST['relate_to'] = 'test';
     $bean = new SugarBean();
     $bean->id = '1';
     $bean->test_id = '3';
     $bean->field_defs = array('test' => array('type' => 'link', 'relationship' => 'test', 'link_file' => 'data/SugarBean.php', 'link_class' => 'Link44930'));
     $bean->relationship_fields = array('test_id' => 'test');
     $bean->save_relationship_changes(true);
     $this->assertEquals($bean->test_id, $bean->test->lastCall, 'Last relation should point to test_id instead of relate_id');
 }
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:18,代码来源:Bug44930Test.php


示例8: trackView

 /**
  * Track a view for a particular bean.
  *
  * @param SugarBean $seed
  * @param string $current_view
  */
 function trackView($seed, $current_view)
 {
     $trackerManager = TrackerManager::getInstance();
     if ($monitor = $trackerManager->getMonitor('tracker')) {
         $monitor->setValue('date_modified', TimeDate::getInstance()->nowDb());
         $monitor->setValue('user_id', $GLOBALS['current_user']->id);
         $monitor->setValue('module_name', $seed->module_dir);
         $monitor->setValue('action', $current_view);
         $monitor->setValue('item_id', $seed->id);
         $monitor->setValue('item_summary', $seed->get_summary_text());
         $monitor->setValue('visible', true);
         $trackerManager->saveMonitor($monitor, TRUE, TRUE);
     }
 }
开发者ID:butschster,项目名称:sugarcrm_dev,代码行数:20,代码来源:SugarWebServiceUtilv3_1.php


示例9: apiFormatField

 /**
  * {@inheritDoc}
  */
 public function apiFormatField(array &$data, SugarBean $bean, array $args, $fieldName, $properties, array $fieldList = null, ServiceBase $service = null)
 {
     $this->ensureApiFormatFieldArguments($fieldList, $service);
     // this is only for generated links
     if (isset($bean->field_defs[$fieldName]['gen']) && isTruthy($bean->field_defs[$fieldName]['gen'])) {
         $subject = $bean->field_defs[$fieldName]['default'];
         if (!empty($subject)) {
             $data[$fieldName] = replace_sugar_vars($subject, $bean->toArray(), true);
         } else {
             $data[$fieldName] = "";
         }
     } else {
         parent::apiFormatField($data, $bean, $args, $fieldName, $properties, $fieldList, $service);
     }
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:18,代码来源:SugarFieldLink.php


示例10: getRelatedFields

 /**
  * This function is used to popluate an fields on the relationship from the request
  *
  * @param $api ServiceBase The API class of the request, used in cases where the API changes how security is applied
  * @param $args array The arguments array passed in from the API
  * @param $primaryBean SugarBean The near side of the link
  * @param $linkName string What is the name of the link field that you want to get the related fields for
  *
  * @return array A list of the related fields pulled out of the $args array
  */
 protected function getRelatedFields(ServiceBase $api, $args, SugarBean $primaryBean, $linkName, $seed = null)
 {
     $relatedData = array();
     if (!empty($primaryBean->{$linkName}) || $primaryBean->load_relationship($linkName)) {
         $otherLink = $primaryBean->{$linkName}->getLinkForOtherSide();
         if ($seed instanceof SugarBean) {
             foreach ($args as $field => $value) {
                 if (empty($seed->field_defs[$field]['rname_link']) || empty($seed->field_defs[$field]['link']) || $seed->field_defs[$field]['link'] != $otherLink) {
                     continue;
                 }
                 $relatedData[$seed->field_defs[$field]['rname_link']] = $value;
             }
         }
     }
     return $relatedData;
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:26,代码来源:RelateRecordApi.php


示例11: remove

 /**
  * @param SugarBean $lhs
  * @param SugarBean $rhs
  *
  * @return bool
  */
 public function remove($lhs, $rhs)
 {
     $lhsLinkName = $this->lhsLink;
     if (!$lhs instanceof SugarBean) {
         Log::fatal("LHS is not a SugarBean object");
         return false;
     }
     if (!$rhs instanceof SugarBean) {
         Log::fatal("RHS is not a SugarBean object");
         return false;
     }
     if (empty($lhs->{$lhsLinkName}) && !$lhs->load_relationship($lhsLinkName)) {
         Log::fatal("could not load LHS {$lhsLinkName}");
         return false;
     }
     if (empty($_SESSION['disable_workflow']) || $_SESSION['disable_workflow'] != "Yes") {
         if (!empty($lhs->{$lhsLinkName})) {
             $lhs->{$lhsLinkName}->load();
             $this->callBeforeDelete($lhs, $rhs, $lhsLinkName);
         }
     }
     $dataToRemove = [$this->def['join_key_lhs'] => $lhs->id, $this->def['join_key_rhs'] => $rhs->id];
     $this->removeRow($dataToRemove);
     if ($this->self_referencing) {
         $this->removeSelfReferencing($lhs, $rhs);
     }
     if (empty($_SESSION['disable_workflow']) || $_SESSION['disable_workflow'] != "Yes") {
         if (!empty($lhs->{$lhsLinkName})) {
             $lhs->{$lhsLinkName}->load();
             $this->callAfterDelete($lhs, $rhs, $lhsLinkName);
         }
     }
     return true;
 }
开发者ID:butschster,项目名称:sugarcrm_dev,代码行数:40,代码来源:EmailAddressRelationship.php


示例12: compileFrom

 /**
  * Create a from statement
  *
  * @param SugarBean|array $bean
  * @return string
  */
 protected function compileFrom($bean)
 {
     $alias = "";
     $return = array();
     if (is_array($bean)) {
         list($bean, $alias) = $bean;
         $this->from_alias = $alias;
     }
     $this->from_bean = $bean;
     $table = $bean->getTableName();
     $table_cstm = '';
     $from_clause = "{$table}";
     if (!empty($alias)) {
         $from_clause .= " {$alias}";
     }
     //SugarQuery will determine if we actually need to add the table or not.
     $this->sugar_query->joinCustomTable($bean, $alias);
     if (!empty($this->from_alias)) {
         $this->primary_table = $this->from_alias;
         $this->primary_custom_table = $this->from_alias . '_c';
     } else {
         $this->primary_table = $this->from_bean->getTableName();
         $this->primary_custom_table = $this->from_bean->get_custom_table_name();
     }
     $return = $from_clause;
     return $return;
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:33,代码来源:SQL.php


示例13: Worksheets

 function Worksheets()
 {
     $this->worksheet_tour_id = $id;
     global $sugar_config;
     $noidung = new stdClass();
     parent::SugarBean();
 }
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:7,代码来源:Worksheets.php


示例14: UserSignature

 function UserSignature()
 {
     //Ensure the vardefs get loaded.
     global $dictionary;
     require_once "metadata/users_signaturesMetaData.php";
     parent::SugarBean();
 }
开发者ID:klr2003,项目名称:sourceread,代码行数:7,代码来源:UserSignature.php


示例15: save

 function save($id = '', $module = '', $new_addrs = array(), $primary = '', $replyTo = '', $invalid = '', $optOut = '', $in_workflow = false)
 {
     if (func_num_args() > 1) {
         parent::save($id, $module, $new_addrs, $primary, $replyTo, $invalid, $optOut, $in_workflow);
     } else {
         SugarBean::save($id);
     }
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:8,代码来源:EmailAddress.php


示例16: updateBean

 /**
  * Fetches data from the $args array and updates the bean with that data
  * @param $bean SugarBean The bean to be updated
  * @param $api ServiceBase The API class of the request, used in cases where the API changes how the fields are pulled from the args array.
  * @param $args array The arguments array passed in from the API
  * @return id Bean id
  */
 protected function updateBean(SugarBean $bean, ServiceBase $api, $args)
 {
     // Bug 54515: Set modified by and created by users to assigned to user. If not set default to admin.
     $bean->update_modified_by = false;
     $bean->set_created_by = false;
     $admin = Administration::getSettings();
     if (isset($admin->settings['supportPortal_RegCreatedBy']) && !empty($admin->settings['supportPortal_RegCreatedBy'])) {
         $bean->created_by = $admin->settings['supportPortal_RegCreatedBy'];
         $bean->modified_user_id = $admin->settings['supportPortal_RegCreatedBy'];
     } else {
         $bean->created_by = '1';
         $bean->modified_user_id = '1';
     }
     // Bug 54516 users not getting notified on new record creation
     $bean->save(true);
     return parent::updateBean($bean, $api, $args);
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:24,代码来源:RegisterLeadApi.php


示例17: __construct

 public function __construct($name, $vardefs)
 {
     global $dictionary;
     $this->object_name = $name;
     $this->table_name = $name;
     $dictionary[$this->object_name] = $vardefs;
     parent::SugarBean();
 }
开发者ID:netconstructor,项目名称:sugarcrm_dev,代码行数:8,代码来源:TestBean.php


示例18: testGetUnionRelatedList

 public function testGetUnionRelatedList()
 {
     $subpanel = array('order' => 20, 'sort_order' => 'desc', 'sort_by' => 'date_entered', 'type' => 'collection', 'subpanel_name' => 'history', 'top_buttons' => array(), 'collection_list' => array('meetings' => array('module' => 'Meetings', 'subpanel_name' => 'ForHistory', 'get_subpanel_data' => 'meetings'), 'emails' => array('module' => 'Emails', 'subpanel_name' => 'ForHistory', 'get_subpanel_data' => 'emails', 'get_distinct_data' => true), 'linkedemails_contacts' => array('module' => 'Emails', 'subpanel_name' => 'ForHistory', 'generate_select' => true, 'get_distinct_data' => true, 'get_subpanel_data' => 'function:GetUnionRelatedTest_get_select', 'function_parameters' => array('import_function_file' => __FILE__))));
     $subpanel_def = new aSubPanel("testpanel", $subpanel, $this->bean);
     $query = $this->bean->get_union_related_list($this->bean, "", '', "", 0, 5, -1, 0, $subpanel_def);
     $result = $this->bean->db->query($query["query"]);
     $this->assertNotEmpty($result, "Bad query: {$query["query"]}");
 }
开发者ID:thsonvt,项目名称:sugarcrm_dev,代码行数:8,代码来源:GetUnionRelatedTest.php


示例19:

 function __construct()
 {
     parent::__construct();
     $this->db = DBManagerFactory::getInstance();
     $this->dbManager = DBManagerFactory::getInstance();
     $this->disable_row_level_security = true;
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:7,代码来源:ContactOpportunityRelationship.php


示例20: __construct

 public function __construct()
 {
     parent::__construct();
     $this->team_id = 1;
     // make the item globally accessible
     $this->disable_row_level_security = true;
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:7,代码来源:Version.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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