@@ -1,5 +1,7 @@ discard block |
||
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. |
@@ -84,8 +86,7 @@ discard block |
||
84 | 86 | } |
85 | 87 | $_SESSION[$this->var_order_by] = array('orderBy'=>$orderBy, 'direction'=> $direction); |
86 | 88 | $_SESSION['lvd']['last_ob'] = $orderBy; |
87 | - } |
|
88 | - else { |
|
89 | + } else { |
|
89 | 90 | $userPreferenceOrder = $GLOBALS['current_user']->getPreference('listviewOrder', $this->var_name); |
90 | 91 | if(!empty($_SESSION[$this->var_order_by])) { |
91 | 92 | $orderBy = $_SESSION[$this->var_order_by]['orderBy']; |
@@ -183,7 +184,7 @@ discard block |
||
183 | 184 | function getTotalCount($main_query){ |
184 | 185 | if(!empty($this->count_query)){ |
185 | 186 | $count_query = $this->count_query; |
186 | - }else{ |
|
187 | + } else{ |
|
187 | 188 | $count_query = $this->seed->create_list_count_query($main_query); |
188 | 189 | } |
189 | 190 | $result = $this->db->query($count_query); |
@@ -246,8 +247,7 @@ discard block |
||
246 | 247 | // if $params tell us to override all ordering |
247 | 248 | if(!empty($params['overrideOrder']) && !empty($params['orderBy'])) { |
248 | 249 | $order = $this->getOrderBy(strtolower($params['orderBy']), (empty($params['sortOrder']) ? '' : $params['sortOrder'])); // retreive from $_REQUEST |
249 | - } |
|
250 | - else { |
|
250 | + } else { |
|
251 | 251 | $order = $this->getOrderBy(); // retreive from $_REQUEST |
252 | 252 | } |
253 | 253 | |
@@ -274,8 +274,9 @@ discard block |
||
274 | 274 | } else { |
275 | 275 | $orderBy = $order['orderBy'] . ' ' . $order['sortOrder']; |
276 | 276 | //wdong, Bug 25476, fix the sorting problem of Oracle. |
277 | - if (isset($params['custom_order_by_override']['ori_code']) && $order['orderBy'] == $params['custom_order_by_override']['ori_code']) |
|
278 | - $orderBy = $params['custom_order_by_override']['custom_code'] . ' ' . $order['sortOrder']; |
|
277 | + if (isset($params['custom_order_by_override']['ori_code']) && $order['orderBy'] == $params['custom_order_by_override']['ori_code']) { |
|
278 | + $orderBy = $params['custom_order_by_override']['custom_code'] . ' ' . $order['sortOrder']; |
|
279 | + } |
|
279 | 280 | } |
280 | 281 | |
281 | 282 | if (empty($params['skipOrderSave'])) { // don't save preferences if told so |
@@ -293,11 +294,21 @@ discard block |
||
293 | 294 | $ret_array['inner_join'] = ' ' . implode(' ', $this->seed->listview_inner_join) . ' '; |
294 | 295 | } |
295 | 296 | |
296 | - if(!is_array($params)) $params = array(); |
|
297 | - if(!isset($params['custom_select'])) $params['custom_select'] = ''; |
|
298 | - if(!isset($params['custom_from'])) $params['custom_from'] = ''; |
|
299 | - if(!isset($params['custom_where'])) $params['custom_where'] = ''; |
|
300 | - if(!isset($params['custom_order_by'])) $params['custom_order_by'] = ''; |
|
297 | + if(!is_array($params)) { |
|
298 | + $params = array(); |
|
299 | + } |
|
300 | + if(!isset($params['custom_select'])) { |
|
301 | + $params['custom_select'] = ''; |
|
302 | + } |
|
303 | + if(!isset($params['custom_from'])) { |
|
304 | + $params['custom_from'] = ''; |
|
305 | + } |
|
306 | + if(!isset($params['custom_where'])) { |
|
307 | + $params['custom_where'] = ''; |
|
308 | + } |
|
309 | + if(!isset($params['custom_order_by'])) { |
|
310 | + $params['custom_order_by'] = ''; |
|
311 | + } |
|
301 | 312 | $main_query = $ret_array['select'] . $params['custom_select'] . $ret_array['from'] . $params['custom_from'] . $ret_array['inner_join']. $ret_array['where'] . $params['custom_where'] . $ret_array['order_by'] . $params['custom_order_by']; |
302 | 313 | //C.L. - Fix for 23461 |
303 | 314 | if(empty($_REQUEST['action']) || $_REQUEST['action'] != 'Popup') { |
@@ -305,13 +316,14 @@ discard block |
||
305 | 316 | } |
306 | 317 | if($limit < -1) { |
307 | 318 | $result = $this->db->query($main_query); |
308 | - } |
|
309 | - else { |
|
319 | + } else { |
|
310 | 320 | if($limit == -1) { |
311 | 321 | $limit = $this->getLimit(); |
312 | 322 | } |
313 | 323 | $dyn_offset = $this->getOffset(); |
314 | - if($dyn_offset > 0 || !is_int($dyn_offset))$offset = $dyn_offset; |
|
324 | + if($dyn_offset > 0 || !is_int($dyn_offset)) { |
|
325 | + $offset = $dyn_offset; |
|
326 | + } |
|
315 | 327 | |
316 | 328 | if(strcmp($offset, 'end') == 0){ |
317 | 329 | $totalCount = $this->getTotalCount($main_query); |
@@ -319,8 +331,7 @@ discard block |
||
319 | 331 | } |
320 | 332 | if($this->seed->ACLAccess('ListView')) { |
321 | 333 | $result = $this->db->limitQuery($main_query, $offset, $limit + 1); |
322 | - } |
|
323 | - else { |
|
334 | + } else { |
|
324 | 335 | $result = array(); |
325 | 336 | } |
326 | 337 | |
@@ -388,7 +399,9 @@ discard block |
||
388 | 399 | if(!isset($post_retrieve[$rows[$rowIndex[0]]['parent_type']])) { |
389 | 400 | $post_retrieve[$rows[$rowIndex[0]]['parent_type']] = array(); |
390 | 401 | } |
391 | - if(!empty($rows[$rowIndex[0]]['parent_id'])) $post_retrieve[$rows[$rowIndex[0]]['parent_type']][] = array('child_id' => $id , 'parent_id'=> $rows[$rowIndex[0]]['parent_id'], 'parent_type' => $rows[$rowIndex[0]]['parent_type'], 'type' => 'parent'); |
|
402 | + if(!empty($rows[$rowIndex[0]]['parent_id'])) { |
|
403 | + $post_retrieve[$rows[$rowIndex[0]]['parent_type']][] = array('child_id' => $id , 'parent_id'=> $rows[$rowIndex[0]]['parent_id'], 'parent_type' => $rows[$rowIndex[0]]['parent_type'], 'type' => 'parent'); |
|
404 | + } |
|
392 | 405 | } |
393 | 406 | if(isset($post_retrieve)) { |
394 | 407 | $parent_fields = $seed->retrieve_parent_fields($post_retrieve); |
@@ -416,7 +429,7 @@ discard block |
||
416 | 429 | } |
417 | 430 | if($idIndex[$row[$id_field]][0] == $dataIndex){ |
418 | 431 | $pageData['tag'][$dataIndex] = $temp->listviewACLHelper(); |
419 | - }else{ |
|
432 | + } else{ |
|
420 | 433 | $pageData['tag'][$dataIndex] = $pageData['tag'][$idIndex[$row[$id_field]][0]]; |
421 | 434 | } |
422 | 435 | $data[$dataIndex] = $temp->get_list_view_data($filter_fields); |
@@ -430,8 +443,7 @@ discard block |
||
430 | 443 | if($additionalDetailsAllow) { |
431 | 444 | if($this->additionalDetailsAjax) { |
432 | 445 | $ar = $this->getAdditionalDetailsAjax($data[$dataIndex]['ID']); |
433 | - } |
|
434 | - else { |
|
446 | + } else { |
|
435 | 447 | $additionalDetailsFile = 'modules/' . $this->seed->module_dir . '/metadata/additionalDetails.php'; |
436 | 448 | if(file_exists('custom/modules/' . $this->seed->module_dir . '/metadata/additionalDetails.php')){ |
437 | 449 | $additionalDetailsFile = 'custom/modules/' . $this->seed->module_dir . '/metadata/additionalDetails.php'; |
@@ -456,7 +468,9 @@ discard block |
||
456 | 468 | |
457 | 469 | if($offset > 0) { |
458 | 470 | $prevOffset = $offset - $limit; |
459 | - if($prevOffset < 0)$prevOffset = 0; |
|
471 | + if($prevOffset < 0) { |
|
472 | + $prevOffset = 0; |
|
473 | + } |
|
460 | 474 | } |
461 | 475 | $totalCount = $count + $offset; |
462 | 476 | |
@@ -490,16 +504,19 @@ discard block |
||
490 | 504 | isset($_REQUEST["module"]) && $_REQUEST["module"] == "MergeRecords") |
491 | 505 | { |
492 | 506 | $queryString = "-advanced_search"; |
493 | - } |
|
494 | - else if (isset($_REQUEST["searchFormTab"]) && $_REQUEST["searchFormTab"] == "basic_search") |
|
507 | + } else if (isset($_REQUEST["searchFormTab"]) && $_REQUEST["searchFormTab"] == "basic_search") |
|
495 | 508 | { |
496 | - if($seed->module_dir == "Reports") $searchMetaData = SearchFormReports::retrieveReportsSearchDefs(); |
|
497 | - else $searchMetaData = SearchForm::retrieveSearchDefs($seed->module_dir); |
|
509 | + if($seed->module_dir == "Reports") { |
|
510 | + $searchMetaData = SearchFormReports::retrieveReportsSearchDefs(); |
|
511 | + } else { |
|
512 | + $searchMetaData = SearchForm::retrieveSearchDefs($seed->module_dir); |
|
513 | + } |
|
498 | 514 | |
499 | 515 | $basicSearchFields = array(); |
500 | 516 | |
501 | - if( isset($searchMetaData['searchdefs']) && isset($searchMetaData['searchdefs'][$seed->module_dir]['layout']['basic_search']) ) |
|
502 | - $basicSearchFields = $searchMetaData['searchdefs'][$seed->module_dir]['layout']['basic_search']; |
|
517 | + if( isset($searchMetaData['searchdefs']) && isset($searchMetaData['searchdefs'][$seed->module_dir]['layout']['basic_search']) ) { |
|
518 | + $basicSearchFields = $searchMetaData['searchdefs'][$seed->module_dir]['layout']['basic_search']; |
|
519 | + } |
|
503 | 520 | |
504 | 521 | foreach( $basicSearchFields as $basicSearchField) |
505 | 522 | { |
@@ -573,8 +590,7 @@ discard block |
||
573 | 590 | { |
574 | 591 | $queries['endPage'] = $queries['baseURL']; |
575 | 592 | $queries['endPage'][$this->var_offset] = $endOffset; |
576 | - } |
|
577 | - else |
|
593 | + } else |
|
578 | 594 | { |
579 | 595 | $queries['endPage'] = $queries['baseURL']; |
580 | 596 | $queries['endPage'][$this->var_offset] = 'end'; |
@@ -1,5 +1,7 @@ discard block |
||
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. |
@@ -56,12 +58,14 @@ discard block |
||
56 | 58 | function sugar_mkdir($pathname, $mode=null, $recursive=false, $context='') { |
57 | 59 | $mode = get_mode('dir_mode', $mode); |
58 | 60 | |
59 | - if ( sugar_is_dir($pathname,$mode) ) |
|
60 | - return true; |
|
61 | + if ( sugar_is_dir($pathname,$mode) ) { |
|
62 | + return true; |
|
63 | + } |
|
61 | 64 | |
62 | 65 | $result = false; |
63 | - if(empty($mode)) |
|
64 | - $mode = 0777; |
|
66 | + if(empty($mode)) { |
|
67 | + $mode = 0777; |
|
68 | + } |
|
65 | 69 | if(empty($context)) { |
66 | 70 | $result = @mkdir($pathname, $mode, $recursive); |
67 | 71 | } else { |
@@ -82,8 +86,7 @@ discard block |
||
82 | 86 | return false; |
83 | 87 | } |
84 | 88 | } |
85 | - } |
|
86 | - else { |
|
89 | + } else { |
|
87 | 90 | $errorMessage = "Cannot create directory $pathname cannot be touched"; |
88 | 91 | if(is_null($GLOBALS['log'])) { |
89 | 92 | throw new Exception("Error occurred but the system doesn't have logger. Error message: \"$errorMessage\""); |
@@ -285,15 +288,16 @@ discard block |
||
285 | 288 | * @return boolean Returns TRUE on success or FALSE on failure. |
286 | 289 | */ |
287 | 290 | function sugar_chmod($filename, $mode=null) { |
288 | - if ( !is_int($mode) ) |
|
289 | - $mode = (int) $mode; |
|
291 | + if ( !is_int($mode) ) { |
|
292 | + $mode = (int) $mode; |
|
293 | + } |
|
290 | 294 | if(!is_windows()){ |
291 | 295 | if(!isset($mode)){ |
292 | 296 | $mode = get_mode('file_mode', $mode); |
293 | 297 | } |
294 | 298 | if(isset($mode) && $mode > 0){ |
295 | 299 | return @chmod($filename, $mode); |
296 | - }else{ |
|
300 | + } else{ |
|
297 | 301 | return false; |
298 | 302 | } |
299 | 303 | } |
@@ -313,11 +317,11 @@ discard block |
||
313 | 317 | if(!is_windows()){ |
314 | 318 | if(strlen($user)){ |
315 | 319 | return chown($filename, $user); |
316 | - }else{ |
|
320 | + } else{ |
|
317 | 321 | if(strlen($GLOBALS['sugar_config']['default_permissions']['user'])){ |
318 | 322 | $user = $GLOBALS['sugar_config']['default_permissions']['user']; |
319 | 323 | return chown($filename, $user); |
320 | - }else{ |
|
324 | + } else{ |
|
321 | 325 | return false; |
322 | 326 | } |
323 | 327 | } |
@@ -338,11 +342,11 @@ discard block |
||
338 | 342 | if(!is_windows()){ |
339 | 343 | if(!empty($group)){ |
340 | 344 | return chgrp($filename, $group); |
341 | - }else{ |
|
345 | + } else{ |
|
342 | 346 | if(!empty($GLOBALS['sugar_config']['default_permissions']['group'])){ |
343 | 347 | $group = $GLOBALS['sugar_config']['default_permissions']['group']; |
344 | 348 | return chgrp($filename, $group); |
345 | - }else{ |
|
349 | + } else{ |
|
346 | 350 | return false; |
347 | 351 | } |
348 | 352 | } |
@@ -361,8 +365,9 @@ discard block |
||
361 | 365 | * @return int - the mode either found in the config file or passed in via the input parameter |
362 | 366 | */ |
363 | 367 | function get_mode($key = 'dir_mode', $mode=null) { |
364 | - if ( !is_int($mode) ) |
|
365 | - $mode = (int) $mode; |
|
368 | + if ( !is_int($mode) ) { |
|
369 | + $mode = (int) $mode; |
|
370 | + } |
|
366 | 371 | if(!class_exists('SugarConfig', true)) { |
367 | 372 | require 'include/SugarObjects/SugarConfig.php'; |
368 | 373 | } |
@@ -374,12 +379,16 @@ discard block |
||
374 | 379 | } |
375 | 380 | |
376 | 381 | function sugar_is_dir($path, $mode='r'){ |
377 | - if(defined('TEMPLATE_URL'))return is_dir($path, $mode); |
|
382 | + if(defined('TEMPLATE_URL')) { |
|
383 | + return is_dir($path, $mode); |
|
384 | + } |
|
378 | 385 | return is_dir($path); |
379 | 386 | } |
380 | 387 | |
381 | 388 | function sugar_is_file($path, $mode='r'){ |
382 | - if(defined('TEMPLATE_URL'))return is_file($path, $mode); |
|
389 | + if(defined('TEMPLATE_URL')) { |
|
390 | + return is_file($path, $mode); |
|
391 | + } |
|
383 | 392 | return is_file($path); |
384 | 393 | } |
385 | 394 |
@@ -84,7 +84,9 @@ discard block |
||
84 | 84 | $cacheDir = create_cache_directory('modules/'. $module . '/'); |
85 | 85 | $d = dir($cacheDir); |
86 | 86 | while($e = $d->read()){ |
87 | - if(!empty($view) && $e != $view )continue; |
|
87 | + if(!empty($view) && $e != $view ) { |
|
88 | + continue; |
|
89 | + } |
|
88 | 90 | $end =strlen($e) - 4; |
89 | 91 | if(is_file($cacheDir . $e) && $end > 1 && substr($e, $end) == '.tpl'){ |
90 | 92 | unlink($cacheDir . $e); |
@@ -181,8 +183,9 @@ discard block |
||
181 | 183 | $javascript->setFormName($view); |
182 | 184 | |
183 | 185 | $javascript->setSugarBean($sugarbean); |
184 | - if ($view != "ConvertLead") |
|
185 | - $javascript->addAllFields('', null,true); |
|
186 | + if ($view != "ConvertLead") { |
|
187 | + $javascript->addAllFields('', null,true); |
|
188 | + } |
|
186 | 189 | |
187 | 190 | $validatedFields = array(); |
188 | 191 | $javascript->addToValidateBinaryDependency('assigned_user_name', 'alpha', $javascript->buildStringToTranslateInSmarty('ERR_SQS_NO_MATCH_FIELD').': '.$javascript->buildStringToTranslateInSmarty('LBL_ASSIGNED_TO'), 'false', '', 'assigned_user_id'); |
@@ -205,8 +208,7 @@ discard block |
||
205 | 208 | || isset($app_strings[$def['vname']]) |
206 | 209 | || translate($def['vname'],$sugarbean->module_dir) != $def['vname']) { |
207 | 210 | $vname = $def['vname']; |
208 | - } |
|
209 | - else{ |
|
211 | + } else{ |
|
210 | 212 | $vname = "undefined"; |
211 | 213 | } |
212 | 214 | $javascript->addToValidateBinaryDependency($name, 'alpha', $javascript->buildStringToTranslateInSmarty('ERR_SQS_NO_MATCH_FIELD').': '.$javascript->buildStringToTranslateInSmarty($vname), (!empty($def['required']) ? 'true' : 'false'), '', $def['id_name']); |
@@ -218,7 +220,7 @@ discard block |
||
218 | 220 | $contents .= $javascript->getScript(); |
219 | 221 | $contents .= $this->createQuickSearchCode($defs, $defs2, $view, $module); |
220 | 222 | $contents .= "{/literal}\n"; |
221 | - }else if(preg_match('/^SearchForm_.+/', $view)){ |
|
223 | + } else if(preg_match('/^SearchForm_.+/', $view)){ |
|
222 | 224 | global $dictionary, $beanList, $app_strings, $mod_strings; |
223 | 225 | $mod = $beanList[$module]; |
224 | 226 | |
@@ -320,10 +322,12 @@ discard block |
||
320 | 322 | { |
321 | 323 | $sqs_objects = array(); |
322 | 324 | require_once('include/QuickSearchDefaults.php'); |
323 | - if(isset($this) && $this instanceof TemplateHandler) //If someone calls createQuickSearchCode as a static method (@see ImportViewStep3) $this becomes anoter object, not TemplateHandler |
|
325 | + if(isset($this) && $this instanceof TemplateHandler) { |
|
326 | + //If someone calls createQuickSearchCode as a static method (@see ImportViewStep3) $this becomes anoter object, not TemplateHandler |
|
324 | 327 | { |
325 | 328 | $qsd = QuickSearchDefaults::getQuickSearchDefaults($this->getQSDLookup()); |
326 | - }else |
|
329 | + } |
|
330 | + } else |
|
327 | 331 | { |
328 | 332 | $qsd = QuickSearchDefaults::getQuickSearchDefaults(array()); |
329 | 333 | } |
@@ -332,7 +336,7 @@ discard block |
||
332 | 336 | if(strpos($view, 'popup_query_form')){ |
333 | 337 | $qsd->setFormName('popup_query_form'); |
334 | 338 | $parsedView = 'advanced'; |
335 | - }else{ |
|
339 | + } else{ |
|
336 | 340 | $qsd->setFormName('search_form'); |
337 | 341 | $parsedView = preg_replace("/^SearchForm_/", "", $view); |
338 | 342 | } |
@@ -350,8 +354,7 @@ discard block |
||
350 | 354 | |
351 | 355 | if(!empty($f['name']) && !empty($f['id_name'])) { |
352 | 356 | $sqs_objects[$name.'_'.$parsedView] = $qsd->getQSUser($f['name'],$f['id_name']); |
353 | - } |
|
354 | - else { |
|
357 | + } else { |
|
355 | 358 | $sqs_objects[$name.'_'.$parsedView] = $qsd->getQSUser(); |
356 | 359 | } |
357 | 360 | } else if($matches[0] == 'Campaigns') { |
@@ -387,13 +390,16 @@ discard block |
||
387 | 390 | } //if-else |
388 | 391 | } //foreach |
389 | 392 | |
390 | - foreach ( $sqs_objects as $name => $field ) |
|
391 | - foreach ( $field['populate_list'] as $key => $fieldname ) |
|
393 | + foreach ( $sqs_objects as $name => $field ) { |
|
394 | + foreach ( $field['populate_list'] as $key => $fieldname ) |
|
392 | 395 | $sqs_objects[$name]['populate_list'][$key] = $sqs_objects[$name]['populate_list'][$key] . '_'.$parsedView; |
393 | - }else{ |
|
396 | + } |
|
397 | + } else{ |
|
394 | 398 | //Loop through the Meta-Data fields to see which ones need quick search support |
395 | 399 | foreach($defs2 as $f) { |
396 | - if(!isset($defs[$f['name']])) continue; |
|
400 | + if(!isset($defs[$f['name']])) { |
|
401 | + continue; |
|
402 | + } |
|
397 | 403 | |
398 | 404 | $field = $defs[$f['name']]; |
399 | 405 | if ($view == "ConvertLead") |
@@ -404,13 +410,13 @@ discard block |
||
404 | 410 | $ida_suffix = "_".$lc_module.$lc_module."_ida"; |
405 | 411 | if (preg_match('/'.$ida_suffix.'$/', $field['id_name']) > 0) { |
406 | 412 | $field['id_name'] = $module . $field['id_name']; |
413 | + } else { |
|
414 | + $field['id_name'] = $field['name'] . "_" . $field['id_name']; |
|
415 | + } |
|
416 | + } else { |
|
417 | + if (!empty($field['id_name'])) { |
|
418 | + $field['id_name'] = $module.$field['id_name']; |
|
407 | 419 | } |
408 | - else |
|
409 | - $field['id_name'] = $field['name'] . "_" . $field['id_name']; |
|
410 | - } |
|
411 | - else { |
|
412 | - if (!empty($field['id_name'])) |
|
413 | - $field['id_name'] = $module.$field['id_name']; |
|
414 | 420 | } |
415 | 421 | } |
416 | 422 | $name = $qsd->form_name . '_' . $field['name']; |
@@ -428,10 +434,9 @@ discard block |
||
428 | 434 | if($field['name'] == 'reports_to_name'){ |
429 | 435 | $sqs_objects[$name] = $qsd->getQSUser('reports_to_name','reports_to_id'); |
430 | 436 | // Bug #52994 : QuickSearch for a 1-M User relationship changes assigned to user |
431 | - }elseif($field['name'] == 'assigned_user_name'){ |
|
437 | + } elseif($field['name'] == 'assigned_user_name'){ |
|
432 | 438 | $sqs_objects[$name] = $qsd->getQSUser('assigned_user_name','assigned_user_id'); |
433 | - } |
|
434 | - else |
|
439 | + } else |
|
435 | 440 | { |
436 | 441 | $sqs_objects[$name] = $qsd->getQSUser($field['name'], $field['id_name']); |
437 | 442 | |
@@ -462,9 +467,9 @@ discard block |
||
462 | 467 | if(!isset($field['field_list']) && !isset($field['populate_list'])) { |
463 | 468 | $sqs_objects[$name]['populate_list'] = array($field['name'], $field['id_name']); |
464 | 469 | // now handle quicksearches where the column to match is not 'name' but rather specified in 'rname' |
465 | - if (!isset($field['rname'])) |
|
466 | - $sqs_objects[$name]['field_list'] = array('name', 'id'); |
|
467 | - else |
|
470 | + if (!isset($field['rname'])) { |
|
471 | + $sqs_objects[$name]['field_list'] = array('name', 'id'); |
|
472 | + } else |
|
468 | 473 | { |
469 | 474 | $sqs_objects[$name]['field_list'] = array($field['rname'], 'id'); |
470 | 475 | $sqs_objects[$name]['order'] = $field['rname']; |
@@ -161,13 +161,17 @@ discard block |
||
161 | 161 | echo $jsAlerts->getScript(); |
162 | 162 | } |
163 | 163 | |
164 | - if ($this->_getOption('show_subpanels') && !empty($_REQUEST['record'])) $this->_displaySubPanels(); |
|
164 | + if ($this->_getOption('show_subpanels') && !empty($_REQUEST['record'])) { |
|
165 | + $this->_displaySubPanels(); |
|
166 | + } |
|
165 | 167 | |
166 | 168 | if ($this->action === 'Login') { |
167 | 169 | //this is needed for a faster loading login page ie won't render unless the tables are closed |
168 | 170 | ob_flush(); |
169 | 171 | } |
170 | - if ($this->_getOption('show_footer')) $this->displayFooter(); |
|
172 | + if ($this->_getOption('show_footer')) { |
|
173 | + $this->displayFooter(); |
|
174 | + } |
|
171 | 175 | $GLOBALS['logic_hook']->call_custom_logic('', 'after_ui_footer'); |
172 | 176 | if ($this->_getOption('json_output')) |
173 | 177 | { |
@@ -186,11 +190,13 @@ discard block |
||
186 | 190 | 'favicon' => $this->getFavicon(), |
187 | 191 | ); |
188 | 192 | |
189 | - if(SugarThemeRegistry::current()->name == 'Classic' || SugarThemeRegistry::current()->classic) |
|
190 | - $ajax_ret['moduleList'] = $this->displayHeader(true); |
|
193 | + if(SugarThemeRegistry::current()->name == 'Classic' || SugarThemeRegistry::current()->classic) { |
|
194 | + $ajax_ret['moduleList'] = $this->displayHeader(true); |
|
195 | + } |
|
191 | 196 | |
192 | - if(empty($this->responseTime)) |
|
193 | - $this->_calculateFooterMetrics(); |
|
197 | + if(empty($this->responseTime)) { |
|
198 | + $this->_calculateFooterMetrics(); |
|
199 | + } |
|
194 | 200 | $ajax_ret['responseTime'] = $this->responseTime; |
195 | 201 | $json = getJSONobj(); |
196 | 202 | echo $json->encode($ajax_ret); |
@@ -214,8 +220,7 @@ discard block |
||
214 | 220 | |
215 | 221 | if ( !$this->suppressDisplayErrors ) { |
216 | 222 | echo $errors; |
217 | - } |
|
218 | - else { |
|
223 | + } else { |
|
219 | 224 | return $errors; |
220 | 225 | } |
221 | 226 | } |
@@ -329,24 +334,26 @@ discard block |
||
329 | 334 | ob_end_clean(); |
330 | 335 | |
331 | 336 | // get favicon |
332 | - if(isset($GLOBALS['sugar_config']['default_module_favicon'])) |
|
333 | - $module_favicon = $GLOBALS['sugar_config']['default_module_favicon']; |
|
334 | - else |
|
335 | - $module_favicon = false; |
|
337 | + if(isset($GLOBALS['sugar_config']['default_module_favicon'])) { |
|
338 | + $module_favicon = $GLOBALS['sugar_config']['default_module_favicon']; |
|
339 | + } else { |
|
340 | + $module_favicon = false; |
|
341 | + } |
|
336 | 342 | |
337 | 343 | $favicon = $this->getFavicon(); |
338 | 344 | $ss->assign('FAVICON_URL', $favicon['url']); |
339 | 345 | |
340 | 346 | // build the shortcut menu |
341 | 347 | $shortcut_menu = array(); |
342 | - foreach ( $this->getMenu() as $key => $menu_item ) |
|
343 | - $shortcut_menu[$key] = array( |
|
348 | + foreach ( $this->getMenu() as $key => $menu_item ) { |
|
349 | + $shortcut_menu[$key] = array( |
|
344 | 350 | "URL" => $menu_item[0], |
345 | 351 | "LABEL" => $menu_item[1], |
346 | 352 | "MODULE_NAME" => $menu_item[2], |
347 | 353 | "IMAGE" => $themeObject |
348 | 354 | ->getImage($menu_item[2],"border='0' align='absmiddle'",null,null,'.gif',$menu_item[1]), |
349 | 355 | ); |
356 | + } |
|
350 | 357 | $ss->assign("SHORTCUT_MENU",$shortcut_menu); |
351 | 358 | |
352 | 359 | // handle rtl text direction |
@@ -370,8 +377,7 @@ discard block |
||
370 | 377 | $ss->assign("COMPANY_LOGO_MD5", $company_logo_attributes[0]); |
371 | 378 | $ss->assign("COMPANY_LOGO_WIDTH", $company_logo_attributes[1]); |
372 | 379 | $ss->assign("COMPANY_LOGO_HEIGHT", $company_logo_attributes[2]); |
373 | - } |
|
374 | - else { |
|
380 | + } else { |
|
375 | 381 | // Always need to md5 the file |
376 | 382 | $ss->assign("COMPANY_LOGO_MD5", md5_file($companyLogoURL)); |
377 | 383 | |
@@ -379,14 +385,14 @@ discard block |
||
379 | 385 | if ( $width > 212 || $height > 40 ) { |
380 | 386 | $resizePctWidth = ($width - 212)/212; |
381 | 387 | $resizePctHeight = ($height - 40)/40; |
382 | - if ( $resizePctWidth > $resizePctHeight ) |
|
383 | - $resizeAmount = $width / 212; |
|
384 | - else |
|
385 | - $resizeAmount = $height / 40; |
|
388 | + if ( $resizePctWidth > $resizePctHeight ) { |
|
389 | + $resizeAmount = $width / 212; |
|
390 | + } else { |
|
391 | + $resizeAmount = $height / 40; |
|
392 | + } |
|
386 | 393 | $ss->assign("COMPANY_LOGO_WIDTH", round($width * (1/$resizeAmount))); |
387 | 394 | $ss->assign("COMPANY_LOGO_HEIGHT", round($height * (1/$resizeAmount))); |
388 | - } |
|
389 | - else { |
|
395 | + } else { |
|
390 | 396 | $ss->assign("COMPANY_LOGO_WIDTH", $width); |
391 | 397 | $ss->assign("COMPANY_LOGO_HEIGHT", $height); |
392 | 398 | } |
@@ -429,11 +435,12 @@ discard block |
||
429 | 435 | } |
430 | 436 | // and now the sublinks |
431 | 437 | if ( $linkattribute == 'submenu' && is_array($attributevalue) ) { |
432 | - foreach ($attributevalue as $submenulinkkey => $submenulinkinfo) |
|
433 | - $gcls[$key]['SUBMENU'][$submenulinkkey] = array( |
|
438 | + foreach ($attributevalue as $submenulinkkey => $submenulinkinfo) { |
|
439 | + $gcls[$key]['SUBMENU'][$submenulinkkey] = array( |
|
434 | 440 | "LABEL" => key($submenulinkinfo), |
435 | 441 | "URL" => current($submenulinkinfo), |
436 | 442 | ); |
443 | + } |
|
437 | 444 | if(substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"], 0, 11) == "javascript:") { |
438 | 445 | $gcls[$key]['SUBMENU'][$submenulinkkey]["ONCLICK"] = substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"],11); |
439 | 446 | $gcls[$key]['SUBMENU'][$submenulinkkey]["URL"] = "javascript:void(0)"; |
@@ -445,8 +452,9 @@ discard block |
||
445 | 452 | |
446 | 453 | $ss->assign("SEARCH", isset($_REQUEST['query_string']) ? $_REQUEST['query_string'] : ''); |
447 | 454 | |
448 | - if ($this->action == "EditView" || $this->action == "Login") |
|
449 | - $ss->assign("ONLOAD", 'onload="set_focus()"'); |
|
455 | + if ($this->action == "EditView" || $this->action == "Login") { |
|
456 | + $ss->assign("ONLOAD", 'onload="set_focus()"'); |
|
457 | + } |
|
450 | 458 | |
451 | 459 | $ss->assign("AUTHENTICATED",isset($_SESSION["authenticated_user_id"])); |
452 | 460 | |
@@ -506,8 +514,7 @@ discard block |
||
506 | 514 | foreach($frames as $key => $values){ |
507 | 515 | $fullModuleList[$key] = $values; |
508 | 516 | } |
509 | - } |
|
510 | - elseif (isset($fullModuleList['iFrames'])) { |
|
517 | + } elseif (isset($fullModuleList['iFrames'])) { |
|
511 | 518 | unset($fullModuleList['iFrames']); |
512 | 519 | } |
513 | 520 | |
@@ -523,8 +530,7 @@ discard block |
||
523 | 530 | // We have a default value. Use it |
524 | 531 | if(isset($GLOBALS['sugar_config']['default_max_tabs'])){ |
525 | 532 | $max_tabs = $GLOBALS['sugar_config']['default_max_tabs']; |
526 | - } |
|
527 | - else{ |
|
533 | + } else{ |
|
528 | 534 | $max_tabs = 8; |
529 | 535 | } |
530 | 536 | } |
@@ -633,7 +639,9 @@ discard block |
||
633 | 639 | ); |
634 | 640 | } |
635 | 641 | } |
636 | - if(!empty($sugar_config['lock_homepage']) && $sugar_config['lock_homepage'] == true) $ss->assign('lock_homepage', true); |
|
642 | + if(!empty($sugar_config['lock_homepage']) && $sugar_config['lock_homepage'] == true) { |
|
643 | + $ss->assign('lock_homepage', true); |
|
644 | + } |
|
637 | 645 | $ss->assign("groupTabs",$groupTabs); |
638 | 646 | $ss->assign("shortcutTopMenu",$shortcutTopMenu); |
639 | 647 | $ss->assign('USE_GROUP_TABS',$usingGroupTabs); |
@@ -676,8 +684,9 @@ discard block |
||
676 | 684 | global $mod_strings; |
677 | 685 | $mod_strings = $bakModStrings; |
678 | 686 | $headerTpl = $themeObject->getTemplate('header.tpl'); |
679 | - if (inDeveloperMode() ) |
|
680 | - $ss->clear_compiled_tpl($headerTpl); |
|
687 | + if (inDeveloperMode() ) { |
|
688 | + $ss->clear_compiled_tpl($headerTpl); |
|
689 | + } |
|
681 | 690 | |
682 | 691 | if ($retModTabs) |
683 | 692 | { |
@@ -716,8 +725,9 @@ discard block |
||
716 | 725 | global $gridline, $request_string, $modListHeader, $dashletData, $authController, $locale, $currentModule, $import_bean_map, $image_path, $license; |
717 | 726 | global $user_unique_key, $server_unique_key, $barChartColors, $modules_exempt_from_availability_check, $dictionary, $current_language, $beanList, $beanFiles, $sugar_build, $sugar_codename; |
718 | 727 | global $timedate, $login_error; // cn: bug 13855 - timedate not available to classic views. |
719 | - if (!empty($this->module)) |
|
720 | - $currentModule = $this->module; |
|
728 | + if (!empty($this->module)) { |
|
729 | + $currentModule = $this->module; |
|
730 | + } |
|
721 | 731 | require_once ($file); |
722 | 732 | } |
723 | 733 | |
@@ -747,8 +757,9 @@ discard block |
||
747 | 757 | if ( typeof(SUGAR.themes) == 'undefined' ) SUGAR.themes = {}; |
748 | 758 | </script> |
749 | 759 | EOQ; |
750 | - if(isset( $sugar_config['disc_client']) && $sugar_config['disc_client']) |
|
751 | - echo getVersionedScript('modules/Sync/headersync.js'); |
|
760 | + if(isset( $sugar_config['disc_client']) && $sugar_config['disc_client']) { |
|
761 | + echo getVersionedScript('modules/Sync/headersync.js'); |
|
762 | + } |
|
752 | 763 | } |
753 | 764 | |
754 | 765 | /** |
@@ -849,8 +860,9 @@ discard block |
||
849 | 860 | |
850 | 861 | echo $this->_getModLanguageJS(); |
851 | 862 | |
852 | - if(isset( $sugar_config['disc_client']) && $sugar_config['disc_client']) |
|
853 | - echo getVersionedScript('modules/Sync/headersync.js'); |
|
863 | + if(isset( $sugar_config['disc_client']) && $sugar_config['disc_client']) { |
|
864 | + echo getVersionedScript('modules/Sync/headersync.js'); |
|
865 | + } |
|
854 | 866 | |
855 | 867 | |
856 | 868 | //echo out the $js_vars variables as javascript variables |
@@ -917,8 +929,9 @@ discard block |
||
917 | 929 | } |
918 | 930 | } |
919 | 931 | $ss->assign("BOTTOMLINKS",$bottomLinksStr); |
920 | - if (SugarConfig::getInstance()->get('calculate_response_time', false)) |
|
921 | - $ss->assign('STATISTICS',$this->_getStatistics()); |
|
932 | + if (SugarConfig::getInstance()->get('calculate_response_time', false)) { |
|
933 | + $ss->assign('STATISTICS',$this->_getStatistics()); |
|
934 | + } |
|
922 | 935 | |
923 | 936 | // Under the License referenced above, you are required to leave in all copyright statements in both |
924 | 937 | // the code and end-user application. |
@@ -956,8 +969,7 @@ discard block |
||
956 | 969 | $ss->assign("COMPANY_LOGO_MD5", $company_logo_attributes[0]); |
957 | 970 | $ss->assign("COMPANY_LOGO_WIDTH", $company_logo_attributes[1]); |
958 | 971 | $ss->assign("COMPANY_LOGO_HEIGHT", $company_logo_attributes[2]); |
959 | - } |
|
960 | - else { |
|
972 | + } else { |
|
961 | 973 | // Always need to md5 the file |
962 | 974 | $ss->assign("COMPANY_LOGO_MD5", md5_file($companyLogoURL)); |
963 | 975 | |
@@ -965,14 +977,14 @@ discard block |
||
965 | 977 | if ( $width > 212 || $height > 40 ) { |
966 | 978 | $resizePctWidth = ($width - 212)/212; |
967 | 979 | $resizePctHeight = ($height - 40)/40; |
968 | - if ( $resizePctWidth > $resizePctHeight ) |
|
969 | - $resizeAmount = $width / 212; |
|
970 | - else |
|
971 | - $resizeAmount = $height / 40; |
|
980 | + if ( $resizePctWidth > $resizePctHeight ) { |
|
981 | + $resizeAmount = $width / 212; |
|
982 | + } else { |
|
983 | + $resizeAmount = $height / 40; |
|
984 | + } |
|
972 | 985 | $ss->assign("COMPANY_LOGO_WIDTH", round($width * (1/$resizeAmount))); |
973 | 986 | $ss->assign("COMPANY_LOGO_HEIGHT", round($height * (1/$resizeAmount))); |
974 | - } |
|
975 | - else { |
|
987 | + } else { |
|
976 | 988 | $ss->assign("COMPANY_LOGO_WIDTH", $width); |
977 | 989 | $ss->assign("COMPANY_LOGO_HEIGHT", $height); |
978 | 990 | } |
@@ -1030,8 +1042,9 @@ discard block |
||
1030 | 1042 | |
1031 | 1043 | protected function _buildModuleList() |
1032 | 1044 | { |
1033 | - if (!empty($GLOBALS['current_user']) && empty($GLOBALS['modListHeader'])) |
|
1034 | - $GLOBALS['modListHeader'] = query_module_access_list($GLOBALS['current_user']); |
|
1045 | + if (!empty($GLOBALS['current_user']) && empty($GLOBALS['modListHeader'])) { |
|
1046 | + $GLOBALS['modListHeader'] = query_module_access_list($GLOBALS['current_user']); |
|
1047 | + } |
|
1035 | 1048 | } |
1036 | 1049 | |
1037 | 1050 | /** |
@@ -1051,7 +1064,9 @@ discard block |
||
1051 | 1064 | return $this->options['show_all']; |
1052 | 1065 | } elseif (!empty($this->options) && isset($this->options[$option])) { |
1053 | 1066 | return $this->options[$option]; |
1054 | - } else return $default; |
|
1067 | + } else { |
|
1068 | + return $default; |
|
1069 | + } |
|
1055 | 1070 | } |
1056 | 1071 | |
1057 | 1072 | /** |
@@ -1088,10 +1103,11 @@ discard block |
||
1088 | 1103 | |
1089 | 1104 | public function renderJavascript() |
1090 | 1105 | { |
1091 | - if ($this->action !== 'Login') |
|
1092 | - $this->_displayJavascript(); |
|
1093 | - else |
|
1094 | - $this->_displayLoginJS(); |
|
1106 | + if ($this->action !== 'Login') { |
|
1107 | + $this->_displayJavascript(); |
|
1108 | + } else { |
|
1109 | + $this->_displayLoginJS(); |
|
1110 | + } |
|
1095 | 1111 | } |
1096 | 1112 | |
1097 | 1113 | private function _calculateFooterMetrics() |
@@ -1198,8 +1214,9 @@ discard block |
||
1198 | 1214 | { |
1199 | 1215 | global $current_language, $current_user, $mod_strings, $app_strings, $module_menu; |
1200 | 1216 | |
1201 | - if ( empty($module) ) |
|
1202 | - $module = $this->module; |
|
1217 | + if ( empty($module) ) { |
|
1218 | + $module = $this->module; |
|
1219 | + } |
|
1203 | 1220 | |
1204 | 1221 | //Need to make sure the mod_strings match the requested module or Menus may fail |
1205 | 1222 | $curr_mod_strings = $mod_strings; |
@@ -1220,13 +1237,14 @@ discard block |
||
1220 | 1237 | $GLOBALS['mod_strings']['LNK_NEW_RECORD'],"{$GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL']}$module" ,$module ); |
1221 | 1238 | $module_menu[] = array("index.php?module=$module&action=index", $GLOBALS['mod_strings']['LNK_LIST'], |
1222 | 1239 | $module, $module); |
1223 | - if ( ($this->bean instanceOf SugarBean) && !empty($this->bean->importable) ) |
|
1224 | - if ( !empty($mod_strings['LNK_IMPORT_'.strtoupper($module)]) ) |
|
1240 | + if ( ($this->bean instanceOf SugarBean) && !empty($this->bean->importable) ) { |
|
1241 | + if ( !empty($mod_strings['LNK_IMPORT_'.strtoupper($module)]) ) |
|
1225 | 1242 | $module_menu[] = array("index.php?module=Import&action=Step1&import_module=$module&return_module=$module&return_action=index", |
1226 | 1243 | $mod_strings['LNK_IMPORT_'.strtoupper($module)], "Import", $module); |
1227 | - else |
|
1228 | - $module_menu[] = array("index.php?module=Import&action=Step1&import_module=$module&return_module=$module&return_action=index", |
|
1244 | + } else { |
|
1245 | + $module_menu[] = array("index.php?module=Import&action=Step1&import_module=$module&return_module=$module&return_action=index", |
|
1229 | 1246 | $app_strings['LBL_IMPORT'], "Import", $module); |
1247 | + } |
|
1230 | 1248 | } |
1231 | 1249 | if (file_exists('custom/application/Ext/Menus/menu.ext.php')) { |
1232 | 1250 | require('custom/application/Ext/Menus/menu.ext.php'); |
@@ -1251,22 +1269,25 @@ discard block |
||
1251 | 1269 | $defaultTab = (in_array("Home",$userTabs)) ? "Home" : key($userTabs); |
1252 | 1270 | |
1253 | 1271 | // Need to figure out what tab this module belongs to, most modules have their own tabs, but there are exceptions. |
1254 | - if ( !empty($_REQUEST['module_tab']) ) |
|
1255 | - return $_REQUEST['module_tab']; |
|
1256 | - elseif ( isset($moduleTabMap[$this->module]) ) |
|
1257 | - return $moduleTabMap[$this->module]; |
|
1272 | + if ( !empty($_REQUEST['module_tab']) ) { |
|
1273 | + return $_REQUEST['module_tab']; |
|
1274 | + } elseif ( isset($moduleTabMap[$this->module]) ) { |
|
1275 | + return $moduleTabMap[$this->module]; |
|
1276 | + } |
|
1258 | 1277 | // Special cases |
1259 | - elseif ( $this->module == 'MergeRecords' ) |
|
1260 | - return !empty($_REQUEST['merge_module']) ? $_REQUEST['merge_module'] : $_REQUEST['return_module']; |
|
1261 | - elseif ( $this->module == 'Users' && $this->action == 'SetTimezone' ) |
|
1262 | - return $defaultTab; |
|
1278 | + elseif ( $this->module == 'MergeRecords' ) { |
|
1279 | + return !empty($_REQUEST['merge_module']) ? $_REQUEST['merge_module'] : $_REQUEST['return_module']; |
|
1280 | + } elseif ( $this->module == 'Users' && $this->action == 'SetTimezone' ) { |
|
1281 | + return $defaultTab; |
|
1282 | + } |
|
1263 | 1283 | // Default anonymous pages to be under Home |
1264 | - elseif ( !isset($app_list_strings['moduleList'][$this->module]) ) |
|
1265 | - return $defaultTab; |
|
1266 | - elseif ( isset($_REQUEST['action']) && $_REQUEST['action'] == "ajaxui" ) |
|
1267 | - return $defaultTab; |
|
1268 | - else |
|
1269 | - return $this->module; |
|
1284 | + elseif ( !isset($app_list_strings['moduleList'][$this->module]) ) { |
|
1285 | + return $defaultTab; |
|
1286 | + } elseif ( isset($_REQUEST['action']) && $_REQUEST['action'] == "ajaxui" ) { |
|
1287 | + return $defaultTab; |
|
1288 | + } else { |
|
1289 | + return $this->module; |
|
1290 | + } |
|
1270 | 1291 | } |
1271 | 1292 | |
1272 | 1293 | /** |
@@ -1317,7 +1338,10 @@ discard block |
||
1317 | 1338 | if($show_help || $this->type == 'list') { |
1318 | 1339 | $theTitle .= "<span class='utils'>"; |
1319 | 1340 | $createImageURL = SugarThemeRegistry::current()->getImageURL('create-record.gif'); |
1320 | - if($this->type == 'list') $theTitle .= '<a href="#" class="btn btn-success showsearch"><span class=" glyphicon glyphicon-search" aria-hidden="true"></span></a>';$url = ajaxLink("index.php?module=$module&action=EditView&return_module=$module&return_action=DetailView"); |
|
1341 | + if($this->type == 'list') { |
|
1342 | + $theTitle .= '<a href="#" class="btn btn-success showsearch"><span class=" glyphicon glyphicon-search" aria-hidden="true"></span></a>'; |
|
1343 | + } |
|
1344 | + $url = ajaxLink("index.php?module=$module&action=EditView&return_module=$module&return_action=DetailView"); |
|
1321 | 1345 | if($show_help) { |
1322 | 1346 | $theTitle .= <<<EOHTML |
1323 | 1347 | |
@@ -1349,14 +1373,14 @@ discard block |
||
1349 | 1373 | if(file_exists('custom/' .$coreMetaPath )){ |
1350 | 1374 | $metadataFile = 'custom/' . $coreMetaPath; |
1351 | 1375 | $foundViewDefs = true; |
1352 | - }else{ |
|
1376 | + } else{ |
|
1353 | 1377 | if(file_exists('custom/modules/'.$this->module.'/metadata/metafiles.php')){ |
1354 | 1378 | require_once('custom/modules/'.$this->module.'/metadata/metafiles.php'); |
1355 | 1379 | if(!empty($metafiles[$this->module][$viewDef])){ |
1356 | 1380 | $metadataFile = $metafiles[$this->module][$viewDef]; |
1357 | 1381 | $foundViewDefs = true; |
1358 | 1382 | } |
1359 | - }elseif(file_exists('modules/'.$this->module.'/metadata/metafiles.php')){ |
|
1383 | + } elseif(file_exists('modules/'.$this->module.'/metadata/metafiles.php')){ |
|
1360 | 1384 | require_once('modules/'.$this->module.'/metadata/metafiles.php'); |
1361 | 1385 | if(!empty($metafiles[$this->module][$viewDef])){ |
1362 | 1386 | $metadataFile = $metafiles[$this->module][$viewDef]; |
@@ -1391,9 +1415,9 @@ discard block |
||
1391 | 1415 | if(!empty($this->bean->id) && (empty($_REQUEST['isDuplicate']) || $_REQUEST['isDuplicate'] === 'false')) { |
1392 | 1416 | $params[] = "<a href='index.php?module={$this->module}&action=DetailView&record={$this->bean->id}'>".$this->bean->get_summary_text()."</a>"; |
1393 | 1417 | $params[] = $GLOBALS['app_strings']['LBL_EDIT_BUTTON_LABEL']; |
1418 | + } else { |
|
1419 | + $params[] = $GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL']; |
|
1394 | 1420 | } |
1395 | - else |
|
1396 | - $params[] = $GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL']; |
|
1397 | 1421 | break; |
1398 | 1422 | case 'DetailView': |
1399 | 1423 | $beanName = $this->bean->get_summary_text(); |
@@ -1417,10 +1441,11 @@ discard block |
||
1417 | 1441 | global $current_user; |
1418 | 1442 | global $app_strings; |
1419 | 1443 | |
1420 | - if(!empty($GLOBALS['app_list_strings']['moduleList'][$this->module])) |
|
1421 | - $firstParam = $GLOBALS['app_list_strings']['moduleList'][$this->module]; |
|
1422 | - else |
|
1423 | - $firstParam = $this->module; |
|
1444 | + if(!empty($GLOBALS['app_list_strings']['moduleList'][$this->module])) { |
|
1445 | + $firstParam = $GLOBALS['app_list_strings']['moduleList'][$this->module]; |
|
1446 | + } else { |
|
1447 | + $firstParam = $this->module; |
|
1448 | + } |
|
1424 | 1449 | |
1425 | 1450 | $iconPath = $this->getModuleTitleIconPath($this->module); |
1426 | 1451 | if($this->action == "ListView" || $this->action == "index") { |
@@ -1436,8 +1461,7 @@ discard block |
||
1436 | 1461 | } else { |
1437 | 1462 | return $firstParam; |
1438 | 1463 | } |
1439 | - } |
|
1440 | - else { |
|
1464 | + } else { |
|
1441 | 1465 | if (!empty($iconPath) && !$browserTitle) { |
1442 | 1466 | //return "<a href='index.php?module={$this->module}&action=index'>$this->module</a>"; |
1443 | 1467 | } else { |
@@ -1451,8 +1475,7 @@ discard block |
||
1451 | 1475 | $iconPath = ""; |
1452 | 1476 | if(is_file(SugarThemeRegistry::current()->getImageURL('icon_'.$module.'_32.png',false))) { |
1453 | 1477 | $iconPath = SugarThemeRegistry::current()->getImageURL('icon_'.$module.'_32.png'); |
1454 | - } |
|
1455 | - else if (is_file(SugarThemeRegistry::current()->getImageURL('icon_'.ucfirst($module).'_32.png',false))) { |
|
1478 | + } else if (is_file(SugarThemeRegistry::current()->getImageURL('icon_'.ucfirst($module).'_32.png',false))) { |
|
1456 | 1479 | $iconPath = SugarThemeRegistry::current()->getImageURL('icon_'.ucfirst($module).'_32.png'); |
1457 | 1480 | } |
1458 | 1481 | return $iconPath; |
@@ -1469,11 +1492,13 @@ discard block |
||
1469 | 1492 | global $app_strings; |
1470 | 1493 | |
1471 | 1494 | $browserTitle = $app_strings['LBL_BROWSER_TITLE']; |
1472 | - if ( $this->module == 'Users' && ($this->action == 'SetTimezone' || $this->action == 'Login') ) |
|
1473 | - return $browserTitle; |
|
1495 | + if ( $this->module == 'Users' && ($this->action == 'SetTimezone' || $this->action == 'Login') ) { |
|
1496 | + return $browserTitle; |
|
1497 | + } |
|
1474 | 1498 | $params = $this->_getModuleTitleParams(true); |
1475 | - foreach ($params as $value ) |
|
1476 | - $browserTitle = strip_tags($value) . ' » ' . $browserTitle; |
|
1499 | + foreach ($params as $value ) { |
|
1500 | + $browserTitle = strip_tags($value) . ' » ' . $browserTitle; |
|
1501 | + } |
|
1477 | 1502 | |
1478 | 1503 | return $browserTitle; |
1479 | 1504 | } |
@@ -1487,8 +1512,7 @@ discard block |
||
1487 | 1512 | { |
1488 | 1513 | if(SugarThemeRegistry::current()->directionality == "ltr") { |
1489 | 1514 | return "<span class='pointer'>»</span>"; |
1490 | - } |
|
1491 | - else { |
|
1515 | + } else { |
|
1492 | 1516 | return "<span class='pointer'>«</span>"; |
1493 | 1517 | } |
1494 | 1518 | } |
@@ -1510,8 +1534,7 @@ discard block |
||
1510 | 1534 | } |
1511 | 1535 | if ( empty($sugar_config['disableAjaxUI']) ) { |
1512 | 1536 | $config_js[] = "SUGAR.config.disableAjaxUI = false;"; |
1513 | - } |
|
1514 | - else{ |
|
1537 | + } else{ |
|
1515 | 1538 | $config_js[] = "SUGAR.config.disableAjaxUI = true;"; |
1516 | 1539 | } |
1517 | 1540 | if ( !empty($sugar_config['addAjaxBannedModules']) ){ |
@@ -1581,18 +1604,21 @@ discard block |
||
1581 | 1604 | protected function getFavicon() |
1582 | 1605 | { |
1583 | 1606 | // get favicon |
1584 | - if(isset($GLOBALS['sugar_config']['default_module_favicon'])) |
|
1585 | - $module_favicon = $GLOBALS['sugar_config']['default_module_favicon']; |
|
1586 | - else |
|
1587 | - $module_favicon = false; |
|
1607 | + if(isset($GLOBALS['sugar_config']['default_module_favicon'])) { |
|
1608 | + $module_favicon = $GLOBALS['sugar_config']['default_module_favicon']; |
|
1609 | + } else { |
|
1610 | + $module_favicon = false; |
|
1611 | + } |
|
1588 | 1612 | |
1589 | 1613 | $themeObject = SugarThemeRegistry::current(); |
1590 | 1614 | |
1591 | 1615 | $favicon = ''; |
1592 | - if ( $module_favicon ) |
|
1593 | - $favicon = $themeObject->getImageURL($this->module.'.gif',false); |
|
1594 | - if ( !sugar_is_file($favicon) || !$module_favicon ) |
|
1595 | - $favicon = $themeObject->getImageURL('sugar_icon.ico',false); |
|
1616 | + if ( $module_favicon ) { |
|
1617 | + $favicon = $themeObject->getImageURL($this->module.'.gif',false); |
|
1618 | + } |
|
1619 | + if ( !sugar_is_file($favicon) || !$module_favicon ) { |
|
1620 | + $favicon = $themeObject->getImageURL('sugar_icon.ico',false); |
|
1621 | + } |
|
1596 | 1622 | |
1597 | 1623 | $extension = pathinfo($favicon, PATHINFO_EXTENSION); |
1598 | 1624 | switch ($extension) |
@@ -57,23 +57,23 @@ |
||
57 | 57 | require_once('custom/modules/'.$module.'/controller.php'); |
58 | 58 | if(class_exists($customClass)){ |
59 | 59 | $controller = new $customClass(); |
60 | - }else if(class_exists($class)){ |
|
60 | + } else if(class_exists($class)){ |
|
61 | 61 | $controller = new $class(); |
62 | 62 | } |
63 | - }elseif(file_exists('modules/'.$module.'/controller.php')){ |
|
63 | + } elseif(file_exists('modules/'.$module.'/controller.php')){ |
|
64 | 64 | require_once('modules/'.$module.'/controller.php'); |
65 | 65 | if(class_exists($customClass)){ |
66 | 66 | $controller = new $customClass(); |
67 | - }else if(class_exists($class)){ |
|
67 | + } else if(class_exists($class)){ |
|
68 | 68 | $controller = new $class(); |
69 | 69 | } |
70 | - }else{ |
|
70 | + } else{ |
|
71 | 71 | if(file_exists('custom/include/MVC/Controller/SugarController.php')){ |
72 | 72 | require_once('custom/include/MVC/Controller/SugarController.php'); |
73 | 73 | } |
74 | 74 | if(class_exists('CustomSugarController')){ |
75 | 75 | $controller = new CustomSugarController(); |
76 | - }else{ |
|
76 | + } else{ |
|
77 | 77 | $controller = new SugarController(); |
78 | 78 | } |
79 | 79 | } |
@@ -171,11 +171,13 @@ discard block |
||
171 | 171 | * |
172 | 172 | */ |
173 | 173 | public function setup($module = ''){ |
174 | - if(empty($module) && !empty($_REQUEST['module'])) |
|
175 | - $module = $_REQUEST['module']; |
|
174 | + if(empty($module) && !empty($_REQUEST['module'])) { |
|
175 | + $module = $_REQUEST['module']; |
|
176 | + } |
|
176 | 177 | //set the module |
177 | - if(!empty($module)) |
|
178 | - $this->setModule($module); |
|
178 | + if(!empty($module)) { |
|
179 | + $this->setModule($module); |
|
180 | + } |
|
179 | 181 | |
180 | 182 | if(!empty($_REQUEST['target_module']) && $_REQUEST['target_module'] != 'undefined') { |
181 | 183 | $this->target_module = $_REQUEST['target_module']; |
@@ -199,18 +201,24 @@ discard block |
||
199 | 201 | * |
200 | 202 | */ |
201 | 203 | private function loadPropertiesFromRequest(){ |
202 | - if(!empty($_REQUEST['action'])) |
|
203 | - $this->action = $_REQUEST['action']; |
|
204 | - if(!empty($_REQUEST['record'])) |
|
205 | - $this->record = $_REQUEST['record']; |
|
206 | - if(!empty($_REQUEST['view'])) |
|
207 | - $this->view = $_REQUEST['view']; |
|
208 | - if(!empty($_REQUEST['return_module'])) |
|
209 | - $this->return_module = $_REQUEST['return_module']; |
|
210 | - if(!empty($_REQUEST['return_action'])) |
|
211 | - $this->return_action = $_REQUEST['return_action']; |
|
212 | - if(!empty($_REQUEST['return_id'])) |
|
213 | - $this->return_id = $_REQUEST['return_id']; |
|
204 | + if(!empty($_REQUEST['action'])) { |
|
205 | + $this->action = $_REQUEST['action']; |
|
206 | + } |
|
207 | + if(!empty($_REQUEST['record'])) { |
|
208 | + $this->record = $_REQUEST['record']; |
|
209 | + } |
|
210 | + if(!empty($_REQUEST['view'])) { |
|
211 | + $this->view = $_REQUEST['view']; |
|
212 | + } |
|
213 | + if(!empty($_REQUEST['return_module'])) { |
|
214 | + $this->return_module = $_REQUEST['return_module']; |
|
215 | + } |
|
216 | + if(!empty($_REQUEST['return_action'])) { |
|
217 | + $this->return_action = $_REQUEST['return_action']; |
|
218 | + } |
|
219 | + if(!empty($_REQUEST['return_id'])) { |
|
220 | + $this->return_id = $_REQUEST['return_id']; |
|
221 | + } |
|
214 | 222 | } |
215 | 223 | |
216 | 224 | /** |
@@ -235,8 +243,9 @@ discard block |
||
235 | 243 | $this->bean = new $class(); |
236 | 244 | if(!empty($this->record)){ |
237 | 245 | $this->bean->retrieve($this->record); |
238 | - if($this->bean) |
|
239 | - $GLOBALS['FOCUS'] = $this->bean; |
|
246 | + if($this->bean) { |
|
247 | + $GLOBALS['FOCUS'] = $this->bean; |
|
248 | + } |
|
240 | 249 | } |
241 | 250 | } |
242 | 251 | } |
@@ -250,7 +259,7 @@ discard block |
||
250 | 259 | if(!$$var){ |
251 | 260 | if($merge && !empty($this->$var)){ |
252 | 261 | $$var = $this->$var; |
253 | - }else{ |
|
262 | + } else{ |
|
254 | 263 | $$var = array(); |
255 | 264 | } |
256 | 265 | if(file_exists('include/MVC/Controller/'. $var . '.php')){ |
@@ -293,13 +302,11 @@ discard block |
||
293 | 302 | if(!empty($this->view)) |
294 | 303 | { |
295 | 304 | $this->processView(); |
296 | - } |
|
297 | - elseif(!empty($this->redirect_url)) |
|
305 | + } elseif(!empty($this->redirect_url)) |
|
298 | 306 | { |
299 | 307 | $this->redirect(); |
300 | 308 | } |
301 | - } |
|
302 | - catch (Exception $e) |
|
309 | + } catch (Exception $e) |
|
303 | 310 | { |
304 | 311 | $this->handleException($e); |
305 | 312 | } |
@@ -321,8 +328,7 @@ discard block |
||
321 | 328 | { |
322 | 329 | $logicHook->setBean($this->bean); |
323 | 330 | $logicHook->call_custom_logic($this->bean->module_dir, "handle_exception", $e); |
324 | - } |
|
325 | - else |
|
331 | + } else |
|
326 | 332 | { |
327 | 333 | $logicHook->call_custom_logic('', "handle_exception", $e); |
328 | 334 | } |
@@ -384,7 +390,7 @@ discard block |
||
384 | 390 | } |
385 | 391 | |
386 | 392 | $this->redirect(); |
387 | - }else{ |
|
393 | + } else{ |
|
388 | 394 | $this->no_access(); |
389 | 395 | } |
390 | 396 | } |
@@ -491,8 +497,9 @@ discard block |
||
491 | 497 | */ |
492 | 498 | protected function redirect(){ |
493 | 499 | |
494 | - if(!empty($this->redirect_url)) |
|
495 | - SugarApplication::redirect($this->redirect_url); |
|
500 | + if(!empty($this->redirect_url)) { |
|
501 | + SugarApplication::redirect($this->redirect_url); |
|
502 | + } |
|
496 | 503 | } |
497 | 504 | |
498 | 505 | //////////////////////////////////////////////////////// |
@@ -586,7 +593,7 @@ discard block |
||
586 | 593 | sugar_cleanup(true); |
587 | 594 | } |
588 | 595 | $this->bean->mark_deleted($_REQUEST['record']); |
589 | - }else{ |
|
596 | + } else{ |
|
590 | 597 | sugar_die("A record number must be specified to delete"); |
591 | 598 | } |
592 | 599 | } |
@@ -652,7 +659,7 @@ discard block |
||
652 | 659 | unset($_REQUEST[$seed->module_dir.'2_'.strtoupper($seed->object_name).'_offset']);//after massupdate, the page should redirect to no offset page |
653 | 660 | $storeQuery->saveFromRequest($_REQUEST['module']); |
654 | 661 | $_REQUEST = array('return_module' => $temp_req['return_module'], 'return_action' => $temp_req['return_action']);//for post_massupdate, to go back to original page. |
655 | - }else{ |
|
662 | + } else{ |
|
656 | 663 | sugar_die("You must massupdate at least one record"); |
657 | 664 | } |
658 | 665 | } |
@@ -711,8 +718,7 @@ discard block |
||
711 | 718 | |
712 | 719 | if(method_exists($dashlet, $requestedMethod) || method_exists($dashlet, '__call')) { |
713 | 720 | echo $dashlet->$requestedMethod(); |
714 | - } |
|
715 | - else { |
|
721 | + } else { |
|
716 | 722 | echo 'no method'; |
717 | 723 | } |
718 | 724 | } |
@@ -734,15 +740,13 @@ discard block |
||
734 | 740 | if(!empty($_REQUEST['configure']) && $_REQUEST['configure']) { // save settings |
735 | 741 | $dashletDefs[$id]['options'] = $dashlet->saveOptions($_REQUEST); |
736 | 742 | $current_user->setPreference('dashlets', $dashletDefs, 0, $_REQUEST['module']); |
737 | - } |
|
738 | - else { // display options |
|
743 | + } else { // display options |
|
739 | 744 | $json = getJSONobj(); |
740 | 745 | return 'result = ' . $json->encode((array('header' => $dashlet->title . ' : ' . $mod_strings['LBL_OPTIONS'], |
741 | 746 | 'body' => $dashlet->displayOptions()))); |
742 | 747 | |
743 | 748 | } |
744 | - } |
|
745 | - else { |
|
749 | + } else { |
|
746 | 750 | return '0'; |
747 | 751 | } |
748 | 752 | } |
@@ -824,13 +828,14 @@ discard block |
||
824 | 828 | $this->_processed = true; |
825 | 829 | $this->no_access(); |
826 | 830 | } |
827 | - }else{ |
|
831 | + } else{ |
|
828 | 832 | $this->_processed = true; |
829 | 833 | $this->no_access(); |
830 | 834 | } |
831 | 835 | } |
832 | - }else |
|
833 | - $this->_processed = false; |
|
836 | + } else { |
|
837 | + $this->_processed = false; |
|
838 | + } |
|
834 | 839 | } |
835 | 840 | |
836 | 841 | /** |
@@ -865,8 +870,9 @@ discard block |
||
865 | 870 | $this->loadMapping('entry_point_registry'); |
866 | 871 | |
867 | 872 | if ( isset($this->entry_point_registry[$entryPoint]['auth']) |
868 | - && !$this->entry_point_registry[$entryPoint]['auth'] ) |
|
869 | - return false; |
|
873 | + && !$this->entry_point_registry[$entryPoint]['auth'] ) { |
|
874 | + return false; |
|
875 | + } |
|
870 | 876 | return true; |
871 | 877 | } |
872 | 878 | |
@@ -879,8 +885,7 @@ discard block |
||
879 | 885 | $file = self::getActionFilename($this->do_action); |
880 | 886 | if ( isset($this->action_view_map[strtolower($this->do_action)]) ) { |
881 | 887 | $action = $this->action_view_map[strtolower($this->do_action)]; |
882 | - } |
|
883 | - else { |
|
888 | + } else { |
|
884 | 889 | $action = $this->do_action; |
885 | 890 | } |
886 | 891 | // index actions actually maps to the view.list.php view |
@@ -913,12 +918,13 @@ discard block |
||
913 | 918 | $GLOBALS['log']->debug('Using Action File Map:' . $this->action_file_map[strtolower($this->do_action)]); |
914 | 919 | require_once($this->action_file_map[strtolower($this->do_action)]); |
915 | 920 | $this->_processed = true; |
916 | - }elseif(!empty($this->action_view_map[strtolower($this->do_action)])){ |
|
921 | + } elseif(!empty($this->action_view_map[strtolower($this->do_action)])){ |
|
917 | 922 | $GLOBALS['log']->debug('Using Action View Map:' . $this->action_view_map[strtolower($this->do_action)]); |
918 | 923 | $this->view = $this->action_view_map[strtolower($this->do_action)]; |
919 | 924 | $this->_processed = true; |
920 | - }else |
|
921 | - $this->no_action(); |
|
925 | + } else { |
|
926 | + $this->no_action(); |
|
927 | + } |
|
922 | 928 | } |
923 | 929 | |
924 | 930 | /** |
@@ -1,5 +1,7 @@ discard block |
||
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. |
@@ -38,7 +40,9 @@ discard block |
||
38 | 40 | * display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM". |
39 | 41 | ********************************************************************************/ |
40 | 42 | |
41 | -if (empty($_REQUEST)) die(); |
|
43 | +if (empty($_REQUEST)) { |
|
44 | + die(); |
|
45 | +} |
|
42 | 46 | |
43 | 47 | $yui_path = array( |
44 | 48 | "2.9.0" => "include/javascript/yui", |
@@ -58,20 +62,24 @@ discard block |
||
58 | 62 | foreach ($_REQUEST as $param => $val) |
59 | 63 | { |
60 | 64 | //No backtracking in the path |
61 | - if (strpos($param, "..") !== false) |
|
62 | - continue; |
|
65 | + if (strpos($param, "..") !== false) { |
|
66 | + continue; |
|
67 | + } |
|
63 | 68 | |
64 | 69 | $version = explode("/", $param); |
65 | 70 | $version = $version[0]; |
66 | - if (empty($yui_path[$version])) continue; |
|
71 | + if (empty($yui_path[$version])) { |
|
72 | + continue; |
|
73 | + } |
|
67 | 74 | |
68 | 75 | $path = $yui_path[$version] . substr($param, strlen($version)); |
69 | 76 | |
70 | 77 | $extension = substr($path, strrpos($path, "_") + 1); |
71 | 78 | |
72 | 79 | //Only allowed file extensions |
73 | - if (empty($types[$extension])) |
|
74 | - continue; |
|
80 | + if (empty($types[$extension])) { |
|
81 | + continue; |
|
82 | + } |
|
75 | 83 | |
76 | 84 | if (empty($contentType)) |
77 | 85 | { |
@@ -1,5 +1,7 @@ discard block |
||
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. |
@@ -121,10 +123,12 @@ discard block |
||
121 | 123 | // load language files |
122 | 124 | $this->loadLanguage($classname, 'modules/Charts/Dashlets/'); |
123 | 125 | |
124 | - if ( empty($options['title']) ) |
|
125 | - $this->title = $this->dashletStrings['LBL_TITLE']; |
|
126 | - if ( isset($options['autoRefresh']) ) |
|
127 | - $this->autoRefresh = $options['autoRefresh']; |
|
126 | + if ( empty($options['title']) ) { |
|
127 | + $this->title = $this->dashletStrings['LBL_TITLE']; |
|
128 | + } |
|
129 | + if ( isset($options['autoRefresh']) ) { |
|
130 | + $this->autoRefresh = $options['autoRefresh']; |
|
131 | + } |
|
128 | 132 | |
129 | 133 | $this->layoutManager = new LayoutManager(); |
130 | 134 | $this->layoutManager->setAttribute('context', 'Report'); |
@@ -140,8 +144,8 @@ discard block |
||
140 | 144 | public function setRefreshIcon() |
141 | 145 | { |
142 | 146 | $additionalTitle = ''; |
143 | - if($this->isRefreshable) |
|
144 | - |
|
147 | + if($this->isRefreshable) { |
|
148 | + |
|
145 | 149 | $additionalTitle .= '<a href="#" onclick="SUGAR.mySugar.retrieveDashlet(\'' |
146 | 150 | . $this->id |
147 | 151 | . '\',\'predefined_chart\'); return false;"><!--not_in_theme!-->' |
@@ -154,6 +158,7 @@ discard block |
||
154 | 158 | translate('LBL_DASHLET_REFRESH', 'Home') |
155 | 159 | ) |
156 | 160 | . '</a>'; |
161 | + } |
|
157 | 162 | return $additionalTitle; |
158 | 163 | } |
159 | 164 | |
@@ -200,25 +205,32 @@ discard block |
||
200 | 205 | |
201 | 206 | $options = array(); |
202 | 207 | |
203 | - foreach($req as $name => $value) |
|
204 | - if(!is_array($value)) $req[$name] = trim($value); |
|
208 | + foreach($req as $name => $value) { |
|
209 | + if(!is_array($value)) $req[$name] = trim($value); |
|
210 | + } |
|
205 | 211 | |
206 | 212 | foreach($this->_searchFields as $name => $params) { |
207 | 213 | $widgetDef = $params; |
208 | - if ( isset($this->getSeedBean()->field_defs[$name]) ) |
|
209 | - $widgetDef = $this->getSeedBean()->field_defs[$name]; |
|
210 | - if ( $widgetDef['type'] == 'date') // special case date types |
|
214 | + if ( isset($this->getSeedBean()->field_defs[$name]) ) { |
|
215 | + $widgetDef = $this->getSeedBean()->field_defs[$name]; |
|
216 | + } |
|
217 | + if ( $widgetDef['type'] == 'date') { |
|
218 | + // special case date types |
|
211 | 219 | $options[$widgetDef['name']] = $timedate->swap_formats($req['type_'.$widgetDef['name']], $timedate->get_date_format(), $timedate->dbDayFormat); |
212 | - elseif ( $widgetDef['type'] == 'time') // special case time types |
|
220 | + } elseif ( $widgetDef['type'] == 'time') { |
|
221 | + // special case time types |
|
213 | 222 | $options[$widgetDef['name']] = $timedate->swap_formats($req['type_'.$widgetDef['name']], $timedate->get_time_format(), $timedate->dbTimeFormat); |
214 | - elseif ( $widgetDef['type'] == 'datepicker') // special case datepicker types |
|
223 | + } elseif ( $widgetDef['type'] == 'datepicker') { |
|
224 | + // special case datepicker types |
|
215 | 225 | $options[$widgetDef['name']] = $timedate->swap_formats($req[$widgetDef['name']], $timedate->get_date_format(), $timedate->dbDayFormat); |
216 | - elseif (!empty($req[$widgetDef['name']])) |
|
217 | - $options[$widgetDef['name']] = $req[$widgetDef['name']]; |
|
226 | + } elseif (!empty($req[$widgetDef['name']])) { |
|
227 | + $options[$widgetDef['name']] = $req[$widgetDef['name']]; |
|
228 | + } |
|
218 | 229 | } |
219 | 230 | |
220 | - if (!empty($req['dashletTitle'])) |
|
221 | - $options['title'] = $req['dashletTitle']; |
|
231 | + if (!empty($req['dashletTitle'])) { |
|
232 | + $options['title'] = $req['dashletTitle']; |
|
233 | + } |
|
222 | 234 | |
223 | 235 | $options['autoRefresh'] = empty($req['autoRefresh']) ? '0' : $req['autoRefresh']; |
224 | 236 | |
@@ -241,19 +253,24 @@ discard block |
||
241 | 253 | $currentSearchFields[$name] = array(); |
242 | 254 | |
243 | 255 | $widgetDef = $params; |
244 | - if ( isset($this->getSeedBean()->field_defs[$name]) ) |
|
245 | - $widgetDef = $this->getSeedBean()->field_defs[$name]; |
|
256 | + if ( isset($this->getSeedBean()->field_defs[$name]) ) { |
|
257 | + $widgetDef = $this->getSeedBean()->field_defs[$name]; |
|
258 | + } |
|
246 | 259 | |
247 | - if($widgetDef['type'] == 'enum' || $widgetDef['type'] == 'singleenum') $widgetDef['remove_blank'] = true; // remove the blank option for the dropdown |
|
260 | + if($widgetDef['type'] == 'enum' || $widgetDef['type'] == 'singleenum') { |
|
261 | + $widgetDef['remove_blank'] = true; |
|
262 | + } |
|
263 | + // remove the blank option for the dropdown |
|
248 | 264 | |
249 | - if ( empty($widgetDef['input_name0']) ) |
|
250 | - $widgetDef['input_name0'] = empty($this->$name) ? '' : $this->$name; |
|
265 | + if ( empty($widgetDef['input_name0']) ) { |
|
266 | + $widgetDef['input_name0'] = empty($this->$name) ? '' : $this->$name; |
|
267 | + } |
|
251 | 268 | $currentSearchFields[$name]['label'] = translate($widgetDef['vname'], $this->getSeedBean()->module_dir); |
252 | - if ( $currentSearchFields[$name]['label'] == $widgetDef['vname'] ) |
|
253 | - $currentSearchFields[$name]['label'] = translate($widgetDef['vname'], 'Charts'); |
|
269 | + if ( $currentSearchFields[$name]['label'] == $widgetDef['vname'] ) { |
|
270 | + $currentSearchFields[$name]['label'] = translate($widgetDef['vname'], 'Charts'); |
|
271 | + } |
|
254 | 272 | $currentSearchFields[$name]['input'] = $this->layoutManager->widgetDisplayInput($widgetDef, true, (empty($this->$name) ? '' : $this->$name)); |
255 | - } |
|
256 | - else { // ability to create spacers in input fields |
|
273 | + } else { // ability to create spacers in input fields |
|
257 | 274 | $currentSearchFields['blank' + $count]['label'] = ''; |
258 | 275 | $currentSearchFields['blank' + $count]['input'] = ''; |
259 | 276 | $count++; |
@@ -289,8 +306,9 @@ discard block |
||
289 | 306 | */ |
290 | 307 | protected function getSeedBean() |
291 | 308 | { |
292 | - if ( !($this->_seedBean instanceof SugarBean) ) |
|
293 | - $this->_seedBean = SugarModule::get($this->_seedName)->loadBean(); |
|
309 | + if ( !($this->_seedBean instanceof SugarBean) ) { |
|
310 | + $this->_seedBean = SugarModule::get($this->_seedName)->loadBean(); |
|
311 | + } |
|
294 | 312 | |
295 | 313 | return $this->_seedBean; |
296 | 314 | } |
@@ -412,9 +430,14 @@ discard block |
||
412 | 430 | } |
413 | 431 | |
414 | 432 | //if(isset($sortby1[0]) && $sortby1[0]=='') unset($sortby1[0]);//the beginning of lead_source_dom is blank. |
415 | - if(isset($sortby1[0]) && $sortby1[0]==array()) unset($sortby1[0]);//the beginning of month after search is blank. |
|
433 | + if(isset($sortby1[0]) && $sortby1[0]==array()) { |
|
434 | + unset($sortby1[0]); |
|
435 | + } |
|
436 | + //the beginning of month after search is blank. |
|
416 | 437 | |
417 | - if($ifsort2==false) $sortby2=array(0); |
|
438 | + if($ifsort2==false) { |
|
439 | + $sortby2=array(0); |
|
440 | + } |
|
418 | 441 | |
419 | 442 | if($keycolname2!=null) { |
420 | 443 | $sortby2 = array(); |
@@ -438,7 +461,9 @@ discard block |
||
438 | 461 | |
439 | 462 | foreach($sortby1 as $sort1) { |
440 | 463 | foreach($sortby2 as $sort2) { |
441 | - if($ifsort2) $a=0; |
|
464 | + if($ifsort2) { |
|
465 | + $a=0; |
|
466 | + } |
|
442 | 467 | foreach($data_set as $key => $value){ |
443 | 468 | if($value[$keycolname1] == $sort1 && (!$ifsort2 || $value[$keycolname2]== $sort2)) { |
444 | 469 | if($translate1) { |
@@ -461,15 +486,13 @@ discard block |
||
461 | 486 | if($translate1) { |
462 | 487 | $val[$keycolname1] = $app_list_strings[$keycolname1.'_dom'][$sort1]; |
463 | 488 | $val[$keycolname1.'_dom_option'] = $sort1; |
464 | - } |
|
465 | - else { |
|
489 | + } else { |
|
466 | 490 | $val[$keycolname1] = $sort1; |
467 | 491 | } |
468 | 492 | if($translate2) { |
469 | 493 | $val[$keycolname2] = $app_list_strings[$keycolname2.'_dom'][$sort2]; |
470 | 494 | $val[$keycolname2.'_dom_option'] = $sort2; |
471 | - } |
|
472 | - elseif($keycolname2!=null) { |
|
495 | + } elseif($keycolname2!=null) { |
|
473 | 496 | $val[$keycolname2] = $sort2; |
474 | 497 | } |
475 | 498 | array_push($data, $val); |
@@ -1,5 +1,7 @@ discard block |
||
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. |
@@ -73,8 +75,9 @@ discard block |
||
73 | 75 | if(is_file(preg_replace('/(.*\/.*)(\.php)/Uis', '$1.meta$2', $file))) { // is there an associated meta data file? |
74 | 76 | $dashletFiles[$class]['meta'] = preg_replace('/(.*\/.*)(\.php)/Uis', '$1.meta$2', $file); |
75 | 77 | require($dashletFiles[$class]['meta']); |
76 | - if ( isset($dashletMeta[$class]['module']) ) |
|
77 | - $dashletFiles[$class]['module'] = $dashletMeta[$class]['module']; |
|
78 | + if ( isset($dashletMeta[$class]['module']) ) { |
|
79 | + $dashletFiles[$class]['module'] = $dashletMeta[$class]['module']; |
|
80 | + } |
|
78 | 81 | } |
79 | 82 | |
80 | 83 | $filesInDirectory = array(); |