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


PHP Lead::retrieve方法代码示例

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


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

示例1: 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;
 }
开发者ID:butschster,项目名称:sugarcrm_dev,代码行数:55,代码来源:EmailReminder.php

示例2: 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;
	}
开发者ID:eggsurplus,项目名称:SuiteCRM,代码行数:51,代码来源:Call.php

示例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 = '';
     }
 }
开发者ID:NeoArno,项目名称:tilkee-sugarcrm,代码行数:27,代码来源:hooks.php

示例4: 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'.");
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:31,代码来源:Bug50127Test.php

示例5: display

 function display()
 {
     if (isset($this->bean->lead_id) && !empty($this->bean->lead_id)) {
         //get lead name
         $lead = new Lead();
         $lead->retrieve($this->bean->lead_id);
         $this->ss->assign('lead', $lead);
     }
     parent::display();
 }
开发者ID:klr2003,项目名称:sourceread,代码行数:10,代码来源:view.detail.php

示例6: 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();
 }
开发者ID:NeoArno,项目名称:tilkee-sugarcrm,代码行数:49,代码来源:view.edit.php

示例7: 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}'");
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:19,代码来源:vCardBug40629Test.php

示例8: handleSave

 /**
  * Saves a new Contact as well as any related items passed in.
  *
  * @return null
  */
 protected function handleSave()
 {
     require_once "include/formbase.php";
     $lead = false;
     if (!empty($_REQUEST['record'])) {
         $lead = new Lead();
         $lead->retrieve($_REQUEST['record']);
     }
     global $beanList;
     $this->loadDefs();
     $beans = array();
     $selectedBeans = array();
     $selects = array();
     //Make sure the contact object is availible for relationships.
     $beans['Contacts'] = new Contact();
     $beans['Contacts']->id = create_guid();
     $beans['Contacts']->new_with_id = true;
     // Bug 39287 - Check for Duplicates on selected modules before save
     if (!empty($_REQUEST['selectedContact'])) {
         $beans['Contacts']->retrieve($_REQUEST['selectedContact']);
         if (!empty($beans['Contacts']->id)) {
             $beans['Contacts']->new_with_id = false;
             unset($_REQUEST["convert_create_Contacts"]);
             unset($_POST["convert_create_Contacts"]);
         }
     } elseif (!empty($_REQUEST["convert_create_Contacts"]) && $_REQUEST["convert_create_Contacts"] != "false" && !isset($_POST['ContinueContact'])) {
         require_once 'modules/Contacts/ContactFormBase.php';
         $contactForm = new ContactFormBase();
         $duplicateContacts = $contactForm->checkForDuplicates('Contacts');
         if (isset($duplicateContacts)) {
             echo $contactForm->buildTableForm($duplicateContacts, 'Contacts');
             return;
         }
     }
     if (!empty($_REQUEST['selectedAccount'])) {
         $_REQUEST['account_id'] = $_REQUEST['selectedAccount'];
         unset($_REQUEST["convert_create_Accounts"]);
         unset($_POST["convert_create_Accounts"]);
     } elseif (!empty($_REQUEST["convert_create_Accounts"]) && $_REQUEST["convert_create_Accounts"] != "false" && empty($_POST['ContinueAccount'])) {
         require_once 'modules/Accounts/AccountFormBase.php';
         $accountForm = new AccountFormBase();
         $duplicateAccounts = $accountForm->checkForDuplicates('Accounts');
         if (isset($duplicateAccounts)) {
             echo $accountForm->buildTableForm($duplicateAccounts);
             return;
         }
     }
     foreach ($this->defs as $module => $vdef) {
         //Create a new record if "create" was selected
         if (!empty($_REQUEST["convert_create_{$module}"]) && $_REQUEST["convert_create_{$module}"] != "false") {
             //Save the new record
             $bean = $beanList[$module];
             if (empty($beans[$module])) {
                 $beans[$module] = new $bean();
             }
             $this->populateNewBean($module, $beans[$module], $beans['Contacts'], $lead);
         } else {
             if (!empty($vdef['ConvertLead']['select'])) {
                 //Save the new record
                 $select = $vdef['ConvertLead']['select'];
                 $fieldDef = $beans['Contacts']->field_defs[$select];
                 if (!empty($fieldDef['id_name']) && !empty($_REQUEST[$fieldDef['id_name']])) {
                     $beans['Contacts']->{$fieldDef}['id_name'] = $_REQUEST[$fieldDef['id_name']];
                     $selects[$module] = $_REQUEST[$fieldDef['id_name']];
                     if (!empty($_REQUEST[$select])) {
                         $beans['Contacts']->{$select} = $_REQUEST[$select];
                     }
                     // Bug 39268 - Add the existing beans to a list of beans we'll potentially add the lead's activities to
                     $bean = loadBean($module);
                     $bean->retrieve($_REQUEST[$fieldDef['id_name']]);
                     $selectedBeans[$module] = $bean;
                 }
             }
         }
     }
     $this->handleActivities($lead, $beans);
     // Bug 39268 - Add the lead's activities to the selected beans
     $this->handleActivities($lead, $selectedBeans);
     //link selected account to lead if it exists
     if (!empty($selectedBeans['Accounts'])) {
         $lead->account_id = $selectedBeans['Accounts']->id;
     }
     //Handle non-contacts relationships
     foreach ($beans as $bean) {
         if (!empty($lead)) {
             if (empty($bean->assigned_user_id)) {
                 $bean->assigned_user_id = $lead->assigned_user_id;
             }
             $leadsRel = $this->findRelationship($bean, $lead);
             if (!empty($leadsRel)) {
                 $bean->load_relationship($leadsRel);
                 $relObject = $bean->{$leadsRel}->getRelationshipObject();
                 if ($relObject->relationship_type == "one-to-many" && $bean->{$leadsRel}->_get_bean_position()) {
                     $id_field = $relObject->rhs_key;
                     $lead->{$id_field} = $bean->id;
//.........这里部分代码省略.........
开发者ID:nickpro,项目名称:sugarcrm_dev,代码行数:101,代码来源:view.convertlead.php

示例9: moveActivity

 /**
  * Change the parent id and parent type of an activity
  * @param $activity Activity to be modified
  * @param $bean New parent bean of the activity
  */
 protected function moveActivity($activity, $bean)
 {
     global $beanList;
     $lead = null;
     if (!empty($_REQUEST['record'])) {
         $lead = new Lead();
         $lead->retrieve($_REQUEST['record']);
     }
     // delete the old relationship to the old parent (lead)
     if ($rel = $this->findRelationship($activity, $lead)) {
         $activity->load_relationship($rel);
         if ($activity->parent_id && $activity->id) {
             $activity->{$rel}->delete($activity->id, $activity->parent_id);
         }
     }
     // add the new relationship to the new parent (contact, account, etc)
     if ($rel = $this->findRelationship($activity, $bean)) {
         $activity->load_relationship($rel);
         $relObj = $activity->{$rel}->getRelationshipObject();
         if ($relObj->relationship_type == 'one-to-one' || $relObj->relationship_type == 'one-to-many') {
             $key = $relObj->rhs_key;
             $activity->{$key} = $bean->id;
         }
         $activity->{$rel}->add($bean);
     }
     // set the new parent id and type
     $activity->parent_id = $bean->id;
     $activity->parent_type = $bean->module_dir;
     $activity->save();
 }
开发者ID:MexinaD,项目名称:SuiteCRM,代码行数:35,代码来源:view.convertlead.php

示例10: Lead

 function converted_lead($leadid, $contactid, $accountid, $opportunityid)
 {
     $query = "UPDATE leads set converted='1', contact_id={$contactid}, account_id={$accountid}, opportunity_id={$opportunityid} where  id={$leadid} and deleted=0";
     $this->db->query($query, true, "Error converting lead: ");
     //we must move the status out here in order to be able to capture workflow conditions
     $leadid = str_replace("'", "", $leadid);
     $lead = new Lead();
     $lead->retrieve($leadid);
     $lead->status = 'Converted';
     $lead->save();
 }
开发者ID:thsonvt,项目名称:sugarcrm_dev,代码行数:11,代码来源:Lead.php

示例11: Contact

    $current_entity = $current_user;
} else {
    if (!empty($_REQUEST['contact_id'])) {
        $current_entity = new Contact();
        $current_entity->disable_row_level_security = true;
        $result = $current_entity->retrieve($_REQUEST['contact_id']);
        if ($result == null) {
            session_destroy();
            sugar_cleanup();
            die("The contact id doesn't exist");
        }
    } else {
        if (!empty($_REQUEST['lead_id'])) {
            $current_entity = new Lead();
            $current_entity->disable_row_level_security = true;
            $result = $current_entity->retrieve($_REQUEST['lead_id']);
            if ($result == null) {
                session_destroy();
                sugar_cleanup();
                die("The lead id doesn't exist");
            }
        }
    }
}
$bean = $beanList[clean_string($_REQUEST['module'])];
require_once $beanFiles[$bean];
$focus = new $bean();
$focus->disable_row_level_security = true;
$result = $focus->retrieve($_REQUEST['record']);
if ($result == null) {
    session_destroy();
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:31,代码来源:AcceptDecline.php

示例12: Lead

$xtpl->assign("ALT_ADDRESS_COUNTRY", $focus->alt_address_country);
$xtpl->assign("DESCRIPTION", nl2br(url2html($focus->description)));
$xtpl->assign("DATE_MODIFIED", $focus->date_modified);
$xtpl->assign("DATE_ENTERED", $focus->date_entered);
$xtpl->assign("ACCOUNT_NAME", $focus->account_name);
$detailView->processListNavigation($xtpl, "PROSPECT", $offset);
// adding custom fields:
require_once 'modules/DynamicFields/templates/Files/DetailView.php';
$xtpl->parse("main.open_source");
$preform = "<table width='100%' border='1' cellspacing='0' cellpadding='0'><tr><td><table width='100%'><tr><td>";
$displayPreform = false;
//$tags = $focus->listviewACLHelper();
if (isset($focus->lead_id) && !empty($focus->lead_id)) {
    //get lead name
    $lead = new Lead();
    $lead->retrieve($focus->lead_id);
    //$tag = $tags['LEAD'];
    $displayPreform = true;
    $preform .= $mod_strings["LBL_CONVERTED_LEAD"] . "&nbsp;<a href='index.php?module=Leads&action=DetailView&record=" . $focus->lead_id . "'>" . $lead->name . "</a>";
}
$preform .= "</td></tr></table></td></tr></table>";
if ($displayPreform) {
    $xtpl->assign("PREVIEW", $preform);
}
$xtpl->parse("main");
$xtpl->out("main");
require_once 'include/SubPanel/SubPanelTiles.php';
$subpanel = new SubPanelTiles($focus, 'Prospects');
echo $subpanel->display();
require_once 'modules/SavedSearch/SavedSearch.php';
$savedSearch = new SavedSearch();
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:31,代码来源:DetailView.php

示例13: Lead

    }
    if (isset($call)) {
        $call->track_view($current_user->id, 'Calls');
        array_push($ROWVALUES, "<LI>" . $mod_strings['LBL_CREATED_CALL'] . " - <a href='index.php?action=DetailView&module=Calls&record=" . $call->id . "'>" . $call->name . "</a>");
    }
    if (isset($meeting)) {
        $meeting->track_view($current_user->id, 'Meetings');
        array_push($ROWVALUES, "<LI>" . $mod_strings['LBL_CREATED_MEETING'] . " - <a href='index.php?action=DetailView&module=Meetings&record=" . $meeting->id . "'>" . $meeting->name . "</a>");
    }
    array_push($ROWVALUES, "&nbsp;");
    array_push($ROWVALUES, "<a href='index.php?module=Leads&action=ListView'>{$mod_strings['LBL_BACKTOLEADS']}</a>");
    $sugar_smarty->assign('ROWVALUES', $ROWVALUES);
    echo $sugar_smarty->fetch('modules/Leads/ConvertLead.tpl');
} else {
    $lead = new Lead();
    $lead->retrieve($_REQUEST['record']);
    $sugar_smarty->assign('RECORD', $_REQUEST['record']);
    $sugar_smarty->assign('TABLECLASS', 'edit view');
    //CONTACT
    $sugar_smarty->assign('FORMHEADER', $mod_strings['LNK_NEW_CONTACT']);
    $sugar_smarty->assign('OPPNEEDSACCOUNT', $mod_strings['NTC_OPPORTUNITY_REQUIRES_ACCOUNT']);
    if ($sugar_config['require_accounts']) {
        $sugar_smarty->assign('CHECKOPPORTUNITY', "&& checkOpportunity()");
    } else {
        $sugar_smarty->assign('CHECKOPPORTUNITY', "");
    }
    require_once 'modules/Contacts/ContactFormBase.php';
    $contactForm = new ContactFormBase();
    $sugar_smarty->assign('FORMBODY', $contactForm->getWideFormBody('Contacts', 'Contacts', 'ConvertLead', $lead, false));
    //$sugar_smarty->assign('FORMFOOTER',get_form_footer());
    $sugar_smarty->assign('CLASS', 'dataLabel');
开发者ID:klr2003,项目名称:sourceread,代码行数:31,代码来源:ConvertLead.php

示例14: testSaveAndConverted_lead

 public function testSaveAndConverted_lead()
 {
     $lead = new Lead();
     $lead->first_name = "firstn";
     $lead->last_name = "lastnn";
     $lead->lead_source = "test";
     $result = $lead->save();
     //test for record ID to verify that record is saved
     $this->assertTrue(isset($lead->id));
     $this->assertEquals(36, strlen($lead->id));
     $this->assertEquals("New", $lead->status);
     //test converted_lead method after saving
     /*$lead->converted_lead("'" . $lead->id . "'" , "'1'", "'1'", "'1'");
     
         	//retrieve back to test if attributes are updated in db
         	$lead = $lead->retrieve($lead->id);
         	$this->assertEquals("Converted", $lead->status);
         	$this->assertEquals("1", $lead->converted);
         	$this->assertEquals("1", $lead->contact_id);
         	$this->assertEquals("1", $lead->account_id);
         	$this->assertEquals("1", $lead->opportunity_id);
     		*/
     $this->markTestSkipped("converted_lead: Error in query, id's not properly escaped ");
     //mark the record as deleted and verify that this record cannot be retrieved anymore.
     $lead->mark_deleted($lead->id);
     $result = $lead->retrieve($lead->id);
     $this->assertEquals(null, $result);
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:28,代码来源:LeadTest.php

示例15: testConversionAndDoNothing

 public function testConversionAndDoNothing()
 {
     global $sugar_config;
     // init
     $lead = SugarTestLeadUtilities::createLead();
     $account = SugarTestAccountUtilities::createAccount();
     $meeting = SugarTestMeetingUtilities::createMeeting();
     SugarTestMeetingUtilities::addMeetingParent($meeting->id, $lead->id);
     $relation_id = SugarTestMeetingUtilities::addMeetingLeadRelation($meeting->id, $lead->id);
     $_REQUEST['record'] = $lead->id;
     // set the request/post parameters before converting the lead
     $_REQUEST['module'] = 'Leads';
     $_REQUEST['action'] = 'ConvertLead';
     $_REQUEST['record'] = $lead->id;
     $_REQUEST['handle'] = 'save';
     $_REQUEST['selectedAccount'] = $account->id;
     $sugar_config['lead_conv_activity_opt'] = 'none';
     // call display to trigger conversion
     $vc = new ViewConvertLead();
     $vc->display();
     // refresh meeting
     $meeting_id = $meeting->id;
     $meeting = new Meeting();
     $meeting->retrieve($meeting_id);
     // refresh lead
     $lead_id = $lead->id;
     $lead = new Lead();
     $lead->retrieve($lead_id);
     // retrieve the new contact id from the conversion
     $contact_id = $lead->contact_id;
     // 1. Lead's contact_id should not be null
     $this->assertNotNull($contact_id, 'Lead has null contact id after conversion.');
     // 2. Lead status should be 'Converted'
     $this->assertEquals('Converted', $lead->status, "Lead atatus should be 'Converted'.");
     // 3. parent_type of the original meeting should be Leads
     $this->assertEquals('Leads', $meeting->parent_type, 'Meeting parent should be Leads');
     // 4. parent_id of the original meeting should be contact id
     $this->assertEquals($lead_id, $meeting->parent_id, 'Meeting parent id should be lead id.');
     // 5. record should NOT be deleted from meetings_leads table
     $sql = "select id from meetings_leads where meeting_id='{$meeting->id}' and lead_id='{$lead->id}' and deleted=0";
     $result = $GLOBALS['db']->query($sql);
     $row = $GLOBALS['db']->fetchByAssoc($result);
     $this->assertFalse(empty($row), "Meeting-Lead relationship is removed.");
     // 6. record should NOT be added to meetings_contacts table
     $sql = "select meeting_id from meetings_contacts where contact_id='{$contact_id}' and deleted=0";
     $result = $GLOBALS['db']->query($sql);
     $row = $GLOBALS['db']->fetchByAssoc($result);
     $this->assertFalse($row, "Meeting-Contact relationship should not be added.");
     // clean up
     unset($_REQUEST['record']);
     $GLOBALS['db']->query("delete from meetings where parent_id='{$lead->id}' and parent_type= 'Leads'");
     $GLOBALS['db']->query("delete from meetings where parent_id='{$contact_id}' and parent_type= 'Contacts'");
     $GLOBALS['db']->query("delete from contacts where id='{$contact_id}'");
     $GLOBALS['db']->query("delete from meetings_leads where meeting_id='{$meeting->id}' and lead_id= '{$lead_id}'");
     $GLOBALS['db']->query("delete from meetings_contacts where contact_id= '{$contact_id}'");
     SugarTestMeetingUtilities::deleteMeetingLeadRelation($relation_id);
     SugarTestMeetingUtilities::removeMeetingContacts();
     SugarTestMeetingUtilities::removeAllCreatedMeetings();
     SugarTestAccountUtilities::removeAllCreatedAccounts();
     SugarTestLeadUtilities::removeAllCreatedLeads();
 }
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:61,代码来源:ConvertLeadTests.php


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