Completed
Push — master ( a75ecc...97ae17 )
by Adam
71:21 queued 52:34
created
modules/Campaigns/WizardNewsletter.php 3 patches
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
     foreach($trkr_lists as $trkr_id){
295 295
         $ct_focus = new CampaignTracker();
296 296
         $ct_focus->retrieve($trkr_id);
297
-      if(isset($ct_focus->tracker_name) && !empty($ct_focus->tracker_name)){
297
+        if(isset($ct_focus->tracker_name) && !empty($ct_focus->tracker_name)){
298 298
             if($ct_focus->is_optout){$opt = 'checked';}else{$opt = '';}
299 299
             $trkr_html .= "<div id='existing_trkr".$trkr_count."'> <table width='100%' border='0' cellspacing='0' cellpadding='0'>" ;
300 300
             $trkr_html .= "<tr class='evenListRowS1'><td width='15%'><input name='wiz_step3_is_optout".$trkr_count."' title='".$mod_strings['LBL_EDIT_OPT_OUT'] . $trkr_count ."' id='existing_is_optout". $trkr_count ."' class='checkbox' type='checkbox' $opt  /><input name='wiz_step3_id".$trkr_count."' value='".$ct_focus->id."' id='existing_tracker_id". $trkr_count ."'type='hidden''/></td>";
@@ -305,8 +305,8 @@  discard block
 block discarded – undo
305 305
 
306 306
 
307 307
 
308
-      }
309
-      $trkr_count =$trkr_count+1;
308
+        }
309
+        $trkr_count =$trkr_count+1;
310 310
     }
311 311
     
312 312
     $trkr_html .= "<div id='no_trackers'></div>";
@@ -391,33 +391,33 @@  discard block
 block discarded – undo
391 391
 $prospect_lists = $focus->prospectlists->get();
392 392
 
393 393
 if((isset($_REQUEST['wizardtype']) && $_REQUEST['wizardtype'] ==1) || ($focus->campaign_type=='NewsLetter')){
394
- //this is a newsletter type campaign, fill in subscription values   
394
+    //this is a newsletter type campaign, fill in subscription values   
395 395
 
396 396
 //if prospect lists are returned, then iterate through and populate form values
397 397
 if(count($prospect_lists)>0){
398 398
     
399 399
     foreach($prospect_lists as $pl_id){
400 400
     //retrieve prospect list
401
-     $pl = new ProspectList();   
402
-     $pl->retrieve($pl_id);
401
+        $pl = new ProspectList();   
402
+        $pl->retrieve($pl_id);
403 403
 
404
-      if(isset($pl->list_type) && !empty($pl->list_type)){
405
-         //assign values based on type
406
-         if(($pl->list_type == 'default') || ($pl->list_type == 'seed')){            
404
+        if(isset($pl->list_type) && !empty($pl->list_type)){
405
+            //assign values based on type
406
+            if(($pl->list_type == 'default') || ($pl->list_type == 'seed')){            
407 407
             $ss->assign('SUBSCRIPTION_ID', $pl->id);
408 408
             $ss->assign('SUBSCRIPTION_NAME', $pl->name);
409
-         };
410
-         if($pl->list_type == 'exempt'){
409
+            };
410
+            if($pl->list_type == 'exempt'){
411 411
             $ss->assign('UNSUBSCRIPTION_ID', $pl->id);
412 412
             $ss->assign('UNSUBSCRIPTION_NAME', $pl->name);
413 413
          
414
-         };
415
-         if($pl->list_type == 'test'){
414
+            };
415
+            if($pl->list_type == 'test'){
416 416
             $ss->assign('TEST_ID', $pl->id);
417 417
             $ss->assign('TEST_NAME', $pl->name);
418 418
          
419
-         };
420
-      }
419
+            };
420
+        }
421 421
      
422 422
     }
423 423
 }
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
 
426 426
 
427 427
 }else{
428
- //this is not a newlsetter campaign, so fill in target list table
428
+    //this is not a newlsetter campaign, so fill in target list table
429 429
     //create array for javascript, this will help to display the option text, not the value
430 430
     $dom_txt =' ';
431 431
     foreach($app_list_strings['prospect_list_type_dom'] as $key=>$val){
@@ -438,19 +438,19 @@  discard block
 block discarded – undo
438 438
         
439 439
         foreach($prospect_lists as $pl_id){
440 440
         //retrieve prospect list
441
-             $pl = new ProspectList();   
442
-             $pl_focus = $pl->retrieve($pl_id);
443
-             $trgt_html .= "<div id='existing_trgt".$trgt_count."'> <table class='tabDetailViewDL2' width='100%'>" ;
444
-             $trgt_html .= "<td width='25%'> <input id='existing_target_name". $trgt_count ."' type='hidden' type='text' size='60' maxlength='255' name='existing_target_name". $trgt_count ."'  value='". $pl_focus->name."' >". $pl_focus->name."</td>";
445
-             $trgt_html .= "<td width='25%'><input type='hidden' size='60' maxlength='255' name='existing_tracker_list_type". $trgt_count ."'   id='existing_tracker_list_type". $trgt_count ."' value='".$pl_focus->list_type."' >".$app_list_strings['prospect_list_type_dom'][$pl_focus->list_type];
446
-             $trgt_html .= "<input type='hidden' name='added_target_id". $trgt_count ."' id='added_target_id". $trgt_count ."' value='". $pl_focus->id ."' ></td>";
447
-             $trgt_html .= "<td><a href='#' onclick=\"javascript:remove_existing_target('existing_trgt".$trgt_count."','".$pl_focus->id."'); \" >  ";
448
-             $trgt_html .= SugarThemeRegistry::current()->getImage('delete_inline', "border='0' align='absmiddle'", 12, 12, ".gif", $mod_strings['LBL_DELETE'])."</a></td></tr></table></div>";
441
+                $pl = new ProspectList();   
442
+                $pl_focus = $pl->retrieve($pl_id);
443
+                $trgt_html .= "<div id='existing_trgt".$trgt_count."'> <table class='tabDetailViewDL2' width='100%'>" ;
444
+                $trgt_html .= "<td width='25%'> <input id='existing_target_name". $trgt_count ."' type='hidden' type='text' size='60' maxlength='255' name='existing_target_name". $trgt_count ."'  value='". $pl_focus->name."' >". $pl_focus->name."</td>";
445
+                $trgt_html .= "<td width='25%'><input type='hidden' size='60' maxlength='255' name='existing_tracker_list_type". $trgt_count ."'   id='existing_tracker_list_type". $trgt_count ."' value='".$pl_focus->list_type."' >".$app_list_strings['prospect_list_type_dom'][$pl_focus->list_type];
446
+                $trgt_html .= "<input type='hidden' name='added_target_id". $trgt_count ."' id='added_target_id". $trgt_count ."' value='". $pl_focus->id ."' ></td>";
447
+                $trgt_html .= "<td><a href='#' onclick=\"javascript:remove_existing_target('existing_trgt".$trgt_count."','".$pl_focus->id."'); \" >  ";
448
+                $trgt_html .= SugarThemeRegistry::current()->getImage('delete_inline', "border='0' align='absmiddle'", 12, 12, ".gif", $mod_strings['LBL_DELETE'])."</a></td></tr></table></div>";
449 449
 
450 450
 
451 451
     
452 452
           
453
-          $trgt_count =$trgt_count +1;
453
+            $trgt_count =$trgt_count +1;
454 454
         }
455 455
         
456 456
         $trgt_html  .= "<div id='no_targets'></div>";
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
 
492 492
 
493 493
 //  this is the wizard control script that resides in page    
494
- $divScript = <<<EOQ
494
+    $divScript = <<<EOQ
495 495
 
496 496
  <script type="text/javascript" language="javascript">
497 497
    
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
         $nav_html .= "<tr><td scope='row' nowrap><div id='nav_step'".($i+2).">".$mod_strings['LBL_NAVIGATION_MENU_SEND_EMAIL']."</div></li>";
606 606
         $nav_html .= "<tr><td scope='row' nowrap><div id='nav_step'".($i+3).">".$summ_url."</div></td></tr>";
607 607
     }else{
608
-     $nav_html .= "<tr><td scope='row' nowrap><div id='nav_step'".($i+1).">".$summ_url."</div></td></tr>";   
608
+        $nav_html .= "<tr><td scope='row' nowrap><div id='nav_step'".($i+1).">".$summ_url."</div></td></tr>";   
609 609
     }
610 610
        
611 611
     $nav_html .= '</table>';
Please login to merge, or discard this patch.
Spacing   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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.
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
 /*************** GENERAL SETUP WORK **********/
65 65
 
66 66
 $focus = new Campaign();
67
-if(isset($_REQUEST['record'])) {
67
+if (isset($_REQUEST['record'])) {
68 68
     $focus->retrieve($_REQUEST['record']);
69 69
 }
70
-if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
70
+if (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
71 71
     $focus->id = "";
72 72
 }
73 73
 global $theme;
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
 
79 79
 $GLOBALS['log']->info("Campaign NewsLetter Wizard");
80 80
 
81
-if( (isset($_REQUEST['wizardtype'])  && $_REQUEST['wizardtype']==1)  ||  ($focus->campaign_type=='NewsLetter')){
81
+if ((isset($_REQUEST['wizardtype']) && $_REQUEST['wizardtype'] == 1) || ($focus->campaign_type == 'NewsLetter')) {
82 82
     echo getClassicModuleTitle($mod_strings['LBL_MODULE_NAME'], array($mod_strings['LBL_NEWSLETTER WIZARD_TITLE'].$focus->name), true, false);
83
-}else{
83
+} else {
84 84
     echo getClassicModuleTitle($mod_strings['LBL_MODULE_NAME'], array($mod_strings['LBL_CAMPAIGN'].$focus->name), true, false);   
85 85
 }
86 86
 
@@ -104,26 +104,26 @@  discard block
 block discarded – undo
104 104
 $sqs_objects = array('parent_name' => $qsd->getQSParent(), 
105 105
                     'assigned_user_name' => $qsd->getQSUser(),
106 106
                     //'prospect_list_name' => getProspectListQSObjects(),
107
-                    'test_name' => getProspectListQSObjects('prospect_list_type_test', 'test_name','wiz_step3_test_name_id'),
108
-                    'unsubscription_name' => getProspectListQSObjects('prospect_list_type_exempt', 'unsubscription_name','wiz_step3_unsubscription_name_id'),
109
-                    'subscription_name' => getProspectListQSObjects('prospect_list_type_default', 'subscription_name','wiz_step3_subscription_name_id'),
107
+                    'test_name' => getProspectListQSObjects('prospect_list_type_test', 'test_name', 'wiz_step3_test_name_id'),
108
+                    'unsubscription_name' => getProspectListQSObjects('prospect_list_type_exempt', 'unsubscription_name', 'wiz_step3_unsubscription_name_id'),
109
+                    'subscription_name' => getProspectListQSObjects('prospect_list_type_default', 'subscription_name', 'wiz_step3_subscription_name_id'),
110 110
                     );
111 111
                     
112 112
 
113
-$quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '</script>';
113
+$quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = '.$json->encode($sqs_objects).'</script>';
114 114
 
115 115
 $ss->assign("JAVASCRIPT", $quicksearch_js);
116 116
 
117 117
 
118 118
 //set the campaign type based on wizardtype value from request object
119 119
 $campaign_type = 'newsletter';
120
-if( (isset($_REQUEST['wizardtype'])  && $_REQUEST['wizardtype']==1)  ||  ($focus->campaign_type=='NewsLetter')){
120
+if ((isset($_REQUEST['wizardtype']) && $_REQUEST['wizardtype'] == 1) || ($focus->campaign_type == 'NewsLetter')) {
121 121
     $campaign_type = 'newsletter';
122 122
     $ss->assign("CAMPAIGN_DIAGNOSTIC_LINK", diagnose());    
123
-}elseif( (isset($_REQUEST['wizardtype'])  && $_REQUEST['wizardtype']==2)  || ($focus->campaign_type=='Email') ){
123
+}elseif ((isset($_REQUEST['wizardtype']) && $_REQUEST['wizardtype'] == 2) || ($focus->campaign_type == 'Email')) {
124 124
     $campaign_type = 'email';
125 125
     $ss->assign("CAMPAIGN_DIAGNOSTIC_LINK", diagnose());
126
-}else{
126
+} else {
127 127
     $campaign_type = 'general';
128 128
 }
129 129
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 
144 144
 //set default values
145 145
 $ss->assign("CALENDAR_LANG", "en");
146
-$ss->assign("USER_DATEFORMAT", '('. $timedate->get_user_date_format().')');
146
+$ss->assign("USER_DATEFORMAT", '('.$timedate->get_user_date_format().')');
147 147
 $ss->assign("CALENDAR_DATEFORMAT", $timedate->get_cal_date_format());
148 148
 $ss->assign("CAMP_DATE_ENTERED", $focus->date_entered);
149 149
 $ss->assign("CAMP_DATE_MODIFIED", $focus->date_modified);
@@ -166,50 +166,50 @@  discard block
 block discarded – undo
166 166
 if (empty($focus->assigned_name) && empty($focus->id))  $focus->assigned_user_name = $current_user->user_name;
167 167
 $ss->assign("ASSIGNED_USER_OPTIONS", get_select_options_with_id(get_user_array(TRUE, "Active", $focus->assigned_user_id), $focus->assigned_user_id));
168 168
 $ss->assign("ASSIGNED_USER_NAME", $focus->assigned_user_name);
169
-$ss->assign("ASSIGNED_USER_ID", $focus->assigned_user_id );
169
+$ss->assign("ASSIGNED_USER_ID", $focus->assigned_user_id);
170 170
 
171
-if((!isset($focus->status)) && (!isset($focus->id)))
171
+if ((!isset($focus->status)) && (!isset($focus->id)))
172 172
     $ss->assign("STATUS_OPTIONS", get_select_options_with_id($app_list_strings['campaign_status_dom'], 'Planning'));
173 173
 else
174 174
     $ss->assign("STATUS_OPTIONS", get_select_options_with_id($app_list_strings['campaign_status_dom'], $focus->status));
175 175
 
176 176
 //hide frequency options if this is not a newsletter
177
-if($campaign_type == 'newsletter'){
177
+if ($campaign_type == 'newsletter') {
178 178
     $ss->assign("HIDE_FREQUENCY_IF_NEWSLETTER", "Select");
179 179
     $ss->assign("FREQUENCY_LABEL", $mod_strings['LBL_CAMPAIGN_FREQUENCY']);
180
-    if((!isset($focus->frequency)) && (!isset($focus->id))){
180
+    if ((!isset($focus->frequency)) && (!isset($focus->id))) {
181 181
         $ss->assign("FREQ_OPTIONS", get_select_options_with_id($app_list_strings['newsletter_frequency_dom'], 'Monthly'));
182
-    }else{
182
+    } else {
183 183
         $ss->assign("FREQ_OPTIONS", get_select_options_with_id($app_list_strings['newsletter_frequency_dom'], $focus->frequency));
184 184
     }
185
-}else{
185
+} else {
186 186
     $ss->assign("HIDE_FREQUENCY_IF_NEWSLETTER", "input type='hidden'");
187 187
     $ss->assign("FREQUENCY_LABEL", '&nbsp;');
188 188
 }
189 189
 global $current_user;
190 190
 require_once('modules/Currencies/ListCurrency.php');
191 191
 $currency = new ListCurrency();
192
-if(isset($focus->currency_id) && !empty($focus->currency_id)){
192
+if (isset($focus->currency_id) && !empty($focus->currency_id)) {
193 193
     $selectCurrency = $currency->getSelectOptions($focus->currency_id);
194 194
     $ss->assign("CURRENCY", $selectCurrency);
195 195
 }
196
-else if($current_user->getPreference('currency') && !isset($focus->id))
196
+else if ($current_user->getPreference('currency') && !isset($focus->id))
197 197
 {
198 198
     $selectCurrency = $currency->getSelectOptions($current_user->getPreference('currency'));
199 199
     $ss->assign("CURRENCY", $selectCurrency);
200
-}else{
200
+} else {
201 201
 
202 202
     $selectCurrency = $currency->getSelectOptions();
203 203
     $ss->assign("CURRENCY", $selectCurrency);
204 204
 
205 205
 }
206 206
 global $current_user;
207
-if(is_admin($current_user) && $_REQUEST['module'] != 'DynamicLayout' && !empty($_SESSION['editinplace'])){  
207
+if (is_admin($current_user) && $_REQUEST['module'] != 'DynamicLayout' && !empty($_SESSION['editinplace'])) {  
208 208
     $record = '';
209
-    if(!empty($_REQUEST['record'])){
210
-        $record =   $_REQUEST['record'];
209
+    if (!empty($_REQUEST['record'])) {
210
+        $record = $_REQUEST['record'];
211 211
     }
212
-    $ss->assign("ADMIN_EDIT","<a href='index.php?action=index&module=DynamicLayout&from_action=".$_REQUEST['action'] ."&from_module=".$_REQUEST['module'] ."&record=".$record. "'>".SugarThemeRegistry::current()->getImage("EditLayout","border='0' align='bottom'",null,null,'.gif',$mod_strings['LBL_EDIT_LAYOUT'])."</a>");
212
+    $ss->assign("ADMIN_EDIT", "<a href='index.php?action=index&module=DynamicLayout&from_action=".$_REQUEST['action']."&from_module=".$_REQUEST['module']."&record=".$record."'>".SugarThemeRegistry::current()->getImage("EditLayout", "border='0' align='bottom'", null, null, '.gif', $mod_strings['LBL_EDIT_LAYOUT'])."</a>");
213 213
 
214 214
 }
215 215
 
@@ -221,54 +221,54 @@  discard block
 block discarded – undo
221 221
 
222 222
 
223 223
 //fill out the campaign type dropdown based on type of campaign being created
224
-if($campaign_type == 'general'){
224
+if ($campaign_type == 'general') {
225 225
     //get regular campaign dom object and strip out entries for email and newsletter
226 226
     $myTypeOptionsArr = array();
227 227
     $OptionsArr = $app_list_strings['campaign_type_dom'];
228
-    foreach($OptionsArr as $key=>$val){
229
-        if($val =='Newsletter' || $val =='Email' || $val =='' ){
228
+    foreach ($OptionsArr as $key=>$val) {
229
+        if ($val == 'Newsletter' || $val == 'Email' || $val == '') {
230 230
             //do not add   
231
-        }else{
231
+        } else {
232 232
             $myTypeOptionsArr[$key] = $val;
233 233
         }
234 234
     }
235 235
     
236 236
     //now create select option html without the newsletter/email, or blank ('') options
237
-    $type_option_html =' ';
237
+    $type_option_html = ' ';
238 238
     $selected = false;
239
-    foreach($myTypeOptionsArr as $optionKey=>$optionName){
239
+    foreach ($myTypeOptionsArr as $optionKey=>$optionName) {
240 240
         //if the selected flag is set to true, then just populate
241
-        if($selected){
242
-            $type_option_html .="<option value='$optionKey' >$optionName</option>";
243
-        }else{//if not selected yet, check to see if this option should be selected
241
+        if ($selected) {
242
+            $type_option_html .= "<option value='$optionKey' >$optionName</option>";
243
+        } else {//if not selected yet, check to see if this option should be selected
244 244
             //if the campaign type is not empty, then select the retrieved type
245
-            if(!empty($focus->campaign_type)){
245
+            if (!empty($focus->campaign_type)) {
246 246
                 //check to see if key matches campaign type
247
-                if($optionKey == $focus->campaign_type){
247
+                if ($optionKey == $focus->campaign_type) {
248 248
                     //mark as selected
249
-                    $type_option_html .="<option value='$optionKey' selected>$optionName</option>";
249
+                    $type_option_html .= "<option value='$optionKey' selected>$optionName</option>";
250 250
                     //mark as selected for next time
251
-                    $selected=true;
252
-                }else{
251
+                    $selected = true;
252
+                } else {
253 253
                     //key does not match, just populate
254
-                    $type_option_html .="<option value='$optionKey' >$optionName</option>";
254
+                    $type_option_html .= "<option value='$optionKey' >$optionName</option>";
255 255
                 }
256
-            }else{
256
+            } else {
257 257
             //since the campaign type is empty, then select first one                
258
-                $type_option_html .="<option value='$optionKey' selected>$optionName</option>";    
258
+                $type_option_html .= "<option value='$optionKey' selected>$optionName</option>";    
259 259
                 //mark as selected for next time
260
-                $selected=true;
260
+                $selected = true;
261 261
             }
262 262
         }    
263 263
     }
264 264
     //assign the modified dropdown for general campaign creation
265 265
     $ss->assign("CAMPAIGN_TYPE_OPTIONS", $type_option_html);
266 266
     $ss->assign("SHOULD_TYPE_BE_DISABLED", "select");    
267
-}elseif($campaign_type == 'email'){
267
+}elseif ($campaign_type == 'email') {
268 268
     //Assign Email as type of campaign being created an disable the select widget
269 269
     $ss->assign("CAMPAIGN_TYPE_OPTIONS", $mod_strings['LBL_EMAIL']);
270 270
     $ss->assign("SHOULD_TYPE_BE_DISABLED", "input type='hidden' value='Email'");
271
-}else{
271
+} else {
272 272
     //Assign NewsLetter as type of campaign being created an disable the select widget
273 273
     $ss->assign("CAMPAIGN_TYPE_OPTIONS", $mod_strings['LBL_NEWSLETTER']);
274 274
     $ss->assign("SHOULD_TYPE_BE_DISABLED", "input type='hidden' value='NewsLetter'");
@@ -284,33 +284,33 @@  discard block
 block discarded – undo
284 284
 $focus->load_relationship('tracked_urls');
285 285
 
286 286
 $trkr_lists = $focus->tracked_urls->get();
287
-$trkr_html ='';    
288
-$ss->assign('TRACKER_COUNT',count($trkr_lists));
289
-if(count($trkr_lists)>0){
287
+$trkr_html = '';    
288
+$ss->assign('TRACKER_COUNT', count($trkr_lists));
289
+if (count($trkr_lists) > 0) {
290 290
 global $odd_bg, $even_bg, $hilite_bg;
291 291
     
292 292
     $trkr_count = 0;
293 293
 //create the html to create tracker table
294
-    foreach($trkr_lists as $trkr_id){
294
+    foreach ($trkr_lists as $trkr_id) {
295 295
         $ct_focus = new CampaignTracker();
296 296
         $ct_focus->retrieve($trkr_id);
297
-      if(isset($ct_focus->tracker_name) && !empty($ct_focus->tracker_name)){
298
-            if($ct_focus->is_optout){$opt = 'checked';}else{$opt = '';}
299
-            $trkr_html .= "<div id='existing_trkr".$trkr_count."'> <table width='100%' border='0' cellspacing='0' cellpadding='0'>" ;
300
-            $trkr_html .= "<tr class='evenListRowS1'><td width='15%'><input name='wiz_step3_is_optout".$trkr_count."' title='".$mod_strings['LBL_EDIT_OPT_OUT'] . $trkr_count ."' id='existing_is_optout". $trkr_count ."' class='checkbox' type='checkbox' $opt  /><input name='wiz_step3_id".$trkr_count."' value='".$ct_focus->id."' id='existing_tracker_id". $trkr_count ."'type='hidden''/></td>";
301
-            $trkr_html .= "<td width='40%'> <input id='existing_tracker_name". $trkr_count ."' type='text' size='20' maxlength='255' name='wiz_step3_tracker_name". $trkr_count ."' title='".$mod_strings['LBL_EDIT_TRACKER_NAME']. $trkr_count ."' value='".$ct_focus->tracker_name."' ></td>";
302
-            $trkr_html .= "<td width='40%'><input type='text' size='60' maxlength='255' name='wiz_step3_tracker_url". $trkr_count ."' title='".$mod_strings['LBL_EDIT_TRACKER_URL']. $trkr_count ."' id='existing_tracker_url". $trkr_count ."' value='".$ct_focus->tracker_url."' ></td>";
297
+      if (isset($ct_focus->tracker_name) && !empty($ct_focus->tracker_name)) {
298
+            if ($ct_focus->is_optout) {$opt = 'checked'; } else {$opt = ''; }
299
+            $trkr_html .= "<div id='existing_trkr".$trkr_count."'> <table width='100%' border='0' cellspacing='0' cellpadding='0'>";
300
+            $trkr_html .= "<tr class='evenListRowS1'><td width='15%'><input name='wiz_step3_is_optout".$trkr_count."' title='".$mod_strings['LBL_EDIT_OPT_OUT'].$trkr_count."' id='existing_is_optout".$trkr_count."' class='checkbox' type='checkbox' $opt  /><input name='wiz_step3_id".$trkr_count."' value='".$ct_focus->id."' id='existing_tracker_id".$trkr_count."'type='hidden''/></td>";
301
+            $trkr_html .= "<td width='40%'> <input id='existing_tracker_name".$trkr_count."' type='text' size='20' maxlength='255' name='wiz_step3_tracker_name".$trkr_count."' title='".$mod_strings['LBL_EDIT_TRACKER_NAME'].$trkr_count."' value='".$ct_focus->tracker_name."' ></td>";
302
+            $trkr_html .= "<td width='40%'><input type='text' size='60' maxlength='255' name='wiz_step3_tracker_url".$trkr_count."' title='".$mod_strings['LBL_EDIT_TRACKER_URL'].$trkr_count."' id='existing_tracker_url".$trkr_count."' value='".$ct_focus->tracker_url."' ></td>";
303 303
             $trkr_html .= "<td><a href='#' onclick=\"javascript:remove_existing_tracker('existing_trkr".$trkr_count."','".$ct_focus->id."'); \" >  ";
304 304
             $trkr_html .= SugarThemeRegistry::current()->getImage('delete_inline', "border='0'  align='absmiddle'", 12, 12, ".gif", $mod_strings['LBL_DELETE'])."</a></td></tr></table></div>";
305 305
 
306 306
 
307 307
 
308 308
       }
309
-      $trkr_count =$trkr_count+1;
309
+      $trkr_count = $trkr_count + 1;
310 310
     }
311 311
     
312 312
     $trkr_html .= "<div id='no_trackers'></div>";
313
-    }else{
313
+    } else {
314 314
         $trkr_html .= "<div id='no_trackers'><table width='100%' border='0' cellspacing='0' cellpadding='0'><tr class='evenListRowS1'><td>".$mod_strings['LBL_NONE']."</td></tr></table></div>";
315 315
     }
316 316
     $ss->assign('EXISTING_TRACKERS', $trkr_html);
@@ -390,29 +390,29 @@  discard block
 block discarded – undo
390 390
 
391 391
 $prospect_lists = $focus->prospectlists->get();
392 392
 
393
-if((isset($_REQUEST['wizardtype']) && $_REQUEST['wizardtype'] ==1) || ($focus->campaign_type=='NewsLetter')){
393
+if ((isset($_REQUEST['wizardtype']) && $_REQUEST['wizardtype'] == 1) || ($focus->campaign_type == 'NewsLetter')) {
394 394
  //this is a newsletter type campaign, fill in subscription values   
395 395
 
396 396
 //if prospect lists are returned, then iterate through and populate form values
397
-if(count($prospect_lists)>0){
397
+if (count($prospect_lists) > 0) {
398 398
     
399
-    foreach($prospect_lists as $pl_id){
399
+    foreach ($prospect_lists as $pl_id) {
400 400
     //retrieve prospect list
401 401
      $pl = new ProspectList();   
402 402
      $pl->retrieve($pl_id);
403 403
 
404
-      if(isset($pl->list_type) && !empty($pl->list_type)){
404
+      if (isset($pl->list_type) && !empty($pl->list_type)) {
405 405
          //assign values based on type
406
-         if(($pl->list_type == 'default') || ($pl->list_type == 'seed')){            
406
+         if (($pl->list_type == 'default') || ($pl->list_type == 'seed')) {            
407 407
             $ss->assign('SUBSCRIPTION_ID', $pl->id);
408 408
             $ss->assign('SUBSCRIPTION_NAME', $pl->name);
409 409
          };
410
-         if($pl->list_type == 'exempt'){
410
+         if ($pl->list_type == 'exempt') {
411 411
             $ss->assign('UNSUBSCRIPTION_ID', $pl->id);
412 412
             $ss->assign('UNSUBSCRIPTION_NAME', $pl->name);
413 413
          
414 414
          };
415
-         if($pl->list_type == 'test'){
415
+         if ($pl->list_type == 'test') {
416 416
             $ss->assign('TEST_ID', $pl->id);
417 417
             $ss->assign('TEST_NAME', $pl->name);
418 418
          
@@ -424,67 +424,67 @@  discard block
 block discarded – undo
424 424
 
425 425
 
426 426
 
427
-}else{
427
+} else {
428 428
  //this is not a newlsetter campaign, so fill in target list table
429 429
     //create array for javascript, this will help to display the option text, not the value
430
-    $dom_txt =' ';
431
-    foreach($app_list_strings['prospect_list_type_dom'] as $key=>$val){
432
-        $dom_txt .="if(trgt_type_text =='$key'){trgt_type_text='$val';}";
430
+    $dom_txt = ' ';
431
+    foreach ($app_list_strings['prospect_list_type_dom'] as $key=>$val) {
432
+        $dom_txt .= "if(trgt_type_text =='$key'){trgt_type_text='$val';}";
433 433
     }
434 434
     $ss->assign("PL_DOM_STMT", $dom_txt); 
435 435
     $trgt_count = 0;
436 436
     $trgt_html = ' ';
437
-    if(count($prospect_lists)>0){
437
+    if (count($prospect_lists) > 0) {
438 438
         
439
-        foreach($prospect_lists as $pl_id){
439
+        foreach ($prospect_lists as $pl_id) {
440 440
         //retrieve prospect list
441 441
              $pl = new ProspectList();   
442 442
              $pl_focus = $pl->retrieve($pl_id);
443
-             $trgt_html .= "<div id='existing_trgt".$trgt_count."'> <table class='tabDetailViewDL2' width='100%'>" ;
444
-             $trgt_html .= "<td width='25%'> <input id='existing_target_name". $trgt_count ."' type='hidden' type='text' size='60' maxlength='255' name='existing_target_name". $trgt_count ."'  value='". $pl_focus->name."' >". $pl_focus->name."</td>";
445
-             $trgt_html .= "<td width='25%'><input type='hidden' size='60' maxlength='255' name='existing_tracker_list_type". $trgt_count ."'   id='existing_tracker_list_type". $trgt_count ."' value='".$pl_focus->list_type."' >".$app_list_strings['prospect_list_type_dom'][$pl_focus->list_type];
446
-             $trgt_html .= "<input type='hidden' name='added_target_id". $trgt_count ."' id='added_target_id". $trgt_count ."' value='". $pl_focus->id ."' ></td>";
443
+             $trgt_html .= "<div id='existing_trgt".$trgt_count."'> <table class='tabDetailViewDL2' width='100%'>";
444
+             $trgt_html .= "<td width='25%'> <input id='existing_target_name".$trgt_count."' type='hidden' type='text' size='60' maxlength='255' name='existing_target_name".$trgt_count."'  value='".$pl_focus->name."' >".$pl_focus->name."</td>";
445
+             $trgt_html .= "<td width='25%'><input type='hidden' size='60' maxlength='255' name='existing_tracker_list_type".$trgt_count."'   id='existing_tracker_list_type".$trgt_count."' value='".$pl_focus->list_type."' >".$app_list_strings['prospect_list_type_dom'][$pl_focus->list_type];
446
+             $trgt_html .= "<input type='hidden' name='added_target_id".$trgt_count."' id='added_target_id".$trgt_count."' value='".$pl_focus->id."' ></td>";
447 447
              $trgt_html .= "<td><a href='#' onclick=\"javascript:remove_existing_target('existing_trgt".$trgt_count."','".$pl_focus->id."'); \" >  ";
448 448
              $trgt_html .= SugarThemeRegistry::current()->getImage('delete_inline', "border='0' align='absmiddle'", 12, 12, ".gif", $mod_strings['LBL_DELETE'])."</a></td></tr></table></div>";
449 449
 
450 450
 
451 451
     
452 452
           
453
-          $trgt_count =$trgt_count +1;
453
+          $trgt_count = $trgt_count + 1;
454 454
         }
455 455
         
456 456
         $trgt_html  .= "<div id='no_targets'></div>";
457
-    }else{
457
+    } else {
458 458
         $trgt_html  .= "<div id='no_targets'><table width='100%' border='0' cellspacing='0' cellpadding='0'><tr class='evenListRowS1'><td>".$mod_strings['LBL_NONE']."</td></tr></table></div>";
459 459
         
460 460
     }
461
-    $ss->assign('EXISTING_TARGETS', $trgt_html );
461
+    $ss->assign('EXISTING_TARGETS', $trgt_html);
462 462
 
463 463
 }
464 464
 
465 465
     
466 466
 /**************************** WIZARD UI DIV Stuff *******************/
467 467
 $mrkt_string = $mod_strings['LBL_NAVIGATION_MENU_MARKETING'];
468
-if(!empty($focus->id)){
468
+if (!empty($focus->id)) {
469 469
     $mrkt_url = "<a  href='index.php?action=WizardMarketing&module=Campaigns&return_module=Campaigns&return_action=WizardHome";
470 470
     $mrkt_url .= "&return_id=".$focus->id."&campaign_id=".$focus->id;
471
-    $mrkt_url .= "'>". $mrkt_string."</a>";
471
+    $mrkt_url .= "'>".$mrkt_string."</a>";
472 472
     $mrkt_string = $mrkt_url;
473 473
 }
474 474
     $summ_url = $mod_strings['LBL_NAVIGATION_MENU_SUMMARY'];
475
-    if(!empty($focus->id)){
475
+    if (!empty($focus->id)) {
476 476
         $summ_url = "<a  href='index.php?action=WizardHome&module=Campaigns";
477 477
         $summ_url .= "&return_id=".$focus->id."&record=".$focus->id;
478
-        $summ_url .= "'> ". $mod_strings['LBL_NAVIGATION_MENU_SUMMARY']."</a>";
478
+        $summ_url .= "'> ".$mod_strings['LBL_NAVIGATION_MENU_SUMMARY']."</a>";
479 479
     } 
480 480
    
481 481
 
482 482
 
483
-$script_to_call ='';
484
-    if (!empty($focus->id)){
483
+$script_to_call = '';
484
+    if (!empty($focus->id)) {
485 485
         $script_to_call = "link_navs(1,4);";
486
-        if(isset($_REQUEST['direct_step']) and !empty($_REQUEST['direct_step'])){
487
-            $script_to_call .='   direct('.$_REQUEST['direct_step'].');';
486
+        if (isset($_REQUEST['direct_step']) and !empty($_REQUEST['direct_step'])) {
487
+            $script_to_call .= '   direct('.$_REQUEST['direct_step'].');';
488 488
         }
489 489
     } 
490 490
     $ss->assign("HILITE_ALL", $script_to_call);
@@ -524,24 +524,24 @@  discard block
 block discarded – undo
524 524
 
525 525
 //Create the html to fill in the wizard steps
526 526
 
527
-if($campaign_type == 'general'){
527
+if ($campaign_type == 'general') {
528 528
     $steps = create_campaign_steps();    
529
-    $ss->assign('NAV_ITEMS',create_wiz_menu_items($steps,'campaign',$mrkt_string,$summ_url));
530
-    $ss->assign('HIDE_CONTINUE','hidden');
529
+    $ss->assign('NAV_ITEMS', create_wiz_menu_items($steps, 'campaign', $mrkt_string, $summ_url));
530
+    $ss->assign('HIDE_CONTINUE', 'hidden');
531 531
 
532
-}elseif($campaign_type == 'email'){
532
+}elseif ($campaign_type == 'email') {
533 533
     $steps = create_email_steps();  
534
-    $ss->assign('NAV_ITEMS',create_wiz_menu_items($steps,'email',$mrkt_string,$summ_url));
535
-    $ss->assign('HIDE_CONTINUE','submit');
536
-}else{
534
+    $ss->assign('NAV_ITEMS', create_wiz_menu_items($steps, 'email', $mrkt_string, $summ_url));
535
+    $ss->assign('HIDE_CONTINUE', 'submit');
536
+} else {
537 537
     $steps = create_newsletter_steps();  
538
-    $ss->assign('NAV_ITEMS',create_wiz_menu_items($steps,'newsletter',$mrkt_string,$summ_url));
539
-    $ss->assign('HIDE_CONTINUE','submit');
538
+    $ss->assign('NAV_ITEMS', create_wiz_menu_items($steps, 'newsletter', $mrkt_string, $summ_url));
539
+    $ss->assign('HIDE_CONTINUE', 'submit');
540 540
 }
541 541
 
542 542
 $ss->assign('TOTAL_STEPS', count($steps));
543
-$sshtml = create_wiz_step_divs($steps,$ss);
544
-$ss->assign('STEPS',$sshtml);
543
+$sshtml = create_wiz_step_divs($steps, $ss);
544
+$ss->assign('STEPS', $sshtml);
545 545
      	   	
546 546
 
547 547
 /**************************** FINAL END OF PAGE UI Stuff *******************/
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 $ss->display(file_exists('custom/modules/Campaigns/tpls/WizardNewsletter.tpl') ? 'custom/modules/Campaigns/tpls/WizardNewsletter.tpl' : 'modules/Campaigns/tpls/WizardNewsletter.tpl');
550 550
 
551 551
 
552
-function create_newsletter_steps(){
552
+function create_newsletter_steps() {
553 553
     global $mod_strings;
554 554
     $steps[$mod_strings['LBL_NAVIGATION_MENU_GEN1']]          = file_exists('custom/modules/Campaigns/tpls/WizardCampaignHeader.tpl') ? 'custom/modules/Campaigns/tpls/WizardCampaignHeader.tpl' : 'modules/Campaigns/tpls/WizardCampaignHeader.tpl';
555 555
     $steps[$mod_strings['LBL_NAVIGATION_MENU_GEN2']]          = file_exists('custom/modules/Campaigns/tpls/WizardCampaignBudget.tpl') ? 'custom/modules/Campaigns/tpls/WizardCampaignBudget.tpl' : 'modules/Campaigns/tpls/WizardCampaignBudget.tpl';
@@ -558,54 +558,54 @@  discard block
 block discarded – undo
558 558
     return  $steps;
559 559
 }
560 560
 
561
-function create_campaign_steps(){
561
+function create_campaign_steps() {
562 562
     global $mod_strings;
563 563
     $steps[$mod_strings['LBL_NAVIGATION_MENU_GEN1']]          = file_exists('custom/modules/Campaigns/tpls/WizardCampaignHeader.tpl') ? 'custom/modules/Campaigns/tpls/WizardCampaignHeader.tpl' : 'modules/Campaigns/tpls/WizardCampaignHeader.tpl';
564 564
     $steps[$mod_strings['LBL_NAVIGATION_MENU_GEN2']]          = file_exists('custom/modules/Campaigns/tpls/WizardCampaignBudget.tpl') ? 'custom/modules/Campaigns/tpls/WizardCampaignBudget.tpl' : 'modules/Campaigns/tpls/WizardCampaignBudget.tpl';
565
-    $steps[$mod_strings['LBL_TARGET_LISTS']]                   = file_exists('custom/modules/Campaigns/tpls/WizardCampaignTargetListForNonNewsLetter.tpl') ? 'custom/modules/Campaigns/tpls/WizardCampaignTargetListForNonNewsLetter.tpl' : 'modules/Campaigns/tpls/WizardCampaignTargetListForNonNewsLetter.tpl';
565
+    $steps[$mod_strings['LBL_TARGET_LISTS']] = file_exists('custom/modules/Campaigns/tpls/WizardCampaignTargetListForNonNewsLetter.tpl') ? 'custom/modules/Campaigns/tpls/WizardCampaignTargetListForNonNewsLetter.tpl' : 'modules/Campaigns/tpls/WizardCampaignTargetListForNonNewsLetter.tpl';
566 566
     return  $steps;
567 567
 }
568 568
 
569
-function create_email_steps(){
569
+function create_email_steps() {
570 570
     global $mod_strings;
571 571
     $steps[$mod_strings['LBL_NAVIGATION_MENU_GEN1']]          = file_exists('custom/modules/Campaigns/tpls/WizardCampaignHeader.tpl') ? 'custom/modules/Campaigns/tpls/WizardCampaignHeader.tpl' : 'modules/Campaigns/tpls/WizardCampaignHeader.tpl';
572 572
     $steps[$mod_strings['LBL_NAVIGATION_MENU_GEN2']]          = file_exists('custom/modules/Campaigns/tpls/WizardCampaignBudget.tpl') ? 'custom/modules/Campaigns/tpls/WizardCampaignBudget.tpl' : 'modules/Campaigns/tpls/WizardCampaignBudget.tpl';
573 573
     $steps[$mod_strings['LBL_NAVIGATION_MENU_TRACKERS']]      = file_exists('custom/modules/Campaigns/tpls/WizardCampaignTracker.tpl') ? 'custom/modules/Campaigns/tpls/WizardCampaignTracker.tpl' : 'modules/Campaigns/tpls/WizardCampaignTracker.tpl';
574
-    $steps[$mod_strings['LBL_TARGET_LISTS']]                   = file_exists('custom/modules/Campaigns/tpls/WizardCampaignTargetListForNonNewsLetter.tpl') ? 'custom/modules/Campaigns/tpls/WizardCampaignTargetListForNonNewsLetter.tpl' : 'modules/Campaigns/tpls/WizardCampaignTargetListForNonNewsLetter.tpl';
574
+    $steps[$mod_strings['LBL_TARGET_LISTS']] = file_exists('custom/modules/Campaigns/tpls/WizardCampaignTargetListForNonNewsLetter.tpl') ? 'custom/modules/Campaigns/tpls/WizardCampaignTargetListForNonNewsLetter.tpl' : 'modules/Campaigns/tpls/WizardCampaignTargetListForNonNewsLetter.tpl';
575 575
     return  $steps;
576 576
 }
577 577
 
578 578
 
579
-function create_wiz_step_divs($steps,$ss){
579
+function create_wiz_step_divs($steps, $ss) {
580 580
     $step_html = '';
581
-    if(isset($steps)  && !empty($steps)){
582
-        $i=1;
583
-        foreach($steps as $name=>$step){
584
-            $step_html .="<p><div id='step$i'>";
581
+    if (isset($steps) && !empty($steps)) {
582
+        $i = 1;
583
+        foreach ($steps as $name=>$step) {
584
+            $step_html .= "<p><div id='step$i'>";
585 585
             $step_html .= $ss->fetch($step);
586
-            $step_html .="</div></p>";
587
-            $i = $i+1;
586
+            $step_html .= "</div></p>";
587
+            $i = $i + 1;
588 588
         }    
589 589
     }
590 590
     return $step_html;
591 591
 }
592 592
  
593
-function create_wiz_menu_items($steps,$type,$mrkt_string,$summ_url){
593
+function create_wiz_menu_items($steps, $type, $mrkt_string, $summ_url) {
594 594
     global $mod_strings;
595 595
     $nav_html = '<table border="0" cellspacing="0" cellpadding="0" width="100%" >';
596
-    if(isset($steps)  && !empty($steps)){
597
-        $i=1;
598
-        foreach($steps as $name=>$step){
596
+    if (isset($steps) && !empty($steps)) {
597
+        $i = 1;
598
+        foreach ($steps as $name=>$step) {
599 599
             $nav_html .= "<tr><td scope='row' nowrap><div id='nav_step$i'>$name</div></td></tr>";
600
-            $i=$i+1;
600
+            $i = $i + 1;
601 601
         }
602 602
     }
603
-    if($type == 'newsletter'  ||  $type == 'email'){
604
-        $nav_html .= "<tr><td scope='row' nowrap><div id='nav_step'".($i+1).">$mrkt_string</div></td></tr>";
605
-        $nav_html .= "<tr><td scope='row' nowrap><div id='nav_step'".($i+2).">".$mod_strings['LBL_NAVIGATION_MENU_SEND_EMAIL']."</div></li>";
606
-        $nav_html .= "<tr><td scope='row' nowrap><div id='nav_step'".($i+3).">".$summ_url."</div></td></tr>";
607
-    }else{
608
-     $nav_html .= "<tr><td scope='row' nowrap><div id='nav_step'".($i+1).">".$summ_url."</div></td></tr>";   
603
+    if ($type == 'newsletter' || $type == 'email') {
604
+        $nav_html .= "<tr><td scope='row' nowrap><div id='nav_step'".($i + 1).">$mrkt_string</div></td></tr>";
605
+        $nav_html .= "<tr><td scope='row' nowrap><div id='nav_step'".($i + 2).">".$mod_strings['LBL_NAVIGATION_MENU_SEND_EMAIL']."</div></li>";
606
+        $nav_html .= "<tr><td scope='row' nowrap><div id='nav_step'".($i + 3).">".$summ_url."</div></td></tr>";
607
+    } else {
608
+     $nav_html .= "<tr><td scope='row' nowrap><div id='nav_step'".($i + 1).">".$summ_url."</div></td></tr>";   
609 609
     }
610 610
        
611 611
     $nav_html .= '</table>';
Please login to merge, or discard this patch.
Braces   +41 added lines, -29 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -80,7 +82,7 @@  discard block
 block discarded – undo
80 82
 
81 83
 if( (isset($_REQUEST['wizardtype'])  && $_REQUEST['wizardtype']==1)  ||  ($focus->campaign_type=='NewsLetter')){
82 84
     echo getClassicModuleTitle($mod_strings['LBL_MODULE_NAME'], array($mod_strings['LBL_NEWSLETTER WIZARD_TITLE'].$focus->name), true, false);
83
-}else{
85
+} else{
84 86
     echo getClassicModuleTitle($mod_strings['LBL_MODULE_NAME'], array($mod_strings['LBL_CAMPAIGN'].$focus->name), true, false);   
85 87
 }
86 88
 
@@ -89,9 +91,15 @@  discard block
 block discarded – undo
89 91
 $ss->assign("MOD", $mod_strings);
90 92
 $ss->assign("APP", $app_strings);
91 93
 
92
-if (isset($_REQUEST['return_module'])) $ss->assign("RETURN_MODULE", $_REQUEST['return_module']);
93
-if (isset($_REQUEST['return_action'])) $ss->assign("RETURN_ACTION", $_REQUEST['return_action']);
94
-if (isset($_REQUEST['return_id'])) $ss->assign("RETURN_ID", $_REQUEST['return_id']);
94
+if (isset($_REQUEST['return_module'])) {
95
+    $ss->assign("RETURN_MODULE", $_REQUEST['return_module']);
96
+}
97
+if (isset($_REQUEST['return_action'])) {
98
+    $ss->assign("RETURN_ACTION", $_REQUEST['return_action']);
99
+}
100
+if (isset($_REQUEST['return_id'])) {
101
+    $ss->assign("RETURN_ID", $_REQUEST['return_id']);
102
+}
95 103
 // handle Create $module then Cancel
96 104
 if (empty($_REQUEST['return_id'])) {
97 105
     $ss->assign("RETURN_ACTION", 'index');
@@ -120,10 +128,10 @@  discard block
 block discarded – undo
120 128
 if( (isset($_REQUEST['wizardtype'])  && $_REQUEST['wizardtype']==1)  ||  ($focus->campaign_type=='NewsLetter')){
121 129
     $campaign_type = 'newsletter';
122 130
     $ss->assign("CAMPAIGN_DIAGNOSTIC_LINK", diagnose());    
123
-}elseif( (isset($_REQUEST['wizardtype'])  && $_REQUEST['wizardtype']==2)  || ($focus->campaign_type=='Email') ){
131
+} elseif( (isset($_REQUEST['wizardtype'])  && $_REQUEST['wizardtype']==2)  || ($focus->campaign_type=='Email') ){
124 132
     $campaign_type = 'email';
125 133
     $ss->assign("CAMPAIGN_DIAGNOSTIC_LINK", diagnose());
126
-}else{
134
+} else{
127 135
     $campaign_type = 'general';
128 136
 }
129 137
 
@@ -162,16 +170,21 @@  discard block
 block discarded – undo
162 170
 $ss->assign("CAMP_NAME", $focus->name);
163 171
 $ss->assign("CAMP_RECORD", $focus->id);
164 172
 $ss->assign("CAMP_IMPRESSIONS", $focus->impressions);
165
-if (empty($focus->assigned_user_id) && empty($focus->id))  $focus->assigned_user_id = $current_user->id;
166
-if (empty($focus->assigned_name) && empty($focus->id))  $focus->assigned_user_name = $current_user->user_name;
173
+if (empty($focus->assigned_user_id) && empty($focus->id)) {
174
+    $focus->assigned_user_id = $current_user->id;
175
+}
176
+if (empty($focus->assigned_name) && empty($focus->id)) {
177
+    $focus->assigned_user_name = $current_user->user_name;
178
+}
167 179
 $ss->assign("ASSIGNED_USER_OPTIONS", get_select_options_with_id(get_user_array(TRUE, "Active", $focus->assigned_user_id), $focus->assigned_user_id));
168 180
 $ss->assign("ASSIGNED_USER_NAME", $focus->assigned_user_name);
169 181
 $ss->assign("ASSIGNED_USER_ID", $focus->assigned_user_id );
170 182
 
171
-if((!isset($focus->status)) && (!isset($focus->id)))
183
+if((!isset($focus->status)) && (!isset($focus->id))) {
172 184
     $ss->assign("STATUS_OPTIONS", get_select_options_with_id($app_list_strings['campaign_status_dom'], 'Planning'));
173
-else
185
+} else {
174 186
     $ss->assign("STATUS_OPTIONS", get_select_options_with_id($app_list_strings['campaign_status_dom'], $focus->status));
187
+}
175 188
 
176 189
 //hide frequency options if this is not a newsletter
177 190
 if($campaign_type == 'newsletter'){
@@ -179,10 +192,10 @@  discard block
 block discarded – undo
179 192
     $ss->assign("FREQUENCY_LABEL", $mod_strings['LBL_CAMPAIGN_FREQUENCY']);
180 193
     if((!isset($focus->frequency)) && (!isset($focus->id))){
181 194
         $ss->assign("FREQ_OPTIONS", get_select_options_with_id($app_list_strings['newsletter_frequency_dom'], 'Monthly'));
182
-    }else{
195
+    } else{
183 196
         $ss->assign("FREQ_OPTIONS", get_select_options_with_id($app_list_strings['newsletter_frequency_dom'], $focus->frequency));
184 197
     }
185
-}else{
198
+} else{
186 199
     $ss->assign("HIDE_FREQUENCY_IF_NEWSLETTER", "input type='hidden'");
187 200
     $ss->assign("FREQUENCY_LABEL", '&nbsp;');
188 201
 }
@@ -192,12 +205,11 @@  discard block
 block discarded – undo
192 205
 if(isset($focus->currency_id) && !empty($focus->currency_id)){
193 206
     $selectCurrency = $currency->getSelectOptions($focus->currency_id);
194 207
     $ss->assign("CURRENCY", $selectCurrency);
195
-}
196
-else if($current_user->getPreference('currency') && !isset($focus->id))
208
+} else if($current_user->getPreference('currency') && !isset($focus->id))
197 209
 {
198 210
     $selectCurrency = $currency->getSelectOptions($current_user->getPreference('currency'));
199 211
     $ss->assign("CURRENCY", $selectCurrency);
200
-}else{
212
+} else{
201 213
 
202 214
     $selectCurrency = $currency->getSelectOptions();
203 215
     $ss->assign("CURRENCY", $selectCurrency);
@@ -228,7 +240,7 @@  discard block
 block discarded – undo
228 240
     foreach($OptionsArr as $key=>$val){
229 241
         if($val =='Newsletter' || $val =='Email' || $val =='' ){
230 242
             //do not add   
231
-        }else{
243
+        } else{
232 244
             $myTypeOptionsArr[$key] = $val;
233 245
         }
234 246
     }
@@ -240,7 +252,7 @@  discard block
 block discarded – undo
240 252
         //if the selected flag is set to true, then just populate
241 253
         if($selected){
242 254
             $type_option_html .="<option value='$optionKey' >$optionName</option>";
243
-        }else{//if not selected yet, check to see if this option should be selected
255
+        } else{//if not selected yet, check to see if this option should be selected
244 256
             //if the campaign type is not empty, then select the retrieved type
245 257
             if(!empty($focus->campaign_type)){
246 258
                 //check to see if key matches campaign type
@@ -249,11 +261,11 @@  discard block
 block discarded – undo
249 261
                     $type_option_html .="<option value='$optionKey' selected>$optionName</option>";
250 262
                     //mark as selected for next time
251 263
                     $selected=true;
252
-                }else{
264
+                } else{
253 265
                     //key does not match, just populate
254 266
                     $type_option_html .="<option value='$optionKey' >$optionName</option>";
255 267
                 }
256
-            }else{
268
+            } else{
257 269
             //since the campaign type is empty, then select first one                
258 270
                 $type_option_html .="<option value='$optionKey' selected>$optionName</option>";    
259 271
                 //mark as selected for next time
@@ -264,11 +276,11 @@  discard block
 block discarded – undo
264 276
     //assign the modified dropdown for general campaign creation
265 277
     $ss->assign("CAMPAIGN_TYPE_OPTIONS", $type_option_html);
266 278
     $ss->assign("SHOULD_TYPE_BE_DISABLED", "select");    
267
-}elseif($campaign_type == 'email'){
279
+} elseif($campaign_type == 'email'){
268 280
     //Assign Email as type of campaign being created an disable the select widget
269 281
     $ss->assign("CAMPAIGN_TYPE_OPTIONS", $mod_strings['LBL_EMAIL']);
270 282
     $ss->assign("SHOULD_TYPE_BE_DISABLED", "input type='hidden' value='Email'");
271
-}else{
283
+} else{
272 284
     //Assign NewsLetter as type of campaign being created an disable the select widget
273 285
     $ss->assign("CAMPAIGN_TYPE_OPTIONS", $mod_strings['LBL_NEWSLETTER']);
274 286
     $ss->assign("SHOULD_TYPE_BE_DISABLED", "input type='hidden' value='NewsLetter'");
@@ -295,7 +307,7 @@  discard block
 block discarded – undo
295 307
         $ct_focus = new CampaignTracker();
296 308
         $ct_focus->retrieve($trkr_id);
297 309
       if(isset($ct_focus->tracker_name) && !empty($ct_focus->tracker_name)){
298
-            if($ct_focus->is_optout){$opt = 'checked';}else{$opt = '';}
310
+            if($ct_focus->is_optout){$opt = 'checked';} else{$opt = '';}
299 311
             $trkr_html .= "<div id='existing_trkr".$trkr_count."'> <table width='100%' border='0' cellspacing='0' cellpadding='0'>" ;
300 312
             $trkr_html .= "<tr class='evenListRowS1'><td width='15%'><input name='wiz_step3_is_optout".$trkr_count."' title='".$mod_strings['LBL_EDIT_OPT_OUT'] . $trkr_count ."' id='existing_is_optout". $trkr_count ."' class='checkbox' type='checkbox' $opt  /><input name='wiz_step3_id".$trkr_count."' value='".$ct_focus->id."' id='existing_tracker_id". $trkr_count ."'type='hidden''/></td>";
301 313
             $trkr_html .= "<td width='40%'> <input id='existing_tracker_name". $trkr_count ."' type='text' size='20' maxlength='255' name='wiz_step3_tracker_name". $trkr_count ."' title='".$mod_strings['LBL_EDIT_TRACKER_NAME']. $trkr_count ."' value='".$ct_focus->tracker_name."' ></td>";
@@ -310,7 +322,7 @@  discard block
 block discarded – undo
310 322
     }
311 323
     
312 324
     $trkr_html .= "<div id='no_trackers'></div>";
313
-    }else{
325
+    } else{
314 326
         $trkr_html .= "<div id='no_trackers'><table width='100%' border='0' cellspacing='0' cellpadding='0'><tr class='evenListRowS1'><td>".$mod_strings['LBL_NONE']."</td></tr></table></div>";
315 327
     }
316 328
     $ss->assign('EXISTING_TRACKERS', $trkr_html);
@@ -424,7 +436,7 @@  discard block
 block discarded – undo
424 436
 
425 437
 
426 438
 
427
-}else{
439
+} else{
428 440
  //this is not a newlsetter campaign, so fill in target list table
429 441
     //create array for javascript, this will help to display the option text, not the value
430 442
     $dom_txt =' ';
@@ -454,7 +466,7 @@  discard block
 block discarded – undo
454 466
         }
455 467
         
456 468
         $trgt_html  .= "<div id='no_targets'></div>";
457
-    }else{
469
+    } else{
458 470
         $trgt_html  .= "<div id='no_targets'><table width='100%' border='0' cellspacing='0' cellpadding='0'><tr class='evenListRowS1'><td>".$mod_strings['LBL_NONE']."</td></tr></table></div>";
459 471
         
460 472
     }
@@ -529,11 +541,11 @@  discard block
 block discarded – undo
529 541
     $ss->assign('NAV_ITEMS',create_wiz_menu_items($steps,'campaign',$mrkt_string,$summ_url));
530 542
     $ss->assign('HIDE_CONTINUE','hidden');
531 543
 
532
-}elseif($campaign_type == 'email'){
544
+} elseif($campaign_type == 'email'){
533 545
     $steps = create_email_steps();  
534 546
     $ss->assign('NAV_ITEMS',create_wiz_menu_items($steps,'email',$mrkt_string,$summ_url));
535 547
     $ss->assign('HIDE_CONTINUE','submit');
536
-}else{
548
+} else{
537 549
     $steps = create_newsletter_steps();  
538 550
     $ss->assign('NAV_ITEMS',create_wiz_menu_items($steps,'newsletter',$mrkt_string,$summ_url));
539 551
     $ss->assign('HIDE_CONTINUE','submit');
@@ -604,7 +616,7 @@  discard block
 block discarded – undo
604 616
         $nav_html .= "<tr><td scope='row' nowrap><div id='nav_step'".($i+1).">$mrkt_string</div></td></tr>";
605 617
         $nav_html .= "<tr><td scope='row' nowrap><div id='nav_step'".($i+2).">".$mod_strings['LBL_NAVIGATION_MENU_SEND_EMAIL']."</div></li>";
606 618
         $nav_html .= "<tr><td scope='row' nowrap><div id='nav_step'".($i+3).">".$summ_url."</div></td></tr>";
607
-    }else{
619
+    } else{
608 620
      $nav_html .= "<tr><td scope='row' nowrap><div id='nav_step'".($i+1).">".$summ_url."</div></td></tr>";   
609 621
     }
610 622
        
Please login to merge, or discard this patch.
modules/Campaigns/GenerateWebToLeadForm.php 3 patches
Indentation   +216 added lines, -216 removed lines patch added patch discarded remove patch
@@ -101,19 +101,19 @@  discard block
 block discarded – undo
101 101
 }
102 102
 
103 103
 
104
- $lead = new Lead();
105
- $fieldsMetaData = new FieldsMetaData();
106
- $xtpl=new XTemplate ('modules/Campaigns/WebToLeadForm.html');
107
- $xtpl->assign("MOD", $mod_strings);
108
- $xtpl->assign("APP", $app_strings);
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')) . '">';
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>';
114
-
115
- $Web_To_Lead_Form_html .="<form action='$web_post_url' name='WebToLeadForm' method='POST' id='WebToLeadForm'>";
116
- $Web_To_Lead_Form_html .= "<table width='100%' style='border-top: 1px solid;
104
+    $lead = new Lead();
105
+    $fieldsMetaData = new FieldsMetaData();
106
+    $xtpl=new XTemplate ('modules/Campaigns/WebToLeadForm.html');
107
+    $xtpl->assign("MOD", $mod_strings);
108
+    $xtpl->assign("APP", $app_strings);
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')) . '">';
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>';
114
+
115
+    $Web_To_Lead_Form_html .="<form action='$web_post_url' name='WebToLeadForm' method='POST' id='WebToLeadForm'>";
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;
119 119
 background-color: rgb(233, 243, 255);
@@ -126,21 +126,21 @@  discard block
 block discarded – undo
126 126
 $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_description</TD></tr>";
127 127
 $Web_To_Lead_Form_html .= "<tr align='center' style='color: rgb(0, 105, 225); font-family: Arial,Verdana,Helvetica,sans-serif; font-size: 8px; font-weight: normal; margin-bottom: 0px; margin-top: 0px;'><TD COLSPAN='4'>&nbsp</TD></tr>";
128 128
 
129
- //$Web_To_Lead_Form_html .= "\n<p>\n";
129
+    //$Web_To_Lead_Form_html .= "\n<p>\n";
130 130
 
131 131
 if(!empty($_REQUEST['colsFirst']) && !empty($_REQUEST['colsSecond'])){
132
- if(count($_REQUEST['colsFirst']) < count($_REQUEST['colsSecond'])){
133
-   $columns= count($_REQUEST['colsSecond']);
134
- }
135
- if(count($_REQUEST['colsFirst']) > count($_REQUEST['colsSecond']) || count($_REQUEST['colsFirst']) == count($_REQUEST['colsSecond'])){
136
-   $columns= count($_REQUEST['colsFirst']);
137
- }
132
+    if(count($_REQUEST['colsFirst']) < count($_REQUEST['colsSecond'])){
133
+    $columns= count($_REQUEST['colsSecond']);
134
+    }
135
+    if(count($_REQUEST['colsFirst']) > count($_REQUEST['colsSecond']) || count($_REQUEST['colsFirst']) == count($_REQUEST['colsSecond'])){
136
+    $columns= count($_REQUEST['colsFirst']);
137
+    }
138 138
 }
139 139
 else if(!empty($_REQUEST['colsFirst'])){
140
- $columns= count($_REQUEST['colsFirst']);
140
+    $columns= count($_REQUEST['colsFirst']);
141 141
 }
142 142
 else if(!empty($_REQUEST['colsSecond'])){
143
- $columns= count($_REQUEST['colsSecond']);
143
+    $columns= count($_REQUEST['colsSecond']);
144 144
 }
145 145
 
146 146
 
@@ -153,140 +153,140 @@  discard block
 block discarded – undo
153 153
     if(!empty($_REQUEST['colsFirst'][$i])){
154 154
         $colsFirstField = $_REQUEST['colsFirst'][$i];
155 155
         //_pp($_REQUEST['colsFirst']);
156
-     }
156
+        }
157 157
     if(!empty($_REQUEST['colsSecond'][$i])){
158 158
         $colsSecondField = $_REQUEST['colsSecond'][$i];
159 159
         //_pp($_REQUEST['colsSecond']);
160
-     }
160
+        }
161 161
 
162 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'));
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){
164
+            $field_vname = preg_replace('/:$/','',translate($lead->field_defs[$colsFirstField]['vname'],'Leads'));
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 168
             $field_type= $lead->field_defs[$colsFirstField]['custom_type'];
169
-         }
170
-         else{
169
+            }
170
+            else{
171 171
             $field_type= $lead->field_defs[$colsFirstField]['type'];
172
-         }
172
+            }
173 173
          
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'])){
176
-             $lead->field_defs['webtolead_email1']['required'] = $lead->field_defs['email1']['required'];
177
-         }
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'])){
176
+                $lead->field_defs['webtolead_email1']['required'] = $lead->field_defs['email1']['required'];
177
+            }
178 178
          
179
-         $field_required = '';
180
-         if(isset($lead->field_defs[$colsFirstField]['required']) && $lead->field_defs[$colsFirstField]['required'] != null
179
+            $field_required = '';
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 184
             if (! in_array($lead->field_defs[$colsFirstField]['name'], $required_fields)){
185
-              array_push($required_fields,$lead->field_defs[$colsFirstField]['name']);
186
-             }
187
-          }
188
-          if($lead->field_defs[$colsFirstField]['name']=='last_name'){
185
+                array_push($required_fields,$lead->field_defs[$colsFirstField]['name']);
186
+                }
187
+            }
188
+            if($lead->field_defs[$colsFirstField]['name']=='last_name'){
189 189
             if (! in_array($lead->field_defs[$colsFirstField]['name'], $required_fields)){
190
-              array_push($required_fields,$lead->field_defs[$colsFirstField]['name']);
190
+                array_push($required_fields,$lead->field_defs[$colsFirstField]['name']);
191 191
             }
192
-          }
193
-         if($field_type=='multienum' || $field_type=='enum' || $field_type=='radioenum')  $field_options= $lead->field_defs[$colsFirstField]['options'];
192
+            }
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 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){
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 202
             $field1_type= $lead->field_defs[$colsSecondField]['custom_type'];
203
-         }
204
-         else{
203
+            }
204
+            else{
205 205
             $field1_type= $lead->field_defs[$colsSecondField]['type'];
206
-         }
206
+            }
207 207
          
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'])){
210
-             $lead->field_defs['webtolead_email1']['required'] = $lead->field_defs['email1']['required'];
211
-         }
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'])){
210
+                $lead->field_defs['webtolead_email1']['required'] = $lead->field_defs['email1']['required'];
211
+            }
212 212
          
213
-         $field1_required = '';
214
-         if(isset($lead->field_defs[$colsSecondField]['required']) && $lead->field_defs[$colsSecondField]['required'] != null
213
+            $field1_required = '';
214
+            if(isset($lead->field_defs[$colsSecondField]['required']) && $lead->field_defs[$colsSecondField]['required'] != null
215 215
              && $lead->field_defs[$colsSecondField]['required'] != 0){
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']);
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']);
219 219
             }
220
-         }
221
-         if($lead->field_defs[$colsSecondField]['name']=='last_name'){
220
+            }
221
+            if($lead->field_defs[$colsSecondField]['name']=='last_name'){
222 222
             if (! in_array($lead->field_defs[$colsSecondField]['name'], $required_fields)){
223
-              array_push($required_fields,$lead->field_defs[$colsSecondField]['name']);
223
+                array_push($required_fields,$lead->field_defs[$colsSecondField]['name']);
224 224
             }
225
-         }
226
-         if($field1_type=='multienum' || $field1_type=='enum' || $field1_type=='radioenum')  $field1_options= $lead->field_defs[$colsSecondField]['options'];
225
+            }
226
+            if($field1_type=='multienum' || $field1_type=='enum' || $field1_type=='radioenum')  $field1_options= $lead->field_defs[$colsSecondField]['options'];
227 227
     }
228 228
 
229
-     $Web_To_Lead_Form_html .= "<tr>";
229
+        $Web_To_Lead_Form_html .= "<tr>";
230 230
 
231 231
     if(isset($lead->field_defs[$colsFirstField]) && $lead->field_defs[$colsFirstField] != null){
232 232
         if($field_type=='multienum' || $field_type=='enum' || $field_type=='radioenum'){
233
-          $lead_options = '';
234
-          if(!empty($lead->$field_name)){
233
+            $lead_options = '';
234
+            if(!empty($lead->$field_name)){
235 235
             $lead_options= get_select_options_with_id($app_list_strings[$field_options], unencodeMultienum($lead->$field_name));
236
-          }
237
-          else{
236
+            }
237
+            else{
238 238
             $lead_options= get_select_options_with_id($app_list_strings[$field_options], '');
239
-          }
240
-          if($field_required){
239
+            }
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
-             }
246
-          if(isset($lead->field_defs[$colsFirstField]['isMultiSelect']) && $lead->field_defs[$colsFirstField]['isMultiSelect'] ==1){
245
+                }
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'])){
248
+            }elseif(ifRadioButton($lead->field_defs[$colsFirstField]['name'])){
249 249
             $Web_To_Lead_Form_html .="<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'>";
250 250
             foreach($app_list_strings[$field_options] as $field_option_key => $field_option){
251 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
-                	}
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>";
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
+                    }
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 260
             $Web_To_Lead_Form_html .="</span sugar='slot'></td>";
261
-          }else{
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
-          }
264
-         }
265
-         if($field_type=='bool'){
266
-          if($field_required){
263
+            }
264
+            }
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
-          }
269
-          else{
268
+            }
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
-          }
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']);
275
-             }
276
-         }
277
-         if($field_type=='date') {
271
+            }
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']);
275
+                }
276
+            }
277
+            if($field_type=='date') {
278 278
 
279
-          global $timedate;
280
-          $cal_dateformat = $timedate->get_cal_date_format();
281
-	      $LBL_ENTER_DATE = translate('LBL_ENTER_DATE', 'Charts');
282
-          if($field_required){
279
+            global $timedate;
280
+            $cal_dateformat = $timedate->get_cal_date_format();
281
+            $LBL_ENTER_DATE = translate('LBL_ENTER_DATE', 'Charts');
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
-          }
285
-          else{
284
+            }
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
 
289
-			$Web_To_Lead_Form_html .= "
289
+            $Web_To_Lead_Form_html .= "
290 290
 				<td width='35%' style='font-size: 12px; font-weight: normal;'>
291 291
 				<script type='text/javascript'>
292 292
 					update{$field_name}Value = function() {
@@ -301,121 +301,121 @@  discard block
 block discarded – undo
301 301
 					}
302 302
 				</script>
303 303
 				<span sugar='slot'><input type='hidden' id='{$field_name}' name='{$field_name}'/>";
304
-          	$order = explode("%", $cal_dateformat);
305
-          	foreach($order as $part)
306
-          	{
307
-          		if (!isset($part[0]))
308
-          			continue;
309
-          		if (strToUpper($part[0]) == "M" )
310
-          			$Web_To_Lead_Form_html .= translate("LBL_MONTH") . ":<input class=\"text\"
304
+                $order = explode("%", $cal_dateformat);
305
+                foreach($order as $part)
306
+                {
307
+                    if (!isset($part[0]))
308
+                        continue;
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
-          	}
322
-          	$Web_To_Lead_Form_html .= "</span></td>";
323
-	     } // if
321
+                }
322
+                $Web_To_Lead_Form_html .= "</span></td>";
323
+            } // if
324 324
 
325
-         if( $field_type=='varchar' ||  $field_type=='name'
325
+            if( $field_type=='varchar' ||  $field_type=='name'
326 326
           ||  $field_type=='phone' || $field_type=='currency' || $field_type=='url' || $field_type=='int'){
327
-           if($field_name=='last_name' ||   $field_required){
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 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
-             }
333
-             if ( $field_name=='email1'||$field_name=='email2' ){
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
-             } else {
332
+                }
333
+                if ( $field_name=='email1'||$field_name=='email2' ){
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
+                } else {
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
+                }
338
+            }
339
+            if ( $field_type == 'text' ) {
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
+                $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
+            }
343
+            if($field_type=='relate' &&  $field_name=='account_name'){
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>";
336 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>";
337
-             }
338
-            }
339
-          if ( $field_type == 'text' ) {
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
-			   $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
-           }
343
-           if($field_type=='relate' &&  $field_name=='account_name'){
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
-	            $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
-           }
347
-          if($field_type=='email'){
346
+            }
347
+            if($field_type=='email'){
348 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
-              }
351
-           else{
350
+                }
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
-           }
356
-       }
357
-      else{
355
+            }
356
+        }
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'>&nbsp</span sugar='slot'></td>";
359 359
             $Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'>&nbsp</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'){
364
-          $lead1_options = '';
365
-          if(!empty($lead->$field1_name)){
362
+        if(isset($lead->field_defs[$colsSecondField]) && $lead->field_defs[$colsSecondField] != null){
363
+            if($field1_type=='multienum' || $field1_type=='enum' || $field1_type=='radioenum'){
364
+            $lead1_options = '';
365
+            if(!empty($lead->$field1_name)){
366 366
             $lead1_options= get_select_options_with_id($app_list_strings[$field1_options], unencodeMultienum($lead->$field1_name));
367
-          }
368
-          else{
367
+            }
368
+            else{
369 369
             $lead1_options= get_select_options_with_id($app_list_strings[$field1_options], '');
370
-          }
370
+            }
371 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 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 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 379
             }elseif(ifRadioButton($lead->field_defs[$colsSecondField]['name'])){
380 380
                 $Web_To_Lead_Form_html .="<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'>";
381 381
                 foreach($app_list_strings[$field1_options] as $field_option_key => $field_option){
382 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
-	                    }
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>";
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
+                        }
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 391
                 $Web_To_Lead_Form_html .="</span sugar='slot'></td>";
392 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
-         }
396
-         if($field1_type=='bool'){
397
-          if($field1_required){
395
+            }
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
-          }
400
-          else{
399
+            }
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 404
             if (! in_array($lead->field_defs[$colsSecondField]['name'], $bool_fields)){
405
-              array_push($bool_fields,$lead->field_defs[$colsSecondField]['name']);
406
-             }
407
-         }
408
-         if($field1_type=='date') {
409
-	        global $timedate;
410
-			$cal_dateformat = $timedate->get_cal_date_format();
411
-	        $LBL_ENTER_DATE = translate('LBL_ENTER_DATE', 'Charts');
412
-          if($field1_required){
405
+                array_push($bool_fields,$lead->field_defs[$colsSecondField]['name']);
406
+                }
407
+            }
408
+            if($field1_type=='date') {
409
+            global $timedate;
410
+            $cal_dateformat = $timedate->get_cal_date_format();
411
+            $LBL_ENTER_DATE = translate('LBL_ENTER_DATE', 'Charts');
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
-          }
415
-          else{
414
+            }
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
-          }
418
-			$Web_To_Lead_Form_html .= " 
417
+            }
418
+            $Web_To_Lead_Form_html .= " 
419 419
 				<td width='35%' style='font-size: 12px; font-weight: normal;'>
420 420
 				<script type='text/javascript'>
421 421
 					update{$field1_name}Value = function() {
@@ -430,64 +430,64 @@  discard block
 block discarded – undo
430 430
 					}
431 431
 				</script>
432 432
 				<span sugar='slot'><input type='hidden' id='{$field1_name}' name='{$field1_name}'/>";
433
-          	$order = explode("%", $cal_dateformat);
434
-          	foreach($order as $part)
435
-          	{
436
-          		if (!isset($part[0]))
437
-          			continue;
438
-          		if (strToUpper($part[0]) == "M" )
439
-          			$Web_To_Lead_Form_html .= translate("LBL_MONTH") . ":<input class=\"text\"
433
+                $order = explode("%", $cal_dateformat);
434
+                foreach($order as $part)
435
+                {
436
+                    if (!isset($part[0]))
437
+                        continue;
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
-          	}
451
-          	$Web_To_Lead_Form_html .= "</span></td>";
452
-         } // if
453
-         if( $field1_type=='varchar' ||  $field1_type=='name'
450
+                }
451
+                $Web_To_Lead_Form_html .= "</span></td>";
452
+            } // if
453
+            if( $field1_type=='varchar' ||  $field1_type=='name'
454 454
           ||  $field1_type=='phone' || $field1_type=='currency' || $field1_type=='url' || $field1_type=='int'){
455 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 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
-             }
461
-             if ( $field1_name=='email1'||$field1_name=='email2' ){
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
-             } else {
460
+                }
461
+                if ( $field1_name=='email1'||$field1_name=='email2' ){
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
+                } else {
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
+                }
466
+
467
+            }
468
+            if ( $field1_type == 'text' ) {
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
+                $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
+            }
472
+            if($field1_type=='relate' &&  $field1_name=='account_name'){
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>";
464 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>";
465
-             }
466
-
467
-           }
468
-           if ( $field1_type == 'text' ) {
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
-				$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
-           }
472
-           if($field1_type=='relate' &&  $field1_name=='account_name'){
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
-	            $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
-           }
476
-           if($field1_type=='email'){
477
-           	if($field1_required){
475
+            }
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 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
-           }
485
-      }
486
-      else{
484
+            }
485
+        }
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'>&nbsp</span sugar='slot'></td>";
488 488
             $Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'>&nbsp</span sugar='slot'></td>";
489
-       }
490
-       $Web_To_Lead_Form_html .= "</tr>";
489
+        }
490
+        $Web_To_Lead_Form_html .= "</tr>";
491 491
 }
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'>&nbsp</TD></tr>";
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
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 502
 if(!empty($web_form_campaign)){
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>";
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 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>";
Please login to merge, or discard this patch.
Spacing   +184 added lines, -184 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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'>&nbsp</span sugar='slot'></td>";
359 359
             $Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'>&nbsp</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
 block discarded – undo
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'>&nbsp</span sugar='slot'></td>";
488 488
             $Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'>&nbsp</span sugar='slot'></td>";
489 489
        }
@@ -492,46 +492,46 @@  discard block
 block discarded – undo
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'>&nbsp</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'>&nbsp</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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
Braces   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -135,11 +137,9 @@  discard block
 block discarded – undo
135 137
  if(count($_REQUEST['colsFirst']) > count($_REQUEST['colsSecond']) || count($_REQUEST['colsFirst']) == count($_REQUEST['colsSecond'])){
136 138
    $columns= count($_REQUEST['colsFirst']);
137 139
  }
138
-}
139
-else if(!empty($_REQUEST['colsFirst'])){
140
+} else if(!empty($_REQUEST['colsFirst'])){
140 141
  $columns= count($_REQUEST['colsFirst']);
141
-}
142
-else if(!empty($_REQUEST['colsSecond'])){
142
+} else if(!empty($_REQUEST['colsSecond'])){
143 143
  $columns= count($_REQUEST['colsSecond']);
144 144
 }
145 145
 
@@ -166,8 +166,7 @@  discard block
 block discarded – undo
166 166
          $field_label = $field_vname .": ";
167 167
          if(isset($lead->field_defs[$colsFirstField]['custom_type']) && $lead->field_defs[$colsFirstField]['custom_type'] != null){
168 168
             $field_type= $lead->field_defs[$colsFirstField]['custom_type'];
169
-         }
170
-         else{
169
+         } else{
171 170
             $field_type= $lead->field_defs[$colsFirstField]['type'];
172 171
          }
173 172
          
@@ -190,7 +189,9 @@  discard block
 block discarded – undo
190 189
               array_push($required_fields,$lead->field_defs[$colsFirstField]['name']);
191 190
             }
192 191
           }
193
-         if($field_type=='multienum' || $field_type=='enum' || $field_type=='radioenum')  $field_options= $lead->field_defs[$colsFirstField]['options'];
192
+         if($field_type=='multienum' || $field_type=='enum' || $field_type=='radioenum') {
193
+             $field_options= $lead->field_defs[$colsFirstField]['options'];
194
+         }
194 195
     }
195 196
     //preg_replace('/:$/','',translate($field_def['vname'],'Leads')
196 197
     if(isset($lead->field_defs[$colsSecondField]) && $lead->field_defs[$colsSecondField] != null)
@@ -200,8 +201,7 @@  discard block
 block discarded – undo
200 201
          $field1_label = $field1_vname .": ";
201 202
          if(isset($lead->field_defs[$colsSecondField]['custom_type']) && $lead->field_defs[$colsSecondField]['custom_type'] != null){
202 203
             $field1_type= $lead->field_defs[$colsSecondField]['custom_type'];
203
-         }
204
-         else{
204
+         } else{
205 205
             $field1_type= $lead->field_defs[$colsSecondField]['type'];
206 206
          }
207 207
          
@@ -223,7 +223,9 @@  discard block
 block discarded – undo
223 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') {
227
+             $field1_options= $lead->field_defs[$colsSecondField]['options'];
228
+         }
227 229
     }
228 230
 
229 231
      $Web_To_Lead_Form_html .= "<tr>";
@@ -233,19 +235,17 @@  discard block
 block discarded – undo
233 235
           $lead_options = '';
234 236
           if(!empty($lead->$field_name)){
235 237
             $lead_options= get_select_options_with_id($app_list_strings[$field_options], unencodeMultienum($lead->$field_name));
236
-          }
237
-          else{
238
+          } else{
238 239
             $lead_options= get_select_options_with_id($app_list_strings[$field_options], '');
239 240
           }
240 241
           if($field_required){
241 242
                 $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
-            }
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 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'])){
248
+          } elseif(ifRadioButton($lead->field_defs[$colsFirstField]['name'])){
249 249
             $Web_To_Lead_Form_html .="<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'>";
250 250
             foreach($app_list_strings[$field_options] as $field_option_key => $field_option){
251 251
                 if($field_option != null){
@@ -258,15 +258,14 @@  discard block
 block discarded – undo
258 258
                 }
259 259
             }
260 260
             $Web_To_Lead_Form_html .="</span sugar='slot'></td>";
261
-          }else{
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 265
          if($field_type=='bool'){
266 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
-          }
269
-          else{
268
+          } else{
270 269
                 $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 270
           }
272 271
           $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>";
@@ -281,8 +280,7 @@  discard block
 block discarded – undo
281 280
 	      $LBL_ENTER_DATE = translate('LBL_ENTER_DATE', 'Charts');
282 281
           if($field_required){
283 282
                 $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
-          }
285
-          else{
283
+          } else{
286 284
                 $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 285
           }
288 286
 
@@ -304,20 +302,22 @@  discard block
 block discarded – undo
304 302
           	$order = explode("%", $cal_dateformat);
305 303
           	foreach($order as $part)
306 304
           	{
307
-          		if (!isset($part[0]))
308
-          			continue;
309
-          		if (strToUpper($part[0]) == "M" )
310
-          			$Web_To_Lead_Form_html .= translate("LBL_MONTH") . ":<input class=\"text\"
305
+          		if (!isset($part[0])) {
306
+          		          			continue;
307
+          		}
308
+          		if (strToUpper($part[0]) == "M" ) {
309
+          		          			$Web_To_Lead_Form_html .= translate("LBL_MONTH") . ":<input class=\"text\"
311 310
 					name=\"{$field_name}_month\" size='2' maxlength='2' id='{$field_name}_month' value=''
312 311
 					onblur=\"update{$field_name}Value()\">";
313
-				else if (strToUpper($part[0]) == "D" )
314
-					$Web_To_Lead_Form_html .=  translate("LBL_DAY") . ":<input class=\"text\"
312
+          		} else if (strToUpper($part[0]) == "D" ) {
313
+									$Web_To_Lead_Form_html .=  translate("LBL_DAY") . ":<input class=\"text\"
315 314
 					name=\"{$field_name}_day\" size='2' maxlength='2' id='{$field_name}_day' value=''
316 315
 					onblur=\"update{$field_name}Value()\">";
317
-				else if (strToUpper($part[0]) == "Y" )
318
-					$Web_To_Lead_Form_html .= translate("LBL_YEAR") . ":<input class=\"text\"
316
+				} else if (strToUpper($part[0]) == "Y" ) {
317
+									$Web_To_Lead_Form_html .= translate("LBL_YEAR") . ":<input class=\"text\"
319 318
 					name=\"{$field_name}_year\" size='4' maxlength='4' id='{$field_name}_year' value=''
320 319
 					onblur=\"update{$field_name}Value()\">";
320
+				}
321 321
           	}
322 322
           	$Web_To_Lead_Form_html .= "</span></td>";
323 323
 	     } // if
@@ -326,8 +326,7 @@  discard block
 block discarded – undo
326 326
           ||  $field_type=='phone' || $field_type=='currency' || $field_type=='url' || $field_type=='int'){
327 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
-              }
330
-            else{
329
+              } else{
331 330
                 $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 331
              }
333 332
              if ( $field_name=='email1'||$field_name=='email2' ){
@@ -347,14 +346,12 @@  discard block
 block discarded – undo
347 346
           if($field_type=='email'){
348 347
             if($field_required){
349 348
                 $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
-              }
351
-           else{
349
+              } else{
352 350
                 $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 351
              }
354 352
             $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 353
            }
356
-       }
357
-      else{
354
+       } else{
358 355
             $Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>&nbsp</span sugar='slot'></td>";
359 356
             $Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'>&nbsp</span sugar='slot'></td>";
360 357
         }
@@ -364,40 +361,37 @@  discard block
 block discarded – undo
364 361
           $lead1_options = '';
365 362
           if(!empty($lead->$field1_name)){
366 363
             $lead1_options= get_select_options_with_id($app_list_strings[$field1_options], unencodeMultienum($lead->$field1_name));
367
-          }
368
-          else{
364
+          } else{
369 365
             $lead1_options= get_select_options_with_id($app_list_strings[$field1_options], '');
370 366
           }
371 367
             if($field1_required){
372 368
                 $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
-            }
374
-            else{
369
+            } else{
375 370
                 $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 371
              }
377 372
             if(isset($lead->field_defs[$colsSecondField]['isMultiSelect']) && $lead->field_defs[$colsSecondField]['isMultiSelect'] ==1){
378 373
                 $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'])){
374
+            } elseif(ifRadioButton($lead->field_defs[$colsSecondField]['name'])){
380 375
                 $Web_To_Lead_Form_html .="<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'>";
381 376
                 foreach($app_list_strings[$field1_options] as $field_option_key => $field_option){
382 377
                     if($field_option != null){
383 378
                     	if(!empty($lead->$field1_name) && in_array($field_option_key,unencodeMultienum($lead->$field1_name))){
384 379
                     		$Web_To_Lead_Form_html .="<input id='$colsSecondField"."_$field_option_key' checked name='$colsSecondField' value='$field_option_key' type='radio'>";
385
-                    	}else{
380
+                    	} else{
386 381
 	                    	$Web_To_Lead_Form_html .="<input id='$colsSecondField"."_$field_option_key' name='$colsSecondField' value='$field_option_key' type='radio'>";
387 382
 	                    }
388 383
 	                    $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 384
                     }
390 385
                 }
391 386
                 $Web_To_Lead_Form_html .="</span sugar='slot'></td>";
392
-            }else{
387
+            } else{
393 388
                 $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 389
             }
395 390
          }
396 391
          if($field1_type=='bool'){
397 392
           if($field1_required){
398 393
             $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
-          }
400
-          else{
394
+          } else{
401 395
             $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 396
           }
403 397
             $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>";
@@ -411,8 +405,7 @@  discard block
 block discarded – undo
411 405
 	        $LBL_ENTER_DATE = translate('LBL_ENTER_DATE', 'Charts');
412 406
           if($field1_required){
413 407
                 $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
-          }
415
-          else{
408
+          } else{
416 409
                 $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 410
           }
418 411
 			$Web_To_Lead_Form_html .= " 
@@ -433,20 +426,22 @@  discard block
 block discarded – undo
433 426
           	$order = explode("%", $cal_dateformat);
434 427
           	foreach($order as $part)
435 428
           	{
436
-          		if (!isset($part[0]))
437
-          			continue;
438
-          		if (strToUpper($part[0]) == "M" )
439
-          			$Web_To_Lead_Form_html .= translate("LBL_MONTH") . ":<input class=\"text\"
429
+          		if (!isset($part[0])) {
430
+          		          			continue;
431
+          		}
432
+          		if (strToUpper($part[0]) == "M" ) {
433
+          		          			$Web_To_Lead_Form_html .= translate("LBL_MONTH") . ":<input class=\"text\"
440 434
 					name=\"{$field1_name}_month\" size='2' maxlength='2' id='{$field1_name}_month' value='' 
441 435
 					onblur=\"update{$field1_name}Value()\">";
442
-				else if (strToUpper($part[0]) == "D" ) 
443
-					$Web_To_Lead_Form_html .=  translate("LBL_DAY") . ":<input class=\"text\"
436
+          		} else if (strToUpper($part[0]) == "D" ) {
437
+									$Web_To_Lead_Form_html .=  translate("LBL_DAY") . ":<input class=\"text\"
444 438
 					name=\"{$field1_name}_day\" size='2' maxlength='2' id='{$field1_name}_day' value='' 
445 439
 					onblur=\"update{$field1_name}Value()\">";
446
-				else if (strToUpper($part[0]) == "Y" ) 
447
-					$Web_To_Lead_Form_html .= translate("LBL_YEAR") . ":<input class=\"text\"
440
+				} else if (strToUpper($part[0]) == "Y" ) {
441
+									$Web_To_Lead_Form_html .= translate("LBL_YEAR") . ":<input class=\"text\"
448 442
 					name=\"{$field1_name}_year\" size='4' maxlength='4' id='{$field1_name}_year' value='' 
449 443
 					onblur=\"update{$field1_name}Value()\">";
444
+				}
450 445
           	}
451 446
           	$Web_To_Lead_Form_html .= "</span></td>";
452 447
          } // if
@@ -454,8 +449,7 @@  discard block
 block discarded – undo
454 449
           ||  $field1_type=='phone' || $field1_type=='currency' || $field1_type=='url' || $field1_type=='int'){
455 450
             if($field1_name=='last_name' ||  $field1_required){
456 451
                 $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
-              }
458
-            else{
452
+              } else{
459 453
                 $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 454
              }
461 455
              if ( $field1_name=='email1'||$field1_name=='email2' ){
@@ -476,14 +470,12 @@  discard block
 block discarded – undo
476 470
            if($field1_type=='email'){
477 471
            	if($field1_required){
478 472
                 $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
-              }
480
-            else{
473
+              } else{
481 474
                 $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 475
              }
483 476
             $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 477
            }
485
-      }
486
-      else{
478
+      } else{
487 479
             $Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>&nbsp</span sugar='slot'></td>";
488 480
             $Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'>&nbsp</span sugar='slot'></td>";
489 481
        }
@@ -596,8 +588,16 @@  discard block
 block discarded – undo
596 588
 }
597 589
 </script>";
598 590
 
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", "");
591
+if(isset($Web_To_Lead_Form_html)) {
592
+    $xtpl->assign("BODY", $Web_To_Lead_Form_html);
593
+} else {
594
+    $xtpl->assign("BODY", "");
595
+}
596
+if(isset($Web_To_Lead_Form_html)) {
597
+    $xtpl->assign("BODY_HTML", $Web_To_Lead_Form_html);
598
+} else {
599
+    $xtpl->assign("BODY_HTML", "");
600
+}
601 601
 
602 602
 
603 603
 require_once('include/SugarTinyMCE.php');
Please login to merge, or discard this patch.
modules/Campaigns/WizardEmailSetupSave.php 3 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 //perform this if the option to create new mail box has been checked
86 86
 if(isset($_REQUEST['wiz_new_mbox']) && ($_REQUEST['wiz_new_mbox']=='1')){
87 87
     
88
-   //Populate the Request variables that inboundemail expects
88
+    //Populate the Request variables that inboundemail expects
89 89
     $_REQUEST['mark_read'] = 1;
90 90
     $_REQUEST['only_since'] = 1;
91 91
     $_REQUEST['mailbox_type'] = 'bounce';
@@ -114,18 +114,18 @@  discard block
 block discarded – undo
114 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)) ;
119
-              $_REQUEST[$newkey] = $val;
120
-         }               
117
+                if((strstr($key, $prefix )) && (strpos($key, $prefix )== 0)){
118
+                $newkey  =substr($key, strlen($prefix)) ;
119
+                $_REQUEST[$newkey] = $val;
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)) ;
126
-              $_POST[$newkey] = $val;
124
+                if((strstr($key, $prefix )) && (strpos($key, $prefix )== 0)){
125
+                $newkey  =substr($key, strlen($prefix)) ;
126
+                $_POST[$newkey] = $val;
127 127
               
128
-         }               
128
+            }               
129 129
     }
130 130
 }
131 131
 
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
          }               
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -100,7 +102,7 @@  discard block
 block discarded – undo
100 102
             //an error was found during inbound save.  This means the save was allowed but the inbound box had problems, return user to wizard
101 103
             //and display error message
102 104
             header("Location: index.php?action=WizardEmailSetup&module=Campaigns&error=true");
103
-    }else{
105
+    } else{
104 106
         //set navigation details
105 107
         header("Location: index.php?action=index&module=Campaigns");
106 108
     }
Please login to merge, or discard this patch.
modules/Campaigns/WizardNewsletterSave.php 3 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     $campaign_focus = populateFromPost('', $campaign_focus);
62 62
 
63 63
     foreach($camp_steps as $step){
64
-       $campaign_focus =  populate_wizard_bean_from_request($campaign_focus,$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
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 //require_once('modules/Campaigns/WizardMarketing.php');
221 221
 $header_URL = "Location: index.php?return_module=Campaigns&module=Campaigns&action=".$action."&campaign_id=".$campaign_focus->id."&return_action=WizardNewsLetter&return_id=".$campaign_focus->id;
222 222
 $GLOBALS['log']->debug("about to post header URL of: $header_URL");
223
- header($header_URL);
223
+    header($header_URL);
224 224
 
225 225
 
226 226
 
@@ -230,15 +230,15 @@  discard block
 block discarded – undo
230 230
  */
231 231
 function populate_wizard_bean_from_request($bean,$prefix){
232 232
     foreach($_REQUEST as $key=> $val){
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])){
237
-              //echo "prefix is $prefix, field is $field,    key is $key,   and value is $val<br>";
238
-              $value = $_REQUEST[$key];
239
-              $bean->$field = $value;
240
-          }
241
-     }
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])){
237
+                //echo "prefix is $prefix, field is $field,    key is $key,   and value is $val<br>";
238
+                $value = $_REQUEST[$key];
239
+                $bean->$field = $value;
240
+            }
241
+        }
242 242
     }
243 243
 
244 244
     return $bean;
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 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
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 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
Please login to merge, or discard this patch.
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -92,7 +94,7 @@  discard block
 block discarded – undo
92 94
                     $campaign_focus->prospectlists->delete($campaign_focus->id, $pl_del);
93 95
                 }
94 96
             }
95
-        }else{
97
+        } else{
96 98
             //process target lists if this is not a newsletter
97 99
             //remove Target Lists if defined
98 100
 
@@ -124,7 +126,7 @@  discard block
 block discarded – undo
124 126
                     //load relationship and add to the list
125 127
                     $campaign_focus->load_relationship('prospectlists');
126 128
                     $campaign_focus->prospectlists->add($trgt_focus ->id);
127
-                }else{
129
+                } else{
128 130
 
129 131
                     //this is a new target, as the id is not populated, need to create and link
130 132
                     $trgt_focus = new ProspectList();
@@ -214,7 +216,7 @@  discard block
 block discarded – undo
214 216
 $action = '';
215 217
 if(isset($_REQUEST['wiz_direction'])  &&  $_REQUEST['wiz_direction']== 'continue'){
216 218
     $action = 'WizardMarketing';
217
-}else{
219
+} else{
218 220
     $action = 'WizardHome&record='.$campaign_focus->id;
219 221
 }
220 222
 //require_once('modules/Campaigns/WizardMarketing.php');
Please login to merge, or discard this patch.
modules/Campaigns/WebToLeadCapture.php 3 patches
Indentation   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -55,16 +55,16 @@  discard block
 block discarded – undo
55 55
  * To make your changes upgrade safe create a file called leadCapture_override.php and place the changes there
56 56
  */
57 57
 $users = array(
58
-	'PUT A RANDOM KEY FROM THE WEBSITE HERE' => array('name'=>'PUT THE USER_NAME HERE', 'pass'=>'PUT THE USER_HASH FOR THE RESPECTIVE USER HERE'),
58
+    'PUT A RANDOM KEY FROM THE WEBSITE HERE' => array('name'=>'PUT THE USER_NAME HERE', 'pass'=>'PUT THE USER_HASH FOR THE RESPECTIVE USER HERE'),
59 59
 );
60 60
 
61 61
 if (isset($_POST['campaign_id']) && !empty($_POST['campaign_id'])) {
62
-	    //adding the client ip address
63
-	    $_POST['client_id_address'] = query_client_ip();
64
-		$campaign_id=$_POST['campaign_id'];
65
-		$campaign = new Campaign();
66
-		$camp_query  = "select name,id from campaigns where id='$campaign_id'";
67
-		$camp_query .= " and deleted=0";
62
+        //adding the client ip address
63
+        $_POST['client_id_address'] = query_client_ip();
64
+        $campaign_id=$_POST['campaign_id'];
65
+        $campaign = new Campaign();
66
+        $camp_query  = "select name,id from campaigns where id='$campaign_id'";
67
+        $camp_query .= " and deleted=0";
68 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
@@ -78,20 +78,20 @@  discard block
 block discarded – undo
78 78
         $marketing_result = $db->limitQuery($marketing_query, 0, 1, true);
79 79
         $marketing_data = $db->fetchByAssoc($marketing_result);
80 80
         // .Bug 41292
81
-		if (isset($_REQUEST['assigned_user_id']) && !empty($_REQUEST['assigned_user_id'])) {
82
-			$current_user = new User();
83
-			$current_user->retrieve($_REQUEST['assigned_user_id']);
84
-		} 
81
+        if (isset($_REQUEST['assigned_user_id']) && !empty($_REQUEST['assigned_user_id'])) {
82
+            $current_user = new User();
83
+            $current_user->retrieve($_REQUEST['assigned_user_id']);
84
+        } 
85 85
 
86
-	    if(isset($camp_data) && $camp_data != null ){
87
-			$leadForm = new LeadFormBase();
86
+        if(isset($camp_data) && $camp_data != null ){
87
+            $leadForm = new LeadFormBase();
88 88
             $lead = new Lead();
89
-			$prefix = '';
90
-			if(!empty($_POST['prefix'])){
91
-				$prefix = $_POST['prefix'];
92
-			}
89
+            $prefix = '';
90
+            if(!empty($_POST['prefix'])){
91
+                $prefix = $_POST['prefix'];
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
             }
@@ -114,47 +114,47 @@  discard block
 block discarded – undo
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
-	            //create campaign log
120
-	            $camplog = new CampaignLog();
121
-	            $camplog->campaign_id  = $_POST['campaign_id'];
122
-	            $camplog->related_id   = $lead->id;
123
-	            $camplog->related_type = $lead->module_dir;
124
-	            $camplog->activity_type = "lead";
125
-	            $camplog->target_type = $lead->module_dir;
126
-	            $campaign_log->activity_date=$timedate->now();
127
-	            $camplog->target_id    = $lead->id;
119
+                //create campaign log
120
+                $camplog = new CampaignLog();
121
+                $camplog->campaign_id  = $_POST['campaign_id'];
122
+                $camplog->related_id   = $lead->id;
123
+                $camplog->related_type = $lead->module_dir;
124
+                $camplog->activity_type = "lead";
125
+                $camplog->target_type = $lead->module_dir;
126
+                $campaign_log->activity_date=$timedate->now();
127
+                $camplog->target_id    = $lead->id;
128 128
                 if(isset($marketing_data['id']))
129 129
                 {
130 130
                     $camplog->marketing_id = $marketing_data['id'];
131 131
                 }
132
-	            $camplog->save();
132
+                $camplog->save();
133 133
 
134
-		        //link campaignlog and lead
134
+                //link campaignlog and lead
135 135
 
136
-		        if (isset($_POST['email1']) && $_POST['email1'] != null)
136
+                if (isset($_POST['email1']) && $_POST['email1'] != null)
137 137
                 {
138 138
                     $lead->email1 = $_POST['email1'];
139
-		        } 
139
+                } 
140 140
                 //in case there are old forms used webtolead_email1
141 141
                 elseif (isset($_POST['webtolead_email1']) && $_POST['webtolead_email1'] != null)
142 142
                 {
143 143
                     $lead->email1 = $_POST['webtolead_email1'];
144 144
                 }
145 145
                 
146
-		        if (isset($_POST['email2']) && $_POST['email2'] != null)
146
+                if (isset($_POST['email2']) && $_POST['email2'] != null)
147 147
                 {
148 148
                     $lead->email2 = $_POST['email2'];
149
-		        } 
149
+                } 
150 150
                 //in case there are old forms used webtolead_email2
151 151
                 elseif (isset($_POST['webtolead_email2']) && $_POST['webtolead_email2'] != null)
152 152
                 {
153 153
                     $lead->email2 = $_POST['webtolead_email2'];
154 154
                 }
155 155
                 
156
-		        $lead->load_relationship('campaigns');
157
-		        $lead->campaigns->add($camplog->id);
156
+                $lead->load_relationship('campaigns');
157
+                $lead->campaigns->add($camplog->id);
158 158
                 if(!empty($GLOBALS['check_notify'])) {
159 159
                     $lead->save($GLOBALS['check_notify']);
160 160
                 }
@@ -176,87 +176,87 @@  discard block
 block discarded – undo
176 176
                     
177 177
                 }
178 178
             }              
179
-			if(isset($_POST['redirect_url']) && !empty($_POST['redirect_url'])){
180
-			    // Get the redirect url, and make sure the query string is not too long
181
-		        $redirect_url = $_POST['redirect_url'];
182
-		        $query_string = '';
183
-				$first_char = '&';
184
-				if(strpos($redirect_url, '?') === FALSE){
185
-					$first_char = '?';
186
-				}
187
-				$first_iteration = true;
188
-				$get_and_post = array_merge($_GET, $_POST);
189
-				foreach($get_and_post as $param => $value) {
179
+            if(isset($_POST['redirect_url']) && !empty($_POST['redirect_url'])){
180
+                // Get the redirect url, and make sure the query string is not too long
181
+                $redirect_url = $_POST['redirect_url'];
182
+                $query_string = '';
183
+                $first_char = '&';
184
+                if(strpos($redirect_url, '?') === FALSE){
185
+                    $first_char = '?';
186
+                }
187
+                $first_iteration = true;
188
+                $get_and_post = array_merge($_GET, $_POST);
189
+                foreach($get_and_post as $param => $value) {
190 190
 
191
-					if($param == 'redirect_url' && $param == 'submit')
192
-						continue;
191
+                    if($param == 'redirect_url' && $param == 'submit')
192
+                        continue;
193 193
 					
194
-					if($first_iteration){
195
-						$first_iteration = false;
196
-						$query_string .= $first_char;
197
-					}
198
-					else{
199
-						$query_string .= "&";
200
-					}
201
-					$query_string .= "{$param}=".urlencode($value);
202
-				}
203
-				if(empty($lead)) {
204
-					if($first_iteration){
205
-						$query_string .= $first_char;
206
-					}
207
-					else{
208
-						$query_string .= "&";
209
-					}
210
-					$query_string .= "error=1";
211
-				}
194
+                    if($first_iteration){
195
+                        $first_iteration = false;
196
+                        $query_string .= $first_char;
197
+                    }
198
+                    else{
199
+                        $query_string .= "&";
200
+                    }
201
+                    $query_string .= "{$param}=".urlencode($value);
202
+                }
203
+                if(empty($lead)) {
204
+                    if($first_iteration){
205
+                        $query_string .= $first_char;
206
+                    }
207
+                    else{
208
+                        $query_string .= "&";
209
+                    }
210
+                    $query_string .= "error=1";
211
+                }
212 212
 				
213
-				$redirect_url = $redirect_url.$query_string;
213
+                $redirect_url = $redirect_url.$query_string;
214 214
 
215 215
 
216
-				// Check if the headers have been sent, or if the redirect url is greater than 2083 characters (IE max URL length)
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">';
216
+                // Check if the headers have been sent, or if the redirect url is greater than 2083 characters (IE max URL length)
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">';
221 221
     
222
-    				foreach($_POST as $param => $value) {
223
-    					if($param != 'redirect_url' ||$param != 'submit') {
224
-    						echo '<input type="hidden" name="'.$param.'" value="'.$value.'">';
225
-    					}
226
-    				}
227
-    				if(empty($lead)) {
228
-    					echo '<input type="hidden" name="error" value="1">';
229
-    				}
230
-    				echo '</form><script language="javascript" type="text/javascript">document.redirect.submit();</script>';
231
-    				echo '</body></html>';
232
-    			}
233
-				else{
234
-    				header("Location: {$redirect_url}");
235
-    				die();
236
-			    }
237
-			}
238
-			else{
239
-				echo $mod_strings['LBL_THANKS_FOR_SUBMITTING_LEAD'];
240
-			}
241
-			sugar_cleanup();
242
-			// die to keep code from running into redirect case below
243
-			die();
244
-	    }
245
-	   else{
246
-	  	  echo $mod_strings['LBL_SERVER_IS_CURRENTLY_UNAVAILABLE'];
247
-	  }
222
+                    foreach($_POST as $param => $value) {
223
+                        if($param != 'redirect_url' ||$param != 'submit') {
224
+                            echo '<input type="hidden" name="'.$param.'" value="'.$value.'">';
225
+                        }
226
+                    }
227
+                    if(empty($lead)) {
228
+                        echo '<input type="hidden" name="error" value="1">';
229
+                    }
230
+                    echo '</form><script language="javascript" type="text/javascript">document.redirect.submit();</script>';
231
+                    echo '</body></html>';
232
+                }
233
+                else{
234
+                    header("Location: {$redirect_url}");
235
+                    die();
236
+                }
237
+            }
238
+            else{
239
+                echo $mod_strings['LBL_THANKS_FOR_SUBMITTING_LEAD'];
240
+            }
241
+            sugar_cleanup();
242
+            // die to keep code from running into redirect case below
243
+            die();
244
+        }
245
+        else{
246
+            echo $mod_strings['LBL_SERVER_IS_CURRENTLY_UNAVAILABLE'];
247
+        }
248 248
 }
249 249
 
250 250
 if (!empty($_POST['redirect'])) {
251 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
-    	echo '</form><script language="javascript" type="text/javascript">document.redirect.submit();</script>';
255
-    	echo '</body></html>';
252
+        echo '<html ' . get_language_header() . '><head><title>SugarCRM</title></head><body>';
253
+        echo '<form name="redirect" action="' .$_POST['redirect']. '" method="GET">';
254
+        echo '</form><script language="javascript" type="text/javascript">document.redirect.submit();</script>';
255
+        echo '</body></html>';
256 256
     }
257 257
     else{
258
-    	header("Location: {$_POST['redirect']}");
259
-    	die();
258
+        header("Location: {$_POST['redirect']}");
259
+        die();
260 260
     }
261 261
 }
262 262
 
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
Braces   +13 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -157,8 +159,7 @@  discard block
 block discarded – undo
157 159
 		        $lead->campaigns->add($camplog->id);
158 160
                 if(!empty($GLOBALS['check_notify'])) {
159 161
                     $lead->save($GLOBALS['check_notify']);
160
-                }
161
-                else {
162
+                } else {
162 163
                     $lead->save(FALSE);
163 164
                 }
164 165
             }
@@ -188,14 +189,14 @@  discard block
 block discarded – undo
188 189
 				$get_and_post = array_merge($_GET, $_POST);
189 190
 				foreach($get_and_post as $param => $value) {
190 191
 
191
-					if($param == 'redirect_url' && $param == 'submit')
192
-						continue;
192
+					if($param == 'redirect_url' && $param == 'submit') {
193
+											continue;
194
+					}
193 195
 					
194 196
 					if($first_iteration){
195 197
 						$first_iteration = false;
196 198
 						$query_string .= $first_char;
197
-					}
198
-					else{
199
+					} else{
199 200
 						$query_string .= "&";
200 201
 					}
201 202
 					$query_string .= "{$param}=".urlencode($value);
@@ -203,8 +204,7 @@  discard block
 block discarded – undo
203 204
 				if(empty($lead)) {
204 205
 					if($first_iteration){
205 206
 						$query_string .= $first_char;
206
-					}
207
-					else{
207
+					} else{
208 208
 						$query_string .= "&";
209 209
 					}
210 210
 					$query_string .= "error=1";
@@ -229,20 +229,17 @@  discard block
 block discarded – undo
229 229
     				}
230 230
     				echo '</form><script language="javascript" type="text/javascript">document.redirect.submit();</script>';
231 231
     				echo '</body></html>';
232
-    			}
233
-				else{
232
+    			} else{
234 233
     				header("Location: {$redirect_url}");
235 234
     				die();
236 235
 			    }
237
-			}
238
-			else{
236
+			} else{
239 237
 				echo $mod_strings['LBL_THANKS_FOR_SUBMITTING_LEAD'];
240 238
 			}
241 239
 			sugar_cleanup();
242 240
 			// die to keep code from running into redirect case below
243 241
 			die();
244
-	    }
245
-	   else{
242
+	    } else{
246 243
 	  	  echo $mod_strings['LBL_SERVER_IS_CURRENTLY_UNAVAILABLE'];
247 244
 	  }
248 245
 }
@@ -253,8 +250,7 @@  discard block
 block discarded – undo
253 250
     	echo '<form name="redirect" action="' .$_POST['redirect']. '" method="GET">';
254 251
     	echo '</form><script language="javascript" type="text/javascript">document.redirect.submit();</script>';
255 252
     	echo '</body></html>';
256
-    }
257
-    else{
253
+    } else{
258 254
     	header("Location: {$_POST['redirect']}");
259 255
     	die();
260 256
     }
Please login to merge, or discard this patch.
modules/Campaigns/DeleteTestCampaigns.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,8 +66,8 @@
 block discarded – undo
66 66
     $test_ids = array();
67 67
     $test_list_ids = array();
68 68
     while($row = $focus->db->fetchByAssoc($res)) {
69
-       $test_ids[] = $row['emailid'];
70
-       $test_list_ids[$row['listid']] = true;
69
+        $test_ids[] = $row['emailid'];
70
+        $test_list_ids[$row['listid']] = true;
71 71
     }
72 72
     $test_list_ids = array_keys($test_list_ids);
73 73
     unset($res);
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
Please login to merge, or discard this patch.
modules/Campaigns/WebToLeadCreation.php 3 patches
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -113,23 +113,23 @@  discard block
 block discarded – undo
113 113
 $json = getJSONobj();
114 114
 // Users Popup
115 115
 $popup_request_data = array(
116
-	'call_back_function' => 'set_return',
117
-	'form_name' => 'WebToLeadCreation',
118
-	'field_to_name_array' => array(
119
-		'id' => 'assigned_user_id',
120
-		'user_name' => 'assigned_user_name',
121
-		),
122
-	);
116
+    'call_back_function' => 'set_return',
117
+    'form_name' => 'WebToLeadCreation',
118
+    'field_to_name_array' => array(
119
+        'id' => 'assigned_user_id',
120
+        'user_name' => 'assigned_user_name',
121
+        ),
122
+    );
123 123
 $xtpl->assign('encoded_users_popup_request_data', $json->encode($popup_request_data));
124 124
 
125 125
 //Campaigns popup
126 126
 $popup_request_data = array(
127
-		'call_back_function' => 'set_return',
128
-		'form_name' => 'WebToLeadCreation',
129
-		'field_to_name_array' => array(
130
-			'id' => 'campaign_id',
131
-			'name' => 'campaign_name',
132
-		),
127
+        'call_back_function' => 'set_return',
128
+        'form_name' => 'WebToLeadCreation',
129
+        'field_to_name_array' => array(
130
+            'id' => 'campaign_id',
131
+            'name' => 'campaign_name',
132
+        ),
133 133
 );
134 134
 $encoded_users_popup_request_data = $json->encode($popup_request_data);
135 135
 $xtpl->assign('encoded_campaigns_popup_request_data' , $json->encode($popup_request_data));
@@ -148,50 +148,50 @@  discard block
 block discarded – undo
148 148
 $count= 0;
149 149
 foreach($lead->field_defs as $field_def)
150 150
 {
151
-	$email_fields = false;
151
+    $email_fields = false;
152 152
     if($field_def['name']== 'email1' || $field_def['name']== 'email2')
153 153
     {
154
-    	$email_fields = true;
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')
160
-	    {
161
-	        continue;
162
-	    }
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')
168
-	    {
169
-	    	continue;
170
-	    }
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
+        {
161
+            continue;
162
+        }
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')
168
+        {
169
+            continue;
170
+        }
171 171
 
172 172
 
173 173
     $field_def['vname'] = preg_replace('/:$/','',translate($field_def['vname'],'Leads'));
174 174
 
175
-     //$cols_name = "{'".$field_def['vname']."'}";
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
-     	){
175
+        //$cols_name = "{'".$field_def['vname']."'}";
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 180
         $cols_name=$field_def['vname'].' '.$app_strings['LBL_REQUIRED_SYMBOL'];
181 181
         $col_arr[0]=$cols_name;
182 182
         $col_arr[1]=$field_def['name'];
183 183
         $col_arr[2]=true;
184
-     }
185
-     else{
186
-	     $cols_name=$field_def['vname'];
187
-	     $col_arr[0]=$cols_name;
188
-	     $col_arr[1]=$field_def['name'];
189
-     }
190
-     if (! in_array($cols_name, $fields))
191
-     {
192
-         array_push($fields,$col_arr);
193
-     }
194
-     $count++;
184
+        }
185
+        else{
186
+            $cols_name=$field_def['vname'];
187
+            $col_arr[0]=$cols_name;
188
+            $col_arr[1]=$field_def['name'];
189
+        }
190
+        if (! in_array($cols_name, $fields))
191
+        {
192
+            array_push($fields,$col_arr);
193
+        }
194
+        $count++;
195 195
 }
196 196
 
197 197
 $xtpl->assign("WEB_POST_URL",$web_post_url);
@@ -200,10 +200,10 @@  discard block
 block discarded – undo
200 200
 require_once('include/QuickSearchDefaults.php');
201 201
 $qsd = QuickSearchDefaults::getQuickSearchDefaults();
202 202
 $sqs_objects = array('account_name' => $qsd->getQSParent(),
203
-					'assigned_user_name' => $qsd->getQSUser(),
204
-					'campaign_name' => $qsd->getQSCampaigns(),
203
+                    'assigned_user_name' => $qsd->getQSUser(),
204
+                    'campaign_name' => $qsd->getQSCampaigns(),
205 205
 
206
-					);
206
+                    );
207 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
 
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 			    	//Call other function when this is called
277 277
 	           }
278 278
 	        </script>";
279
-	$str .= "<script>
279
+    $str .= "<script>
280 280
 		       function displayAddRemoveDragButtons(Add_All_Fields,Remove_All_Fields){
281 281
 				    var addRemove = document.getElementById('lead_add_remove_button');
282 282
 				    if(" . $dd_chooser->args['classname'] . "_grid0.getDataModel().getTotalRowCount() ==0) {
Please login to merge, or discard this patch.
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 				    }
Please login to merge, or discard this patch.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -181,8 +183,7 @@  discard block
 block discarded – undo
181 183
         $col_arr[0]=$cols_name;
182 184
         $col_arr[1]=$field_def['name'];
183 185
         $col_arr[2]=true;
184
-     }
185
-     else{
186
+     } else{
186 187
 	     $cols_name=$field_def['vname'];
187 188
 	     $col_arr[0]=$cols_name;
188 189
 	     $col_arr[1]=$field_def['name'];
@@ -209,8 +210,12 @@  discard block
 block discarded – undo
209 210
 
210 211
 
211 212
 
212
-if (empty($focus->assigned_user_id) && empty($focus->id))  $focus->assigned_user_id = $current_user->id;
213
-if (empty($focus->assigned_name) && empty($focus->id))  $focus->assigned_user_name = $current_user->user_name;
213
+if (empty($focus->assigned_user_id) && empty($focus->id)) {
214
+    $focus->assigned_user_id = $current_user->id;
215
+}
216
+if (empty($focus->assigned_name) && empty($focus->id)) {
217
+    $focus->assigned_user_name = $current_user->user_name;
218
+}
214 219
 $xtpl->assign("ASSIGNED_USER_OPTIONS", get_select_options_with_id(get_user_array(TRUE, "Active", $focus->assigned_user_id), $focus->assigned_user_id));
215 220
 $xtpl->assign("ASSIGNED_USER_NAME", $focus->assigned_user_name);
216 221
 $xtpl->assign("ASSIGNED_USER_ID", $focus->assigned_user_id );
Please login to merge, or discard this patch.
modules/Campaigns/WizardEmailSetup.php 3 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -137,14 +137,14 @@  discard block
 block discarded – undo
137 137
 if(isset($mbox) && count($mbox)>0){
138 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
-                   .  " <td width='20%'><b>".$mod_strings['LBL_LOGIN']."</b></td>"
141
-                   .  " <td width='20%'><b>".$mod_strings['LBL_MAILBOX']."</b></td>" 
142
-                   .  " <td width='20%'><b>".$mod_strings['LBL_SERVER_URL']."</b></td>"
143
-                   .  " <td width='20%'><b>".$mod_strings['LBL_LIST_STATUS']."</b></td></tr>";
140
+                    .  " <td width='20%'><b>".$mod_strings['LBL_LOGIN']."</b></td>"
141
+                    .  " <td width='20%'><b>".$mod_strings['LBL_MAILBOX']."</b></td>" 
142
+                    .  " <td width='20%'><b>".$mod_strings['LBL_SERVER_URL']."</b></td>"
143
+                    .  " <td width='20%'><b>".$mod_strings['LBL_LIST_STATUS']."</b></td></tr>";
144 144
     $colorclass=' ';
145 145
     foreach($mbox as $details){
146 146
                 
147
-     if( $colorclass == "class='evenListRowS1'"){
147
+        if( $colorclass == "class='evenListRowS1'"){
148 148
             $colorclass= "class='oddListRowS1'";
149 149
         }else{ 
150 150
             $colorclass= "class='evenListRowS1'";
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 /**************************** WIZARD UI DIV Stuff *******************/
176 176
   
177 177
 //  this is the wizard control script that resides in page    
178
- $divScript = <<<EOQ
178
+    $divScript = <<<EOQ
179 179
  <script type="text/javascript" language="javascript">  
180 180
 
181 181
     //this function toggles visibility of fields based on selected options
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
Braces   +17 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -55,7 +57,9 @@  discard block
 block discarded – undo
55 57
 global $mod_strings,$app_list_strings,$app_strings,$current_user;
56 58
 
57 59
 
58
-if (!is_admin($current_user)&& !is_admin_for_module($GLOBALS['current_user'],'Campaigns')) sugar_die("Unauthorized access to administration.");
60
+if (!is_admin($current_user)&& !is_admin_for_module($GLOBALS['current_user'],'Campaigns')) {
61
+    sugar_die("Unauthorized access to administration.");
62
+}
59 63
 
60 64
 $params = array();
61 65
 $params[] = "<a href='index.php?module=Campaigns&action=index'>{$mod_strings['LBL_MODULE_NAME']}</a>";
@@ -78,9 +82,15 @@  discard block
 block discarded – undo
78 82
 $ss = new Sugar_Smarty();
79 83
 $ss->assign("MOD", $mod_strings);
80 84
 $ss->assign("APP", $app_strings);
81
-if (isset($_REQUEST['return_module'])) $ss->assign("RETURN_MODULE", $_REQUEST['return_module']);
82
-if (isset($_REQUEST['return_action'])) $ss->assign("RETURN_ACTION", $_REQUEST['return_action']);
83
-if (isset($_REQUEST['return_id'])) $ss->assign("RETURN_ID", $_REQUEST['return_id']);
85
+if (isset($_REQUEST['return_module'])) {
86
+    $ss->assign("RETURN_MODULE", $_REQUEST['return_module']);
87
+}
88
+if (isset($_REQUEST['return_action'])) {
89
+    $ss->assign("RETURN_ACTION", $_REQUEST['return_action']);
90
+}
91
+if (isset($_REQUEST['return_id'])) {
92
+    $ss->assign("RETURN_ID", $_REQUEST['return_id']);
93
+}
84 94
 
85 95
 
86 96
 
@@ -146,7 +156,7 @@  discard block
 block discarded – undo
146 156
                 
147 157
      if( $colorclass == "class='evenListRowS1'"){
148 158
             $colorclass= "class='oddListRowS1'";
149
-        }else{ 
159
+        } else{ 
150 160
             $colorclass= "class='evenListRowS1'";
151 161
         }           
152 162
         
@@ -159,7 +169,7 @@  discard block
 block discarded – undo
159 169
     }
160 170
 
161 171
 
162
-}else{
172
+} else{
163 173
 $need_mbox = 'checked';
164 174
 $mboxTable .= "<tr><td colspan='5'><b>".$mod_strings['LBL_MAILBOX_CHECK_WIZ_BAD']." </b>.</td></tr>";
165 175
 }        
Please login to merge, or discard this patch.
modules/Campaigns/ProcessBouncedEmails.php 3 patches
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     $query = "SELECT description FROM notes WHERE file_mime_type = 'messsage/rfc822' AND parent_type='Emails' AND parent_id = '".$email->id."' AND deleted=0";
57 57
     $rs = $GLOBALS['db']->query($query);
58 58
     while ($row = $GLOBALS['db']->fetchByAssoc($rs)) 
59
-		$contents .= $row['description'];
59
+        $contents .= $row['description'];
60 60
 
61 61
     return $contents;
62 62
 }
@@ -162,80 +162,80 @@  discard block
 block discarded – undo
162 162
 
163 163
 function campaign_process_bounced_emails(&$email, &$email_header) 
164 164
 {
165
-	global $sugar_config;
166
-	$emailFromAddress = $email_header->fromaddress;
167
-	$email_description = $email->raw_source;
165
+    global $sugar_config;
166
+    $emailFromAddress = $email_header->fromaddress;
167
+    $email_description = $email->raw_source;
168 168
     	
169
-	//if raw_source is empty, try using the description instead
170
-    	if (empty($email_description)){
171
-        	$email_description = $email->description;
172
-	}
169
+    //if raw_source is empty, try using the description instead
170
+        if (empty($email_description)){
171
+            $email_description = $email->description;
172
+    }
173 173
 
174 174
     $email_description .= retrieveErrorReportAttachment($email);
175 175
 
176
-	if (preg_match('/MAILER-DAEMON|POSTMASTER/i',$emailFromAddress)) 
177
-	{
178
-	    $email_description=quoted_printable_decode($email_description);
179
-		$matches=array();
176
+    if (preg_match('/MAILER-DAEMON|POSTMASTER/i',$emailFromAddress)) 
177
+    {
178
+        $email_description=quoted_printable_decode($email_description);
179
+        $matches=array();
180 180
 		
181
-		//do we have the identifier tag in the email?
182
-		$identifierScanResults = checkBouncedEmailForIdentifier($email_description);
181
+        //do we have the identifier tag in the email?
182
+        $identifierScanResults = checkBouncedEmailForIdentifier($email_description);
183 183
 		
184
-		if ( $identifierScanResults['found'] ) 
185
-		{
186
-			$matches = $identifierScanResults['matches'];
187
-			$identifiers = $identifierScanResults['identifiers'];
188
-
189
-			if (!empty($identifiers)) 
190
-			{
191
-				//array should have only one element in it.
192
-				$identifier = trim($identifiers[0]);
193
-				$row = getExistingCampaignLogEntry($identifier);
184
+        if ( $identifierScanResults['found'] ) 
185
+        {
186
+            $matches = $identifierScanResults['matches'];
187
+            $identifiers = $identifierScanResults['identifiers'];
188
+
189
+            if (!empty($identifiers)) 
190
+            {
191
+                //array should have only one element in it.
192
+                $identifier = trim($identifiers[0]);
193
+                $row = getExistingCampaignLogEntry($identifier);
194 194
 				
195
-				//Found entry
196
-				if (!empty($row)) 
197
-				{
198
-					//do not create another campaign_log record is we already have an
199
-					//invalid email or send error entry for this tracker key.
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')";
195
+                //Found entry
196
+                if (!empty($row)) 
197
+                {
198
+                    //do not create another campaign_log record is we already have an
199
+                    //invalid email or send error entry for this tracker key.
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')";
202 202
                     $targeted = new CampaignLog();
203
-					$result_log=$targeted->db->query($query_log);
204
-					$row_log=$targeted->db->fetchByAssoc($result_log);
205
-
206
-					if (empty($row_log)) 
207
-					{
208
-						$return_id = createBouncedCampaignLogEntry($row, $email, $email_description);	
209
-						return TRUE;
210
-					}				
211
-					else 
212
-					{
213
-					    $GLOBALS['log']->debug("Warning: campaign log entry already exists for identifier $identifier");
214
-					    return FALSE;
215
-					}
216
-				} 
217
-				else 
218
-				{
219
-				    $GLOBALS['log']->info("Warning: skipping bounced email with this tracker_key(identifier) in the message body: ".$identifier);
220
-					return FALSE;
221
-				}			
222
-    		} 
223
-    		else 
224
-    		{
225
-    			$GLOBALS['log']->info("Warning: Empty identifier for campaign log.");
226
-    			return FALSE;
227
-    		}
228
-    	}  
229
-    	else 
230
-    	{
231
-    	    $GLOBALS['log']->info("Warning: skipping bounced email because it does not have the removeme link.");	
232
-    		return FALSE;	
233
-      	}
234
-  } 
235
-  else 
236
-  {
237
-	$GLOBALS['log']->info("Warning: skipping bounced email because the sender is not MAILER-DAEMON.");
238
-	return FALSE;
239
-  }
203
+                    $result_log=$targeted->db->query($query_log);
204
+                    $row_log=$targeted->db->fetchByAssoc($result_log);
205
+
206
+                    if (empty($row_log)) 
207
+                    {
208
+                        $return_id = createBouncedCampaignLogEntry($row, $email, $email_description);	
209
+                        return TRUE;
210
+                    }				
211
+                    else 
212
+                    {
213
+                        $GLOBALS['log']->debug("Warning: campaign log entry already exists for identifier $identifier");
214
+                        return FALSE;
215
+                    }
216
+                } 
217
+                else 
218
+                {
219
+                    $GLOBALS['log']->info("Warning: skipping bounced email with this tracker_key(identifier) in the message body: ".$identifier);
220
+                    return FALSE;
221
+                }			
222
+            } 
223
+            else 
224
+            {
225
+                $GLOBALS['log']->info("Warning: Empty identifier for campaign log.");
226
+                return FALSE;
227
+            }
228
+        }  
229
+        else 
230
+        {
231
+            $GLOBALS['log']->info("Warning: skipping bounced email because it does not have the removeme link.");	
232
+            return FALSE;	
233
+            }
234
+    } 
235
+    else 
236
+    {
237
+    $GLOBALS['log']->info("Warning: skipping bounced email because the sender is not MAILER-DAEMON.");
238
+    return FALSE;
239
+    }
240 240
 }
241 241
 ?>
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 					{
Please login to merge, or discard this patch.
Braces   +17 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -55,8 +57,9 @@  discard block
 block discarded – undo
55 57
     $contents = "";
56 58
     $query = "SELECT description FROM notes WHERE file_mime_type = 'messsage/rfc822' AND parent_type='Emails' AND parent_id = '".$email->id."' AND deleted=0";
57 59
     $rs = $GLOBALS['db']->query($query);
58
-    while ($row = $GLOBALS['db']->fetchByAssoc($rs)) 
59
-		$contents .= $row['description'];
60
+    while ($row = $GLOBALS['db']->fetchByAssoc($rs)) {
61
+    		$contents .= $row['description'];
62
+    }
60 63
 
61 64
     return $contents;
62 65
 }
@@ -89,9 +92,9 @@  discard block
 block discarded – undo
89 92
     {
90 93
         $bounce->activity_type='invalid email';
91 94
         markEmailAddressInvalid($email);
95
+    } else {
96
+            $bounce->activity_type='send error';
92 97
     }
93
-    else 
94
-        $bounce->activity_type='send error';
95 98
         
96 99
     $return_id=$bounce->save();
97 100
     return $return_id;
@@ -104,8 +107,9 @@  discard block
 block discarded – undo
104 107
  */
105 108
 function markEmailAddressInvalid($email_address)
106 109
 {
107
-    if(empty($email_address))
108
-        return;
110
+    if(empty($email_address)) {
111
+            return;
112
+    }
109 113
     $sea = new SugarEmailAddress();
110 114
     $rs = $sea->retrieve_by_string_fields( array('email_address_caps' => trim(strtoupper($email_address))) );
111 115
     if($rs != null)
@@ -149,8 +153,7 @@  discard block
 block discarded – undo
149 153
         $identifiers = preg_split('/X-CampTrackID: /',$matches[0],-1,PREG_SPLIT_NO_EMPTY);
150 154
         $found = TRUE;
151 155
         $GLOBALS['log']->debug("Found campaign identifier in header of email");  
152
-    }
153
-    else if( preg_match('/index.php\?entryPoint=removeme&identifier=[a-z0-9\-]*/',$email_description, $matches) )
156
+    } else if( preg_match('/index.php\?entryPoint=removeme&identifier=[a-z0-9\-]*/',$email_description, $matches) )
154 157
     {
155 158
         $identifiers = preg_split('/index.php\?entryPoint=removeme&identifier=/',$matches[0],-1,PREG_SPLIT_NO_EMPTY);
156 159
         $found = TRUE;
@@ -207,32 +210,27 @@  discard block
 block discarded – undo
207 210
 					{
208 211
 						$return_id = createBouncedCampaignLogEntry($row, $email, $email_description);	
209 212
 						return TRUE;
210
-					}				
211
-					else 
213
+					} else 
212 214
 					{
213 215
 					    $GLOBALS['log']->debug("Warning: campaign log entry already exists for identifier $identifier");
214 216
 					    return FALSE;
215 217
 					}
216
-				} 
217
-				else 
218
+				} else 
218 219
 				{
219 220
 				    $GLOBALS['log']->info("Warning: skipping bounced email with this tracker_key(identifier) in the message body: ".$identifier);
220 221
 					return FALSE;
221 222
 				}			
222
-    		} 
223
-    		else 
223
+    		} else 
224 224
     		{
225 225
     			$GLOBALS['log']->info("Warning: Empty identifier for campaign log.");
226 226
     			return FALSE;
227 227
     		}
228
-    	}  
229
-    	else 
228
+    	} else 
230 229
     	{
231 230
     	    $GLOBALS['log']->info("Warning: skipping bounced email because it does not have the removeme link.");	
232 231
     		return FALSE;	
233 232
       	}
234
-  } 
235
-  else 
233
+  } else 
236 234
   {
237 235
 	$GLOBALS['log']->info("Warning: skipping bounced email because the sender is not MAILER-DAEMON.");
238 236
 	return FALSE;
Please login to merge, or discard this patch.