@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | |
57 | 57 | |
58 | -global $app_list_strings, $app_strings,$mod_strings; |
|
58 | +global $app_list_strings, $app_strings, $mod_strings; |
|
59 | 59 | |
60 | 60 | $site_url = $sugar_config['site_url']; |
61 | 61 | $web_form_header = $mod_strings['LBL_LEAD_DEFAULT_HEADER']; |
@@ -72,47 +72,47 @@ discard block |
||
72 | 72 | $web_form_footer = ''; |
73 | 73 | $regex = "/^\w+(['\.\-\+]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+\$/"; |
74 | 74 | //_ppd($web_required_symbol); |
75 | -if(!empty($_REQUEST['web_header'])){ |
|
76 | - $web_form_header= $_REQUEST['web_header']; |
|
75 | +if (!empty($_REQUEST['web_header'])) { |
|
76 | + $web_form_header = $_REQUEST['web_header']; |
|
77 | 77 | } |
78 | -if(!empty($_REQUEST['web_description'])){ |
|
79 | - $web_form_description= $_REQUEST['web_description']; |
|
78 | +if (!empty($_REQUEST['web_description'])) { |
|
79 | + $web_form_description = $_REQUEST['web_description']; |
|
80 | 80 | } |
81 | -if(!empty($_REQUEST['web_submit'])){ |
|
82 | - $web_form_submit_label=to_html($_REQUEST['web_submit']); |
|
81 | +if (!empty($_REQUEST['web_submit'])) { |
|
82 | + $web_form_submit_label = to_html($_REQUEST['web_submit']); |
|
83 | 83 | } |
84 | -if(!empty($_REQUEST['post_url'])){ |
|
85 | - $web_post_url= $_REQUEST['post_url']; |
|
84 | +if (!empty($_REQUEST['post_url'])) { |
|
85 | + $web_post_url = $_REQUEST['post_url']; |
|
86 | 86 | } |
87 | -if(!empty($_REQUEST['redirect_url']) && $_REQUEST['redirect_url'] !="http://"){ |
|
88 | - $web_redirect_url= $_REQUEST['redirect_url']; |
|
87 | +if (!empty($_REQUEST['redirect_url']) && $_REQUEST['redirect_url'] != "http://") { |
|
88 | + $web_redirect_url = $_REQUEST['redirect_url']; |
|
89 | 89 | } |
90 | -if(!empty($_REQUEST['notify_campaign'])){ |
|
90 | +if (!empty($_REQUEST['notify_campaign'])) { |
|
91 | 91 | $web_notify_campaign = $_REQUEST['notify_campaign']; |
92 | 92 | } |
93 | -if(!empty($_REQUEST['web_footer'])){ |
|
94 | - $web_form_footer= $_REQUEST['web_footer']; |
|
93 | +if (!empty($_REQUEST['web_footer'])) { |
|
94 | + $web_form_footer = $_REQUEST['web_footer']; |
|
95 | 95 | } |
96 | -if(!empty($_REQUEST['campaign_id'])){ |
|
97 | - $web_form_campaign= $_REQUEST['campaign_id']; |
|
96 | +if (!empty($_REQUEST['campaign_id'])) { |
|
97 | + $web_form_campaign = $_REQUEST['campaign_id']; |
|
98 | 98 | } |
99 | -if(!empty($_REQUEST['assigned_user_id'])){ |
|
99 | +if (!empty($_REQUEST['assigned_user_id'])) { |
|
100 | 100 | $web_assigned_user = $_REQUEST['assigned_user_id']; |
101 | 101 | } |
102 | 102 | |
103 | 103 | |
104 | 104 | $lead = new Lead(); |
105 | 105 | $fieldsMetaData = new FieldsMetaData(); |
106 | - $xtpl=new XTemplate ('modules/Campaigns/WebToLeadForm.html'); |
|
106 | + $xtpl = new XTemplate('modules/Campaigns/WebToLeadForm.html'); |
|
107 | 107 | $xtpl->assign("MOD", $mod_strings); |
108 | 108 | $xtpl->assign("APP", $app_strings); |
109 | 109 | $Web_To_Lead_Form_html = ''; |
110 | - $Web_To_Lead_Form_html .='<link rel="stylesheet" type="text/css" media="all" href="' . getJSPath(SugarThemeRegistry::current()->getCSSURL('calendar-win2k-cold-1.css')) . '">'; |
|
110 | + $Web_To_Lead_Form_html .= '<link rel="stylesheet" type="text/css" media="all" href="'.getJSPath(SugarThemeRegistry::current()->getCSSURL('calendar-win2k-cold-1.css')).'">'; |
|
111 | 111 | |
112 | - $Web_To_Lead_Form_html .= "<script type=\"text/javascript\" src='" . getJSPath($site_url.'/cache/include/javascript/sugar_grp1.js') . "'></script>"; |
|
113 | - $Web_To_Lead_Form_html .= '<script type="text/javascript" src="' . getJSPath($site_url.'/cache/include/javascript/calendar.js') . '"></script>'; |
|
112 | + $Web_To_Lead_Form_html .= "<script type=\"text/javascript\" src='".getJSPath($site_url.'/cache/include/javascript/sugar_grp1.js')."'></script>"; |
|
113 | + $Web_To_Lead_Form_html .= '<script type="text/javascript" src="'.getJSPath($site_url.'/cache/include/javascript/calendar.js').'"></script>'; |
|
114 | 114 | |
115 | - $Web_To_Lead_Form_html .="<form action='$web_post_url' name='WebToLeadForm' method='POST' id='WebToLeadForm'>"; |
|
115 | + $Web_To_Lead_Form_html .= "<form action='$web_post_url' name='WebToLeadForm' method='POST' id='WebToLeadForm'>"; |
|
116 | 116 | $Web_To_Lead_Form_html .= "<table width='100%' style='border-top: 1px solid; |
117 | 117 | border-bottom: 1px solid; |
118 | 118 | padding: 10px 6px 12px 10px; |
@@ -128,161 +128,161 @@ discard block |
||
128 | 128 | |
129 | 129 | //$Web_To_Lead_Form_html .= "\n<p>\n"; |
130 | 130 | |
131 | -if(!empty($_REQUEST['colsFirst']) && !empty($_REQUEST['colsSecond'])){ |
|
132 | - if(count($_REQUEST['colsFirst']) < count($_REQUEST['colsSecond'])){ |
|
133 | - $columns= count($_REQUEST['colsSecond']); |
|
131 | +if (!empty($_REQUEST['colsFirst']) && !empty($_REQUEST['colsSecond'])) { |
|
132 | + if (count($_REQUEST['colsFirst']) < count($_REQUEST['colsSecond'])) { |
|
133 | + $columns = count($_REQUEST['colsSecond']); |
|
134 | 134 | } |
135 | - if(count($_REQUEST['colsFirst']) > count($_REQUEST['colsSecond']) || count($_REQUEST['colsFirst']) == count($_REQUEST['colsSecond'])){ |
|
136 | - $columns= count($_REQUEST['colsFirst']); |
|
135 | + if (count($_REQUEST['colsFirst']) > count($_REQUEST['colsSecond']) || count($_REQUEST['colsFirst']) == count($_REQUEST['colsSecond'])) { |
|
136 | + $columns = count($_REQUEST['colsFirst']); |
|
137 | 137 | } |
138 | 138 | } |
139 | -else if(!empty($_REQUEST['colsFirst'])){ |
|
140 | - $columns= count($_REQUEST['colsFirst']); |
|
139 | +else if (!empty($_REQUEST['colsFirst'])) { |
|
140 | + $columns = count($_REQUEST['colsFirst']); |
|
141 | 141 | } |
142 | -else if(!empty($_REQUEST['colsSecond'])){ |
|
143 | - $columns= count($_REQUEST['colsSecond']); |
|
142 | +else if (!empty($_REQUEST['colsSecond'])) { |
|
143 | + $columns = count($_REQUEST['colsSecond']); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | |
147 | 147 | $required_fields = array(); |
148 | 148 | $bool_fields = array(); |
149 | -for($i= 0; $i<$columns;$i++){ |
|
149 | +for ($i = 0; $i < $columns; $i++) { |
|
150 | 150 | $colsFirstField = ''; |
151 | 151 | $colsSecondField = ''; |
152 | 152 | |
153 | - if(!empty($_REQUEST['colsFirst'][$i])){ |
|
153 | + if (!empty($_REQUEST['colsFirst'][$i])) { |
|
154 | 154 | $colsFirstField = $_REQUEST['colsFirst'][$i]; |
155 | 155 | //_pp($_REQUEST['colsFirst']); |
156 | 156 | } |
157 | - if(!empty($_REQUEST['colsSecond'][$i])){ |
|
157 | + if (!empty($_REQUEST['colsSecond'][$i])) { |
|
158 | 158 | $colsSecondField = $_REQUEST['colsSecond'][$i]; |
159 | 159 | //_pp($_REQUEST['colsSecond']); |
160 | 160 | } |
161 | 161 | |
162 | - if(isset($lead->field_defs[$colsFirstField]) && $lead->field_defs[$colsFirstField] != null) |
|
162 | + if (isset($lead->field_defs[$colsFirstField]) && $lead->field_defs[$colsFirstField] != null) |
|
163 | 163 | { |
164 | - $field_vname = preg_replace('/:$/','',translate($lead->field_defs[$colsFirstField]['vname'],'Leads')); |
|
164 | + $field_vname = preg_replace('/:$/', '', translate($lead->field_defs[$colsFirstField]['vname'], 'Leads')); |
|
165 | 165 | $field_name = $colsFirstField; |
166 | - $field_label = $field_vname .": "; |
|
167 | - if(isset($lead->field_defs[$colsFirstField]['custom_type']) && $lead->field_defs[$colsFirstField]['custom_type'] != null){ |
|
168 | - $field_type= $lead->field_defs[$colsFirstField]['custom_type']; |
|
166 | + $field_label = $field_vname.": "; |
|
167 | + if (isset($lead->field_defs[$colsFirstField]['custom_type']) && $lead->field_defs[$colsFirstField]['custom_type'] != null) { |
|
168 | + $field_type = $lead->field_defs[$colsFirstField]['custom_type']; |
|
169 | 169 | } |
170 | - else{ |
|
171 | - $field_type= $lead->field_defs[$colsFirstField]['type']; |
|
170 | + else { |
|
171 | + $field_type = $lead->field_defs[$colsFirstField]['type']; |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | //bug: 47574 - make sure, that webtolead_email1 field has same required attribute as email1 field |
175 | - if($colsFirstField == 'webtolead_email1' && isset($lead->field_defs['email1']) && isset($lead->field_defs['email1']['required'])){ |
|
175 | + if ($colsFirstField == 'webtolead_email1' && isset($lead->field_defs['email1']) && isset($lead->field_defs['email1']['required'])) { |
|
176 | 176 | $lead->field_defs['webtolead_email1']['required'] = $lead->field_defs['email1']['required']; |
177 | 177 | } |
178 | 178 | |
179 | 179 | $field_required = ''; |
180 | - if(isset($lead->field_defs[$colsFirstField]['required']) && $lead->field_defs[$colsFirstField]['required'] != null |
|
180 | + if (isset($lead->field_defs[$colsFirstField]['required']) && $lead->field_defs[$colsFirstField]['required'] != null |
|
181 | 181 | && $lead->field_defs[$colsFirstField]['required'] != 0) |
182 | 182 | { |
183 | 183 | $field_required = $lead->field_defs[$colsFirstField]['required']; |
184 | - if (! in_array($lead->field_defs[$colsFirstField]['name'], $required_fields)){ |
|
185 | - array_push($required_fields,$lead->field_defs[$colsFirstField]['name']); |
|
184 | + if (!in_array($lead->field_defs[$colsFirstField]['name'], $required_fields)) { |
|
185 | + array_push($required_fields, $lead->field_defs[$colsFirstField]['name']); |
|
186 | 186 | } |
187 | 187 | } |
188 | - if($lead->field_defs[$colsFirstField]['name']=='last_name'){ |
|
189 | - if (! in_array($lead->field_defs[$colsFirstField]['name'], $required_fields)){ |
|
190 | - array_push($required_fields,$lead->field_defs[$colsFirstField]['name']); |
|
188 | + if ($lead->field_defs[$colsFirstField]['name'] == 'last_name') { |
|
189 | + if (!in_array($lead->field_defs[$colsFirstField]['name'], $required_fields)) { |
|
190 | + array_push($required_fields, $lead->field_defs[$colsFirstField]['name']); |
|
191 | 191 | } |
192 | 192 | } |
193 | - if($field_type=='multienum' || $field_type=='enum' || $field_type=='radioenum') $field_options= $lead->field_defs[$colsFirstField]['options']; |
|
193 | + if ($field_type == 'multienum' || $field_type == 'enum' || $field_type == 'radioenum') $field_options = $lead->field_defs[$colsFirstField]['options']; |
|
194 | 194 | } |
195 | 195 | //preg_replace('/:$/','',translate($field_def['vname'],'Leads') |
196 | - if(isset($lead->field_defs[$colsSecondField]) && $lead->field_defs[$colsSecondField] != null) |
|
196 | + if (isset($lead->field_defs[$colsSecondField]) && $lead->field_defs[$colsSecondField] != null) |
|
197 | 197 | { |
198 | - $field1_vname= preg_replace('/:$/','',translate($lead->field_defs[$colsSecondField]['vname'],'Leads')); |
|
199 | - $field1_name= $colsSecondField; |
|
200 | - $field1_label = $field1_vname .": "; |
|
201 | - if(isset($lead->field_defs[$colsSecondField]['custom_type']) && $lead->field_defs[$colsSecondField]['custom_type'] != null){ |
|
202 | - $field1_type= $lead->field_defs[$colsSecondField]['custom_type']; |
|
198 | + $field1_vname = preg_replace('/:$/', '', translate($lead->field_defs[$colsSecondField]['vname'], 'Leads')); |
|
199 | + $field1_name = $colsSecondField; |
|
200 | + $field1_label = $field1_vname.": "; |
|
201 | + if (isset($lead->field_defs[$colsSecondField]['custom_type']) && $lead->field_defs[$colsSecondField]['custom_type'] != null) { |
|
202 | + $field1_type = $lead->field_defs[$colsSecondField]['custom_type']; |
|
203 | 203 | } |
204 | - else{ |
|
205 | - $field1_type= $lead->field_defs[$colsSecondField]['type']; |
|
204 | + else { |
|
205 | + $field1_type = $lead->field_defs[$colsSecondField]['type']; |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | //bug: 47574 - make sure, that webtolead_email1 field has same required attribute as email1 field |
209 | - if($colsSecondField == 'webtolead_email1' && isset($lead->field_defs['email1']) && isset($lead->field_defs['email1']['required'])){ |
|
209 | + if ($colsSecondField == 'webtolead_email1' && isset($lead->field_defs['email1']) && isset($lead->field_defs['email1']['required'])) { |
|
210 | 210 | $lead->field_defs['webtolead_email1']['required'] = $lead->field_defs['email1']['required']; |
211 | 211 | } |
212 | 212 | |
213 | 213 | $field1_required = ''; |
214 | - if(isset($lead->field_defs[$colsSecondField]['required']) && $lead->field_defs[$colsSecondField]['required'] != null |
|
215 | - && $lead->field_defs[$colsSecondField]['required'] != 0){ |
|
214 | + if (isset($lead->field_defs[$colsSecondField]['required']) && $lead->field_defs[$colsSecondField]['required'] != null |
|
215 | + && $lead->field_defs[$colsSecondField]['required'] != 0) { |
|
216 | 216 | $field1_required = $lead->field_defs[$colsSecondField]['required']; |
217 | - if (! in_array($lead->field_defs[$colsSecondField]['name'], $required_fields)){ |
|
218 | - array_push($required_fields,$lead->field_defs[$colsSecondField]['name']); |
|
217 | + if (!in_array($lead->field_defs[$colsSecondField]['name'], $required_fields)) { |
|
218 | + array_push($required_fields, $lead->field_defs[$colsSecondField]['name']); |
|
219 | 219 | } |
220 | 220 | } |
221 | - if($lead->field_defs[$colsSecondField]['name']=='last_name'){ |
|
222 | - if (! in_array($lead->field_defs[$colsSecondField]['name'], $required_fields)){ |
|
223 | - array_push($required_fields,$lead->field_defs[$colsSecondField]['name']); |
|
221 | + if ($lead->field_defs[$colsSecondField]['name'] == 'last_name') { |
|
222 | + if (!in_array($lead->field_defs[$colsSecondField]['name'], $required_fields)) { |
|
223 | + array_push($required_fields, $lead->field_defs[$colsSecondField]['name']); |
|
224 | 224 | } |
225 | 225 | } |
226 | - if($field1_type=='multienum' || $field1_type=='enum' || $field1_type=='radioenum') $field1_options= $lead->field_defs[$colsSecondField]['options']; |
|
226 | + if ($field1_type == 'multienum' || $field1_type == 'enum' || $field1_type == 'radioenum') $field1_options = $lead->field_defs[$colsSecondField]['options']; |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | $Web_To_Lead_Form_html .= "<tr>"; |
230 | 230 | |
231 | - if(isset($lead->field_defs[$colsFirstField]) && $lead->field_defs[$colsFirstField] != null){ |
|
232 | - if($field_type=='multienum' || $field_type=='enum' || $field_type=='radioenum'){ |
|
231 | + if (isset($lead->field_defs[$colsFirstField]) && $lead->field_defs[$colsFirstField] != null) { |
|
232 | + if ($field_type == 'multienum' || $field_type == 'enum' || $field_type == 'radioenum') { |
|
233 | 233 | $lead_options = ''; |
234 | - if(!empty($lead->$field_name)){ |
|
235 | - $lead_options= get_select_options_with_id($app_list_strings[$field_options], unencodeMultienum($lead->$field_name)); |
|
234 | + if (!empty($lead->$field_name)) { |
|
235 | + $lead_options = get_select_options_with_id($app_list_strings[$field_options], unencodeMultienum($lead->$field_name)); |
|
236 | 236 | } |
237 | - else{ |
|
238 | - $lead_options= get_select_options_with_id($app_list_strings[$field_options], ''); |
|
237 | + else { |
|
238 | + $lead_options = get_select_options_with_id($app_list_strings[$field_options], ''); |
|
239 | 239 | } |
240 | - if($field_required){ |
|
240 | + if ($field_required) { |
|
241 | 241 | $Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field_label</span sugar='slot'><span class='required' style='color: rgb(255, 0, 0);'>$web_required_symbol</span></td>"; |
242 | 242 | } |
243 | - else{ |
|
243 | + else { |
|
244 | 244 | $Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field_label</span sugar='slot'></td>"; |
245 | 245 | } |
246 | - if(isset($lead->field_defs[$colsFirstField]['isMultiSelect']) && $lead->field_defs[$colsFirstField]['isMultiSelect'] ==1){ |
|
246 | + if (isset($lead->field_defs[$colsFirstField]['isMultiSelect']) && $lead->field_defs[$colsFirstField]['isMultiSelect'] == 1) { |
|
247 | 247 | $Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'><select id='{$field_name}' multiple='true' name='{$field_name}[]' tabindex='1'>$lead_options</select></span sugar='slot'></td>"; |
248 | - }elseif(ifRadioButton($lead->field_defs[$colsFirstField]['name'])){ |
|
249 | - $Web_To_Lead_Form_html .="<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'>"; |
|
250 | - foreach($app_list_strings[$field_options] as $field_option_key => $field_option){ |
|
251 | - if($field_option != null){ |
|
252 | - if(!empty($lead->$field_name) && in_array($field_option_key,unencodeMultienum($lead->$field_name))){ |
|
253 | - $Web_To_Lead_Form_html .="<input id='$colsFirstField"."_$field_option_key' checked name='$colsFirstField' value='$field_option_key' type='radio'>"; |
|
254 | - } else{ |
|
255 | - $Web_To_Lead_Form_html .="<input id='$colsFirstField"."_$field_option_key' name='$colsFirstField' value='$field_option_key' type='radio'>"; |
|
248 | + }elseif (ifRadioButton($lead->field_defs[$colsFirstField]['name'])) { |
|
249 | + $Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'>"; |
|
250 | + foreach ($app_list_strings[$field_options] as $field_option_key => $field_option) { |
|
251 | + if ($field_option != null) { |
|
252 | + if (!empty($lead->$field_name) && in_array($field_option_key, unencodeMultienum($lead->$field_name))) { |
|
253 | + $Web_To_Lead_Form_html .= "<input id='$colsFirstField"."_$field_option_key' checked name='$colsFirstField' value='$field_option_key' type='radio'>"; |
|
254 | + } else { |
|
255 | + $Web_To_Lead_Form_html .= "<input id='$colsFirstField"."_$field_option_key' name='$colsFirstField' value='$field_option_key' type='radio'>"; |
|
256 | 256 | } |
257 | - $Web_To_Lead_Form_html .="<span ='document.getElementById('".$lead->field_defs[$colsFirstField]."_$field_option_key').checked =true style='cursor:default'; onmousedown='return false;'>$field_option</span><br>"; |
|
257 | + $Web_To_Lead_Form_html .= "<span ='document.getElementById('".$lead->field_defs[$colsFirstField]."_$field_option_key').checked =true style='cursor:default'; onmousedown='return false;'>$field_option</span><br>"; |
|
258 | 258 | } |
259 | 259 | } |
260 | - $Web_To_Lead_Form_html .="</span sugar='slot'></td>"; |
|
261 | - }else{ |
|
260 | + $Web_To_Lead_Form_html .= "</span sugar='slot'></td>"; |
|
261 | + } else { |
|
262 | 262 | $Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'><select id=$field_name name=$field_name tabindex='1'>$lead_options</select></span sugar='slot'></td>"; |
263 | 263 | } |
264 | 264 | } |
265 | - if($field_type=='bool'){ |
|
266 | - if($field_required){ |
|
265 | + if ($field_type == 'bool') { |
|
266 | + if ($field_required) { |
|
267 | 267 | $Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field_label</span sugar='slot'><span class='required' style='color: rgb(255, 0, 0);'>$web_required_symbol</span></td>"; |
268 | 268 | } |
269 | - else{ |
|
269 | + else { |
|
270 | 270 | $Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field_label</span sugar='slot'></td>"; |
271 | 271 | } |
272 | 272 | $Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'><input type='checkbox' id=$field_name name=$field_name></span sugar='slot'></td>"; |
273 | - if (! in_array($lead->field_defs[$colsFirstField]['name'], $bool_fields)){ |
|
274 | - array_push($bool_fields,$lead->field_defs[$colsFirstField]['name']); |
|
273 | + if (!in_array($lead->field_defs[$colsFirstField]['name'], $bool_fields)) { |
|
274 | + array_push($bool_fields, $lead->field_defs[$colsFirstField]['name']); |
|
275 | 275 | } |
276 | 276 | } |
277 | - if($field_type=='date') { |
|
277 | + if ($field_type == 'date') { |
|
278 | 278 | |
279 | 279 | global $timedate; |
280 | 280 | $cal_dateformat = $timedate->get_cal_date_format(); |
281 | 281 | $LBL_ENTER_DATE = translate('LBL_ENTER_DATE', 'Charts'); |
282 | - if($field_required){ |
|
282 | + if ($field_required) { |
|
283 | 283 | $Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field_label</span sugar='slot'><span class='required' style='color: rgb(255, 0, 0);'>$web_required_symbol</span></td>"; |
284 | 284 | } |
285 | - else{ |
|
285 | + else { |
|
286 | 286 | $Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field_label</span sugar='slot'></td>"; |
287 | 287 | } |
288 | 288 | |
@@ -302,117 +302,117 @@ discard block |
||
302 | 302 | </script> |
303 | 303 | <span sugar='slot'><input type='hidden' id='{$field_name}' name='{$field_name}'/>"; |
304 | 304 | $order = explode("%", $cal_dateformat); |
305 | - foreach($order as $part) |
|
305 | + foreach ($order as $part) |
|
306 | 306 | { |
307 | 307 | if (!isset($part[0])) |
308 | 308 | continue; |
309 | - if (strToUpper($part[0]) == "M" ) |
|
310 | - $Web_To_Lead_Form_html .= translate("LBL_MONTH") . ":<input class=\"text\" |
|
309 | + if (strToUpper($part[0]) == "M") |
|
310 | + $Web_To_Lead_Form_html .= translate("LBL_MONTH").":<input class=\"text\" |
|
311 | 311 | name=\"{$field_name}_month\" size='2' maxlength='2' id='{$field_name}_month' value='' |
312 | 312 | onblur=\"update{$field_name}Value()\">"; |
313 | - else if (strToUpper($part[0]) == "D" ) |
|
314 | - $Web_To_Lead_Form_html .= translate("LBL_DAY") . ":<input class=\"text\" |
|
313 | + else if (strToUpper($part[0]) == "D") |
|
314 | + $Web_To_Lead_Form_html .= translate("LBL_DAY").":<input class=\"text\" |
|
315 | 315 | name=\"{$field_name}_day\" size='2' maxlength='2' id='{$field_name}_day' value='' |
316 | 316 | onblur=\"update{$field_name}Value()\">"; |
317 | - else if (strToUpper($part[0]) == "Y" ) |
|
318 | - $Web_To_Lead_Form_html .= translate("LBL_YEAR") . ":<input class=\"text\" |
|
317 | + else if (strToUpper($part[0]) == "Y") |
|
318 | + $Web_To_Lead_Form_html .= translate("LBL_YEAR").":<input class=\"text\" |
|
319 | 319 | name=\"{$field_name}_year\" size='4' maxlength='4' id='{$field_name}_year' value='' |
320 | 320 | onblur=\"update{$field_name}Value()\">"; |
321 | 321 | } |
322 | 322 | $Web_To_Lead_Form_html .= "</span></td>"; |
323 | 323 | } // if |
324 | 324 | |
325 | - if( $field_type=='varchar' || $field_type=='name' |
|
326 | - || $field_type=='phone' || $field_type=='currency' || $field_type=='url' || $field_type=='int'){ |
|
327 | - if($field_name=='last_name' || $field_required){ |
|
325 | + if ($field_type == 'varchar' || $field_type == 'name' |
|
326 | + || $field_type == 'phone' || $field_type == 'currency' || $field_type == 'url' || $field_type == 'int') { |
|
327 | + if ($field_name == 'last_name' || $field_required) { |
|
328 | 328 | $Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field_label</span sugar='slot'><span class='required' style='color: rgb(255, 0, 0);'>$web_required_symbol</span></td>"; |
329 | 329 | } |
330 | - else{ |
|
330 | + else { |
|
331 | 331 | $Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field_label</span sugar='slot'></td>"; |
332 | 332 | } |
333 | - if ( $field_name=='email1'||$field_name=='email2' ){ |
|
333 | + if ($field_name == 'email1' || $field_name == 'email2') { |
|
334 | 334 | $Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'><input id=$field_name name=$field_name type='text' onchange='validateEmailAdd();'></span sugar='slot'></td>"; |
335 | 335 | } else { |
336 | 336 | $Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'><input id=$field_name name=$field_name type='text'></span sugar='slot'></td>"; |
337 | 337 | } |
338 | 338 | } |
339 | - if ( $field_type == 'text' ) { |
|
339 | + if ($field_type == 'text') { |
|
340 | 340 | $Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field_label</span sugar='slot'></td>"; |
341 | 341 | $Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span id='ta_replace' sugar='slot'><input id=$field_name name=$field_name type='text'></span sugar='slot'></td>"; |
342 | 342 | } |
343 | - if($field_type=='relate' && $field_name=='account_name'){ |
|
343 | + if ($field_type == 'relate' && $field_name == 'account_name') { |
|
344 | 344 | $Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field_label</span sugar='slot'></td>"; |
345 | 345 | $Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'><input id=$field_name name=$field_name type='text'></span sugar='slot'></td>"; |
346 | 346 | } |
347 | - if($field_type=='email'){ |
|
348 | - if($field_required){ |
|
347 | + if ($field_type == 'email') { |
|
348 | + if ($field_required) { |
|
349 | 349 | $Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field_label</span sugar='slot'><span class='required' style='color: rgb(255, 0, 0);'>$web_required_symbol</span></td>"; |
350 | 350 | } |
351 | - else{ |
|
351 | + else { |
|
352 | 352 | $Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field_label</span sugar='slot'></td>"; |
353 | 353 | } |
354 | 354 | $Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'><input id=$field_name name=$field_name type='text' onchange='validateEmailAdd();'></span sugar='slot'></td>"; |
355 | 355 | } |
356 | 356 | } |
357 | - else{ |
|
357 | + else { |
|
358 | 358 | $Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'> </span sugar='slot'></td>"; |
359 | 359 | $Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'> </span sugar='slot'></td>"; |
360 | 360 | } |
361 | 361 | |
362 | - if(isset($lead->field_defs[$colsSecondField]) && $lead->field_defs[$colsSecondField] != null){ |
|
363 | - if($field1_type=='multienum' || $field1_type=='enum' || $field1_type=='radioenum'){ |
|
362 | + if (isset($lead->field_defs[$colsSecondField]) && $lead->field_defs[$colsSecondField] != null) { |
|
363 | + if ($field1_type == 'multienum' || $field1_type == 'enum' || $field1_type == 'radioenum') { |
|
364 | 364 | $lead1_options = ''; |
365 | - if(!empty($lead->$field1_name)){ |
|
366 | - $lead1_options= get_select_options_with_id($app_list_strings[$field1_options], unencodeMultienum($lead->$field1_name)); |
|
365 | + if (!empty($lead->$field1_name)) { |
|
366 | + $lead1_options = get_select_options_with_id($app_list_strings[$field1_options], unencodeMultienum($lead->$field1_name)); |
|
367 | 367 | } |
368 | - else{ |
|
369 | - $lead1_options= get_select_options_with_id($app_list_strings[$field1_options], ''); |
|
368 | + else { |
|
369 | + $lead1_options = get_select_options_with_id($app_list_strings[$field1_options], ''); |
|
370 | 370 | } |
371 | - if($field1_required){ |
|
371 | + if ($field1_required) { |
|
372 | 372 | $Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field1_label</span sugar='slot'><span class='required' style='color: rgb(255, 0, 0);'>$web_required_symbol</span></td>"; |
373 | 373 | } |
374 | - else{ |
|
374 | + else { |
|
375 | 375 | $Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field1_label</span sugar='slot'></td>"; |
376 | 376 | } |
377 | - if(isset($lead->field_defs[$colsSecondField]['isMultiSelect']) && $lead->field_defs[$colsSecondField]['isMultiSelect'] ==1){ |
|
377 | + if (isset($lead->field_defs[$colsSecondField]['isMultiSelect']) && $lead->field_defs[$colsSecondField]['isMultiSelect'] == 1) { |
|
378 | 378 | $Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'><select id='{$field1_name}' name='{$field1_name}[]' multiple='true' tabindex='1'>$lead1_options</select></span sugar='slot'></td>"; |
379 | - }elseif(ifRadioButton($lead->field_defs[$colsSecondField]['name'])){ |
|
380 | - $Web_To_Lead_Form_html .="<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'>"; |
|
381 | - foreach($app_list_strings[$field1_options] as $field_option_key => $field_option){ |
|
382 | - if($field_option != null){ |
|
383 | - if(!empty($lead->$field1_name) && in_array($field_option_key,unencodeMultienum($lead->$field1_name))){ |
|
384 | - $Web_To_Lead_Form_html .="<input id='$colsSecondField"."_$field_option_key' checked name='$colsSecondField' value='$field_option_key' type='radio'>"; |
|
385 | - }else{ |
|
386 | - $Web_To_Lead_Form_html .="<input id='$colsSecondField"."_$field_option_key' name='$colsSecondField' value='$field_option_key' type='radio'>"; |
|
379 | + }elseif (ifRadioButton($lead->field_defs[$colsSecondField]['name'])) { |
|
380 | + $Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'>"; |
|
381 | + foreach ($app_list_strings[$field1_options] as $field_option_key => $field_option) { |
|
382 | + if ($field_option != null) { |
|
383 | + if (!empty($lead->$field1_name) && in_array($field_option_key, unencodeMultienum($lead->$field1_name))) { |
|
384 | + $Web_To_Lead_Form_html .= "<input id='$colsSecondField"."_$field_option_key' checked name='$colsSecondField' value='$field_option_key' type='radio'>"; |
|
385 | + } else { |
|
386 | + $Web_To_Lead_Form_html .= "<input id='$colsSecondField"."_$field_option_key' name='$colsSecondField' value='$field_option_key' type='radio'>"; |
|
387 | 387 | } |
388 | - $Web_To_Lead_Form_html .="<span ='document.getElementById('".$lead->field_defs[$colsSecondField]."_$field_option_key').checked =true style='cursor:default'; onmousedown='return false;'>$field_option</span><br>"; |
|
388 | + $Web_To_Lead_Form_html .= "<span ='document.getElementById('".$lead->field_defs[$colsSecondField]."_$field_option_key').checked =true style='cursor:default'; onmousedown='return false;'>$field_option</span><br>"; |
|
389 | 389 | } |
390 | 390 | } |
391 | - $Web_To_Lead_Form_html .="</span sugar='slot'></td>"; |
|
392 | - }else{ |
|
391 | + $Web_To_Lead_Form_html .= "</span sugar='slot'></td>"; |
|
392 | + } else { |
|
393 | 393 | $Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'><select id=$field1_name name=$field1_name tabindex='1'>$lead1_options</select></span sugar='slot'></td>"; |
394 | 394 | } |
395 | 395 | } |
396 | - if($field1_type=='bool'){ |
|
397 | - if($field1_required){ |
|
396 | + if ($field1_type == 'bool') { |
|
397 | + if ($field1_required) { |
|
398 | 398 | $Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field1_label</span sugar='slot'><span class='required' style='color: rgb(255, 0, 0);'>$web_required_symbol</span></td>"; |
399 | 399 | } |
400 | - else{ |
|
400 | + else { |
|
401 | 401 | $Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field1_label</span sugar='slot'></td>"; |
402 | 402 | } |
403 | 403 | $Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'><input id=$field1_name name=$field1_name type='checkbox'></span sugar='slot'></td>"; |
404 | - if (! in_array($lead->field_defs[$colsSecondField]['name'], $bool_fields)){ |
|
405 | - array_push($bool_fields,$lead->field_defs[$colsSecondField]['name']); |
|
404 | + if (!in_array($lead->field_defs[$colsSecondField]['name'], $bool_fields)) { |
|
405 | + array_push($bool_fields, $lead->field_defs[$colsSecondField]['name']); |
|
406 | 406 | } |
407 | 407 | } |
408 | - if($field1_type=='date') { |
|
408 | + if ($field1_type == 'date') { |
|
409 | 409 | global $timedate; |
410 | 410 | $cal_dateformat = $timedate->get_cal_date_format(); |
411 | 411 | $LBL_ENTER_DATE = translate('LBL_ENTER_DATE', 'Charts'); |
412 | - if($field1_required){ |
|
412 | + if ($field1_required) { |
|
413 | 413 | $Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field1_label</span sugar='slot'><span class='required' style='color: rgb(255, 0, 0);'>$web_required_symbol</span></td>"; |
414 | 414 | } |
415 | - else{ |
|
415 | + else { |
|
416 | 416 | $Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field1_label</span sugar='slot'></td>"; |
417 | 417 | } |
418 | 418 | $Web_To_Lead_Form_html .= " |
@@ -431,59 +431,59 @@ discard block |
||
431 | 431 | </script> |
432 | 432 | <span sugar='slot'><input type='hidden' id='{$field1_name}' name='{$field1_name}'/>"; |
433 | 433 | $order = explode("%", $cal_dateformat); |
434 | - foreach($order as $part) |
|
434 | + foreach ($order as $part) |
|
435 | 435 | { |
436 | 436 | if (!isset($part[0])) |
437 | 437 | continue; |
438 | - if (strToUpper($part[0]) == "M" ) |
|
439 | - $Web_To_Lead_Form_html .= translate("LBL_MONTH") . ":<input class=\"text\" |
|
438 | + if (strToUpper($part[0]) == "M") |
|
439 | + $Web_To_Lead_Form_html .= translate("LBL_MONTH").":<input class=\"text\" |
|
440 | 440 | name=\"{$field1_name}_month\" size='2' maxlength='2' id='{$field1_name}_month' value='' |
441 | 441 | onblur=\"update{$field1_name}Value()\">"; |
442 | - else if (strToUpper($part[0]) == "D" ) |
|
443 | - $Web_To_Lead_Form_html .= translate("LBL_DAY") . ":<input class=\"text\" |
|
442 | + else if (strToUpper($part[0]) == "D") |
|
443 | + $Web_To_Lead_Form_html .= translate("LBL_DAY").":<input class=\"text\" |
|
444 | 444 | name=\"{$field1_name}_day\" size='2' maxlength='2' id='{$field1_name}_day' value='' |
445 | 445 | onblur=\"update{$field1_name}Value()\">"; |
446 | - else if (strToUpper($part[0]) == "Y" ) |
|
447 | - $Web_To_Lead_Form_html .= translate("LBL_YEAR") . ":<input class=\"text\" |
|
446 | + else if (strToUpper($part[0]) == "Y") |
|
447 | + $Web_To_Lead_Form_html .= translate("LBL_YEAR").":<input class=\"text\" |
|
448 | 448 | name=\"{$field1_name}_year\" size='4' maxlength='4' id='{$field1_name}_year' value='' |
449 | 449 | onblur=\"update{$field1_name}Value()\">"; |
450 | 450 | } |
451 | 451 | $Web_To_Lead_Form_html .= "</span></td>"; |
452 | 452 | } // if |
453 | - if( $field1_type=='varchar' || $field1_type=='name' |
|
454 | - || $field1_type=='phone' || $field1_type=='currency' || $field1_type=='url' || $field1_type=='int'){ |
|
455 | - if($field1_name=='last_name' || $field1_required){ |
|
453 | + if ($field1_type == 'varchar' || $field1_type == 'name' |
|
454 | + || $field1_type == 'phone' || $field1_type == 'currency' || $field1_type == 'url' || $field1_type == 'int') { |
|
455 | + if ($field1_name == 'last_name' || $field1_required) { |
|
456 | 456 | $Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field1_label</span sugar='slot'><span class='required' style='color: rgb(255, 0, 0);'>$web_required_symbol</span></td>"; |
457 | 457 | } |
458 | - else{ |
|
458 | + else { |
|
459 | 459 | $Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field1_label</span sugar='slot'></td>"; |
460 | 460 | } |
461 | - if ( $field1_name=='email1'||$field1_name=='email2' ){ |
|
461 | + if ($field1_name == 'email1' || $field1_name == 'email2') { |
|
462 | 462 | $Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'><input id=$field1_name name=$field1_name type='text' onchange='validateEmailAdd();'></span sugar='slot'></td>"; |
463 | 463 | } else { |
464 | 464 | $Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'><input id=$field1_name name=$field1_name type='text'></span sugar='slot'></td>"; |
465 | 465 | } |
466 | 466 | |
467 | 467 | } |
468 | - if ( $field1_type == 'text' ) { |
|
468 | + if ($field1_type == 'text') { |
|
469 | 469 | $Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field1_label</span sugar='slot'></td>"; |
470 | 470 | $Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span id='ta_replace' sugar='slot'><input id=$field1_name name=$field1_name type='text'></span sugar='slot'></td>"; |
471 | 471 | } |
472 | - if($field1_type=='relate' && $field1_name=='account_name'){ |
|
472 | + if ($field1_type == 'relate' && $field1_name == 'account_name') { |
|
473 | 473 | $Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field1_label</span sugar='slot'></td>"; |
474 | 474 | $Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'><input id=$field1_name name=$field1_name type='text'></span sugar='slot'></td>"; |
475 | 475 | } |
476 | - if($field1_type=='email'){ |
|
477 | - if($field1_required){ |
|
476 | + if ($field1_type == 'email') { |
|
477 | + if ($field1_required) { |
|
478 | 478 | $Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field1_label</span sugar='slot'><span class='required' style='color: rgb(255, 0, 0);'>$web_required_symbol</span></td>"; |
479 | 479 | } |
480 | - else{ |
|
480 | + else { |
|
481 | 481 | $Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field1_label</span sugar='slot'></td>"; |
482 | 482 | } |
483 | 483 | $Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'><input id=$field1_name name=$field1_name type='text' onchange='validateEmailAdd();'></span sugar='slot'></td>"; |
484 | 484 | } |
485 | 485 | } |
486 | - else{ |
|
486 | + else { |
|
487 | 487 | $Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'> </span sugar='slot'></td>"; |
488 | 488 | $Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'> </span sugar='slot'></td>"; |
489 | 489 | } |
@@ -492,46 +492,46 @@ discard block |
||
492 | 492 | |
493 | 493 | $Web_To_Lead_Form_html .= "<tr align='center' style='color: rgb(0, 105, 225); font-family: Arial,Verdana,Helvetica,sans-serif; font-size: 18px; font-weight: bold; margin-bottom: 0px; margin-top: 0px;'><TD COLSPAN='4'> </TD></tr>"; |
494 | 494 | |
495 | -if(!empty($web_form_footer)){ |
|
495 | +if (!empty($web_form_footer)) { |
|
496 | 496 | $Web_To_Lead_Form_html .= "<tr align='center' style='color: rgb(0, 105, 225); font-family: Arial,Verdana,Helvetica,sans-serif; font-size: 18px; font-weight: bold; margin-bottom: 0px; margin-top: 0px;'><TD COLSPAN='4'> </TD></tr>"; |
497 | 497 | $Web_To_Lead_Form_html .= "<tr align='left' style='color: rgb(0, 105, 225); font-family: Arial,Verdana,Helvetica,sans-serif; font-size: 12px; font-weight: normal; margin-bottom: 0px; margin-top: 0px;'><TD COLSPAN='4'>$web_form_footer</TD></tr>"; |
498 | 498 | } |
499 | 499 | |
500 | 500 | $Web_To_Lead_Form_html .= "<tr align='center'><td colspan='10'><input type='button' onclick='submit_form();' class='button' name='Submit' value='$web_form_submit_label'/></td></tr>"; |
501 | 501 | |
502 | -if(!empty($web_form_campaign)){ |
|
502 | +if (!empty($web_form_campaign)) { |
|
503 | 503 | $Web_To_Lead_Form_html .= "<tr><td style='display: none'><input type='hidden' id='campaign_id' name='campaign_id' value='$web_form_campaign'></td></tr>"; |
504 | 504 | } |
505 | -if(!empty($web_redirect_url)){ |
|
505 | +if (!empty($web_redirect_url)) { |
|
506 | 506 | $Web_To_Lead_Form_html .= "<tr><td style='display: none'><input type='hidden' id='redirect_url' name='redirect_url' value='$web_redirect_url'></td></tr>"; |
507 | 507 | } |
508 | -if(!empty($web_assigned_user)){ |
|
508 | +if (!empty($web_assigned_user)) { |
|
509 | 509 | $Web_To_Lead_Form_html .= "<tr><td style='display: none'><input type='hidden' id='assigned_user_id' name='assigned_user_id' value='$web_assigned_user'></td></tr>"; |
510 | 510 | } |
511 | -$req_fields=''; |
|
512 | -if(isset($required_fields) && $required_fields != null ){ |
|
513 | - foreach($required_fields as $req){ |
|
514 | - $req_fields=$req_fields.$req.';'; |
|
511 | +$req_fields = ''; |
|
512 | +if (isset($required_fields) && $required_fields != null) { |
|
513 | + foreach ($required_fields as $req) { |
|
514 | + $req_fields = $req_fields.$req.';'; |
|
515 | 515 | } |
516 | 516 | } |
517 | -$boolean_fields=''; |
|
518 | -if(isset($bool_fields) && $bool_fields != null ){ |
|
519 | - foreach($bool_fields as $boo){ |
|
520 | - $boolean_fields=$boolean_fields.$boo.';'; |
|
517 | +$boolean_fields = ''; |
|
518 | +if (isset($bool_fields) && $bool_fields != null) { |
|
519 | + foreach ($bool_fields as $boo) { |
|
520 | + $boolean_fields = $boolean_fields.$boo.';'; |
|
521 | 521 | } |
522 | 522 | } |
523 | -if(!empty($req_fields)){ |
|
523 | +if (!empty($req_fields)) { |
|
524 | 524 | $Web_To_Lead_Form_html .= "<tr><td style='display: none'><input type='hidden' id='req_id' name='req_id' value='$req_fields'></td></tr>"; |
525 | 525 | } |
526 | -if(!empty($boolean_fields)){ |
|
526 | +if (!empty($boolean_fields)) { |
|
527 | 527 | $Web_To_Lead_Form_html .= "<tr><td style='display: none'><input type='hidden' id='bool_id' name='bool_id' value='$boolean_fields'></td></tr>"; |
528 | 528 | } |
529 | 529 | |
530 | 530 | |
531 | 531 | $Web_To_Lead_Form_html .= "</table >"; |
532 | -$Web_To_Lead_Form_html .="</form>"; |
|
532 | +$Web_To_Lead_Form_html .= "</form>"; |
|
533 | 533 | |
534 | -$Web_To_Lead_Form_html .="<script type='text/javascript'> |
|
534 | +$Web_To_Lead_Form_html .= "<script type='text/javascript'> |
|
535 | 535 | function submit_form(){ |
536 | 536 | if(typeof(validateCaptchaAndSubmit)!='undefined'){ |
537 | 537 | validateCaptchaAndSubmit(); |
@@ -596,15 +596,15 @@ discard block |
||
596 | 596 | } |
597 | 597 | </script>"; |
598 | 598 | |
599 | -if(isset($Web_To_Lead_Form_html)) $xtpl->assign("BODY", $Web_To_Lead_Form_html); else $xtpl->assign("BODY", ""); |
|
600 | -if(isset($Web_To_Lead_Form_html)) $xtpl->assign("BODY_HTML", $Web_To_Lead_Form_html); else $xtpl->assign("BODY_HTML", ""); |
|
599 | +if (isset($Web_To_Lead_Form_html)) $xtpl->assign("BODY", $Web_To_Lead_Form_html); else $xtpl->assign("BODY", ""); |
|
600 | +if (isset($Web_To_Lead_Form_html)) $xtpl->assign("BODY_HTML", $Web_To_Lead_Form_html); else $xtpl->assign("BODY_HTML", ""); |
|
601 | 601 | |
602 | 602 | |
603 | 603 | require_once('include/SugarTinyMCE.php'); |
604 | 604 | $tiny = new SugarTinyMCE(); |
605 | -$tiny->defaultConfig['height']=400; |
|
606 | -$tiny->defaultConfig['apply_source_formatting']=true; |
|
607 | -$tiny->defaultConfig['cleanup']=false; |
|
605 | +$tiny->defaultConfig['height'] = 400; |
|
606 | +$tiny->defaultConfig['apply_source_formatting'] = true; |
|
607 | +$tiny->defaultConfig['cleanup'] = false; |
|
608 | 608 | $ed = $tiny->getInstance('body_html'); |
609 | 609 | $xtpl->assign("tiny", $ed); |
610 | 610 | |
@@ -619,12 +619,12 @@ discard block |
||
619 | 619 | $xtpl->parse("main"); |
620 | 620 | $xtpl->out("main"); |
621 | 621 | |
622 | -function ifRadioButton($customFieldName){ |
|
622 | +function ifRadioButton($customFieldName) { |
|
623 | 623 | $custRow = null; |
624 | - $query="select id,type from fields_meta_data where deleted = 0 and name = '$customFieldName'"; |
|
625 | - $result=$GLOBALS['db']->query($query); |
|
624 | + $query = "select id,type from fields_meta_data where deleted = 0 and name = '$customFieldName'"; |
|
625 | + $result = $GLOBALS['db']->query($query); |
|
626 | 626 | $row = $GLOBALS['db']->fetchByAssoc($result); |
627 | - if($row != null && $row['type'] == 'radioenum'){ |
|
627 | + if ($row != null && $row['type'] == 'radioenum') { |
|
628 | 628 | return $custRow = $row; |
629 | 629 | } |
630 | 630 | return $custRow; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -60,22 +60,22 @@ discard block |
||
60 | 60 | //name is used as key in post, it is also used in creation of summary page for wizard, |
61 | 61 | //so let's clean up the posting so we can reuse the save functionality for inbound emails and |
62 | 62 | //from existing save.php's |
63 | - foreach($camp_steps as $step){ |
|
63 | + foreach ($camp_steps as $step) { |
|
64 | 64 | clean_up_post($step); |
65 | 65 | } |
66 | 66 | /**************************** Save general Email Setup *****************************/ |
67 | 67 | |
68 | 68 | //we do not need to track location if location type is not set |
69 | -if(isset($_POST['tracking_entities_location_type'])) { |
|
69 | +if (isset($_POST['tracking_entities_location_type'])) { |
|
70 | 70 | if ($_POST['tracking_entities_location_type'] != '2') { |
71 | 71 | unset($_POST['tracking_entities_location']); |
72 | 72 | unset($_POST['tracking_entities_location_type']); |
73 | 73 | } |
74 | 74 | } |
75 | 75 | //if the check box is empty, then set it to 0 |
76 | -if(!isset($_POST['mail_smtpauth_req'])) { $_POST['mail_smtpauth_req'] = 0; } |
|
76 | +if (!isset($_POST['mail_smtpauth_req'])) { $_POST['mail_smtpauth_req'] = 0; } |
|
77 | 77 | //default ssl use to false |
78 | -if(!isset($_POST['mail_smtpssl'])) { $_POST['mail_smtpssl'] = 0; } |
|
78 | +if (!isset($_POST['mail_smtpssl'])) { $_POST['mail_smtpssl'] = 0; } |
|
79 | 79 | //reuse existing saveconfig functionality |
80 | 80 | $focus->saveConfig(); |
81 | 81 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | /**************************** Add New Monitored Box *****************************/ |
85 | 85 | //perform this if the option to create new mail box has been checked |
86 | -if(isset($_REQUEST['wiz_new_mbox']) && ($_REQUEST['wiz_new_mbox']=='1')){ |
|
86 | +if (isset($_REQUEST['wiz_new_mbox']) && ($_REQUEST['wiz_new_mbox'] == '1')) { |
|
87 | 87 | |
88 | 88 | //Populate the Request variables that inboundemail expects |
89 | 89 | $_REQUEST['mark_read'] = 1; |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | require_once('modules/InboundEmail/Save.php'); |
97 | 97 | |
98 | 98 | } |
99 | - if (!empty($_REQUEST['error'])){ |
|
99 | + if (!empty($_REQUEST['error'])) { |
|
100 | 100 | //an error was found during inbound save. This means the save was allowed but the inbound box had problems, return user to wizard |
101 | 101 | //and display error message |
102 | 102 | header("Location: index.php?action=WizardEmailSetup&module=Campaigns&error=true"); |
103 | - }else{ |
|
103 | + } else { |
|
104 | 104 | //set navigation details |
105 | 105 | header("Location: index.php?action=index&module=Campaigns"); |
106 | 106 | } |
@@ -111,18 +111,18 @@ discard block |
||
111 | 111 | * which does not expect the prefix, and still use the generic create summary functionality in wizard, which |
112 | 112 | * does expect the prefix. |
113 | 113 | */ |
114 | -function clean_up_post($prefix){ |
|
114 | +function clean_up_post($prefix) { |
|
115 | 115 | |
116 | 116 | foreach ($_REQUEST as $key => $val) { |
117 | - if((strstr($key, $prefix )) && (strpos($key, $prefix )== 0)){ |
|
118 | - $newkey =substr($key, strlen($prefix)) ; |
|
117 | + if ((strstr($key, $prefix)) && (strpos($key, $prefix) == 0)) { |
|
118 | + $newkey = substr($key, strlen($prefix)); |
|
119 | 119 | $_REQUEST[$newkey] = $val; |
120 | 120 | } |
121 | 121 | } |
122 | 122 | |
123 | 123 | foreach ($_POST as $key => $val) { |
124 | - if((strstr($key, $prefix )) && (strpos($key, $prefix )== 0)){ |
|
125 | - $newkey =substr($key, strlen($prefix)) ; |
|
124 | + if ((strstr($key, $prefix)) && (strpos($key, $prefix) == 0)) { |
|
125 | + $newkey = substr($key, strlen($prefix)); |
|
126 | 126 | $_POST[$newkey] = $val; |
127 | 127 | |
128 | 128 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | //create new campaign bean and populate |
53 | 53 | $campaign_focus = new Campaign(); |
54 | - if(isset($_REQUEST['record'])) { |
|
54 | + if (isset($_REQUEST['record'])) { |
|
55 | 55 | $campaign_focus->retrieve($_REQUEST['record']); |
56 | 56 | } |
57 | 57 | |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | |
61 | 61 | $campaign_focus = populateFromPost('', $campaign_focus); |
62 | 62 | |
63 | - foreach($camp_steps as $step){ |
|
64 | - $campaign_focus = populate_wizard_bean_from_request($campaign_focus,$step); |
|
63 | + foreach ($camp_steps as $step) { |
|
64 | + $campaign_focus = populate_wizard_bean_from_request($campaign_focus, $step); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | //save here so we can link relationships |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | //process prospect lists |
72 | 72 | |
73 | 73 | //process subscription lists if this is a newsletter |
74 | - if($campaign_focus->campaign_type =='NewsLetter'){ |
|
74 | + if ($campaign_focus->campaign_type == 'NewsLetter') { |
|
75 | 75 | $pl_list = process_subscriptions_from_request($campaign_focus->name); |
76 | 76 | |
77 | 77 | $campaign_focus->load_relationship('prospectlists'); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $ui_ids = array(); |
80 | 80 | |
81 | 81 | //for each list returned, add the list to the relationship |
82 | - foreach($pl_list as $pl){ |
|
82 | + foreach ($pl_list as $pl) { |
|
83 | 83 | $campaign_focus->prospectlists->add($pl->id); |
84 | 84 | //populate array with id's from UI' |
85 | 85 | $ui_ids[] = $pl->id; |
@@ -87,36 +87,36 @@ discard block |
||
87 | 87 | |
88 | 88 | //now remove the lists that may have existed before, but were not specified in UI. |
89 | 89 | //this will enforce that Newsletters only have 3 available target lists. |
90 | - foreach($existing_pls as $pl_del){ |
|
91 | - if (!in_array($pl_del, $ui_ids)){ |
|
90 | + foreach ($existing_pls as $pl_del) { |
|
91 | + if (!in_array($pl_del, $ui_ids)) { |
|
92 | 92 | $campaign_focus->prospectlists->delete($campaign_focus->id, $pl_del); |
93 | 93 | } |
94 | 94 | } |
95 | - }else{ |
|
95 | + } else { |
|
96 | 96 | //process target lists if this is not a newsletter |
97 | 97 | //remove Target Lists if defined |
98 | 98 | |
99 | - if(isset($_REQUEST['wiz_remove_target_list'])){ |
|
99 | + if (isset($_REQUEST['wiz_remove_target_list'])) { |
|
100 | 100 | |
101 | 101 | $remove_target_strings = explode(",", $_REQUEST['wiz_remove_target_list']); |
102 | - foreach($remove_target_strings as $remove_trgt_string){ |
|
103 | - if(!empty($remove_trgt_string)){ |
|
102 | + foreach ($remove_target_strings as $remove_trgt_string) { |
|
103 | + if (!empty($remove_trgt_string)) { |
|
104 | 104 | //load relationship and add to the list |
105 | 105 | $campaign_focus->load_relationship('prospectlists'); |
106 | - $campaign_focus->prospectlists->delete($campaign_focus->id,$remove_trgt_string); |
|
106 | + $campaign_focus->prospectlists->delete($campaign_focus->id, $remove_trgt_string); |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | } |
110 | 110 | |
111 | 111 | |
112 | 112 | //create new campaign tracker and save if defined |
113 | - if(isset($_REQUEST['wiz_list_of_targets'])){ |
|
113 | + if (isset($_REQUEST['wiz_list_of_targets'])) { |
|
114 | 114 | $target_strings = explode(",", $_REQUEST['wiz_list_of_targets']); |
115 | - foreach($target_strings as $trgt_string){ |
|
115 | + foreach ($target_strings as $trgt_string) { |
|
116 | 116 | $target_values = explode("@@", $trgt_string); |
117 | - if(count($target_values)==3){ |
|
117 | + if (count($target_values) == 3) { |
|
118 | 118 | |
119 | - if(!empty($target_values[0])){ |
|
119 | + if (!empty($target_values[0])) { |
|
120 | 120 | //this is a selected target, as the id is already populated, retrieve and link |
121 | 121 | $trgt_focus = new ProspectList(); |
122 | 122 | $trgt_focus->retrieve($target_values[0]); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | //load relationship and add to the list |
125 | 125 | $campaign_focus->load_relationship('prospectlists'); |
126 | 126 | $campaign_focus->prospectlists->add($trgt_focus ->id); |
127 | - }else{ |
|
127 | + } else { |
|
128 | 128 | |
129 | 129 | //this is a new target, as the id is not populated, need to create and link |
130 | 130 | $trgt_focus = new ProspectList(); |
@@ -149,27 +149,27 @@ discard block |
||
149 | 149 | |
150 | 150 | |
151 | 151 | //remove campaign trackers if defined |
152 | - if(isset($_REQUEST['wiz_remove_tracker_list'])){ |
|
152 | + if (isset($_REQUEST['wiz_remove_tracker_list'])) { |
|
153 | 153 | |
154 | 154 | $remove_tracker_strings = explode(",", $_REQUEST['wiz_remove_tracker_list']); |
155 | - foreach($remove_tracker_strings as $remove_trkr_string){ |
|
156 | - if(!empty($remove_trkr_string)){ |
|
155 | + foreach ($remove_tracker_strings as $remove_trkr_string) { |
|
156 | + if (!empty($remove_trkr_string)) { |
|
157 | 157 | //load relationship and add to the list |
158 | 158 | $campaign_focus->load_relationship('tracked_urls'); |
159 | - $campaign_focus->tracked_urls->delete($campaign_focus->id,$remove_trkr_string); |
|
159 | + $campaign_focus->tracked_urls->delete($campaign_focus->id, $remove_trkr_string); |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
164 | 164 | |
165 | 165 | //save campaign trackers and save if defined |
166 | - if(isset($_REQUEST['wiz_list_of_existing_trackers'])){ |
|
166 | + if (isset($_REQUEST['wiz_list_of_existing_trackers'])) { |
|
167 | 167 | $tracker_strings = explode(",", $_REQUEST['wiz_list_of_existing_trackers']); |
168 | - foreach($tracker_strings as $trkr_string){ |
|
168 | + foreach ($tracker_strings as $trkr_string) { |
|
169 | 169 | $tracker_values = explode("@@", $trkr_string); |
170 | 170 | $ct_focus = new CampaignTracker(); |
171 | 171 | $ct_focus->retrieve($tracker_values[0]); |
172 | - if(!empty($ct_focus->tracker_name)){ |
|
172 | + if (!empty($ct_focus->tracker_name)) { |
|
173 | 173 | $ct_focus->tracker_name = $tracker_values[1]; |
174 | 174 | $ct_focus->is_optout = $tracker_values[2]; |
175 | 175 | $ct_focus->tracker_url = $tracker_values[3]; |
@@ -184,11 +184,11 @@ discard block |
||
184 | 184 | |
185 | 185 | |
186 | 186 | //create new campaign tracker and save if defined |
187 | - if(isset($_REQUEST['wiz_list_of_trackers'])){ |
|
187 | + if (isset($_REQUEST['wiz_list_of_trackers'])) { |
|
188 | 188 | $tracker_strings = explode(",", $_REQUEST['wiz_list_of_trackers']); |
189 | - foreach($tracker_strings as $trkr_string){ |
|
189 | + foreach ($tracker_strings as $trkr_string) { |
|
190 | 190 | $tracker_values = explode("@@", $trkr_string); |
191 | - if(count($tracker_values)==3){ |
|
191 | + if (count($tracker_values) == 3) { |
|
192 | 192 | $ct_focus = new CampaignTracker(); |
193 | 193 | $ct_focus->tracker_name = $tracker_values[0]; |
194 | 194 | $ct_focus->is_optout = $tracker_values[1]; |
@@ -209,12 +209,12 @@ discard block |
||
209 | 209 | $_REQUEST['return_module'] = $campaign_focus->module_dir; |
210 | 210 | $_REQUEST['return_action'] = "WizardNewsLetter"; |
211 | 211 | $_REQUEST['action'] = "WizardMarketing"; |
212 | -$_REQUEST['record'] = $campaign_focus->id;; |
|
212 | +$_REQUEST['record'] = $campaign_focus->id; ; |
|
213 | 213 | |
214 | 214 | $action = ''; |
215 | -if(isset($_REQUEST['wiz_direction']) && $_REQUEST['wiz_direction']== 'continue'){ |
|
215 | +if (isset($_REQUEST['wiz_direction']) && $_REQUEST['wiz_direction'] == 'continue') { |
|
216 | 216 | $action = 'WizardMarketing'; |
217 | -}else{ |
|
217 | +} else { |
|
218 | 218 | $action = 'WizardHome&record='.$campaign_focus->id; |
219 | 219 | } |
220 | 220 | //require_once('modules/Campaigns/WizardMarketing.php'); |
@@ -228,12 +228,12 @@ discard block |
||
228 | 228 | * This function will populate the passed in bean with the post variables |
229 | 229 | * that contain the specified prefix |
230 | 230 | */ |
231 | -function populate_wizard_bean_from_request($bean,$prefix){ |
|
232 | - foreach($_REQUEST as $key=> $val){ |
|
231 | +function populate_wizard_bean_from_request($bean, $prefix) { |
|
232 | + foreach ($_REQUEST as $key=> $val) { |
|
233 | 233 | $key = trim($key); |
234 | - if((strstr($key, $prefix )) && (strpos($key, $prefix )== 0)){ |
|
235 | - $field =substr($key, strlen($prefix)) ; |
|
236 | - if(isset($_REQUEST[$key]) && !empty($_REQUEST[$key])){ |
|
234 | + if ((strstr($key, $prefix)) && (strpos($key, $prefix) == 0)) { |
|
235 | + $field = substr($key, strlen($prefix)); |
|
236 | + if (isset($_REQUEST[$key]) && !empty($_REQUEST[$key])) { |
|
237 | 237 | //echo "prefix is $prefix, field is $field, key is $key, and value is $val<br>"; |
238 | 238 | $value = $_REQUEST[$key]; |
239 | 239 | $bean->$field = $value; |
@@ -250,34 +250,34 @@ discard block |
||
250 | 250 | * If no prospect lists have been specified, then it will create one for you. A total of 3 prospect lists |
251 | 251 | * will be created for you (Subscription, Unsubscription, and test) |
252 | 252 | */ |
253 | -function process_subscriptions_from_request($campaign_name){ |
|
253 | +function process_subscriptions_from_request($campaign_name) { |
|
254 | 254 | global $mod_strings; |
255 | 255 | $pl_list = array(); |
256 | 256 | |
257 | 257 | //process default target list |
258 | 258 | $create_new = true; |
259 | 259 | $pl_subs = new ProspectList($campaign_name); |
260 | - if(!empty($_REQUEST['wiz_step3_subscription_list_id'])){ |
|
260 | + if (!empty($_REQUEST['wiz_step3_subscription_list_id'])) { |
|
261 | 261 | //if subscription list is specified then attach |
262 | 262 | $pl_subs->retrieve($_REQUEST['wiz_step3_subscription_list_id']); |
263 | 263 | //check to see name matches the bean, if not, then the user has chosen to create new bean |
264 | - if($pl_subs->name == $_REQUEST['wiz_step3_subscription_name']){ |
|
264 | + if ($pl_subs->name == $_REQUEST['wiz_step3_subscription_name']) { |
|
265 | 265 | $pl_list[] = $pl_subs; |
266 | 266 | $create_new = false; |
267 | 267 | } |
268 | 268 | |
269 | 269 | } |
270 | 270 | //create new bio if one was not retrieved successfully |
271 | - if($create_new){ |
|
271 | + if ($create_new) { |
|
272 | 272 | //use default name if one has not been specified |
273 | - $name = $campaign_name . " ".$mod_strings['LBL_SUBSCRIPTION_LIST']; |
|
274 | - if(isset($_REQUEST['wiz_step3_subscription_name']) && !empty($_REQUEST['wiz_step3_subscription_name'])){ |
|
273 | + $name = $campaign_name." ".$mod_strings['LBL_SUBSCRIPTION_LIST']; |
|
274 | + if (isset($_REQUEST['wiz_step3_subscription_name']) && !empty($_REQUEST['wiz_step3_subscription_name'])) { |
|
275 | 275 | $name = $_REQUEST['wiz_step3_subscription_name']; |
276 | 276 | } |
277 | 277 | //if subscription list is not specified then create and attach default one |
278 | 278 | $pl_subs->name = $name; |
279 | 279 | $pl_subs->list_type = 'default'; |
280 | - $pl_subs->assigned_user_id= $GLOBALS['current_user']->id; |
|
280 | + $pl_subs->assigned_user_id = $GLOBALS['current_user']->id; |
|
281 | 281 | $pl_subs->save(); |
282 | 282 | $pl_list[] = $pl_subs; |
283 | 283 | } |
@@ -285,27 +285,27 @@ discard block |
||
285 | 285 | //process exempt target list |
286 | 286 | $create_new = true; |
287 | 287 | $pl_un_subs = new ProspectList(); |
288 | - if(!empty($_REQUEST['wiz_step3_unsubscription_list_id'])){ |
|
288 | + if (!empty($_REQUEST['wiz_step3_unsubscription_list_id'])) { |
|
289 | 289 | //if unsubscription list is specified then attach |
290 | 290 | $pl_un_subs->retrieve($_REQUEST['wiz_step3_unsubscription_list_id']); |
291 | 291 | //check to see name matches the bean, if not, then the user has chosen to create new bean |
292 | - if($pl_un_subs->name == $_REQUEST['wiz_step3_unsubscription_name']){ |
|
292 | + if ($pl_un_subs->name == $_REQUEST['wiz_step3_unsubscription_name']) { |
|
293 | 293 | $pl_list[] = $pl_un_subs; |
294 | 294 | $create_new = false; |
295 | 295 | } |
296 | 296 | |
297 | 297 | } |
298 | 298 | //create new bean if one was not retrieved successfully |
299 | - if($create_new){ |
|
299 | + if ($create_new) { |
|
300 | 300 | //use default name if one has not been specified |
301 | - $name = $campaign_name . " ".$mod_strings['LBL_UNSUBSCRIPTION_LIST']; |
|
302 | - if(isset($_REQUEST['wiz_step3_unsubscription_name']) && !empty($_REQUEST['wiz_step3_unsubscription_name'])){ |
|
301 | + $name = $campaign_name." ".$mod_strings['LBL_UNSUBSCRIPTION_LIST']; |
|
302 | + if (isset($_REQUEST['wiz_step3_unsubscription_name']) && !empty($_REQUEST['wiz_step3_unsubscription_name'])) { |
|
303 | 303 | $name = $_REQUEST['wiz_step3_unsubscription_name']; |
304 | 304 | } |
305 | 305 | //if unsubscription list is not specified then create and attach default one |
306 | 306 | $pl_un_subs->name = $name; |
307 | 307 | $pl_un_subs->list_type = 'exempt'; |
308 | - $pl_un_subs->assigned_user_id= $GLOBALS['current_user']->id; |
|
308 | + $pl_un_subs->assigned_user_id = $GLOBALS['current_user']->id; |
|
309 | 309 | $pl_un_subs->save(); |
310 | 310 | $pl_list[] = $pl_un_subs; |
311 | 311 | } |
@@ -313,26 +313,26 @@ discard block |
||
313 | 313 | //process test target list |
314 | 314 | $pl_test = new ProspectList(); |
315 | 315 | $create_new = true; |
316 | - if(!empty($_REQUEST['wiz_step3_test_list_id'])){ |
|
316 | + if (!empty($_REQUEST['wiz_step3_test_list_id'])) { |
|
317 | 317 | //if test list is specified then attach |
318 | 318 | $pl_test->retrieve($_REQUEST['wiz_step3_test_list_id']); |
319 | 319 | //check to see name matches the bean, if not, then the user has chosen to create new bean |
320 | - if($pl_test->name == $_REQUEST['wiz_step3_test_name']){ |
|
320 | + if ($pl_test->name == $_REQUEST['wiz_step3_test_name']) { |
|
321 | 321 | $pl_list[] = $pl_test; |
322 | 322 | $create_new = false; |
323 | 323 | } |
324 | 324 | } |
325 | 325 | //create new bio if one was not retrieved successfully |
326 | - if($create_new){ |
|
326 | + if ($create_new) { |
|
327 | 327 | //use default name if one has not been specified |
328 | - $name = $campaign_name . " ".$mod_strings['LBL_TEST_LIST']; |
|
329 | - if(isset($_REQUEST['wiz_step3_test_name']) && !empty($_REQUEST['wiz_step3_test_name'])){ |
|
328 | + $name = $campaign_name." ".$mod_strings['LBL_TEST_LIST']; |
|
329 | + if (isset($_REQUEST['wiz_step3_test_name']) && !empty($_REQUEST['wiz_step3_test_name'])) { |
|
330 | 330 | $name = $_REQUEST['wiz_step3_test_name']; |
331 | 331 | } |
332 | 332 | //if test list is not specified then create and attach default one |
333 | 333 | $pl_test->name = $name; |
334 | 334 | $pl_test->list_type = 'test'; |
335 | - $pl_test->assigned_user_id= $GLOBALS['current_user']->id; |
|
335 | + $pl_test->assigned_user_id = $GLOBALS['current_user']->id; |
|
336 | 336 | $pl_test->save(); |
337 | 337 | $pl_list[] = $pl_test; |
338 | 338 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | $mod_strings = return_module_language($sugar_config['default_language'], 'Leads'); |
49 | 49 | |
50 | -$app_list_strings['record_type_module'] = array('Contact'=>'Contacts', 'Account'=>'Accounts', 'Opportunity'=>'Opportunities', 'Case'=>'Cases', 'Note'=>'Notes', 'Call'=>'Calls', 'Email'=>'Emails', 'Meeting'=>'Meetings', 'Task'=>'Tasks', 'Lead'=>'Leads','Bug'=>'Bugs', |
|
50 | +$app_list_strings['record_type_module'] = array('Contact'=>'Contacts', 'Account'=>'Accounts', 'Opportunity'=>'Opportunities', 'Case'=>'Cases', 'Note'=>'Notes', 'Call'=>'Calls', 'Email'=>'Emails', 'Meeting'=>'Meetings', 'Task'=>'Tasks', 'Lead'=>'Leads', 'Bug'=>'Bugs', |
|
51 | 51 | |
52 | 52 | ); |
53 | 53 | |
@@ -61,18 +61,18 @@ discard block |
||
61 | 61 | if (isset($_POST['campaign_id']) && !empty($_POST['campaign_id'])) { |
62 | 62 | //adding the client ip address |
63 | 63 | $_POST['client_id_address'] = query_client_ip(); |
64 | - $campaign_id=$_POST['campaign_id']; |
|
64 | + $campaign_id = $_POST['campaign_id']; |
|
65 | 65 | $campaign = new Campaign(); |
66 | 66 | $camp_query = "select name,id from campaigns where id='$campaign_id'"; |
67 | 67 | $camp_query .= " and deleted=0"; |
68 | - $camp_result=$campaign->db->query($camp_query); |
|
68 | + $camp_result = $campaign->db->query($camp_query); |
|
69 | 69 | $camp_data = $campaign->db->fetchByAssoc($camp_result); |
70 | 70 | // Bug 41292 - have to select marketing_id for new lead |
71 | 71 | $db = DBManagerFactory::getInstance(); |
72 | 72 | $marketing = new EmailMarketing(); |
73 | 73 | $marketing_query = $marketing->create_new_list_query( |
74 | 74 | 'date_start desc, date_modified desc', |
75 | - "campaign_id = '{$campaign_id}' and status = 'active' and date_start < " . $db->convert('', 'today'), |
|
75 | + "campaign_id = '{$campaign_id}' and status = 'active' and date_start < ".$db->convert('', 'today'), |
|
76 | 76 | array('id') |
77 | 77 | ); |
78 | 78 | $marketing_result = $db->limitQuery($marketing_query, 0, 1, true); |
@@ -83,22 +83,22 @@ discard block |
||
83 | 83 | $current_user->retrieve($_REQUEST['assigned_user_id']); |
84 | 84 | } |
85 | 85 | |
86 | - if(isset($camp_data) && $camp_data != null ){ |
|
86 | + if (isset($camp_data) && $camp_data != null) { |
|
87 | 87 | $leadForm = new LeadFormBase(); |
88 | 88 | $lead = new Lead(); |
89 | 89 | $prefix = ''; |
90 | - if(!empty($_POST['prefix'])){ |
|
90 | + if (!empty($_POST['prefix'])) { |
|
91 | 91 | $prefix = $_POST['prefix']; |
92 | 92 | } |
93 | 93 | |
94 | - if(empty($lead->id)) { |
|
94 | + if (empty($lead->id)) { |
|
95 | 95 | $lead->id = create_guid(); |
96 | 96 | $lead->new_with_id = true; |
97 | 97 | } |
98 | 98 | $GLOBALS['check_notify'] = true; |
99 | 99 | |
100 | 100 | //bug: 47574 - make sure, that webtolead_email1 field has same required attribute as email1 field |
101 | - if(isset($lead->required_fields['email1'])){ |
|
101 | + if (isset($lead->required_fields['email1'])) { |
|
102 | 102 | $lead->required_fields['webtolead_email1'] = $lead->required_fields['email1']; |
103 | 103 | } |
104 | 104 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | // checkRequired needs a major overhaul before it works for web to lead forms. |
115 | 115 | $lead = $leadForm->handleSave($prefix, false, false, false, $lead); |
116 | 116 | |
117 | - if(!empty($lead)){ |
|
117 | + if (!empty($lead)) { |
|
118 | 118 | |
119 | 119 | //create campaign log |
120 | 120 | $camplog = new CampaignLog(); |
@@ -123,9 +123,9 @@ discard block |
||
123 | 123 | $camplog->related_type = $lead->module_dir; |
124 | 124 | $camplog->activity_type = "lead"; |
125 | 125 | $camplog->target_type = $lead->module_dir; |
126 | - $campaign_log->activity_date=$timedate->now(); |
|
127 | - $camplog->target_id = $lead->id; |
|
128 | - if(isset($marketing_data['id'])) |
|
126 | + $campaign_log->activity_date = $timedate->now(); |
|
127 | + $camplog->target_id = $lead->id; |
|
128 | + if (isset($marketing_data['id'])) |
|
129 | 129 | { |
130 | 130 | $camplog->marketing_id = $marketing_data['id']; |
131 | 131 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | |
156 | 156 | $lead->load_relationship('campaigns'); |
157 | 157 | $lead->campaigns->add($camplog->id); |
158 | - if(!empty($GLOBALS['check_notify'])) { |
|
158 | + if (!empty($GLOBALS['check_notify'])) { |
|
159 | 159 | $lead->save($GLOBALS['check_notify']); |
160 | 160 | } |
161 | 161 | else { |
@@ -164,47 +164,47 @@ discard block |
||
164 | 164 | } |
165 | 165 | |
166 | 166 | //in case there are forms out there still using email_opt_out |
167 | - if(isset($_POST['webtolead_email_opt_out']) || isset($_POST['email_opt_out'])){ |
|
167 | + if (isset($_POST['webtolead_email_opt_out']) || isset($_POST['email_opt_out'])) { |
|
168 | 168 | |
169 | - if(isset ($lead->email1) && !empty($lead->email1)){ |
|
169 | + if (isset ($lead->email1) && !empty($lead->email1)) { |
|
170 | 170 | $sea = new SugarEmailAddress(); |
171 | - $sea->AddUpdateEmailAddress($lead->email1,0,1); |
|
171 | + $sea->AddUpdateEmailAddress($lead->email1, 0, 1); |
|
172 | 172 | } |
173 | - if(isset ($lead->email2) && !empty($lead->email2)){ |
|
173 | + if (isset ($lead->email2) && !empty($lead->email2)) { |
|
174 | 174 | $sea = new SugarEmailAddress(); |
175 | - $sea->AddUpdateEmailAddress($lead->email2,0,1); |
|
175 | + $sea->AddUpdateEmailAddress($lead->email2, 0, 1); |
|
176 | 176 | |
177 | 177 | } |
178 | 178 | } |
179 | - if(isset($_POST['redirect_url']) && !empty($_POST['redirect_url'])){ |
|
179 | + if (isset($_POST['redirect_url']) && !empty($_POST['redirect_url'])) { |
|
180 | 180 | // Get the redirect url, and make sure the query string is not too long |
181 | 181 | $redirect_url = $_POST['redirect_url']; |
182 | 182 | $query_string = ''; |
183 | 183 | $first_char = '&'; |
184 | - if(strpos($redirect_url, '?') === FALSE){ |
|
184 | + if (strpos($redirect_url, '?') === FALSE) { |
|
185 | 185 | $first_char = '?'; |
186 | 186 | } |
187 | 187 | $first_iteration = true; |
188 | 188 | $get_and_post = array_merge($_GET, $_POST); |
189 | - foreach($get_and_post as $param => $value) { |
|
189 | + foreach ($get_and_post as $param => $value) { |
|
190 | 190 | |
191 | - if($param == 'redirect_url' && $param == 'submit') |
|
191 | + if ($param == 'redirect_url' && $param == 'submit') |
|
192 | 192 | continue; |
193 | 193 | |
194 | - if($first_iteration){ |
|
194 | + if ($first_iteration) { |
|
195 | 195 | $first_iteration = false; |
196 | 196 | $query_string .= $first_char; |
197 | 197 | } |
198 | - else{ |
|
198 | + else { |
|
199 | 199 | $query_string .= "&"; |
200 | 200 | } |
201 | 201 | $query_string .= "{$param}=".urlencode($value); |
202 | 202 | } |
203 | - if(empty($lead)) { |
|
204 | - if($first_iteration){ |
|
203 | + if (empty($lead)) { |
|
204 | + if ($first_iteration) { |
|
205 | 205 | $query_string .= $first_char; |
206 | 206 | } |
207 | - else{ |
|
207 | + else { |
|
208 | 208 | $query_string .= "&"; |
209 | 209 | } |
210 | 210 | $query_string .= "error=1"; |
@@ -215,46 +215,46 @@ discard block |
||
215 | 215 | |
216 | 216 | // Check if the headers have been sent, or if the redirect url is greater than 2083 characters (IE max URL length) |
217 | 217 | // and use a javascript form submission if that is the case. |
218 | - if(headers_sent() || strlen($redirect_url) > 2083){ |
|
219 | - echo '<html ' . get_language_header() . '><head><title>SugarCRM</title></head><body>'; |
|
220 | - echo '<form name="redirect" action="' .$_POST['redirect_url']. '" method="GET">'; |
|
218 | + if (headers_sent() || strlen($redirect_url) > 2083) { |
|
219 | + echo '<html '.get_language_header().'><head><title>SugarCRM</title></head><body>'; |
|
220 | + echo '<form name="redirect" action="'.$_POST['redirect_url'].'" method="GET">'; |
|
221 | 221 | |
222 | - foreach($_POST as $param => $value) { |
|
223 | - if($param != 'redirect_url' ||$param != 'submit') { |
|
222 | + foreach ($_POST as $param => $value) { |
|
223 | + if ($param != 'redirect_url' || $param != 'submit') { |
|
224 | 224 | echo '<input type="hidden" name="'.$param.'" value="'.$value.'">'; |
225 | 225 | } |
226 | 226 | } |
227 | - if(empty($lead)) { |
|
227 | + if (empty($lead)) { |
|
228 | 228 | echo '<input type="hidden" name="error" value="1">'; |
229 | 229 | } |
230 | 230 | echo '</form><script language="javascript" type="text/javascript">document.redirect.submit();</script>'; |
231 | 231 | echo '</body></html>'; |
232 | 232 | } |
233 | - else{ |
|
233 | + else { |
|
234 | 234 | header("Location: {$redirect_url}"); |
235 | 235 | die(); |
236 | 236 | } |
237 | 237 | } |
238 | - else{ |
|
238 | + else { |
|
239 | 239 | echo $mod_strings['LBL_THANKS_FOR_SUBMITTING_LEAD']; |
240 | 240 | } |
241 | 241 | sugar_cleanup(); |
242 | 242 | // die to keep code from running into redirect case below |
243 | 243 | die(); |
244 | 244 | } |
245 | - else{ |
|
245 | + else { |
|
246 | 246 | echo $mod_strings['LBL_SERVER_IS_CURRENTLY_UNAVAILABLE']; |
247 | 247 | } |
248 | 248 | } |
249 | 249 | |
250 | 250 | if (!empty($_POST['redirect'])) { |
251 | - if(headers_sent()){ |
|
252 | - echo '<html ' . get_language_header() . '><head><title>SugarCRM</title></head><body>'; |
|
253 | - echo '<form name="redirect" action="' .$_POST['redirect']. '" method="GET">'; |
|
251 | + if (headers_sent()) { |
|
252 | + echo '<html '.get_language_header().'><head><title>SugarCRM</title></head><body>'; |
|
253 | + echo '<form name="redirect" action="'.$_POST['redirect'].'" method="GET">'; |
|
254 | 254 | echo '</form><script language="javascript" type="text/javascript">document.redirect.submit();</script>'; |
255 | 255 | echo '</body></html>'; |
256 | 256 | } |
257 | - else{ |
|
257 | + else { |
|
258 | 258 | header("Location: {$_POST['redirect']}"); |
259 | 259 | die(); |
260 | 260 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | function deleteTestRecords($focus) |
57 | 57 | { |
58 | - if(empty($focus) || empty($focus->id)) |
|
58 | + if (empty($focus) || empty($focus->id)) |
|
59 | 59 | { |
60 | 60 | return; |
61 | 61 | } |
@@ -65,17 +65,17 @@ discard block |
||
65 | 65 | WHERE campaign_log.campaign_id = '{$focus->id}' AND prospect_lists.list_type='test'"); |
66 | 66 | $test_ids = array(); |
67 | 67 | $test_list_ids = array(); |
68 | - while($row = $focus->db->fetchByAssoc($res)) { |
|
68 | + while ($row = $focus->db->fetchByAssoc($res)) { |
|
69 | 69 | $test_ids[] = $row['emailid']; |
70 | 70 | $test_list_ids[$row['listid']] = true; |
71 | 71 | } |
72 | 72 | $test_list_ids = array_keys($test_list_ids); |
73 | 73 | unset($res); |
74 | - if(!empty($test_ids)) { |
|
74 | + if (!empty($test_ids)) { |
|
75 | 75 | $focus->db->query("UPDATE emails SET deleted=1 WHERE id IN ('".join("','", $test_ids)."')"); |
76 | 76 | } |
77 | 77 | |
78 | - if(!empty($test_list_ids)) { |
|
78 | + if (!empty($test_list_ids)) { |
|
79 | 79 | $query = "DELETE FROM emailman WHERE campaign_id = '{$focus->id}' AND list_id IN ('".join("','", $test_list_ids)."')"; |
80 | 80 | $focus->db->query($query); |
81 | 81 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -55,30 +55,30 @@ discard block |
||
55 | 55 | require_once('modules/Campaigns/utils.php'); |
56 | 56 | |
57 | 57 | global $mod_strings, $app_list_strings, $app_strings, $current_user, $import_bean_map; |
58 | -global $import_file_name, $theme;$app_list_strings; |
|
58 | +global $import_file_name, $theme; $app_list_strings; |
|
59 | 59 | $lead = new Lead(); |
60 | 60 | $fields = array(); |
61 | 61 | |
62 | -$xtpl=new XTemplate ('modules/Campaigns/WebToLeadCreation.html'); |
|
62 | +$xtpl = new XTemplate('modules/Campaigns/WebToLeadCreation.html'); |
|
63 | 63 | $xtpl->assign("MOD", $mod_strings); |
64 | 64 | $xtpl->assign("APP", $app_strings); |
65 | -if(isset($_REQUEST['module'])) |
|
65 | +if (isset($_REQUEST['module'])) |
|
66 | 66 | { |
67 | 67 | $xtpl->assign("MODULE", $_REQUEST['module']); |
68 | 68 | } |
69 | -if(isset($_REQUEST['return_module'])) |
|
69 | +if (isset($_REQUEST['return_module'])) |
|
70 | 70 | { |
71 | 71 | $xtpl->assign("RETURN_MODULE", $_REQUEST['return_module']); |
72 | 72 | } |
73 | -if(isset($_REQUEST['return_id'])) |
|
73 | +if (isset($_REQUEST['return_id'])) |
|
74 | 74 | { |
75 | 75 | $xtpl->assign("RETURN_ID", $_REQUEST['return_id']); |
76 | 76 | } |
77 | -if(isset($_REQUEST['return_id'])) |
|
77 | +if (isset($_REQUEST['return_id'])) |
|
78 | 78 | { |
79 | 79 | $xtpl->assign("RETURN_ACTION", $_REQUEST['return_action']); |
80 | 80 | } |
81 | -if(isset($_REQUEST['record'])) |
|
81 | +if (isset($_REQUEST['record'])) |
|
82 | 82 | { |
83 | 83 | $xtpl->assign("RECORD", $_REQUEST['record']); |
84 | 84 | } |
@@ -132,69 +132,69 @@ discard block |
||
132 | 132 | ), |
133 | 133 | ); |
134 | 134 | $encoded_users_popup_request_data = $json->encode($popup_request_data); |
135 | -$xtpl->assign('encoded_campaigns_popup_request_data' , $json->encode($popup_request_data)); |
|
135 | +$xtpl->assign('encoded_campaigns_popup_request_data', $json->encode($popup_request_data)); |
|
136 | 136 | |
137 | 137 | //create the cancel button |
138 | 138 | $cancel_buttons_html = "<input class='button' onclick=\"this.form.action.value='".$_REQUEST['return_action']."'; this.form.module.value='".$_REQUEST['return_module']."';\" type='submit' name='cancel' value='".$app_strings['LBL_BACK']."'/>"; |
139 | -$xtpl->assign("CANCEL_BUTTON", $cancel_buttons_html ); |
|
139 | +$xtpl->assign("CANCEL_BUTTON", $cancel_buttons_html); |
|
140 | 140 | |
141 | 141 | $field_defs_js = "var field_defs = {'Contacts':["; |
142 | 142 | |
143 | 143 | //bug: 47574 - make sure, that webtolead_email1 field has same required attribute as email1 field |
144 | -if(isset($lead->field_defs['webtolead_email1']) && isset($lead->field_defs['email1']) && isset($lead->field_defs['email1']['required'])){ |
|
144 | +if (isset($lead->field_defs['webtolead_email1']) && isset($lead->field_defs['email1']) && isset($lead->field_defs['email1']['required'])) { |
|
145 | 145 | $lead->field_defs['webtolead_email1']['required'] = $lead->field_defs['email1']['required']; |
146 | 146 | } |
147 | 147 | |
148 | -$count= 0; |
|
149 | -foreach($lead->field_defs as $field_def) |
|
148 | +$count = 0; |
|
149 | +foreach ($lead->field_defs as $field_def) |
|
150 | 150 | { |
151 | 151 | $email_fields = false; |
152 | - if($field_def['name']== 'email1' || $field_def['name']== 'email2') |
|
152 | + if ($field_def['name'] == 'email1' || $field_def['name'] == 'email2') |
|
153 | 153 | { |
154 | 154 | $email_fields = true; |
155 | 155 | } |
156 | - if($field_def['name']!= 'account_name'){ |
|
157 | - if( ( $field_def['type'] == 'relate' && empty($field_def['custom_type']) ) |
|
158 | - || $field_def['type'] == 'assigned_user_name' || $field_def['type'] =='link' |
|
159 | - || (isset($field_def['source']) && $field_def['source']=='non-db' && !$email_fields) || $field_def['type'] == 'id') |
|
156 | + if ($field_def['name'] != 'account_name') { |
|
157 | + if (($field_def['type'] == 'relate' && empty($field_def['custom_type'])) |
|
158 | + || $field_def['type'] == 'assigned_user_name' || $field_def['type'] == 'link' |
|
159 | + || (isset($field_def['source']) && $field_def['source'] == 'non-db' && !$email_fields) || $field_def['type'] == 'id') |
|
160 | 160 | { |
161 | 161 | continue; |
162 | 162 | } |
163 | 163 | } |
164 | - if($field_def['name']== 'deleted' || $field_def['name']=='converted' || $field_def['name']=='date_entered' |
|
165 | - || $field_def['name']== 'date_modified' || $field_def['name']=='modified_user_id' |
|
166 | - || $field_def['name']=='assigned_user_id' || $field_def['name']=='created_by' |
|
167 | - || $field_def['name']=='team_id') |
|
164 | + if ($field_def['name'] == 'deleted' || $field_def['name'] == 'converted' || $field_def['name'] == 'date_entered' |
|
165 | + || $field_def['name'] == 'date_modified' || $field_def['name'] == 'modified_user_id' |
|
166 | + || $field_def['name'] == 'assigned_user_id' || $field_def['name'] == 'created_by' |
|
167 | + || $field_def['name'] == 'team_id') |
|
168 | 168 | { |
169 | 169 | continue; |
170 | 170 | } |
171 | 171 | |
172 | 172 | |
173 | - $field_def['vname'] = preg_replace('/:$/','',translate($field_def['vname'],'Leads')); |
|
173 | + $field_def['vname'] = preg_replace('/:$/', '', translate($field_def['vname'], 'Leads')); |
|
174 | 174 | |
175 | 175 | //$cols_name = "{'".$field_def['vname']."'}"; |
176 | 176 | $col_arr = array(); |
177 | - if((isset($field_def['required']) && $field_def['required'] != null && $field_def['required'] != 0) |
|
178 | - || $field_def['name']=='last_name' |
|
179 | - ){ |
|
180 | - $cols_name=$field_def['vname'].' '.$app_strings['LBL_REQUIRED_SYMBOL']; |
|
181 | - $col_arr[0]=$cols_name; |
|
182 | - $col_arr[1]=$field_def['name']; |
|
183 | - $col_arr[2]=true; |
|
177 | + if ((isset($field_def['required']) && $field_def['required'] != null && $field_def['required'] != 0) |
|
178 | + || $field_def['name'] == 'last_name' |
|
179 | + ) { |
|
180 | + $cols_name = $field_def['vname'].' '.$app_strings['LBL_REQUIRED_SYMBOL']; |
|
181 | + $col_arr[0] = $cols_name; |
|
182 | + $col_arr[1] = $field_def['name']; |
|
183 | + $col_arr[2] = true; |
|
184 | 184 | } |
185 | - else{ |
|
186 | - $cols_name=$field_def['vname']; |
|
187 | - $col_arr[0]=$cols_name; |
|
188 | - $col_arr[1]=$field_def['name']; |
|
185 | + else { |
|
186 | + $cols_name = $field_def['vname']; |
|
187 | + $col_arr[0] = $cols_name; |
|
188 | + $col_arr[1] = $field_def['name']; |
|
189 | 189 | } |
190 | - if (! in_array($cols_name, $fields)) |
|
190 | + if (!in_array($cols_name, $fields)) |
|
191 | 191 | { |
192 | - array_push($fields,$col_arr); |
|
192 | + array_push($fields, $col_arr); |
|
193 | 193 | } |
194 | 194 | $count++; |
195 | 195 | } |
196 | 196 | |
197 | -$xtpl->assign("WEB_POST_URL",$web_post_url); |
|
197 | +$xtpl->assign("WEB_POST_URL", $web_post_url); |
|
198 | 198 | //$xtpl->assign("LEAD_SELECT_FIELDS",'MOD.LBL_SELECT_LEAD_FIELDS'); |
199 | 199 | |
200 | 200 | require_once('include/QuickSearchDefaults.php'); |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | 'campaign_name' => $qsd->getQSCampaigns(), |
205 | 205 | |
206 | 206 | ); |
207 | -$quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '</script>'; |
|
207 | +$quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = '.$json->encode($sqs_objects).'</script>'; |
|
208 | 208 | $xtpl->assign("JAVASCRIPT", $quicksearch_js); |
209 | 209 | |
210 | 210 | |
@@ -213,30 +213,30 @@ discard block |
||
213 | 213 | if (empty($focus->assigned_name) && empty($focus->id)) $focus->assigned_user_name = $current_user->user_name; |
214 | 214 | $xtpl->assign("ASSIGNED_USER_OPTIONS", get_select_options_with_id(get_user_array(TRUE, "Active", $focus->assigned_user_id), $focus->assigned_user_id)); |
215 | 215 | $xtpl->assign("ASSIGNED_USER_NAME", $focus->assigned_user_name); |
216 | -$xtpl->assign("ASSIGNED_USER_ID", $focus->assigned_user_id ); |
|
216 | +$xtpl->assign("ASSIGNED_USER_ID", $focus->assigned_user_id); |
|
217 | 217 | |
218 | -$xtpl->assign("REDIRECT_URL_DEFAULT",'http://'); |
|
218 | +$xtpl->assign("REDIRECT_URL_DEFAULT", 'http://'); |
|
219 | 219 | |
220 | 220 | //required fields on Webtolead form |
221 | -$campaign= new Campaign(); |
|
221 | +$campaign = new Campaign(); |
|
222 | 222 | |
223 | 223 | $javascript = new javascript(); |
224 | 224 | $javascript->setFormName('WebToLeadCreation'); |
225 | 225 | $javascript->setSugarBean($lead); |
226 | 226 | $javascript->addAllFields(''); |
227 | 227 | //$javascript->addFieldGeneric('redirect_url', '', 'LBL_REDIRECT_URL' ,'true'); |
228 | -$javascript->addFieldGeneric('campaign_name', '', 'LBL_RELATED_CAMPAIGN' ,'true'); |
|
229 | -$javascript->addFieldGeneric('assigned_user_name', '', 'LBL_ASSIGNED_TO' ,'true'); |
|
230 | -$javascript->addToValidateBinaryDependency('campaign_name', 'alpha', $app_strings['ERR_SQS_NO_MATCH_FIELD'] . $mod_strings['LBL_LEAD_NOTIFY_CAMPAIGN'], 'false', '', 'campaign_id'); |
|
231 | -$javascript->addToValidateBinaryDependency('assigned_user_name', 'alpha', $app_strings['ERR_SQS_NO_MATCH_FIELD'] . $app_strings['LBL_ASSIGNED_TO'], 'false', '', 'assigned_user_id'); |
|
228 | +$javascript->addFieldGeneric('campaign_name', '', 'LBL_RELATED_CAMPAIGN', 'true'); |
|
229 | +$javascript->addFieldGeneric('assigned_user_name', '', 'LBL_ASSIGNED_TO', 'true'); |
|
230 | +$javascript->addToValidateBinaryDependency('campaign_name', 'alpha', $app_strings['ERR_SQS_NO_MATCH_FIELD'].$mod_strings['LBL_LEAD_NOTIFY_CAMPAIGN'], 'false', '', 'campaign_id'); |
|
231 | +$javascript->addToValidateBinaryDependency('assigned_user_name', 'alpha', $app_strings['ERR_SQS_NO_MATCH_FIELD'].$app_strings['LBL_ASSIGNED_TO'], 'false', '', 'assigned_user_id'); |
|
232 | 232 | echo $javascript->getScript(); |
233 | 233 | |
234 | 234 | $json = getJSONobj(); |
235 | 235 | $lead_fields = $json->encode($fields); |
236 | -$xtpl->assign("LEAD_FIELDS",$lead_fields); |
|
236 | +$xtpl->assign("LEAD_FIELDS", $lead_fields); |
|
237 | 237 | $classname = "SUGAR_GRID"; |
238 | -$xtpl->assign("CLASSNAME",$classname); |
|
239 | -$xtpl->assign("DRAG_DROP_CHOOSER_WEB_TO_LEAD",constructDDWebToLeadFields($fields,$classname)); |
|
238 | +$xtpl->assign("CLASSNAME", $classname); |
|
239 | +$xtpl->assign("DRAG_DROP_CHOOSER_WEB_TO_LEAD", constructDDWebToLeadFields($fields, $classname)); |
|
240 | 240 | |
241 | 241 | $xtpl->parse("main"); |
242 | 242 | $xtpl->out("main"); |
@@ -249,20 +249,20 @@ discard block |
||
249 | 249 | /* |
250 | 250 | *This function constructs Drag and Drop multiselect box of subscriptions for display in manage subscription form |
251 | 251 | */ |
252 | -function constructDDWebToLeadFields($fields,$classname){ |
|
252 | +function constructDDWebToLeadFields($fields, $classname) { |
|
253 | 253 | require_once("include/templates/TemplateDragDropChooser.php"); |
254 | 254 | global $mod_strings; |
255 | 255 | $d2 = array(); |
256 | 256 | //now call function that creates javascript for invoking DDChooser object |
257 | 257 | $dd_chooser = new TemplateDragDropChooser(); |
258 | - $dd_chooser->args['classname'] = $classname; |
|
258 | + $dd_chooser->args['classname'] = $classname; |
|
259 | 259 | $dd_chooser->args['left_header'] = $mod_strings['LBL_AVALAIBLE_FIELDS_HEADER']; |
260 | 260 | $dd_chooser->args['mid_header'] = $mod_strings['LBL_LEAD_FORM_FIRST_HEADER']; |
261 | 261 | $dd_chooser->args['right_header'] = $mod_strings['LBL_LEAD_FORM_SECOND_HEADER']; |
262 | 262 | $dd_chooser->args['left_data'] = $fields; |
263 | 263 | $dd_chooser->args['mid_data'] = $d2; |
264 | 264 | $dd_chooser->args['right_data'] = $d2; |
265 | - $dd_chooser->args['title'] = ' '; |
|
265 | + $dd_chooser->args['title'] = ' '; |
|
266 | 266 | $dd_chooser->args['left_div_name'] = 'ddgrid2'; |
267 | 267 | $dd_chooser->args['mid_div_name'] = 'ddgrid3'; |
268 | 268 | $dd_chooser->args['right_div_name'] = 'ddgrid4'; |
@@ -279,11 +279,11 @@ discard block |
||
279 | 279 | $str .= "<script> |
280 | 280 | function displayAddRemoveDragButtons(Add_All_Fields,Remove_All_Fields){ |
281 | 281 | var addRemove = document.getElementById('lead_add_remove_button'); |
282 | - if(" . $dd_chooser->args['classname'] . "_grid0.getDataModel().getTotalRowCount() ==0) { |
|
282 | + if(" . $dd_chooser->args['classname']."_grid0.getDataModel().getTotalRowCount() ==0) { |
|
283 | 283 | addRemove.setAttribute('value',Remove_All_Fields); |
284 | 284 | addRemove.setAttribute('title',Remove_All_Fields); |
285 | 285 | } |
286 | - else if(" . $dd_chooser->args['classname'] . "_grid1.getDataModel().getTotalRowCount() ==0 && " . $dd_chooser->args['classname'] . "_grid2.getDataModel().getTotalRowCount() ==0){ |
|
286 | + else if(" . $dd_chooser->args['classname']."_grid1.getDataModel().getTotalRowCount() ==0 && ".$dd_chooser->args['classname']."_grid2.getDataModel().getTotalRowCount() ==0){ |
|
287 | 287 | addRemove.setAttribute('value',Add_All_Fields); |
288 | 288 | addRemove.setAttribute('title',Add_All_Fields); |
289 | 289 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -52,10 +52,10 @@ discard block |
||
52 | 52 | |
53 | 53 | |
54 | 54 | |
55 | -global $mod_strings,$app_list_strings,$app_strings,$current_user; |
|
55 | +global $mod_strings, $app_list_strings, $app_strings, $current_user; |
|
56 | 56 | |
57 | 57 | |
58 | -if (!is_admin($current_user)&& !is_admin_for_module($GLOBALS['current_user'],'Campaigns')) sugar_die("Unauthorized access to administration."); |
|
58 | +if (!is_admin($current_user) && !is_admin_for_module($GLOBALS['current_user'], 'Campaigns')) sugar_die("Unauthorized access to administration."); |
|
59 | 59 | |
60 | 60 | $params = array(); |
61 | 61 | $params[] = "<a href='index.php?module=Campaigns&action=index'>{$mod_strings['LBL_MODULE_NAME']}</a>"; |
@@ -101,25 +101,25 @@ discard block |
||
101 | 101 | $ss->assign('PROTOCOL', get_select_options_with_id($protocol, '')); |
102 | 102 | if (isset($focus->settings['massemailer_campaign_emails_per_run']) && !empty($focus->settings['massemailer_campaign_emails_per_run'])) { |
103 | 103 | $ss->assign("EMAILS_PER_RUN", $focus->settings['massemailer_campaign_emails_per_run']); |
104 | -} else { |
|
104 | +} else { |
|
105 | 105 | $ss->assign("EMAILS_PER_RUN", 500); |
106 | 106 | } |
107 | 107 | |
108 | -if (!isset($focus->settings['massemailer_tracking_entities_location_type']) or empty($focus->settings['massemailer_tracking_entities_location_type']) or $focus->settings['massemailer_tracking_entities_location_type']=='1') { |
|
108 | +if (!isset($focus->settings['massemailer_tracking_entities_location_type']) or empty($focus->settings['massemailer_tracking_entities_location_type']) or $focus->settings['massemailer_tracking_entities_location_type'] == '1') { |
|
109 | 109 | $ss->assign("DEFAULT_CHECKED", "checked"); |
110 | 110 | $ss->assign("TRACKING_ENTRIES_LOCATION_STATE", "disabled"); |
111 | - $ss->assign("TRACKING_ENTRIES_LOCATION",$mod_strings['TRACKING_ENTRIES_LOCATION_DEFAULT_VALUE']); |
|
112 | -} else { |
|
111 | + $ss->assign("TRACKING_ENTRIES_LOCATION", $mod_strings['TRACKING_ENTRIES_LOCATION_DEFAULT_VALUE']); |
|
112 | +} else { |
|
113 | 113 | $ss->assign("USERDEFINED_CHECKED", "checked"); |
114 | - $ss->assign("TRACKING_ENTRIES_LOCATION",$focus->settings["massemailer_tracking_entities_location"]); |
|
114 | + $ss->assign("TRACKING_ENTRIES_LOCATION", $focus->settings["massemailer_tracking_entities_location"]); |
|
115 | 115 | } |
116 | 116 | |
117 | -$ss->assign("SITEURL",$sugar_config['site_url']); |
|
117 | +$ss->assign("SITEURL", $sugar_config['site_url']); |
|
118 | 118 | |
119 | 119 | // Change the default campaign to not store a copy of each message. |
120 | -if (!empty($focus->settings['massemailer_email_copy']) and $focus->settings['massemailer_email_copy']=='1') { |
|
120 | +if (!empty($focus->settings['massemailer_email_copy']) and $focus->settings['massemailer_email_copy'] == '1') { |
|
121 | 121 | $ss->assign("YES_CHECKED", "checked='checked'"); |
122 | -} else { |
|
122 | +} else { |
|
123 | 123 | $ss->assign("NO_CHECKED", "checked='checked'"); |
124 | 124 | } |
125 | 125 | |
@@ -129,25 +129,25 @@ discard block |
||
129 | 129 | /*********** New Mail Box UI DIV Stuff ****************/ |
130 | 130 | $mbox_qry = "select * from inbound_email where deleted ='0' and mailbox_type = 'bounce'"; |
131 | 131 | $mbox_res = $focus->db->query($mbox_qry); |
132 | -while ($mbox_row = $focus->db->fetchByAssoc($mbox_res)){$mbox[] = $mbox_row;} |
|
132 | +while ($mbox_row = $focus->db->fetchByAssoc($mbox_res)) {$mbox[] = $mbox_row; } |
|
133 | 133 | $mbox_msg = ' '; |
134 | 134 | $need_mbox = ''; |
135 | 135 | |
136 | 136 | $mboxTable = "<table class='list view' width='100%' border='0' cellspacing='1' cellpadding='1'>"; |
137 | -if(isset($mbox) && count($mbox)>0){ |
|
138 | - $mboxTable .= "<tr><td colspan='5'><b>" .count($mbox) ." ". $mod_strings['LBL_MAILBOX_CHECK_WIZ_GOOD']." </b>.</td></tr>"; |
|
137 | +if (isset($mbox) && count($mbox) > 0) { |
|
138 | + $mboxTable .= "<tr><td colspan='5'><b>".count($mbox)." ".$mod_strings['LBL_MAILBOX_CHECK_WIZ_GOOD']." </b>.</td></tr>"; |
|
139 | 139 | $mboxTable .= "<tr class='listViewHRS1'><td width='20%'><b>".$mod_strings['LBL_MAILBOX_NAME']."</b></td>" |
140 | 140 | . " <td width='20%'><b>".$mod_strings['LBL_LOGIN']."</b></td>" |
141 | 141 | . " <td width='20%'><b>".$mod_strings['LBL_MAILBOX']."</b></td>" |
142 | 142 | . " <td width='20%'><b>".$mod_strings['LBL_SERVER_URL']."</b></td>" |
143 | 143 | . " <td width='20%'><b>".$mod_strings['LBL_LIST_STATUS']."</b></td></tr>"; |
144 | - $colorclass=' '; |
|
145 | - foreach($mbox as $details){ |
|
144 | + $colorclass = ' '; |
|
145 | + foreach ($mbox as $details) { |
|
146 | 146 | |
147 | - if( $colorclass == "class='evenListRowS1'"){ |
|
148 | - $colorclass= "class='oddListRowS1'"; |
|
149 | - }else{ |
|
150 | - $colorclass= "class='evenListRowS1'"; |
|
147 | + if ($colorclass == "class='evenListRowS1'") { |
|
148 | + $colorclass = "class='oddListRowS1'"; |
|
149 | + } else { |
|
150 | + $colorclass = "class='evenListRowS1'"; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | $mboxTable .= "<tr $colorclass>"; |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | } |
160 | 160 | |
161 | 161 | |
162 | -}else{ |
|
162 | +} else { |
|
163 | 163 | $need_mbox = 'checked'; |
164 | 164 | $mboxTable .= "<tr><td colspan='5'><b>".$mod_strings['LBL_MAILBOX_CHECK_WIZ_BAD']." </b>.</td></tr>"; |
165 | 165 | } |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | $ss->assign("MAILBOXES_DETECTED_MESSAGE", $mboxTable); |
168 | 168 | $ss->assign("MBOX_NEEDED", $need_mbox); |
169 | 169 | $ss->assign('ROLLOVER', $email->rolloverStyle); |
170 | -if(!function_exists('imap_open')) { |
|
170 | +if (!function_exists('imap_open')) { |
|
171 | 171 | $ss->assign('IE_DISABLED', 'DISABLED'); |
172 | 172 | } |
173 | 173 | /**************************** SUMMARY UI DIV Stuff *******************/ |
@@ -406,13 +406,13 @@ discard block |
||
406 | 406 | </script> |
407 | 407 | EOQ; |
408 | 408 | |
409 | -if(isset($_REQUEST['error'])){ |
|
409 | +if (isset($_REQUEST['error'])) { |
|
410 | 410 | //if there is an error flagged, then we are coming here after a save where there was an error detected |
411 | 411 | //on an inbound email save. Display error to user so they are aware. |
412 | 412 | $errorString = "<div class='error'>".$mod_strings['ERR_NO_OPTS_SAVED']." <a href='index.php?module=InboundEmail&action=index'>".$mod_strings['ERR_REVIEW_EMAIL_SETTINGS']."</a></div>"; |
413 | 413 | $ss->assign('ERROR', $errorString); |
414 | 414 | //navigate to inbound email page by default |
415 | - $divScript .=" <script>navigate('next');</script>"; |
|
415 | + $divScript .= " <script>navigate('next');</script>"; |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | $ss->assign("DIV_JAVASCRIPT", $divScript); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -69,31 +69,31 @@ discard block |
||
69 | 69 | * @param string $email_description |
70 | 70 | * @return string |
71 | 71 | */ |
72 | -function createBouncedCampaignLogEntry($row,$email, $email_description) |
|
72 | +function createBouncedCampaignLogEntry($row, $email, $email_description) |
|
73 | 73 | { |
74 | 74 | $GLOBALS['log']->debug("Creating bounced email campaign log"); |
75 | 75 | $bounce = new CampaignLog(); |
76 | - $bounce->campaign_id=$row['campaign_id']; |
|
77 | - $bounce->target_tracker_key=$row['target_tracker_key']; |
|
78 | - $bounce->target_id= $row['target_id']; |
|
79 | - $bounce->target_type=$row['target_type']; |
|
80 | - $bounce->list_id=$row['list_id']; |
|
81 | - $bounce->marketing_id=$row['marketing_id']; |
|
76 | + $bounce->campaign_id = $row['campaign_id']; |
|
77 | + $bounce->target_tracker_key = $row['target_tracker_key']; |
|
78 | + $bounce->target_id = $row['target_id']; |
|
79 | + $bounce->target_type = $row['target_type']; |
|
80 | + $bounce->list_id = $row['list_id']; |
|
81 | + $bounce->marketing_id = $row['marketing_id']; |
|
82 | 82 | |
83 | - $bounce->activity_date=$email->date_created; |
|
84 | - $bounce->related_type='Emails'; |
|
85 | - $bounce->related_id= $email->id; |
|
83 | + $bounce->activity_date = $email->date_created; |
|
84 | + $bounce->related_type = 'Emails'; |
|
85 | + $bounce->related_id = $email->id; |
|
86 | 86 | |
87 | 87 | //do we have the phrase permanent error in the email body. |
88 | - if (preg_match('/permanent[ ]*error/',$email_description)) |
|
88 | + if (preg_match('/permanent[ ]*error/', $email_description)) |
|
89 | 89 | { |
90 | - $bounce->activity_type='invalid email'; |
|
90 | + $bounce->activity_type = 'invalid email'; |
|
91 | 91 | markEmailAddressInvalid($email); |
92 | 92 | } |
93 | 93 | else |
94 | - $bounce->activity_type='send error'; |
|
94 | + $bounce->activity_type = 'send error'; |
|
95 | 95 | |
96 | - $return_id=$bounce->save(); |
|
96 | + $return_id = $bounce->save(); |
|
97 | 97 | return $return_id; |
98 | 98 | } |
99 | 99 | |
@@ -104,11 +104,11 @@ discard block |
||
104 | 104 | */ |
105 | 105 | function markEmailAddressInvalid($email_address) |
106 | 106 | { |
107 | - if(empty($email_address)) |
|
107 | + if (empty($email_address)) |
|
108 | 108 | return; |
109 | 109 | $sea = new SugarEmailAddress(); |
110 | - $rs = $sea->retrieve_by_string_fields( array('email_address_caps' => trim(strtoupper($email_address))) ); |
|
111 | - if($rs != null) |
|
110 | + $rs = $sea->retrieve_by_string_fields(array('email_address_caps' => trim(strtoupper($email_address)))); |
|
111 | + if ($rs != null) |
|
112 | 112 | { |
113 | 113 | $sea->AddUpdateEmailAddress($email_address, 1, 0, $rs->id); |
114 | 114 | } |
@@ -124,10 +124,10 @@ discard block |
||
124 | 124 | { |
125 | 125 | $row = FALSE; |
126 | 126 | $targeted = new CampaignLog(); |
127 | - $where="campaign_log.activity_type='targeted' and campaign_log.target_tracker_key='{$identifier}'"; |
|
128 | - $query=$targeted->create_new_list_query('',$where); |
|
129 | - $result=$targeted->db->query($query); |
|
130 | - $row=$targeted->db->fetchByAssoc($result); |
|
127 | + $where = "campaign_log.activity_type='targeted' and campaign_log.target_tracker_key='{$identifier}'"; |
|
128 | + $query = $targeted->create_new_list_query('', $where); |
|
129 | + $result = $targeted->db->query($query); |
|
130 | + $row = $targeted->db->fetchByAssoc($result); |
|
131 | 131 | |
132 | 132 | return $row; |
133 | 133 | } |
@@ -144,15 +144,15 @@ discard block |
||
144 | 144 | $identifiers = array(); |
145 | 145 | $found = FALSE; |
146 | 146 | //Check if the identifier is present in the header. |
147 | - if(preg_match('/X-CampTrackID: [a-z0-9\-]*/',$email_description,$matches)) |
|
147 | + if (preg_match('/X-CampTrackID: [a-z0-9\-]*/', $email_description, $matches)) |
|
148 | 148 | { |
149 | - $identifiers = preg_split('/X-CampTrackID: /',$matches[0],-1,PREG_SPLIT_NO_EMPTY); |
|
149 | + $identifiers = preg_split('/X-CampTrackID: /', $matches[0], -1, PREG_SPLIT_NO_EMPTY); |
|
150 | 150 | $found = TRUE; |
151 | 151 | $GLOBALS['log']->debug("Found campaign identifier in header of email"); |
152 | 152 | } |
153 | - else if( preg_match('/index.php\?entryPoint=removeme&identifier=[a-z0-9\-]*/',$email_description, $matches) ) |
|
153 | + else if (preg_match('/index.php\?entryPoint=removeme&identifier=[a-z0-9\-]*/', $email_description, $matches)) |
|
154 | 154 | { |
155 | - $identifiers = preg_split('/index.php\?entryPoint=removeme&identifier=/',$matches[0],-1,PREG_SPLIT_NO_EMPTY); |
|
155 | + $identifiers = preg_split('/index.php\?entryPoint=removeme&identifier=/', $matches[0], -1, PREG_SPLIT_NO_EMPTY); |
|
156 | 156 | $found = TRUE; |
157 | 157 | $GLOBALS['log']->debug("Found campaign identifier in body of email"); |
158 | 158 | } |
@@ -167,21 +167,21 @@ discard block |
||
167 | 167 | $email_description = $email->raw_source; |
168 | 168 | |
169 | 169 | //if raw_source is empty, try using the description instead |
170 | - if (empty($email_description)){ |
|
170 | + if (empty($email_description)) { |
|
171 | 171 | $email_description = $email->description; |
172 | 172 | } |
173 | 173 | |
174 | 174 | $email_description .= retrieveErrorReportAttachment($email); |
175 | 175 | |
176 | - if (preg_match('/MAILER-DAEMON|POSTMASTER/i',$emailFromAddress)) |
|
176 | + if (preg_match('/MAILER-DAEMON|POSTMASTER/i', $emailFromAddress)) |
|
177 | 177 | { |
178 | - $email_description=quoted_printable_decode($email_description); |
|
179 | - $matches=array(); |
|
178 | + $email_description = quoted_printable_decode($email_description); |
|
179 | + $matches = array(); |
|
180 | 180 | |
181 | 181 | //do we have the identifier tag in the email? |
182 | 182 | $identifierScanResults = checkBouncedEmailForIdentifier($email_description); |
183 | 183 | |
184 | - if ( $identifierScanResults['found'] ) |
|
184 | + if ($identifierScanResults['found']) |
|
185 | 185 | { |
186 | 186 | $matches = $identifierScanResults['matches']; |
187 | 187 | $identifiers = $identifierScanResults['identifiers']; |
@@ -198,10 +198,10 @@ discard block |
||
198 | 198 | //do not create another campaign_log record is we already have an |
199 | 199 | //invalid email or send error entry for this tracker key. |
200 | 200 | $query_log = "select * from campaign_log where target_tracker_key='{$row['target_tracker_key']}'"; |
201 | - $query_log .=" and (activity_type='invalid email' or activity_type='send error')"; |
|
201 | + $query_log .= " and (activity_type='invalid email' or activity_type='send error')"; |
|
202 | 202 | $targeted = new CampaignLog(); |
203 | - $result_log=$targeted->db->query($query_log); |
|
204 | - $row_log=$targeted->db->fetchByAssoc($result_log); |
|
203 | + $result_log = $targeted->db->query($query_log); |
|
204 | + $row_log = $targeted->db->fetchByAssoc($result_log); |
|
205 | 205 | |
206 | 206 | if (empty($row_log)) |
207 | 207 | { |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -56,52 +56,52 @@ discard block |
||
56 | 56 | |
57 | 57 | //-----------begin replacing text input tags that have been marked with text area tags |
58 | 58 | //get array of text areas strings to process |
59 | -$bodyHTML = html_entity_decode($_REQUEST['body_html'],ENT_QUOTES); |
|
59 | +$bodyHTML = html_entity_decode($_REQUEST['body_html'], ENT_QUOTES); |
|
60 | 60 | //Bug53791 |
61 | 61 | $bodyHTML = str_replace(chr(160), " ", $bodyHTML); |
62 | 62 | |
63 | -while (strpos($bodyHTML, "ta_replace") !== false){ |
|
63 | +while (strpos($bodyHTML, "ta_replace") !== false) { |
|
64 | 64 | |
65 | 65 | //define the marker edges of the sub string to process (opening and closing tag brackets) |
66 | 66 | $marker = strpos($bodyHTML, "ta_replace"); |
67 | - $start_border = strpos($bodyHTML, "input", $marker) - 1;// to account for opening '<' char; |
|
67 | + $start_border = strpos($bodyHTML, "input", $marker) - 1; // to account for opening '<' char; |
|
68 | 68 | $end_border = strpos($bodyHTML, '>', $start_border); //get the closing tag after marker ">"; |
69 | 69 | |
70 | 70 | //extract the input tag string |
71 | - $working_str = substr($bodyHTML, $marker-3, $end_border-($marker-3) ); |
|
71 | + $working_str = substr($bodyHTML, $marker - 3, $end_border - ($marker - 3)); |
|
72 | 72 | |
73 | 73 | //replace input markup with text areas markups |
74 | - $new_str = str_replace('input','textarea',$working_str); |
|
74 | + $new_str = str_replace('input', 'textarea', $working_str); |
|
75 | 75 | $new_str = str_replace("type='text'", ' ', $new_str); |
76 | - $new_str = $new_str . '> </textarea'; |
|
76 | + $new_str = $new_str.'> </textarea'; |
|
77 | 77 | |
78 | 78 | //replace the marker with generic term |
79 | 79 | $new_str = str_replace('ta_replace', 'sugarslot', $new_str); |
80 | 80 | |
81 | 81 | //merge the processed string back into bodyhtml string |
82 | - $bodyHTML = str_replace($working_str , $new_str, $bodyHTML); |
|
82 | + $bodyHTML = str_replace($working_str, $new_str, $bodyHTML); |
|
83 | 83 | } |
84 | 84 | //<<<----------end replacing marked text inputs with text area tags |
85 | 85 | |
86 | 86 | $guid = create_guid(); |
87 | 87 | $form_file = "upload://$guid"; |
88 | 88 | |
89 | -$SugarTiny = new SugarTinyMCE(); |
|
89 | +$SugarTiny = new SugarTinyMCE(); |
|
90 | 90 | $html = $SugarTiny->cleanEncodedMCEHtml($bodyHTML); |
91 | 91 | |
92 | 92 | //Check to ensure we have <html> tags in the form. Without them, IE8 will attempt to display the page as XML. |
93 | 93 | if (stripos($html, "<html") === false) { |
94 | 94 | $langHeader = get_language_header(); |
95 | - $html = "<html {$langHeader}><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"></head><body>" . $html . "</body></html>"; |
|
95 | + $html = "<html {$langHeader}><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"></head><body>".$html."</body></html>"; |
|
96 | 96 | } |
97 | 97 | file_put_contents($form_file, $html); |
98 | 98 | |
99 | -$xtpl=new XTemplate ('modules/Campaigns/WebToLeadDownloadForm.html'); |
|
99 | +$xtpl = new XTemplate('modules/Campaigns/WebToLeadDownloadForm.html'); |
|
100 | 100 | $xtpl->assign("MOD", $mod_strings); |
101 | 101 | $xtpl->assign("APP", $app_strings); |
102 | 102 | $webformlink = "<b>$mod_strings[LBL_DOWNLOAD_TEXT_WEB_TO_LEAD_FORM]</b><br/>"; |
103 | 103 | $webformlink .= "<a href=\"index.php?entryPoint=download&id={$guid}&isTempFile=1&tempName=WebToLeadForm.html&type=temp\">$mod_strings[LBL_DOWNLOAD_WEB_TO_LEAD_FORM]</a>"; |
104 | -$xtpl->assign("LINK_TO_WEB_FORM",$webformlink); |
|
104 | +$xtpl->assign("LINK_TO_WEB_FORM", $webformlink); |
|
105 | 105 | $xtpl->assign("RAW_SOURCE", htmlspecialchars($html)); |
106 | 106 | $xtpl->parse("main.copy_source"); |
107 | 107 | $xtpl->parse("main"); |