Completed
Push — console-installer ( 3d54e5...e2b50d )
by Adam
69:10 queued 48:24
created
modules/Home/UnifiedSearchAdvanced.php 1 patch
Spacing   +98 added lines, -98 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.
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
     /*search form class name*/
59 59
     var $searchFormClass = 'SearchForm';
60 60
 
61
-    function __construct(){
62
-        if(!empty($_REQUEST['query_string'])){
61
+    function __construct() {
62
+        if (!empty($_REQUEST['query_string'])) {
63 63
             $query_string = trim($_REQUEST['query_string']);
64
-            if(!empty($query_string)){
64
+            if (!empty($query_string)) {
65 65
                 $this->query_string = $query_string;
66 66
             }
67 67
         }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	function getDropDownDiv($tpl = 'modules/Home/UnifiedSearchAdvanced.tpl') {
73 73
 		global $app_list_strings, $app_strings;
74 74
 
75
-		if(!file_exists($this->cache_search))
75
+		if (!file_exists($this->cache_search))
76 76
 		{
77 77
 			$this->buildCache();
78 78
 		}
@@ -83,10 +83,10 @@  discard block
 block discarded – undo
83 83
 		$users_modules = $current_user->getPreference('globalSearch', 'search');
84 84
 
85 85
 		// preferences are empty, select all
86
-		if(empty($users_modules)) {
86
+		if (empty($users_modules)) {
87 87
 			$users_modules = array();
88
-			foreach($unified_search_modules_display as $module=>$data) {
89
-				if (!empty($data['visible']) ) {
88
+			foreach ($unified_search_modules_display as $module=>$data) {
89
+				if (!empty($data['visible'])) {
90 90
                     $users_modules[$module] = $beanList[$module];
91 91
                 }
92 92
 			}
@@ -97,15 +97,15 @@  discard block
 block discarded – undo
97 97
 
98 98
 		$modules_to_search = array();
99 99
 
100
-		foreach($users_modules as $key=>$module)
100
+		foreach ($users_modules as $key=>$module)
101 101
 		{
102
-            if(ACLController::checkAccess($key, 'list', true))
102
+            if (ACLController::checkAccess($key, 'list', true))
103 103
             {
104 104
                 $modules_to_search[$key]['checked'] = true;
105 105
             }
106 106
 		}
107 107
 
108
-		if(!empty($this->query_string))
108
+		if (!empty($this->query_string))
109 109
 		{
110 110
 			$sugar_smarty->assign('query_string', securexss($this->query_string));
111 111
 		} else {
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
 		$json_disabled = array();
122 122
 
123 123
 		//Now add the rest of the modules that are searchable via Global Search settings
124
-		foreach($unified_search_modules_display as $module=>$data)
124
+		foreach ($unified_search_modules_display as $module=>$data)
125 125
 		{
126
-			if(!isset($modules_to_search[$module]) && $data['visible'] && ACLController::checkAccess($module, 'list', true))
126
+			if (!isset($modules_to_search[$module]) && $data['visible'] && ACLController::checkAccess($module, 'list', true))
127 127
 			{
128 128
 			   $modules_to_search[$module]['checked'] = false;
129 129
 			} else if (isset($modules_to_search[$module]) && !$data['visible']) {
@@ -132,10 +132,10 @@  discard block
 block discarded – undo
132 132
 		}
133 133
 
134 134
 		//Create the two lists (doing it this way preserves the user's ordering choice for enabled modules)
135
-		foreach($modules_to_search as $module=>$data)
135
+		foreach ($modules_to_search as $module=>$data)
136 136
 		{
137 137
 			$label = isset($app_list_strings['moduleList'][$module]) ? $app_list_strings['moduleList'][$module] : $module;
138
-			if(!empty($data['checked']))
138
+			if (!empty($data['checked']))
139 139
 			{
140 140
 				$json_enabled[] = array("module" => $module, 'label' => $label);
141 141
 			} else {
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 		$sugar_smarty->assign('disabled_modules', json_encode($json_disabled));
148 148
 
149 149
 		$showDiv = $current_user->getPreference('showGSDiv', 'search');
150
-		if(!isset($showDiv))
150
+		if (!isset($showDiv))
151 151
 		{
152 152
 		   $showDiv = 'no';
153 153
 		}
@@ -181,11 +181,11 @@  discard block
 block discarded – undo
181 181
 
182 182
 		$this->query_string = $GLOBALS['db']->quote(securexss(from_html(clean_string($this->query_string, 'UNIFIED_SEARCH'))));
183 183
 
184
-		if(!empty($_REQUEST['advanced']) && $_REQUEST['advanced'] != 'false') {
184
+		if (!empty($_REQUEST['advanced']) && $_REQUEST['advanced'] != 'false') {
185 185
 			$modules_to_search = array();
186
-			if(!empty($_REQUEST['search_modules']))
186
+			if (!empty($_REQUEST['search_modules']))
187 187
 			{
188
-			    foreach(explode (',', $_REQUEST['search_modules'] ) as $key)
188
+			    foreach (explode(',', $_REQUEST['search_modules']) as $key)
189 189
 	            {
190 190
                     if (isset($unified_search_modules_display[$key]) && !empty($unified_search_modules_display[$key]['visible']))
191 191
                     {
@@ -200,16 +200,16 @@  discard block
 block discarded – undo
200 200
 			$users_modules = $current_user->getPreference('globalSearch', 'search');
201 201
 			$modules_to_search = array();
202 202
 
203
-			if(!empty($users_modules)) {
203
+			if (!empty($users_modules)) {
204 204
 				// use user's previous selections
205
-			    foreach ( $users_modules as $key => $value ) {
205
+			    foreach ($users_modules as $key => $value) {
206 206
 			    	if (isset($unified_search_modules_display[$key]) && !empty($unified_search_modules_display[$key]['visible'])) {
207 207
 		            	$modules_to_search[$key] = $beanList[$key];
208 208
 		        	}
209 209
 			    }
210 210
 			} else {
211
-				foreach($unified_search_modules_display as $module=>$data) {
212
-				    if (!empty($data['visible']) ) {
211
+				foreach ($unified_search_modules_display as $module=>$data) {
212
+				    if (!empty($data['visible'])) {
213 213
 				        $modules_to_search[$module] = $beanList[$module];
214 214
 				    }
215 215
 				}
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 
220 220
 
221 221
 		$templateFile = 'modules/Home/UnifiedSearchAdvancedForm.tpl';
222
-		if(file_exists('custom/' . $templateFile))
222
+		if (file_exists('custom/'.$templateFile))
223 223
 		{
224 224
 		   $templateFile = 'custom/'.$templateFile;
225 225
 		}
@@ -230,9 +230,9 @@  discard block
 block discarded – undo
230 230
 		$module_counts = array();
231 231
 		$has_results = false;
232 232
 
233
-		if(!empty($this->query_string)) {
234
-			foreach($modules_to_search as $moduleName => $beanName) {
235
-                require_once $beanFiles[$beanName] ;
233
+		if (!empty($this->query_string)) {
234
+			foreach ($modules_to_search as $moduleName => $beanName) {
235
+                require_once $beanFiles[$beanName];
236 236
                 $seed = new $beanName();
237 237
 
238 238
                 $lv = new ListViewSmarty();
@@ -243,25 +243,25 @@  discard block
 block discarded – undo
243 243
                 require('modules/'.$seed->module_dir.'/metadata/listviewdefs.php');
244 244
 				$orig_listViewDefs = $listViewDefs;
245 245
 
246
-                if(file_exists('custom/modules/'.$seed->module_dir.'/metadata/listviewdefs.php'))
246
+                if (file_exists('custom/modules/'.$seed->module_dir.'/metadata/listviewdefs.php'))
247 247
                 {
248 248
                     require('custom/modules/'.$seed->module_dir.'/metadata/listviewdefs.php');
249 249
                 }
250 250
 
251
-                if ( !isset($listViewDefs) || !isset($listViewDefs[$seed->module_dir]) )
251
+                if (!isset($listViewDefs) || !isset($listViewDefs[$seed->module_dir]))
252 252
                 {
253 253
                     continue;
254 254
                 }
255 255
 
256
-			    $unifiedSearchFields = array () ;
256
+			    $unifiedSearchFields = array();
257 257
                 $innerJoins = array();
258
-                foreach ( $unified_search_modules[ $moduleName ]['fields'] as $field=>$def )
258
+                foreach ($unified_search_modules[$moduleName]['fields'] as $field=>$def)
259 259
                 {
260 260
                 	$listViewCheckField = strtoupper($field);
261 261
                 	//check to see if the field is in listview defs
262
-					if ( empty($listViewDefs[$seed->module_dir][$listViewCheckField]['default']) ) {
262
+					if (empty($listViewDefs[$seed->module_dir][$listViewCheckField]['default'])) {
263 263
 						//check to see if field is in original list view defs (in case we are using custom layout defs)
264
-						if (!empty($orig_listViewDefs[$seed->module_dir][$listViewCheckField]['default']) ) {
264
+						if (!empty($orig_listViewDefs[$seed->module_dir][$listViewCheckField]['default'])) {
265 265
 							//if we are here then the layout has been customized, but the field is still needed for query creation
266 266
 							$listViewDefs[$seed->module_dir][$listViewCheckField] = $orig_listViewDefs[$seed->module_dir][$listViewCheckField];
267 267
 						}
@@ -270,9 +270,9 @@  discard block
 block discarded – undo
270 270
 
271 271
                     //bug: 34125 we might want to try to use the LEFT JOIN operator instead of the INNER JOIN in the case we are
272 272
                     //joining against a field that has not been populated.
273
-                    if(!empty($def['innerjoin']) )
273
+                    if (!empty($def['innerjoin']))
274 274
                     {
275
-                        if (empty($def['db_field']) )
275
+                        if (empty($def['db_field']))
276 276
                         {
277 277
                             continue;
278 278
                         }
@@ -280,37 +280,37 @@  discard block
 block discarded – undo
280 280
                         $def['innerjoin'] = str_replace('INNER', 'LEFT', $def['innerjoin']);
281 281
                     }
282 282
 
283
-                    if(isset($seed->field_defs[$field]['type']))
283
+                    if (isset($seed->field_defs[$field]['type']))
284 284
                     {
285 285
                         $type = $seed->field_defs[$field]['type'];
286
-                        if($type == 'int' && !is_numeric($this->query_string))
286
+                        if ($type == 'int' && !is_numeric($this->query_string))
287 287
                         {
288 288
                             continue;
289 289
                         }
290 290
                     }
291 291
 
292
-                    $unifiedSearchFields[ $moduleName ] [ $field ] = $def ;
293
-                    $unifiedSearchFields[ $moduleName ] [ $field ][ 'value' ] = $this->query_string ;
292
+                    $unifiedSearchFields[$moduleName] [$field] = $def;
293
+                    $unifiedSearchFields[$moduleName] [$field]['value'] = $this->query_string;
294 294
                 }
295 295
 
296 296
                 /*
297 297
                  * Use searchForm2->generateSearchWhere() to create the search query, as it can generate SQL for the full set of comparisons required
298 298
                  * generateSearchWhere() expects to find the search conditions for a field in the 'value' parameter of the searchFields entry for that field
299 299
                  */
300
-                require_once $beanFiles[$beanName] ;
300
+                require_once $beanFiles[$beanName];
301 301
                 $seed = new $beanName();
302 302
                 
303 303
 				require_once $this->searchFormPath;
304
-                $searchForm = new $this->searchFormClass ( $seed, $moduleName ) ;
304
+                $searchForm = new $this->searchFormClass($seed, $moduleName);
305 305
 
306
-                $searchForm->setup (array ( $moduleName => array() ) , $unifiedSearchFields , '' , 'saved_views' /* hack to avoid setup doing further unwanted processing */ ) ;
307
-                $where_clauses = $searchForm->generateSearchWhere() ;
306
+                $searchForm->setup(array($moduleName => array()), $unifiedSearchFields, '', 'saved_views' /* hack to avoid setup doing further unwanted processing */);
307
+                $where_clauses = $searchForm->generateSearchWhere();
308 308
                 //add inner joins back into the where clause
309 309
                 $params = array('custom_select' => "");
310
-                foreach($innerJoins as $field=>$def) {
310
+                foreach ($innerJoins as $field=>$def) {
311 311
                     if (isset ($def['db_field'])) {
312
-                      foreach($def['db_field'] as $dbfield)
313
-                          $where_clauses[] = $dbfield . " LIKE '" . $this->query_string . "%'";
312
+                      foreach ($def['db_field'] as $dbfield)
313
+                          $where_clauses[] = $dbfield." LIKE '".$this->query_string."%'";
314 314
                           $params['custom_select'] .= ", $dbfield";
315 315
                           $params['distinct'] = true;
316 316
                           //$filterFields[$dbfield] = $dbfield;
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 
320 320
                 if (count($where_clauses) > 0)
321 321
                 {
322
-                    $where = '(('. implode(' ) OR ( ', $where_clauses) . '))';
322
+                    $where = '(('.implode(' ) OR ( ', $where_clauses).'))';
323 323
                 }
324 324
                 else
325 325
                 {
@@ -328,16 +328,16 @@  discard block
 block discarded – undo
328 328
                     $where = '';
329 329
                 }
330 330
                 $displayColumns = array();
331
-                foreach($listViewDefs[$seed->module_dir] as $colName => $param)
331
+                foreach ($listViewDefs[$seed->module_dir] as $colName => $param)
332 332
                 {
333
-                    if(!empty($param['default']) && $param['default'] == true)
333
+                    if (!empty($param['default']) && $param['default'] == true)
334 334
                     {
335
-                        $param['url_sort'] = true;//bug 27933
335
+                        $param['url_sort'] = true; //bug 27933
336 336
                         $displayColumns[$colName] = $param;
337 337
                     }
338 338
                 }
339 339
 
340
-                if(count($displayColumns) > 0)
340
+                if (count($displayColumns) > 0)
341 341
                 {
342 342
                 	$lv->displayColumns = $displayColumns;
343 343
                 } else {
@@ -354,12 +354,12 @@  discard block
 block discarded – undo
354 354
 
355 355
                 $lv->setup($seed, 'include/ListView/ListViewNoMassUpdate.tpl', $where, $params, 0, 10);
356 356
 
357
-                $module_results[$moduleName] = '<br /><br />' . get_form_header($GLOBALS['app_list_strings']['moduleList'][$seed->module_dir] . ' (' . $lv->data['pageData']['offsets']['total'] . ')', '', false);
357
+                $module_results[$moduleName] = '<br /><br />'.get_form_header($GLOBALS['app_list_strings']['moduleList'][$seed->module_dir].' ('.$lv->data['pageData']['offsets']['total'].')', '', false);
358 358
                 $module_counts[$moduleName] = $lv->data['pageData']['offsets']['total'];
359 359
 
360
-                if($lv->data['pageData']['offsets']['total'] == 0) {
360
+                if ($lv->data['pageData']['offsets']['total'] == 0) {
361 361
                     //$module_results[$moduleName] .= "<li class='noBullet' id='whole_subpanel_{$moduleName}'><div id='div_{$moduleName}'><h2>" . $home_mod_strings['LBL_NO_RESULTS_IN_MODULE'] . '</h2></div></li>';
362
-                    $module_results[$moduleName] .= '<h2>' . $home_mod_strings['LBL_NO_RESULTS_IN_MODULE'] . '</h2>';
362
+                    $module_results[$moduleName] .= '<h2>'.$home_mod_strings['LBL_NO_RESULTS_IN_MODULE'].'</h2>';
363 363
                 } else {
364 364
                     $has_results = true;
365 365
                     //$module_results[$moduleName] .= "<li class='noBullet' id='whole_subpanel_{$moduleName}'><div id='div_{$moduleName}'>" . $lv->display(false, false) . '</div></li>';
@@ -369,11 +369,11 @@  discard block
 block discarded – undo
369 369
 			}
370 370
 		}
371 371
 
372
-		if($has_results) {
373
-			foreach($module_counts as $name=>$value) {
372
+		if ($has_results) {
373
+			foreach ($module_counts as $name=>$value) {
374 374
 				echo $module_results[$name];
375 375
 			}
376
-		} else if(empty($_REQUEST['form_only'])) {
376
+		} else if (empty($_REQUEST['form_only'])) {
377 377
 			echo $home_mod_strings['LBL_NO_RESULTS'];
378 378
 			echo $home_mod_strings['LBL_NO_RESULTS_TIPS'];
379 379
 		}
@@ -387,68 +387,68 @@  discard block
 block discarded – undo
387 387
 
388 388
 		$supported_modules = array();
389 389
 
390
-		foreach($beanList as $moduleName=>$beanName)
390
+		foreach ($beanList as $moduleName=>$beanName)
391 391
 		{
392 392
 			if (!isset($beanFiles[$beanName]))
393 393
 				continue;
394 394
 
395 395
 			$beanName = BeanFactory::getObjectName($moduleName);
396
-			$manager = new VardefManager ( );
397
-			$manager->loadVardef( $moduleName , $beanName ) ;
396
+			$manager = new VardefManager( );
397
+			$manager->loadVardef($moduleName, $beanName);
398 398
 
399 399
 			// obtain the field definitions used by generateSearchWhere (duplicate code in view.list.php)
400
-			if(file_exists('custom/modules/'.$moduleName.'/metadata/metafiles.php')){
400
+			if (file_exists('custom/modules/'.$moduleName.'/metadata/metafiles.php')) {
401 401
                 require('custom/modules/'.$moduleName.'/metadata/metafiles.php');
402
-            }elseif(file_exists('modules/'.$moduleName.'/metadata/metafiles.php')){
402
+            }elseif (file_exists('modules/'.$moduleName.'/metadata/metafiles.php')) {
403 403
                 require('modules/'.$moduleName.'/metadata/metafiles.php');
404 404
             }
405 405
 
406 406
 
407
-			if(!empty($metafiles[$moduleName]['searchfields']))
407
+			if (!empty($metafiles[$moduleName]['searchfields']))
408 408
 			{
409
-				require $metafiles[$moduleName]['searchfields'] ;
410
-			} else if(file_exists("modules/{$moduleName}/metadata/SearchFields.php")) {
411
-				require "modules/{$moduleName}/metadata/SearchFields.php" ;
409
+				require $metafiles[$moduleName]['searchfields'];
410
+			} else if (file_exists("modules/{$moduleName}/metadata/SearchFields.php")) {
411
+				require "modules/{$moduleName}/metadata/SearchFields.php";
412 412
 			}
413 413
 
414 414
 			//Load custom SearchFields.php if it exists
415
-			if(file_exists("custom/modules/{$moduleName}/metadata/SearchFields.php"))
415
+			if (file_exists("custom/modules/{$moduleName}/metadata/SearchFields.php"))
416 416
 			{
417
-				require "custom/modules/{$moduleName}/metadata/SearchFields.php" ;
417
+				require "custom/modules/{$moduleName}/metadata/SearchFields.php";
418 418
 			}				
419 419
 
420 420
             //If there are $searchFields are empty, just continue, there are no search fields defined for the module
421
-            if(empty($searchFields[$moduleName]))
421
+            if (empty($searchFields[$moduleName]))
422 422
             {
423 423
                 continue;
424 424
             }
425 425
 
426
-			$isCustomModule = preg_match('/^([a-z0-9]{1,5})_([a-z0-9_]+)$/i' , $moduleName);
426
+			$isCustomModule = preg_match('/^([a-z0-9]{1,5})_([a-z0-9_]+)$/i', $moduleName);
427 427
 
428 428
 			//If the bean supports unified search or if it's a custom module bean and unified search is not defined
429
-			if(!empty($dictionary[$beanName]['unified_search']) || $isCustomModule)
429
+			if (!empty($dictionary[$beanName]['unified_search']) || $isCustomModule)
430 430
 			{
431 431
 				$fields = array();
432
-				foreach ( $dictionary [ $beanName ][ 'fields' ] as $field => $def )
432
+				foreach ($dictionary [$beanName]['fields'] as $field => $def)
433 433
 				{
434 434
 					// We cannot enable or disable unified_search for email in the vardefs as we don't actually have a vardef entry for 'email'
435 435
 					// the searchFields entry for 'email' doesn't correspond to any vardef entry. Instead it contains SQL to directly perform the search.
436 436
 					// So as a proxy we allow any field in the vardefs that has a name starting with 'email...' to be tagged with the 'unified_search' parameter
437 437
 
438
-					if (strpos($field,'email') !== false)
438
+					if (strpos($field, 'email') !== false)
439 439
 					{
440
-						$field = 'email' ;
440
+						$field = 'email';
441 441
 					}
442 442
 
443 443
 					//bug: 38139 - allow phone to be searched through Global Search
444
-					if (strpos($field,'phone') !== false)
444
+					if (strpos($field, 'phone') !== false)
445 445
 					{
446
-						$field = 'phone' ;
446
+						$field = 'phone';
447 447
 					}
448 448
 
449
-					if ( !empty($def['unified_search']) && isset ( $searchFields [ $moduleName ] [ $field ]  ))
449
+					if (!empty($def['unified_search']) && isset ($searchFields [$moduleName] [$field]))
450 450
 					{
451
-						$fields [ $field ] = $searchFields [ $moduleName ] [ $field ] ;
451
+						$fields [$field] = $searchFields [$moduleName] [$field];
452 452
 					}
453 453
 				}
454 454
 
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
                     }
464 464
                 }
465 465
 
466
-				if(count($fields) > 0) {
466
+				if (count($fields) > 0) {
467 467
 					$supported_modules [$moduleName] ['fields'] = $fields;
468 468
 					if (isset($dictionary[$beanName]['unified_search_default_enabled']) && $dictionary[$beanName]['unified_search_default_enabled'] === TRUE)
469 469
 					{
@@ -494,10 +494,10 @@  discard block
 block discarded – undo
494 494
         //Add the translated attribute for display label
495 495
         $json_enabled = array();
496 496
         $json_disabled = array();
497
-        foreach($unified_search_modules_display as $module=>$data)
497
+        foreach ($unified_search_modules_display as $module=>$data)
498 498
         {
499 499
             $label = isset($app_list_strings['moduleList'][$module]) ? $app_list_strings['moduleList'][$module] : $module;
500
-            if($data['visible'] === true)
500
+            if ($data['visible'] === true)
501 501
             {
502 502
                 $json_enabled[] = array("module" => $module, 'label' => $label);
503 503
             }
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
         }
509 509
 
510 510
         //If the file doesn't exist
511
-        if(!file_exists($this->cache_search))
511
+        if (!file_exists($this->cache_search))
512 512
         {
513 513
             $this->buildCache();
514 514
         }
@@ -516,12 +516,12 @@  discard block
 block discarded – undo
516 516
         include($this->cache_search);
517 517
 
518 518
         //Now add any new modules that may have since been added to unified_search_modules.php
519
-        foreach($unified_search_modules as $module=>$data)
519
+        foreach ($unified_search_modules as $module=>$data)
520 520
         {
521
-            if(!isset($unified_search_modules_display[$module]))
521
+            if (!isset($unified_search_modules_display[$module]))
522 522
             {
523 523
                 $label = isset($app_list_strings['moduleList'][$module]) ? $app_list_strings['moduleList'][$module] : $module;
524
-                if($data['default'])
524
+                if ($data['default'])
525 525
                 {
526 526
                   $json_enabled[] = array("module" => $module, 'label' => $label);
527 527
                 } else {
@@ -542,20 +542,20 @@  discard block
 block discarded – undo
542 542
 	 */
543 543
 	function saveGlobalSearchSettings()
544 544
 	{
545
-		if(isset($_REQUEST['enabled_modules']))
545
+		if (isset($_REQUEST['enabled_modules']))
546 546
 		{
547 547
             $unified_search_modules_display = $this->getUnifiedSearchModulesDisplay();
548 548
 
549 549
 			$new_unified_search_modules_display = array();
550 550
 
551
-            foreach(explode (',', $_REQUEST['enabled_modules'] ) as $module)
551
+            foreach (explode(',', $_REQUEST['enabled_modules']) as $module)
552 552
             {
553 553
                 $new_unified_search_modules_display[$module]['visible'] = true;
554 554
             }
555 555
 
556
-			foreach($unified_search_modules_display as $module=>$data)
556
+			foreach ($unified_search_modules_display as $module=>$data)
557 557
 			{
558
-				if(!isset($new_unified_search_modules_display[$module]))
558
+				if (!isset($new_unified_search_modules_display[$module]))
559 559
 				{
560 560
 				   $new_unified_search_modules_display[$module]['visible'] = false;
561 561
 				}
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 	public static function unlinkUnifiedSearchModulesFile() {
570 570
 		//clear the unified_search_module.php file
571 571
 		$cache_search = sugar_cached('modules/unified_search_modules.php');
572
-    	if(file_exists($cache_search))
572
+    	if (file_exists($cache_search))
573 573
     	{
574 574
     		$GLOBALS['log']->info("unlink {$cache_search}");
575 575
     		unlink($cache_search);
@@ -589,14 +589,14 @@  discard block
 block discarded – undo
589 589
     {
590 590
 		//Make directory if it doesn't exist
591 591
         $cachedir = sugar_cached('modules');
592
-		if(!file_exists($cachedir))
592
+		if (!file_exists($cachedir))
593 593
 		{
594 594
 		   mkdir_recursive($cachedir);
595 595
 		}
596 596
 
597 597
 		//Load unified_search_modules.php file
598 598
         $cachedFile = sugar_cached('modules/unified_search_modules.php');
599
-		if(!file_exists($cachedFile))
599
+		if (!file_exists($cachedFile))
600 600
 		{
601 601
 			$this->buildCache();
602 602
 		}
@@ -616,15 +616,15 @@  discard block
 block discarded – undo
616 616
      */
617 617
     public function getUnifiedSearchModulesDisplay()
618 618
     {
619
-		if(!file_exists('custom/modules/unified_search_modules_display.php'))
619
+		if (!file_exists('custom/modules/unified_search_modules_display.php'))
620 620
 		{
621 621
             $unified_search_modules = $this->getUnifiedSearchModules();
622 622
 
623 623
             $unified_search_modules_display = array();
624 624
 
625
-            if(!empty($unified_search_modules))
625
+            if (!empty($unified_search_modules))
626 626
             {
627
-                foreach($unified_search_modules as $module=>$data)
627
+                foreach ($unified_search_modules as $module=>$data)
628 628
                 {
629 629
                     $unified_search_modules_display[$module]['visible'] = (isset($data['default']) && $data['default']) ? true : false;
630 630
                 }
@@ -647,12 +647,12 @@  discard block
 block discarded – undo
647 647
 	 */
648 648
 	private function writeUnifiedSearchModulesDisplayFile($unified_search_modules_display)
649 649
 	{
650
-		if(is_null($unified_search_modules_display) || empty($unified_search_modules_display))
650
+		if (is_null($unified_search_modules_display) || empty($unified_search_modules_display))
651 651
 		{
652 652
 		   return false;
653 653
 		}
654 654
 
655
-	    if(!write_array_to_file("unified_search_modules_display", $unified_search_modules_display, 'custom/modules/unified_search_modules_display.php'))
655
+	    if (!write_array_to_file("unified_search_modules_display", $unified_search_modules_display, 'custom/modules/unified_search_modules_display.php'))
656 656
 	    {
657 657
 	    	//Log error message and throw Exception
658 658
 	    	global $app_strings;
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
 
668 668
 
669 669
 function unified_search_modules_cmp($a, $b) {
670
-	if(!isset($a['translated']) || !isset($b['translated']))
670
+	if (!isset($a['translated']) || !isset($b['translated']))
671 671
 	{
672 672
 	   return 0;
673 673
 	}
Please login to merge, or discard this patch.
modules/Home/index.php 1 patch
Spacing   +43 added lines, -43 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.
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 require_once('include/MySugar/MySugar.php');
46 46
 
47 47
 // build dashlet cache file if not found
48
-if(!is_file($cachefile = sugar_cached('dashlets/dashlets.php'))) {
48
+if (!is_file($cachefile = sugar_cached('dashlets/dashlets.php'))) {
49 49
     require_once('include/Dashlets/DashletCacheBuilder.php');
50 50
 
51 51
     $dc = new DashletCacheBuilder();
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
 $hasUserPreferences = (!isset($pages) || empty($pages) || !isset($dashlets) || empty($dashlets)) ? false : true;
65 65
 
66
-if(!$hasUserPreferences){
66
+if (!$hasUserPreferences) {
67 67
     $dashlets = array();
68 68
 
69 69
     //list of preferences to move over and to where
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     $old_columns = $current_user->getPreference('columns', 'home');
89 89
     $old_dashlets = $current_user->getPreference('dashlets', 'home');
90 90
 
91
-    if (isset($old_columns) && !empty($old_columns) && isset($old_dashlets) && !empty($old_dashlets)){
91
+    if (isset($old_columns) && !empty($old_columns) && isset($old_dashlets) && !empty($old_dashlets)) {
92 92
         $columns = $old_columns;
93 93
         $dashlets = $old_dashlets;
94 94
 
@@ -98,23 +98,23 @@  discard block
 block discarded – undo
98 98
         $current_user->setPreference('columns', $old_columns, 0, 'home');
99 99
         $current_user->setPreference('dashlets', $old_dashlets, 0, 'home');
100 100
     }
101
-    else{
101
+    else {
102 102
         // This is here to get Sugar dashlets added above the rest
103
-        $dashlets[create_guid()] = array ('className' => 'SugarFeedDashlet',
103
+        $dashlets[create_guid()] = array('className' => 'SugarFeedDashlet',
104 104
             'module' => 'SugarFeed',
105 105
             'forceColumn' => 1,
106 106
             'fileLocation' => $dashletsFiles['SugarFeedDashlet']['file'],
107 107
         );
108 108
 
109
-        foreach($defaultDashlets as $dashletName=>$module){
109
+        foreach ($defaultDashlets as $dashletName=>$module) {
110 110
             // clint - fixes bug #20398
111 111
             // only display dashlets that are from visibile modules and that the user has permission to list
112 112
             $myDashlet = new MySugar($module);
113 113
             $displayDashlet = $myDashlet->checkDashletDisplay();
114
-            if (isset($dashletsFiles[$dashletName]) && $displayDashlet){
114
+            if (isset($dashletsFiles[$dashletName]) && $displayDashlet) {
115 115
                 $options = array();
116
-                $prefsforthisdashlet = array_keys($prefstomove,$dashletName);
117
-                foreach ( $prefsforthisdashlet as $pref ) {
116
+                $prefsforthisdashlet = array_keys($prefstomove, $dashletName);
117
+                foreach ($prefsforthisdashlet as $pref) {
118 118
                     $options[$pref] = $current_user->getPreference($pref);
119 119
                 }
120 120
                 $dashlets[create_guid()] = array('className' => $dashletName,
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
         $columns[1]['width'] = '40%';
135 135
         $columns[1]['dashlets'] = array();
136 136
 
137
-        foreach($dashlets as $guid=>$dashlet) {
138
-            if( $dashlet['forceColumn'] == 0 ) array_push($columns[0]['dashlets'], $guid);
137
+        foreach ($dashlets as $guid=>$dashlet) {
138
+            if ($dashlet['forceColumn'] == 0) array_push($columns[0]['dashlets'], $guid);
139 139
             else array_push($columns[1]['dashlets'], $guid);
140 140
             $count++;
141 141
         }
@@ -150,29 +150,29 @@  discard block
 block discarded – undo
150 150
 // handles upgrading from versions that had the 'Dashboard' module; move those items over to the Home page
151 151
 $pagesDashboard = $current_user->getPreference('pages', 'Dashboard');
152 152
 $dashletsDashboard = $current_user->getPreference('dashlets', 'Dashboard');
153
-if ( !empty($pagesDashboard) ) {
153
+if (!empty($pagesDashboard)) {
154 154
     // move dashlets from the dashboard to be at the end of the home screen dashlets
155
-    foreach ($pagesDashboard[0]['columns'] as $dashboardColumnKey => $dashboardColumn ) {
156
-        foreach ($dashboardColumn['dashlets'] as $dashletItem ) {
155
+    foreach ($pagesDashboard[0]['columns'] as $dashboardColumnKey => $dashboardColumn) {
156
+        foreach ($dashboardColumn['dashlets'] as $dashletItem) {
157 157
             $pages[0]['columns'][$dashboardColumnKey]['dashlets'][] = $dashletItem;
158 158
         }
159 159
     }
160
-    $pages = array_merge($pages,$pagesDashboard);
160
+    $pages = array_merge($pages, $pagesDashboard);
161 161
     $current_user->setPreference('pages', $pages, 0, 'Home');
162 162
 }
163
-if ( !empty($dashletsDashboard) ) {
164
-    $dashlets = array_merge($dashlets,$dashletsDashboard);
163
+if (!empty($dashletsDashboard)) {
164
+    $dashlets = array_merge($dashlets, $dashletsDashboard);
165 165
     $current_user->setPreference('dashlets', $dashlets, 0, 'Home');
166 166
 }
167
-if ( !empty($pagesDashboard) || !empty($dashletsDashboard) )
167
+if (!empty($pagesDashboard) || !empty($dashletsDashboard))
168 168
     $current_user->resetPreferences('Dashboard');
169 169
 
170
-if (empty($pages)){
170
+if (empty($pages)) {
171 171
     $pages = array();
172 172
     $pageIndex = 0;
173 173
     $pages[0]['columns'] = $columns;
174 174
     $pages[0]['numColumns'] = '3';
175
-    $pages[0]['pageTitleLabel'] = 'LBL_HOME_PAGE_1_NAME';	// "My Sugar"
175
+    $pages[0]['pageTitleLabel'] = 'LBL_HOME_PAGE_1_NAME'; // "My Sugar"
176 176
     $pageIndex++;
177 177
     $current_user->setPreference('pages', $pages, 0, 'Home');
178 178
     $activePage = 0;
@@ -191,34 +191,34 @@  discard block
 block discarded – undo
191 191
 $dashletIds = array(); // collect ids to pass to javascript
192 192
 $display = array();
193 193
 
194
-foreach($pages[$activePage]['columns'] as $colNum => $column) {
195
-    if ($colNum == $numCols){
194
+foreach ($pages[$activePage]['columns'] as $colNum => $column) {
195
+    if ($colNum == $numCols) {
196 196
         break;
197 197
     }
198 198
     $display[$colNum]['width'] = $column['width'];
199 199
     $display[$colNum]['dashlets'] = array();
200
-    foreach($column['dashlets'] as $num => $id) {
200
+    foreach ($column['dashlets'] as $num => $id) {
201 201
         // clint - fixes bug #20398
202 202
         // only display dashlets that are from visibile modules and that the user has permission to list
203
-        if(!empty($id) && isset($dashlets[$id]) && is_file($dashlets[$id]['fileLocation'])) {
203
+        if (!empty($id) && isset($dashlets[$id]) && is_file($dashlets[$id]['fileLocation'])) {
204 204
             $module = 'Home';
205
-            if ( !empty($dashletsFiles[$dashlets[$id]['className']]['module']) )
205
+            if (!empty($dashletsFiles[$dashlets[$id]['className']]['module']))
206 206
                 $module = $dashletsFiles[$dashlets[$id]['className']]['module'];
207 207
             // Bug 24772 - Look into the user preference for the module the dashlet is a part of in case
208 208
             //             of the Report Chart dashlets.
209
-            elseif ( !empty($dashlets[$id]['module']) )
209
+            elseif (!empty($dashlets[$id]['module']))
210 210
                 $module = $dashlets[$id]['module'];
211 211
 
212 212
             $myDashlet = new MySugar($module);
213 213
 
214
-            if($myDashlet->checkDashletDisplay()) {
214
+            if ($myDashlet->checkDashletDisplay()) {
215 215
                 require_once($dashlets[$id]['fileLocation']);
216 216
 
217 217
 
218 218
                 $dashlet = new $dashlets[$id]['className']($id, (isset($dashlets[$id]['options']) ? $dashlets[$id]['options'] : array()));
219 219
                 // Need to add support to dynamically display/hide dashlets
220 220
                 // If it has a method 'shouldDisplay' we will call it to see if we should display it or not
221
-                if (method_exists($dashlet,'shouldDisplay')) {
221
+                if (method_exists($dashlet, 'shouldDisplay')) {
222 222
                     if (!$dashlet->shouldDisplay()) {
223 223
                         // This dashlet doesn't want us to show it, skip it.
224 224
                         continue;
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 
230 230
                 $dashlets = $current_user->getPreference('dashlets', 'Home'); // Using hardcoded 'Home' because DynamicAction.php $_REQUEST['module'] value is always Home
231 231
                 $lvsParams = array();
232
-                if(!empty($dashlets[$id]['sort_options'])){
232
+                if (!empty($dashlets[$id]['sort_options'])) {
233 233
                     $lvsParams = $dashlets[$id]['sort_options'];
234 234
                 }
235 235
 
@@ -238,10 +238,10 @@  discard block
 block discarded – undo
238 238
                     $display[$colNum]['dashlets'][$id]['display'] = $dashlet->display();
239 239
                     $display[$colNum]['dashlets'][$id]['displayHeader'] = $dashlet->getHeader();
240 240
                     $display[$colNum]['dashlets'][$id]['displayFooter'] = $dashlet->getFooter();
241
-                    if($dashlet->hasScript) {
241
+                    if ($dashlet->hasScript) {
242 242
                         $display[$colNum]['dashlets'][$id]['script'] = $dashlet->displayScript();
243 243
                     }
244
-                } catch (Exception $ex) {
244
+                }catch (Exception $ex) {
245 245
                     $display[$colNum]['dashlets'][$id]['display'] = $ex->getMessage();
246 246
                     $display[$colNum]['dashlets'][$id]['displayHeader'] = $dashlet->getHeader();
247 247
                     $display[$colNum]['dashlets'][$id]['displayFooter'] = $dashlet->getFooter();
@@ -253,18 +253,18 @@  discard block
 block discarded – undo
253 253
 
254 254
 
255 255
 $i = 0;
256
-    while($i < count($pages)){
257
-        if($i == 0){
256
+    while ($i < count($pages)) {
257
+        if ($i == 0) {
258 258
             $pageTabs[$i]['pageTitle'] = $GLOBALS['app_strings']['LBL_SUITE_DASHBOARD'];
259 259
 //            $pageTabs[$i]['active'] = 'current';
260
-        }else{
260
+        } else {
261 261
             $pageTabs[$i]['pageTitle'] = $pages[$i]['pageTitle'];
262 262
             $divPages[] = $i;
263 263
         }
264 264
         $i++;
265 265
     }
266 266
 
267
-if(!empty($sugar_config['lock_homepage']) && $sugar_config['lock_homepage'] == true) $sugar_smarty->assign('lock_homepage', true);
267
+if (!empty($sugar_config['lock_homepage']) && $sugar_config['lock_homepage'] == true) $sugar_smarty->assign('lock_homepage', true);
268 268
 
269 269
 $sugar_smarty->assign('sugarVersion', $sugar_version);
270 270
 $sugar_smarty->assign('sugarFlavor', $sugar_flavor);
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 
275 275
 $sugar_smarty->assign('maxCount', empty($sugar_config['max_dashlets_homepage']) ? 15 : $sugar_config['max_dashlets_homepage']);
276 276
 $sugar_smarty->assign('dashletCount', $count);
277
-$sugar_smarty->assign('dashletIds', '["' . implode('","', $dashletIds) . '"]');
277
+$sugar_smarty->assign('dashletIds', '["'.implode('","', $dashletIds).'"]');
278 278
 $sugar_smarty->assign('columns', $display);
279 279
 
280 280
 global $theme;
@@ -305,16 +305,16 @@  discard block
 block discarded – undo
305 305
 $sugar_smarty->assign('chartResources', $resources);
306 306
 $sugar_smarty->assign('mySugarChartResources', $mySugarResources);
307 307
 
308
-if (file_exists("custom/themes/" . $theme ."/tpls/MySugar.tpl")) {
309
-    echo $sugar_smarty->fetch("custom/themes/" . $theme ."/tpls/MySugar.tpl");
308
+if (file_exists("custom/themes/".$theme."/tpls/MySugar.tpl")) {
309
+    echo $sugar_smarty->fetch("custom/themes/".$theme."/tpls/MySugar.tpl");
310 310
 }
311
-else if(file_exists('custom/include/MySugar/tpls/MySugar.tpl')) {
311
+else if (file_exists('custom/include/MySugar/tpls/MySugar.tpl')) {
312 312
     echo $sugar_smarty->fetch('custom/include/MySugar/tpls/MySugar.tpl');
313 313
 }
314
-elseif (file_exists("themes/" . $theme ."/tpls/MySugar.tpl")) {
315
-    echo $sugar_smarty->fetch("themes/" . $theme ."/tpls/MySugar.tpl");
314
+elseif (file_exists("themes/".$theme."/tpls/MySugar.tpl")) {
315
+    echo $sugar_smarty->fetch("themes/".$theme."/tpls/MySugar.tpl");
316 316
 }
317
-else if(file_exists('include/MySugar/tpls/MySugar.tpl')) {
317
+else if (file_exists('include/MySugar/tpls/MySugar.tpl')) {
318 318
     echo $sugar_smarty->fetch('include/MySugar/tpls/MySugar.tpl');
319 319
 }
320 320
 else {
Please login to merge, or discard this patch.
modules/Project/delete_project_tasks.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,12 +24,12 @@
 block discarded – undo
24 24
  * Used to delete a project's related tasks after a project is deleted
25 25
  */
26 26
 class delete_project_tasks {
27
-    function delete_tasks(&$bean, $event, $arguments){
27
+    function delete_tasks(&$bean, $event, $arguments) {
28 28
         global $db;
29 29
         $Task = BeanFactory::getBean('ProjectTask');
30 30
         $tasks = $Task->get_full_list("order_number", "project_task.project_id = '".$bean->id."'");
31 31
 
32
-        foreach($tasks as $task){
32
+        foreach ($tasks as $task) {
33 33
             $query = "UPDATE project_task SET deleted ='1' WHERE id ='".$task->id."'";
34 34
             $update = $db->query($query);
35 35
         }
Please login to merge, or discard this patch.
modules/Project/metadata/additionalDetails.php 1 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.
@@ -43,16 +43,16 @@  discard block
 block discarded – undo
43 43
 
44 44
 function additionalDetailsProject($fields) {
45 45
 	static $mod_strings;
46
-	if(empty($mod_strings)) {
46
+	if (empty($mod_strings)) {
47 47
 		global $current_language;
48 48
 		$mod_strings = return_module_language($current_language, 'Project');
49 49
 	}
50 50
 		
51 51
 	$overlib_string = '';
52 52
 	
53
-	if(!empty($fields['DESCRIPTION'])) {
54
-		$overlib_string .= '<b>'. $mod_strings['LBL_DESCRIPTION'] . '</b> ' . substr($fields['DESCRIPTION'], 0, 300);
55
-		if(strlen($fields['DESCRIPTION']) > 300) $overlib_string .= '...';
53
+	if (!empty($fields['DESCRIPTION'])) {
54
+		$overlib_string .= '<b>'.$mod_strings['LBL_DESCRIPTION'].'</b> '.substr($fields['DESCRIPTION'], 0, 300);
55
+		if (strlen($fields['DESCRIPTION']) > 300) $overlib_string .= '...';
56 56
 	}	
57 57
 
58 58
 	return array('fieldToAddTo' => 'NAME', 
Please login to merge, or discard this patch.
modules/Project/metadata/dashletviewdefs.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@  discard block
 block discarded – undo
1 1
 <?php
2
-$dashletData['ProjectDashlet']['searchFields'] = array (
2
+$dashletData['ProjectDashlet']['searchFields'] = array(
3 3
   'date_entered' => 
4
-  array (
4
+  array(
5 5
     'default' => '',
6 6
   ),
7 7
   'date_modified' => 
8
-  array (
8
+  array(
9 9
     'default' => '',
10 10
   ),
11 11
   'assigned_user_id' => 
12
-  array (
12
+  array(
13 13
     'type' => 'assigned_user_name',
14 14
     'default' => 'Administrator',
15 15
   ),
16 16
 );
17
-$dashletData['ProjectDashlet']['columns'] = array (
17
+$dashletData['ProjectDashlet']['columns'] = array(
18 18
   'name' => 
19
-  array (
19
+  array(
20 20
     'width' => '30%',
21 21
     'label' => 'LBL_LIST_NAME',
22 22
     'link' => true,
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     'name' => 'name',
25 25
   ),
26 26
   'status' => 
27
-  array (
27
+  array(
28 28
     'type' => 'enum',
29 29
     'default' => true,
30 30
     'label' => 'LBL_STATUS',
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     'name' => 'status',
33 33
   ),
34 34
   'estimated_start_date' => 
35
-  array (
35
+  array(
36 36
     'type' => 'date',
37 37
     'label' => 'LBL_DATE_START',
38 38
     'width' => '10%',
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
     'name' => 'estimated_start_date',
41 41
   ),
42 42
   'assigned_user_name' => 
43
-  array (
43
+  array(
44 44
     'width' => '8%',
45 45
     'label' => 'LBL_LIST_ASSIGNED_USER',
46 46
     'name' => 'assigned_user_name',
47 47
     'default' => true,
48 48
   ),
49 49
   'estimated_end_date' => 
50
-  array (
50
+  array(
51 51
     'type' => 'date',
52 52
     'label' => 'LBL_DATE_END',
53 53
     'width' => '10%',
@@ -55,21 +55,21 @@  discard block
 block discarded – undo
55 55
     'name' => 'estimated_end_date',
56 56
   ),
57 57
   'date_modified' => 
58
-  array (
58
+  array(
59 59
     'width' => '15%',
60 60
     'label' => 'LBL_DATE_MODIFIED',
61 61
     'name' => 'date_modified',
62 62
     'default' => false,
63 63
   ),
64 64
   'date_entered' => 
65
-  array (
65
+  array(
66 66
     'width' => '15%',
67 67
     'label' => 'LBL_DATE_ENTERED',
68 68
     'default' => false,
69 69
     'name' => 'date_entered',
70 70
   ),
71 71
   'created_by' => 
72
-  array (
72
+  array(
73 73
     'width' => '8%',
74 74
     'label' => 'LBL_CREATED',
75 75
     'name' => 'created_by',
Please login to merge, or discard this patch.
modules/Project/metadata/editviewdefs.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -41,96 +41,96 @@
 block discarded – undo
41 41
 
42 42
 
43 43
 $viewdefs ['Project'] =
44
-array (
44
+array(
45 45
   'EditView' => 
46
-  array (
46
+  array(
47 47
     'templateMeta' => 
48
-    array (
48
+    array(
49 49
       'maxColumns' => '2',
50 50
       'widths' => 
51
-      array (
51
+      array(
52 52
         0 => 
53
-        array (
53
+        array(
54 54
           'label' => '10',
55 55
           'field' => '30',
56 56
         ),
57 57
         1 => 
58
-        array (
58
+        array(
59 59
           'label' => '10',
60 60
           'field' => '30',
61 61
         ),
62 62
       ),
63 63
       'form' => 
64
-      array (
64
+      array(
65 65
         'hidden' => '<input type="hidden" name="is_template" value="{$is_template}" />',
66 66
         'buttons' => 
67
-        array (
67
+        array(
68 68
           0 => 'SAVE',
69 69
           1 => 
70
-          array (
70
+          array(
71 71
             'customCode' => '{if !empty($smarty.request.return_action) && $smarty.request.return_action == "ProjectTemplatesDetailView" && (!empty($fields.id.value) || !empty($smarty.request.return_id)) }<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="this.form.action.value=\'ProjectTemplatesDetailView\'; this.form.module.value=\'{$smarty.request.return_module}\'; this.form.record.value=\'{$smarty.request.return_id}\';" type="submit" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}" id="CANCEL{$place}"> {elseif !empty($smarty.request.return_action) && $smarty.request.return_action == "DetailView" && (!empty($fields.id.value) || !empty($smarty.request.return_id)) }<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="this.form.action.value=\'DetailView\'; this.form.module.value=\'{$smarty.request.return_module}\'; this.form.record.value=\'{$smarty.request.return_id}\';" type="submit" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}" id="CANCEL{$place}"> {elseif $is_template}<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="this.form.action.value=\'ProjectTemplatesListView\'; this.form.module.value=\'{$smarty.request.return_module}\'; this.form.record.value=\'{$smarty.request.return_id}\';" type="submit" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}" id="CANCEL{$place}"> {else}<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="this.form.action.value=\'index\'; this.form.module.value=\'{$smarty.request.return_module}\'; this.form.record.value=\'{$smarty.request.return_id}\';" type="submit" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}" id="CANCEL{$place}"> {/if}',
72 72
           ),
73 73
         ),
74 74
       ),
75 75
       'useTabs' => false,
76 76
       'tabDefs' => 
77
-      array (
77
+      array(
78 78
         'LBL_PROJECT_INFORMATION' => 
79
-        array (
79
+        array(
80 80
           'newTab' => false,
81 81
           'panelDefault' => 'expanded',
82 82
         ),
83 83
         'LBL_PANEL_ASSIGNMENT' => 
84
-        array (
84
+        array(
85 85
           'newTab' => false,
86 86
           'panelDefault' => 'expanded',
87 87
         ),
88 88
       ),
89 89
     ),
90 90
     'panels' => 
91
-    array (
91
+    array(
92 92
       'lbl_project_information' => 
93
-      array (
93
+      array(
94 94
         0 => 
95
-        array (
95
+        array(
96 96
           0 => 'name',
97 97
           1 => 'status',
98 98
         ),
99 99
         1 => 
100
-        array (
100
+        array(
101 101
           0 => 'estimated_start_date',
102 102
           1 => 'priority',
103 103
         ),
104 104
         2 => 
105
-        array (
105
+        array(
106 106
           0 => 'estimated_end_date',
107 107
           1 => '',
108 108
         ),
109 109
         3 => 
110
-        array (
110
+        array(
111 111
           0 => 'description',
112 112
         ),
113 113
       ),
114 114
       'LBL_PANEL_ASSIGNMENT' => 
115
-      array (
115
+      array(
116 116
         0 => 
117
-        array (
117
+        array(
118 118
           0 => 'assigned_user_name',
119 119
           1 => 
120
-          array (
120
+          array(
121 121
             'name' => 'am_projecttemplates_project_1_name',
122 122
           ),
123 123
         ),
124 124
         1 => 
125
-        array (
125
+        array(
126 126
           0 => 
127
-          array (
127
+          array(
128 128
             'name' => 'date_entered',
129 129
             'comment' => 'Date record created',
130 130
             'label' => 'LBL_DATE_ENTERED',
131 131
           ),
132 132
           1 => 
133
-          array (
133
+          array(
134 134
             'name' => 'date_modified',
135 135
             'comment' => 'Date record last modified',
136 136
             'label' => 'LBL_DATE_MODIFIED',
Please login to merge, or discard this patch.
modules/Project/metadata/searchdefs.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
 						'basic_search' => array(
49 49
 						 	'name',
50 50
 						 	array('name'=>'current_user_only', 'label'=>'LBL_CURRENT_USER_FILTER', 'type'=>'bool'),
51
-                            array ('name' => 'favorites_only','label' => 'LBL_FAVORITES_FILTER','type' => 'bool',),
51
+                            array('name' => 'favorites_only', 'label' => 'LBL_FAVORITES_FILTER', 'type' => 'bool',),
52 52
 
53 53
 
54 54
                         ),
Please login to merge, or discard this patch.
modules/Project/metadata/SearchFields.php 1 patch
Spacing   +17 added lines, -17 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.
@@ -40,31 +40,31 @@  discard block
 block discarded – undo
40 40
 global $current_user;
41 41
 $module_name = "Project";
42 42
 $searchFields['Project'] = 
43
-    array (
44
-        'name' => array( 'query_type'=>'default'),
45
-        'current_user_only'=> array('query_type'=>'default','db_field'=>array('assigned_user_id'),'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'),
43
+    array(
44
+        'name' => array('query_type'=>'default'),
45
+        'current_user_only'=> array('query_type'=>'default', 'db_field'=>array('assigned_user_id'), 'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'),
46 46
         'favorites_only' => array(
47 47
             'query_type'=>'format',
48 48
             'operator' => 'subquery',
49 49
             'subquery' => 'SELECT favorites.parent_id FROM favorites
50 50
 			                    WHERE favorites.deleted = 0
51 51
 			                        and favorites.parent_type = "'.$module_name.'"
52
-			                        and favorites.assigned_user_id = "' .$current_user->id . '") OR NOT ({0}',
52
+			                        and favorites.assigned_user_id = "' .$current_user->id.'") OR NOT ({0}',
53 53
             'db_field'=>array('id')),
54 54
 		//Range Search Support 
55
-	   'range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
56
-	   'start_range_date_entered' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
57
-	   'end_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
58
-	   'range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
59
-	   'start_range_date_modified' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
60
-       'end_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
55
+	   'range_date_entered' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
56
+	   'start_range_date_entered' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
57
+	   'end_range_date_entered' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
58
+	   'range_date_modified' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
59
+	   'start_range_date_modified' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
60
+       'end_range_date_modified' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
61 61
 	    
62
-	   'range_estimated_start_date' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
63
-	   'start_range_estimated_start_date' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
64
-	   'end_range_estimated_start_date' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
65
-	   'range_estimated_end_date' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
66
-	   'start_range_estimated_end_date' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
67
-       'end_range_estimated_end_date' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
62
+	   'range_estimated_start_date' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
63
+	   'start_range_estimated_start_date' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
64
+	   'end_range_estimated_start_date' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
65
+	   'range_estimated_end_date' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
66
+	   'start_range_estimated_end_date' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
67
+       'end_range_estimated_end_date' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
68 68
 		//Range Search Support 				
69 69
     );
70 70
 ?>
Please login to merge, or discard this patch.
modules/Project/metadata/detailviewdefs.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -41,49 +41,49 @@  discard block
 block discarded – undo
41 41
 
42 42
 
43 43
 $viewdefs ['Project'] =
44
-array (
44
+array(
45 45
   'DetailView' => 
46
-  array (
46
+  array(
47 47
     'templateMeta' => 
48
-    array (
48
+    array(
49 49
       'maxColumns' => '2',
50 50
       'widths' => 
51
-      array (
51
+      array(
52 52
         0 => 
53
-        array (
53
+        array(
54 54
           'label' => '10',
55 55
           'field' => '30',
56 56
         ),
57 57
         1 => 
58
-        array (
58
+        array(
59 59
           'label' => '10',
60 60
           'field' => '30',
61 61
         ),
62 62
       ),
63 63
       'includes' => 
64
-      array (
64
+      array(
65 65
         0 => 
66
-        array (
66
+        array(
67 67
           'file' => 'modules/Project/Project.js',
68 68
         ),
69 69
         1 => 
70
-        array (
70
+        array(
71 71
           'file' => 'modules/Project/js/custom_project.js',
72 72
         ),
73 73
       ),
74 74
       'form' => 
75
-      array (
75
+      array(
76 76
         'buttons' => 
77
-        array (
77
+        array(
78 78
           0 => 
79
-          array (
79
+          array(
80 80
             'customCode' => '<input title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" class="button" type="submit" name="Edit" id="edit_button" value="{$APP.LBL_EDIT_BUTTON_LABEL}"onclick="{if $IS_TEMPLATE}this.form.return_module.value=\'Project\'; this.form.return_action.value=\'ProjectTemplatesDetailView\'; this.form.return_id.value=\'{$id}\'; this.form.action.value=\'ProjectTemplatesEditView\';{else}this.form.return_module.value=\'Project\'; this.form.return_action.value=\'DetailView\'; this.form.return_id.value=\'{$id}\'; this.form.action.value=\'EditView\'; {/if}"/>',
81 81
             'sugar_html' => 
82
-            array (
82
+            array(
83 83
               'type' => 'submit',
84 84
               'value' => ' {$APP.LBL_EDIT_BUTTON_LABEL} ',
85 85
               'htmlOptions' => 
86
-              array (
86
+              array(
87 87
                 'id' => 'edit_button',
88 88
                 'class' => 'button',
89 89
                 'accessKey' => '{$APP.LBL_EDIT_BUTTON_KEY}',
@@ -93,15 +93,15 @@  discard block
 block discarded – undo
93 93
             ),
94 94
           ),
95 95
           1 => 
96
-          array (
96
+          array(
97 97
             'customCode' => '<input title="{$APP.LBL_DELETE_BUTTON_TITLE}" accessKey="{$APP.LBL_DELETE_BUTTON_KEY}" class="button" type="button" name="Delete" id="delete_button" value="{$APP.LBL_DELETE_BUTTON_LABEL}" onclick="project_delete(this);"/>',
98 98
             'sugar_html' => 
99
-            array (
99
+            array(
100 100
               'type' => 'button',
101 101
               'id' => 'delete_button',
102 102
               'value' => '{$APP.LBL_DELETE_BUTTON_LABEL}',
103 103
               'htmlOptions' => 
104
-              array (
104
+              array(
105 105
                 'title' => '{$APP.LBL_DELETE_BUTTON_TITLE}',
106 106
                 'accessKey' => '{$APP.LBL_DELETE_BUTTON_KEY}',
107 107
                 'id' => 'delete_button',
@@ -111,14 +111,14 @@  discard block
 block discarded – undo
111 111
             ),
112 112
           ),
113 113
           2 => 
114
-          array (
114
+          array(
115 115
             'customCode' => '<input title="{$APP.LBL_DUPLICATE_BUTTON_TITLE}" accessKey="{$APP.LBL_DUPLICATE_BUTTON_KEY}" class="button" type="submit" name="Duplicate" id="duplicate_button" value="{$APP.LBL_DUPLICATE_BUTTON_LABEL}"onclick="{if $IS_TEMPLATE}this.form.return_module.value=\'Project\'; this.form.return_action.value=\'ProjectTemplatesDetailView\'; this.form.isDuplicate.value=true; this.form.action.value=\'projecttemplateseditview\'; this.form.return_id.value=\'{$id}\';{else}this.form.return_module.value=\'Project\'; this.form.return_action.value=\'DetailView\'; this.form.isDuplicate.value=true; this.form.action.value=\'EditView\'; this.form.return_id.value=\'{$id}\';{/if}""/>',
116 116
             'sugar_html' => 
117
-            array (
117
+            array(
118 118
               'type' => 'submit',
119 119
               'value' => '{$APP.LBL_DUPLICATE_BUTTON_LABEL}',
120 120
               'htmlOptions' => 
121
-              array (
121
+              array(
122 122
                 'title' => '{$APP.LBL_DUPLICATE_BUTTON_TITLE}',
123 123
                 'accessKey' => '{$APP.LBL_DUPLICATE_BUTTON_KEY}',
124 124
                 'class' => 'button',
@@ -129,82 +129,82 @@  discard block
 block discarded – undo
129 129
             ),
130 130
           ),
131 131
           3 => 
132
-          array (
132
+          array(
133 133
             'customCode' => '<input title="{$APP.LBL_VIEW_GANTT_TITLE}" class="button" type="button" name="view_gantt" id="view_gantt" value="{$APP.LBL_GANTT_BUTTON_LABEL}" onclick="javascript:window.location.href=\'index.php?module=Project&action=view_GanttChart&project_id={$id}\'"/>',
134 134
           ),
135 135
         ),
136 136
       ),
137 137
       'useTabs' => true,
138 138
       'tabDefs' => 
139
-      array (
139
+      array(
140 140
         'LBL_PROJECT_INFORMATION' => 
141
-        array (
141
+        array(
142 142
           'newTab' => true,
143 143
           'panelDefault' => 'expanded',
144 144
         ),
145 145
         'LBL_PANEL_ASSIGNMENT' => 
146
-        array (
146
+        array(
147 147
           'newTab' => true,
148 148
           'panelDefault' => 'expanded',
149 149
         ),
150 150
       ),
151 151
     ),
152 152
     'panels' => 
153
-    array (
153
+    array(
154 154
       'lbl_project_information' => 
155
-      array (
155
+      array(
156 156
         0 => 
157
-        array (
157
+        array(
158 158
           0 => 'name',
159 159
           1 => 'status',
160 160
         ),
161 161
         1 => 
162
-        array (
162
+        array(
163 163
           0 => 
164
-          array (
164
+          array(
165 165
             'name' => 'estimated_start_date',
166 166
             'label' => 'LBL_DATE_START',
167 167
           ),
168 168
           1 => 'priority',
169 169
         ),
170 170
         2 => 
171
-        array (
171
+        array(
172 172
           0 => 
173
-          array (
173
+          array(
174 174
             'name' => 'estimated_end_date',
175 175
             'label' => 'LBL_DATE_END',
176 176
           ),
177 177
           1 => '',
178 178
         ),
179 179
         3 => 
180
-        array (
180
+        array(
181 181
           0 => 'description',
182 182
         ),
183 183
       ),
184 184
       'LBL_PANEL_ASSIGNMENT' => 
185
-      array (
185
+      array(
186 186
         0 => 
187
-        array (
187
+        array(
188 188
           0 => 
189
-          array (
189
+          array(
190 190
             'name' => 'assigned_user_name',
191 191
             'label' => 'LBL_ASSIGNED_TO',
192 192
           ),
193 193
           1 => 
194
-          array (
194
+          array(
195 195
             'name' => 'am_projecttemplates_project_1_name',
196 196
           ),
197 197
         ),
198 198
         1 => 
199
-        array (
199
+        array(
200 200
           0 => 
201
-          array (
201
+          array(
202 202
             'name' => 'date_entered',
203 203
             'comment' => 'Date record created',
204 204
             'label' => 'LBL_DATE_ENTERED',
205 205
           ),
206 206
           1 => 
207
-          array (
207
+          array(
208 208
             'name' => 'date_modified',
209 209
             'comment' => 'Date record last modified',
210 210
             'label' => 'LBL_DATE_MODIFIED',
Please login to merge, or discard this patch.