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


PHP Email::load_relationship方法代码示例

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


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

示例1: testRelations

 /**
  * @group 49109
  */
 public function testRelations()
 {
     global $beanFiles;
     $bean = new Email();
     $bean->load_relationship('users', $bean);
     $relation = $bean->users->getRelationshipObject();
     $this->assertNotEmpty($relation->lhsLink, 'lhsLink is undefined');
     $this->assertNotEmpty($relation->rhsLink, 'rhsLink is undefined');
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:12,代码来源:Bug49109Test.php

示例2: testEmailImport

 public function testEmailImport()
 {
     $this->_login();
     $nv = array('from_addr' => 'test@test.com', 'parent_type' => 'Accounts', 'parent_id' => $this->acc->id, 'description' => 'test', 'name' => 'Test Subject');
     $result = $this->_soapClient->call('set_entry', array('session' => $this->_sessionId, "module_name" => 'Emails', 'name_value_list' => $nv));
     $this->email_id = $result['id'];
     $email = new Email();
     $email->retrieve($this->email_id);
     $email->load_relationship('accounts');
     $acc = $email->accounts->get();
     $this->assertEquals($this->acc->id, $acc[0]);
 }
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:12,代码来源:Bug22504Test.php

示例3: linkLeadToEmail

 /**
  * Link the Lead to the Email from which the lead was created
  * Also set the assigned user to current user and mark email as read.
  * TODO: This logic is brought over from LeadFormBase->handleSave() - need refactoring to use Link2?
  *
  * @param $emailId
  * @param $leadId
  */
 protected function linkLeadToEmail($emailId, $leadId)
 {
     global $current_user;
     $email = new Email();
     $email->retrieve($emailId);
     $email->parent_type = 'Leads';
     $email->parent_id = $leadId;
     $email->assigned_user_id = $current_user->id;
     $email->status = 'read';
     $email->save();
     $email->load_relationship('leads');
     $email->leads->add($leadId);
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:21,代码来源:LeadsApi.php

示例4: handleSave

 function handleSave($prefix, $redirect = true, $useRequired = false)
 {
     global $theme, $current_user;
     require_once 'include/formbase.php';
     global $timedate;
     $focus = new Contact();
     if ($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
         return null;
     }
     if (!empty($_POST[$prefix . 'new_reports_to_id'])) {
         $focus->retrieve($_POST[$prefix . 'new_reports_to_id']);
         $focus->reports_to_id = $_POST[$prefix . 'record'];
     } else {
         $focus = populateFromPost($prefix, $focus);
         if (!empty($focus->portal_password) && $focus->portal_password != $_POST[$prefix . 'old_portal_password']) {
             $focus->portal_password = md5($focus->portal_password);
         }
         if (!isset($_POST[$prefix . 'email_opt_out'])) {
             $focus->email_opt_out = 0;
         }
         if (!isset($_POST[$prefix . 'do_not_call'])) {
             $focus->do_not_call = 0;
         }
     }
     if (!$focus->ACLAccess('Save')) {
         ACLController::displayNoAccess(true);
         sugar_cleanup(true);
     }
     if ($_REQUEST['action'] != 'BusinessCard' && $_REQUEST['action'] != 'ConvertLead' && $_REQUEST['action'] != 'ConvertProspect') {
         if (!empty($_POST[$prefix . 'sync_contact'])) {
             $focus->contacts_users_id = $current_user->id;
         } else {
             if (!isset($focus->users)) {
                 $focus->load_relationship('user_sync');
             }
             $focus->contacts_users_id = null;
             $focus->user_sync->delete($focus->id, $current_user->id);
         }
     }
     if (isset($GLOBALS['check_notify'])) {
         $check_notify = $GLOBALS['check_notify'];
     } else {
         $check_notify = FALSE;
     }
     if (empty($_POST['dup_checked'])) {
         $duplicateContacts = $this->checkForDuplicates($prefix);
         if (isset($duplicateContacts)) {
             $location = 'module=Contacts&action=ShowDuplicates';
             $get = '';
             if (isset($_POST['inbound_email_id']) && !empty($_POST['inbound_email_id'])) {
                 $get .= '&inbound_email_id=' . $_POST['inbound_email_id'];
             }
             // Bug 25311 - Add special handling for when the form specifies many-to-many relationships
             if (isset($_POST['relate_to']) && !empty($_POST['relate_to'])) {
                 $get .= '&Contactsrelate_to=' . $_POST['relate_to'];
             }
             if (isset($_POST['relate_id']) && !empty($_POST['relate_id'])) {
                 $get .= '&Contactsrelate_id=' . $_POST['relate_id'];
             }
             //add all of the post fields to redirect get string
             foreach ($focus->column_fields as $field) {
                 if (!empty($focus->{$field}) && !is_object($focus->{$field})) {
                     $get .= "&Contacts{$field}=" . urlencode($focus->{$field});
                 }
             }
             foreach ($focus->additional_column_fields as $field) {
                 if (!empty($focus->{$field})) {
                     $get .= "&Contacts{$field}=" . urlencode($focus->{$field});
                 }
             }
             if ($focus->hasCustomFields()) {
                 foreach ($focus->field_defs as $name => $field) {
                     if (!empty($field['source']) && $field['source'] == 'custom_fields') {
                         $get .= "&Contacts{$name}=" . urlencode($focus->{$name});
                     }
                 }
             }
             $emailAddress = new SugarEmailAddress();
             $get .= $emailAddress->getFormBaseURL($focus);
             //create list of suspected duplicate contact id's in redirect get string
             $i = 0;
             foreach ($duplicateContacts as $contact) {
                 $get .= "&duplicate[{$i}]=" . $contact['id'];
                 $i++;
             }
             //add return_module, return_action, and return_id to redirect get string
             $get .= "&return_module=";
             if (!empty($_POST['return_module'])) {
                 $get .= $_POST['return_module'];
             } else {
                 $get .= "Contacts";
             }
             $get .= "&return_action=";
             if (!empty($_POST['return_action'])) {
                 $get .= $_POST['return_action'];
             }
             //else $get .= "DetailView";
             if (!empty($_POST['return_id'])) {
                 $get .= "&return_id=" . $_POST['return_id'];
             }
//.........这里部分代码省略.........
开发者ID:razorinc,项目名称:sugarcrm-example,代码行数:101,代码来源:ContactFormBase.php

示例5: handleSave

 function handleSave($prefix, $redirect = true, $useRequired = false, $do_save = true, $exist_lead = null)
 {
     require_once 'modules/Campaigns/utils.php';
     require_once 'include/formbase.php';
     if (empty($exist_lead)) {
         $focus = new Lead();
     } else {
         $focus = $exist_lead;
     }
     if ($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
         return null;
     }
     $focus = populateFromPost($prefix, $focus);
     if (!$focus->ACLAccess('Save')) {
         ACLController::displayNoAccess(true);
         sugar_cleanup(true);
     }
     if (!isset($_POST[$prefix . 'email_opt_out'])) {
         $focus->email_opt_out = 0;
     }
     if (!isset($_POST[$prefix . 'do_not_call'])) {
         $focus->do_not_call = 0;
     }
     if ($do_save) {
         if (!empty($GLOBALS['check_notify'])) {
             $focus->save($GLOBALS['check_notify']);
         } else {
             $focus->save(FALSE);
         }
     }
     $return_id = $focus->id;
     if (isset($_POST[$prefix . 'prospect_id']) && !empty($_POST[$prefix . 'prospect_id'])) {
         $prospect = new Prospect();
         $prospect->retrieve($_POST[$prefix . 'prospect_id']);
         $prospect->lead_id = $focus->id;
         $prospect->save();
         //if prospect id exists, make sure we are coming from prospect detail
         if (strtolower($_POST['return_module']) == 'prospects' && strtolower($_POST['return_action']) == 'detailview') {
             //create campaing_log entry
             if (isset($focus->campaign_id) && $focus->campaign_id != null) {
                 campaign_log_lead_entry($focus->campaign_id, $prospect, $focus, 'lead');
             }
         }
     }
     ///////////////////////////////////////////////////////////////////////////////
     ////	INBOUND EMAIL HANDLING
     ///////////////////////////////////////////////////////////////////////////////
     if (isset($_REQUEST['inbound_email_id']) && !empty($_REQUEST['inbound_email_id'])) {
         if (!isset($current_user)) {
             global $current_user;
         }
         // fake this case like it's already saved.
         $email = new Email();
         $email->retrieve($_REQUEST['inbound_email_id']);
         $email->parent_type = 'Leads';
         $email->parent_id = $focus->id;
         $email->assigned_user_id = $current_user->id;
         $email->status = 'read';
         $email->save();
         $email->load_relationship('leads');
         $email->leads->add($focus->id);
         header("Location: index.php?&module=Emails&action=EditView&type=out&inbound_email_id=" . $_REQUEST['inbound_email_id'] . "&parent_id=" . $email->parent_id . "&parent_type=" . $email->parent_type . '&start=' . $_REQUEST['start']);
         exit;
     }
     ////	END INBOUND EMAIL HANDLING
     ///////////////////////////////////////////////////////////////////////////////
     $GLOBALS['log']->debug("Saved record with id of " . $return_id);
     if ($redirect) {
         handleRedirect($return_id, 'Leads');
     } else {
         return $focus;
     }
 }
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:73,代码来源:LeadFormBase.php

示例6: Lead

    $email->duration_hours = array_rand($possible_duration_hours_arr);
    $email->duration_minutes = array_rand($possible_duration_minutes_arr);
    $email->assigned_user_id = $assigned_user_id;
    $email->assigned_user_id = $contacts_account->assigned_user_id;
    $email->assigned_user_name = $contacts_account->assigned_user_name;
    $email->description = 'Discuss project plan and hash out the details of implementation';
    $email->status = 'sent';
    $email->parent_id = $account_id;
    $email->parent_type = 'Accounts';
    $email->to_addrs = $contact->emailAddress->getPrimaryAddress($contact);
    $email->from_addr = $assignedUser->emailAddress->getPrimaryAddress($assignedUser);
    $email->from_addr_name = $email->from_addr;
    $email->to_addrs_names = $email->to_addrs;
    $email->type = 'out';
    $email->save();
    $email->load_relationship('contacts');
    $email->contacts->add($contact->id);
    $email->load_relationship('accounts');
    $email->contacts->add($account_id);
}
for ($i = 0; $i < $number_leads; $i++) {
    $lead = new Lead();
    $lead->account_name = $company_name_array[mt_rand(0, $company_name_count - 1)] . ' ' . mt_rand(1, 1000000);
    $lead->first_name = $first_name_array[mt_rand(0, $first_name_max)];
    $lead->last_name = $last_name_array[mt_rand(0, $last_name_max)];
    $lead->primary_address_street = $street_address_array[mt_rand(0, $street_address_max)];
    $lead->primary_address_city = $city_array[mt_rand(0, $city_array_max)];
    $lead->lead_source = $app_list_strings['lead_source_dom'][array_rand($app_list_strings['lead_source_dom'])];
    $lead->title = $titles[mt_rand(0, $title_max)];
    $lead->phone_work = create_phone_number();
    $lead->phone_home = create_phone_number();
开发者ID:nerdystudmuffin,项目名称:dashlet-subpanels,代码行数:31,代码来源:populateSeedData.php

示例7: explode

         }
     }
     break;
 case "relateEmails":
     if (isset($_REQUEST['uid']) && !empty($_REQUEST['uid']) && isset($_REQUEST['parent_id']) && !empty($_REQUEST['parent_id']) && isset($_REQUEST['parent_type']) && !empty($_REQUEST['parent_type'])) {
         $uids = explode($app_strings['LBL_EMAIL_DELIMITER'], $_REQUEST['uid']);
         $mod = strtolower($_REQUEST['parent_type']);
         $modId = $_REQUEST['parent_id'];
         foreach ($uids as $id) {
             $email = new Email();
             $email->retrieve($id);
             $email->parent_id = $modId;
             $email->parent_type = $_REQUEST['parent_type'];
             $email->status = 'read';
             $email->save();
             $email->load_relationship($mod);
             $email->{$mod}->add($modId);
         }
     }
     break;
 case "getAssignmentDialogContent":
     $out = $email->distributionForm("");
     $out = trim($json->encode($out, false));
     echo $out;
     break;
 case "doAssignmentAssign":
     $out = $email->et->doAssignment($_REQUEST['distribute_method'], $_REQUEST['ieId'], $_REQUEST['folder'], $_REQUEST['uids'], $_REQUEST['users']);
     echo $out;
     break;
 case "doAssignmentDelete":
     $GLOBALS['log']->debug("********** EMAIL 2.0 - Asynchronous - at: doAssignmentDelete");
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:31,代码来源:EmailUIAjax.php

示例8: strtolower

$focus->to_addrs = $_REQUEST['to_addrs'];
$focus->cc_addrs = $_REQUEST['cc_addrs'];
$focus->bcc_addrs = $_REQUEST['bcc_addrs'];
$focus->from_addr = $_REQUEST['from_addr'];
// delete the existing relationship of all the email addresses with this email
$query = "update emails_email_addr_rel set deleted = 1 WHERE email_id = '{$focus->id}'";
$focus->db->query($query);
// delete al the relationship of this email with all the beans
//$query = "update emails_beans set deleted = 1, bean_id = '', bean_module = '' WHERE email_id = '{$focus->id}'";
//$focus->db->query($query);
if (isset($_REQUEST['object_type']) && !empty($_REQUEST['object_type']) && isset($_REQUEST['object_id']) && !empty($_REQUEST['object_id'])) {
    //run linking code only if the object_id has not been linked as part of the contacts above and it is an OOB relationship
    $GLOBALS['log']->debug("CESELY" . $_REQUEST['object_type']);
    if (!in_array($_REQUEST['object_id'], $exContactIds)) {
        $rel = strtolower($_REQUEST['object_type']);
        if ($focus->load_relationship($rel)) {
            $focus->{$rel}->add($_REQUEST['object_id']);
            $GLOBALS['log']->debug("CESELY LOADED" . $_REQUEST['object_type']);
        }
    }
}
////    END RELATIONSHIP LINKING
///////////////////////////////////////////////////////////////////////////////
// If came from email archiving edit view, this would have been set from form input.
if (!isset($focus->date_start)) {
    $timedate = TimeDate::getInstance();
    list($focus->date_start, $focus->time_start) = $timedate->split_date_time($timedate->now());
}
$focus->date_sent = "";
require_once 'include/formbase.php';
$focus = populateFromPost('', $focus);
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:31,代码来源:Save.php

示例9: Email

        $focus->{$field} = $value;
    }
}
foreach ($focus->additional_column_fields as $field) {
    if (isset($_POST[$field])) {
        $value = $_POST[$field];
        $focus->{$field} = $value;
    }
}
$focus->save($check_notify);
$return_id = $focus->id;
///////////////////////////////////////////////////////////////////////////////
////	INBOUND EMAIL HANDLING
///////////////////////////////////////////////////////////////////////////////
if (isset($_REQUEST['inbound_email_id']) && !empty($_REQUEST['inbound_email_id'])) {
    require_once 'modules/Emails/Email.php';
    $email = new Email();
    $email->retrieve($_REQUEST['inbound_email_id']);
    $email->parent_type = 'Bugs';
    $email->parent_id = $focus->id;
    $email->assigned_user_id = $current_user->id;
    $email->status = 'read';
    $email->save();
    $email->load_relationship('bugs');
    $email->bugs->add($focus->id);
    header("Location: index.php?&module=Emails&action=EditView&type=out&inbound_email_id=" . $_REQUEST['inbound_email_id'] . "&parent_id=" . $email->parent_id . "&parent_type=" . $email->parent_type . '&start=' . $_REQUEST['start'] . '&assigned_user_id=' . $current_user->id);
    exit;
}
////	END INBOUND EMAIL HANDLING
///////////////////////////////////////////////////////////////////////////////
handleRedirect($return_id, 'Bugs');
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:31,代码来源:Save.php

示例10: sendEmail


//.........这里部分代码省略.........
             $this->current_emailtemplate->body = from_html($this->current_emailtemplate->body);
             $q = "SELECT * FROM notes WHERE parent_id = '" . $this->current_emailtemplate->id . "' AND deleted = 0";
             $r = $this->db->query($q);
             // cn: bug 4684 - initialize the notes array, else old data is still around for the next round
             $this->notes_array = array();
             while ($a = $this->db->fetchByAssoc($r)) {
                 $noteTemplate = new Note();
                 $noteTemplate->retrieve($a['id']);
                 $this->notes_array[] = $noteTemplate;
             }
         }
         //fetch mailbox details..
         if (empty($this->current_mailbox)) {
             if (!class_exists('InboundEmail')) {
                 require_once 'modules/InboundEmail/InboundEmail.php';
             }
             $this->current_mailbox = new InboundEmail();
         }
         if (empty($this->current_mailbox->id) or $this->current_mailbox->id !== $this->current_emailmarketing->inbound_email_id) {
             $this->current_mailbox->retrieve($this->current_emailmarketing->inbound_email_id);
             //extract the email address.
             $this->mailbox_from_addr = $this->current_mailbox->get_stored_options('from_addr', 'nobody@example.com', null);
         }
         //fetch campaign  details..
         if (empty($this->current_campaign)) {
             if (!class_exists('Campaign')) {
                 require_once 'modules/Campaigns/Campaign.php';
             }
             $this->current_campaign = new Campaign();
         }
         if (empty($this->current_campaign->id) or $this->current_campaign->id !== $this->current_emailmarketing->campaign_id) {
             $this->current_campaign->retrieve($this->current_emailmarketing->campaign_id);
             //load defined tracked_urls
             $this->current_campaign->load_relationship('tracked_urls');
             $query_array = $this->current_campaign->tracked_urls->getQuery(true);
             $query_array['select'] = "SELECT tracker_name, tracker_key, id, is_optout ";
             $result = $this->current_campaign->db->query(implode(' ', $query_array));
             $this->has_optout_links = false;
             while (($row = $this->current_campaign->db->fetchByAssoc($result)) != null) {
                 $this->tracker_urls['{' . $row['tracker_name'] . '}'] = $row;
                 //has the user defined opt-out links for the campaign.
                 if ($row['is_optout'] == 1) {
                     $this->has_optout_links = true;
                 }
             }
         }
         //BEGIN:this code will trigger for only campaigns pending before upgrade to 4.2.0.
         //will be removed for the next release.
         $btracker = true;
         $tracker_url = $this->tracking_url . '/campaign_tracker.php?track=' . $this->current_campaign->tracker_key . '&identifier=' . $this->target_tracker_key;
         $tracker_text = $this->current_campaign->tracker_text;
         if (empty($tracker_text)) {
             $btracker = false;
         }
         //END
         $mail->ClearAllRecipients();
         $mail->ClearReplyTos();
         $mail->Sender = $this->mailbox_from_addr;
         $mail->From = $this->mailbox_from_addr;
         $mail->FromName = $this->current_emailmarketing->from_name;
         $mail->AddReplyTo($this->mailbox_from_addr, $this->current_emailmarketing->from_name);
         //parse and replace bean variables.
         $template_data = $this->current_emailtemplate->parse_email_template(array('subject' => $this->current_emailtemplate->subject, 'body_html' => $this->current_emailtemplate->body_html, 'body' => $this->current_emailtemplate->body), 'Contacts', $module);
         //parse and replace urls.
         //this is new style of adding tracked urls to a campaign.
         $tracker_url_template = $this->tracking_url . '/campaign_trackerv2.php?track=%s' . '&identifier=' . $this->target_tracker_key;
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:67,代码来源:EmailMan.php

示例11: handleSave

 function handleSave($prefix, $redirect = true, $useRequired = false)
 {
     global $theme, $current_user;
     $theme_path = "themes/" . $theme . "/";
     require_once 'modules/Contacts/Contact.php';
     require_once $theme_path . 'layout_utils.php';
     require_once 'include/utils.php';
     require_once 'include/formbase.php';
     require_once 'XTemplate/xtpl.php';
     global $timedate;
     $focus = new Contact();
     if ($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
         return null;
     }
     if (!empty($_POST[$prefix . 'new_reports_to_id'])) {
         $focus->retrieve($_POST[$prefix . 'new_reports_to_id']);
         $focus->reports_to_id = $_POST[$prefix . 'record'];
     } else {
         $focus = populateFromPost($prefix, $focus);
         if (isset($focus->portal_password) && $focus->portal_password != $_POST[$prefix . 'old_portal_password']) {
             $focus->portal_password = md5($focus->portal_password);
         }
         if (!isset($_POST[$prefix . 'email_opt_out'])) {
             $focus->email_opt_out = 'off';
         }
         if (!isset($_POST[$prefix . 'do_not_call'])) {
             $focus->do_not_call = 'off';
         }
     }
     if (!$focus->ACLAccess('Save')) {
         ACLController::displayNoAccess(true);
         sugar_cleanup(true);
     }
     if ($_REQUEST['action'] != 'BusinessCard' && $_REQUEST['action'] != 'ConvertLead' && $_REQUEST['action'] != 'ConvertProspect') {
         if (isset($_POST[$prefix . 'sync_contact'])) {
             $focus->contacts_users_id = $current_user->id;
         } else {
             if (!isset($focus->users)) {
                 $focus->load_relationship('user_sync');
             }
             $focus->contacts_users_id = null;
             $focus->user_sync->delete($focus->id, $current_user->id);
         }
     }
     if (isset($GLOBALS['check_notify'])) {
         $check_notify = $GLOBALS['check_notify'];
     } else {
         $check_notify = FALSE;
     }
     if (empty($_POST['record']) && empty($_POST['dup_checked'])) {
         $duplicateContacts = $this->checkForDuplicates($prefix);
         if (isset($duplicateContacts)) {
             $get = 'module=Contacts&action=ShowDuplicates';
             if (isset($_POST['inbound_email_id']) && !empty($_POST['inbound_email_id'])) {
                 $get .= '&inbound_email_id=' . $_POST['inbound_email_id'];
             }
             //add all of the post fields to redirect get string
             foreach ($focus->column_fields as $field) {
                 if (!empty($focus->{$field})) {
                     $get .= "&Contacts{$field}=" . urlencode($focus->{$field});
                 }
             }
             foreach ($focus->additional_column_fields as $field) {
                 if (!empty($focus->{$field})) {
                     $get .= "&Contacts{$field}=" . urlencode($focus->{$field});
                 }
             }
             //create list of suspected duplicate contact id's in redirect get string
             $i = 0;
             foreach ($duplicateContacts as $contact) {
                 $get .= "&duplicate[{$i}]=" . $contact['id'];
                 $i++;
             }
             //add return_module, return_action, and return_id to redirect get string
             $get .= "&return_module=";
             if (!empty($_POST['return_module'])) {
                 $get .= $_POST['return_module'];
             } else {
                 $get .= "Contacts";
             }
             $get .= "&return_action=";
             if (!empty($_POST['return_action'])) {
                 $get .= $_POST['return_action'];
             } else {
                 $get .= "DetailView";
             }
             if (!empty($_POST['return_id'])) {
                 $get .= "&return_id=" . $_POST['return_id'];
             }
             if (!empty($_POST['popup'])) {
                 $get .= '&popup=' . $_POST['popup'];
             }
             if (!empty($_POST['create'])) {
                 $get .= '&create=' . $_POST['create'];
             }
             // for InboundEmail flow
             if (!empty($_POST['start'])) {
                 $get .= '&start=' . $_POST['start'];
             }
             //now redirect the post to modules/Contacts/ShowDuplicates.php
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:101,代码来源:ContactFormBase.php

示例12: gmdate

    if ($focus->send()) {
        $focus->status = 'sent';
        $today = gmdate('Y-m-d H:i:s');
        $focus->date_start = $timedate->to_display_date($today);
        $focus->time_start = $timedate->to_display_time($today, true);
    } else {
        $focus->status = 'send_error';
    }
}
$focus->to_addrs = $_REQUEST['to_addrs'];
$focus->save(FALSE);
////	END EMAIL SAVE/SEND SETUP
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
////	RELATIONSHIP LINKING
$focus->load_relationship('users');
$focus->users->add($current_user->id);
if (!empty($_REQUEST['to_addrs_ids'])) {
    $focus->load_relationship('contacts');
    $exContactIds = explode(';', $_REQUEST['to_addrs_ids']);
    foreach ($exContactIds as $contactId) {
        $contactId = trim($contactId);
        $focus->contacts->add($contactId);
    }
}
if (isset($_REQUEST['object_type']) && !empty($_REQUEST['object_type']) && isset($_REQUEST['object_id']) && !empty($_REQUEST['object_id'])) {
    //run linking code only if the object_id has not been linked as part of the contacts above
    if (!in_array($_REQUEST['object_id'], $exContactIds)) {
        $rel = strtolower($_REQUEST['object_type']);
        $focus->load_relationship($rel);
        $focus->{$rel}->add($_REQUEST['object_id']);
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:31,代码来源:Save.php

示例13: handleSave

 function handleSave($prefix, $redirect = true, $useRequired = false)
 {
     require_once 'modules/Leads/Lead.php';
     require_once 'include/formbase.php';
     $focus = new Lead();
     if ($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
         return null;
     }
     $focus = populateFromPost($prefix, $focus);
     if (!$focus->ACLAccess('Save')) {
         ACLController::displayNoAccess(true);
         sugar_cleanup(true);
     }
     if (!isset($_POST[$prefix . 'email_opt_out'])) {
         $focus->email_opt_out = 'off';
     }
     if (!isset($_POST[$prefix . 'do_not_call'])) {
         $focus->do_not_call = 'off';
     }
     if (!empty($GLOBALS['check_notify'])) {
         $focus->save($GLOBALS['check_notify']);
     } else {
         $focus->save(FALSE);
     }
     $return_id = $focus->id;
     if (isset($_POST[$prefix . 'prospect_id']) && !empty($_POST[$prefix . 'prospect_id'])) {
         if (!class_exists('Prospect')) {
             require_once 'modules/Prospects/Prospect.php';
         }
         $prospect = new Prospect();
         $prospect->retrieve($_POST[$prefix . 'prospect_id']);
         $prospect->lead_id = $focus->id;
         $prospect->save();
         $linked_beans = $prospect->get_linked_beans('campaigns', 'CampaignLog');
         if (empty($linked_beans)) {
             $linked_beans = array();
         }
         foreach ($linked_beans as $thebean) {
             $thebean->id = null;
             $thebean->target_id = $focus->id;
             $thebean->target_type = 'Leads';
             $thebean->archived = 1;
             $thebean->save();
         }
     }
     ///////////////////////////////////////////////////////////////////////////////
     ////	INBOUND EMAIL HANDLING
     ///////////////////////////////////////////////////////////////////////////////
     if (isset($_REQUEST['inbound_email_id']) && !empty($_REQUEST['inbound_email_id'])) {
         if (!isset($current_user)) {
             global $current_user;
         }
         // fake this case like it's already saved.
         require_once 'modules/Emails/Email.php';
         $email = new Email();
         $email->retrieve($_REQUEST['inbound_email_id']);
         $email->parent_type = 'Leads';
         $email->parent_id = $focus->id;
         $email->assigned_user_id = $current_user->id;
         $email->status = 'read';
         $email->save();
         $email->load_relationship('leads');
         $email->leads->add($focus->id);
         header("Location: index.php?&module=Emails&action=EditView&type=out&inbound_email_id=" . $_REQUEST['inbound_email_id'] . "&parent_id=" . $email->parent_id . "&parent_type=" . $email->parent_type . '&start=' . $_REQUEST['start']);
         exit;
     }
     ////	END INBOUND EMAIL HANDLING
     ///////////////////////////////////////////////////////////////////////////////
     $GLOBALS['log']->debug("Saved record with id of " . $return_id);
     if ($redirect) {
         handleRedirect($return_id, 'Leads');
     } else {
         return $focus;
     }
 }
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:75,代码来源:LeadFormBase.php

示例14: handleSave


//.........这里部分代码省略.........
             //add return_module, return_action, and return_id to redirect get string
             $get .= "&return_module=";
             if (!empty($_POST['return_module'])) {
                 $get .= $_POST['return_module'];
             } else {
                 $get .= "Leads";
             }
             $get .= "&return_action=";
             if (!empty($_POST['return_action'])) {
                 $get .= $_POST['return_action'];
             }
             if (!empty($_POST['return_id'])) {
                 $get .= "&return_id=" . $_POST['return_id'];
             }
             if (!empty($_POST['popup'])) {
                 $get .= '&popup=' . $_POST['popup'];
             }
             if (!empty($_POST['create'])) {
                 $get .= '&create=' . $_POST['create'];
             }
             // for InboundEmail flow
             if (!empty($_POST['start'])) {
                 $get .= '&start=' . $_POST['start'];
             }
             $_SESSION['SHOW_DUPLICATES'] = $get;
             if (!empty($_POST['is_ajax_call']) && $_POST['is_ajax_call'] == '1') {
                 ob_clean();
                 $json = getJSONobj();
                 echo $json->encode(array('status' => 'dupe', 'get' => $location));
             } else {
                 if (!empty($_REQUEST['ajax_load'])) {
                     echo "<script>SUGAR.ajaxUI.loadContent('index.php?{$location}');</script>";
                 } else {
                     if (!empty($_POST['to_pdf'])) {
                         $location .= '&to_pdf=' . $_POST['to_pdf'];
                     }
                     header("Location: index.php?{$location}");
                 }
             }
             return null;
         }
     }
     if (!isset($_POST[$prefix . 'email_opt_out'])) {
         $focus->email_opt_out = 0;
     }
     if (!isset($_POST[$prefix . 'do_not_call'])) {
         $focus->do_not_call = 0;
     }
     if ($do_save) {
         if (!empty($GLOBALS['check_notify'])) {
             $focus->save($GLOBALS['check_notify']);
         } else {
             $focus->save(FALSE);
         }
     }
     $return_id = $focus->id;
     if (isset($_POST[$prefix . 'prospect_id']) && !empty($_POST[$prefix . 'prospect_id'])) {
         $prospect = new Prospect();
         $prospect->retrieve($_POST[$prefix . 'prospect_id']);
         $prospect->lead_id = $focus->id;
         // Set to keep email in target
         $prospect->in_workflow = true;
         $prospect->save();
         //if prospect id exists, make sure we are coming from prospect detail
         if (strtolower($_POST['return_module']) == 'prospects' && strtolower($_POST['return_action']) == 'detailview') {
             //create campaing_log entry
             if (isset($focus->campaign_id) && $focus->campaign_id != null) {
                 campaign_log_lead_entry($focus->campaign_id, $prospect, $focus, 'lead');
             }
         }
     }
     ///////////////////////////////////////////////////////////////////////////////
     ////	INBOUND EMAIL HANDLING
     ///////////////////////////////////////////////////////////////////////////////
     if (isset($_REQUEST['inbound_email_id']) && !empty($_REQUEST['inbound_email_id'])) {
         if (!isset($current_user)) {
             global $current_user;
         }
         // fake this case like it's already saved.
         $email = new Email();
         $email->retrieve($_REQUEST['inbound_email_id']);
         $email->parent_type = 'Leads';
         $email->parent_id = $focus->id;
         $email->assigned_user_id = $current_user->id;
         $email->status = 'read';
         $email->save();
         $email->load_relationship('leads');
         $email->leads->add($focus->id);
         header("Location: index.php?&module=Emails&action=EditView&type=out&inbound_email_id=" . $_REQUEST['inbound_email_id'] . "&parent_id=" . $email->parent_id . "&parent_type=" . $email->parent_type . '&start=' . $_REQUEST['start']);
         exit;
     }
     ////	END INBOUND EMAIL HANDLING
     ///////////////////////////////////////////////////////////////////////////////
     $GLOBALS['log']->debug("Saved record with id of " . $return_id);
     if ($redirect) {
         handleRedirect($return_id, 'Leads');
     } else {
         return $focus;
     }
 }
开发者ID:omusico,项目名称:sugar_work,代码行数:101,代码来源:LeadFormBase.php

示例15: Email

 /**
  * The function creates a copy of email send to each target.
  */
 function create_indiv_email($module, $mail)
 {
     global $locale, $timedate;
     $email = new Email();
     $email->to_addrs = $module->name . '&lt;' . $module->email1 . '&gt;';
     $email->to_addrs_ids = $module->id . ';';
     $email->to_addrs_names = $module->name . ';';
     $email->to_addrs_emails = $module->email1 . ';';
     $email->type = 'archived';
     $email->deleted = '0';
     $email->name = $this->current_campaign->name . ': ' . $mail->Subject;
     if ($mail->ContentType == "text/plain") {
         $email->description = $mail->Body;
         $email->description_html = null;
     } else {
         $email->description_html = $mail->Body;
         $email->description = $mail->AltBody;
     }
     $email->from_addr = $mail->From;
     $email->assigned_user_id = $this->user_id;
     $email->parent_type = $this->related_type;
     $email->parent_id = $this->related_id;
     $email->date_start = $timedate->nowDbDate();
     $email->time_start = $timedate->asDbTime($timedate->getNow());
     $email->status = 'sent';
     $retId = $email->save();
     foreach ($this->notes_array as $note) {
         if (!class_exists('Note')) {
         }
         // create "audit" email without duping off the file to save on disk space
         $noteAudit = new Note();
         $noteAudit->parent_id = $retId;
         $noteAudit->parent_type = $email->module_dir;
         $noteAudit->description = "[" . $note->filename . "] " . $mod_strings['LBL_ATTACHMENT_AUDIT'];
         $noteAudit->save();
     }
     if (!empty($this->related_id) && !empty($this->related_type)) {
         //save relationships.
         switch ($this->related_type) {
             case 'Users':
                 $rel_name = "users";
                 break;
             case 'Prospects':
                 $rel_name = "prospects";
                 break;
             case 'Contacts':
                 $rel_name = "contacts";
                 break;
             case 'Leads':
                 $rel_name = "leads";
                 break;
             case 'Accounts':
                 $rel_name = "accounts";
                 break;
         }
         if (!empty($rel_name)) {
             $email->load_relationship($rel_name);
             $email->{$rel_name}->add($this->related_id);
         }
     }
     return $email->id;
 }
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:65,代码来源:EmailMan.php


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