'campaign'); var $required_fields = array('tracker_name'=>1,'tracker_url'=>1); /*This bean's constructor*/ function CampaignTracker() { parent::SugarBean(); } function save() { //make sure that the url has a scheme, if not then add http:// scheme if ($this->is_optout!=1 ){ $url = strtolower(trim($this->tracker_url)); if(!preg_match('/^(http|https|ftp):\/\//i', $url)){ $this->tracker_url = 'http://'.$url; } } parent::save(); } /* This method should return the summary text which is used to build the bread crumb navigation*/ /* Generally from this method you would return value of a field that is required and is of type string*/ function get_summary_text() { return "$this->tracker_name"; } /* This method is used to generate query for the list form. The base implementation of this method * uses the table_name and list_field variable to generate the basic query and then adds the custom field * join and team filter. If you are implementing this function do not forget to consider the additional conditions. */ function fill_in_additional_detail_fields() { global $sugar_config; //setup campaign name. $query = "SELECT name from campaigns where id = '$this->campaign_id'"; $result =$this->db->query($query,true," Error filling in additional detail fields: "); // Get the id and the name. $row = $this->db->fetchByAssoc($result); if($row != null) { $this->campaign_name=$row['name']; } if (!class_exists('Administration')) { } $admin=new Administration(); $admin->retrieveSettings('massemailer'); //retrieve all admin settings. if (isset($admin->settings['massemailer_tracking_entities_location_type']) and $admin->settings['massemailer_tracking_entities_location_type']=='2' and isset($admin->settings['massemailer_tracking_entities_location']) ) { $this->message_url=$admin->settings['massemailer_tracking_entities_location']; } else { $this->message_url=$sugar_config['site_url']; } if ($this->is_optout == 1) { $this->message_url .= '/index.php?entryPoint=removeme&identifier={MESSAGE_ID}'; } else { $this->message_url .= '/index.php?entryPoint=campaign_trackerv2&track=' . $this->id; } } } ?>