Passed
Push — scrutinizer-code-quality ( eedb15...27193c )
by Adam
54:15 queued 15s
created
include/SugarFields/Parsers/MetaParser.php 1 patch
Braces   +6 added lines, -3 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.
@@ -456,8 +458,9 @@  discard block
 block discarded – undo
456 458
     while ($file = readdir($handler)) {
457 459
         // if $file isn't this directory or its parent,
458 460
         // add it to the results array
459
-        if ($file != '.' && $file != '..')
460
-            $results[] = $file;
461
+        if ($file != '.' && $file != '..') {
462
+                    $results[] = $file;
463
+        }
461 464
     }
462 465
 
463 466
     // tidy up: close the handler
Please login to merge, or discard this patch.
include/SugarFields/SugarFieldHandler.php 1 patch
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -91,10 +91,10 @@  discard block
 block discarded – undo
91 91
         		$file = 'custom/include/SugarFields/Fields/' . $field . '/SugarField' . $field. '.php';
92 92
                 $type = $field;
93 93
 			//else check the fields directory
94
-			}else if(file_exists('include/SugarFields/Fields/' . $field . '/SugarField' . $field. '.php')){
94
+			} else if(file_exists('include/SugarFields/Fields/' . $field . '/SugarField' . $field. '.php')){
95 95
            		$file = 'include/SugarFields/Fields/' . $field . '/SugarField' . $field. '.php';
96 96
                 $type = $field;
97
-        	}else{
97
+        	} else{
98 98
                 // No direct class, check the directories to see if they are defined
99 99
         		if( $returnNullIfBase &&
100 100
                     !is_dir('custom/include/SugarFields/Fields/'.$field) &&
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 			$customClass = 'Custom' . $class;
112 112
         	if(class_exists($customClass)){
113 113
         		$sugarFieldObjects[$field] = new $customClass($field);
114
-        	}else{
114
+        	} else{
115 115
         		$sugarFieldObjects[$field] = new $class($field);
116 116
         	}
117 117
         }
Please login to merge, or discard this patch.
SugarFields/Fields/Assigned_user_name/SugarFieldAssigned_user_name.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
 		if(!empty($vardef['function']['returns']) && $vardef['function']['returns']== 'html'){
47 47
     	   $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
48 48
            return $this->fetch($this->findTemplate('EditViewFunction'));
49
-    	}else{
49
+    	} else{
50 50
     	   $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
51 51
            return $this->fetch($this->findTemplate('SearchView'));
52 52
     	}
Please login to merge, or discard this patch.
include/SugarEmailAddress/SugarEmailAddress.php 1 patch
Braces   +39 added lines, -26 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.
@@ -132,8 +134,9 @@  discard block
 block discarded – undo
132 134
         $alternate_found = false;
133 135
         $alternate2_found = false;
134 136
         foreach($this->addresses as $k=>$address) {
135
-            if ($primary_found && $alternate_found)
136
-                break;
137
+            if ($primary_found && $alternate_found) {
138
+                            break;
139
+            }
137 140
             if ($address['primary_address'] == 1 && !$primary_found) {
138 141
                 $primary_index = $k;
139 142
                 $primary_found = true;
@@ -271,8 +274,9 @@  discard block
 block discarded – undo
271 274
         )
272 275
     {
273 276
         $emailCaps = strtoupper(trim($email));
274
-        if(empty($emailCaps))
275
-            return 0;
277
+        if(empty($emailCaps)) {
278
+                    return 0;
279
+        }
276 280
 
277 281
         $q = "SELECT *
278 282
                 FROM email_addr_bean_rel eabl JOIN email_addresses ea
@@ -288,7 +292,9 @@  discard block
 block discarded – undo
288 292
 
289 293
         // do it this way to make the count accurate in oracle
290 294
         $i = 0;
291
-        while ($this->db->fetchByAssoc($r)) ++$i;
295
+        while ($this->db->fetchByAssoc($r)) {
296
+            ++$i;
297
+        }
292 298
 
293 299
         return $i;
294 300
     }
@@ -471,8 +477,9 @@  discard block
 block discarded – undo
471 477
                     foreach($_REQUEST as $k => $v) {
472 478
                         if(preg_match('/'.$eId.'emailAddressVerifiedValue[0-9]+$/i', $k) && !empty($v)) {
473 479
                             $validateFlag = str_replace("Value", "Flag", $k);
474
-                            if (isset($_REQUEST[$validateFlag]) && $_REQUEST[$validateFlag] == "true")
475
-                              $new_addrs[$k] = $v;
480
+                            if (isset($_REQUEST[$validateFlag]) && $_REQUEST[$validateFlag] == "true") {
481
+                                                          $new_addrs[$k] = $v;
482
+                            }
476 483
                         }
477 484
                     }
478 485
                 }
@@ -675,8 +682,7 @@  discard block
 block discarded – undo
675 682
         if ($id) {
676 683
             $r = $this->db->query("SELECT * FROM email_addresses WHERE id='".$this->db->quote($id)."'");
677 684
             $current_email = $this->db->fetchByAssoc($r);
678
-        }
679
-        else {
685
+        } else {
680 686
             $current_email = null;
681 687
         }
682 688
 
@@ -716,8 +722,7 @@  discard block
 block discarded – undo
716 722
                 $upd_r = $this->db->query($upd_q);
717 723
             }
718 724
             return $duplicate_email['id'];
719
-        }
720
-        else {
725
+        } else {
721 726
             // no case-insensitive address match - it's new, or undeleted.
722 727
             $guid = '';
723 728
             if(!empty($address)){
@@ -783,8 +788,7 @@  discard block
 block discarded – undo
783 788
             // otherwise
784 789
             $q .= "
785 790
                 ORDER BY ear.reply_to_address DESC";
786
-        }
787
-        else
791
+        } else
788 792
         {
789 793
             // retrieve reply-to address only
790 794
             $q .= "
@@ -835,8 +839,9 @@  discard block
 block discarded – undo
835 839
      */
836 840
     function getEmailAddressWidgetEditView($id, $module, $asMetadata=false, $tpl='',$tabindex='0')
837 841
     {
838
-        if ( !($this->smarty instanceOf Sugar_Smarty ) )
839
-            $this->smarty = new Sugar_Smarty();
842
+        if ( !($this->smarty instanceOf Sugar_Smarty ) ) {
843
+                    $this->smarty = new Sugar_Smarty();
844
+        }
840 845
 
841 846
         global $app_strings, $dictionary, $beanList;
842 847
 
@@ -854,8 +859,9 @@  discard block
 block discarded – undo
854 859
         if(!empty($id)) {
855 860
             $prefillDataArr = $this->getAddressesByGUID($id, $module);
856 861
             //When coming from convert leads, sometimes module is Contacts while the id is for a lead.
857
-            if (empty($prefillDataArr) && $module == "Contacts")
858
-                $prefillDataArr = $this->getAddressesByGUID($id, "Leads");
862
+            if (empty($prefillDataArr) && $module == "Contacts") {
863
+                            $prefillDataArr = $this->getAddressesByGUID($id, "Leads");
864
+            }
859 865
         } else if(isset($_REQUEST['full_form']) && !empty($_REQUEST['emailAddressWidget'])){
860 866
             $widget_id = isset($_REQUEST[$module . '_email_widget_id']) ? $_REQUEST[$module . '_email_widget_id'] : '0';
861 867
             $count = 0;
@@ -880,8 +886,9 @@  discard block
 block discarded – undo
880 886
 
881 887
         $required = false;
882 888
         $vardefs = $dictionary[$beanList[$passedModule]]['fields'];
883
-        if (!empty($vardefs['email1']) && isset($vardefs['email1']['required']) && $vardefs['email1']['required'])
884
-            $required = true;
889
+        if (!empty($vardefs['email1']) && isset($vardefs['email1']['required']) && $vardefs['email1']['required']) {
890
+                    $required = true;
891
+        }
885 892
         $this->smarty->assign('required', $required);
886 893
 
887 894
         $this->smarty->assign('module', $saveModule);
@@ -935,13 +942,16 @@  discard block
 block discarded – undo
935 942
      */
936 943
     function getEmailAddressWidgetDetailView($focus, $tpl='')
937 944
     {
938
-        if ( !($this->smarty instanceOf Sugar_Smarty ) )
939
-            $this->smarty = new Sugar_Smarty();
945
+        if ( !($this->smarty instanceOf Sugar_Smarty ) ) {
946
+                    $this->smarty = new Sugar_Smarty();
947
+        }
940 948
 
941 949
         global $app_strings;
942 950
         global $current_user;
943 951
         $assign = array();
944
-        if(empty($focus->id))return '';
952
+        if(empty($focus->id)) {
953
+            return '';
954
+        }
945 955
         $prefillData = $this->getAddressesByGUID($focus->id, $focus->module_dir);
946 956
 
947 957
         foreach($prefillData as $addressItem) {
@@ -970,8 +980,9 @@  discard block
 block discarded – undo
970 980
      */
971 981
     function getEmailAddressWidgetDuplicatesView($focus)
972 982
     {
973
-        if ( !($this->smarty instanceOf Sugar_Smarty ) )
974
-            $this->smarty = new Sugar_Smarty();
983
+        if ( !($this->smarty instanceOf Sugar_Smarty ) ) {
984
+                    $this->smarty = new Sugar_Smarty();
985
+        }
975 986
 
976 987
         $count = 0;
977 988
         $emails = array();
@@ -1131,7 +1142,9 @@  discard block
 block discarded – undo
1131 1142
 
1132 1143
         if($view == 'EditView' || $view == 'QuickCreate' || $view == 'ConvertLead') {
1133 1144
             $module = $focus->module_dir;
1134
-            if ($view == 'ConvertLead' && $module == "Contacts")  $module = "Leads";
1145
+            if ($view == 'ConvertLead' && $module == "Contacts") {
1146
+                $module = "Leads";
1147
+            }
1135 1148
 
1136 1149
             return $sea->getEmailAddressWidgetEditView($focus->id, $module, false,'',$tabindex);
1137 1150
         }
Please login to merge, or discard this patch.
include/SugarOauth.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -133,7 +133,7 @@
 block discarded – undo
133 133
             try{
134 134
                 $this->_last = $token = parent::getRequestToken($params);
135 135
                 return array('oauth_token' => $token->getToken(), 'oauth_token_secret' => $token->getTokenSecret());
136
-            }catch(Zend_Oauth_Exception $e){
136
+            } catch(Zend_Oauth_Exception $e){
137 137
                 return array('oauth_token' => '', 'oauth_token_secret' => '');
138 138
             }
139 139
         }
Please login to merge, or discard this patch.
include/formbase.php 1 patch
Braces   +10 added lines, -11 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.
@@ -77,8 +79,9 @@  discard block
 block discarded – undo
77 79
 {
78 80
 	global $current_user;
79 81
 
80
-	if(!empty($_REQUEST[$prefix.'record']) && !$skipRetrieve)
81
-		$focus->retrieve($_REQUEST[$prefix.'record']);
82
+	if(!empty($_REQUEST[$prefix.'record']) && !$skipRetrieve) {
83
+			$focus->retrieve($_REQUEST[$prefix.'record']);
84
+	}
82 85
 
83 86
 	if(!empty($_POST['assigned_user_id']) && 
84 87
 	    ($focus->assigned_user_id != $_POST['assigned_user_id']) && 
@@ -240,8 +243,7 @@  discard block
 block discarded – undo
240 243
     if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "")
241 244
 	{
242 245
 		$return_module = $_REQUEST['return_module'];
243
-	}
244
-	else
246
+	} else
245 247
 	{
246 248
 		$return_module = $return_module;
247 249
 	}
@@ -275,14 +277,12 @@  discard block
 block discarded – undo
275 277
 			$return_module = $_REQUEST['module'];
276 278
 			$return_action = $_REQUEST['return_action']; 
277 279
 			// wp: return action needs to be set for one-click close in task list
278
-		} 
279
-		else 
280
+		} else 
280 281
 		{
281 282
 			// if we "Cancel", we go back to the list view.
282 283
 			$return_action = $_REQUEST['return_action'];
283 284
 		}
284
-	}
285
-	else
285
+	} else
286 286
 	{
287 287
 		$return_action = "DetailView";
288 288
 	}
@@ -378,8 +378,7 @@  discard block
 block discarded – undo
378 378
     $focus=BeanFactory::getBean('Prospects');
379 379
     if(is_array($child_id)){
380 380
         $uids = $child_id;
381
-    }
382
-    else{
381
+    } else{
383 382
         $uids = array($child_id);
384 383
     }
385 384
 
Please login to merge, or discard this patch.
include/Popups/PopupSmarty.php 1 patch
Braces   +45 added lines, -25 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.
@@ -128,8 +130,9 @@  discard block
 block discarded – undo
128 130
         foreach($this->displayColumns as $name => $params) {
129 131
             $this->displayColumns[$name]['width'] = round($this->displayColumns[$name]['width'] / $adjustment, 2);
130 132
             // figure out which contextMenu objectsTypes are required
131
-            if(!empty($params['contextMenu']['objectType']))
132
-                $contextMenuObjectsTypes[$params['contextMenu']['objectType']] = true;
133
+            if(!empty($params['contextMenu']['objectType'])) {
134
+                            $contextMenuObjectsTypes[$params['contextMenu']['objectType']] = true;
135
+            }
133 136
         }
134 137
 		$this->th->ss->assign('displayColumns', $this->displayColumns);
135 138
 
@@ -147,10 +150,17 @@  discard block
 block discarded – undo
147 150
 		$this->th->ss->assign('searchForm', $this->searchForm->display(false));
148 151
         //rrs
149 152
 
150
-		if($this->export) $this->th->ss->assign('exportLink', $this->buildExportLink());
153
+		if($this->export) {
154
+		    $this->th->ss->assign('exportLink', $this->buildExportLink());
155
+		}
151 156
 		$this->th->ss->assign('quickViewLinks', $this->quickViewLinks);
152
-		if($this->mailMerge) $this->th->ss->assign('mergeLink', $this->buildMergeLink()); // still check for mailmerge access
153
-		if($this->mergeduplicates) $this->th->ss->assign('mergedupLink', $this->buildMergeDuplicatesLink());
157
+		if($this->mailMerge) {
158
+		    $this->th->ss->assign('mergeLink', $this->buildMergeLink());
159
+		}
160
+		// still check for mailmerge access
161
+		if($this->mergeduplicates) {
162
+		    $this->th->ss->assign('mergedupLink', $this->buildMergeDuplicatesLink());
163
+		}
154 164
 
155 165
 
156 166
 		if (!empty($_REQUEST['mode']) && strtoupper($_REQUEST['mode']) == 'MULTISELECT') {
@@ -301,7 +311,7 @@  discard block
 block discarded – undo
301 311
 
302 312
 		if(file_exists('custom/modules/'.$this->module.'/metadata/metafiles.php')){
303 313
 			require('custom/modules/'.$this->module.'/metadata/metafiles.php');
304
-		}elseif(file_exists('modules/'.$this->module.'/metadata/metafiles.php')){
314
+		} elseif(file_exists('modules/'.$this->module.'/metadata/metafiles.php')){
305 315
 			require('modules/'.$this->module.'/metadata/metafiles.php');
306 316
 		}
307 317
 
@@ -321,21 +331,24 @@  discard block
 block discarded – undo
321 331
 		$displayColumns = array();
322 332
 		if(!empty($_REQUEST['displayColumns'])) {
323 333
 		    foreach(explode('|', $_REQUEST['displayColumns']) as $num => $col) {
324
-		        if(!empty($listViewDefs[$this->module][$col]))
325
-		            $displayColumns[$col] = $this->listviewdefs[$this->module][$col];
334
+		        if(!empty($listViewDefs[$this->module][$col])) {
335
+		        		            $displayColumns[$col] = $this->listviewdefs[$this->module][$col];
336
+		        }
326 337
 		    }
327
-		}
328
-		else {
338
+		} else {
329 339
 		    foreach($this->listviewdefs[$this->module] as $col => $para) {
330
-		        if(!empty($para['default']) && $para['default'])
331
-		            $displayColumns[$col] = $para;
340
+		        if(!empty($para['default']) && $para['default']) {
341
+		        		            $displayColumns[$col] = $para;
342
+		        }
332 343
 		    }
333 344
 		}
334 345
 		$params['massupdate'] = true;
335 346
 		if(!empty($_REQUEST['orderBy'])) {
336 347
 		    $params['orderBy'] = $_REQUEST['orderBy'];
337 348
 		    $params['overrideOrder'] = true;
338
-		    if(!empty($_REQUEST['sortOrder'])) $params['sortOrder'] = $_REQUEST['sortOrder'];
349
+		    if(!empty($_REQUEST['sortOrder'])) {
350
+		        $params['sortOrder'] = $_REQUEST['sortOrder'];
351
+		    }
339 352
 		}
340 353
 
341 354
 		$lv->displayColumns = $displayColumns;
@@ -453,7 +466,9 @@  discard block
 block discarded – undo
453 466
 
454 467
         // Need to include the default whereStatement
455 468
 		if(!empty($this->_popupMeta['whereStatement'])){
456
-            if(!empty($where))$where .= ' AND ';
469
+            if(!empty($where)) {
470
+                $where .= ' AND ';
471
+            }
457 472
             $where .= $this->_popupMeta['whereStatement'];
458 473
 		}
459 474
 
@@ -472,11 +487,13 @@  discard block
 block discarded – undo
472 487
 				$this->formData[] = array('field' => $data);
473 488
 				$value = '';
474 489
 				$this->customFieldDefs[$data['name']]= $data;
475
-				if(!empty($_REQUEST[$data['name']]))
476
-	            	$value = $_REQUEST[$data['name']];
490
+				if(!empty($_REQUEST[$data['name']])) {
491
+					            	$value = $_REQUEST[$data['name']];
492
+				}
477 493
 	            $this->customFieldDefs[$data['name']]['value'] = $value;
478
-			}else
479
-				$this->formData[] = array('field' => array('name'=>$data));
494
+			} else {
495
+							$this->formData[] = array('field' => array('name'=>$data));
496
+			}
480 497
 		}
481 498
 		$this->fieldDefs = array();
482 499
 		if($this->seed){
@@ -487,13 +504,15 @@  discard block
 block discarded – undo
487 504
 	            //if we have a relate type then reset to name so that we end up with a textbox
488 505
 	            //rather than a select button
489 506
 	            $this->fieldDefs[$name]['name'] = $this->fieldDefs[$name]['name'];
490
-	            if($this->fieldDefs[$name]['type'] == 'relate')
491
-	            	$this->fieldDefs[$name]['type'] = 'name';
507
+	            if($this->fieldDefs[$name]['type'] == 'relate') {
508
+	            	            	$this->fieldDefs[$name]['type'] = 'name';
509
+	            }
492 510
 	            if(isset($this->fieldDefs[$name]['options']) && isset($GLOBALS['app_list_strings'][$this->fieldDefs[$name]['options']])) {
493 511
 	                $this->fieldDefs[$name]['options'] = $GLOBALS['app_list_strings'][$this->fieldDefs[$name]['options']]; // fill in enums
494 512
 	            }
495
-	            if(!empty($_REQUEST[$name]))
496
-	            	$value = $_REQUEST[$name];
513
+	            if(!empty($_REQUEST[$name])) {
514
+	            	            	$value = $_REQUEST[$name];
515
+	            }
497 516
 	            $this->fieldDefs[$name]['value'] = $value;
498 517
 	        }
499 518
 		}
@@ -540,8 +559,9 @@  discard block
 block discarded – undo
540 559
 EOQ;
541 560
 		// if metadata contains custom inputs for the quickcreate
542 561
 		if(!empty($this->_popupMeta['customInput']) && is_array($this->_popupMeta['customInput'])) {
543
-			foreach($this->_popupMeta['customInput'] as $key => $value)
544
-				$formSave .= '<input type="hidden" name="' . $key . '" value="'. $value .'">\n';
562
+			foreach($this->_popupMeta['customInput'] as $key => $value) {
563
+							$formSave .= '<input type="hidden" name="' . $key . '" value="'. $value .'">\n';
564
+			}
545 565
 		}
546 566
 
547 567
 
Please login to merge, or discard this patch.
include/SubPanel/SubPanelDefinitions.php 1 patch
Braces   +60 added lines, -39 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.
@@ -85,7 +87,9 @@  discard block
 block discarded – undo
85 87
 
86 88
 		$this->_instance_properties = $instance_properties ;
87 89
 
88
-		if(isset($instance_properties['collection_list' ])) $this->base_collection_list = $instance_properties['collection_list' ];
90
+		if(isset($instance_properties['collection_list' ])) {
91
+		    $this->base_collection_list = $instance_properties['collection_list' ];
92
+		}
89 93
 
90 94
 		if(!empty($collections) && isset($instance_properties['collection_list' ])){
91 95
 			foreach($instance_properties['collection_list' ] as $cname => $value){
@@ -277,7 +281,9 @@  discard block
 block discarded – undo
277 281
 				}
278 282
 			}
279 283
 			// if it's empty just dump out as there is nothing to process.
280
-			if(empty($this->sub_subpanels)) return false;
284
+			if(empty($this->sub_subpanels)) {
285
+			    return false;
286
+			}
281 287
 			//Sync displayed list fields across the subpanels
282 288
 			$display_fields = $this->getDisplayFieldsFromCollection($this->sub_subpanels);
283 289
 			$query_fields = array();
@@ -291,10 +297,11 @@  discard block
 block discarded – undo
291 297
 					if (isset($def['vname']) && isset($def['width']))
292 298
 					{
293 299
 						$index++;
294
-						if(!empty($def['alias']))
295
-							$listFieldMap[$key][$def['alias']] = $field;
296
-						else
297
-							$listFieldMap[$key][$field] = $field;
300
+						if(!empty($def['alias'])) {
301
+													$listFieldMap[$key][$def['alias']] = $field;
302
+						} else {
303
+													$listFieldMap[$key][$field] = $field;
304
+						}
298 305
 						if (!isset($display_fields[$def['vname']]))
299 306
 						{
300 307
 							if(sizeof($display_fields) > $index)
@@ -332,13 +339,11 @@  discard block
 block discarded – undo
332 339
 					if (isset($subpanel->panel_definition['list_fields'][$field]))
333 340
 					{
334 341
 						$list_fields[$field] = $subpanel->panel_definition['list_fields'][$field];
335
-					}
336
-					else if ($list_key != $field && isset($subpanel->panel_definition['list_fields'][$list_key]))
342
+					} else if ($list_key != $field && isset($subpanel->panel_definition['list_fields'][$list_key]))
337 343
 					{
338 344
 						$list_fields[$list_key] = $subpanel->panel_definition['list_fields'][$list_key];
339 345
 
340
-					}
341
-					else {
346
+					} else {
342 347
 						$list_fields[$field] = $display_fields[$vname];
343 348
 					}
344 349
 				}
@@ -347,8 +352,7 @@  discard block
 block discarded – undo
347 352
 					if (isset($subpanel->panel_definition['list_fields'][$field]))
348 353
 					{
349 354
 						$list_fields[$field] = $subpanel->panel_definition['list_fields'][$field];
350
-					}
351
-					else {
355
+					} else {
352 356
 						$list_fields[$field] = $def;
353 357
 					}
354 358
 				}
@@ -624,18 +628,22 @@  discard block
 block discarded – undo
624 628
 		global $modListHeader ;
625 629
 		global $modules_exempt_from_availability_check ;
626 630
 
627
-		if (isset ( $this->_visible_tabs_array ))
628
-			return $this->_visible_tabs_array ;
631
+		if (isset ( $this->_visible_tabs_array )) {
632
+					return $this->_visible_tabs_array ;
633
+		}
629 634
 
630
-		if (empty($modListHeader))
631
-		    $modListHeader = query_module_access_list($GLOBALS['current_user']);
635
+		if (empty($modListHeader)) {
636
+				    $modListHeader = query_module_access_list($GLOBALS['current_user']);
637
+		}
632 638
 
633 639
 		$this->_visible_tabs_array = array ( ) ; // bug 16820 - make sure this is an array for the later ksort
634 640
 
635
-		if (isset ( $this->layout_defs [ 'subpanel_setup' ] )) // bug 17434 - belts-and-braces - check that we have some subpanels first
641
+		if (isset ( $this->layout_defs [ 'subpanel_setup' ] )) {
642
+		    // bug 17434 - belts-and-braces - check that we have some subpanels first
636 643
 		{
637 644
 			//retrieve list of hidden subpanels
638 645
 			$hidden_panels = $this->get_hidden_subpanels();
646
+		}
639 647
 
640 648
 			//activities is a special use case in that if it is hidden,
641 649
 			//then the history tab should be hidden too.
@@ -648,8 +656,9 @@  discard block
 block discarded – undo
648 656
 			{
649 657
 				//exclude if this subpanel is hidden from admin screens
650 658
                 $module = $key;
651
-                if ( isset($values_array['module']) )
652
-                    $module = strtolower($values_array['module']);
659
+                if ( isset($values_array['module']) ) {
660
+                                    $module = strtolower($values_array['module']);
661
+                }
653 662
 				 if ($hidden_panels && is_array($hidden_panels) && (in_array($module, $hidden_panels) || array_key_exists($module, $hidden_panels)) ){
654 663
 				 	//this panel is hidden, skip it
655 664
 				 	continue;
@@ -696,8 +705,9 @@  discard block
 block discarded – undo
696 705
 	 */
697 706
 	function load_subpanel ( $name , $reload = false , $original_only = false, $search_query = '', $collections = array() )
698 707
 	{
699
-		if (!is_dir('modules/' . $this->layout_defs [ 'subpanel_setup' ][ strtolower ( $name ) ] [ 'module' ]))
700
-			return false;
708
+		if (!is_dir('modules/' . $this->layout_defs [ 'subpanel_setup' ][ strtolower ( $name ) ] [ 'module' ])) {
709
+					return false;
710
+		}
701 711
 
702 712
 		$subpanel = new aSubPanel ( $name, $this->layout_defs [ 'subpanel_setup' ] [ strtolower ( $name ) ], $this->_focus, $reload, $original_only, $search_query, $collections ) ;
703 713
 
@@ -720,16 +730,19 @@  discard block
 block discarded – undo
720 730
 
721 731
 		if (empty ( $this->layout_defs ) || $reload || (! empty ( $layout_def_key ) && ! isset ( $layout_defs [ $layout_def_key ] )))
722 732
 		{
723
-			if (file_exists ( 'modules/' . $this->_focus->module_dir . '/metadata/subpaneldefs.php' ))
724
-				require ('modules/' . $this->_focus->module_dir . '/metadata/subpaneldefs.php') ;
733
+			if (file_exists ( 'modules/' . $this->_focus->module_dir . '/metadata/subpaneldefs.php' )) {
734
+							require ('modules/' . $this->_focus->module_dir . '/metadata/subpaneldefs.php') ;
735
+			}
725 736
 
726
-			if (! $original_only && file_exists ( 'custom/modules/' . $this->_focus->module_dir . '/Ext/Layoutdefs/layoutdefs.ext.php' ))
727
-				require ('custom/modules/' . $this->_focus->module_dir . '/Ext/Layoutdefs/layoutdefs.ext.php') ;
737
+			if (! $original_only && file_exists ( 'custom/modules/' . $this->_focus->module_dir . '/Ext/Layoutdefs/layoutdefs.ext.php' )) {
738
+							require ('custom/modules/' . $this->_focus->module_dir . '/Ext/Layoutdefs/layoutdefs.ext.php') ;
739
+			}
728 740
 
729
-			if (! empty ( $layout_def_key ))
730
-				$this->layout_defs = $layout_defs [ $layout_def_key ] ;
731
-			else
732
-				$this->layout_defs = $layout_defs [ $this->_focus->module_dir ] ;
741
+			if (! empty ( $layout_def_key )) {
742
+							$this->layout_defs = $layout_defs [ $layout_def_key ] ;
743
+			} else {
744
+							$this->layout_defs = $layout_defs [ $this->_focus->module_dir ] ;
745
+			}
733 746
 
734 747
 		}
735 748
 
@@ -785,11 +798,15 @@  discard block
 block discarded – undo
785 798
 		foreach($modules_to_check as $mod_name){
786 799
 
787 800
 			//skip if module name is not in bean list, otherwise get the bean class name
788
-			if(!isset($beanList[$mod_name])) continue;
801
+			if(!isset($beanList[$mod_name])) {
802
+			    continue;
803
+			}
789 804
 			$class = $beanList[$mod_name];
790 805
 
791 806
 			//skip if class name is not in file list, otherwise require the bean file and create new class
792
-			if(!isset($beanFiles[$class]) || !file_exists($beanFiles[$class])) continue;
807
+			if(!isset($beanFiles[$class]) || !file_exists($beanFiles[$class])) {
808
+			    continue;
809
+			}
793 810
 
794 811
 			//retrieve subpanels for this bean
795 812
 			require_once($beanFiles[$class]);
@@ -803,15 +820,20 @@  discard block
 block discarded – undo
803 820
 			foreach( $sub_tabs as $panel_key){
804 821
 				$panel_key = strtolower($panel_key);
805 822
                 $panel_module = $panel_key;
806
-                if ( isset($spd->layout_defs['subpanel_setup'][$panel_key]['module']) )
807
-                    $panel_module = strtolower($spd->layout_defs['subpanel_setup'][$panel_key]['module']);
823
+                if ( isset($spd->layout_defs['subpanel_setup'][$panel_key]['module']) ) {
824
+                                    $panel_module = strtolower($spd->layout_defs['subpanel_setup'][$panel_key]['module']);
825
+                }
808 826
                 //if module_only flag is set, only if it is also in module array
809
-				if($return_tab_modules_only && !array_key_exists($panel_module, $modules_to_check)) continue;
827
+				if($return_tab_modules_only && !array_key_exists($panel_module, $modules_to_check)) {
828
+				    continue;
829
+				}
810 830
 				$panel_key_name = $panel_module;
811 831
 
812 832
 				//group_by_key_name is set to true, then array will hold an entry for each
813 833
 				//subpanel, with the module name prepended in the key
814
-				if($group_by_module) $panel_key_name = $class.'_'.$panel_key_name;
834
+				if($group_by_module) {
835
+				    $panel_key_name = $class.'_'.$panel_key_name;
836
+				}
815 837
 				//add panel name to subpanel array
816 838
 				$spd_arr[$panel_key_name] = $panel_module;
817 839
 			}
@@ -864,12 +886,11 @@  discard block
 block discarded – undo
864 886
 					}
865 887
 
866 888
 
867
-				}else{
889
+				} else{
868 890
 					//no settings found, return empty
869 891
 					return $hidden_subpanels;
870 892
 				}
871
-			}
872
-			else
893
+			} else
873 894
 			{	//no settings found, return empty
874 895
 				return $hidden_subpanels;
875 896
 			}
Please login to merge, or discard this patch.
include/SubPanel/SubPanel.php 1 patch
Braces   +20 added lines, -12 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.
@@ -141,8 +143,7 @@  discard block
 block discarded – undo
141 143
 			if(empty($widget_data['widget_class']))
142 144
 			{
143 145
 				$widget_contents .= "widget_class not defined for top subpanel buttons";
144
-			}
145
-			else
146
+			} else
146 147
 			{
147 148
 				$widget_contents .= $layout_manager->widgetDisplay($widget_data);
148 149
 			}
@@ -163,7 +164,7 @@  discard block
 block discarded – undo
163 164
 
164 165
 		if(isset($this->listview)){
165 166
 			$ListView =& $this->listview;
166
-		}else{
167
+		} else{
167 168
 			$ListView = new ListView();
168 169
 		}
169 170
 		$ListView->initNewXTemplate($xTemplatePath,$this->subpanel_defs->mod_strings);
@@ -178,7 +179,9 @@  discard block
 block discarded – undo
178 179
 		$ListView->xTemplateAssign("SUBPANEL_ID", $this->subpanel_id);
179 180
 		$ListView->xTemplateAssign("SUBPANEL_SEARCH", $this->getSearchForm());
180 181
 		$display_sps = '';
181
-		if($this->search_query == '' && empty($this->collections)) $display_sps = 'display:none';
182
+		if($this->search_query == '' && empty($this->collections)) {
183
+		    $display_sps = 'display:none';
184
+		}
182 185
 		$ListView->xTemplateAssign("DISPLAY_SPS",$display_sps);
183 186
 
184 187
 		if(is_admin($current_user) && $_REQUEST['module'] != 'DynamicLayout' && !empty($_SESSION['editinplace']))
@@ -311,10 +314,12 @@  discard block
 block discarded – undo
311 314
   		$moduleInstaller = new ModuleInstaller();
312 315
   		$moduleInstaller->silent = true; // make sure that the ModuleInstaller->log() function doesn't echo while rebuilding the layoutdefs
313 316
   		$moduleInstaller->rebuild_layoutdefs();
314
-  		if (file_exists('modules/'.  $panel->parent_bean->module_dir . '/layout_defs.php'))
315
-  			include('modules/'.  $panel->parent_bean->module_dir . '/layout_defs.php');
316
-  		if (file_exists('custom/modules/'.  $panel->parent_bean->module_dir . '/Ext/Layoutdefs/layoutdefs.ext.php'))
317
-  			include('custom/modules/'.  $panel->parent_bean->module_dir . '/Ext/Layoutdefs/layoutdefs.ext.php');
317
+  		if (file_exists('modules/'.  $panel->parent_bean->module_dir . '/layout_defs.php')) {
318
+  		  			include('modules/'.  $panel->parent_bean->module_dir . '/layout_defs.php');
319
+  		}
320
+  		if (file_exists('custom/modules/'.  $panel->parent_bean->module_dir . '/Ext/Layoutdefs/layoutdefs.ext.php')) {
321
+  		  			include('custom/modules/'.  $panel->parent_bean->module_dir . '/Ext/Layoutdefs/layoutdefs.ext.php');
322
+  		}
318 323
   }
319 324
 
320 325
 	function get_subpanel_setup($module)
@@ -400,7 +405,9 @@  discard block
 block discarded – undo
400 405
 
401 406
 		$where_clauses = $searchForm->generateSearchWhere(true, $seed->module_dir);
402 407
 
403
-		if (count($where_clauses) > 0 )$this->search_query = '('. implode(' ) AND ( ', $where_clauses) . ')';
408
+		if (count($where_clauses) > 0 ) {
409
+		    $this->search_query = '('. implode(' ) AND ( ', $where_clauses) . ')';
410
+		}
404 411
 		$GLOBALS['log']->info("Subpanel Where Clause: $this->search_query");
405 412
 
406 413
 		return print_r($where_clauses,true);
@@ -436,8 +443,9 @@  discard block
 block discarded – undo
436 443
 
437 444
 			$searchForm->setup($subpanel_searchMetaData, $searchMetaData['searchFields'], 'SubpanelSearchFormGeneric.tpl', 'basic_search');
438 445
 
439
-			if(!empty($this->collections))
440
-				$searchForm->searchFields['collection'] = array();
446
+			if(!empty($this->collections)) {
447
+							$searchForm->searchFields['collection'] = array();
448
+			}
441 449
 
442 450
 			$searchForm->populateFromRequest();
443 451
 
Please login to merge, or discard this patch.