Test Failed
Push — CI ( 0f01dd...c95a04 )
by Adam
55:13
created
modules/AOR_Reports/AOR_Report.php 1 patch
Braces   +42 added lines, -34 removed lines patch added patch discarded remove patch
@@ -211,8 +211,10 @@  discard block
 block discarded – undo
211 211
                 $html = '<script src="modules/AOR_Reports/js/Chart.js"></script>';
212 212
                 break;
213 213
             case self::CHART_TYPE_RGRAPH:
214
-                if($_REQUEST['module']!= 'Home')//Need the require_once for the rgraphincludes as they are only loaded when the home page is hit
214
+                if($_REQUEST['module']!= 'Home') {
215
+                    //Need the require_once for the rgraphincludes as they are only loaded when the home page is hit
215 216
                     require_once('include/SuiteGraphs/RGraphIncludes.php');
217
+                }
216 218
 
217 219
                 break;
218 220
         }
@@ -235,15 +237,13 @@  discard block
 block discarded – undo
235 237
 
236 238
         if(count($rows) > 1) {
237 239
             $GLOBALS['log']->fatal('ambiguous group display for report ' . $this->id);
238
-        }
239
-        else if(count($rows) == 1){
240
+        } else if(count($rows) == 1){
240 241
             $rows[0]['module_path'] = unserialize(base64_decode($rows[0]['module_path']));
241 242
             if(!$rows[0]['module_path'][0]) {
242 243
                 $module = new $beanList[$this->report_module]();
243 244
                 $rows[0]['field_id_name'] = $module->field_defs[$rows[0]['field']]['id_name'] ? $module->field_defs[$rows[0]['field']]['id_name'] : $module->field_defs[$rows[0]['field']]['name'];
244 245
                 $rows[0]['module_path'][0] = $module->table_name;
245
-            }
246
-            else {
246
+            } else {
247 247
                 $rows[0]['field_id_name'] = $rows[0]['field'];
248 248
             }
249 249
             $path[] = $rows[0];
@@ -255,8 +255,7 @@  discard block
 block discarded – undo
255 255
             }
256 256
 
257 257
             return $this->buildMultiGroupReport($offset, $links, $level+1, $path);
258
-        }
259
-        else if(!$rows) {
258
+        } else if(!$rows) {
260 259
             if($path) {
261 260
                 $html = '';
262 261
                 foreach ($path as $pth) {
@@ -274,12 +273,10 @@  discard block
 block discarded – undo
274 273
                     }
275 274
                 }
276 275
                 return $html;
277
-            }
278
-            else {
276
+            } else {
279 277
                 return $this->build_group_report($offset, $links);
280 278
             }
281
-        }
282
-        else {
279
+        } else {
283 280
             throw new Exception('incorrect results');
284 281
         }
285 282
         throw new Exception('incorrect state');
@@ -415,8 +412,7 @@  discard block
 block discarded – undo
415 412
                 foreach($extra['select'] as $selectField => $selectAlias) {
416 413
                     if($selectAlias) {
417 414
                         $query_array['select'][] = $selectField . " AS " . $selectAlias;
418
-                    }
419
-                    else {
415
+                    } else {
420 416
                         $query_array['select'][] = $selectField;
421 417
                     }
422 418
                 }
@@ -471,14 +467,18 @@  discard block
 block discarded – undo
471 467
             $result = $this->db->query($query);
472 468
 
473 469
             while ($row = $this->db->fetchByAssoc($result)) {
474
-                if($html != '') $html .= '<br />';
470
+                if($html != '') {
471
+                    $html .= '<br />';
472
+                }
475 473
 
476 474
                $html .= $this->build_report_html($offset, $links, $row[$field_label], '', $extra);
477 475
 
478 476
             }
479 477
         }
480 478
 
481
-        if($html == '') $html = $this->build_report_html($offset, $links);
479
+        if($html == '') {
480
+            $html = $this->build_report_html($offset, $links);
481
+        }
482 482
         return $html;
483 483
 
484 484
     }
@@ -663,7 +663,9 @@  discard block
 block discarded – undo
663 663
                     if($att['total']){
664 664
                         $totals[$name][] = $row[$name];
665 665
                     }
666
-                    if($att['link'] && $links) $html .= "</a>";
666
+                    if($att['link'] && $links) {
667
+                        $html .= "</a>";
668
+                    }
667 669
                     $html .= "</td>";
668 670
                 }
669 671
             }
@@ -747,7 +749,7 @@  discard block
 block discarded – undo
747 749
             if($field['total']){
748 750
                 $totalLabel = $field['label'] ." ".$app_list_strings['aor_total_options'][$field['total']];
749 751
                 $html .= "<th>{$totalLabel}</th>";
750
-            }else{
752
+            } else{
751 753
                 $html .= "<th></th>";
752 754
             }
753 755
         }
@@ -759,7 +761,7 @@  discard block
 block discarded – undo
759 761
             }
760 762
             if($field['total'] && isset($totals[$label])){
761 763
                 $html .= "<td>".$this->calculateTotal($field['total'],$totals[$label])."</td>";
762
-            }else{
764
+            } else{
763 765
                 $html .= "<td></td>";
764 766
             }
765 767
         }
@@ -835,10 +837,11 @@  discard block
 block discarded – undo
835 837
             $csv .= "\r\n";
836 838
             foreach($fields as $name => $att){
837 839
                 if($att['display']){
838
-                    if($att['function'] != '' )
839
-                        $csv .= $this->encloseForCSV($row[$name]);
840
-                    else
841
-                        $csv .= $this->encloseForCSV(trim(strip_tags(getModuleField($att['module'], $att['field'], $att['field'], 'DetailView',$row[$name]))));
840
+                    if($att['function'] != '' ) {
841
+                                            $csv .= $this->encloseForCSV($row[$name]);
842
+                    } else {
843
+                                            $csv .= $this->encloseForCSV(trim(strip_tags(getModuleField($att['module'], $att['field'], $att['field'], 'DetailView',$row[$name]))));
844
+                    }
842 845
                     $csv .= $delimiter;
843 846
                 }
844 847
             }
@@ -1022,7 +1025,9 @@  discard block
 block discarded – undo
1022 1025
 
1023 1026
                 $query['select'][] = $select_field ." AS '".$field->label."'";
1024 1027
 
1025
-                if($field->group_display == 1 && $group_value) $query['where'][] = $select_field." = '".$group_value."' AND ";
1028
+                if($field->group_display == 1 && $group_value) {
1029
+                    $query['where'][] = $select_field." = '".$group_value."' AND ";
1030
+                }
1026 1031
                     ++$i;
1027 1032
             }
1028 1033
         }
@@ -1047,13 +1052,13 @@  discard block
 block discarded – undo
1047 1052
                                 $params['right_join_table_alias'] = $this->db->quoteIdentifier($alias);
1048 1053
                                 $params['join_table_alias'] = $this->db->quoteIdentifier($alias);
1049 1054
                                 $params['left_join_table_alias'] = $this->db->quoteIdentifier($parentAlias);
1050
-                            }else{
1055
+                            } else{
1051 1056
                                 $params['right_join_table_alias'] = $this->db->quoteIdentifier($parentAlias);
1052 1057
                                 $params['join_table_alias'] = $this->db->quoteIdentifier($alias);
1053 1058
                                 $params['left_join_table_alias'] = $this->db->quoteIdentifier($alias);
1054 1059
                             }
1055 1060
 
1056
-                        }else{
1061
+                        } else{
1057 1062
                             $params['right_join_table_alias'] = $this->db->quoteIdentifier($parentAlias);
1058 1063
                             $params['join_table_alias'] = $this->db->quoteIdentifier($alias);
1059 1064
                             $params['left_join_table_alias'] = $this->db->quoteIdentifier($parentAlias);
@@ -1268,12 +1273,16 @@  discard block
 block discarded – undo
1268 1273
 
1269 1274
                         case 'Multi':
1270 1275
                             $sep = ' AND ';
1271
-                            if ($condition->operator == 'Equal_To') $sep = ' OR ';
1276
+                            if ($condition->operator == 'Equal_To') {
1277
+                                $sep = ' OR ';
1278
+                            }
1272 1279
                             $multi_values = unencodeMultienum($condition->value);
1273 1280
                             if (!empty($multi_values)) {
1274 1281
                                 $value = '(';
1275 1282
                                 foreach ($multi_values as $multi_value) {
1276
-                                    if ($value != '(') $value .= $sep;
1283
+                                    if ($value != '(') {
1284
+                                        $value .= $sep;
1285
+                                    }
1277 1286
                                     $value .= $field . ' ' . $app_list_strings['aor_sql_operator_list'][$condition->operator] . " '" . $multi_value . "'";
1278 1287
                                 }
1279 1288
                                 $value .= ')';
@@ -1313,21 +1322,20 @@  discard block
 block discarded – undo
1313 1322
                     }
1314 1323
 
1315 1324
 
1316
-                    if (!$where_set) $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op . ' ': 'AND ')) . $field . ' ' . $app_list_strings['aor_sql_operator_list'][$condition->operator] . ' ' . $value;
1325
+                    if (!$where_set) {
1326
+                        $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op . ' ': 'AND ')) . $field . ' ' . $app_list_strings['aor_sql_operator_list'][$condition->operator] . ' ' . $value;
1327
+                    }
1317 1328
 
1318 1329
                     $tiltLogicOp = false;
1319
-                }
1320
-                else if($condition->parenthesis) {
1330
+                } else if($condition->parenthesis) {
1321 1331
                     if($condition->parenthesis == 'START') {
1322 1332
                         $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op . ' ' : 'AND ')) .  '(';
1323 1333
                         $tiltLogicOp = true;
1324
-                    }
1325
-                    else {
1334
+                    } else {
1326 1335
                         $query['where'][] = ')';
1327 1336
                         $tiltLogicOp = false;
1328 1337
                     }
1329
-                }
1330
-                else {
1338
+                } else {
1331 1339
                     $GLOBALS['log']->debug('illegal condition');
1332 1340
                 }
1333 1341
 
Please login to merge, or discard this patch.
modules/AOR_Reports/views/view.edit.php 1 patch
Braces   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -94,8 +94,7 @@  discard block
 block discarded – undo
94 94
             }
95 95
             if(isset($conditions[$condition_item['condition_order']])) {
96 96
                 $conditions[] = $condition_item;
97
-            }
98
-            else {
97
+            } else {
99 98
                 $conditions[$condition_item['condition_order']] = $condition_item;
100 99
             }
101 100
         }
@@ -144,7 +143,7 @@  discard block
 block discarded – undo
144 143
         $modulePathDisplay[] = $currentBean->module_name;
145 144
         if(is_array($modulePath)) {
146 145
             $split = $modulePath;
147
-        }else{
146
+        } else{
148 147
             $split = explode(':', $modulePath);
149 148
         }
150 149
         if ($split && $split[0] == $currentBean->module_dir) {
@@ -162,7 +161,7 @@  discard block
 block discarded – undo
162 161
 
163 162
             if(!empty($moduleLabel)){
164 163
                 $modulePathDisplay[] = $moduleLabel;
165
-            }else {
164
+            } else {
166 165
                 $modulePathDisplay[] = $currentBean->module_name;
167 166
             }
168 167
         }
Please login to merge, or discard this patch.
modules/AOR_Reports/views/view.detail.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,8 +55,7 @@
 block discarded – undo
55 55
             }
56 56
             if(isset($parameters[$condition_item['condition_order']])) {
57 57
                 $parameters[] = $condition_item;
58
-            }
59
-            else {
58
+            } else {
60 59
                 $parameters[$condition_item['condition_order']] = $condition_item;
61 60
             }
62 61
         }
Please login to merge, or discard this patch.
modules/AOR_Reports/controller.php 1 patch
Braces   +110 added lines, -51 removed lines patch added patch discarded remove patch
@@ -191,10 +191,11 @@  discard block
 block discarded – undo
191 191
 
192 192
             for($x =0; $x < $countOfCharts; $x++)
193 193
             {
194
-                if(is_null($itemsWithModulus) ||  $x < $itemsWithModulus)
195
-                    $graphHtml.="<img src='.$graphs[$x].' style='width:$width%;' />";
196
-                else
197
-                    $graphHtml.="<img src='.$graphs[$x].' style='width:$modulusWidth%;' />";
194
+                if(is_null($itemsWithModulus) ||  $x < $itemsWithModulus) {
195
+                                    $graphHtml.="<img src='.$graphs[$x].' style='width:$width%;' />";
196
+                } else {
197
+                                    $graphHtml.="<img src='.$graphs[$x].' style='width:$modulusWidth%;' />";
198
+                }
198 199
             }
199 200
 
200 201
 /*            foreach($graphs as $g)
@@ -241,7 +242,7 @@  discard block
 block discarded – undo
241 242
             $pdf->WriteHTML($printable,3);
242 243
             $pdf->Output($this->bean->name.'.pdf', "D");
243 244
 
244
-        }catch(mPDF_exception $e){
245
+        } catch(mPDF_exception $e){
245 246
             echo $e;
246 247
         }
247 248
 
@@ -259,7 +260,7 @@  discard block
 block discarded – undo
259 260
 
260 261
         if($view == 'EditView'){
261 262
             echo "<select type='text' style='width:100px;' name='$aor_field' id='$aor_field' title='' tabindex='116'>". get_select_options_with_id($app_list_strings['aor_function_list'], $value) ."</select>";
262
-        }else{
263
+        } else{
263 264
             echo $app_list_strings['aor_function_list'][$value];
264 265
         }
265 266
         die;
@@ -278,11 +279,17 @@  discard block
 block discarded – undo
278 279
         $fieldname = $_REQUEST['aor_fieldname'];
279 280
         $aor_field = $_REQUEST['aor_newfieldname'];
280 281
 
281
-        if(isset($_REQUEST['view'])) $view = $_REQUEST['view'];
282
-        else $view= 'EditView';
282
+        if(isset($_REQUEST['view'])) {
283
+            $view = $_REQUEST['view'];
284
+        } else {
285
+            $view= 'EditView';
286
+        }
283 287
 
284
-        if(isset($_REQUEST['aor_value'])) $value = $_REQUEST['aor_value'];
285
-        else $value = '';
288
+        if(isset($_REQUEST['aor_value'])) {
289
+            $value = $_REQUEST['aor_value'];
290
+        } else {
291
+            $value = '';
292
+        }
286 293
 
287 294
 
288 295
         require_once($beanFiles[$beanList[$module]]);
@@ -329,7 +336,7 @@  discard block
 block discarded – undo
329 336
         $app_list_strings['aor_operator_list'];
330 337
         if($view == 'EditView'){
331 338
             echo "<select type='text' style='width:178px;' name='$aor_field' id='$aor_field' title='' tabindex='116'>". get_select_options_with_id($app_list_strings['aor_operator_list'], $value) ."</select>";
332
-        }else{
339
+        } else{
333 340
             echo $app_list_strings['aor_operator_list'][$value];
334 341
         }
335 342
         die;
@@ -348,11 +355,17 @@  discard block
 block discarded – undo
348 355
         $fieldname = $_REQUEST['aor_fieldname'];
349 356
         $aor_field = $_REQUEST['aor_newfieldname'];
350 357
 
351
-        if(isset($_REQUEST['view'])) $view = $_REQUEST['view'];
352
-        else $view= 'EditView';
358
+        if(isset($_REQUEST['view'])) {
359
+            $view = $_REQUEST['view'];
360
+        } else {
361
+            $view= 'EditView';
362
+        }
353 363
 
354
-        if(isset($_REQUEST['aor_value'])) $value = $_REQUEST['aor_value'];
355
-        else $value = '';
364
+        if(isset($_REQUEST['aor_value'])) {
365
+            $value = $_REQUEST['aor_value'];
366
+        } else {
367
+            $value = '';
368
+        }
356 369
 
357 370
 
358 371
         require_once($beanFiles[$beanList[$module]]);
@@ -403,7 +416,7 @@  discard block
 block discarded – undo
403 416
 
404 417
         if($view == 'EditView'){
405 418
             echo "<select type='text' style='width:178px;' name='$aor_field' id='$aor_field' title='' tabindex='116'>". get_select_options_with_id($app_list_strings['aor_condition_type_list'], $value) ."</select>";
406
-        }else{
419
+        } else{
407 420
             echo $app_list_strings['aor_condition_type_list'][$value];
408 421
         }
409 422
         die;
@@ -423,11 +436,17 @@  discard block
 block discarded – undo
423 436
         $fieldname = $_REQUEST['aor_fieldname'];
424 437
         $aor_field = $_REQUEST['aor_newfieldname'];
425 438
 
426
-        if(isset($_REQUEST['view'])) $view = $_REQUEST['view'];
427
-        else $view= 'EditView';
439
+        if(isset($_REQUEST['view'])) {
440
+            $view = $_REQUEST['view'];
441
+        } else {
442
+            $view= 'EditView';
443
+        }
428 444
 
429
-        if(isset($_REQUEST['aor_value'])) $value = $_REQUEST['aor_value'];
430
-        else $value = '';
445
+        if(isset($_REQUEST['aor_value'])) {
446
+            $value = $_REQUEST['aor_value'];
447
+        } else {
448
+            $value = '';
449
+        }
431 450
 
432 451
 
433 452
         require_once($beanFiles[$beanList[$module]]);
@@ -460,7 +479,9 @@  discard block
 block discarded – undo
460 479
                 break;
461 480
             case 'relate':
462 481
                 $valid_opp = array('Value','Field');
463
-                if($vardef['module'] == 'Users') $valid_opp = array('Value','Field','Round_Robin','Least_Busy','Random');
482
+                if($vardef['module'] == 'Users') {
483
+                    $valid_opp = array('Value','Field','Round_Robin','Least_Busy','Random');
484
+                }
464 485
                 break;
465 486
             default:
466 487
                 $valid_opp = array('Value','Field');
@@ -475,7 +496,7 @@  discard block
 block discarded – undo
475 496
 
476 497
         if($view == 'EditView'){
477 498
             echo "<select type='text' style='width:178px;' name='$aor_field' id='$aor_field' title='' tabindex='116'>". get_select_options_with_id($app_list_strings['aor_action_type_list'], $value) ."</select>";
478
-        }else{
499
+        } else{
479 500
             echo $app_list_strings['aor_action_type_list'][$value];
480 501
         }
481 502
         die;
@@ -494,18 +515,26 @@  discard block
 block discarded – undo
494 515
         $fieldname = $_REQUEST['aor_fieldname'];
495 516
         $aor_field = $_REQUEST['aor_newfieldname'];
496 517
 
497
-        if(isset($_REQUEST['view'])) $view = $_REQUEST['view'];
498
-        else $view= 'EditView';
518
+        if(isset($_REQUEST['view'])) {
519
+            $view = $_REQUEST['view'];
520
+        } else {
521
+            $view= 'EditView';
522
+        }
499 523
 
500
-        if(isset($_REQUEST['aor_value'])) $value = $_REQUEST['aor_value'];
501
-        else $value = '';
524
+        if(isset($_REQUEST['aor_value'])) {
525
+            $value = $_REQUEST['aor_value'];
526
+        } else {
527
+            $value = '';
528
+        }
502 529
 
503 530
         switch($_REQUEST['aor_type']) {
504 531
             case 'Field':
505
-                if(isset($_REQUEST['alt_module']) && $_REQUEST['alt_module'] != '') $module = $_REQUEST['alt_module'];
532
+                if(isset($_REQUEST['alt_module']) && $_REQUEST['alt_module'] != '') {
533
+                    $module = $_REQUEST['alt_module'];
534
+                }
506 535
                 if($view == 'EditView'){
507 536
                     echo "<select type='text' style='width:178px;' name='$aor_field' id='$aor_field' title='' tabindex='116'>". getModuleFields($module, $view, $value) ."</select>";
508
-                }else{
537
+                } else{
509 538
                     echo getModuleFields($module, $view, $value);
510 539
                 }
511 540
                 break;
@@ -518,7 +547,7 @@  discard block
 block discarded – undo
518 547
             case 'Period':
519 548
                 if($view == 'EditView'){
520 549
                     echo "<select type='text' style='width:178px;' name='$aor_field' id='$aor_field' title='' tabindex='116'>". getDropdownList('date_time_period_list',$_REQUEST['aor_value']) ."</select>";
521
-                }else{
550
+                } else{
522 551
                     echo getDropdownList('date_time_period_list',$_REQUEST['aor_value']);
523 552
                 }
524 553
 
@@ -540,23 +569,33 @@  discard block
 block discarded – undo
540 569
         $fieldname = $_REQUEST['aor_fieldname'];
541 570
         $aor_field = $_REQUEST['aor_newfieldname'];
542 571
 
543
-        if(isset($_REQUEST['view'])) $view = $_REQUEST['view'];
544
-        else $view= 'EditView';
572
+        if(isset($_REQUEST['view'])) {
573
+            $view = $_REQUEST['view'];
574
+        } else {
575
+            $view= 'EditView';
576
+        }
545 577
 
546
-        if(isset($_REQUEST['aor_value'])) $value = $_REQUEST['aor_value'];
547
-        else $value = '';
578
+        if(isset($_REQUEST['aor_value'])) {
579
+            $value = $_REQUEST['aor_value'];
580
+        } else {
581
+            $value = '';
582
+        }
548 583
 
549 584
         switch($_REQUEST['aor_type']) {
550 585
             case 'Field':
551
-                if(isset($_REQUEST['alt_module']) && $_REQUEST['alt_module'] != '') $module = $_REQUEST['alt_module'];
586
+                if(isset($_REQUEST['alt_module']) && $_REQUEST['alt_module'] != '') {
587
+                    $module = $_REQUEST['alt_module'];
588
+                }
552 589
                 if($view == 'EditView'){
553 590
                     echo "<select type='text' style='width:178px;' name='$aor_field' id='$aor_field' title='' tabindex='116'>". getModuleFields($module, $view, $value) ."</select>";
554
-                }else{
591
+                } else{
555 592
                     echo getModuleFields($module, $view, $value);
556 593
                 }
557 594
                 break;
558 595
             case 'Date':
559
-                if(isset($_REQUEST['alt_module']) && $_REQUEST['alt_module'] != '') $module = $_REQUEST['alt_module'];
596
+                if(isset($_REQUEST['alt_module']) && $_REQUEST['alt_module'] != '') {
597
+                    $module = $_REQUEST['alt_module'];
598
+                }
560 599
                 echo getDateField($module, $aor_field, $view, $value);
561 600
                 break;
562 601
             Case 'Round_Robin';
@@ -575,11 +614,17 @@  discard block
 block discarded – undo
575 614
 
576 615
     protected function action_getModuleField()
577 616
     {
578
-        if(isset($_REQUEST['view'])) $view = $_REQUEST['view'];
579
-        else $view= 'EditView';
617
+        if(isset($_REQUEST['view'])) {
618
+            $view = $_REQUEST['view'];
619
+        } else {
620
+            $view= 'EditView';
621
+        }
580 622
 
581
-        if(isset($_REQUEST['aor_value'])) $value = $_REQUEST['aor_value'];
582
-        else $value = '';
623
+        if(isset($_REQUEST['aor_value'])) {
624
+            $value = $_REQUEST['aor_value'];
625
+        } else {
626
+            $value = '';
627
+        }
583 628
 
584 629
         echo getModuleField($_REQUEST['aor_module'],$_REQUEST['aor_fieldname'], $_REQUEST['aor_newfieldname'], $view, $value );
585 630
         die;
@@ -591,18 +636,26 @@  discard block
 block discarded – undo
591 636
         $fieldname = $_REQUEST['aor_fieldname'];
592 637
         $aor_field = $_REQUEST['aor_newfieldname'];
593 638
 
594
-        if(isset($_REQUEST['view'])) $view = $_REQUEST['view'];
595
-        else $view= 'EditView';
639
+        if(isset($_REQUEST['view'])) {
640
+            $view = $_REQUEST['view'];
641
+        } else {
642
+            $view= 'EditView';
643
+        }
596 644
 
597
-        if(isset($_REQUEST['aor_value'])) $value = $_REQUEST['aor_value'];
598
-        else $value = '';
645
+        if(isset($_REQUEST['aor_value'])) {
646
+            $value = $_REQUEST['aor_value'];
647
+        } else {
648
+            $value = '';
649
+        }
599 650
 
600 651
         switch($_REQUEST['aor_type']) {
601 652
             case 'Field':
602
-                if(isset($_REQUEST['alt_module']) && $_REQUEST['alt_module'] != '') $module = $_REQUEST['alt_module'];
653
+                if(isset($_REQUEST['alt_module']) && $_REQUEST['alt_module'] != '') {
654
+                    $module = $_REQUEST['alt_module'];
655
+                }
603 656
                 if($view == 'EditView'){
604 657
                     echo "<select type='text' style='width:178px;' name='$aor_field' id='$aor_field' title='' tabindex='116'>". getModuleFields($module, $view, $value) ."</select>";
605
-                }else{
658
+                } else{
606 659
                     echo getModuleFields($module, $view, $value);
607 660
                 }
608 661
                 break;
@@ -624,11 +677,17 @@  discard block
 block discarded – undo
624 677
         $fieldname = $_REQUEST['aor_fieldname'];
625 678
         $aor_field = $_REQUEST['aor_newfieldname'];
626 679
 
627
-        if(isset($_REQUEST['view'])) $view = $_REQUEST['view'];
628
-        else $view= 'EditView';
680
+        if(isset($_REQUEST['view'])) {
681
+            $view = $_REQUEST['view'];
682
+        } else {
683
+            $view= 'EditView';
684
+        }
629 685
 
630
-        if(isset($_REQUEST['aor_value'])) $value = $_REQUEST['aor_value'];
631
-        else $value = '';
686
+        if(isset($_REQUEST['aor_value'])) {
687
+            $value = $_REQUEST['aor_value'];
688
+        } else {
689
+            $value = '';
690
+        }
632 691
 
633 692
 
634 693
         require_once($beanFiles[$beanList[$module]]);
@@ -652,7 +711,7 @@  discard block
 block discarded – undo
652 711
 
653 712
         if($view == 'EditView'){
654 713
             echo "<select type='text' style='width:178px;' name='$aor_field' id='$aor_field' title='' tabindex='116'>". get_select_options_with_id($app_list_strings['aor_rel_action_type_list'], $value) ."</select>";
655
-        }else{
714
+        } else{
656 715
             echo $app_list_strings['aor_rel_action_type_list'][$value];
657 716
         }
658 717
         die;
Please login to merge, or discard this patch.
modules/AOR_Reports/Dashlets/AORReportsDashlet/AORReportsDashlet.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 
4 6
 
5 7
 require_once('include/Dashlets/Dashlet.php');
@@ -63,7 +65,7 @@  discard block
 block discarded – undo
63 65
         if(!empty($this->report->id)) {
64 66
             //return $this->report->build_report_chart($this->charts, AOR_Report::CHART_TYPE_CHARTJS);
65 67
             return $this->report->build_report_chart($this->charts, AOR_Report::CHART_TYPE_RGRAPH);
66
-        }else{
68
+        } else{
67 69
             return '';
68 70
         }
69 71
     }
Please login to merge, or discard this patch.
modules/DynamicFields/DynamicField.php 1 patch
Braces   +84 added lines, -59 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (! defined ( 'sugarEntry' ) || ! sugarEntry)
2
+if (! defined ( 'sugarEntry' ) || ! sugarEntry) {
3 3
     die ( 'Not A Valid Entry Point' ) ;
4
+}
4 5
 
5 6
 /*********************************************************************************
6 7
  * SugarCRM Community Edition is a customer relationship management program developed by
@@ -103,9 +104,12 @@  discard block
 block discarded – undo
103 104
     */
104 105
     function buildCache($module = false, $saveCache=true) {
105 106
         //We can't build the cache while installing as the required database tables may not exist.
106
-        if (!empty($GLOBALS['installing']) && $GLOBALS['installing'] == true|| empty($GLOBALS['db']))
107
+        if (!empty($GLOBALS['installing']) && $GLOBALS['installing'] == true|| empty($GLOBALS['db'])) {
108
+                    return false;
109
+        }
110
+        if($module == '../data') {
107 111
             return false;
108
-        if($module == '../data')return false;
112
+        }
109 113
 
110 114
         static $results = array ( ) ;
111 115
 
@@ -113,8 +117,7 @@  discard block
 block discarded – undo
113 117
         if (! empty ( $module )) {
114 118
             $where .= " custom_module='$module' AND ";
115 119
             unset( $results[ $module ] ) ; // clear out any old results for the module as $results is declared static
116
-        }
117
-        else
120
+        } else
118 121
         {
119 122
             $results = array ( ) ; // clear out results - if we remove a module we don't want to have its old vardefs hanging around
120 123
         }
@@ -138,10 +141,12 @@  discard block
 block discarded – undo
138 141
             $vardef = $field->get_field_def ();
139 142
             $vardef ['id'] = $row ['id'];
140 143
             $vardef ['custom_module'] = $row ['custom_module'];
141
-            if (empty ( $vardef ['source'] ))
142
-                $vardef ['source'] = 'custom_fields';
143
-            if (empty ( $results [$row ['custom_module']] ))
144
-                $results [$row ['custom_module']] = array ( );
144
+            if (empty ( $vardef ['source'] )) {
145
+                            $vardef ['source'] = 'custom_fields';
146
+            }
147
+            if (empty ( $results [$row ['custom_module']] )) {
148
+                            $results [$row ['custom_module']] = array ( );
149
+            }
145 150
             $results [$row ['custom_module']] [$row ['name']] = $vardef;
146 151
         }
147 152
         if (empty ( $module )) {
@@ -151,7 +156,7 @@  discard block
 block discarded – undo
151 156
         } else {
152 157
             if (! empty ( $results [$module] )) {
153 158
                 $this->saveToVardef ( $module, $results [$module], $saveCache);
154
-            }else{
159
+            } else{
155 160
                 $this->saveToVardef ( $module, false, $saveCache);
156 161
             }
157 162
         }
@@ -196,7 +201,9 @@  discard block
 block discarded – undo
196 201
                 //if the vardef isn't loaded let's try loading it.
197 202
                 VardefManager::refreshVardefs($module,$object, null, false);
198 203
                 //if it's still not loaded we really don't have anything useful to cache
199
-                if(empty($GLOBALS['dictionary'][$object]['fields']))return;
204
+                if(empty($GLOBALS['dictionary'][$object]['fields'])) {
205
+                    return;
206
+                }
200 207
             }
201 208
             if (!isset($GLOBALS['dictionary'][$object]['custom_fields'])) {
202 209
                 $GLOBALS['dictionary'][$object]['custom_fields'] = false;
@@ -266,8 +273,7 @@  discard block
 block discarded – undo
266 273
         if (empty($expandedList) )
267 274
         {
268 275
             $select = ",{$this->bean->table_name}_cstm.*" ;
269
-        }
270
-        else
276
+        } else
271 277
         {
272 278
             $select = '';
273 279
             $isList = is_array($expandedList);
@@ -276,8 +282,9 @@  discard block
 block discarded – undo
276 282
                 if (!empty($field['source']) && $field['source'] == 'custom_fields' && (!$isList || !empty($expandedList[$name]))){
277 283
                     // assumption: that the column name in _cstm is the same as the field name. Currently true.
278 284
                     // however, two types of dynamic fields do not have columns in the custom table - html fields (they're readonly) and flex relates (parent_name doesn't exist)
279
-                    if ( $field['type'] != 'html' && $name != 'parent_name')
280
-                        $select .= ",{$this->bean->table_name}_cstm.{$name}" ;
285
+                    if ( $field['type'] != 'html' && $name != 'parent_name') {
286
+                                            $select .= ",{$this->bean->table_name}_cstm.{$name}" ;
287
+                    }
281 288
                 }
282 289
             }
283 290
         }
@@ -332,8 +339,7 @@  discard block
 block discarded – undo
332 339
             else if(!empty($rel_mod->field_defs['name']['source']) && $rel_mod->field_defs['name']['source'] == "non-db" && !empty($field_def['rname']))
333 340
             {
334 341
                 $name_field = "$joinTableAlias." . $field_def['rname'];
335
-            }
336
-            else
342
+            } else
337 343
             {
338 344
                 $name_field = "$joinTableAlias.name";
339 345
             }
@@ -355,12 +361,16 @@  discard block
 block discarded – undo
355 361
    function fill_relationships(){
356 362
         global $beanList, $beanFiles;
357 363
         if(!empty($this->bean->relDepth)) {
358
-            if($this->bean->relDepth > 1)return;
359
-        }else{
364
+            if($this->bean->relDepth > 1) {
365
+                return;
366
+            }
367
+        } else{
360 368
             $this->bean->relDepth = 0;
361 369
         }
362 370
         foreach($this->bean->field_defs as $field){
363
-            if(empty($field['source']) || $field['source'] != 'custom_fields')continue;
371
+            if(empty($field['source']) || $field['source'] != 'custom_fields') {
372
+                continue;
373
+            }
364 374
             if($field['type'] == 'relate'){
365 375
                 $related_module =$field['ext2'];
366 376
                 $name = $field['name'];
@@ -399,8 +409,12 @@  discard block
 block discarded – undo
399 409
             $first = true;
400 410
             foreach($this->bean->field_defs as $name=>$field){
401 411
 
402
-                if(empty($field['source']) || $field['source'] != 'custom_fields')continue;
403
-                if($field['type'] == 'html' || $field['type'] == 'parent')continue;
412
+                if(empty($field['source']) || $field['source'] != 'custom_fields') {
413
+                    continue;
414
+                }
415
+                if($field['type'] == 'html' || $field['type'] == 'parent') {
416
+                    continue;
417
+                }
404 418
                 if(isset($this->bean->$name)){
405 419
                     $quote = "'";
406 420
 
@@ -409,16 +423,17 @@  discard block
 block discarded – undo
409 423
                         if(!isset($this->bean->$name) || !is_numeric($this->bean->$name) ){
410 424
                             if($field['required']){
411 425
                                 $this->bean->$name = 0;
412
-                            }else{
426
+                            } else{
413 427
                                 $this->bean->$name = 'NULL';
414 428
                             }
415 429
                         }
416 430
                     }
417 431
                     if ( $field['type'] == 'bool' ) {
418
-                        if ( $this->bean->$name === FALSE )
419
-                            $this->bean->$name = '0';
420
-                        elseif ( $this->bean->$name === TRUE )
421
-                            $this->bean->$name = '1';
432
+                        if ( $this->bean->$name === FALSE ) {
433
+                                                    $this->bean->$name = '0';
434
+                        } elseif ( $this->bean->$name === TRUE ) {
435
+                                                    $this->bean->$name = '1';
436
+                        }
422 437
                     }
423 438
 
424 439
                     $val = $this->bean->$name;
@@ -431,7 +446,7 @@  discard block
 block discarded – undo
431 446
                         if($first){
432 447
                             $query .= " $name=$quote".$GLOBALS['db']->quote($val)."$quote";
433 448
 
434
-                        }else{
449
+                        } else{
435 450
                             $query .= " ,$name=$quote".$GLOBALS['db']->quote($val)."$quote";
436 451
                         }
437 452
                     }
@@ -450,7 +465,7 @@  discard block
 block discarded – undo
450 465
             if(!$first){
451 466
                 if(!$isUpdate){
452 467
                     $GLOBALS['db']->query($queryInsert);
453
-                }else{
468
+                } else{
454 469
                     $checkquery = "SELECT id_c FROM {$this->bean->table_name}_cstm WHERE id_c = '{$this->bean->id}'";
455 470
                     if ( $GLOBALS['db']->getOne($checkquery) ) {
456 471
                         $result = $GLOBALS['db']->query($query);
@@ -485,8 +500,9 @@  discard block
 block discarded – undo
485 500
 
486 501
         $GLOBALS['db']->query("DELETE FROM fields_meta_data WHERE id='" . $this->module . $widget->name . "'");
487 502
         $sql = $widget->get_db_delete_alter_table( $this->bean->table_name . "_cstm" ) ;
488
-        if (! empty( $sql ) )
489
-            $GLOBALS['db']->query( $sql );
503
+        if (! empty( $sql ) ) {
504
+                    $GLOBALS['db']->query( $sql );
505
+        }
490 506
 
491 507
         $this->removeVardefExtension($widget);
492 508
         VardefManager::clearVardef();
@@ -504,19 +520,21 @@  discard block
 block discarded – undo
504 520
         $name = $this->getDBName($name);
505 521
         $vardefs = $GLOBALS['dictionary'][$this->bean->object_name]['fields'];
506 522
         if(!empty($vardefs)){
507
-            if(empty($type) && empty($name))
508
-                return false;
509
-            else if(empty($type))
510
-                return !empty($vardefs[$name]);
511
-            else if(empty($name)){
523
+            if(empty($type) && empty($name)) {
524
+                            return false;
525
+            } else if(empty($type)) {
526
+                            return !empty($vardefs[$name]);
527
+            } else if(empty($name)){
512 528
                 foreach($vardefs as $def){
513
-                    if(!empty($def['type']) && $def['type'] == $type)
514
-                        return true;
529
+                    if(!empty($def['type']) && $def['type'] == $type) {
530
+                                            return true;
531
+                    }
515 532
                 }
516 533
                 return false;
517
-            }else
518
-                return (!empty($vardefs[$name]) && ($vardefs[$name]['type'] == $type));
519
-        }else{
534
+            } else {
535
+                            return (!empty($vardefs[$name]) && ($vardefs[$name]['type'] == $type));
536
+            }
537
+        } else{
520 538
             return false;
521 539
         }
522 540
     }
@@ -539,7 +557,7 @@  discard block
 block discarded – undo
539 557
         $label = strtoupper( $field->label );
540 558
         if(!empty($id)){
541 559
             $is_update = true;
542
-        }else{
560
+        } else{
543 561
             $db_name = $this->getDBName($field->name);
544 562
             $field->name = $db_name;
545 563
         }
@@ -550,8 +568,10 @@  discard block
 block discarded – undo
550 568
         $fmd->vname = $label;
551 569
         $fmd->type = $field->type;
552 570
         $fmd->help = $field->help;
553
-        if (!empty($field->len))
554
-            $fmd->len = $field->len; // tyoung bug 15407 - was being set to $field->size so changes weren't being saved
571
+        if (!empty($field->len)) {
572
+                    $fmd->len = $field->len;
573
+        }
574
+        // tyoung bug 15407 - was being set to $field->size so changes weren't being saved
555 575
         $fmd->required = ($field->required ? 1 : 0);
556 576
         $fmd->default_value = $field->default;
557 577
         $fmd->ext1 = $field->ext1;
@@ -591,7 +611,7 @@  discard block
 block discarded – undo
591 611
 	                	$GLOBALS['db']->query($query, true, "Cannot set default");
592 612
 	            	}
593 613
                 }
594
-            }else{
614
+            } else{
595 615
                 $query = $field->get_db_modify_alter_table($this->bean->table_name . '_cstm');
596 616
                 if(!empty($query)){
597 617
                 	$GLOBALS['db']->query($query, true, "Cannot modify field");
@@ -671,16 +691,16 @@  discard block
 block discarded – undo
671 691
 
672 692
         $out .= "\n ?>";
673 693
 
674
-        if (!file_exists($this->base_path))
675
-            mkdir_recursive($this->base_path);
694
+        if (!file_exists($this->base_path)) {
695
+                    mkdir_recursive($this->base_path);
696
+        }
676 697
 
677 698
         if( $fh = @sugar_fopen( $file_loc, 'w' ) )
678 699
         {
679 700
             fputs( $fh, $out);
680 701
             fclose( $fh );
681 702
             return true ;
682
-        }
683
-        else
703
+        } else
684 704
         {
685 705
             return false ;
686 706
         }
@@ -801,8 +821,9 @@  discard block
 block discarded – undo
801 821
     	$out = "";
802 822
         if($this->bean->hasCustomFields()){
803 823
 	        foreach($this->bean->field_defs as $name=>$data){
804
-	        	if(empty($data['source']) || $data['source'] != 'custom_fields')
805
-                    continue;
824
+	        	if(empty($data['source']) || $data['source'] != 'custom_fields') {
825
+	        	                    continue;
826
+	        	}
806 827
 	            $out .= $this->add_existing_custom_field($data, $execute);
807 828
 	        }
808 829
     	}
@@ -817,8 +838,9 @@  discard block
 block discarded – undo
817 838
         $query = "/*MISSING IN DATABASE - {$data['name']} -  ROW*/\n"
818 839
                 . $field->get_db_add_alter_table($this->bean->table_name . '_cstm');
819 840
         $out = $query . "\n";
820
-        if ($execute)
821
-            $GLOBALS['db']->query($query);
841
+        if ($execute) {
842
+                    $GLOBALS['db']->query($query);
843
+        }
822 844
 
823 845
         return $out;
824 846
     }
@@ -827,16 +849,18 @@  discard block
 block discarded – undo
827 849
     {
828 850
         $out = $this->createCustomTable($execute);
829 851
         //If the table didn't exist, createCustomTable will have returned all the SQL to create and populate it
830
-        if (!empty($out))
831
-            return "/*Checking Custom Fields for module : {$this->module} */\n$out";
852
+        if (!empty($out)) {
853
+                    return "/*Checking Custom Fields for module : {$this->module} */\n$out";
854
+        }
832 855
         //Otherwise make sure all the custom fields defined in the vardefs exist in the custom table.
833 856
         //We aren't checking for data types, just that the column exists.
834 857
         $db = $GLOBALS['db'];
835 858
         $tablename = $this->bean->table_name."_cstm";
836 859
         $compareFieldDefs = $db->get_columns($tablename);
837 860
         foreach($this->bean->field_defs as $name=>$data){
838
-            if(empty($data['source']) || $data['source'] != 'custom_fields')
839
-                continue;
861
+            if(empty($data['source']) || $data['source'] != 'custom_fields') {
862
+                            continue;
863
+            }
840 864
             /**
841 865
              * @bug 43471
842 866
              * @issue 43471
@@ -850,8 +874,9 @@  discard block
 block discarded – undo
850 874
             }
851 875
             $out .= $this->add_existing_custom_field($data, $execute);
852 876
         }
853
-        if (!empty($out))
854
-            $out = "/*Checking Custom Fields for module : {$this->module} */\n$out";
877
+        if (!empty($out)) {
878
+                    $out = "/*Checking Custom Fields for module : {$this->module} */\n$out";
879
+        }
855 880
 
856 881
         return $out;
857 882
     }
Please login to merge, or discard this patch.
modules/DynamicFields/UpgradeFields.php 1 patch
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); 
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -89,15 +91,19 @@  discard block
 block discarded – undo
89 91
 			$the_field->set($fieldDef);
90 92
 				
91 93
 				if(!isset($fields[$col]) && $col != 'id_c'){
92
-					if(!$simulate)$db->query("ALTER TABLE $mod->table_name" . "_cstm DROP COLUMN $col");
94
+					if(!$simulate) {
95
+					    $db->query("ALTER TABLE $mod->table_name" . "_cstm DROP COLUMN $col");
96
+					}
93 97
 					unset($fields[$col]);
94 98
 					echo "Dropping Column $col from $mod->table_name" . "_cstm for module $the_module<br>";
95
-				}	else{
99
+				} else{
96 100
 					if($col != 'id_c'){
97 101
 					if(trim($the_field->get_db_type()) != trim($type)){
98 102
 						
99 103
 					echo "Fixing Column Type for $col changing $type to ". $the_field->get_db_type() . "<br>";
100
-					if(!$simulate)$db->query($the_field->get_db_modify_alter_table($mod->table_name . '_cstm'));		
104
+					if(!$simulate) {
105
+					    $db->query($the_field->get_db_modify_alter_table($mod->table_name . '_cstm'));
106
+					}
101 107
 					}
102 108
 					}
103 109
 					
Please login to merge, or discard this patch.
modules/Relationships/Relationship.php 1 patch
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -197,8 +199,7 @@  discard block
 block discarded – undo
197 199
 			{
198 200
 					$this->$field = $value;
199 201
 			}
200
-		}
201
-		else {
202
+		} else {
202 203
 			$GLOBALS['log']->fatal('Error fetching relationship from cache '.$relationship_name);
203 204
 			return false;
204 205
 		}
Please login to merge, or discard this patch.
modules/jjwg_Maps/views/view.geocoding_test.php 1 patch
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3
+if(!defined('sugarEntry') || !sugarEntry) {
4
+    die('Not A Valid Entry Point');
5
+}
4 6
 
5 7
 class Jjwg_MapsViewGeocoding_Test extends SugarView {
6 8
 
@@ -10,8 +12,10 @@  discard block
 block discarded – undo
10 12
 
11 13
 	function display() {
12 14
 		
13
-        if (!isset($_REQUEST['geocoding_address'])) $_REQUEST['geocoding_address'] = '';
14
-?>
15
+        if (!isset($_REQUEST['geocoding_address'])) {
16
+            $_REQUEST['geocoding_address'] = '';
17
+        }
18
+        ?>
15 19
 
16 20
 <div class="moduleTitle"><h2><?php echo $GLOBALS['mod_strings']['LBL_MAP_ADDRESS_TEST']; ?></h2><div class="clear"></div></div>
17 21
 <div class="clear"></div>
Please login to merge, or discard this patch.