本文整理匯總了PHP中ProspectList::get_linked_fields方法的典型用法代碼示例。如果您正苦於以下問題:PHP ProspectList::get_linked_fields方法的具體用法?PHP ProspectList::get_linked_fields怎麽用?PHP ProspectList::get_linked_fields使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ProspectList
的用法示例。
在下文中一共展示了ProspectList::get_linked_fields方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: checkAccess
public function checkAccess($thisReport)
{
require_once 'modules/ProspectLists/ProspectList.php';
$newProspectList = new ProspectList();
// fill with results:
$newProspectList->load_relationships();
$linkedFields = $newProspectList->get_linked_fields();
$foundModule = false;
foreach ($linkedFields as $linkedField => $linkedFieldData) {
if ($newProspectList->{$linkedField}->_relationship->rhs_module == $thisReport->report_module) {
$foundModule = true;
}
}
return $foundModule ? true : false;
}
示例2: createTargeList
function createTargeList($listname, $campaign_id = '')
{
global $current_user, $db;
$results = $this->getSelectionResults(array());
if (count($results > 0)) {
require_once 'modules/ProspectLists/ProspectList.php';
$newProspectList = new ProspectList();
$newProspectList->name = $listname;
$newProspectList->list_type = 'default';
$newProspectList->assigned_user_id = $current_user->id;
$newProspectList->save();
// add to campaign
if ($campaign_id != '') {
require_once 'modules/Campaigns/Campaign.php';
$thisCampaign = new Campaign();
$thisCampaign->retrieve($campaign_id);
$thisCampaign->load_relationships();
$campaignLinkedFields = $thisCampaign->get_linked_fields();
foreach ($campaignLinkedFields as $linkedField => $linkedFieldData) {
if ($thisCampaign->{$linkedField}->_relationship->rhs_module == 'ProspectList') {
$thisCampaign->{$linkedField}->add($newProspectList->id);
}
}
}
// fill with results:
$newProspectList->load_relationships();
$linkedFields = $newProspectList->get_linked_fields();
foreach ($linkedFields as $linkedField => $linkedFieldData) {
if ($newProspectList->{$linkedField}->_relationship->rhs_module == $this->report_module) {
foreach ($results as $thisRecord) {
$newProspectList->{$linkedField}->add($thisRecord['sugarRecordId']);
}
} elseif ($newProspectList->{$linkedField}->_relationship->rhs_module == 'Campaigns' and $campaign_id != '') {
$newProspectList->{$linkedField}->add($campaign_id);
}
}
}
}
示例3: createTargeList
function createTargeList($listname, $campaign_id = '')
{
global $current_user, $db;
$results = $this->getSelectionResults(array());
if (count($results > 0)) {
require_once 'modules/ProspectLists/ProspectList.php';
$newProspectList = new ProspectList();
$newProspectList->name = $listname;
$newProspectList->list_type = 'default';
$newProspectList->assigned_user_id = $current_user->id;
$db = DBManagerFactory::getInstance();
/*
$sugarQuery = new SugarQuery();
$sugarQuery->select('id');
$sugarQuery->from(BeanFactory::getBean('Accounts'));
$sugarQuery->where()->equals('name',$newProspectList->name);
$id_prospect = $sugarQuery->execute();
$id_prospect = $id_prospect[0];
*/
$sql = "SELECT id, name from prospect_lists where deleted = '0' and name = '" . $newProspectList->name . "' limit 1";
$result = $db->query($sql);
if ($db->getRowCount($result) > 0) {
if ($row = $db->fetchByAssoc($result)) {
$newProspectList->id = $row['id'];
}
}
if ($newProspectList->save()) {
/* Força update do campo da base de dados com o sql do relatório */
$sql = 'UPDATE prospect_lists SET sql_query = "' . str_replace('"', "'", $_SESSION['kreport_sql']) . '" where id = "' . $newProspectList->id . '"';
$result = $db->query($sql);
if ($result) {
$GLOBALS['log']->debug("Atualizou prospect list sql");
} else {
$GLOBALS['log']->debug("Falha ao atualizar prospect list sql");
}
/* Fim */
}
// add to campaign
if ($campaign_id != '') {
require_once 'modules/Campaigns/Campaign.php';
$thisCampaign = new Campaign();
$thisCampaign->retrieve($campaign_id);
$thisCampaign->load_relationships();
$campaignLinkedFields = $thisCampaign->get_linked_fields();
foreach ($campaignLinkedFields as $linkedField => $linkedFieldData) {
if ($thisCampaign->{$linkedField}->_relationship->rhs_module == 'ProspectList') {
$thisCampaign->{$linkedField}->add($newProspectList->id);
}
}
}
// fill with results:
$newProspectList->load_relationships();
$linkedFields = $newProspectList->get_linked_fields();
foreach ($linkedFields as $linkedField => $linkedFieldData) {
if ($newProspectList->{$linkedField}->_relationship->rhs_module == $this->report_module) {
foreach ($results as $thisRecord) {
$newProspectList->{$linkedField}->add($thisRecord['sugarRecordId']);
}
} elseif ($newProspectList->{$linkedField}->_relationship->rhs_module == 'Campaigns' and $campaign_id != '') {
$newProspectList->{$linkedField}->add($campaign_id);
}
}
}
}