本文整理汇总了PHP中Opportunity::load_relationship方法的典型用法代码示例。如果您正苦于以下问题:PHP Opportunity::load_relationship方法的具体用法?PHP Opportunity::load_relationship怎么用?PHP Opportunity::load_relationship使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Opportunity
的用法示例。
在下文中一共展示了Opportunity::load_relationship方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processListViews
/**
* Add and Remove fields from all the list views
*
* @param array $fieldMap How are we going to change the fields
* @return array The Modules which had their subpanels affected
*/
public function processListViews(array $fieldMap)
{
// get the views for the module
$mm = MetadataManager::getManager();
$views = $mm->getModuleViews('Opportunities');
// fix the selected-list view
$this->processSelectedListView($fieldMap);
// fix the dupecheck-list view
$this->processDupeCheckListView($fieldMap);
// get the generic list view
$this->processListView($fieldMap);
// get the mobile list view now
$this->processMobileListView($fieldMap);
$subpanel_modules = array('Opportunities');
$links = $this->bean->get_linked_fields();
foreach ($links as $link => $def) {
if ($this->bean->load_relationship($link) && $this->bean->{$link} instanceof Link2) {
$linkname = $this->bean->{$link}->getRelatedModuleLinkName();
if (!empty($linkname)) {
$this->processListView($fieldMap, $this->bean->{$link}->getRelatedModuleName(), $linkname);
$subpanel_modules[] = $this->bean->{$link}->getRelatedModuleName();
}
}
}
return $subpanel_modules;
}
示例2: setUp
public function setUp()
{
SugarTestHelper::setUp('beanFiles');
SugarTestHelper::setUp('beanList');
SugarTestHelper::setUp('current_user');
$this->account = SugarTestAccountUtilities::createAccount();
$this->contact = SugarTestContactUtilities::createContact();
$this->email = SugarTestEmailUtilities::createEmail();
$this->opportunity = SugarTestOpportunityUtilities::createOpportunity('', $this->account);
$this->contact->account_id = $this->account->id;
$this->contact->save();
$this->opportunity->load_relationship('contacts');
$this->opportunity->contacts->add($this->contact);
$this->email->parent_id = $this->contact->id;
$this->email->parent_type = $this->contact->module_name;
$this->email->save();
if (isset($GLOBALS['app'])) {
$this->application = $GLOBALS['app'];
}
$GLOBALS['app'] = new SugarApplication();
$GLOBALS['app']->controller = new SugarController();
}
示例3: linkQuoteContactsToOpportunity
/**
* Take any Billing and Shipping Contacts and link the to the Opportunity
*
* @param Quote $quote
* @param Opportunity $opp
*/
protected function linkQuoteContactsToOpportunity(Quote $quote, Opportunity $opp)
{
// @codeCoverageIgnoreStart
global $app_list_strings;
// @codeCoverageIgnoreEnd
//opportunity_relationship_type_dom
$quote->load_relationship('shipping_contacts');
$quote->load_relationship('billing_contacts');
$ids = array_merge($quote->shipping_contacts->get(), $quote->billing_contacts->get());
$ids = array_unique($ids);
$default_role = isset($app_list_strings['opportunity_relationship_type_dom']['Other']) ? 'Other' : '';
if (!empty($ids)) {
$opp->load_relationship('contacts');
foreach ($ids as $id) {
$opp->contacts->add($id, array('contact_role' => $default_role));
}
}
}
示例4: Opportunity
if (empty($contact->last_name)) {
$contact->last_name = $contact_last_name;
}
if (empty($contact->mobile)) {
$contact->mobile = $contact_mobile;
}
if (empty($contact->assigned_user_id)) {
$contact->assigned_user_id = 1;
}
$contact->save();
} else {
$contact->first_name = $contact_first_name;
$contact->last_name = $contact_last_name;
$contact->email1 = $contact_email;
$contact->mobile = $contact_mobile;
$contact->assigned_user_id = 1;
$contact->save();
$contact->load_relationship('accounts');
$contact->accounts->add($account->id);
}
// Create the Opportunity
$opportunity = new Opportunity();
$opportunity->name = $opportunity_name;
$opportunity->amount = $opportunity_amount;
$opportunity->date_closed = $timeDate->getNow(true)->asDbDate();
$opportunity->sales_stage = "Closed Won";
$opportunity->account_id = $account->id;
$opportunity->assigned_user_id = 1;
$opportunity->save();
$opportunity->load_relationship('contacts');
$opportunity->contacts->add($contact->id);