2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
4 /*********************************************************************************
5 * SugarCRM Community Edition is a customer relationship management program developed by
6 * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
8 * This program is free software; you can redistribute it and/or modify it under
9 * the terms of the GNU Affero General Public License version 3 as published by the
10 * Free Software Foundation with the addition of the following permission added
11 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
12 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
13 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
20 * You should have received a copy of the GNU Affero General Public License along with
21 * this program; if not, see http://www.gnu.org/licenses or write to the Free
22 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
26 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
28 * The interactive user interfaces in modified source and object code versions
29 * of this program must display Appropriate Legal Notices, as required under
30 * Section 5 of the GNU Affero General Public License version 3.
32 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
33 * these Appropriate Legal Notices must retain the display of the "Powered by
34 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
35 * technical reasons, the Appropriate Legal Notices must display the words
36 * "Powered by SugarCRM".
37 ********************************************************************************/
39 /*********************************************************************************
41 * Description: This file is used to override the default Meta-data DetailView behavior
42 * to provide customization specific to the Campaigns module.
43 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
44 * All Rights Reserved.
45 * Contributor(s): ______________________________________..
46 ********************************************************************************/
48 require_once('include/json_config.php');
50 require_once('include/MVC/View/views/view.detail.php');
52 class CampaignsViewDetail extends ViewDetail {
54 function CampaignsViewDetail(){
57 //turn off normal display of subpanels
58 $this->options['show_subpanels'] = false;
63 function preDisplay(){
65 if (isset($this->bean->campaign_type) && strtolower($this->bean->campaign_type) == 'newsletter'){
66 $mod_strings['LBL_MODULE_NAME'] = $mod_strings['LBL_NEWSLETTERS'];
69 $this->options['show_subpanels'] = false;
74 global $app_list_strings;
75 $this->ss->assign('APP_LIST', $app_list_strings);
77 if (isset($_REQUEST['mode']) && $_REQUEST['mode']=='set_target'){
78 require_once('modules/Campaigns/utils.php');
79 //call function to create campaign logs
80 $mess = track_campaign_prospects($this->bean);
82 $confirm_msg = "var ajax_C_LOG_Status = new SUGAR.ajaxStatusClass();
83 window.setTimeout(\"ajax_C_LOG_Status.showStatus('".$mess."')\",1000);
84 window.setTimeout('ajax_C_LOG_Status.hideStatus()', 1500);
85 window.setTimeout(\"ajax_C_LOG_Status.showStatus('".$mess."')\",2000);
86 window.setTimeout('ajax_C_LOG_Status.hideStatus()', 5000); ";
87 $this->ss->assign("MSG_SCRIPT",$confirm_msg);
91 if (($this->bean->campaign_type == 'Email') || ($this->bean->campaign_type == 'NewsLetter' )) {
92 $this->ss->assign("ADD_BUTTON_STATE", "submit");
93 $this->ss->assign("TARGET_BUTTON_STATE", "hidden");
95 $this->ss->assign("ADD_BUTTON_STATE", "hidden");
96 $this->ss->assign("DISABLE_LINK", "display:none");
97 $this->ss->assign("TARGET_BUTTON_STATE", "submit");
100 $currency = new Currency();
101 if(isset($this->bean->currency_id) && !empty($this->bean->currency_id))
103 $currency->retrieve($this->bean->currency_id);
104 if( $currency->deleted != 1){
105 $this->ss->assign('CURRENCY', $currency->iso4217 .' '.$currency->symbol);
107 $this->ss->assign('CURRENCY', $currency->getDefaultISO4217() .' '.$currency->getDefaultCurrencySymbol());
110 $this->ss->assign('CURRENCY', $currency->getDefaultISO4217() .' '.$currency->getDefaultCurrencySymbol());
115 //We want to display subset of available, panels, so we will call subpanel
116 //object directly instead of using sugarview.
117 $GLOBALS['focus'] = $this->bean;
118 require_once('include/SubPanel/SubPanelTiles.php');
119 $subpanel = new SubPanelTiles($this->bean, $this->module);
120 //get available list of subpanels
121 $alltabs=$subpanel->subpanel_definitions->get_available_tabs();
122 if (!empty($alltabs)) {
123 //iterate through list, and filter out all but 3 subpanels
124 foreach ($alltabs as $key=>$name) {
125 if ($name != 'prospectlists' && $name!='emailmarketing' && $name != 'tracked_urls') {
126 //exclude subpanels that are not prospectlists, emailmarketing, or tracked urls
127 $subpanel->subpanel_definitions->exclude_tab($name);
130 //only show email marketing subpanel for email/newsletter campaigns
131 if ($this->bean->campaign_type != 'Email' && $this->bean->campaign_type != 'NewsLetter' ) {
132 //exclude emailmarketing subpanel if not on an email or newsletter campaign
133 $subpanel->subpanel_definitions->exclude_tab('emailmarketing');
134 // Bug #49893 - 20120120 - Captivea (ybi) - Remove trackers subpanels if not on an email/newsletter campaign (useless subpannl)
135 $subpanel->subpanel_definitions->exclude_tab('tracked_urls');
138 //show filtered subpanel list
139 echo $subpanel->display();