本文整理汇总了PHP中Contact::retrieve方法的典型用法代码示例。如果您正苦于以下问题:PHP Contact::retrieve方法的具体用法?PHP Contact::retrieve怎么用?PHP Contact::retrieve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Contact
的用法示例。
在下文中一共展示了Contact::retrieve方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
function get_notification_recipients() {
if($this->special_notification) {
return parent::get_notification_recipients();
}
// $GLOBALS['log']->debug('Call.php->get_notification_recipients():'.print_r($this,true));
$list = array();
if(!is_array($this->contacts_arr)) {
$this->contacts_arr = array();
}
if(!is_array($this->users_arr)) {
$this->users_arr = array();
}
if(!is_array($this->leads_arr)) {
$this->leads_arr = array();
}
foreach($this->users_arr as $user_id) {
$notify_user = new User();
$notify_user->retrieve($user_id);
$notify_user->new_assigned_user_name = $notify_user->full_name;
$GLOBALS['log']->info("Notifications: recipient is $notify_user->new_assigned_user_name");
$list[$notify_user->id] = $notify_user;
}
foreach($this->contacts_arr as $contact_id) {
$notify_user = new Contact();
$notify_user->retrieve($contact_id);
$notify_user->new_assigned_user_name = $notify_user->full_name;
$GLOBALS['log']->info("Notifications: recipient is $notify_user->new_assigned_user_name");
$list[$notify_user->id] = $notify_user;
}
foreach($this->leads_arr as $lead_id) {
$notify_user = new Lead();
$notify_user->retrieve($lead_id);
$notify_user->new_assigned_user_name = $notify_user->full_name;
$GLOBALS['log']->info("Notifications: recipient is $notify_user->new_assigned_user_name");
$list[$notify_user->id] = $notify_user;
}
global $sugar_config;
if(isset($sugar_config['disable_notify_current_user']) && $sugar_config['disable_notify_current_user']) {
global $current_user;
if(isset($list[$current_user->id]))
unset($list[$current_user->id]);
}
// $GLOBALS['log']->debug('Call.php->get_notification_recipients():'.print_r($list,true));
return $list;
}
示例2: getRecipients
/**
* get recipients of reminding email for specific activity
* @param string $id
* @param string $module
* @return array
*/
protected function getRecipients($id, $module = "Meetings")
{
global $db;
switch ($module) {
case "Meetings":
$field_part = "meeting";
break;
case "Calls":
$field_part = "call";
break;
default:
return array();
}
$emails = array();
// fetch users
$query = "SELECT user_id FROM {$field_part}s_users WHERE {$field_part}_id = '{$id}' AND accept_status != 'decline' AND deleted = 0\n ";
$re = $db->query($query);
while ($row = $db->fetchByAssoc($re)) {
$user = new User();
$user->retrieve($row['user_id']);
if (!empty($user->email1)) {
$arr = array('type' => 'Users', 'name' => $user->full_name, 'email' => $user->email1);
$emails[] = $arr;
}
}
// fetch contacts
$query = "SELECT contact_id FROM {$field_part}s_contacts WHERE {$field_part}_id = '{$id}' AND accept_status != 'decline' AND deleted = 0";
$re = $db->query($query);
while ($row = $db->fetchByAssoc($re)) {
$contact = new Contact();
$contact->retrieve($row['contact_id']);
if (!empty($contact->email1)) {
$arr = array('type' => 'Contacts', 'name' => $contact->full_name, 'email' => $contact->email1);
$emails[] = $arr;
}
}
// fetch leads
$query = "SELECT lead_id FROM {$field_part}s_leads WHERE {$field_part}_id = '{$id}' AND accept_status != 'decline' AND deleted = 0";
$re = $db->query($query);
while ($row = $db->fetchByAssoc($re)) {
$lead = new Lead();
$lead->retrieve($row['lead_id']);
if (!empty($lead->email1)) {
$arr = array('type' => 'Leads', 'name' => $lead->full_name, 'email' => $lead->email1);
$emails[] = $arr;
}
}
return $emails;
}
示例3: Contact
function update_tilkee_tilk(&$bean, $event, $arguments = null)
{
if ($event != 'before_save') {
return;
}
global $beanFiles;
$tilk_name = '[TILK] ';
// Email initialisation
if ($bean->contacts_id != '') {
require_once $beanFiles['Contact'];
$the_contact = new Contact();
$the_contact->retrieve($bean->contacts_id);
$bean->contact_email = $the_contact->emailAddress->getPrimaryAddress($the_contact);
$bean->name = $tilk_name . $the_contact->name;
}
if ($bean->leads_id != '') {
require_once $beanFiles['Lead'];
$the_lead = new Lead();
$the_lead->retrieve($bean->leads_id);
$bean->contact_email = $the_lead->emailAddress->getPrimaryAddress($the_lead);
$bean->name = $tilk_name . $the_lead->name;
}
// delete URL if tilk is archived
if ($bean->archived == 'true') {
$bean->tilk_url = '';
}
}
示例4: execute
function execute(&$bean)
{
if ($bean->sales_stage == "completed") {
$realty_list = $bean->get_linked_beans("realty_opportunities", "Realty");
if (!empty($bean->contact_id)) {
$contact = new Contact();
$contact->retrieve($bean->contact_id);
foreach ($realty_list as $realty) {
if ($realty->operation == 'rent') {
$contact->load_relationship("realty_contacts_rent");
$contact->realty_contacts_rent->add($realty->id);
} elseif ($realty->operation == 'buying') {
$contact->load_relationship("realty_contacts_buying");
$contact->realty_contacts_buying->add($realty->id);
}
}
}
if (!empty($bean->account_id)) {
$account = new Account();
$account->retrieve($bean->account_id);
foreach ($realty_list as $realty) {
if ($realty->operation == 'rent') {
$account->load_relationship("realty_accounts_rent");
$account->realty_accounts_rent->add($realty->id);
} elseif ($realty->operation == 'buying') {
$account->load_relationship("realty_accounts_buying");
$account->realty_accounts_buying->add($realty->id);
}
}
}
}
}
示例5: testConvertLinkingExistingContact
/**
* Create a lead and convert it to an existing Account and Contact
*/
public function testConvertLinkingExistingContact()
{
// Create records
$lead = SugarTestLeadUtilities::createLead();
$account = SugarTestAccountUtilities::createAccount();
$contact = SugarTestContactUtilities::createContact();
// ConvertLead to an existing Contact and Account
$_REQUEST = array('module' => 'Leads', 'record' => $lead->id, 'isDuplicate' => 'false', 'action' => 'ConvertLead', 'convert_create_Contacts' => 'false', 'report_to_name' => $contact->name, 'reports_to_id' => $contact->id, 'convert_create_Accounts' => 'false', 'account_name' => $account->name, 'account_id' => $account->id, 'handle' => 'save');
// Call display to trigger conversion
$vc = new ViewConvertLead();
$vc->display();
// Refresh Lead
$leadId = $lead->id;
$lead = new Lead();
$lead->retrieve($leadId);
// Refresh Contact
$contactId = $contact->id;
$contact = new Contact();
$contact->retrieve($contactId);
// Check if contact it's linked properly
$this->assertEquals($contact->id, $lead->contact_id, 'Contact not linked with Lead successfully.');
// Check if account is linked with lead properly
$this->assertEquals($account->id, $lead->account_id, 'Account not linked with Lead successfully.');
// Check if account is linked with contact properly
$this->assertEquals($account->id, $contact->account_id, 'Account not linked with Contact successfully.');
// Check Lead Status, should be converted
$this->assertEquals('Converted', $lead->status, "Lead status should be 'Converted'.");
}
示例6: Contact
function Request_sugar()
{
parent::Basic();
$cont = new Contact();
$cont->retrieve('f0552f45-5d45-b8cd-b32c-521730a146f2');
/*$rabbit = new SugarRabbit();
$rabbit->CreateContact($cont);*/
}
示例7: Email
function send_email($module, $module_type, $printable, $file_name, $attach)
{
require_once 'modules/Emails/Email.php';
global $current_user, $mod_strings, $sugar_config;
//First Create e-mail draft
$email = new Email();
// set the id for relationships
$email->id = create_guid();
$email->new_with_id = true;
//subject
$email->name = $mod_strings['LBL_EMAIL_NAME'] . ' ' . $module->name;
//body
$email->description_html = $printable;
//type is draft
$email->type = "draft";
$email->status = "draft";
if (!empty($module->billing_contact_id) && $module->billing_contact_id != "") {
require_once 'modules/Contacts/Contact.php';
$contact = new Contact();
$contact->retrieve($module->billing_contact_id);
$email->parent_type = 'Contacts';
$email->parent_id = $contact->id;
if (!empty($contact->email1)) {
$email->to_addrs_emails = $contact->email1 . ";";
$email->to_addrs = $module->billing_contact_name . " <" . $contact->email1 . ">";
}
}
//team id
$email->team_id = $current_user->default_team;
//assigned_user_id
$email->assigned_user_id = $current_user->id;
//Save the email object
global $timedate;
$email->date_start = $timedate->to_display_date_time(gmdate($GLOBALS['timedate']->get_db_date_time_format()));
$email->save(FALSE);
$email_id = $email->id;
if ($attach) {
$note = new Note();
$note->modified_user_id = $current_user->id;
$note->created_by = $current_user->id;
$note->name = $file_name;
$note->parent_type = 'Emails';
$note->parent_id = $email_id;
$note->file_mime_type = 'application/pdf';
$note->filename = $file_name;
$note->save();
rename($sugar_config['upload_dir'] . 'attachfile.pdf', $sugar_config['upload_dir'] . $note->id);
}
//redirect
if ($email_id == "") {
echo "Unable to initiate Email Client";
exit;
} else {
header("Location: index.php?action=Compose&module=Emails&return_module=" . $module_type . "&return_action=DetailView&return_id=" . $_REQUEST['record'] . "&recordId=" . $email_id);
}
}
示例8: display
function display()
{
global $mod_strings, $app_strings, $app_list_strings, $sugar_config, $beanFiles;
$this->ss->assign("MOD", $mod_strings);
$this->ss->assign("APP_LIST", $app_list_strings);
// Init default name
$this->bean->name = '[TILK] ';
// IF THE TILK IS CREATED FROM AN CONTACT
if (isset($_REQUEST['CreateFromContact']) && $_REQUEST['CreateFromContact'] == 'true') {
// CREATE DEFAULT TILK LINK WITH CONTACT
require_once $beanFiles['Contact'];
$link_contact = new Contact();
$link_contact->retrieve($_REQUEST['return_id']);
$this->bean->contacts_id = $link_contact->id;
$this->bean->contacts_name = $link_contact->name;
$this->bean->contact_email = $link_contact->emailAddress->getPrimaryAddress($link_contact);
$this->bean->name = '[TILK] ' . $link_contact->name;
//$this->bean->id = $this->bean->save();
$_REQUEST['record'] = $this->bean->id;
// TILKEE API - CREATE PROJECT AND SYNCH IT
}
// IF THE TILK IS CREATED FROM AN LEAD
if (isset($_REQUEST['CreateFromLead']) && $_REQUEST['CreateFromLead'] == 'true') {
// CREATE DEFAULT TILK LINK WITH LEAD
require_once $beanFiles['Lead'];
$link_lead = new Lead();
$link_lead->retrieve($_REQUEST['return_id']);
$this->bean->leads_name = $link_lead->name;
$this->bean->leads_id = $link_lead->id;
$this->bean->contact_email = $link_lead->emailAddress->getPrimaryAddress($link_lead);
$this->bean->name = '[TILK] ' . $link_lead->name;
//$this->bean->id = $this->bean->save();
$_REQUEST['record'] = $this->bean->id;
// TILKEE API - CREATE PROJECT AND SYNCH IT
}
// IF THE TILK IS CREATED FROM AN PROJECT
if (isset($_REQUEST['CreateFromProject']) && $_REQUEST['CreateFromProject'] == 'true') {
// CREATE DEFAULT TILK LINK WITH PROJECT
require_once $beanFiles['TILKEE_PROJECTS'];
$link_tilkee_project = new TILKEE_PROJECTS();
$link_tilkee_project->retrieve($_REQUEST['return_id']);
$this->bean->tilkee_projects_name = $link_tilkee_project->name;
$this->bean->tilkee_projects_id = $link_tilkee_project->id;
//$this->bean->id = $this->bean->save();
$_REQUEST['record'] = $this->bean->id;
// TILKEE API - CREATE PROJECT AND SYNCH IT
}
parent::display();
}
示例9: testImportedVcardAccountLink
/**
* @group bug40629
*/
public function testImportedVcardAccountLink()
{
$filename = dirname(__FILE__) . "/SimpleVCard.vcf";
$vcard = new vCard();
$contact_id = $vcard->importVCard($filename, 'Contacts');
$contact_record = new Contact();
$contact_record->retrieve($contact_id);
$this->assertFalse(empty($contact_record->account_id), "Contact should have an account record associated");
$GLOBALS['db']->query("delete from contacts where id = '{$contact_id}'");
$vcard = new vCard();
$lead_id = $vcard->importVCard($filename, 'Leads');
$lead_record = new Lead();
$lead_record->retrieve($lead_id);
$this->assertTrue(empty($lead_record->account_id), "Lead should not have an account record associated");
$GLOBALS['db']->query("delete from leads where id = '{$lead_id}'");
}
示例10: loadRel
function loadRel($module, $module_id, $linked_module_id)
{
if ($module == 'Accounts') {
$Accounts = new Account();
$Accounts->retrieve($linked_module_id);
$Accounts->load_relationships('realty_accounts_interest');
$Accounts->realty_accounts_interest->add($module_id);
} elseif ($module == 'Contacts') {
$Contacts = new Contact();
$Contacts->retrieve($linked_module_id);
$Contacts->load_relationships('realty_contacts_interest');
$Contacts->realty_contacts_interest->add($module_id);
} elseif ($module == 'Request') {
$Request = new Request();
$Request->retrieve($linked_module_id);
$Request->load_relationships('realty_requests_interest');
$Request->realty_requests_interest->add($module_id);
}
}
示例11: Contact
function action_editview()
{
global $mod_string;
$this->view = 'edit';
$GLOBALS['view'] = $this->view;
if (isset($_REQUEST['aos_quotes_id'])) {
$query = "SELECT * FROM aos_quotes WHERE id = '{$_REQUEST['aos_quotes_id']}'";
$result = $this->bean->db->query($query, true);
$row = $this->bean->db->fetchByAssoc($result);
$this->bean->name = $row['name'];
$this->bean->total_contract_value = $row['total_amount'];
if (isset($row['billing_account_id'])) {
$_REQUEST['account_id'] = $row['billing_account_id'];
}
if (isset($row['billing_contact_id'])) {
$_REQUEST['contact_id'] = $row['billing_contact_id'];
}
if (isset($row['opportunity_id'])) {
$_REQUEST['opportunity_id'] = $row['opportunity_id'];
}
}
if (isset($_REQUEST['account_id'])) {
$query = "SELECT id,name FROM accounts WHERE id = '{$_REQUEST['account_id']}'";
$result = $this->bean->db->query($query, true);
$row = $this->bean->db->fetchByAssoc($result);
$this->bean->contract_account = $row['name'];
$this->bean->contract_account_id = $row['id'];
}
if (isset($_REQUEST['contact_id'])) {
$contact = new Contact();
$contact->retrieve($_REQUEST['contact_id']);
$this->bean->contact = $contact->name;
$this->bean->contact_id = $contact->id;
}
if (isset($_REQUEST['opportunity_id'])) {
$query = "SELECT id,name FROM opportunities WHERE id = '{$_REQUEST['opportunity_id']}'";
$result = $this->bean->db->query($query, true);
$row = $this->bean->db->fetchByAssoc($result);
$this->bean->opportunity = $row['name'];
$this->bean->opportunity_id = $row['id'];
}
}
示例12: Email
//First Create e-mail draft
$email = new Email();
// set the id for relationships
$email->id = create_guid();
$email->new_with_id = true;
//subject
$email->name = "Quote For " . $quote->name . "";
//body
$email->description_html = $printable;
//type is draft
$email->type = "draft";
$email->status = "draft";
if (!empty($quote->billing_contact_id) && $quote->billing_contact_id != "") {
require_once 'modules/Contacts/Contact.php';
$contact = new Contact();
$contact->retrieve($quote->billing_contact_id);
if (!empty($contact->email1)) {
$email->to_addrs_emails = $contact->email1 . ";";
$email->to_addrs = $quote->billing_contact_name . " <" . $contact->email1 . ">";
}
}
//team id
$email->team_id = $current_user->default_team;
//assigned_user_id
$email->assigned_user_id = $current_user->id;
//Save the email object
global $timedate;
$email->date_start = $timedate->to_display_date_time(gmdate($GLOBALS['timedate']->get_db_date_time_format()));
$email->save(FALSE);
$email_id = $email->id;
//redirect
示例13: Contact
function fill_in_additional_detail_fields()
{
global $app_list_strings, $mod_strings;
// Fill in the assigned_user_name
$this->assigned_user_name = get_assigned_user_name($this->assigned_user_id, '');
//if ($this->parent_type == 'Contacts') {
$query = "SELECT contacts.first_name, contacts.last_name, contacts.phone_work, contacts.id, contacts.assigned_user_id contact_name_owner, 'Contacts' contact_name_mod FROM contacts, emails_beans ";
$query .= "WHERE emails_beans.email_id='{$this->id}' AND emails_beans.bean_id=contacts.id AND emails_beans.bean_module = 'Contacts' AND emails_beans.deleted=0 AND contacts.deleted=0";
if (!empty($this->parent_id)) {
$query .= " AND contacts.id= '" . $this->parent_id . "' ";
} else {
if (!empty($_REQUEST['record'])) {
$query .= " AND contacts.id= '" . $_REQUEST['record'] . "' ";
}
}
$result = $this->db->query($query, true, " Error filling in additional detail fields: ");
// Get the id and the name.
$row = $this->db->fetchByAssoc($result);
if ($row != null) {
$contact = new Contact();
$contact->retrieve($row['id']);
$this->contact_name = $contact->full_name;
$this->contact_phone = $row['phone_work'];
$this->contact_id = $row['id'];
$this->contact_email = $contact->emailAddress->getPrimaryAddress($contact);
$this->contact_name_owner = $row['contact_name_owner'];
$this->contact_name_mod = $row['contact_name_mod'];
$GLOBALS['log']->debug("Call({$this->id}): contact_name = {$this->contact_name}");
$GLOBALS['log']->debug("Call({$this->id}): contact_phone = {$this->contact_phone}");
$GLOBALS['log']->debug("Call({$this->id}): contact_id = {$this->contact_id}");
$GLOBALS['log']->debug("Call({$this->id}): contact_email1 = {$this->contact_email}");
} else {
$this->contact_name = '';
$this->contact_phone = '';
$this->contact_id = '';
$this->contact_email = '';
$this->contact_name_owner = '';
$this->contact_name_mod = '';
$GLOBALS['log']->debug("Call({$this->id}): contact_name = {$this->contact_name}");
$GLOBALS['log']->debug("Call({$this->id}): contact_phone = {$this->contact_phone}");
$GLOBALS['log']->debug("Call({$this->id}): contact_id = {$this->contact_id}");
$GLOBALS['log']->debug("Call({$this->id}): contact_email1 = {$this->contact_email}");
}
//}
$this->created_by_name = get_assigned_user_name($this->created_by);
$this->modified_by_name = get_assigned_user_name($this->modified_user_id);
$this->link_action = 'DetailView';
if (!empty($this->type)) {
if ($this->type == 'out' && $this->status == 'send_error') {
$this->type_name = $mod_strings['LBL_NOT_SENT'];
} else {
$this->type_name = $app_list_strings['dom_email_types'][$this->type];
}
if ($this->type == 'out' && $this->status == 'send_error' || $this->type == 'draft') {
$this->link_action = 'EditView';
}
}
//todo this isset( $app_list_strings['dom_email_status'][$this->status]) is hack for 3261.
if (!empty($this->status) && isset($app_list_strings['dom_email_status'][$this->status])) {
$this->status_name = $app_list_strings['dom_email_status'][$this->status];
}
if (empty($this->name) && empty($_REQUEST['record'])) {
$this->name = $mod_strings['LBL_NO_SUBJECT'];
}
$this->fill_in_additional_parent_fields();
}
示例14: sendSugarPHPMail
$result1 = sendSugarPHPMail($emails, 'Презентация ', $body, $file_name, $nameToSend, $assigned_user_id, 'Realty');
if ($result1) {
echo "<br/><span style='color: green; font-size: 14px'>Письмо отправлено</span><br/>";
} else {
echo "<br/><span style='color: red; font-size: 14px'>Что-то пошло не так. Обратитесь к администратору!</span><br/>";
}
$db1 = DBManagerFactory::getInstance();
$sql2 = "UPDATE realty_accounts_m_to_m_table\n\t\t\tSET presentation_checked = 0, SET presentation_text = 'Презентация отправлена'\n\t\t\tWHERE realty_id = '{$_GET['id']}' AND account_id = '{$account->id}'";
$db2->query($sql2);
}
$sql = "SELECT contact_id FROM realty_contacts_table WHERE presentation_checked=1 AND realty_id = '{$_GET['id']}' AND deleted = 0";
$result = $db->query($sql);
while ($row = $db->fetchByAssoc($result)) {
$emails = array();
$contact = new Contact();
$contact->retrieve($row['contact_id']);
$assigned_user_id = $contact->assigned_user_id;
$ass = new User();
$ass->retrieve($assigned_user_id);
//----- сбор ответственных для контактов
// $k = 0;
// $assigned['contacts'][$k]['id'] = $contact->id;
// $assigned['contacts'][$k]['assigned_user_id'] = $contact->assigned_user_id;
// $k++;
// -------------------------------------
/*$sms = new sms();
$sms->retrieve_settings();
$resp = $sms->send_message($ass->phone_mobile, 'Презентация отправлена');
$resp = $sms->send_message($contact->phone_office, 'Вам на почту отправлена презентация');*/
/*$presentations = new Presentations();
$presentations->contact_id = $contact->id;
示例15: get_notification_recipients
protected function get_notification_recipients()
{
if ($this->special_notification) {
return parent::get_notification_recipients();
}
$list = [];
if (!is_array($this->contacts_arr)) {
$this->contacts_arr = [];
}
if (!is_array($this->users_arr)) {
$this->users_arr = [];
}
if (!is_array($this->leads_arr)) {
$this->leads_arr = [];
}
foreach ($this->users_arr as $user_id) {
$notify_user = new User();
$notify_user->retrieve($user_id);
$notify_user->new_assigned_user_name = $notify_user->full_name;
Log::info("Notifications: recipient is {$notify_user->new_assigned_user_name}");
$list[$notify_user->id] = $notify_user;
}
foreach ($this->contacts_arr as $contact_id) {
$notify_user = new Contact();
$notify_user->retrieve($contact_id);
$notify_user->new_assigned_user_name = $notify_user->full_name;
Log::info("Notifications: recipient is {$notify_user->new_assigned_user_name}");
$list[$notify_user->id] = $notify_user;
}
foreach ($this->leads_arr as $lead_id) {
$notify_user = new Lead();
$notify_user->retrieve($lead_id);
$notify_user->new_assigned_user_name = $notify_user->full_name;
Log::info("Notifications: recipient is {$notify_user->new_assigned_user_name}");
$list[$notify_user->id] = $notify_user;
}
global $sugar_config;
if (isset($sugar_config['disable_notify_current_user']) && $sugar_config['disable_notify_current_user']) {
global $current_user;
if (isset($list[$current_user->id])) {
unset($list[$current_user->id]);
}
}
return $list;
}