public function testsave() { $campaignTracker = new CampaignTracker(); $campaignTracker->tracker_name = 'test'; $campaignTracker->is_optout = 1; $campaignTracker->save(); //test for record ID to verify that record is saved $this->assertTrue(isset($campaignTracker->id)); $this->assertEquals(36, strlen($campaignTracker->id)); //mark the record as deleted and verify that this record cannot be retrieved anymore. $campaignTracker->mark_deleted($campaignTracker->id); $result = $campaignTracker->retrieve($campaignTracker->id); $this->assertEquals(null, $result); }
$ss->assign("CAMPAIGN_TYPE_OPTIONS", $mod_strings['LBL_NEWSLETTER']); $ss->assign("SHOULD_TYPE_BE_DISABLED", "input type='hidden' value='NewsLetter'"); } /*************** TRACKER UI DIV Stuff ***************/ //retrieve the trackers $focus->load_relationship('tracked_urls'); $trkr_lists = $focus->tracked_urls->get(); $trkr_html = ''; $ss->assign('TRACKER_COUNT', count($trkr_lists)); if (count($trkr_lists) > 0) { global $odd_bg, $even_bg, $hilite_bg; $trkr_count = 0; //create the html to create tracker table foreach ($trkr_lists as $trkr_id) { $ct_focus = new CampaignTracker(); $ct_focus->retrieve($trkr_id); if (isset($ct_focus->tracker_name) && !empty($ct_focus->tracker_name)) { if ($ct_focus->is_optout) { $opt = 'checked'; } else { $opt = ''; } $trkr_html .= "<div id='existing_trkr" . $trkr_count . "'> <table width='100%' border='0' cellspacing='0' cellpadding='0'>"; $trkr_html .= "<tr class='evenListRowS1'><td width='15%'><input name='wiz_step3_is_optout" . $trkr_count . "' title='" . $mod_strings['LBL_EDIT_OPT_OUT'] . $trkr_count . "' id='existing_is_optout" . $trkr_count . "' class='checkbox' type='checkbox' {$opt} /><input name='wiz_step3_id" . $trkr_count . "' value='" . $ct_focus->id . "' id='existing_tracker_id" . $trkr_count . "'type='hidden''/></td>"; $trkr_html .= "<td width='40%'> <input id='existing_tracker_name" . $trkr_count . "' type='text' size='20' maxlength='255' name='wiz_step3_tracker_name" . $trkr_count . "' title='" . $mod_strings['LBL_EDIT_TRACKER_NAME'] . $trkr_count . "' value='" . $ct_focus->tracker_name . "' ></td>"; $trkr_html .= "<td width='40%'><input type='text' size='60' maxlength='255' name='wiz_step3_tracker_url" . $trkr_count . "' title='" . $mod_strings['LBL_EDIT_TRACKER_URL'] . $trkr_count . "' id='existing_tracker_url" . $trkr_count . "' value='" . $ct_focus->tracker_url . "' ></td>"; $trkr_html .= "<td><a href='#' onclick=\"javascript:remove_existing_tracker('existing_trkr" . $trkr_count . "','" . $ct_focus->id . "'); \" > "; $trkr_html .= "<img src='" . SugarThemeRegistry::current()->getImageURL("delete_inline.gif") . "' border='0' alt='rem' align='absmiddle' border='0' height='12' width='12'>" . $mod_strings['LBL_REMOVE'] . "</a></td></tr></table></div>"; } $trkr_count = $trkr_count + 1; }
function create_tracker_summary($focus) { global $mod_strings, $app_strings; $colorclass = ''; $trkr_tbl = ''; //create tracker table $focus->load_relationship('tracked_urls'); $trkr_lists = $focus->tracked_urls->get(); $trkr_tbl = "<p><table align='center' class='list view' width='100%' border='0' cellspacing='1' cellpadding='1'>"; $trkr_tbl .= "<tr class='detail view'><td colspan='6'><h4> " . $mod_strings['LBL_NAVIGATION_MENU_TRACKERS'] . " </h4></td></tr>"; $trkr_tbl .= "<tr class='listViewHRS1'><td width='15%' scope='col'><b>" . $mod_strings['LBL_EDIT_TRACKER_NAME'] . "</b></td><td width='15%' scope='col'><b>" . $mod_strings['LBL_EDIT_TRACKER_URL'] . "</b></td><td width='15%' scope='col'><b>" . $mod_strings['LBL_EDIT_OPT_OUT'] . "</b></td></tr>"; if (count($trkr_lists) > 0) { foreach ($trkr_lists as $trkr_id) { if ($colorclass == "class='evenListRowS1'") { $colorclass = "class='oddListRowS1'"; } else { $colorclass = "class='evenListRowS1'"; } $ct_focus = new CampaignTracker(); $ct_focus->retrieve($trkr_id); if (isset($ct_focus->tracker_name) && !empty($ct_focus->tracker_name)) { if ($ct_focus->is_optout) { $opt = 'checked'; } else { $opt = ''; } $trkr_tbl .= "<tr {$colorclass}>"; $trkr_tbl .= "<td scope='row' ><a href='index.php?action=DetailView&module=CampaignTrackers&return_module=Campaigns&return_action=WizardHome&return_id=" . $focus->id . "&record=" . $ct_focus->id . "'>"; $trkr_tbl .= $ct_focus->tracker_name . "</a></td>"; $trkr_tbl .= "<td scope='row' width='15%'>" . $ct_focus->tracker_url . "</td>"; $trkr_tbl .= "<td scope='row' width='15%'> <input type='checkbox' class='checkbox' {$opt} disabled></td>"; $trkr_tbl .= "</tr>"; } } } else { $trkr_tbl .= "<tr ><td colspan='3'>" . $mod_strings['LBL_NONE'] . "</td>"; } $trkr_tbl .= "</table></p>"; return $trkr_tbl; }
* * In accordance with Section 7(b) of the GNU Affero General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by * 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'; $focus = new CampaignTracker(); $focus->retrieve($_POST['record']); if (!$focus->ACLAccess('Save')) { ACLController::displayNoAccess(true); sugar_cleanup(true); } $check_notify = FALSE; foreach ($focus->column_fields as $field) { if (isset($_POST[$field])) { $value = $_POST[$field]; $focus->{$field} = $value; } } foreach ($focus->additional_column_fields as $field) { if (isset($_POST[$field])) { $value = $_POST[$field]; $focus->{$field} = $value;
$remove_tracker_strings = explode(",", $_REQUEST['wiz_remove_tracker_list']); foreach ($remove_tracker_strings as $remove_trkr_string) { if (!empty($remove_trkr_string)) { //load relationship and add to the list $campaign_focus->load_relationship('tracked_urls'); $campaign_focus->tracked_urls->delete($campaign_focus->id, $remove_trkr_string); } } } //save campaign trackers and save if defined if (isset($_REQUEST['wiz_list_of_existing_trackers'])) { $tracker_strings = explode(",", $_REQUEST['wiz_list_of_existing_trackers']); foreach ($tracker_strings as $trkr_string) { $tracker_values = explode("@@", $trkr_string); $ct_focus = new CampaignTracker(); $ct_focus->retrieve($tracker_values[0]); if (!empty($ct_focus->tracker_name)) { $ct_focus->tracker_name = $tracker_values[1]; $ct_focus->is_optout = $tracker_values[2]; $ct_focus->tracker_url = $tracker_values[3]; $ct_focus->save(); //load relationship and add to the list $campaign_focus->load_relationship('tracked_urls'); $campaign_focus->tracked_urls->add($ct_focus->id); } } } //create new campaign tracker and save if defined if (isset($_REQUEST['wiz_list_of_trackers'])) { $tracker_strings = explode(",", $_REQUEST['wiz_list_of_trackers']); foreach ($tracker_strings as $trkr_string) {
* In accordance with Section 7(b) of the GNU Affero General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by * 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): ______________________________________.. ********************************************************************************/ global $app_strings; global $mod_strings; $focus = new CampaignTracker(); $focus->retrieve($_REQUEST['record']); if (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') { $focus->id = ""; } echo getClassicModuleTitle($mod_strings['LBL_MODULE_NAME'], array($mod_strings['LBL_MODULE_NAME'], $focus->tracker_name), true); $GLOBALS['log']->info("campaign tracker detail view"); $xtpl = new XTemplate('modules/CampaignTrackers/DetailView.html'); $xtpl->assign("MOD", $mod_strings); $xtpl->assign("APP", $app_strings); if (isset($_REQUEST['return_module'])) { $xtpl->assign("RETURN_MODULE", $_REQUEST['return_module']); } else { $xtpl->assign("RETURN_MODULE", 'Campaigns'); } if (isset($_REQUEST['return_action'])) { $xtpl->assign("RETURN_ACTION", $_REQUEST['return_action']);
foreach ($key_list as $option_key => $option_value) { $select_options .= '<OPTION value="'.$option_key.'" data-id="'.$label_list[$option_key]['id'].'" data-url="'.$label_list[$option_key]['url'].'">'.$label_list[$option_key]['text'].'</OPTION>'; } $select_options = preg_replace($pattern, $replacement, $select_options); return $select_options; }; $ss->assign("TRACKER_KEY_OPTIONS", $get_tracker_options($campaign_urls, $campaign_urls, null)); //$ss->parse("main.NoInbound.tracker_url"); // create tracker URL fields $campaignTracker = new CampaignTracker(); if(isset($_REQUEST['campaign_tracker_id']) && $_REQUEST['campaign_tracker_id']) { $campaignTracker->retrieve((int) $_REQUEST['campaign_tracker_id']); } // todo: hide tracker select if it has no trackers $ss->assign("TRACKER_NAME", isset($focus) ? $focus->tracker_name : null); $ss->assign("TRACKER_URL", isset($focus) ? $focus->tracker_url : null); if (!empty($focus->is_optout) && $focus->is_optout == 1) { $ss->assign("IS_OPTOUT_CHECKED","checked"); $ss->assign("TRACKER_URL_DISABLED","disabled"); } } } // create option of "Contact/Lead/Task" from corresponding module // translations $lblContactAndOthers = implode('/', array( isset($app_list_strings['moduleListSingular']['Contacts']) ? $app_list_strings['moduleListSingular']['Contacts'] : 'Contact',