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


PHP Campaign::retrieve方法代码示例

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


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

示例1: Campaign

 * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
 * reasonably feasible for  technical reasons, the Appropriate Legal Notices must
 * display the words  "Powered by SugarCRM" and "Supercharged by SuiteCRM".
 ********************************************************************************/
/*********************************************************************************
 * Description: Schedules email for delivery. emailman table holds emails for delivery.
 * A cron job polls the emailman table and delivers emails when intended send date time is reached.
 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
 * All Rights Reserved.
 * Contributor(s): ______________________________________..
 ********************************************************************************/
global $timedate;
global $current_user;
global $mod_strings;
$campaign = new Campaign();
$campaign->retrieve($_REQUEST['record']);
$err_messages = array();
$test = false;
if (isset($_REQUEST['mode']) && $_REQUEST['mode'] == 'test') {
    $test = true;
}
//this is to account for the case of sending directly from summary page in wizards
$from_wiz = false;
if (isset($_REQUEST['wiz_mass'])) {
    $mass[] = $_REQUEST['wiz_mass'];
    $_POST['mass'] = $mass;
    $from_wiz = true;
}
if (isset($_REQUEST['from_wiz'])) {
    $from_wiz = true;
}
开发者ID:MexinaD,项目名称:SuiteCRM,代码行数:31,代码来源:QueueCampaign.php

示例2: Campaign

 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
 * All Rights Reserved.
 * Contributor(s): ______________________________________..
 ********************************************************************************/
/**************************** general UI Stuff *******************/
require_once 'modules/Campaigns/utils.php';
global $app_strings;
global $timedate;
global $app_list_strings;
global $mod_strings;
global $current_user;
global $sugar_version, $sugar_config;
/**************************** GENERAL SETUP WORK*******************/
$campaign_focus = new Campaign();
if (isset($_REQUEST['campaign_id']) && !empty($_REQUEST['campaign_id'])) {
    $campaign_focus->retrieve($_REQUEST['campaign_id']);
} else {
    sugar_die($app_strings['ERROR_NO_RECORD']);
}
global $theme;
$json = getJSONobj();
$GLOBALS['log']->info("Wizard Continue Create Wizard");
if ($campaign_focus->campaign_type == 'NewsLetter') {
    echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_NEWSLETTER WIZARD_TITLE'] . ' ' . $campaign_focus->name, true);
} else {
    echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_CAMPAIGN'] . ' ' . $campaign_focus->name, true);
}
$ss = new Sugar_Smarty();
$ss->assign("MOD", $mod_strings);
$ss->assign("APP", $app_strings);
if (isset($_REQUEST['return_module'])) {
开发者ID:aldridged,项目名称:gtg-sugar,代码行数:31,代码来源:WizardMarketing.php

示例3: Campaign

 * All Rights Reserved.
 * Contributor(s): ______________________________________..
 ********************************************************************************/
/******** general UI Stuff ***********/
require_once 'modules/Campaigns/utils.php';
require_once 'modules/Campaigns/Forms.php';
global $app_strings;
global $timedate;
global $app_list_strings;
global $mod_strings;
global $current_user;
global $sugar_version, $sugar_config;
/*************** GENERAL SETUP WORK **********/
$focus = new Campaign();
if (isset($_REQUEST['record'])) {
    $focus->retrieve($_REQUEST['record']);
}
if (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
    $focus->id = "";
}
global $theme;
$json = getJSONobj();
$GLOBALS['log']->info("Campaign NewsLetter Wizard");
if (isset($_REQUEST['wizardtype']) && $_REQUEST['wizardtype'] == 1 || $focus->campaign_type == 'NewsLetter') {
    echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_NEWSLETTER WIZARD_TITLE'] . $focus->name, true);
} else {
    echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_CAMPAIGN'] . $focus->name, true);
}
$ss = new Sugar_Smarty();
$ss->assign("MOD", $mod_strings);
$ss->assign("APP", $app_strings);
开发者ID:klr2003,项目名称:sourceread,代码行数:31,代码来源:WizardNewsletter.php

示例4: testSaveAndMarkDeleted

 public function testSaveAndMarkDeleted()
 {
     $campaign = new Campaign();
     $campaign->name = 'test';
     $campaign->amount = 100;
     $campaign->save();
     //test for record ID to verify that record is saved
     $this->assertTrue(isset($campaign->id));
     $this->assertEquals(36, strlen($campaign->id));
     //mark the record as deleted and verify that this record cannot be retrieved anymore.
     $campaign->mark_deleted($campaign->id);
     $result = $campaign->retrieve($campaign->id);
     $this->assertEquals(null, $result);
 }
开发者ID:recci,项目名称:SuiteCRM,代码行数:14,代码来源:CampaignTest.php

示例5: Campaign

 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by SugarCRM".
 ********************************************************************************/
/*********************************************************************************
 * Description:  TODO: To be written.
 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
 * All Rights Reserved.
 * Contributor(s): ______________________________________..
 ********************************************************************************/
require_once 'include/formbase.php';
global $mod_strings;
//create new campaign bean and populate
$campaign_focus = new Campaign();
if (isset($_REQUEST['record'])) {
    $campaign_focus->retrieve($_REQUEST['record']);
}
$camp_steps[] = 'wiz_step1_';
$camp_steps[] = 'wiz_step2_';
$campaign_focus = populateFromPost('', $campaign_focus);
foreach ($camp_steps as $step) {
    $campaign_focus = populate_wizard_bean_from_request($campaign_focus, $step);
}
//save here so we can link relationships
$campaign_focus->save();
$GLOBALS['log']->debug("Saved record with id of " . $campaign_focus->id);
//process prospect lists
//process subscription lists if this is a newsletter
if ($campaign_focus->campaign_type == 'NewsLetter') {
    $pl_list = process_subscriptions_from_request($campaign_focus->name);
    $campaign_focus->load_relationship('prospectlists');
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:31,代码来源:WizardNewsletterSave.php

示例6: getClassicModuleTitle

global $app_strings;
global $app_list_strings;
global $current_language;
global $current_user;
global $urlPrefix;
global $currentModule;
$current_module_strings = return_module_language($current_language, 'EmailMarketing');
if ($test) {
    echo getClassicModuleTitle('Campaigns', array($current_module_strings['LBL_MODULE_SEND_TEST']), false);
} else {
    echo getClassicModuleTitle('Campaigns', array($current_module_strings['LBL_MODULE_SEND_EMAILS']), false);
}
$campaign_id = isset($_REQUEST['record']) ? $_REQUEST['record'] : false;
if (!empty($campaign_id)) {
    $campaign = new Campaign();
    $campaign->retrieve($campaign_id);
}
if ($campaign_id && isset($campaign) && $campaign->status == 'Inactive') {
    $ss = new Sugar_Smarty();
    $data = array($campaign->name);
    $ss->assign('campaignInactive', string_format(translate('LBL_CAMPAIGN_INACTIVE_SCHEDULE', 'Campaigns'), $data));
    $ss->display('modules/Campaigns/tpls/campaign-inactive.tpl');
} else {
    $focus = new EmailMarketing();
    if ($campaign_id) {
        $where_clauses = array();
        if (!empty($campaign_id)) {
            array_push($where_clauses, "campaign_id = '" . $GLOBALS['db']->quote($campaign_id) . "'");
        }
        $where = "";
        foreach ($where_clauses as $clause) {
开发者ID:butschster,项目名称:sugarcrm_dev,代码行数:31,代码来源:Schedule.php

示例7: Currency

 function fill_in_additional_detail_fields()
 {
     parent::fill_in_additional_detail_fields();
     if (!empty($this->currency_id)) {
         $currency = new Currency();
         $currency->retrieve($this->currency_id);
         if ($currency->id != $this->currency_id || $currency->deleted == 1) {
             $this->amount = $this->amount_usdollar;
             $this->currency_id = $currency->id;
         }
     }
     //get campaign name
     if (!empty($this->campaign_id)) {
         $camp = new Campaign();
         $camp->retrieve($this->campaign_id);
         $this->campaign_name = $camp->name;
     }
     $this->account_name = '';
     $this->account_id = '';
     if (!empty($this->id)) {
         $ret_values = Opportunity::get_account_detail($this->id);
         if (!empty($ret_values)) {
             $this->account_name = $ret_values['name'];
             $this->account_id = $ret_values['id'];
             $this->account_id_owner = $ret_values['assigned_user_id'];
         }
     }
 }
开发者ID:butschster,项目名称:sugarcrm_dev,代码行数:28,代码来源:Opportunity.php

示例8: Campaign

/**
 * Handle campaign log entry creation for mail-merge activity. The function will be called by the soap component.
 *
 * @param String campaign_id Primary key of the campaign
 * @param array targets List of keys for entries from prospect_lists_prosects table
 */
 function campaign_log_mail_merge($campaign_id, $targets) {

    $campaign= new Campaign();
    $campaign->retrieve($campaign_id);

    if (empty($campaign->id)) {
        $GLOBALS['log']->debug('set_campaign_merge: Invalid campaign id'. $campaign_id);
    } else {
        foreach ($targets as $target_list_id) {
            $pl_query = "select * from prospect_lists_prospects where id='".$GLOBALS['db']->quote($target_list_id)."'";
            $result=$GLOBALS['db']->query($pl_query);
            $row=$GLOBALS['db']->fetchByAssoc($result);
            if (!empty($row)) {
                write_mail_merge_log_entry($campaign_id,$row);
            }
        }
    }

 }
开发者ID:auf,项目名称:crm_auf_org,代码行数:25,代码来源:utils.php

示例9: populateFromPost

} else {
    $check_notify = FALSE;
}
require_once 'include/formbase.php';
$focus = populateFromPost('', $focus);
//store preformatted dates for 2nd save
$preformat_start_date = $focus->start_date;
$preformat_end_date = $focus->end_date;
//_ppd($preformat_end_date);
$focus->save($check_notify);
$return_id = $focus->id;
$GLOBALS['log']->debug("Saved record with id of " . $return_id);
//copy compaign targets on duplicate
if (!empty($_REQUEST['duplicateSave']) && !empty($_REQUEST['duplicateId'])) {
    $copyFromCompaign = new Campaign();
    $copyFromCompaign->retrieve($_REQUEST['duplicateId']);
    $copyFromCompaign->load_relationship('prospectlists');
    $focus->load_relationship('prospectlists');
    $target_lists = $copyFromCompaign->prospectlists->get();
    if (count($target_lists) > 0) {
        foreach ($target_lists as $prospect_list_id) {
            $focus->prospectlists->add($prospect_list_id);
        }
    }
    $focus->save();
}
//if type is set to newsletter then make sure there are propsect lists attached
if ($focus->campaign_type == 'NewsLetter') {
    //if this is a duplicate, and the "relate_to" and "relate_id" elements are not cleared out,
    //then prospect lists will get related to the original campaign on save of the prospect list, and then
    //will get related to the new newsletter campaign, meaning the same (un)subscription list will belong to
开发者ID:rgauss,项目名称:sugarcrm_dev,代码行数:31,代码来源:Save.php

示例10: constructQuery

 protected function constructQuery($datay = array(), $targets = array(), $campaign_id, $cache_file_name = 'a_file', $refresh = false, $marketing_id = '', $is_dashlet = false, $dashlet_id = '')
 {
     //global $app_strings,$mod_strings, $current_module_strings, $charset, $lang, $app_list_strings, $current_language,$sugar_config;
     global $mod_strings;
     $not_empty = false;
     $chartData = array();
     $focus = new Campaign();
     $focus->retrieve($campaign_id);
     $opp_count = 0;
     $opp_query = "select count(*) opp_count,sum(" . db_convert("amount_usdollar", "IFNULL", array(0)) . ")  total_value";
     $opp_query .= " from opportunities";
     $opp_query .= " where campaign_id='{$campaign_id}'";
     $opp_query .= " and sales_stage='Prospecting'";
     $opp_query .= " and deleted=0";
     $opp_result = $focus->db->query($opp_query);
     $opp_data = $focus->db->fetchByAssoc($opp_result);
     if (empty($opp_data['total_value'])) {
         $opp_data['total_value'] = 0;
     }
     $chartData['Total Value'] = $opp_data['total_value'];
     //report query
     $opp_query1 = "select SUM(opp.amount) as revenue";
     $opp_query1 .= " from opportunities opp";
     $opp_query1 .= " right join campaigns camp on camp.id = opp.campaign_id";
     $opp_query1 .= " where opp.sales_stage = 'Closed Won'and camp.id='{$campaign_id}' and opp.deleted=0";
     $opp_query1 .= " group by camp.name";
     $opp_result1 = $focus->db->query($opp_query1);
     $opp_data1 = $focus->db->fetchByAssoc($opp_result1);
     //if (empty($opp_data1[]))
     if (empty($opp_data1['revenue'])) {
         $opp_data1[$mod_strings['LBL_ROI_CHART_REVENUE']] = 0;
         unset($opp_data1['revenue']);
     } else {
         $opp_data1[$mod_strings['LBL_ROI_CHART_REVENUE']] = $opp_data1['revenue'];
         unset($opp_data1['revenue']);
         $not_empty = true;
     }
     $chartData['Revenue'] = $opp_data1[$mod_strings['LBL_ROI_CHART_REVENUE']];
     $camp_query1 = "select camp.name, SUM(camp.actual_cost) as investment,SUM(camp.budget) as budget,SUM(camp.expected_revenue) as expected_revenue";
     $camp_query1 .= " from campaigns camp";
     $camp_query1 .= " where camp.id='{$campaign_id}'";
     $camp_query1 .= " group by camp.name";
     $camp_result1 = $focus->db->query($camp_query1);
     $camp_data1 = $focus->db->fetchByAssoc($camp_result1);
     if (empty($camp_data1['investment'])) {
         $camp_data1['investment'] = 0;
     } else {
         $not_empty = true;
     }
     if (empty($camp_data1['budget'])) {
         $camp_data1['budget'] = 0;
     } else {
         $not_empty = true;
     }
     if (empty($camp_data1['expected_revenue'])) {
         $camp_data1['expected_revenue'] = 0;
     } else {
         $not_empty = true;
     }
     $chartData['Investment'] = $camp_data1['investment'];
     $chartData['Budget'] = $camp_data1['budget'];
     $chartData['Expected Revenue'] = $camp_data1['expected_revenue'];
     /*
                 $opp_data1[$mod_strings['LBL_ROI_CHART_INVESTMENT']]=$camp_data1['investment'];
                 $opp_data1[$mod_strings['LBL_ROI_CHART_BUDGET']]=$camp_data1['budget'];
                 $opp_data1[$mod_strings['LBL_ROI_CHART_EXPECTED_REVENUE']]=$camp_data1['expected_revenue'];
     
     
                 $query = "SELECT activity_type,target_type, count(*) hits ";
                 $query.= " FROM campaign_log ";
                 $query.= " WHERE campaign_id = '$campaign_id' AND archived=0 AND deleted=0";
                 //if $marketing id is specified, then lets filter the chart by the value
                 if (!empty($marketing_id)){
                     $query.= " AND marketing_id ='$marketing_id'";
                 }
                 $query.= " GROUP BY  activity_type, target_type";
                 $query.= " ORDER BY  activity_type, target_type";
                 $result = $focus->db->query($query);
     */
     return $chartData;
 }
开发者ID:AlanApter,项目名称:SuiteCRM,代码行数:81,代码来源:CampaignROIChartDashlet.php

示例11: Campaign

 * The Original Code is: SugarCRM Open Source
 * The Initial Developer of the Original Code is SugarCRM, Inc.
 * Portions created by SugarCRM are Copyright (C) 2004-2006 SugarCRM, Inc.;
 * All Rights Reserved.
 * Contributor(s): ______________________________________.
 ********************************************************************************/
/*********************************************************************************
 * Description:  TODO: To be written.
 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
 * All Rights Reserved.
 * Contributor(s): ______________________________________..
 ********************************************************************************/
require_once 'include/formbase.php';
require_once 'modules/Campaigns/Campaign.php';
$focus = new Campaign();
$focus->retrieve($_POST['record']);
if (!$focus->ACLAccess('Save')) {
    ACLController::displayNoAccess(true);
    sugar_cleanup(true);
}
if (!empty($_POST['assigned_user_id']) && $focus->assigned_user_id != $_POST['assigned_user_id'] && $_POST['assigned_user_id'] != $current_user->id) {
    $check_notify = TRUE;
} else {
    $check_notify = FALSE;
}
foreach ($focus->column_fields as $field) {
    if (isset($_POST[$field])) {
        $value = $_POST[$field];
        $focus->{$field} = $value;
    }
}
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:31,代码来源:Save.php

示例12: array

 function campaign_response_roi($datay = array(), $targets = array(), $campaign_id, $cache_file_name = 'a_file', $refresh = false, $marketing_id = '', $is_dashlet = false, $dashlet_id = '')
 {
     global $app_strings, $mod_strings, $current_module_strings, $charset, $lang, $app_list_strings, $current_language, $sugar_config;
     $not_empty = false;
     if ($is_dashlet) {
         $mod_strings = return_module_language($current_language, 'Campaigns');
     }
     if (!file_exists($cache_file_name) || $refresh == true) {
         $GLOBALS['log']->debug("datay is:");
         $GLOBALS['log']->debug($datay);
         $GLOBALS['log']->debug("user_id is: ");
         $GLOBALS['log']->debug("cache_file_name is: {$cache_file_name}");
         $focus = new Campaign();
         $focus->retrieve($campaign_id);
         $opp_count = 0;
         $opp_query = "select count(*) opp_count,sum(" . db_convert("amount_usdollar", "IFNULL", array(0)) . ")  total_value";
         $opp_query .= " from opportunities";
         $opp_query .= " where campaign_id='{$campaign_id}'";
         $opp_query .= " and sales_stage='Prospecting'";
         $opp_query .= " and deleted=0";
         $opp_result = $focus->db->query($opp_query);
         $opp_data = $focus->db->fetchByAssoc($opp_result);
         //            if (empty($opp_data['opp_count'])) $opp_data['opp_count']=0;
         if (empty($opp_data['total_value'])) {
             $opp_data['total_value'] = 0;
         }
         //report query
         $opp_query1 = "select SUM(opp.amount) as revenue";
         $opp_query1 .= " from opportunities opp";
         $opp_query1 .= " right join campaigns camp on camp.id = opp.campaign_id";
         $opp_query1 .= " where opp.sales_stage = 'Closed Won'and camp.id='{$campaign_id}' and opp.deleted=0";
         $opp_query1 .= " group by camp.name";
         $opp_result1 = $focus->db->query($opp_query1);
         $opp_data1 = $focus->db->fetchByAssoc($opp_result1);
         //if (empty($opp_data1[]))
         if (empty($opp_data1['revenue'])) {
             $opp_data1[$mod_strings['LBL_ROI_CHART_REVENUE']] = 0;
             unset($opp_data1['revenue']);
         } else {
             $opp_data1[$mod_strings['LBL_ROI_CHART_REVENUE']] = $opp_data1['revenue'];
             unset($opp_data1['revenue']);
             $not_empty = true;
         }
         $camp_query1 = "select camp.name, SUM(camp.actual_cost) as investment,SUM(camp.budget) as budget,SUM(camp.expected_revenue) as expected_revenue";
         $camp_query1 .= " from campaigns camp";
         $camp_query1 .= " where camp.id='{$campaign_id}'";
         $camp_query1 .= " group by camp.name";
         $camp_result1 = $focus->db->query($camp_query1);
         $camp_data1 = $focus->db->fetchByAssoc($camp_result1);
         //query needs to be lowercase, but array keys need to be propercased, as these are used in
         //chart to display legend
         if (empty($camp_data1['investment'])) {
             $camp_data1['investment'] = 0;
         } else {
             $not_empty = true;
         }
         if (empty($camp_data1['budget'])) {
             $camp_data1['budget'] = 0;
         } else {
             $not_empty = true;
         }
         if (empty($camp_data1['expected_revenue'])) {
             $camp_data1['expected_revenue'] = 0;
         } else {
             $not_empty = true;
         }
         $opp_data1[$mod_strings['LBL_ROI_CHART_INVESTMENT']] = $camp_data1['investment'];
         $opp_data1[$mod_strings['LBL_ROI_CHART_BUDGET']] = $camp_data1['budget'];
         $opp_data1[$mod_strings['LBL_ROI_CHART_EXPECTED_REVENUE']] = $camp_data1['expected_revenue'];
         $query = "SELECT activity_type,target_type, count(*) hits ";
         $query .= " FROM campaign_log ";
         $query .= " WHERE campaign_id = '{$campaign_id}' AND archived=0 AND deleted=0";
         //if $marketing id is specified, then lets filter the chart by the value
         if (!empty($marketing_id)) {
             $query .= " AND marketing_id ='{$marketing_id}'";
         }
         $query .= " GROUP BY  activity_type, target_type";
         $query .= " ORDER BY  activity_type, target_type";
         $result = $focus->db->query($query);
         $leadSourceArr = array();
         $total = 0;
         $total_targeted = 0;
     }
     global $current_user;
     $user_id = $current_user->id;
     $width = '100%';
     $return = '';
     if (!$is_dashlet) {
         $return .= '<br />';
     }
     $currency_id = $focus->currency_id;
     $currency_symbol = $sugar_config['default_currency_symbol'];
     if (!empty($currency_id)) {
         $cur = new Currency();
         $cur->retrieve($currency_id);
         $currency_symbol = $cur->symbol;
     }
     $sugarChart = SugarChartFactory::getInstance();
     $sugarChart->is_currency = true;
     $sugarChart->currency_symbol = $currency_symbol;
//.........这里部分代码省略.........
开发者ID:NALSS,项目名称:SuiteCRM,代码行数:101,代码来源:Charts.php

示例13: 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);
             }
         }
     }
 }
开发者ID:shoaib-fazal16,项目名称:dumpster,代码行数:38,代码来源:KReport.php

示例14: 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);
             }
         }
     }
 }
开发者ID:ambientelivre,项目名称:GeneratorTargetList,代码行数:64,代码来源:KReport.php


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