Example #1
0
/**
 * Internal: Add Leads that match the specified email address to the result array
 *
 * @param Array $output_list -- List of matching detail records
 * @param String $email_address -- Email address
 * @param Bean $seed_lead -- Seed Lead Bean
 * @param int $msi_id -- output array offset.
 */
function add_leads_matching_email_address(&$output_list, $email_address, &$seed_lead, &$msi_id)
{
    $safe_email_address = $GLOBALS['db']->quote($email_address);
    if (!$seed_lead->ACLAccess('ListView')) {
        return;
    }
    $leadList = $seed_lead->emailAddress->getBeansByEmailAddress($safe_email_address);
    // create a return array of names and email addresses.
    foreach ($leadList as $lead) {
        if (!is_a($lead, 'Lead')) {
            continue;
        }
        $output_list[] = array("name1" => $lead->first_name, "name2" => $lead->last_name, "association" => $lead->account_name, "type" => 'Lead', "id" => $lead->id, "msi_id" => $msi_id, "email_address" => $lead->email1);
        $msi_id = $msi_id + 1;
    }
}
Example #2
0
/**
 * Internal: Add Leads that match the specified email address to the result array
 *
 * @param Array $output_list -- List of matching detail records
 * @param String $email_address -- Email address
 * @param Bean $seed_lead -- Seed Lead Bean
 * @param int $msi_id -- output array offset.
 */
function add_leads_matching_email_address(&$output_list, $email_address, &$seed_lead, &$msi_id)
{
    $safe_email_address = addslashes($email_address);
    if (!$seed_lead->ACLAccess('ListView')) {
        return;
    }
    $where = "leads.email1 like '{$safe_email_address}' OR leads.email2 like '{$safe_email_address}'";
    $response = $seed_lead->get_list("last_name, first_name", $where, 0);
    $leadList = $response['list'];
    // create a return array of names and email addresses.
    foreach ($leadList as $lead) {
        $output_list[] = array("name1" => $lead->first_name, "name2" => $lead->last_name, "association" => $lead->account_name, "type" => 'Lead', "id" => $lead->id, "msi_id" => $msi_id, "email_address" => $lead->email1);
        $msi_id = $msi_id + 1;
    }
}