示例#1
0
 function save($id = '', $module = '', $new_addrs = array(), $primary = '', $replyTo = '', $invalid = '', $optOut = '', $in_workflow = false)
 {
     if (func_num_args() > 1) {
         parent::save($id, $module, $new_addrs, $primary, $replyTo, $invalid, $optOut, $in_workflow);
     } else {
         SugarBean::save($id);
     }
 }
示例#2
0
 public function setup()
 {
     global $current_user;
     $current_user = SugarTestUserUtilities::createAnonymousUser();
     //for the purpose of this test, we need to create some records with fake campaign and prospect list data,
     //however we do need to create some targets for the prospect list
     //create campaign tracker
     $ct = new CampaignTracker();
     $ct->tracker_name = 'Campaign Log Unit Test Tracker';
     $ct->tracker_url = 'sugarcrm.com';
     $ct->campaign_id = $this->campaign_id;
     $ct->save();
     $this->campaign_tracker = $ct;
     //for each type, create an object and populate the campaignLog list
     foreach ($this->targetObjectArray as $type) {
         //skip campaign tracker
         if ($type == 'CampaignTracker') {
             continue;
         }
         //create the new bean
         $bean = new $type();
         if ($type == 'Account') {
             $bean->name = 'CampLog Unit Test Account';
         } else {
             $bean->first_name = 'CampaignLog';
             $bean->last_name = 'Test ' . $type;
         }
         $type_obj = 'target_' . $type;
         $bean->save();
         $this->{$type_obj} = $bean;
         //save email
         $sea = new SugarEmailAddress();
         $id = $this->{$type_obj}->id;
         $module = $this->{$type_obj}->module_dir;
         $new_addrs = array();
         $primary = '';
         $replyTo = '';
         $invalid = '';
         $optOut = '';
         $in_workflow = false;
         $_REQUEST[$module . '_email_widget_id'] = 0;
         $_REQUEST[$module . '0emailAddress0'] = $type . '*****@*****.**';
         $_REQUEST[$module . 'emailAddressPrimaryFlag'] = '0emailAddress0';
         $_REQUEST[$module . 'emailAddressVerifiedFlag0'] = 'true';
         $_REQUEST[$module . 'emailAddressVerifiedValue0'] = '*****@*****.**';
         $requestVariablesSet = array('0emailAddress0', 'emailAddressPrimaryFlag', 'emailAddressVerifiedFlag0', 'emailAddressVerifiedValue0');
         $sea->save($id, $module, $new_addrs, $primary, $replyTo, $invalid, $optOut, $in_workflow);
         //unset email request values for next run
         foreach ($requestVariablesSet as $k) {
             unset($_REQUEST[$k]);
         }
         //now create the campaign log
         $cl = new CampaignLog();
         $cl->campaign_id = $this->campaign_id;
         $cl->tracker_key = $ct->tracker_key;
         $cl->target_id = $bean->id;
         $cl->target_type = $bean->module_dir;
         $cl->activity_type = 'targeted';
         //options are targeted (user was sent an email), link (user clicked on link), removed (user opted out) and viewed (viewed)
         $cl->activity_date = date('Y-m-d H:i:s');
         $cl->related_id = 'somebogusemailid' . date('His');
         // this means link will not really work, but we are not testing email
         $cl->related_type = 'Emails';
         $cl->list_id = $this->prospect_list_id;
         $cl->marketing_id = $this->email_marketing_id;
         $cl->save();
     }
     //keep last created campaign log bean to be used to call functions
     $this->campaign_log = $cl;
 }
示例#3
0
 function save($id = '', $module = '', $new_addrs = array(), $primary = '', $replyTo = '', $invalid = '', $optOut = '', $in_workflow = false)
 {
     parent::save($id, $module, $new_addrs, $primary, $replyTo, $invalid, $optOut, $in_workflow);
 }