Completed
Push — develop ( 695bbe )
by Adam
37:32 queued 21:39
created
modules/FP_events/language/en_us.lang.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -112,17 +112,17 @@
 block discarded – undo
112 112
     'LBL_FP_EVENTS_LEADS_1_FROM_LEADS_TITLE' => 'Leads',
113 113
     'LBL_FP_EVENTS_PROSPECTS_1_FROM_PROSPECTS_TITLE' => 'Targets',
114 114
 
115
-	'LBL_HOURS_ABBREV' => 'h',
116
-	'LBL_MINSS_ABBREV' => 'm',
115
+    'LBL_HOURS_ABBREV' => 'h',
116
+    'LBL_MINSS_ABBREV' => 'm',
117 117
 
118
-	// Attendance report
119
-	'LBL_CONTACT_NAME' => 'Name',
120
-	'LBL_ACCOUNT_NAME' => 'Company',
121
-	'LBL_SIGNATURE' => 'Signature',
122
-	// contacts/leads/targets subpanels
123
-	'LBL_LIST_INVITE_STATUS_EVENT' => 'Invited',
124
-	'LBL_LIST_ACCEPT_STATUS_EVENT' => 'Status',
118
+    // Attendance report
119
+    'LBL_CONTACT_NAME' => 'Name',
120
+    'LBL_ACCOUNT_NAME' => 'Company',
121
+    'LBL_SIGNATURE' => 'Signature',
122
+    // contacts/leads/targets subpanels
123
+    'LBL_LIST_INVITE_STATUS_EVENT' => 'Invited',
124
+    'LBL_LIST_ACCEPT_STATUS_EVENT' => 'Status',
125 125
 
126
-	'LBL_ACTIVITY_STATUS' => 'Activity Status',
127
-	'LBL_FP_EVENT_LOCATIONS_FP_EVENTS_1_FROM_FP_EVENTS_TITLE' => 'Event Locations from Events Title',
126
+    'LBL_ACTIVITY_STATUS' => 'Activity Status',
127
+    'LBL_FP_EVENT_LOCATIONS_FP_EVENTS_1_FROM_FP_EVENTS_TITLE' => 'Event Locations from Events Title',
128 128
 );
Please login to merge, or discard this patch.
modules/AOR_Conditions/conditionLines.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -23,19 +23,19 @@  discard block
 block discarded – undo
23 23
  */
24 24
 
25 25
 
26
-function display_condition_lines($focus, $field, $value, $view){
26
+function display_condition_lines($focus, $field, $value, $view) {
27 27
 
28 28
     global $locale, $app_list_strings, $mod_strings;
29 29
 
30 30
     $html = '';
31 31
 
32
-    if (!is_file('cache/jsLanguage/AOR_Conditions/' . $GLOBALS['current_language'] . '.js')) {
32
+    if (!is_file('cache/jsLanguage/AOR_Conditions/'.$GLOBALS['current_language'].'.js')) {
33 33
         require_once ('include/language/jsLanguage.php');
34 34
         jsLanguage::createModuleStringsCache('AOR_Conditions', $GLOBALS['current_language']);
35 35
     }
36
-    $html .= '<script src="cache/jsLanguage/AOR_Conditions/'. $GLOBALS['current_language'] . '.js"></script>';
36
+    $html .= '<script src="cache/jsLanguage/AOR_Conditions/'.$GLOBALS['current_language'].'.js"></script>';
37 37
 
38
-    if($view == 'EditView'){
38
+    if ($view == 'EditView') {
39 39
 
40 40
         $html .= '<script src="modules/AOR_Conditions/conditionLines.js"></script>';
41 41
         $html .= "<table border='0' cellspacing='4' width='100%' id='aor_conditionLines'></table>";
@@ -45,12 +45,12 @@  discard block
 block discarded – undo
45 45
         $html .= "</div>";
46 46
 
47 47
 
48
-        if(isset($focus->report_module) && $focus->report_module != ''){
48
+        if (isset($focus->report_module) && $focus->report_module != '') {
49 49
             require_once("modules/AOW_WorkFlow/aow_utils.php");
50 50
             $html .= "<script>";
51 51
             $html .= "report_module = \"".$focus->report_module."\";";
52 52
             $html .= "document.getElementById('btn_ConditionLine').disabled = '';";
53
-            if($focus->id != ''){
53
+            if ($focus->id != '') {
54 54
                 $sql = "SELECT id FROM aor_conditions WHERE aor_report_id = '".$focus->id."' AND deleted = 0 ORDER BY condition_order ASC";
55 55
                 $result = $focus->db->query($sql);
56 56
 
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
                     $condition_name = new AOR_Condition();
59 59
                     $condition_name->retrieve($row['id']);
60 60
                     $condition_name->module_path = unserialize(base64_decode($condition_name->module_path));
61
-                    $html .= "report_fields = \"".trim(preg_replace('/\s+/', ' ', getModuleFields(getRelatedModule($focus->report_module,$condition_name->module_path[0]))))."\";";
62
-                    if($condition_name->value_type == 'Date'){
61
+                    $html .= "report_fields = \"".trim(preg_replace('/\s+/', ' ', getModuleFields(getRelatedModule($focus->report_module, $condition_name->module_path[0]))))."\";";
62
+                    if ($condition_name->value_type == 'Date') {
63 63
                         $condition_name->value = unserialize(base64_decode($condition_name->value));
64 64
                     }
65 65
                     $condition_item = json_encode($condition_name->toArray());
@@ -71,12 +71,12 @@  discard block
 block discarded – undo
71 71
         }
72 72
 
73 73
     }
74
-    else if($view == 'DetailView'){
74
+    else if ($view == 'DetailView') {
75 75
         $html .= '<script src="modules/AOR_Conditions/conditionLines.js"></script>';
76 76
         $html .= "<table border='0' cellspacing='0' width='100%' id='aor_conditionLines'></table>";
77 77
 
78 78
 
79
-        if(isset($focus->report_module) && $focus->report_module != ''){
79
+        if (isset($focus->report_module) && $focus->report_module != '') {
80 80
             require_once("modules/AOW_WorkFlow/aow_utils.php");
81 81
             $html .= "<script>";
82 82
             $html .= "report_fields = \"".trim(preg_replace('/\s+/', ' ', getModuleFields($focus->report_module)))."\";";
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
                 $condition_name = new AOR_Condition();
89 89
                 $condition_name->retrieve($row['id']);
90 90
                 $condition_name->module_path = unserialize(base64_decode($condition_name->module_path));
91
-                if($condition_name->value_type == 'Date'){
91
+                if ($condition_name->value_type == 'Date') {
92 92
                     $condition_name->value = unserialize(base64_decode($condition_name->value));
93 93
                 }
94 94
                 $condition_item = json_encode($condition_name->toArray());
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -70,8 +70,7 @@
 block discarded – undo
70 70
             $html .= "</script>";
71 71
         }
72 72
 
73
-    }
74
-    else if($view == 'DetailView'){
73
+    } else if($view == 'DetailView'){
75 74
         $html .= '<script src="modules/AOR_Conditions/conditionLines.js"></script>';
76 75
         $html .= "<table border='0' cellspacing='0' width='100%' id='aor_conditionLines'></table>";
77 76
 
Please login to merge, or discard this patch.
modules/AOR_Reports/AOR_Report.php 1 patch
Spacing   +177 added lines, -177 removed lines patch added patch discarded remove patch
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
         foreach ($this->get_linked_beans('aor_fields', 'AOR_Fields') as $field) {
171 171
             $fields[] = $field;
172 172
         }
173
-        usort($fields, function ($a, $b) {
173
+        usort($fields, function($a, $b) {
174 174
             return $a->field_order - $b->field_order;
175 175
         });
176 176
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
             return '';
192 192
         }
193 193
 
194
-        $sql = "SELECT id FROM aor_fields WHERE aor_report_id = '" . $this->id . "' AND deleted = 0 ORDER BY field_order ASC";
194
+        $sql = "SELECT id FROM aor_fields WHERE aor_report_id = '".$this->id."' AND deleted = 0 ORDER BY field_order ASC";
195 195
         $result = $this->db->query($sql);
196 196
 
197 197
         $fields = array();
@@ -216,10 +216,10 @@  discard block
 block discarded – undo
216 216
                         continue;
217 217
                     }
218 218
                     $field_module = getRelatedModule($field_module, $rel);
219
-                    $field_alias = $field_alias . ':' . $rel;
219
+                    $field_alias = $field_alias.':'.$rel;
220 220
                 }
221 221
             }
222
-            $label = str_replace(' ', '_', $field->label) . $i;
222
+            $label = str_replace(' ', '_', $field->label).$i;
223 223
             $fields[$label]['field'] = $field->field;
224 224
             $fields[$label]['label'] = $field->label;
225 225
             $fields[$label]['display'] = $field->display;
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
         while ($row = $this->db->fetchByAssoc($result, false)) {
255 255
             foreach ($fields as $name => $att) {
256 256
 
257
-                $currency_id = isset($row[$att['alias'] . '_currency_id']) ? $row[$att['alias'] . '_currency_id'] : '';
257
+                $currency_id = isset($row[$att['alias'].'_currency_id']) ? $row[$att['alias'].'_currency_id'] : '';
258 258
 
259 259
                 if ($att['function'] != 'COUNT' && empty($att['params']) && !is_numeric($row[$name])) {
260 260
                     $row[$name] = trim(strip_tags(getModuleField($att['module'], $att['field'], $att['field'],
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
         $rows = $this->getGroupDisplayFieldByReportId($this->id, $level);
300 300
 
301 301
         if (count($rows) > 1) {
302
-            $GLOBALS['log']->fatal('ambiguous group display for report ' . $this->id);
302
+            $GLOBALS['log']->fatal('ambiguous group display for report '.$this->id);
303 303
         } else {
304 304
             if (count($rows) == 1) {
305 305
                 $rows[0]['module_path'] = unserialize(base64_decode($rows[0]['module_path']));
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
                         $html = '';
327 327
                         foreach ($path as $pth) {
328 328
                             $_fieldIdName = $this->db->quoteIdentifier($pth['field_id_name']);
329
-                            $query = "SELECT $_fieldIdName FROM " . $this->db->quoteIdentifier($pth['module_path'][0]) . " GROUP BY $_fieldIdName;";
329
+                            $query = "SELECT $_fieldIdName FROM ".$this->db->quoteIdentifier($pth['module_path'][0])." GROUP BY $_fieldIdName;";
330 330
                             $values = $this->dbSelect($query);
331 331
 
332 332
                             foreach ($values as $value) {
@@ -392,8 +392,8 @@  discard block
 block discarded – undo
392 392
     private function getMultiGroupFrameHTML($header, $body)
393 393
     {
394 394
         $html = '<div class="multi-group-list" style="border: 1px solid black; padding: 10px;">
395
-                    <h3>' . $header . '</h3>
396
-                    <div class="multi-group-list-inner">' . $body . '</div>
395
+                    <h3>' . $header.'</h3>
396
+                    <div class="multi-group-list-inner">' . $body.'</div>
397 397
                 </div>';
398 398
 
399 399
         return $html;
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
     private function addDataIdValueToInnertext($html)
403 403
     {
404 404
         preg_match('/\sdata-id-value\s*=\s*"([^"]*)"/', $html, $match);
405
-        $html = preg_replace('/(>)([^<]*)(<\/\w+>$)/', '$1$2' . $match[1] . '$3', $html);
405
+        $html = preg_replace('/(>)([^<]*)(<\/\w+>$)/', '$1$2'.$match[1].'$3', $html);
406 406
 
407 407
         return $html;
408 408
     }
@@ -417,11 +417,11 @@  discard block
 block discarded – undo
417 417
         $query_array = array();
418 418
         $module = new $beanList[$this->report_module]();
419 419
 
420
-        $sql = "SELECT id FROM aor_fields WHERE aor_report_id = '" . $this->id . "' AND group_display = 1 AND deleted = 0 ORDER BY field_order ASC";
420
+        $sql = "SELECT id FROM aor_fields WHERE aor_report_id = '".$this->id."' AND group_display = 1 AND deleted = 0 ORDER BY field_order ASC";
421 421
         $field_id = $this->db->getOne($sql);
422 422
 
423 423
         if (!$field_id) {
424
-            $query_array['select'][] = $module->table_name . ".id AS '" . $module->table_name . "_id'";
424
+            $query_array['select'][] = $module->table_name.".id AS '".$module->table_name."_id'";
425 425
         }
426 426
 
427 427
         if ($field_id != '') {
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
                 foreach ($path as $rel) {
439 439
                     $new_field_module = new $beanList[getRelatedModule($field_module->module_dir, $rel)];
440 440
                     $oldAlias = $table_alias;
441
-                    $table_alias = $table_alias . ":" . $rel;
441
+                    $table_alias = $table_alias.":".$rel;
442 442
 
443 443
                     $query_array = $this->build_report_query_join($rel, $table_alias, $oldAlias, $field_module,
444 444
                         'relationship', $query_array, $new_field_module);
@@ -456,23 +456,23 @@  discard block
 block discarded – undo
456 456
                     '_USD') && isset($field_module->field_defs['currency_id'])
457 457
             ) {
458 458
                 if ((isset($field_module->field_defs['currency_id']['source']) && $field_module->field_defs['currency_id']['source'] == 'custom_fields')) {
459
-                    $query['select'][$table_alias . '_currency_id'] = $table_alias . '_cstm' . ".currency_id AS '" . $table_alias . "_currency_id'";
459
+                    $query['select'][$table_alias.'_currency_id'] = $table_alias.'_cstm'.".currency_id AS '".$table_alias."_currency_id'";
460 460
                 } else {
461
-                    $query_array['select'][$table_alias . '_currency_id'] = $table_alias . ".currency_id AS '" . $table_alias . "_currency_id'";
461
+                    $query_array['select'][$table_alias.'_currency_id'] = $table_alias.".currency_id AS '".$table_alias."_currency_id'";
462 462
                 }
463 463
             }
464 464
 
465 465
             if ((isset($data['source']) && $data['source'] == 'custom_fields')) {
466
-                $select_field = $this->db->quoteIdentifier($table_alias . '_cstm') . '.' . $field->field;
466
+                $select_field = $this->db->quoteIdentifier($table_alias.'_cstm').'.'.$field->field;
467 467
                 // Fix for #1251 - added a missing parameter to the function call
468
-                $query_array = $this->build_report_query_join($table_alias . '_cstm', $table_alias . '_cstm',
468
+                $query_array = $this->build_report_query_join($table_alias.'_cstm', $table_alias.'_cstm',
469 469
                     $table_alias, $field_module, 'custom', $query);
470 470
             } else {
471
-                $select_field = $this->db->quoteIdentifier($table_alias) . '.' . $field->field;
471
+                $select_field = $this->db->quoteIdentifier($table_alias).'.'.$field->field;
472 472
             }
473 473
 
474 474
             if ($field->sort_by != '') {
475
-                $query_array['sort_by'][] = $field_label . ' ' . $field->sort_by;
475
+                $query_array['sort_by'][] = $field_label.' '.$field->sort_by;
476 476
             }
477 477
 
478 478
             if ($field->format && in_array($data['type'], array('date', 'datetime', 'datetimecombo'))) {
@@ -484,35 +484,35 @@  discard block
 block discarded – undo
484 484
             }
485 485
 
486 486
             if ($field->field_function != null) {
487
-                $select_field = $field->field_function . '(' . $select_field . ')';
487
+                $select_field = $field->field_function.'('.$select_field.')';
488 488
             }
489 489
 
490 490
             if ($field->group_by == 1) {
491 491
                 $query_array['group_by'][] = $select_field;
492 492
             }
493 493
 
494
-            $query_array['select'][] = $select_field . " AS '" . $field_label . "'";
494
+            $query_array['select'][] = $select_field." AS '".$field_label."'";
495 495
             if (isset($extra['select']) && $extra['select']) {
496 496
                 foreach ($extra['select'] as $selectField => $selectAlias) {
497 497
                     if ($selectAlias) {
498
-                        $query_array['select'][] = $selectField . " AS " . $selectAlias;
498
+                        $query_array['select'][] = $selectField." AS ".$selectAlias;
499 499
                     } else {
500 500
                         $query_array['select'][] = $selectField;
501 501
                     }
502 502
                 }
503 503
             }
504
-            $query_array['where'][] = $select_field . " IS NOT NULL AND ";
504
+            $query_array['where'][] = $select_field." IS NOT NULL AND ";
505 505
             if (isset($extra['where']) && $extra['where']) {
506
-                $query_array['where'][] = implode(' AND ', $extra['where']) . ' AND ';
506
+                $query_array['where'][] = implode(' AND ', $extra['where']).' AND ';
507 507
             }
508 508
 
509 509
             $query_array = $this->build_report_query_where($query_array);
510 510
 
511 511
             foreach ($query_array['select'] as $select) {
512
-                $query .= ($query == '' ? 'SELECT ' : ', ') . $select;
512
+                $query .= ($query == '' ? 'SELECT ' : ', ').$select;
513 513
             }
514 514
 
515
-            $query .= ' FROM ' . $module->table_name . ' ';
515
+            $query .= ' FROM '.$module->table_name.' ';
516 516
 
517 517
             if (isset($query_array['join'])) {
518 518
                 foreach ($query_array['join'] as $join) {
@@ -522,28 +522,28 @@  discard block
 block discarded – undo
522 522
             if (isset($query_array['where'])) {
523 523
                 $query_where = '';
524 524
                 foreach ($query_array['where'] as $where) {
525
-                    $query_where .= ($query_where == '' ? 'WHERE ' : ' ') . $where;
525
+                    $query_where .= ($query_where == '' ? 'WHERE ' : ' ').$where;
526 526
                 }
527 527
 
528 528
                 $query_where = $this->queryWhereRepair($query_where);
529 529
 
530
-                $query .= ' ' . $query_where;
530
+                $query .= ' '.$query_where;
531 531
             }
532 532
 
533 533
             if (isset($query_array['group_by'])) {
534 534
                 $query_group_by = '';
535 535
                 foreach ($query_array['group_by'] as $group_by) {
536
-                    $query_group_by .= ($query_group_by == '' ? 'GROUP BY ' : ', ') . $group_by;
536
+                    $query_group_by .= ($query_group_by == '' ? 'GROUP BY ' : ', ').$group_by;
537 537
                 }
538
-                $query .= ' ' . $query_group_by;
538
+                $query .= ' '.$query_group_by;
539 539
             }
540 540
 
541 541
             if (isset($query_array['sort_by'])) {
542 542
                 $query_sort_by = '';
543 543
                 foreach ($query_array['sort_by'] as $sort_by) {
544
-                    $query_sort_by .= ($query_sort_by == '' ? 'ORDER BY ' : ', ') . $sort_by;
544
+                    $query_sort_by .= ($query_sort_by == '' ? 'ORDER BY ' : ', ').$sort_by;
545 545
                 }
546
-                $query .= ' ' . $query_sort_by;
546
+                $query .= ' '.$query_sort_by;
547 547
             }
548 548
             $result = $this->db->query($query);
549 549
 
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 
585 585
         $total_rows = 0;
586 586
         $count_sql = explode('ORDER BY', $report_sql);
587
-        $count_query = 'SELECT count(*) c FROM (' . $count_sql[0] . ') as n';
587
+        $count_query = 'SELECT count(*) c FROM ('.$count_sql[0].') as n';
588 588
 
589 589
         // We have a count query.  Run it and get the results.
590 590
         $result = $this->db->query($count_query);
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
             $total_rows = $assoc['c'];
594 594
         }
595 595
 
596
-        $html = "<table class='list aor_reports' id='report_table_" . $tableIdentifier . "' width='100%' cellspacing='0' cellpadding='0' border='0' repeat_header='1'>";
596
+        $html = "<table class='list aor_reports' id='report_table_".$tableIdentifier."' width='100%' cellspacing='0' cellpadding='0' border='0' repeat_header='1'>";
597 597
 
598 598
         if ($offset >= 0) {
599 599
             $start = 0;
@@ -627,33 +627,33 @@  discard block
 block discarded – undo
627 627
 
628 628
             if ($offset == 0) {
629 629
                 $html .= "<button type='button' id='listViewStartButton_top' name='listViewStartButton' title='Start' class='button' disabled='disabled'>
630
-                    <img src='" . SugarThemeRegistry::current()->getImageURL('start_off.gif') . "' alt='Start' align='absmiddle' border='0'>
630
+                    <img src='" . SugarThemeRegistry::current()->getImageURL('start_off.gif')."' alt='Start' align='absmiddle' border='0'>
631 631
                 </button>
632 632
                 <button type='button' id='listViewPrevButton_top' name='listViewPrevButton' class='button' title='Previous' disabled='disabled'>
633
-                    <img src='" . SugarThemeRegistry::current()->getImageURL('previous_off.gif') . "' alt='Previous' align='absmiddle' border='0'>
633
+                    <img src='" . SugarThemeRegistry::current()->getImageURL('previous_off.gif')."' alt='Previous' align='absmiddle' border='0'>
634 634
                 </button>";
635 635
             } else {
636
-                $html .= "<button type='button' id='listViewStartButton_top' name='listViewStartButton' title='Start' class='button' onclick='changeReportPage(\"" . $this->id . "\",0,\"" . $group_value . "\",\"" . $tableIdentifier . "\")'>
637
-                    <img src='" . SugarThemeRegistry::current()->getImageURL('start.gif') . "' alt='Start' align='absmiddle' border='0'>
636
+                $html .= "<button type='button' id='listViewStartButton_top' name='listViewStartButton' title='Start' class='button' onclick='changeReportPage(\"".$this->id."\",0,\"".$group_value."\",\"".$tableIdentifier."\")'>
637
+                    <img src='" . SugarThemeRegistry::current()->getImageURL('start.gif')."' alt='Start' align='absmiddle' border='0'>
638 638
                 </button>
639
-                <button type='button' id='listViewPrevButton_top' name='listViewPrevButton' class='button' title='Previous' onclick='changeReportPage(\"" . $this->id . "\"," . $previous_offset . ",\"" . $group_value . "\",\"" . $tableIdentifier . "\")'>
640
-                    <img src='" . SugarThemeRegistry::current()->getImageURL('previous.gif') . "' alt='Previous' align='absmiddle' border='0'>
639
+                <button type='button' id='listViewPrevButton_top' name='listViewPrevButton' class='button' title='Previous' onclick='changeReportPage(\"" . $this->id."\",".$previous_offset.",\"".$group_value."\",\"".$tableIdentifier."\")'>
640
+                    <img src='" . SugarThemeRegistry::current()->getImageURL('previous.gif')."' alt='Previous' align='absmiddle' border='0'>
641 641
                 </button>";
642 642
             }
643
-            $html .= " <span class='pageNumbers'>(" . $start . " - " . $end . " of " . $total_rows . ")</span>";
643
+            $html .= " <span class='pageNumbers'>(".$start." - ".$end." of ".$total_rows.")</span>";
644 644
             if ($next_offset < $total_rows) {
645
-                $html .= "<button type='button' id='listViewNextButton_top' name='listViewNextButton' title='Next' class='button' onclick='changeReportPage(\"" . $this->id . "\"," . $next_offset . ",\"" . $group_value . "\",\"" . $tableIdentifier . "\")'>
646
-                        <img src='" . SugarThemeRegistry::current()->getImageURL('next.gif') . "' alt='Next' align='absmiddle' border='0'>
645
+                $html .= "<button type='button' id='listViewNextButton_top' name='listViewNextButton' title='Next' class='button' onclick='changeReportPage(\"".$this->id."\",".$next_offset.",\"".$group_value."\",\"".$tableIdentifier."\")'>
646
+                        <img src='" . SugarThemeRegistry::current()->getImageURL('next.gif')."' alt='Next' align='absmiddle' border='0'>
647 647
                     </button>
648
-                     <button type='button' id='listViewEndButton_top' name='listViewEndButton' title='End' class='button' onclick='changeReportPage(\"" . $this->id . "\"," . $last_offset . ",\"" . $group_value . "\",\"" . $tableIdentifier . "\")'>
649
-                        <img src='" . SugarThemeRegistry::current()->getImageURL('end.gif') . "' alt='End' align='absmiddle' border='0'>
648
+                     <button type='button' id='listViewEndButton_top' name='listViewEndButton' title='End' class='button' onclick='changeReportPage(\"" . $this->id."\",".$last_offset.",\"".$group_value."\",\"".$tableIdentifier."\")'>
649
+                        <img src='" . SugarThemeRegistry::current()->getImageURL('end.gif')."' alt='End' align='absmiddle' border='0'>
650 650
                     </button>";
651 651
             } else {
652 652
                 $html .= "<button type='button' id='listViewNextButton_top' name='listViewNextButton' title='Next' class='button'  disabled='disabled'>
653
-                        <img src='" . SugarThemeRegistry::current()->getImageURL('next_off.gif') . "' alt='Next' align='absmiddle' border='0'>
653
+                        <img src='" . SugarThemeRegistry::current()->getImageURL('next_off.gif')."' alt='Next' align='absmiddle' border='0'>
654 654
                     </button>
655 655
                      <button type='button' id='listViewEndButton_top$dashletPaginationButtons' name='listViewEndButton' title='End' class='button'  disabled='disabled'>
656
-                        <img src='" . SugarThemeRegistry::current()->getImageURL('end_off.gif') . "' alt='End' align='absmiddle' border='0'>
656
+                        <img src='".SugarThemeRegistry::current()->getImageURL('end_off.gif')."' alt='End' align='absmiddle' border='0'>
657 657
                     </button>";
658 658
 
659 659
             }
@@ -667,10 +667,10 @@  discard block
 block discarded – undo
667 667
 
668 668
             $moduleFieldByGroupValue = $this->getModuleFieldByGroupValue($beanList, $group_value);
669 669
 
670
-            $html = "<H3>$moduleFieldByGroupValue</H3>" . $html;
670
+            $html = "<H3>$moduleFieldByGroupValue</H3>".$html;
671 671
         }
672 672
 
673
-        $sql = "SELECT id FROM aor_fields WHERE aor_report_id = '" . $this->id . "' AND deleted = 0 ORDER BY field_order ASC";
673
+        $sql = "SELECT id FROM aor_fields WHERE aor_report_id = '".$this->id."' AND deleted = 0 ORDER BY field_order ASC";
674 674
         $result = $this->db->query($sql);
675 675
 
676 676
         $html .= "<thead>";
@@ -695,10 +695,10 @@  discard block
 block discarded – undo
695 695
                         continue;
696 696
                     }
697 697
                     $field_module = getRelatedModule($field_module, $rel);
698
-                    $field_alias = $field_alias . ':' . $rel;
698
+                    $field_alias = $field_alias.':'.$rel;
699 699
                 }
700 700
             }
701
-            $label = str_replace(' ', '_', $field->label) . $i;
701
+            $label = str_replace(' ', '_', $field->label).$i;
702 702
             $fields[$label]['field'] = $field->field;
703 703
             $fields[$label]['label'] = $field->label;
704 704
             $fields[$label]['display'] = $field->display;
@@ -735,16 +735,16 @@  discard block
 block discarded – undo
735 735
 
736 736
         $totals = array();
737 737
         while ($row = $this->db->fetchByAssoc($result)) {
738
-            $html .= "<tr class='" . $row_class . "' height='20'>";
738
+            $html .= "<tr class='".$row_class."' height='20'>";
739 739
 
740 740
             foreach ($fields as $name => $att) {
741 741
                 if ($att['display']) {
742 742
                     $html .= "<td class='' valign='top' align='left'>";
743 743
                     if ($att['link'] && $links) {
744
-                        $html .= "<a href='" . $sugar_config['site_url'] . "/index.php?module=" . $att['module'] . "&action=DetailView&record=" . $row[$att['alias'] . '_id'] . "'>";
744
+                        $html .= "<a href='".$sugar_config['site_url']."/index.php?module=".$att['module']."&action=DetailView&record=".$row[$att['alias'].'_id']."'>";
745 745
                     }
746 746
 
747
-                    $currency_id = isset($row[$att['alias'] . '_currency_id']) ? $row[$att['alias'] . '_currency_id'] : '';
747
+                    $currency_id = isset($row[$att['alias'].'_currency_id']) ? $row[$att['alias'].'_currency_id'] : '';
748 748
 
749 749
                     if ($att['function'] == 'COUNT' || !empty($att['params'])) {
750 750
                         $html .= $row[$name];
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
     {
800 800
         $moduleFieldByGroupValues = array();
801 801
 
802
-        $sql = "SELECT id FROM aor_fields WHERE aor_report_id = '" . $this->id . "' AND group_display = 1 AND deleted = 0 ORDER BY field_order ASC";
802
+        $sql = "SELECT id FROM aor_fields WHERE aor_report_id = '".$this->id."' AND group_display = 1 AND deleted = 0 ORDER BY field_order ASC";
803 803
         $result = $this->db->limitQuery($sql, 0, 1);
804 804
         while ($row = $this->db->fetchByAssoc($result)) {
805 805
 
@@ -823,11 +823,11 @@  discard block
 block discarded – undo
823 823
                         continue;
824 824
                     }
825 825
                     $field_module = getRelatedModule($field_module, $rel);
826
-                    $field_alias = $field_alias . ':' . $rel;
826
+                    $field_alias = $field_alias.':'.$rel;
827 827
                 }
828 828
             }
829 829
 
830
-            $currency_id = isset($row[$field_alias . '_currency_id']) ? $row[$field_alias . '_currency_id'] : '';
830
+            $currency_id = isset($row[$field_alias.'_currency_id']) ? $row[$field_alias.'_currency_id'] : '';
831 831
             $moduleFieldByGroupValues[] = getModuleField($this->report_module, $field->field, $field->field,
832 832
                 'DetailView', $group_value, '', $currency_id);
833 833
 
@@ -853,7 +853,7 @@  discard block
 block discarded – undo
853 853
                 continue;
854 854
             }
855 855
             if ($field['total']) {
856
-                $totalLabel = $field['label'] . " " . $app_list_strings['aor_total_options'][$field['total']];
856
+                $totalLabel = $field['label']." ".$app_list_strings['aor_total_options'][$field['total']];
857 857
                 $html .= "<th>{$totalLabel}</th>";
858 858
             } else {
859 859
                 $html .= "<th></th>";
@@ -879,9 +879,9 @@  discard block
 block discarded – undo
879 879
                             case 'SUM':
880 880
                             case 'AVG':
881 881
                                 if ($currency->id == -99) {
882
-                                    $total = $currency->symbol . format_number($total, null, null);
882
+                                    $total = $currency->symbol.format_number($total, null, null);
883 883
                                 } else {
884
-                                    $total = $currency->symbol . format_number($total, null, null,
884
+                                    $total = $currency->symbol.format_number($total, null, null,
885 885
                                             array('convert' => true));
886 886
                                 }
887 887
                                 break;
@@ -893,7 +893,7 @@  discard block
 block discarded – undo
893 893
                     default:
894 894
                         break;
895 895
                 }
896
-                $html .= "<td>" . $total . "</td>";
896
+                $html .= "<td>".$total."</td>";
897 897
             } else {
898 898
                 $html .= "<td></td>";
899 899
             }
@@ -920,7 +920,7 @@  discard block
 block discarded – undo
920 920
 
921 921
     private function encloseForCSV($field)
922 922
     {
923
-        return '"' . $field . '"';
923
+        return '"'.$field.'"';
924 924
     }
925 925
 
926 926
     function build_report_csv()
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
         $csv = '';
936 936
         //text/comma-separated-values
937 937
 
938
-        $sql = "SELECT id FROM aor_fields WHERE aor_report_id = '" . $this->id . "' AND deleted = 0 ORDER BY field_order ASC";
938
+        $sql = "SELECT id FROM aor_fields WHERE aor_report_id = '".$this->id."' AND deleted = 0 ORDER BY field_order ASC";
939 939
         $result = $this->db->query($sql);
940 940
 
941 941
         $fields = array();
@@ -956,10 +956,10 @@  discard block
 block discarded – undo
956 956
                         continue;
957 957
                     }
958 958
                     $field_module = getRelatedModule($field_module, $rel);
959
-                    $field_alias = $field_alias . ':' . $rel;
959
+                    $field_alias = $field_alias.':'.$rel;
960 960
                 }
961 961
             }
962
-            $label = str_replace(' ', '_', $field->label) . $i;
962
+            $label = str_replace(' ', '_', $field->label).$i;
963 963
             $fields[$label]['field'] = $field->field;
964 964
             $fields[$label]['display'] = $field->display;
965 965
             $fields[$label]['function'] = $field->field_function;
@@ -980,7 +980,7 @@  discard block
 block discarded – undo
980 980
         while ($row = $this->db->fetchByAssoc($result)) {
981 981
             $csv .= "\r\n";
982 982
             foreach ($fields as $name => $att) {
983
-                $currency_id = isset($row[$att['alias'] . '_currency_id']) ? $row[$att['alias'] . '_currency_id'] : '';
983
+                $currency_id = isset($row[$att['alias'].'_currency_id']) ? $row[$att['alias'].'_currency_id'] : '';
984 984
                 if ($att['display']) {
985 985
                     if ($att['function'] != '' || $att['params'] != '') {
986 986
                         $csv .= $this->encloseForCSV($row[$name]);
@@ -997,15 +997,15 @@  discard block
 block discarded – undo
997 997
 
998 998
         ob_clean();
999 999
         header("Pragma: cache");
1000
-        header("Content-type: text/comma-separated-values; charset=" . $GLOBALS['locale']->getExportCharset());
1000
+        header("Content-type: text/comma-separated-values; charset=".$GLOBALS['locale']->getExportCharset());
1001 1001
         header("Content-Disposition: attachment; filename=\"{$this->name}.csv\"");
1002 1002
         header("Content-transfer-encoding: binary");
1003 1003
         header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
1004
-        header("Last-Modified: " . TimeDate::httpTime());
1004
+        header("Last-Modified: ".TimeDate::httpTime());
1005 1005
         header("Cache-Control: post-check=0, pre-check=0", false);
1006
-        header("Content-Length: " . mb_strlen($csv, '8bit'));
1006
+        header("Content-Length: ".mb_strlen($csv, '8bit'));
1007 1007
         if (!empty($sugar_config['export_excel_compatible'])) {
1008
-            $csv = chr(255) . chr(254) . mb_convert_encoding($csv, 'UTF-16LE', 'UTF-8');
1008
+            $csv = chr(255).chr(254).mb_convert_encoding($csv, 'UTF-16LE', 'UTF-8');
1009 1009
         }
1010 1010
         print $csv;
1011 1011
 
@@ -1029,21 +1029,21 @@  discard block
 block discarded – undo
1029 1029
 
1030 1030
         $query_array = $this->build_report_query_select($query_array, $group_value);
1031 1031
         if (isset($extra['where']) && $extra['where']) {
1032
-            $query_array['where'][] = implode(' AND ', $extra['where']) . ' AND ';
1032
+            $query_array['where'][] = implode(' AND ', $extra['where']).' AND ';
1033 1033
         }
1034 1034
         $query_array = $this->build_report_query_where($query_array);
1035 1035
 
1036 1036
         foreach ($query_array['select'] as $select) {
1037
-            $query .= ($query == '' ? 'SELECT ' : ', ') . $select;
1037
+            $query .= ($query == '' ? 'SELECT ' : ', ').$select;
1038 1038
         }
1039 1039
 
1040 1040
         if (empty($query_array['group_by'])) {
1041 1041
             foreach ($query_array['id_select'] as $select) {
1042
-                $query .= ', ' . $select;
1042
+                $query .= ', '.$select;
1043 1043
             }
1044 1044
         }
1045 1045
 
1046
-        $query .= ' FROM ' . $this->db->quoteIdentifier($module->table_name) . ' ';
1046
+        $query .= ' FROM '.$this->db->quoteIdentifier($module->table_name).' ';
1047 1047
 
1048 1048
         if (isset($query_array['join'])) {
1049 1049
             foreach ($query_array['join'] as $join) {
@@ -1053,33 +1053,33 @@  discard block
 block discarded – undo
1053 1053
         if (isset($query_array['where'])) {
1054 1054
             $query_where = '';
1055 1055
             foreach ($query_array['where'] as $where) {
1056
-                $query_where .= ($query_where == '' ? 'WHERE ' : ' ') . $where;
1056
+                $query_where .= ($query_where == '' ? 'WHERE ' : ' ').$where;
1057 1057
             }
1058 1058
 
1059 1059
             $query_where = $this->queryWhereRepair($query_where);
1060 1060
 
1061
-            $query .= ' ' . $query_where;
1061
+            $query .= ' '.$query_where;
1062 1062
         }
1063 1063
 
1064 1064
         if (isset($query_array['group_by'])) {
1065 1065
             $query_group_by = '';
1066 1066
             foreach ($query_array['group_by'] as $group_by) {
1067
-                $query_group_by .= ($query_group_by == '' ? 'GROUP BY ' : ', ') . $group_by;
1067
+                $query_group_by .= ($query_group_by == '' ? 'GROUP BY ' : ', ').$group_by;
1068 1068
             }
1069 1069
             if (isset($query_array['second_group_by']) && $query_group_by != '') {
1070 1070
                 foreach ($query_array['second_group_by'] as $group_by) {
1071
-                    $query_group_by .= ', ' . $group_by;
1071
+                    $query_group_by .= ', '.$group_by;
1072 1072
                 }
1073 1073
             }
1074
-            $query .= ' ' . $query_group_by;
1074
+            $query .= ' '.$query_group_by;
1075 1075
         }
1076 1076
 
1077 1077
         if (isset($query_array['sort_by'])) {
1078 1078
             $query_sort_by = '';
1079 1079
             foreach ($query_array['sort_by'] as $sort_by) {
1080
-                $query_sort_by .= ($query_sort_by == '' ? 'ORDER BY ' : ', ') . $sort_by;
1080
+                $query_sort_by .= ($query_sort_by == '' ? 'ORDER BY ' : ', ').$sort_by;
1081 1081
             }
1082
-            $query .= ' ' . $query_sort_by;
1082
+            $query .= ' '.$query_sort_by;
1083 1083
         }
1084 1084
 
1085 1085
         return $query;
@@ -1113,10 +1113,10 @@  discard block
 block discarded – undo
1113 1113
         if ($beanList[$this->report_module]) {
1114 1114
             $module = new $beanList[$this->report_module]();
1115 1115
 
1116
-            $query['id_select'][$module->table_name] = $this->db->quoteIdentifier($module->table_name) . ".id AS '" . $module->table_name . "_id'";
1117
-            $query['id_select_group'][$module->table_name] = $this->db->quoteIdentifier($module->table_name) . ".id";
1116
+            $query['id_select'][$module->table_name] = $this->db->quoteIdentifier($module->table_name).".id AS '".$module->table_name."_id'";
1117
+            $query['id_select_group'][$module->table_name] = $this->db->quoteIdentifier($module->table_name).".id";
1118 1118
 
1119
-            $sql = "SELECT id FROM aor_fields WHERE aor_report_id = '" . $this->id . "' AND deleted = 0 ORDER BY field_order ASC";
1119
+            $sql = "SELECT id FROM aor_fields WHERE aor_report_id = '".$this->id."' AND deleted = 0 ORDER BY field_order ASC";
1120 1120
 
1121 1121
             $result = $this->db->query($sql);
1122 1122
             $i = 0;
@@ -1125,7 +1125,7 @@  discard block
 block discarded – undo
1125 1125
                 $field = new AOR_Field();
1126 1126
                 $field->retrieve($row['id']);
1127 1127
 
1128
-                $field->label = str_replace(' ', '_', $field->label) . $i;
1128
+                $field->label = str_replace(' ', '_', $field->label).$i;
1129 1129
 
1130 1130
                 $path = unserialize(base64_decode($field->module_path));
1131 1131
 
@@ -1136,7 +1136,7 @@  discard block
 block discarded – undo
1136 1136
                     foreach ($path as $rel) {
1137 1137
                         $new_field_module = new $beanList[getRelatedModule($field_module->module_dir, $rel)];
1138 1138
                         $oldAlias = $table_alias;
1139
-                        $table_alias = $table_alias . ":" . $rel;
1139
+                        $table_alias = $table_alias.":".$rel;
1140 1140
                         $query =
1141 1141
                             $this->build_report_query_join(
1142 1142
                                 $rel,
@@ -1173,20 +1173,20 @@  discard block
 block discarded – undo
1173 1173
 
1174 1174
                 if ($data['type'] == 'currency' && isset($field_module->field_defs['currency_id'])) {
1175 1175
                     if ((isset($field_module->field_defs['currency_id']['source']) && $field_module->field_defs['currency_id']['source'] == 'custom_fields')) {
1176
-                        $query['select'][$table_alias . '_currency_id'] = $this->db->quoteIdentifier($table_alias . '_cstm') . ".currency_id AS '" . $table_alias . "_currency_id'";
1177
-                        $query['second_group_by'][] = $this->db->quoteIdentifier($table_alias . '_cstm') . ".currency_id";
1176
+                        $query['select'][$table_alias.'_currency_id'] = $this->db->quoteIdentifier($table_alias.'_cstm').".currency_id AS '".$table_alias."_currency_id'";
1177
+                        $query['second_group_by'][] = $this->db->quoteIdentifier($table_alias.'_cstm').".currency_id";
1178 1178
                     } else {
1179
-                        $query['select'][$table_alias . '_currency_id'] = $this->db->quoteIdentifier($table_alias) . ".currency_id AS '" . $table_alias . "_currency_id'";
1180
-                        $query['second_group_by'][] = $this->db->quoteIdentifier($table_alias) . ".currency_id";
1179
+                        $query['select'][$table_alias.'_currency_id'] = $this->db->quoteIdentifier($table_alias).".currency_id AS '".$table_alias."_currency_id'";
1180
+                        $query['second_group_by'][] = $this->db->quoteIdentifier($table_alias).".currency_id";
1181 1181
                     }
1182 1182
                 }
1183 1183
 
1184 1184
                 if ((isset($data['source']) && $data['source'] == 'custom_fields')) {
1185
-                    $select_field = $this->db->quoteIdentifier($table_alias . '_cstm') . '.' . $field->field;
1186
-                    $query = $this->build_report_query_join($table_alias . '_cstm', $table_alias . '_cstm',
1185
+                    $select_field = $this->db->quoteIdentifier($table_alias.'_cstm').'.'.$field->field;
1186
+                    $query = $this->build_report_query_join($table_alias.'_cstm', $table_alias.'_cstm',
1187 1187
                         $table_alias, $field_module, 'custom', $query);
1188 1188
                 } else {
1189
-                    $select_field = $this->db->quoteIdentifier($table_alias) . '.' . $field->field;
1189
+                    $select_field = $this->db->quoteIdentifier($table_alias).'.'.$field->field;
1190 1190
                 }
1191 1191
 
1192 1192
                 if ($field->format && in_array($data['type'], array('date', 'datetime', 'datetimecombo'))) {
@@ -1206,19 +1206,19 @@  discard block
 block discarded – undo
1206 1206
                 if ($field->group_by == 1) {
1207 1207
                     $query['group_by'][] = $select_field;
1208 1208
                 } elseif ($field->field_function != null) {
1209
-                    $select_field = $field->field_function . '(' . $select_field . ')';
1209
+                    $select_field = $field->field_function.'('.$select_field.')';
1210 1210
                 } else {
1211 1211
                     $query['second_group_by'][] = $select_field;
1212 1212
                 }
1213 1213
 
1214 1214
                 if ($field->sort_by != '') {
1215
-                    $query['sort_by'][] = $select_field . " " . $field->sort_by;
1215
+                    $query['sort_by'][] = $select_field." ".$field->sort_by;
1216 1216
                 }
1217 1217
 
1218
-                $query['select'][] = $select_field . " AS '" . $field->label . "'";
1218
+                $query['select'][] = $select_field." AS '".$field->label."'";
1219 1219
 
1220 1220
                 if ($field->group_display == 1 && $group_value) {
1221
-                    $query['where'][] = $select_field . " = '" . $group_value . "' AND ";
1221
+                    $query['where'][] = $select_field." = '".$group_value."' AND ";
1222 1222
                 }
1223 1223
 
1224 1224
                 ++$i;
@@ -1245,10 +1245,10 @@  discard block
 block discarded – undo
1245 1245
                 case 'custom':
1246 1246
                     $customTable = $module->get_custom_table_name();
1247 1247
                     $query['join'][$alias] =
1248
-                        'LEFT JOIN ' .
1249
-                        $db->quoteIdentifier($customTable) .' '. $db->quoteIdentifier($alias) .
1250
-                        ' ON ' .
1251
-                        $db->quoteIdentifier($parentAlias) . '.id = ' . $db->quoteIdentifier($name) . '.id_c ';
1248
+                        'LEFT JOIN '.
1249
+                        $db->quoteIdentifier($customTable).' '.$db->quoteIdentifier($alias).
1250
+                        ' ON '.
1251
+                        $db->quoteIdentifier($parentAlias).'.id = '.$db->quoteIdentifier($name).'.id_c ';
1252 1252
                     break;
1253 1253
 
1254 1254
                 case 'relationship':
@@ -1270,7 +1270,7 @@  discard block
 block discarded – undo
1270 1270
                             $params['join_table_alias'] = $db->quoteIdentifier($alias);
1271 1271
                             $params['left_join_table_alias'] = $db->quoteIdentifier($parentAlias);
1272 1272
                         }
1273
-                        $linkAlias = $parentAlias . "|" . $alias;
1273
+                        $linkAlias = $parentAlias."|".$alias;
1274 1274
                         $params['join_table_link_alias'] = $db->quoteIdentifier($linkAlias);
1275 1275
                         $join = $module->$name->getJoin($params, true);
1276 1276
                         $query['join'][$alias] = $join['join'];
@@ -1278,7 +1278,7 @@  discard block
 block discarded – undo
1278 1278
                             $query['join'][$alias] .= $this->build_report_access_query($rel_module,
1279 1279
                                 $db->quoteIdentifier($alias));
1280 1280
                         }
1281
-                        $query['id_select'][$alias] = $join['select'] . " AS '" . $alias . "_id'";
1281
+                        $query['id_select'][$alias] = $join['select']." AS '".$alias."_id'";
1282 1282
                         $query['id_select_group'][$alias] = $join['select'];
1283 1283
                     }
1284 1284
                     break;
@@ -1299,7 +1299,7 @@  discard block
 block discarded – undo
1299 1299
         if ($module->bean_implements('ACL') && ACLController::requireOwner($module->module_dir, 'list')) {
1300 1300
             global $current_user;
1301 1301
             $owner_where = $module->getOwnerWhere($current_user->id);
1302
-            $where = ' AND ' . $owner_where;
1302
+            $where = ' AND '.$owner_where;
1303 1303
 
1304 1304
         }
1305 1305
 
@@ -1311,9 +1311,9 @@  discard block
 block discarded – undo
1311 1311
                 $owner_where = $module->getOwnerWhere($current_user->id);
1312 1312
                 $group_where = SecurityGroup::getGroupWhere($alias, $module->module_dir, $current_user->id);
1313 1313
                 if (!empty($owner_where)) {
1314
-                    $where .= " AND (" . $owner_where . " or " . $group_where . ") ";
1314
+                    $where .= " AND (".$owner_where." or ".$group_where.") ";
1315 1315
                 } else {
1316
-                    $where .= ' AND ' . $group_where;
1316
+                    $where .= ' AND '.$group_where;
1317 1317
                 }
1318 1318
             }
1319 1319
             /* END - SECURITY GROUPS */
@@ -1349,7 +1349,7 @@  discard block
 block discarded – undo
1349 1349
         if ($beanList[$this->report_module]) {
1350 1350
             $module = new $beanList[$this->report_module]();
1351 1351
 
1352
-            $sql = "SELECT id FROM aor_conditions WHERE aor_report_id = '" . $this->id . "' AND deleted = 0 ORDER BY condition_order ASC";
1352
+            $sql = "SELECT id FROM aor_conditions WHERE aor_report_id = '".$this->id."' AND deleted = 0 ORDER BY condition_order ASC";
1353 1353
             $result = $this->db->query($sql);
1354 1354
 
1355 1355
             $tiltLogicOp = true;
@@ -1375,7 +1375,7 @@  discard block
 block discarded – undo
1375 1375
                             return false;
1376 1376
                         }
1377 1377
                         $oldAlias = $table_alias;
1378
-                        $table_alias = $table_alias . ":" . $rel;
1378
+                        $table_alias = $table_alias.":".$rel;
1379 1379
                         $query = $this->build_report_query_join($rel, $table_alias, $oldAlias, $condition_module,
1380 1380
                             'relationship', $query, $new_condition_module);
1381 1381
                         $condition_module = $new_condition_module;
@@ -1406,16 +1406,16 @@  discard block
 block discarded – undo
1406 1406
 
1407 1407
                         // Debugging: security groups conditions - It's a hack to just get the query working
1408 1408
                         if ($condition_module->module_dir = 'SecurityGroups' && count($path) > 1) {
1409
-                            $table_alias = $oldAlias . ':' . $rel;
1409
+                            $table_alias = $oldAlias.':'.$rel;
1410 1410
                         }
1411 1411
                         $condition->field = 'id';
1412 1412
                     }
1413 1413
                     if ((isset($data['source']) && $data['source'] == 'custom_fields')) {
1414
-                        $field = $this->db->quoteIdentifier($table_alias . '_cstm') . '.' . $condition->field;
1415
-                        $query = $this->build_report_query_join($table_alias . '_cstm', $table_alias . '_cstm',
1414
+                        $field = $this->db->quoteIdentifier($table_alias.'_cstm').'.'.$condition->field;
1415
+                        $query = $this->build_report_query_join($table_alias.'_cstm', $table_alias.'_cstm',
1416 1416
                             $table_alias, $condition_module, 'custom', $query);
1417 1417
                     } else {
1418
-                        $field = $this->db->quoteIdentifier($table_alias) . '.' . $condition->field;
1418
+                        $field = $this->db->quoteIdentifier($table_alias).'.'.$condition->field;
1419 1419
                     }
1420 1420
 
1421 1421
                     if (!empty($this->user_parameters[$condition->id]) && $condition->parameter) {
@@ -1451,11 +1451,11 @@  discard block
 block discarded – undo
1451 1451
                                 $condition->field = 'id';
1452 1452
                             }
1453 1453
                             if ((isset($data['source']) && $data['source'] == 'custom_fields')) {
1454
-                                $value = $condition_module->table_name . '_cstm.' . $condition->value;
1455
-                                $query = $this->build_report_query_join($condition_module->table_name . '_cstm',
1456
-                                    $table_alias . '_cstm', $table_alias, $condition_module, 'custom', $query);
1454
+                                $value = $condition_module->table_name.'_cstm.'.$condition->value;
1455
+                                $query = $this->build_report_query_join($condition_module->table_name.'_cstm',
1456
+                                    $table_alias.'_cstm', $table_alias, $condition_module, 'custom', $query);
1457 1457
                             } else {
1458
-                                $value = ($table_alias ? $this->db->quoteIdentifier($table_alias) : $condition_module->table_name) . '.' . $condition->value;
1458
+                                $value = ($table_alias ? $this->db->quoteIdentifier($table_alias) : $condition_module->table_name).'.'.$condition->value;
1459 1459
                             }
1460 1460
                             break;
1461 1461
 
@@ -1479,17 +1479,17 @@  discard block
 block discarded – undo
1479 1479
                                         //$field =
1480 1480
                                         $value = 'CAST(GETDATE() AS DATE)';
1481 1481
                                     } else {
1482
-                                        $field = 'DATE(' . $field . ')';
1482
+                                        $field = 'DATE('.$field.')';
1483 1483
                                         $value = 'Curdate()';
1484 1484
                                     }
1485 1485
                                 } else {
1486 1486
                                     $data = $condition_module->field_defs[$params[0]];
1487 1487
                                     if ((isset($data['source']) && $data['source'] == 'custom_fields')) {
1488
-                                        $value = $condition_module->table_name . '_cstm.' . $params[0];
1489
-                                        $query = $this->build_report_query_join($condition_module->table_name . '_cstm',
1490
-                                            $table_alias . '_cstm', $table_alias, $condition_module, 'custom', $query);
1488
+                                        $value = $condition_module->table_name.'_cstm.'.$params[0];
1489
+                                        $query = $this->build_report_query_join($condition_module->table_name.'_cstm',
1490
+                                            $table_alias.'_cstm', $table_alias, $condition_module, 'custom', $query);
1491 1491
                                     } else {
1492
-                                        $value = $condition_module->table_name . '.' . $params[0];
1492
+                                        $value = $condition_module->table_name.'.'.$params[0];
1493 1493
                                     }
1494 1494
                                 }
1495 1495
                             }
@@ -1501,9 +1501,9 @@  discard block
 block discarded – undo
1501 1501
                                         $params[3] = 'hours';
1502 1502
                                     default:
1503 1503
                                         if ($sugar_config['dbconfig']['db_type'] == 'mssql') {
1504
-                                            $value = "DATEADD(" . $params[3] . ",  " . $app_list_strings['aor_date_operator'][$params[1]] . " $params[2], $value)";
1504
+                                            $value = "DATEADD(".$params[3].",  ".$app_list_strings['aor_date_operator'][$params[1]]." $params[2], $value)";
1505 1505
                                         } else {
1506
-                                            $value = "DATE_ADD($value, INTERVAL " . $app_list_strings['aor_date_operator'][$params[1]] . " $params[2] " . $params[3] . ")";
1506
+                                            $value = "DATE_ADD($value, INTERVAL ".$app_list_strings['aor_date_operator'][$params[1]]." $params[2] ".$params[3].")";
1507 1507
                                         }
1508 1508
                                         break;
1509 1509
                                 }
@@ -1522,11 +1522,11 @@  discard block
 block discarded – undo
1522 1522
                                     if ($value != '(') {
1523 1523
                                         $value .= $sep;
1524 1524
                                     }
1525
-                                    $value .= $field . ' ' . $aor_sql_operator_list[$condition->operator] . " '" . $multi_value . "'";
1525
+                                    $value .= $field.' '.$aor_sql_operator_list[$condition->operator]." '".$multi_value."'";
1526 1526
                                 }
1527 1527
                                 $value .= ')';
1528 1528
                             }
1529
-                            $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op . ' ' : 'AND ')) . $value;
1529
+                            $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op.' ' : 'AND ')).$value;
1530 1530
                             $where_set = true;
1531 1531
                             break;
1532 1532
                         case "Period":
@@ -1535,11 +1535,11 @@  discard block
 block discarded – undo
1535 1535
                             } else {
1536 1536
                                 $params = base64_decode($condition->value);
1537 1537
                             }
1538
-                            $value = '"' . getPeriodDate($params)->format('Y-m-d H:i:s') . '"';
1538
+                            $value = '"'.getPeriodDate($params)->format('Y-m-d H:i:s').'"';
1539 1539
                             break;
1540 1540
                         case "CurrentUserID":
1541 1541
                             global $current_user;
1542
-                            $value = '"' . $current_user->id . '"';
1542
+                            $value = '"'.$current_user->id.'"';
1543 1543
                             break;
1544 1544
                         case 'Value':
1545 1545
                             $utc = new DateTimeZone("UTC");
@@ -1548,132 +1548,132 @@  discard block
 block discarded – undo
1548 1548
                             if ($condition->operator === 'Equal_To') {
1549 1549
                                 if ($dateTime !== false) {
1550 1550
                                     $day_ahead = $dateTime->modify('+1 day');
1551
-                                    $equal_query = "( $field  BETWEEN '" . $this->db->quote($condition->value) . "' AND '" . $this->db->quote($day_ahead->format('Y-m-d H:i:s')) . "' ) ";
1552
-                                    $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op . ' ' : 'AND ')) . $equal_query;
1551
+                                    $equal_query = "( $field  BETWEEN '".$this->db->quote($condition->value)."' AND '".$this->db->quote($day_ahead->format('Y-m-d H:i:s'))."' ) ";
1552
+                                    $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op.' ' : 'AND ')).$equal_query;
1553 1553
                                 } elseif ($dateTime === false && $data['type'] === 'datetime') { // check for incorrectly converted dateTime
1554 1554
                                         $dateTime = convertToDateTime($condition->value);
1555 1555
 
1556 1556
                                         $query_date = $dateTime->format('Y-m-d H:i:s');
1557
-                                        $equal_query = "( $field  BETWEEN '" . $this->db->quote($query_date);
1557
+                                        $equal_query = "( $field  BETWEEN '".$this->db->quote($query_date);
1558 1558
                                         $day_ahead = $dateTime->modify('+1 day');
1559
-                                        $equal_query .= "' AND '" . $this->db->quote($day_ahead->format('Y-m-d H:i:s')) . "' ) ";
1560
-                                        $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op . ' ' : 'AND ')) . $equal_query;
1559
+                                        $equal_query .= "' AND '".$this->db->quote($day_ahead->format('Y-m-d H:i:s'))."' ) ";
1560
+                                        $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op.' ' : 'AND ')).$equal_query;
1561 1561
                                     } else {
1562
-                                        $value = "'" . $this->db->quote($condition->value) . "'";
1562
+                                        $value = "'".$this->db->quote($condition->value)."'";
1563 1563
                                         break;
1564 1564
                                     }
1565 1565
                                 $where_set = true;
1566 1566
                             } elseif ($condition->operator === 'Not_Equal_To') {
1567 1567
                                     if ($dateTime !== false) {
1568 1568
                                         $day_ahead = $dateTime->modify('+1 day');
1569
-                                        $not_equal_query = "( $field NOT BETWEEN '" . $this->db->quote($condition->value) . "' AND '" . $this->db->quote($day_ahead->format('Y-m-d H:i:s')) . "' ) ";
1570
-                                        $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op . ' ' : 'AND ')) . $not_equal_query;
1569
+                                        $not_equal_query = "( $field NOT BETWEEN '".$this->db->quote($condition->value)."' AND '".$this->db->quote($day_ahead->format('Y-m-d H:i:s'))."' ) ";
1570
+                                        $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op.' ' : 'AND ')).$not_equal_query;
1571 1571
                                     } elseif ($dateTime === false && $data['type'] === 'datetime') { // check for incorrectly converted dateTime
1572 1572
                                             $dateTime = convertToDateTime($condition->value);
1573 1573
 
1574 1574
                                             $query_date = $dateTime->format('Y-m-d H:i:s');
1575
-                                            $not_equal_query = "( $field NOT BETWEEN '" . $this->db->quote($query_date);
1575
+                                            $not_equal_query = "( $field NOT BETWEEN '".$this->db->quote($query_date);
1576 1576
                                             $day_ahead = $dateTime->modify('+1 day');
1577
-                                            $not_equal_query .= "' AND '" . $this->db->quote($day_ahead->format('Y-m-d H:i:s')) . "' ) ";
1578
-                                            $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op . ' ' : 'AND ')) . $not_equal_query;
1577
+                                            $not_equal_query .= "' AND '".$this->db->quote($day_ahead->format('Y-m-d H:i:s'))."' ) ";
1578
+                                            $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op.' ' : 'AND ')).$not_equal_query;
1579 1579
                                         } else {
1580
-                                            $value = "'" . $this->db->quote($condition->value) . "'";
1580
+                                            $value = "'".$this->db->quote($condition->value)."'";
1581 1581
                                             break;
1582 1582
                                         }
1583 1583
                                     $where_set = true;
1584 1584
                                 } elseif ($condition->operator === 'Greater_Than') {
1585 1585
                                         if ($dateTime !== false) {
1586
-                                            $greater_than_query = "( $field > '" . $this->db->quote($condition->value) . "' ) ";
1587
-                                            $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op . ' ' : 'AND ')) . $greater_than_query;
1586
+                                            $greater_than_query = "( $field > '".$this->db->quote($condition->value)."' ) ";
1587
+                                            $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op.' ' : 'AND ')).$greater_than_query;
1588 1588
                                         } elseif ($dateTime === false && $data['type'] === 'datetime') { // check for incorrectly converted dateTime
1589 1589
                                                 $dateTime = convertToDateTime($condition->value);
1590 1590
 
1591 1591
                                                 $query_date = $dateTime->format('Y-m-d H:i:s');
1592
-                                                $greater_than_query = "( $field > '" . $this->db->quote($query_date) . "' ) ";
1593
-                                                $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op . ' ' : 'AND ')) . $greater_than_query;
1592
+                                                $greater_than_query = "( $field > '".$this->db->quote($query_date)."' ) ";
1593
+                                                $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op.' ' : 'AND ')).$greater_than_query;
1594 1594
                                             } else {
1595
-                                                $value = "'" . $this->db->quote($condition->value) . "'";
1595
+                                                $value = "'".$this->db->quote($condition->value)."'";
1596 1596
                                                 break;
1597 1597
                                             }
1598 1598
                                         $where_set = true;
1599 1599
                                     } elseif ($condition->operator === 'Less_Than') {
1600 1600
                                             if ($dateTime !== false) {
1601
-                                                $less_than_query = "( $field < '" . $this->db->quote($condition->value) . "' ) ";
1602
-                                                $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op . ' ' : 'AND ')) . $less_than_query;
1601
+                                                $less_than_query = "( $field < '".$this->db->quote($condition->value)."' ) ";
1602
+                                                $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op.' ' : 'AND ')).$less_than_query;
1603 1603
                                             } elseif ($dateTime === false && $data['type'] === 'datetime') { // check for incorrectly converted dateTime
1604 1604
                                                     $dateTime = convertToDateTime($condition->value);
1605 1605
 
1606 1606
                                                     $query_date = $dateTime->format('Y-m-d H:i:s');
1607
-                                                    $less_than_query = "( $field < '" . $this->db->quote($query_date) . "' ) ";
1608
-                                                    $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op . ' ' : 'AND ')) . $less_than_query;
1607
+                                                    $less_than_query = "( $field < '".$this->db->quote($query_date)."' ) ";
1608
+                                                    $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op.' ' : 'AND ')).$less_than_query;
1609 1609
                                                 } else {
1610
-                                                    $value = "'" . $this->db->quote($condition->value) . "'";
1610
+                                                    $value = "'".$this->db->quote($condition->value)."'";
1611 1611
                                                     break;
1612 1612
                                                 }
1613 1613
                                             $where_set = true;
1614 1614
                                         } elseif ($condition->operator === 'Greater_Than_or_Equal_To') {
1615 1615
                                                 if ($dateTime !== false) {
1616
-                                                    $equal_greater_than_query = "( $field > '" . $this->db->quote($condition->value) . "'";
1616
+                                                    $equal_greater_than_query = "( $field > '".$this->db->quote($condition->value)."'";
1617 1617
                                                     $day_ahead = $dateTime->modify('+1 day');
1618
-                                                    $equal_greater_than_query .= " OR $field  BETWEEN '" . $this->db->quote($condition->value) . "' AND '" . $this->db->quote($day_ahead->format('Y-m-d H:i:s')) . "' ) ";
1619
-                                                    $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op . ' ' : 'AND ')) . $equal_greater_than_query;
1618
+                                                    $equal_greater_than_query .= " OR $field  BETWEEN '".$this->db->quote($condition->value)."' AND '".$this->db->quote($day_ahead->format('Y-m-d H:i:s'))."' ) ";
1619
+                                                    $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op.' ' : 'AND ')).$equal_greater_than_query;
1620 1620
                                                 } elseif ($dateTime === false && $data['type'] === 'datetime') { // check for incorrectly converted dateTime
1621 1621
                                                         $dateTime = convertToDateTime($condition->value);
1622 1622
 
1623 1623
                                                         $query_date = $dateTime->format('Y-m-d H:i:s');
1624
-                                                        $equal_greater_than_query = "( $field > '" . $this->db->quote($query_date) . "'";
1624
+                                                        $equal_greater_than_query = "( $field > '".$this->db->quote($query_date)."'";
1625 1625
                                                         $day_ahead = $dateTime->modify('+1 day');
1626
-                                                        $equal_greater_than_query .= " OR $field  BETWEEN '" . $this->db->quote($query_date) . "' AND '" . $this->db->quote($day_ahead->format('Y-m-d H:i:s')) . "' ) ";
1627
-                                                        $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op . ' ' : 'AND ')) . $equal_greater_than_query;
1626
+                                                        $equal_greater_than_query .= " OR $field  BETWEEN '".$this->db->quote($query_date)."' AND '".$this->db->quote($day_ahead->format('Y-m-d H:i:s'))."' ) ";
1627
+                                                        $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op.' ' : 'AND ')).$equal_greater_than_query;
1628 1628
                                                     } else {
1629
-                                                        $value = "'" . $this->db->quote($condition->value) . "'";
1629
+                                                        $value = "'".$this->db->quote($condition->value)."'";
1630 1630
                                                         break;
1631 1631
                                                     }
1632 1632
                                                 $where_set = true;
1633 1633
                                             } elseif ($condition->operator === 'Less_Than_or_Equal_To') {
1634 1634
                                                     if ($dateTime !== false) {
1635
-                                                        $equal_less_than_query = "( $field < '" . $this->db->quote($condition->value) . "'";
1635
+                                                        $equal_less_than_query = "( $field < '".$this->db->quote($condition->value)."'";
1636 1636
                                                         $day_ahead = $dateTime->modify('+1 day');
1637
-                                                        $equal_less_than_query .= " OR $field  BETWEEN '" . $this->db->quote($condition->value) . "' AND '" . $this->db->quote($day_ahead->format('Y-m-d H:i:s')) . "' ) ";
1638
-                                                        $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op . ' ' : 'AND ')) . $equal_less_than_query;
1637
+                                                        $equal_less_than_query .= " OR $field  BETWEEN '".$this->db->quote($condition->value)."' AND '".$this->db->quote($day_ahead->format('Y-m-d H:i:s'))."' ) ";
1638
+                                                        $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op.' ' : 'AND ')).$equal_less_than_query;
1639 1639
                                                     } elseif ($dateTime === false && $data['type'] === 'datetime') { // check for incorrectly converted dateTime
1640 1640
                                                             $dateTime = convertToDateTime($condition->value);
1641 1641
 
1642 1642
                                                             $query_date = $dateTime->format('Y-m-d H:i:s');
1643
-                                                            $equal_less_than_query = "( $field < '" . $this->db->quote($query_date) . "'";
1643
+                                                            $equal_less_than_query = "( $field < '".$this->db->quote($query_date)."'";
1644 1644
                                                             $day_ahead = $dateTime->modify('+1 day');
1645
-                                                            $equal_less_than_query .= " OR $field  BETWEEN '" . $this->db->quote($query_date) . "' AND '" . $this->db->quote($day_ahead->format('Y-m-d H:i:s')) . "' ) ";
1646
-                                                            $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op . ' ' : 'AND ')) . $equal_less_than_query;
1645
+                                                            $equal_less_than_query .= " OR $field  BETWEEN '".$this->db->quote($query_date)."' AND '".$this->db->quote($day_ahead->format('Y-m-d H:i:s'))."' ) ";
1646
+                                                            $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op.' ' : 'AND ')).$equal_less_than_query;
1647 1647
                                                         } else {
1648
-                                                            $value = "'" . $this->db->quote($condition->value) . "'";
1648
+                                                            $value = "'".$this->db->quote($condition->value)."'";
1649 1649
                                                             break;
1650 1650
                                                         }
1651 1651
                                                     $where_set = true;
1652 1652
                                                 } else {
1653
-                                                    $value = "'" . $this->db->quote($condition->value) . "'";
1653
+                                                    $value = "'".$this->db->quote($condition->value)."'";
1654 1654
                                                 }
1655 1655
                             break;
1656 1656
                         default:
1657
-                            $value = "'" . $this->db->quote($condition->value) . "'";
1657
+                            $value = "'".$this->db->quote($condition->value)."'";
1658 1658
                             break;
1659 1659
                     }
1660 1660
 
1661 1661
                     //handle like conditions
1662 1662
                     Switch ($condition->operator) {
1663 1663
                         case 'Contains':
1664
-                            $value = "CONCAT('%', " . $value . " ,'%')";
1664
+                            $value = "CONCAT('%', ".$value." ,'%')";
1665 1665
                             break;
1666 1666
                         case 'Starts_With':
1667
-                            $value = "CONCAT(" . $value . " ,'%')";
1667
+                            $value = "CONCAT(".$value." ,'%')";
1668 1668
                             break;
1669 1669
                         case 'Ends_With':
1670
-                            $value = "CONCAT('%', " . $value . ")";
1670
+                            $value = "CONCAT('%', ".$value.")";
1671 1671
                             break;
1672 1672
                     }
1673 1673
 
1674 1674
                     if ($condition->value_type == 'Value' && !$condition->value && $condition->operator == 'Equal_To') {
1675 1675
                         $value = "{$value} OR {$field} IS NULL)";
1676
-                        $field = "(" . $field;
1676
+                        $field = "(".$field;
1677 1677
                     }
1678 1678
 
1679 1679
                     if (!$where_set) {
@@ -1684,28 +1684,28 @@  discard block
 block discarded – undo
1684 1684
                                 $params = base64_decode($condition->value);
1685 1685
                             }
1686 1686
                             $date = getPeriodEndDate($params)->format('Y-m-d H:i:s');
1687
-                            $value = '"' . getPeriodDate($params)->format('Y-m-d H:i:s') . '"';
1687
+                            $value = '"'.getPeriodDate($params)->format('Y-m-d H:i:s').'"';
1688 1688
 
1689
-                            $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op . ' ' : 'AND '));
1689
+                            $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op.' ' : 'AND '));
1690 1690
                             $tiltLogicOp = false;
1691 1691
 
1692 1692
                             switch ($aor_sql_operator_list[$condition->operator]) {
1693 1693
                                 case "=":
1694
-                                    $query['where'][] = $field . ' BETWEEN ' . $value . ' AND ' . '"' . $date . '"';
1694
+                                    $query['where'][] = $field.' BETWEEN '.$value.' AND '.'"'.$date.'"';
1695 1695
                                     break;
1696 1696
                                 case "!=":
1697
-                                    $query['where'][] = $field . ' NOT BETWEEN ' . $value . ' AND ' . '"' . $date . '"';
1697
+                                    $query['where'][] = $field.' NOT BETWEEN '.$value.' AND '.'"'.$date.'"';
1698 1698
                                     break;
1699 1699
                                 case ">":
1700 1700
                                 case "<":
1701 1701
                                 case ">=":
1702 1702
                                 case "<=":
1703
-                                    $query['where'][] = $field . ' ' . $aor_sql_operator_list[$condition->operator] . ' ' . $value;
1703
+                                    $query['where'][] = $field.' '.$aor_sql_operator_list[$condition->operator].' '.$value;
1704 1704
                                     break;
1705 1705
                             }
1706 1706
                         } else {
1707 1707
                             if (!$where_set) {
1708
-                                $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op . ' ' : 'AND ')) . $field . ' ' . $aor_sql_operator_list[$condition->operator] . ' ' . $value;
1708
+                                $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op.' ' : 'AND ')).$field.' '.$aor_sql_operator_list[$condition->operator].' '.$value;
1709 1709
                             }
1710 1710
                         }
1711 1711
                     }
@@ -1713,7 +1713,7 @@  discard block
 block discarded – undo
1713 1713
                 } else {
1714 1714
                     if ($condition->parenthesis) {
1715 1715
                         if ($condition->parenthesis == 'START') {
1716
-                            $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op . ' ' : 'AND ')) . '(';
1716
+                            $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op.' ' : 'AND ')).'(';
1717 1717
                             $tiltLogicOp = true;
1718 1718
                         } else {
1719 1719
                             $query['where'][] = ')';
@@ -1730,7 +1730,7 @@  discard block
 block discarded – undo
1730 1730
                 array_unshift($query['where'], '(');
1731 1731
                 $query['where'][] = ') AND ';
1732 1732
             }
1733
-            $query['where'][] = $module->table_name . ".deleted = 0 " . $this->build_report_access_query($module,
1733
+            $query['where'][] = $module->table_name.".deleted = 0 ".$this->build_report_access_query($module,
1734 1734
                     $module->table_name);
1735 1735
 
1736 1736
         }
Please login to merge, or discard this patch.
modules/AOW_WorkFlow/aow_utils.php 1 patch
Spacing   +180 added lines, -180 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  */
24 24
 
25 25
 
26
-function getModuleFields($module, $view='EditView',$value = '', $valid = array())
26
+function getModuleFields($module, $view = 'EditView', $value = '', $valid = array())
27 27
 {
28 28
     global $app_strings, $beanList;
29 29
 
@@ -31,68 +31,68 @@  discard block
 block discarded – undo
31 31
     $unset = array();
32 32
 
33 33
     if ($module != '') {
34
-        if(isset($beanList[$module]) && $beanList[$module]){
34
+        if (isset($beanList[$module]) && $beanList[$module]) {
35 35
             $mod = new $beanList[$module]();
36
-            foreach($mod->field_defs as $name => $arr){
37
-                if(ACLController::checkAccess($mod->module_dir, 'list', true)) {
38
-                    if($arr['type'] != 'link' &&((!isset($arr['source']) || $arr['source'] != 'non-db') || ($arr['type'] == 'relate' && isset($arr['id_name']))) && (empty($valid) || in_array($arr['type'], $valid)) && $name != 'currency_name' && $name != 'currency_symbol'){
39
-                        if(isset($arr['vname']) && $arr['vname'] != ''){
40
-                            $fields[$name] = rtrim(translate($arr['vname'],$mod->module_dir), ':');
36
+            foreach ($mod->field_defs as $name => $arr) {
37
+                if (ACLController::checkAccess($mod->module_dir, 'list', true)) {
38
+                    if ($arr['type'] != 'link' && ((!isset($arr['source']) || $arr['source'] != 'non-db') || ($arr['type'] == 'relate' && isset($arr['id_name']))) && (empty($valid) || in_array($arr['type'], $valid)) && $name != 'currency_name' && $name != 'currency_symbol') {
39
+                        if (isset($arr['vname']) && $arr['vname'] != '') {
40
+                            $fields[$name] = rtrim(translate($arr['vname'], $mod->module_dir), ':');
41 41
                         } else {
42 42
                             $fields[$name] = $name;
43 43
                         }
44
-                        if($arr['type'] == 'relate' && isset($arr['id_name']) && $arr['id_name'] != ''){
44
+                        if ($arr['type'] == 'relate' && isset($arr['id_name']) && $arr['id_name'] != '') {
45 45
                             $unset[] = $arr['id_name'];
46 46
                         }
47 47
                     }
48 48
                 }
49 49
             } //End loop.
50 50
 
51
-            foreach($unset as $name){
52
-                if(isset($fields[$name])) unset( $fields[$name]);
51
+            foreach ($unset as $name) {
52
+                if (isset($fields[$name])) unset($fields[$name]);
53 53
             }
54 54
 
55 55
         }
56 56
     }
57 57
     asort($fields);
58
-    if($view == 'JSON'){
58
+    if ($view == 'JSON') {
59 59
         return json_encode($fields);
60 60
     }
61
-    if($view == 'EditView'){
61
+    if ($view == 'EditView') {
62 62
         return get_select_options_with_id($fields, $value);
63 63
     } else {
64 64
         return $fields[$value];
65 65
     }
66 66
 }
67 67
 
68
-function getRelModuleFields($module, $rel_field, $view='EditView',$value = ''){
68
+function getRelModuleFields($module, $rel_field, $view = 'EditView', $value = '') {
69 69
     global $beanList;
70 70
 
71
-    if($module == $rel_field){
71
+    if ($module == $rel_field) {
72 72
         return getModuleFields($module, $view, $value);
73 73
     }
74 74
 
75 75
     $mod = new $beanList[$module]();
76 76
     $data = $mod->field_defs[$rel_field];
77 77
 
78
-    if(isset($data['module']) && $data['module'] != ''){
78
+    if (isset($data['module']) && $data['module'] != '') {
79 79
         return getModuleFields($data['module'], $view, $value);
80 80
     }
81 81
 
82 82
 }
83 83
 
84
-function getRelatedModule($module, $rel_field){
84
+function getRelatedModule($module, $rel_field) {
85 85
     global $beanList;
86 86
 
87
-    if($module == $rel_field){
87
+    if ($module == $rel_field) {
88 88
         return $module;
89 89
     }
90 90
 
91 91
     $mod = new $beanList[$module]();
92 92
 
93
-    if(isset($arr['module']) && $arr['module'] != '') {
93
+    if (isset($arr['module']) && $arr['module'] != '') {
94 94
         return $arr['module'];
95
-    } else if($mod->load_relationship($rel_field)){
95
+    } else if ($mod->load_relationship($rel_field)) {
96 96
         return $mod->$rel_field->getRelatedModuleName();
97 97
     }
98 98
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 
101 101
 }
102 102
 
103
-function getModuleTreeData($module){
103
+function getModuleTreeData($module) {
104 104
     global $beanList, $app_list_strings;
105 105
 
106 106
     $sort_fields = array();
@@ -113,33 +113,33 @@  discard block
 block discarded – undo
113 113
     );
114 114
 
115 115
     if ($module != '') {
116
-        if(isset($beanList[$module]) && $beanList[$module]){
116
+        if (isset($beanList[$module]) && $beanList[$module]) {
117 117
             $mod = new $beanList[$module]();
118 118
 
119
-            foreach($mod->get_linked_fields() as $name => $arr){
120
-                if(isset($arr['module']) && $arr['module'] != '') {
119
+            foreach ($mod->get_linked_fields() as $name => $arr) {
120
+                if (isset($arr['module']) && $arr['module'] != '') {
121 121
                     $rel_module = $arr['module'];
122
-                } else if($mod->load_relationship($name)){
122
+                } else if ($mod->load_relationship($name)) {
123 123
                     $rel_module = $mod->$name->getRelatedModuleName();
124 124
                 }
125 125
 
126 126
                 $rel_module_label = isset($app_list_strings['moduleList'][$rel_module]) ? $app_list_strings['moduleList'][$rel_module] : $rel_module;
127
-                if(isset($arr['vname']) && $arr['vname'] != '') {
128
-                    $label = $rel_module_label . ' : ' . translate($arr['vname'], $mod->module_dir);
129
-                    $module_label = trim(translate($arr['vname'],$mod->module_dir),':');
130
-                }else {
131
-                    $label = $rel_module_label . ' : '. $name;
127
+                if (isset($arr['vname']) && $arr['vname'] != '') {
128
+                    $label = $rel_module_label.' : '.translate($arr['vname'], $mod->module_dir);
129
+                    $module_label = trim(translate($arr['vname'], $mod->module_dir), ':');
130
+                } else {
131
+                    $label = $rel_module_label.' : '.$name;
132 132
                     $module_label = $name;
133 133
                 }
134
-                $sort_fields[$name] = array('label'=>$label,'type'=>'relationship','module' => $rel_module,'module_label'=>$module_label);
135
-                if($arr['type'] == 'relate' && isset($arr['id_name']) && $arr['id_name'] != ''){
136
-                    if(isset($fields[$arr['id_name']])){
137
-                        unset( $fields[$arr['id_name']]);
134
+                $sort_fields[$name] = array('label'=>$label, 'type'=>'relationship', 'module' => $rel_module, 'module_label'=>$module_label);
135
+                if ($arr['type'] == 'relate' && isset($arr['id_name']) && $arr['id_name'] != '') {
136
+                    if (isset($fields[$arr['id_name']])) {
137
+                        unset($fields[$arr['id_name']]);
138 138
                     }
139 139
                 }
140 140
             } //End loop.
141
-            uasort($sort_fields,function($a,$b){
142
-                return strcmp($a['label'],$b['label']);
141
+            uasort($sort_fields, function($a, $b) {
142
+                return strcmp($a['label'], $b['label']);
143 143
             });
144 144
 
145 145
             $fields = array_merge((array)$fields, (array)$sort_fields);
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
     return json_encode($fields);
150 150
 }
151 151
 
152
-function getModuleRelationships($module, $view='EditView',$value = '')
152
+function getModuleRelationships($module, $view = 'EditView', $value = '')
153 153
 {
154 154
     global $beanList, $app_list_strings;
155 155
 
@@ -158,27 +158,27 @@  discard block
 block discarded – undo
158 158
     $invalid_modules = array();
159 159
 
160 160
     if ($module != '') {
161
-        if(isset($beanList[$module]) && $beanList[$module]){
161
+        if (isset($beanList[$module]) && $beanList[$module]) {
162 162
             $mod = new $beanList[$module]();
163 163
 
164 164
             /*if($mod->is_AuditEnabled()){
165 165
                 $fields['Audit'] = translate('LBL_AUDIT_TABLE','AOR_Fields');
166 166
             }*/
167
-            foreach($mod->get_linked_fields() as $name => $arr){
168
-                if(isset($arr['module']) && $arr['module'] != '') {
167
+            foreach ($mod->get_linked_fields() as $name => $arr) {
168
+                if (isset($arr['module']) && $arr['module'] != '') {
169 169
                     $rel_module = $arr['module'];
170
-                } else if($mod->load_relationship($name)){
170
+                } else if ($mod->load_relationship($name)) {
171 171
                     $rel_module = $mod->$name->getRelatedModuleName();
172 172
                 }
173
-                if(!in_array($rel_module,$invalid_modules)){
173
+                if (!in_array($rel_module, $invalid_modules)) {
174 174
                     $relModuleName = isset($app_list_strings['moduleList'][$rel_module]) ? $app_list_strings['moduleList'][$rel_module] : $rel_module;
175
-                    if(isset($arr['vname']) && $arr['vname'] != ''){
176
-                        $sort_fields[$name] = $relModuleName.' : '.translate($arr['vname'],$mod->module_dir);
175
+                    if (isset($arr['vname']) && $arr['vname'] != '') {
176
+                        $sort_fields[$name] = $relModuleName.' : '.translate($arr['vname'], $mod->module_dir);
177 177
                     } else {
178
-                        $sort_fields[$name] = $relModuleName.' : '. $name;
178
+                        $sort_fields[$name] = $relModuleName.' : '.$name;
179 179
                     }
180
-                    if($arr['type'] == 'relate' && isset($arr['id_name']) && $arr['id_name'] != ''){
181
-                        if(isset($fields[$arr['id_name']])) unset( $fields[$arr['id_name']]);
180
+                    if ($arr['type'] == 'relate' && isset($arr['id_name']) && $arr['id_name'] != '') {
181
+                        if (isset($fields[$arr['id_name']])) unset($fields[$arr['id_name']]);
182 182
                     }
183 183
                 }
184 184
             } //End loop.
@@ -186,26 +186,26 @@  discard block
 block discarded – undo
186 186
             $fields = array_merge((array)$fields, (array)$sort_fields);
187 187
         }
188 188
     }
189
-    if($view == 'EditView'){
189
+    if ($view == 'EditView') {
190 190
         return get_select_options_with_id($fields, $value);
191 191
     } else {
192 192
         return $fields[$value];
193 193
     }
194 194
 }
195 195
 
196
-function getValidFieldsTypes($module, $field){
196
+function getValidFieldsTypes($module, $field) {
197 197
     global $beanFiles, $beanList;
198 198
 
199 199
     require_once($beanFiles[$beanList[$module]]);
200 200
     $focus = new $beanList[$module];
201 201
     $vardef = $focus->getFieldDefinition($field);
202 202
 
203
-    switch($vardef['type']) {
203
+    switch ($vardef['type']) {
204 204
         case 'double':
205 205
         case 'decimal':
206 206
         case 'float':
207 207
         case 'currency':
208
-            $valid_type = array('double','decimal','float','currency');
208
+            $valid_type = array('double', 'decimal', 'float', 'currency');
209 209
             break;
210 210
         case 'uint':
211 211
         case 'ulong':
@@ -213,12 +213,12 @@  discard block
 block discarded – undo
213 213
         case 'short':
214 214
         case 'tinyint':
215 215
         case 'int':
216
-            $valid_type = array('uint','ulong','long','short','tinyint','int');
216
+            $valid_type = array('uint', 'ulong', 'long', 'short', 'tinyint', 'int');
217 217
             break;
218 218
         case 'date':
219 219
         case 'datetime':
220 220
         case 'datetimecombo':
221
-            $valid_type = array('date','datetime', 'datetimecombo');
221
+            $valid_type = array('date', 'datetime', 'datetimecombo');
222 222
             break;
223 223
         case 'id':
224 224
         case 'relate':
@@ -235,29 +235,29 @@  discard block
 block discarded – undo
235 235
 }
236 236
 
237 237
 
238
-function getModuleField($module, $fieldname, $aow_field, $view='EditView',$value = '', $alt_type = '', $currency_id = '', $params= array()){
238
+function getModuleField($module, $fieldname, $aow_field, $view = 'EditView', $value = '', $alt_type = '', $currency_id = '', $params = array()) {
239 239
     global $current_language, $app_strings, $app_list_strings, $current_user, $beanFiles, $beanList;
240 240
 
241 241
     // use the mod_strings for this module
242
-    $mod_strings = return_module_language($current_language,$module);
242
+    $mod_strings = return_module_language($current_language, $module);
243 243
 
244 244
     // set the filename for this control
245
-    $file = create_cache_directory('modules/AOW_WorkFlow/') . $module . $view . $alt_type . $fieldname . '.tpl';
245
+    $file = create_cache_directory('modules/AOW_WorkFlow/').$module.$view.$alt_type.$fieldname.'.tpl';
246 246
 
247 247
     $displayParams = array();
248 248
 
249
-    if ( !is_file($file)
249
+    if (!is_file($file)
250 250
         || inDeveloperMode()
251
-        || !empty($_SESSION['developerMode']) ) {
251
+        || !empty($_SESSION['developerMode'])) {
252 252
 
253
-        if ( !isset($vardef) ) {
253
+        if (!isset($vardef)) {
254 254
             require_once($beanFiles[$beanList[$module]]);
255 255
             $focus = new $beanList[$module];
256 256
             $vardef = $focus->getFieldDefinition($fieldname);
257 257
         }
258 258
 
259 259
         // Bug: check for AOR value SecurityGroups value missing
260
-        if(stristr($fieldname, 'securitygroups') != false && empty($vardef)) {
260
+        if (stristr($fieldname, 'securitygroups') != false && empty($vardef)) {
261 261
             require_once($beanFiles[$beanList['SecurityGroups']]);
262 262
             $module = 'SecurityGroups';
263 263
             $focus = new $beanList[$module];
@@ -268,36 +268,36 @@  discard block
 block discarded – undo
268 268
         //$displayParams['formName'] = 'EditView';
269 269
 
270 270
         // if this is the id relation field, then don't have a pop-up selector.
271
-        if( $vardef['type'] == 'relate' && $vardef['id_name'] == $vardef['name']) {
271
+        if ($vardef['type'] == 'relate' && $vardef['id_name'] == $vardef['name']) {
272 272
             $vardef['type'] = 'varchar';
273 273
         }
274 274
 
275
-        if(isset($vardef['precision'])) unset($vardef['precision']);
275
+        if (isset($vardef['precision'])) unset($vardef['precision']);
276 276
 
277 277
         //$vardef['precision'] = $locale->getPrecedentPreference('default_currency_significant_digits', $current_user);
278 278
 
279 279
         //TODO Fix datetimecomebo
280 280
         //temp work around
281
-        if( $vardef['type'] == 'datetimecombo') {
281
+        if ($vardef['type'] == 'datetimecombo') {
282 282
             $vardef['type'] = 'datetime';
283 283
         }
284 284
 
285 285
         // trim down textbox display
286
-        if( $vardef['type'] == 'text' ) {
286
+        if ($vardef['type'] == 'text') {
287 287
             $vardef['rows'] = 2;
288 288
             $vardef['cols'] = 32;
289 289
         }
290 290
 
291 291
         // create the dropdowns for the parent type fields
292
-        if ( $vardef['type'] == 'parent_type' ) {
292
+        if ($vardef['type'] == 'parent_type') {
293 293
             $vardef['type'] = 'enum';
294 294
         }
295 295
 
296
-        if($vardef['type'] == 'link'){
296
+        if ($vardef['type'] == 'link') {
297 297
             $vardef['type'] = 'relate';
298 298
             $vardef['rname'] = 'name';
299 299
             $vardef['id_name'] = $vardef['name'].'_id';
300
-            if((!isset($vardef['module']) || $vardef['module'] == '') && $focus->load_relationship($vardef['name'])) {
300
+            if ((!isset($vardef['module']) || $vardef['module'] == '') && $focus->load_relationship($vardef['name'])) {
301 301
                 $relName = $vardef['name'];
302 302
                 $vardef['module'] = $focus->$relName->getRelatedModuleName();
303 303
             }
@@ -305,24 +305,24 @@  discard block
 block discarded – undo
305 305
         }
306 306
 
307 307
         //check for $alt_type
308
-        if ( $alt_type != '' ) {
308
+        if ($alt_type != '') {
309 309
             $vardef['type'] = $alt_type;
310 310
         }
311 311
 
312 312
         // remove the special text entry field function 'getEmailAddressWidget'
313
-        if ( isset($vardef['function'])
314
-            && ( $vardef['function'] == 'getEmailAddressWidget'
315
-                || $vardef['function']['name'] == 'getEmailAddressWidget' ) )
313
+        if (isset($vardef['function'])
314
+            && ($vardef['function'] == 'getEmailAddressWidget'
315
+                || $vardef['function']['name'] == 'getEmailAddressWidget'))
316 316
             unset($vardef['function']);
317 317
 
318
-        if(isset($vardef['name']) && ($vardef['name'] == 'date_entered' || $vardef['name'] == 'date_modified')){
318
+        if (isset($vardef['name']) && ($vardef['name'] == 'date_entered' || $vardef['name'] == 'date_modified')) {
319 319
             $vardef['name'] = 'aow_temp_date';
320 320
         }
321 321
 
322 322
         // load SugarFieldHandler to render the field tpl file
323 323
         static $sfh;
324 324
 
325
-        if(!isset($sfh)) {
325
+        if (!isset($sfh)) {
326 326
             require_once('include/SugarFields/SugarFieldHandler.php');
327 327
             $sfh = new SugarFieldHandler();
328 328
         }
@@ -332,17 +332,17 @@  discard block
 block discarded – undo
332 332
         // Remove all the copyright comments
333 333
         $contents = preg_replace('/\{\*[^\}]*?\*\}/', '', $contents);
334 334
 
335
-        if( $view == 'EditView' &&  ($vardef['type'] == 'relate' || $vardef['type'] == 'parent')){
336
-            $contents = str_replace('"'.$vardef['id_name'].'"','{/literal}"{$fields.'.$vardef['name'].'.id_name}"{literal}', $contents);
337
-            $contents = str_replace('"'.$vardef['name'].'"','{/literal}"{$fields.'.$vardef['name'].'.name}"{literal}', $contents);
335
+        if ($view == 'EditView' && ($vardef['type'] == 'relate' || $vardef['type'] == 'parent')) {
336
+            $contents = str_replace('"'.$vardef['id_name'].'"', '{/literal}"{$fields.'.$vardef['name'].'.id_name}"{literal}', $contents);
337
+            $contents = str_replace('"'.$vardef['name'].'"', '{/literal}"{$fields.'.$vardef['name'].'.name}"{literal}', $contents);
338 338
         }
339 339
 
340 340
         // hack to disable one of the js calls in this control
341
-        if ( isset($vardef['function']) && ( $vardef['function'] == 'getCurrencyDropDown' || $vardef['function']['name'] == 'getCurrencyDropDown' ) )
341
+        if (isset($vardef['function']) && ($vardef['function'] == 'getCurrencyDropDown' || $vardef['function']['name'] == 'getCurrencyDropDown'))
342 342
             $contents .= "{literal}<script>function CurrencyConvertAll() { return; }</script>{/literal}";
343 343
 
344 344
         // Save it to the cache file
345
-        if($fh = @sugar_fopen($file, 'w')) {
345
+        if ($fh = @sugar_fopen($file, 'w')) {
346 346
             fputs($fh, $contents);
347 347
             fclose($fh);
348 348
         }
@@ -359,51 +359,51 @@  discard block
 block discarded – undo
359 359
     $ss->assign('TIME_FORMAT', $time_format);
360 360
     $time_separator = ":";
361 361
     $match = array();
362
-    if(preg_match('/\d+([^\d])\d+([^\d]*)/s', $time_format, $match)) {
362
+    if (preg_match('/\d+([^\d])\d+([^\d]*)/s', $time_format, $match)) {
363 363
         $time_separator = $match[1];
364 364
     }
365 365
     $t23 = strpos($time_format, '23') !== false ? '%H' : '%I';
366
-    if(!isset($match[2]) || $match[2] == '') {
367
-        $ss->assign('CALENDAR_FORMAT', $date_format . ' ' . $t23 . $time_separator . "%M");
366
+    if (!isset($match[2]) || $match[2] == '') {
367
+        $ss->assign('CALENDAR_FORMAT', $date_format.' '.$t23.$time_separator."%M");
368 368
     }
369 369
     else {
370 370
         $pm = $match[2] == "pm" ? "%P" : "%p";
371
-        $ss->assign('CALENDAR_FORMAT', $date_format . ' ' . $t23 . $time_separator . "%M" . $pm);
371
+        $ss->assign('CALENDAR_FORMAT', $date_format.' '.$t23.$time_separator."%M".$pm);
372 372
     }
373 373
 
374 374
     $ss->assign('CALENDAR_FDOW', $current_user->get_first_day_of_week());
375 375
 
376 376
     // populate the fieldlist from the vardefs
377 377
     $fieldlist = array();
378
-    if ( !isset($focus) || !($focus instanceof SugarBean) )
378
+    if (!isset($focus) || !($focus instanceof SugarBean))
379 379
         require_once($beanFiles[$beanList[$module]]);
380 380
     $focus = new $beanList[$module];
381 381
     // create the dropdowns for the parent type fields
382 382
     $vardefFields = $focus->getFieldDefinitions();
383
-    if (isset($vardefFields[$fieldname]['type']) && $vardefFields[$fieldname]['type'] == 'parent_type' ) {
383
+    if (isset($vardefFields[$fieldname]['type']) && $vardefFields[$fieldname]['type'] == 'parent_type') {
384 384
         $focus->field_defs[$fieldname]['options'] = $focus->field_defs[$vardefFields[$fieldname]['group']]['options'];
385 385
     }
386
-    foreach ( $vardefFields as $name => $properties ) {
386
+    foreach ($vardefFields as $name => $properties) {
387 387
         $fieldlist[$name] = $properties;
388 388
         // fill in enums
389
-        if(isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($app_list_strings[$fieldlist[$name]['options']]))
389
+        if (isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($app_list_strings[$fieldlist[$name]['options']]))
390 390
             $fieldlist[$name]['options'] = $app_list_strings[$fieldlist[$name]['options']];
391 391
         // Bug 32626: fall back on checking the mod_strings if not in the app_list_strings
392
-        elseif(isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($mod_strings[$fieldlist[$name]['options']]))
392
+        elseif (isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($mod_strings[$fieldlist[$name]['options']]))
393 393
             $fieldlist[$name]['options'] = $mod_strings[$fieldlist[$name]['options']];
394 394
         // Bug 22730: make sure all enums have the ability to select blank as the default value.
395
-        if(!isset($fieldlist[$name]['options']['']))
395
+        if (!isset($fieldlist[$name]['options']['']))
396 396
             $fieldlist[$name]['options'][''] = '';
397 397
     }
398 398
 
399 399
     // fill in function return values
400
-    if ( !in_array($fieldname,array('email1','email2')) )
400
+    if (!in_array($fieldname, array('email1', 'email2')))
401 401
     {
402 402
         if (!empty($fieldlist[$fieldname]['function']['returns']) && $fieldlist[$fieldname]['function']['returns'] == 'html')
403 403
         {
404 404
             $function = $fieldlist[$fieldname]['function']['name'];
405 405
             // include various functions required in the various vardefs
406
-            if ( isset($fieldlist[$fieldname]['function']['include']) && is_file($fieldlist[$fieldname]['function']['include']))
406
+            if (isset($fieldlist[$fieldname]['function']['include']) && is_file($fieldlist[$fieldname]['function']['include']))
407 407
                 require_once($fieldlist[$fieldname]['function']['include']);
408 408
             $_REQUEST[$fieldname] = $value;
409 409
             $value = $function($focus, $fieldname, $value, $view);
@@ -412,40 +412,40 @@  discard block
 block discarded – undo
412 412
         }
413 413
     }
414 414
 
415
-    if(isset($fieldlist[$fieldname]['type']) && $fieldlist[$fieldname]['type'] == 'link'){
415
+    if (isset($fieldlist[$fieldname]['type']) && $fieldlist[$fieldname]['type'] == 'link') {
416 416
         $fieldlist[$fieldname]['id_name'] = $fieldlist[$fieldname]['name'].'_id';
417 417
 
418
-        if((!isset($fieldlist[$fieldname]['module']) || $fieldlist[$fieldname]['module'] == '') && $focus->load_relationship($fieldlist[$fieldname]['name'])) {
418
+        if ((!isset($fieldlist[$fieldname]['module']) || $fieldlist[$fieldname]['module'] == '') && $focus->load_relationship($fieldlist[$fieldname]['name'])) {
419 419
             $relName = $fieldlist[$fieldname]['name'];
420 420
             $fieldlist[$fieldname]['module'] = $focus->$relName->getRelatedModuleName();
421 421
         }
422 422
     }
423 423
 
424
-    if(isset($fieldlist[$fieldname]['name']) && ($fieldlist[$fieldname]['name'] == 'date_entered' || $fieldlist[$fieldname]['name'] == 'date_modified')){
424
+    if (isset($fieldlist[$fieldname]['name']) && ($fieldlist[$fieldname]['name'] == 'date_entered' || $fieldlist[$fieldname]['name'] == 'date_modified')) {
425 425
         $fieldlist[$fieldname]['name'] = 'aow_temp_date';
426 426
         $fieldlist['aow_temp_date'] = $fieldlist[$fieldname];
427 427
         $fieldname = 'aow_temp_date';
428 428
     }
429 429
 
430 430
     $quicksearch_js = '';
431
-    if(isset( $fieldlist[$fieldname]['id_name'] ) && $fieldlist[$fieldname]['id_name'] != '' && $fieldlist[$fieldname]['id_name'] != $fieldlist[$fieldname]['name']){
431
+    if (isset($fieldlist[$fieldname]['id_name']) && $fieldlist[$fieldname]['id_name'] != '' && $fieldlist[$fieldname]['id_name'] != $fieldlist[$fieldname]['name']) {
432 432
         $rel_value = $value;
433 433
 
434 434
         require_once("include/TemplateHandler/TemplateHandler.php");
435 435
         $template_handler = new TemplateHandler();
436
-        $quicksearch_js = $template_handler->createQuickSearchCode($fieldlist,$fieldlist,$view);
436
+        $quicksearch_js = $template_handler->createQuickSearchCode($fieldlist, $fieldlist, $view);
437 437
         $quicksearch_js = str_replace($fieldname, $aow_field.'_display', $quicksearch_js);
438 438
         $quicksearch_js = str_replace($fieldlist[$fieldname]['id_name'], $aow_field, $quicksearch_js);
439 439
 
440 440
         echo $quicksearch_js;
441 441
 
442
-        if(isset($fieldlist[$fieldname]['module']) && $fieldlist[$fieldname]['module'] == 'Users'){
442
+        if (isset($fieldlist[$fieldname]['module']) && $fieldlist[$fieldname]['module'] == 'Users') {
443 443
             $rel_value = get_assigned_user_name($value);
444
-        } else if(isset($fieldlist[$fieldname]['module'])){
444
+        } else if (isset($fieldlist[$fieldname]['module'])) {
445 445
             require_once($beanFiles[$beanList[$fieldlist[$fieldname]['module']]]);
446 446
             $rel_focus = new $beanList[$fieldlist[$fieldname]['module']];
447 447
             $rel_focus->retrieve($value);
448
-            if(isset($fieldlist[$fieldname]['rname']) && $fieldlist[$fieldname]['rname'] != ''){
448
+            if (isset($fieldlist[$fieldname]['rname']) && $fieldlist[$fieldname]['rname'] != '') {
449 449
                 $relDisplayField = $fieldlist[$fieldname]['rname'];
450 450
             } else {
451 451
                 $relDisplayField = 'name';
@@ -458,17 +458,17 @@  discard block
 block discarded – undo
458 458
         $fieldlist[$fieldname]['id_name'] = $aow_field;
459 459
         $fieldlist[$fieldlist[$fieldname]['id_name']]['name'] = $aow_field;
460 460
         $fieldlist[$fieldname]['name'] = $aow_field.'_display';
461
-    } else if(isset( $fieldlist[$fieldname]['type'] ) && $view == 'DetailView' && ($fieldlist[$fieldname]['type'] == 'datetimecombo' || $fieldlist[$fieldname]['type'] == 'datetime' || $fieldlist[$fieldname]['type'] == 'date')){
461
+    } else if (isset($fieldlist[$fieldname]['type']) && $view == 'DetailView' && ($fieldlist[$fieldname]['type'] == 'datetimecombo' || $fieldlist[$fieldname]['type'] == 'datetime' || $fieldlist[$fieldname]['type'] == 'date')) {
462 462
         $value = $focus->convertField($value, $fieldlist[$fieldname]);
463
-        if(!empty($params['date_format']) && isset($params['date_format'])){
463
+        if (!empty($params['date_format']) && isset($params['date_format'])) {
464 464
             $convert_format = "Y-m-d H:i:s";
465
-            if($fieldlist[$fieldname]['type'] == 'date') $convert_format = "Y-m-d";
465
+            if ($fieldlist[$fieldname]['type'] == 'date') $convert_format = "Y-m-d";
466 466
             $fieldlist[$fieldname]['value'] = $timedate->to_display($value, $convert_format, $params['date_format']);
467
-        }else{
467
+        } else {
468 468
             $fieldlist[$fieldname]['value'] = $timedate->to_display_date_time($value, true, true);
469 469
         }
470 470
         $fieldlist[$fieldname]['name'] = $aow_field;
471
-    } else if(isset( $fieldlist[$fieldname]['type'] ) && ($fieldlist[$fieldname]['type'] == 'datetimecombo' || $fieldlist[$fieldname]['type'] == 'datetime' || $fieldlist[$fieldname]['type'] == 'date')){
471
+    } else if (isset($fieldlist[$fieldname]['type']) && ($fieldlist[$fieldname]['type'] == 'datetimecombo' || $fieldlist[$fieldname]['type'] == 'datetime' || $fieldlist[$fieldname]['type'] == 'date')) {
472 472
         $value = $focus->convertField($value, $fieldlist[$fieldname]);
473 473
         $fieldlist[$fieldname]['value'] = $timedate->to_display_date($value);
474 474
         //$fieldlist[$fieldname]['value'] = $timedate->to_display_date_time($value, true, true);
@@ -480,17 +480,17 @@  discard block
 block discarded – undo
480 480
 
481 481
     }
482 482
 
483
-    if(isset($fieldlist[$fieldname]['type']) && $fieldlist[$fieldname]['type'] == 'currency' && $view != 'EditView'){
483
+    if (isset($fieldlist[$fieldname]['type']) && $fieldlist[$fieldname]['type'] == 'currency' && $view != 'EditView') {
484 484
         static $sfh;
485 485
 
486
-        if(!isset($sfh)) {
486
+        if (!isset($sfh)) {
487 487
             require_once('include/SugarFields/SugarFieldHandler.php');
488 488
             $sfh = new SugarFieldHandler();
489 489
         }
490 490
 
491
-        if($currency_id != '' && !stripos($fieldname, '_USD')){
491
+        if ($currency_id != '' && !stripos($fieldname, '_USD')) {
492 492
             $userCurrencyId = $current_user->getPreference('currency');
493
-            if($currency_id != $userCurrencyId){
493
+            if ($currency_id != $userCurrencyId) {
494 494
                 $currency = new Currency();
495 495
                 $currency->retrieve($currency_id);
496 496
                 $value = $currency->convertToDollar($value);
@@ -505,9 +505,9 @@  discard block
 block discarded – undo
505 505
     }
506 506
 
507 507
     $ss->assign("QS_JS", $quicksearch_js);
508
-    $ss->assign("fields",$fieldlist);
509
-    $ss->assign("form_name",$view);
510
-    $ss->assign("bean",$focus);
508
+    $ss->assign("fields", $fieldlist);
509
+    $ss->assign("form_name", $view);
510
+    $ss->assign("bean", $focus);
511 511
 
512 512
     // add in any additional strings
513 513
     $ss->assign("MOD", $mod_strings);
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 
521 521
 
522 522
 
523
-function getDateField($module, $aow_field, $view, $value, $field_option = true){
523
+function getDateField($module, $aow_field, $view, $value, $field_option = true) {
524 524
     global $app_list_strings;
525 525
 
526 526
     // set $view = 'EditView' as default
@@ -530,21 +530,21 @@  discard block
 block discarded – undo
530 530
 
531 531
     $value = json_decode(html_entity_decode_utf8($value), true);
532 532
 
533
-    if(!file_exists('modules/AOBH_BusinessHours/AOBH_BusinessHours.php')) unset($app_list_strings['aow_date_type_list']['business_hours']);
533
+    if (!file_exists('modules/AOBH_BusinessHours/AOBH_BusinessHours.php')) unset($app_list_strings['aow_date_type_list']['business_hours']);
534 534
 
535 535
     $field = '';
536 536
 
537
-    if($view == 'EditView'){
538
-        $field .= "<select type='text' name='$aow_field".'[0]'."' id='$aow_field".'[0]'."' title='' tabindex='116'>". getDateFields($module, $view, $value[0], $field_option) ."</select>&nbsp;&nbsp;";
539
-        $field .= "<select type='text' name='$aow_field".'[1]'."' id='$aow_field".'[1]'."' onchange='date_field_change(\"$aow_field\")'  title='' tabindex='116'>". get_select_options_with_id($app_list_strings['aow_date_operator'], $value[1]) ."</select>&nbsp;";
537
+    if ($view == 'EditView') {
538
+        $field .= "<select type='text' name='$aow_field".'[0]'."' id='$aow_field".'[0]'."' title='' tabindex='116'>".getDateFields($module, $view, $value[0], $field_option)."</select>&nbsp;&nbsp;";
539
+        $field .= "<select type='text' name='$aow_field".'[1]'."' id='$aow_field".'[1]'."' onchange='date_field_change(\"$aow_field\")'  title='' tabindex='116'>".get_select_options_with_id($app_list_strings['aow_date_operator'], $value[1])."</select>&nbsp;";
540 540
         $display = 'none';
541
-        if($value[1] == 'plus' || $value[1] == 'minus') $display = '';
541
+        if ($value[1] == 'plus' || $value[1] == 'minus') $display = '';
542 542
         $field .= "<input  type='text' style='display:$display' name='$aow_field".'[2]'."' id='$aow_field".'[2]'."' title='' value='$value[2]' tabindex='116'>&nbsp;";
543
-        $field .= "<select type='text' style='display:$display' name='$aow_field".'[3]'."' id='$aow_field".'[3]'."' title='' tabindex='116'>". get_select_options_with_id($app_list_strings['aow_date_type_list'], $value[3]) ."</select>";
543
+        $field .= "<select type='text' style='display:$display' name='$aow_field".'[3]'."' id='$aow_field".'[3]'."' title='' tabindex='116'>".get_select_options_with_id($app_list_strings['aow_date_type_list'], $value[3])."</select>";
544 544
     }
545 545
     else {
546 546
         $field = getDateFields($module, $view, $value[0], $field_option).' '.$app_list_strings['aow_date_operator'][$value[1]];
547
-        if($value[1] == 'plus' || $value[1] == 'minus'){
547
+        if ($value[1] == 'plus' || $value[1] == 'minus') {
548 548
             $field .= ' '.$value[2].' '.$app_list_strings['aow_date_type_list'][$value[3]];
549 549
         }
550 550
     }
@@ -552,21 +552,21 @@  discard block
 block discarded – undo
552 552
 
553 553
 }
554 554
 
555
-function getDateFields($module, $view='EditView',$value = '', $field_option = true)
555
+function getDateFields($module, $view = 'EditView', $value = '', $field_option = true)
556 556
 {
557 557
     global $beanList, $app_list_strings;
558 558
 
559 559
     $fields = $app_list_strings['aow_date_options'];
560 560
 
561
-    if(!$field_option) unset($fields['field']);
561
+    if (!$field_option) unset($fields['field']);
562 562
 
563 563
     if ($module != '') {
564
-        if(isset($beanList[$module]) && $beanList[$module]){
564
+        if (isset($beanList[$module]) && $beanList[$module]) {
565 565
             $mod = new $beanList[$module]();
566
-            foreach($mod->field_defs as $name => $arr){
567
-                if($arr['type'] == 'date' || $arr['type'] == 'datetime' || $arr['type'] == 'datetimecombo'){
568
-                    if(isset($arr['vname']) && $arr['vname'] != ''){
569
-                        $fields[$name] = translate($arr['vname'],$mod->module_dir);
566
+            foreach ($mod->field_defs as $name => $arr) {
567
+                if ($arr['type'] == 'date' || $arr['type'] == 'datetime' || $arr['type'] == 'datetimecombo') {
568
+                    if (isset($arr['vname']) && $arr['vname'] != '') {
569
+                        $fields[$name] = translate($arr['vname'], $mod->module_dir);
570 570
                     } else {
571 571
                         $fields[$name] = $name;
572 572
                     }
@@ -575,42 +575,42 @@  discard block
 block discarded – undo
575 575
 
576 576
         }
577 577
     }
578
-    if($view == 'EditView'){
578
+    if ($view == 'EditView') {
579 579
         return get_select_options_with_id($fields, $value);
580 580
     } else {
581 581
         return $fields[$value];
582 582
     }
583 583
 }
584 584
 
585
-function getAssignField($aow_field, $view, $value){
585
+function getAssignField($aow_field, $view, $value) {
586 586
     global $app_list_strings;
587 587
 
588 588
     $value = json_decode(html_entity_decode_utf8($value), true);
589 589
 
590
-    $roles = get_bean_select_array(true, 'ACLRole','name', '','name',true);
590
+    $roles = get_bean_select_array(true, 'ACLRole', 'name', '', 'name', true);
591 591
 
592
-    if(!file_exists('modules/SecurityGroups/SecurityGroup.php')){
592
+    if (!file_exists('modules/SecurityGroups/SecurityGroup.php')) {
593 593
         unset($app_list_strings['aow_assign_options']['security_group']);
594 594
     }
595
-    else{
596
-        $securityGroups = get_bean_select_array(true, 'SecurityGroup','name', '','name',true);
595
+    else {
596
+        $securityGroups = get_bean_select_array(true, 'SecurityGroup', 'name', '', 'name', true);
597 597
     }
598 598
 
599 599
     $field = '';
600 600
 
601
-    if($view == 'EditView'){
602
-        $field .= "<select type='text' name='$aow_field".'[0]'."' id='$aow_field".'[0]'."' onchange='assign_field_change(\"$aow_field\")' title='' tabindex='116'>". get_select_options_with_id($app_list_strings['aow_assign_options'], $value[0]) ."</select>&nbsp;&nbsp;";
603
-        if(!file_exists('modules/SecurityGroups/SecurityGroup.php')){
601
+    if ($view == 'EditView') {
602
+        $field .= "<select type='text' name='$aow_field".'[0]'."' id='$aow_field".'[0]'."' onchange='assign_field_change(\"$aow_field\")' title='' tabindex='116'>".get_select_options_with_id($app_list_strings['aow_assign_options'], $value[0])."</select>&nbsp;&nbsp;";
603
+        if (!file_exists('modules/SecurityGroups/SecurityGroup.php')) {
604 604
             $field .= "<input type='hidden' name='$aow_field".'[1]'."' id='$aow_field".'[1]'."' value=''  />";
605 605
         }
606 606
         else {
607 607
             $display = 'none';
608
-            if($value[0] == 'security_group') $display = '';
609
-            $field .= "<select type='text' style='display:$display' name='$aow_field".'[1]'."' id='$aow_field".'[1]'."' title='' tabindex='116'>". get_select_options_with_id($securityGroups, $value[1]) ."</select>&nbsp;&nbsp;";
608
+            if ($value[0] == 'security_group') $display = '';
609
+            $field .= "<select type='text' style='display:$display' name='$aow_field".'[1]'."' id='$aow_field".'[1]'."' title='' tabindex='116'>".get_select_options_with_id($securityGroups, $value[1])."</select>&nbsp;&nbsp;";
610 610
         }
611 611
         $display = 'none';
612
-        if($value[0] == 'role' || $value[0] == 'security_group') $display = '';
613
-        $field .= "<select type='text' style='display:$display' name='$aow_field".'[2]'."' id='$aow_field".'[2]'."' title='' tabindex='116'>". get_select_options_with_id($roles, $value[2]) ."</select>&nbsp;&nbsp;";
612
+        if ($value[0] == 'role' || $value[0] == 'security_group') $display = '';
613
+        $field .= "<select type='text' style='display:$display' name='$aow_field".'[2]'."' id='$aow_field".'[2]'."' title='' tabindex='116'>".get_select_options_with_id($roles, $value[2])."</select>&nbsp;&nbsp;";
614 614
     }
615 615
     else {
616 616
         $field = $app_list_strings['aow_assign_options'][$value[1]];
@@ -622,10 +622,10 @@  discard block
 block discarded – undo
622 622
 function getDropdownList($list_id, $selected_value) {
623 623
     global $app_list_strings;
624 624
     $option = '';
625
-    foreach($app_list_strings[$list_id] as $key => $value) {
626
-        if(base64_decode($selected_value) == $key) {
625
+    foreach ($app_list_strings[$list_id] as $key => $value) {
626
+        if (base64_decode($selected_value) == $key) {
627 627
             $option .= '<option value="'.$key.'" selected>'.$value.'</option>';
628
-        } else if($selected_value == $key) {
628
+        } else if ($selected_value == $key) {
629 629
             $option .= '<option value="'.$key.'" selected>'.$value.'</option>';
630 630
         }
631 631
         else {
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
 }
637 637
 function getLeastBusyUser($users, $field, SugarBean $bean) {
638 638
     $counts = array();
639
-    foreach($users as $id) {
639
+    foreach ($users as $id) {
640 640
         $c = $bean->db->getOne("SELECT count(*) AS c FROM ".$bean->table_name." WHERE $field = '$id' AND deleted = 0");
641 641
         $counts[$id] = $c;
642 642
     }
@@ -647,21 +647,21 @@  discard block
 block discarded – undo
647 647
 
648 648
 function getRoundRobinUser($users, $id) {
649 649
 
650
-    $file = create_cache_directory('modules/AOW_WorkFlow/Users/') . $id . 'lastUser.cache.php';
650
+    $file = create_cache_directory('modules/AOW_WorkFlow/Users/').$id.'lastUser.cache.php';
651 651
 
652
-    if(isset($_SESSION['lastuser'][$id]) && $_SESSION['lastuser'][$id] != '') {
652
+    if (isset($_SESSION['lastuser'][$id]) && $_SESSION['lastuser'][$id] != '') {
653 653
         $users_by_key = array_flip($users); // now keys are values
654 654
         $key = $users_by_key[$_SESSION['lastuser'][$id]] + 1;
655
-        if(!empty($users[$key])) {
655
+        if (!empty($users[$key])) {
656 656
             return $users[$key];
657 657
         }
658 658
     }
659
-    else if (is_file($file)){
659
+    else if (is_file($file)) {
660 660
         require_once($file);
661
-        if(isset($lastUser['User']) && $lastUser['User'] != '') {
661
+        if (isset($lastUser['User']) && $lastUser['User'] != '') {
662 662
             $users_by_key = array_flip($users); // now keys are values
663 663
             $key = $users_by_key[$lastUser['User']] + 1;
664
-            if(!empty($users[$key])) {
664
+            if (!empty($users[$key])) {
665 665
                 return $users[$key];
666 666
             }
667 667
         }
@@ -674,31 +674,31 @@  discard block
 block discarded – undo
674 674
 
675 675
     $_SESSION['lastuser'][$id] = $user_id;
676 676
 
677
-    $file = create_cache_directory('modules/AOW_WorkFlow/Users/') . $id . 'lastUser.cache.php';
677
+    $file = create_cache_directory('modules/AOW_WorkFlow/Users/').$id.'lastUser.cache.php';
678 678
 
679 679
     $arrayString = var_export_helper(array('User' => $user_id));
680 680
 
681
-    $content =<<<eoq
681
+    $content = <<<eoq
682 682
 <?php
683 683
 	\$lastUser = {$arrayString};
684 684
 ?>
685 685
 eoq;
686 686
 
687
-    if($fh = @sugar_fopen($file, 'w')) {
687
+    if ($fh = @sugar_fopen($file, 'w')) {
688 688
         fputs($fh, $content);
689 689
         fclose($fh);
690 690
     }
691 691
     return true;
692 692
 }
693 693
 
694
-function getEmailableModules(){
694
+function getEmailableModules() {
695 695
     global $beanFiles, $beanList, $app_list_strings;
696 696
     $emailableModules = array();
697
-    foreach($app_list_strings['aow_moduleList'] as $bean_name => $bean_dis) {
698
-        if(isset($beanList[$bean_name]) && isset($beanFiles[$beanList[$bean_name]])){
697
+    foreach ($app_list_strings['aow_moduleList'] as $bean_name => $bean_dis) {
698
+        if (isset($beanList[$bean_name]) && isset($beanFiles[$beanList[$bean_name]])) {
699 699
             require_once($beanFiles[$beanList[$bean_name]]);
700 700
             $obj = new $beanList[$bean_name];
701
-            if($obj instanceof Person || $obj instanceof Company){
701
+            if ($obj instanceof Person || $obj instanceof Company) {
702 702
                 $emailableModules[] = $bean_name;
703 703
             }
704 704
         }
@@ -707,37 +707,37 @@  discard block
 block discarded – undo
707 707
     return $emailableModules;
708 708
 }
709 709
 
710
-function getRelatedEmailableFields($module){
710
+function getRelatedEmailableFields($module) {
711 711
     global $beanList, $app_list_strings;
712 712
     $relEmailFields = array();
713 713
     $checked_link = array();
714 714
     $emailableModules = getEmailableModules();
715 715
     if ($module != '') {
716
-        if(isset($beanList[$module]) && $beanList[$module]){
716
+        if (isset($beanList[$module]) && $beanList[$module]) {
717 717
             $mod = new $beanList[$module]();
718 718
 
719
-            foreach($mod->get_related_fields() as $field){
720
-                if(isset($field['link'])) $checked_link[] = $field['link'];
721
-                if(!isset($field['module']) || !in_array($field['module'],$emailableModules) || (isset($field['dbType']) && $field['dbType'] == "id")){
719
+            foreach ($mod->get_related_fields() as $field) {
720
+                if (isset($field['link'])) $checked_link[] = $field['link'];
721
+                if (!isset($field['module']) || !in_array($field['module'], $emailableModules) || (isset($field['dbType']) && $field['dbType'] == "id")) {
722 722
                     continue;
723 723
                 }
724
-                $relEmailFields[$field['name']] = $field['module'].": ".trim(translate($field['vname'],$mod->module_name),":");
724
+                $relEmailFields[$field['name']] = $field['module'].": ".trim(translate($field['vname'], $mod->module_name), ":");
725 725
             }
726 726
 
727
-            foreach($mod->get_linked_fields() as $field){
728
-                if(!in_array($field['name'],$checked_link) && !in_array($field['relationship'],$checked_link)){
729
-                    if(isset($field['module']) && $field['module'] != '') {
727
+            foreach ($mod->get_linked_fields() as $field) {
728
+                if (!in_array($field['name'], $checked_link) && !in_array($field['relationship'], $checked_link)) {
729
+                    if (isset($field['module']) && $field['module'] != '') {
730 730
                         $rel_module = $field['module'];
731
-                    } else if($mod->load_relationship($field['name'])){
731
+                    } else if ($mod->load_relationship($field['name'])) {
732 732
                         $relField = $field['name'];
733 733
                         $rel_module = $mod->$relField->getRelatedModuleName();
734 734
                     }
735 735
 
736
-                    if(in_array($rel_module,$emailableModules)) {
736
+                    if (in_array($rel_module, $emailableModules)) {
737 737
                         if (isset($field['vname']) && $field['vname'] != '') {
738
-                            $relEmailFields[$field['name']] = $app_list_strings['moduleList'][$rel_module] . ' : ' . translate($field['vname'], $mod->module_dir);
738
+                            $relEmailFields[$field['name']] = $app_list_strings['moduleList'][$rel_module].' : '.translate($field['vname'], $mod->module_dir);
739 739
                         } else {
740
-                            $relEmailFields[$field['name']] = $app_list_strings['moduleList'][$rel_module] . ' : ' . $field['name'];
740
+                            $relEmailFields[$field['name']] = $app_list_strings['moduleList'][$rel_module].' : '.$field['name'];
741 741
                         }
742 742
                     }
743 743
                 }
@@ -758,37 +758,37 @@  discard block
 block discarded – undo
758 758
     
759 759
     static $boolean_false_values = array('off', 'false', '0', 'no');
760 760
 
761
-    switch($bean->field_defs[$field]['type']) {
761
+    switch ($bean->field_defs[$field]['type']) {
762 762
         case 'datetime':
763 763
         case 'datetimecombo':
764
-            if(empty($value)) break;
764
+            if (empty($value)) break;
765 765
             if ($value == 'NULL') {
766 766
                 $value = '';
767 767
                 break;
768 768
             }
769
-            if ( ! preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$/',$value) ) {
769
+            if (!preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$/', $value)) {
770 770
                 // This appears to be formatted in user date/time
771 771
                 $value = $timedate->to_db($value);
772 772
             }
773 773
             break;
774 774
         case 'date':
775
-            if(empty($value)) break;
775
+            if (empty($value)) break;
776 776
             if ($value == 'NULL') {
777 777
                 $value = '';
778 778
                 break;
779 779
             }
780
-            if ( ! preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/',$value) ) {
780
+            if (!preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/', $value)) {
781 781
                 // This date appears to be formatted in the user's format
782 782
                 $value = $timedate->to_db_date($value, false);
783 783
             }
784 784
             break;
785 785
         case 'time':
786
-            if(empty($value)) break;
786
+            if (empty($value)) break;
787 787
             if ($value == 'NULL') {
788 788
                 $value = '';
789 789
                 break;
790 790
             }
791
-            if ( preg_match('/(am|pm)/i',$value) ) {
791
+            if (preg_match('/(am|pm)/i', $value)) {
792 792
                 // This time appears to be formatted in the user's format
793 793
                 $value = $timedate->fromUserTime($value)->format(TimeDate::DB_TIME_FORMAT);
794 794
             }
@@ -797,10 +797,10 @@  discard block
 block discarded – undo
797 797
         case 'decimal':
798 798
         case 'currency':
799 799
         case 'float':
800
-            if ( $value === '' || $value == NULL || $value == 'NULL') {
800
+            if ($value === '' || $value == NULL || $value == 'NULL') {
801 801
                 continue;
802 802
             }
803
-            if ( is_string($value) ) {
803
+            if (is_string($value)) {
804 804
                 $value = (float)unformat_number($value);
805 805
             }
806 806
             break;
@@ -810,19 +810,19 @@  discard block
 block discarded – undo
810 810
         case 'short':
811 811
         case 'tinyint':
812 812
         case 'int':
813
-            if ( $value === '' || $value == NULL || $value == 'NULL') {
813
+            if ($value === '' || $value == NULL || $value == 'NULL') {
814 814
                 continue;
815 815
             }
816
-            if ( is_string($value) ) {
816
+            if (is_string($value)) {
817 817
                 $value = (int)unformat_number($value);
818 818
             }
819 819
             break;
820 820
         case 'bool':
821 821
             if (empty($value)) {
822 822
                 $value = false;
823
-            } else if(true === $value || 1 == $value) {
823
+            } else if (true === $value || 1 == $value) {
824 824
                 $value = true;
825
-            } else if(in_array(strval($value), $boolean_false_values)) {
825
+            } else if (in_array(strval($value), $boolean_false_values)) {
826 826
                 $value = false;
827 827
             } else {
828 828
                 $value = true;
Please login to merge, or discard this patch.