Completed
Push — develop ( 0c0e51 )
by Adam
26:01 queued 12:43
created
custom/modules/unified_search_modules_display.php 2 patches
Indentation   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -1,140 +1,140 @@
 block discarded – undo
1 1
 <?php
2 2
 // created: 2014-01-29 09:59:23
3 3
 $unified_search_modules_display = array (
4
-  'AOP_Case_Events' => 
5
-  array (
4
+    'AOP_Case_Events' => 
5
+    array (
6 6
     'visible' => false,
7
-  ),
8
-  'AOP_Case_Updates' => 
9
-  array (
7
+    ),
8
+    'AOP_Case_Updates' => 
9
+    array (
10 10
     'visible' => false,
11
-  ),
12
-  'AOR_Reports' => 
13
-  array (
11
+    ),
12
+    'AOR_Reports' => 
13
+    array (
14 14
     'visible' => false,
15
-  ),
16
-  'AOS_Contracts' => 
17
-  array (
15
+    ),
16
+    'AOS_Contracts' => 
17
+    array (
18 18
     'visible' => false,
19
-  ),
20
-  'AOS_Invoices' => 
21
-  array (
19
+    ),
20
+    'AOS_Invoices' => 
21
+    array (
22 22
     'visible' => false,
23
-  ),
24
-  'AOS_PDF_Templates' => 
25
-  array (
23
+    ),
24
+    'AOS_PDF_Templates' => 
25
+    array (
26 26
     'visible' => false,
27
-  ),
28
-  'AOS_Product_Categories' => 
29
-  array (
27
+    ),
28
+    'AOS_Product_Categories' => 
29
+    array (
30 30
     'visible' => false,
31
-  ),
32
-  'AOS_Products' => 
33
-  array (
31
+    ),
32
+    'AOS_Products' => 
33
+    array (
34 34
     'visible' => false,
35
-  ),
36
-  'AOS_Quotes' => 
37
-  array (
35
+    ),
36
+    'AOS_Quotes' => 
37
+    array (
38 38
     'visible' => false,
39
-  ),
40
-  'AOW_Processed' => 
41
-  array (
39
+    ),
40
+    'AOW_Processed' => 
41
+    array (
42 42
     'visible' => false,
43
-  ),
44
-  'AOW_WorkFlow' => 
45
-  array (
43
+    ),
44
+    'AOW_WorkFlow' => 
45
+    array (
46 46
     'visible' => false,
47
-  ),
48
-  'Accounts' => 
49
-  array (
47
+    ),
48
+    'Accounts' => 
49
+    array (
50 50
     'visible' => true,
51
-  ),
52
-  'Bugs' => 
53
-  array (
51
+    ),
52
+    'Bugs' => 
53
+    array (
54 54
     'visible' => false,
55
-  ),
56
-  'Calls' => 
57
-  array (
55
+    ),
56
+    'Calls' => 
57
+    array (
58 58
     'visible' => true,
59
-  ),
60
-  'Calls_Reschedule' => 
61
-  array (
59
+    ),
60
+    'Calls_Reschedule' => 
61
+    array (
62 62
     'visible' => false,
63
-  ),
64
-  'Campaigns' => 
65
-  array (
63
+    ),
64
+    'Campaigns' => 
65
+    array (
66 66
     'visible' => false,
67
-  ),
68
-  'Cases' => 
69
-  array (
67
+    ),
68
+    'Cases' => 
69
+    array (
70 70
     'visible' => true,
71
-  ),
72
-  'Contacts' => 
73
-  array (
71
+    ),
72
+    'Contacts' => 
73
+    array (
74 74
     'visible' => true,
75
-  ),
76
-  'Documents' => 
77
-  array (
75
+    ),
76
+    'Documents' => 
77
+    array (
78 78
     'visible' => true,
79
-  ),
80
-  'FP_Event_Locations' => 
81
-  array (
79
+    ),
80
+    'FP_Event_Locations' => 
81
+    array (
82 82
     'visible' => false,
83
-  ),
84
-  'FP_events' => 
85
-  array (
83
+    ),
84
+    'FP_events' => 
85
+    array (
86 86
     'visible' => false,
87
-  ),
88
-  'Leads' => 
89
-  array (
87
+    ),
88
+    'Leads' => 
89
+    array (
90 90
     'visible' => true,
91
-  ),
92
-  'Meetings' => 
93
-  array (
91
+    ),
92
+    'Meetings' => 
93
+    array (
94 94
     'visible' => true,
95
-  ),
96
-  'Notes' => 
97
-  array (
95
+    ),
96
+    'Notes' => 
97
+    array (
98 98
     'visible' => true,
99
-  ),
100
-  'Opportunities' => 
101
-  array (
99
+    ),
100
+    'Opportunities' => 
101
+    array (
102 102
     'visible' => true,
103
-  ),
104
-  'Project' => 
105
-  array (
103
+    ),
104
+    'Project' => 
105
+    array (
106 106
     'visible' => false,
107
-  ),
108
-  'ProjectTask' => 
109
-  array (
107
+    ),
108
+    'ProjectTask' => 
109
+    array (
110 110
     'visible' => false,
111
-  ),
112
-  'ProspectLists' => 
113
-  array (
111
+    ),
112
+    'ProspectLists' => 
113
+    array (
114 114
     'visible' => false,
115
-  ),
116
-  'Prospects' => 
117
-  array (
115
+    ),
116
+    'Prospects' => 
117
+    array (
118 118
     'visible' => false,
119
-  ),
120
-  'Tasks' => 
121
-  array (
119
+    ),
120
+    'Tasks' => 
121
+    array (
122 122
     'visible' => false,
123
-  ),
124
-  'jjwg_Address_Cache' => 
125
-  array (
123
+    ),
124
+    'jjwg_Address_Cache' => 
125
+    array (
126 126
     'visible' => false,
127
-  ),
128
-  'jjwg_Areas' => 
129
-  array (
127
+    ),
128
+    'jjwg_Areas' => 
129
+    array (
130 130
     'visible' => false,
131
-  ),
132
-  'jjwg_Maps' => 
133
-  array (
131
+    ),
132
+    'jjwg_Maps' => 
133
+    array (
134 134
     'visible' => false,
135
-  ),
136
-  'jjwg_Markers' => 
137
-  array (
135
+    ),
136
+    'jjwg_Markers' => 
137
+    array (
138 138
     'visible' => false,
139
-  ),
139
+    ),
140 140
 );
141 141
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -1,140 +1,140 @@
 block discarded – undo
1 1
 <?php
2 2
 // created: 2014-01-29 09:59:23
3
-$unified_search_modules_display = array (
3
+$unified_search_modules_display = array(
4 4
   'AOP_Case_Events' => 
5
-  array (
5
+  array(
6 6
     'visible' => false,
7 7
   ),
8 8
   'AOP_Case_Updates' => 
9
-  array (
9
+  array(
10 10
     'visible' => false,
11 11
   ),
12 12
   'AOR_Reports' => 
13
-  array (
13
+  array(
14 14
     'visible' => false,
15 15
   ),
16 16
   'AOS_Contracts' => 
17
-  array (
17
+  array(
18 18
     'visible' => false,
19 19
   ),
20 20
   'AOS_Invoices' => 
21
-  array (
21
+  array(
22 22
     'visible' => false,
23 23
   ),
24 24
   'AOS_PDF_Templates' => 
25
-  array (
25
+  array(
26 26
     'visible' => false,
27 27
   ),
28 28
   'AOS_Product_Categories' => 
29
-  array (
29
+  array(
30 30
     'visible' => false,
31 31
   ),
32 32
   'AOS_Products' => 
33
-  array (
33
+  array(
34 34
     'visible' => false,
35 35
   ),
36 36
   'AOS_Quotes' => 
37
-  array (
37
+  array(
38 38
     'visible' => false,
39 39
   ),
40 40
   'AOW_Processed' => 
41
-  array (
41
+  array(
42 42
     'visible' => false,
43 43
   ),
44 44
   'AOW_WorkFlow' => 
45
-  array (
45
+  array(
46 46
     'visible' => false,
47 47
   ),
48 48
   'Accounts' => 
49
-  array (
49
+  array(
50 50
     'visible' => true,
51 51
   ),
52 52
   'Bugs' => 
53
-  array (
53
+  array(
54 54
     'visible' => false,
55 55
   ),
56 56
   'Calls' => 
57
-  array (
57
+  array(
58 58
     'visible' => true,
59 59
   ),
60 60
   'Calls_Reschedule' => 
61
-  array (
61
+  array(
62 62
     'visible' => false,
63 63
   ),
64 64
   'Campaigns' => 
65
-  array (
65
+  array(
66 66
     'visible' => false,
67 67
   ),
68 68
   'Cases' => 
69
-  array (
69
+  array(
70 70
     'visible' => true,
71 71
   ),
72 72
   'Contacts' => 
73
-  array (
73
+  array(
74 74
     'visible' => true,
75 75
   ),
76 76
   'Documents' => 
77
-  array (
77
+  array(
78 78
     'visible' => true,
79 79
   ),
80 80
   'FP_Event_Locations' => 
81
-  array (
81
+  array(
82 82
     'visible' => false,
83 83
   ),
84 84
   'FP_events' => 
85
-  array (
85
+  array(
86 86
     'visible' => false,
87 87
   ),
88 88
   'Leads' => 
89
-  array (
89
+  array(
90 90
     'visible' => true,
91 91
   ),
92 92
   'Meetings' => 
93
-  array (
93
+  array(
94 94
     'visible' => true,
95 95
   ),
96 96
   'Notes' => 
97
-  array (
97
+  array(
98 98
     'visible' => true,
99 99
   ),
100 100
   'Opportunities' => 
101
-  array (
101
+  array(
102 102
     'visible' => true,
103 103
   ),
104 104
   'Project' => 
105
-  array (
105
+  array(
106 106
     'visible' => false,
107 107
   ),
108 108
   'ProjectTask' => 
109
-  array (
109
+  array(
110 110
     'visible' => false,
111 111
   ),
112 112
   'ProspectLists' => 
113
-  array (
113
+  array(
114 114
     'visible' => false,
115 115
   ),
116 116
   'Prospects' => 
117
-  array (
117
+  array(
118 118
     'visible' => false,
119 119
   ),
120 120
   'Tasks' => 
121
-  array (
121
+  array(
122 122
     'visible' => false,
123 123
   ),
124 124
   'jjwg_Address_Cache' => 
125
-  array (
125
+  array(
126 126
     'visible' => false,
127 127
   ),
128 128
   'jjwg_Areas' => 
129
-  array (
129
+  array(
130 130
     'visible' => false,
131 131
   ),
132 132
   'jjwg_Maps' => 
133
-  array (
133
+  array(
134 134
     'visible' => false,
135 135
   ),
136 136
   'jjwg_Markers' => 
137
-  array (
137
+  array(
138 138
     'visible' => false,
139 139
   ),
140 140
 );
141 141
\ No newline at end of file
Please login to merge, or discard this patch.
custom/Extension/application/Ext/LogicHooks/AOW_WorkFlow_Hook.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,4 +28,4 @@
 block discarded – undo
28 28
 if (!isset($hook_array['after_save']) || !is_array($hook_array['after_save'])) {
29 29
     $hook_array['after_save'] = array();
30 30
 }
31
-$hook_array['after_save'][] = Array(99, 'AOW_Workflow', 'modules/AOW_WorkFlow/AOW_WorkFlow.php','AOW_WorkFlow', 'run_bean_flows');
32 31
\ No newline at end of file
32
+$hook_array['after_save'][] = Array(99, 'AOW_Workflow', 'modules/AOW_WorkFlow/AOW_WorkFlow.php', 'AOW_WorkFlow', 'run_bean_flows');
33 33
\ No newline at end of file
Please login to merge, or discard this patch.
include/SugarFields/Fields/Datetimecombo/SugarFieldDatetimecombo.php 3 patches
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -44,19 +44,19 @@  discard block
 block discarded – undo
44 44
     function getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
45 45
         // Create Smarty variables for the Calendar picker widget
46 46
         if(!isset($displayParams['showMinutesDropdown'])) {
47
-           $displayParams['showMinutesDropdown'] = false;
47
+            $displayParams['showMinutesDropdown'] = false;
48 48
         }
49 49
 
50 50
         if(!isset($displayParams['showHoursDropdown'])) {
51
-           $displayParams['showHoursDropdown'] = false;
51
+            $displayParams['showHoursDropdown'] = false;
52 52
         }
53 53
 
54 54
         if(!isset($displayParams['showNoneCheckbox'])) {
55
-           $displayParams['showNoneCheckbox'] = false;
55
+            $displayParams['showNoneCheckbox'] = false;
56 56
         }
57 57
 
58 58
         if(!isset($displayParams['showFormats'])) {
59
-           $displayParams['showFormats'] = false;
59
+            $displayParams['showFormats'] = false;
60 60
         }
61 61
 
62 62
         global $timedate;
@@ -75,44 +75,44 @@  discard block
 block discarded – undo
75 75
 	
76 76
     function getSearchViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
77 77
 
78
-    	 if($this->isRangeSearchView($vardef)) {
79
-           $displayParams['showMinutesDropdown'] = false;
80
-           $displayParams['showHoursDropdown'] = false;
81
-           $displayParams['showNoneCheckbox'] = false;
82
-           $displayParams['showFormats'] = false;
83
-	       global $timedate, $current_language;
84
-	       $displayParams['dateFormat'] = $timedate->get_cal_date_format();
85
-	       $displayParams['timeFormat'] = $timedate->get_user_time_format();
86
-
87
-           $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
88
-           $id = isset($displayParams['idName']) ? $displayParams['idName'] : $vardef['name'];
89
-           $this->ss->assign('original_id', "{$id}");
90
-           $this->ss->assign('id_range', "range_{$id}");
91
-           $this->ss->assign('id_range_start', "start_range_{$id}");
92
-           $this->ss->assign('id_range_end', "end_range_{$id}");
93
-           $this->ss->assign('id_range_choice', "{$id}_range_choice");
94
-           if(file_exists('custom/include/SugarFields/Fields/Datetimecombo/RangeSearchForm.tpl'))
95
-           {
96
-              return $this->fetch('custom/include/SugarFields/Fields/Datetimecombo/RangeSearchForm.tpl');
97
-           }
98
-           return $this->fetch('include/SugarFields/Fields/Datetimecombo/RangeSearchForm.tpl');
78
+            if($this->isRangeSearchView($vardef)) {
79
+            $displayParams['showMinutesDropdown'] = false;
80
+            $displayParams['showHoursDropdown'] = false;
81
+            $displayParams['showNoneCheckbox'] = false;
82
+            $displayParams['showFormats'] = false;
83
+            global $timedate, $current_language;
84
+            $displayParams['dateFormat'] = $timedate->get_cal_date_format();
85
+            $displayParams['timeFormat'] = $timedate->get_user_time_format();
86
+
87
+            $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
88
+            $id = isset($displayParams['idName']) ? $displayParams['idName'] : $vardef['name'];
89
+            $this->ss->assign('original_id', "{$id}");
90
+            $this->ss->assign('id_range', "range_{$id}");
91
+            $this->ss->assign('id_range_start', "start_range_{$id}");
92
+            $this->ss->assign('id_range_end', "end_range_{$id}");
93
+            $this->ss->assign('id_range_choice', "{$id}_range_choice");
94
+            if(file_exists('custom/include/SugarFields/Fields/Datetimecombo/RangeSearchForm.tpl'))
95
+            {
96
+                return $this->fetch('custom/include/SugarFields/Fields/Datetimecombo/RangeSearchForm.tpl');
97
+            }
98
+            return $this->fetch('include/SugarFields/Fields/Datetimecombo/RangeSearchForm.tpl');
99 99
         }
100 100
 
101
-    	// Create Smarty variables for the Calendar picker widget
101
+        // Create Smarty variables for the Calendar picker widget
102 102
         if(!isset($displayParams['showMinutesDropdown'])) {
103
-           $displayParams['showMinutesDropdown'] = false;
103
+            $displayParams['showMinutesDropdown'] = false;
104 104
         }
105 105
 
106 106
         if(!isset($displayParams['showHoursDropdown'])) {
107
-           $displayParams['showHoursDropdown'] = false;
107
+            $displayParams['showHoursDropdown'] = false;
108 108
         }
109 109
 
110 110
         if(!isset($displayParams['showNoneCheckbox'])) {
111
-           $displayParams['showNoneCheckbox'] = false;
111
+            $displayParams['showNoneCheckbox'] = false;
112 112
         }
113 113
 
114 114
         if(!isset($displayParams['showFormats'])) {
115
-           $displayParams['showFormats'] = false;
115
+            $displayParams['showFormats'] = false;
116 116
         }
117 117
 
118 118
         global $timedate;
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
     }
125 125
 
126 126
 
127
-	public function getEmailTemplateValue($inputField, $vardef, $context = null, $tabindex = 0){
127
+    public function getEmailTemplateValue($inputField, $vardef, $context = null, $tabindex = 0){
128 128
         // This does not return a smarty section, instead it returns a direct value
129 129
         if(isset($context['notify_user'])) {
130 130
             $user = $context['notify_user'];
@@ -143,14 +143,14 @@  discard block
 block discarded – undo
143 143
 
144 144
         if(strpos($params[$prefix.$field], ' ') > 0) {
145 145
             if ($timedate->check_matching_format($params[$prefix.$field], TimeDate::DB_DATETIME_FORMAT)) {
146
-	            $bean->$field = $params[$prefix.$field];
146
+                $bean->$field = $params[$prefix.$field];
147 147
             } else {
148 148
                 $bean->$field = $timedate->to_db($params[$prefix.$field]);
149 149
             }
150 150
         } else {
151
-        	$GLOBALS['log']->error('Field ' . $prefix.$field . ' expecting datetime format, but got value: ' . $params[$prefix.$field]);
152
-	        //Default to assume date format value
153
-        	if ($timedate->check_matching_format($params[$prefix.$field], TimeDate::DB_DATE_FORMAT)) {
151
+            $GLOBALS['log']->error('Field ' . $prefix.$field . ' expecting datetime format, but got value: ' . $params[$prefix.$field]);
152
+            //Default to assume date format value
153
+            if ($timedate->check_matching_format($params[$prefix.$field], TimeDate::DB_DATE_FORMAT)) {
154 154
                 $bean->$field = $params[$prefix.$field];
155 155
             } else {
156 156
                 $bean->$field = $timedate->to_db_date($params[$prefix.$field]);
@@ -175,10 +175,10 @@  discard block
 block discarded – undo
175 175
         if ( !$timedate->check_matching_format($value, $format) ) {
176 176
             $parts = $timedate->split_date_time($value);
177 177
             if(empty($parts[0])) {
178
-               $datepart = $timedate->getNow()->format($settings->dateformat);
178
+                $datepart = $timedate->getNow()->format($settings->dateformat);
179 179
             }
180 180
             else {
181
-               $datepart = $parts[0];
181
+                $datepart = $parts[0];
182 182
             }
183 183
             if(empty($parts[1])) {
184 184
                 $timepart = $timedate->fromTimestamp(0)->format($settings->timeformat);
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -43,19 +43,19 @@  discard block
 block discarded – undo
43 43
 
44 44
     function getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
45 45
         // Create Smarty variables for the Calendar picker widget
46
-        if(!isset($displayParams['showMinutesDropdown'])) {
46
+        if (!isset($displayParams['showMinutesDropdown'])) {
47 47
            $displayParams['showMinutesDropdown'] = false;
48 48
         }
49 49
 
50
-        if(!isset($displayParams['showHoursDropdown'])) {
50
+        if (!isset($displayParams['showHoursDropdown'])) {
51 51
            $displayParams['showHoursDropdown'] = false;
52 52
         }
53 53
 
54
-        if(!isset($displayParams['showNoneCheckbox'])) {
54
+        if (!isset($displayParams['showNoneCheckbox'])) {
55 55
            $displayParams['showNoneCheckbox'] = false;
56 56
         }
57 57
 
58
-        if(!isset($displayParams['showFormats'])) {
58
+        if (!isset($displayParams['showFormats'])) {
59 59
            $displayParams['showFormats'] = false;
60 60
         }
61 61
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	
76 76
     function getSearchViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
77 77
 
78
-    	 if($this->isRangeSearchView($vardef)) {
78
+    	 if ($this->isRangeSearchView($vardef)) {
79 79
            $displayParams['showMinutesDropdown'] = false;
80 80
            $displayParams['showHoursDropdown'] = false;
81 81
            $displayParams['showNoneCheckbox'] = false;
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
            $this->ss->assign('id_range_start', "start_range_{$id}");
92 92
            $this->ss->assign('id_range_end', "end_range_{$id}");
93 93
            $this->ss->assign('id_range_choice', "{$id}_range_choice");
94
-           if(file_exists('custom/include/SugarFields/Fields/Datetimecombo/RangeSearchForm.tpl'))
94
+           if (file_exists('custom/include/SugarFields/Fields/Datetimecombo/RangeSearchForm.tpl'))
95 95
            {
96 96
               return $this->fetch('custom/include/SugarFields/Fields/Datetimecombo/RangeSearchForm.tpl');
97 97
            }
@@ -99,19 +99,19 @@  discard block
 block discarded – undo
99 99
         }
100 100
 
101 101
     	// Create Smarty variables for the Calendar picker widget
102
-        if(!isset($displayParams['showMinutesDropdown'])) {
102
+        if (!isset($displayParams['showMinutesDropdown'])) {
103 103
            $displayParams['showMinutesDropdown'] = false;
104 104
         }
105 105
 
106
-        if(!isset($displayParams['showHoursDropdown'])) {
106
+        if (!isset($displayParams['showHoursDropdown'])) {
107 107
            $displayParams['showHoursDropdown'] = false;
108 108
         }
109 109
 
110
-        if(!isset($displayParams['showNoneCheckbox'])) {
110
+        if (!isset($displayParams['showNoneCheckbox'])) {
111 111
            $displayParams['showNoneCheckbox'] = false;
112 112
         }
113 113
 
114
-        if(!isset($displayParams['showFormats'])) {
114
+        if (!isset($displayParams['showFormats'])) {
115 115
            $displayParams['showFormats'] = false;
116 116
         }
117 117
 
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
     }
125 125
 
126 126
 
127
-	public function getEmailTemplateValue($inputField, $vardef, $context = null, $tabindex = 0){
127
+	public function getEmailTemplateValue($inputField, $vardef, $context = null, $tabindex = 0) {
128 128
         // This does not return a smarty section, instead it returns a direct value
129
-        if(isset($context['notify_user'])) {
129
+        if (isset($context['notify_user'])) {
130 130
             $user = $context['notify_user'];
131 131
         } else {
132 132
             $user = $GLOBALS['current_user'];
@@ -136,19 +136,19 @@  discard block
 block discarded – undo
136 136
     
137 137
     public function save(&$bean, $params, $field, $properties, $prefix = '') {
138 138
         global $timedate;
139
-        if ( !isset($params[$prefix.$field]) ) {
139
+        if (!isset($params[$prefix.$field])) {
140 140
             //$bean->$field = '';
141 141
             return;
142 142
         }
143 143
 
144
-        if(strpos($params[$prefix.$field], ' ') > 0) {
144
+        if (strpos($params[$prefix.$field], ' ') > 0) {
145 145
             if ($timedate->check_matching_format($params[$prefix.$field], TimeDate::DB_DATETIME_FORMAT)) {
146 146
 	            $bean->$field = $params[$prefix.$field];
147 147
             } else {
148 148
                 $bean->$field = $timedate->to_db($params[$prefix.$field]);
149 149
             }
150 150
         } else {
151
-        	$GLOBALS['log']->error('Field ' . $prefix.$field . ' expecting datetime format, but got value: ' . $params[$prefix.$field]);
151
+        	$GLOBALS['log']->error('Field '.$prefix.$field.' expecting datetime format, but got value: '.$params[$prefix.$field]);
152 152
 	        //Default to assume date format value
153 153
         	if ($timedate->check_matching_format($params[$prefix.$field], TimeDate::DB_DATE_FORMAT)) {
154 154
                 $bean->$field = $params[$prefix.$field];
@@ -172,39 +172,39 @@  discard block
 block discarded – undo
172 172
 
173 173
         $format = $timedate->merge_date_time($settings->dateformat, $settings->timeformat);
174 174
 
175
-        if ( !$timedate->check_matching_format($value, $format) ) {
175
+        if (!$timedate->check_matching_format($value, $format)) {
176 176
             $parts = $timedate->split_date_time($value);
177
-            if(empty($parts[0])) {
177
+            if (empty($parts[0])) {
178 178
                $datepart = $timedate->getNow()->format($settings->dateformat);
179 179
             }
180 180
             else {
181 181
                $datepart = $parts[0];
182 182
             }
183
-            if(empty($parts[1])) {
183
+            if (empty($parts[1])) {
184 184
                 $timepart = $timedate->fromTimestamp(0)->format($settings->timeformat);
185 185
             } else {
186 186
                 $timepart = $parts[1];
187 187
                 // see if we can get by stripping the seconds
188
-                if(strpos($settings->timeformat, 's') === false) {
188
+                if (strpos($settings->timeformat, 's') === false) {
189 189
                     $sep = $timedate->timeSeparatorFormat($settings->timeformat);
190 190
                     // We are assuming here seconds are the last component, which
191 191
                     // is kind of reasonable - no sane time format puts seconds first
192 192
                     $timeparts = explode($sep, $timepart);
193
-                    if(!empty($timeparts[2])) {
193
+                    if (!empty($timeparts[2])) {
194 194
                         $timepart = join($sep, array($timeparts[0], $timeparts[1]));
195 195
                     }
196 196
                 }
197 197
             }
198 198
 
199 199
             $value = $timedate->merge_date_time($datepart, $timepart);
200
-            if ( !$timedate->check_matching_format($value, $format) ) {
200
+            if (!$timedate->check_matching_format($value, $format)) {
201 201
                 return false;
202 202
             }
203 203
         }
204 204
 
205 205
         try {
206 206
             $date = SugarDateTime::createFromFormat($format, $value, new DateTimeZone($settings->timezone));
207
-        } catch(Exception $e) {
207
+        }catch (Exception $e) {
208 208
             return false;
209 209
         }
210 210
         return $date->asDb();
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -176,8 +176,7 @@
 block discarded – undo
176 176
             $parts = $timedate->split_date_time($value);
177 177
             if(empty($parts[0])) {
178 178
                $datepart = $timedate->getNow()->format($settings->dateformat);
179
-            }
180
-            else {
179
+            } else {
181 180
                $datepart = $parts[0];
182 181
             }
183 182
             if(empty($parts[1])) {
Please login to merge, or discard this patch.
SugarFields/Fields/Assigned_user_name/SugarFieldAssigned_user_name.php 3 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -41,14 +41,14 @@
 block discarded – undo
41 41
 
42 42
 class SugarFieldAssigned_user_name extends SugarFieldBase {
43 43
 
44
-	function getSearchViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
45
-    	$vardef['options'] = get_user_array(false);
46
-		if(!empty($vardef['function']['returns']) && $vardef['function']['returns']== 'html'){
47
-    	   $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
48
-           return $this->fetch($this->findTemplate('EditViewFunction'));
49
-    	}else{
50
-    	   $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
51
-           return $this->fetch($this->findTemplate('SearchView'));
52
-    	}
44
+    function getSearchViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
45
+        $vardef['options'] = get_user_array(false);
46
+        if(!empty($vardef['function']['returns']) && $vardef['function']['returns']== 'html'){
47
+            $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
48
+            return $this->fetch($this->findTemplate('EditViewFunction'));
49
+        }else{
50
+            $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
51
+            return $this->fetch($this->findTemplate('SearchView'));
52
+        }
53 53
     }
54 54
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,10 +43,10 @@
 block discarded – undo
43 43
 
44 44
 	function getSearchViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
45 45
     	$vardef['options'] = get_user_array(false);
46
-		if(!empty($vardef['function']['returns']) && $vardef['function']['returns']== 'html'){
46
+		if (!empty($vardef['function']['returns']) && $vardef['function']['returns'] == 'html') {
47 47
     	   $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
48 48
            return $this->fetch($this->findTemplate('EditViewFunction'));
49
-    	}else{
49
+    	} else {
50 50
     	   $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
51 51
            return $this->fetch($this->findTemplate('SearchView'));
52 52
     	}
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
 		if(!empty($vardef['function']['returns']) && $vardef['function']['returns']== 'html'){
47 47
     	   $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
48 48
            return $this->fetch($this->findTemplate('EditViewFunction'));
49
-    	}else{
49
+    	} else{
50 50
     	   $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
51 51
            return $this->fetch($this->findTemplate('SearchView'));
52 52
     	}
Please login to merge, or discard this patch.
include/SugarFields/Fields/Text/SugarFieldText.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 require_once 'include/clean.php';
42 42
 class SugarFieldText extends SugarFieldBase {
43 43
 
44
-	function getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
44
+    function getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
45 45
         if(!isset($displayParams['nl2br'])){
46 46
             $displayParams['nl2br'] = true;
47 47
         }
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         if(!isset($displayParams['url2html'])) {
52 52
             $displayParams['url2html'] = true;
53 53
         }
54
-		return parent::getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex);
54
+        return parent::getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex);
55 55
     }
56 56
     function getClassicEditView($field_id='description', $value='', $prefix='', $rich_text=false, $maxlength='', $tabindex=1, $cols=80, $rows=4) {
57 57
 
@@ -68,19 +68,19 @@  discard block
 block discarded – undo
68 68
 
69 69
 
70 70
         $this->ss->assign('displayParams', $displayParams);
71
-		if(isset($GLOBALS['current_user'])) {
72
-			$height = $GLOBALS['current_user']->getPreference('text_editor_height');
73
-			$width = $GLOBALS['current_user']->getPreference('text_editor_width');
74
-			$height = isset($height) ? $height : '300px';
75
-	        $width = isset($width) ? $width : '95%';
76
-			$this->ss->assign('RICH_TEXT_EDITOR_HEIGHT', $height);
77
-			$this->ss->assign('RICH_TEXT_EDITOR_WIDTH', $width);
78
-		} else {
79
-			$this->ss->assign('RICH_TEXT_EDITOR_HEIGHT', '100px');
80
-			$this->ss->assign('RICH_TEXT_EDITOR_WIDTH', '95%');
81
-		}
71
+        if(isset($GLOBALS['current_user'])) {
72
+            $height = $GLOBALS['current_user']->getPreference('text_editor_height');
73
+            $width = $GLOBALS['current_user']->getPreference('text_editor_width');
74
+            $height = isset($height) ? $height : '300px';
75
+            $width = isset($width) ? $width : '95%';
76
+            $this->ss->assign('RICH_TEXT_EDITOR_HEIGHT', $height);
77
+            $this->ss->assign('RICH_TEXT_EDITOR_WIDTH', $width);
78
+        } else {
79
+            $this->ss->assign('RICH_TEXT_EDITOR_HEIGHT', '100px');
80
+            $this->ss->assign('RICH_TEXT_EDITOR_WIDTH', '95%');
81
+        }
82 82
 
83
-		return $this->ss->fetch($this->findTemplate('ClassicEditView'));
83
+        return $this->ss->fetch($this->findTemplate('ClassicEditView'));
84 84
     }
85 85
 }
86 86
 ?>
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -42,18 +42,18 @@  discard block
 block discarded – undo
42 42
 class SugarFieldText extends SugarFieldBase {
43 43
 
44 44
 	function getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
45
-        if(!isset($displayParams['nl2br'])){
45
+        if (!isset($displayParams['nl2br'])) {
46 46
             $displayParams['nl2br'] = true;
47 47
         }
48
-        if(!isset($displayParams['htmlescape'])) {
48
+        if (!isset($displayParams['htmlescape'])) {
49 49
             $displayParams['htmlescape'] = true;
50 50
         }
51
-        if(!isset($displayParams['url2html'])) {
51
+        if (!isset($displayParams['url2html'])) {
52 52
             $displayParams['url2html'] = true;
53 53
         }
54 54
 		return parent::getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex);
55 55
     }
56
-    function getClassicEditView($field_id='description', $value='', $prefix='', $rich_text=false, $maxlength='', $tabindex=1, $cols=80, $rows=4) {
56
+    function getClassicEditView($field_id = 'description', $value = '', $prefix = '', $rich_text = false, $maxlength = '', $tabindex = 1, $cols = 80, $rows = 4) {
57 57
 
58 58
         $this->ss->assign('prefix', $prefix);
59 59
         $this->ss->assign('field_id', $field_id);
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
 
70 70
         $this->ss->assign('displayParams', $displayParams);
71
-		if(isset($GLOBALS['current_user'])) {
71
+		if (isset($GLOBALS['current_user'])) {
72 72
 			$height = $GLOBALS['current_user']->getPreference('text_editor_height');
73 73
 			$width = $GLOBALS['current_user']->getPreference('text_editor_width');
74 74
 			$height = isset($height) ? $height : '300px';
Please login to merge, or discard this patch.
include/SugarFields/Fields/CronSchedule/SugarFieldCronSchedule.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -3,48 +3,48 @@
 block discarded – undo
3 3
 
4 4
 class SugarFieldCronSchedule extends SugarFieldBase {
5 5
 
6
-    private function getDays(){
6
+    private function getDays() {
7 7
         $days = array();
8 8
         $date = new DateTime("1986-05-01");
9 9
         $period = new DateInterval('P1D');
10
-        for($x = 1; $x <= 31; $x++){
11
-            $days[$x] = $date->format('jS');;
10
+        for ($x = 1; $x <= 31; $x++) {
11
+            $days[$x] = $date->format('jS'); ;
12 12
             $date->add($period);
13 13
         }
14 14
         return $days;
15 15
     }
16
-    private function getWeekDays(){
16
+    private function getWeekDays() {
17 17
         $days = array();
18 18
         $date = new DateTime("1986-05-04");
19 19
         $period = new DateInterval('P1D');
20
-        for($x = 0; $x < 7; $x++){
20
+        for ($x = 0; $x < 7; $x++) {
21 21
             $days[$x] = $date->format('D');
22 22
             $date->add($period);
23 23
         }
24 24
         return $days;
25 25
     }
26 26
 
27
-    function getHumanReadable($schedule){
27
+    function getHumanReadable($schedule) {
28 28
 
29 29
     }
30 30
 
31 31
     function setup($parentFieldArray, $vardef, $displayParams, $tabindex, $twopass = true) {
32
-        global $app_list_strings,$app_strings;
32
+        global $app_list_strings, $app_strings;
33 33
         parent::setup($parentFieldArray, $vardef, $displayParams, $tabindex, $twopass);
34
-        $this->ss->assign('APP',$app_strings);
35
-        $this->ss->assign('types',get_select_options_with_id($app_list_strings['aor_scheduled_report_schedule_types'],''));
34
+        $this->ss->assign('APP', $app_strings);
35
+        $this->ss->assign('types', get_select_options_with_id($app_list_strings['aor_scheduled_report_schedule_types'], ''));
36 36
         $weekdays = $this->getWeekDays();
37
-        $this->ss->assign('weekday_vals',json_encode($weekdays));
38
-        $this->ss->assign('weekdays',get_select_options($weekdays,''));
37
+        $this->ss->assign('weekday_vals', json_encode($weekdays));
38
+        $this->ss->assign('weekdays', get_select_options($weekdays, ''));
39 39
         $days = $this->getDays();
40
-        $this->ss->assign('days',get_select_options($days,''));
41
-        function padNumbers($x){
42
-            return str_pad($x,2,'0',STR_PAD_LEFT);
40
+        $this->ss->assign('days', get_select_options($days, ''));
41
+        function padNumbers($x) {
42
+            return str_pad($x, 2, '0', STR_PAD_LEFT);
43 43
         }
44
-        $minutes = array_map('padNumbers',range(0,59));
45
-        $hours = array_map('padNumbers',range(0,23));
46
-        $this->ss->assign('minutes',get_select_options($minutes,''));
47
-        $this->ss->assign('hours',get_select_options($hours,''));
44
+        $minutes = array_map('padNumbers', range(0, 59));
45
+        $hours = array_map('padNumbers', range(0, 23));
46
+        $this->ss->assign('minutes', get_select_options($minutes, ''));
47
+        $this->ss->assign('hours', get_select_options($hours, ''));
48 48
     }
49 49
 
50 50
 
Please login to merge, or discard this patch.
include/SugarEmailAddress/SugarEmailAddress.php 3 patches
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     var $object_name = 'EmailAddress';
57 57
 
58 58
     //bug 40068, According to rules in page 6 of http://www.apps.ietf.org/rfc/rfc3696.html#sec-3,
59
-	//allowed special characters ! # $ % & ' * + - / = ?  ^ _ ` . { | } ~ in local part
59
+    //allowed special characters ! # $ % & ' * + - / = ?  ^ _ ` . { | } ~ in local part
60 60
     var $regex = "/^(?:['\.\-\+&#!\$\*=\?\^_`\{\}~\/\w]+)@(?:(?:\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|\w+(?:[\.-]*\w+)*(?:\.[\w-]{2,})+)\$/";
61 61
     var $disable_custom_fields = true;
62 62
     var $db;
@@ -391,8 +391,8 @@  discard block
 block discarded – undo
391 391
             // determine which array to process
392 392
             foreach($_REQUEST as $k => $v) {
393 393
                 if(strpos($k, 'emailAddress') !== false) {
394
-                   $fromRequest = true;
395
-                   break;
394
+                    $fromRequest = true;
395
+                    break;
396 396
                 }
397 397
             $widget_id = $_REQUEST[$module .'_email_widget_id'];
398 398
     }
@@ -409,30 +409,30 @@  discard block
 block discarded – undo
409 409
 
410 410
                 $eId = $module . $widget_id;
411 411
                 if(isset($_REQUEST[$eId . 'emailAddressPrimaryFlag'])) {
412
-                   $primaryValue = $_REQUEST[$eId . 'emailAddressPrimaryFlag'];
412
+                    $primaryValue = $_REQUEST[$eId . 'emailAddressPrimaryFlag'];
413 413
                 } else if(isset($_REQUEST[$module . 'emailAddressPrimaryFlag'])) {
414
-                   $primaryValue = $_REQUEST[$module . 'emailAddressPrimaryFlag'];
414
+                    $primaryValue = $_REQUEST[$module . 'emailAddressPrimaryFlag'];
415 415
                 }
416 416
 
417 417
                 $optOutValues = array();
418 418
                 if(isset($_REQUEST[$eId .'emailAddressOptOutFlag'])) {
419
-                   $optOutValues = $_REQUEST[$eId .'emailAddressOptOutFlag'];
419
+                    $optOutValues = $_REQUEST[$eId .'emailAddressOptOutFlag'];
420 420
                 } else if(isset($_REQUEST[$module . 'emailAddressOptOutFlag'])) {
421
-                   $optOutValues = $_REQUEST[$module . 'emailAddressOptOutFlag'];
421
+                    $optOutValues = $_REQUEST[$module . 'emailAddressOptOutFlag'];
422 422
                 }
423 423
 
424 424
                 $invalidValues = array();
425 425
                 if(isset($_REQUEST[$eId .'emailAddressInvalidFlag'])) {
426
-                   $invalidValues = $_REQUEST[$eId .'emailAddressInvalidFlag'];
426
+                    $invalidValues = $_REQUEST[$eId .'emailAddressInvalidFlag'];
427 427
                 } else if(isset($_REQUEST[$module . 'emailAddressInvalidFlag'])) {
428
-                   $invalidValues = $_REQUEST[$module . 'emailAddressInvalidFlag'];
428
+                    $invalidValues = $_REQUEST[$module . 'emailAddressInvalidFlag'];
429 429
                 }
430 430
 
431 431
                 $deleteValues = array();
432 432
                 if(isset($_REQUEST[$eId .'emailAddressDeleteFlag'])) {
433
-                   $deleteValues = $_REQUEST[$eId .'emailAddressDeleteFlag'];
433
+                    $deleteValues = $_REQUEST[$eId .'emailAddressDeleteFlag'];
434 434
                 } else if(isset($_REQUEST[$module . 'emailAddressDeleteFlag'])) {
435
-                   $deleteValues = $_REQUEST[$module . 'emailAddressDeleteFlag'];
435
+                    $deleteValues = $_REQUEST[$module . 'emailAddressDeleteFlag'];
436 436
                 }
437 437
 
438 438
                 // prep from form save
@@ -446,9 +446,9 @@  discard block
 block discarded – undo
446 446
 
447 447
                 if($fromRequest && empty($replyTo)) {
448 448
                     if(isset($_REQUEST[$eId .'emailAddressReplyToFlag'])) {
449
-                       $replyToField = $_REQUEST[$eId .'emailAddressReplyToFlag'];
449
+                        $replyToField = $_REQUEST[$eId .'emailAddressReplyToFlag'];
450 450
                     } else if(isset($_REQUEST[$module . 'emailAddressReplyToFlag'])) {
451
-                       $replyToField = $_REQUEST[$module . 'emailAddressReplyToFlag'];
451
+                        $replyToField = $_REQUEST[$module . 'emailAddressReplyToFlag'];
452 452
                     }
453 453
                 }
454 454
                 if($fromRequest && empty($new_addrs)) {
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
                         if(preg_match('/'.$eId.'emailAddressVerifiedValue[0-9]+$/i', $k) && !empty($v)) {
473 473
                             $validateFlag = str_replace("Value", "Flag", $k);
474 474
                             if (isset($_REQUEST[$validateFlag]) && $_REQUEST[$validateFlag] == "true")
475
-                              $new_addrs[$k] = $v;
475
+                                $new_addrs[$k] = $v;
476 476
                         }
477 477
                     }
478 478
                 }
@@ -484,18 +484,18 @@  discard block
 block discarded – undo
484 484
                     $optOutValues = array();
485 485
                     $invalidValues = array();
486 486
                     foreach($new_addrs as $k=>$email) {
487
-                       preg_match('/emailAddress([0-9])+$/', $k, $matches);
488
-                       $count = $matches[1];
489
-                       $result = $this->db->query("SELECT opt_out, invalid_email from email_addresses where email_address_caps = '" . $this->db->quote(strtoupper($email)) . "'");
490
-                       if(!empty($result)) {
491
-                          $row=$this->db->fetchByAssoc($result);
492
-                          if(!empty($row['opt_out'])) {
493
-                             $optOutValues[$k] = "emailAddress$count";
494
-                          }
495
-                          if(!empty($row['invalid_email'])) {
496
-                             $invalidValues[$k] = "emailAddress$count";
497
-                          }
498
-                       }
487
+                        preg_match('/emailAddress([0-9])+$/', $k, $matches);
488
+                        $count = $matches[1];
489
+                        $result = $this->db->query("SELECT opt_out, invalid_email from email_addresses where email_address_caps = '" . $this->db->quote(strtoupper($email)) . "'");
490
+                        if(!empty($result)) {
491
+                            $row=$this->db->fetchByAssoc($result);
492
+                            if(!empty($row['opt_out'])) {
493
+                                $optOutValues[$k] = "emailAddress$count";
494
+                            }
495
+                            if(!empty($row['invalid_email'])) {
496
+                                $invalidValues[$k] = "emailAddress$count";
497
+                            }
498
+                        }
499 499
                     }
500 500
                 }
501 501
                 // Re-populate the addresses class variable if we have new address(es).
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
 
523 523
         //If no widgets, set addresses array to empty
524 524
         if($post_from_email_address_widget && !$hasEmailValue) {
525
-           $this->addresses = array();
525
+            $this->addresses = array();
526 526
         }
527 527
     }
528 528
 
@@ -861,14 +861,14 @@  discard block
 block discarded – undo
861 861
             $count = 0;
862 862
             $key = $module . $widget_id . 'emailAddress'.$count;
863 863
             while(isset($_REQUEST[$key])) {
864
-                   $email = $_REQUEST[$key];
865
-                   $prefillDataArr[] =  array('email_address'=>$email,
866
-                                             'primary_address'=>isset($_REQUEST['emailAddressPrimaryFlag']) && $_REQUEST['emailAddressPrimaryFlag'] == $key,
867
-                                             'invalid_email'=>isset($_REQUEST['emailAddressInvalidFlag']) && in_array($key, $_REQUEST['emailAddressInvalidFlag']),
868
-                                             'opt_out'=>isset($_REQUEST['emailAddressOptOutFlag']) && in_array($key, $_REQUEST['emailAddressOptOutFlag']),
869
-                                             'reply_to_address'=>false
864
+                    $email = $_REQUEST[$key];
865
+                    $prefillDataArr[] =  array('email_address'=>$email,
866
+                                                'primary_address'=>isset($_REQUEST['emailAddressPrimaryFlag']) && $_REQUEST['emailAddressPrimaryFlag'] == $key,
867
+                                                'invalid_email'=>isset($_REQUEST['emailAddressInvalidFlag']) && in_array($key, $_REQUEST['emailAddressInvalidFlag']),
868
+                                                'opt_out'=>isset($_REQUEST['emailAddressOptOutFlag']) && in_array($key, $_REQUEST['emailAddressOptOutFlag']),
869
+                                                'reply_to_address'=>false
870 870
                                         );
871
-                   $key = $module . $widget_id . 'emailAddress' . ++$count;
871
+                    $key = $module . $widget_id . 'emailAddress' . ++$count;
872 872
             } //while
873 873
         }
874 874
 
@@ -985,7 +985,7 @@  discard block
 block discarded – undo
985 985
         $this->smarty->assign('emailAddressWidget',$_POST['emailAddressWidget']);
986 986
 
987 987
         if(isset($_POST[$mod . $widget_id . 'emailAddressPrimaryFlag'])) {
988
-           $primary = $_POST[$mod . $widget_id . 'emailAddressPrimaryFlag'];
988
+            $primary = $_POST[$mod . $widget_id . 'emailAddressPrimaryFlag'];
989 989
         }
990 990
 
991 991
         while(isset($_POST[$mod . $widget_id . "emailAddress" . $count])) {
@@ -994,31 +994,31 @@  discard block
 block discarded – undo
994 994
         }
995 995
 
996 996
         if($count == 0) {
997
-           return "";
997
+            return "";
998 998
         }
999 999
 
1000 1000
         if(isset($_POST[$mod . $widget_id . 'emailAddressOptOutFlag'])) {
1001
-           foreach($_POST[$mod . $widget_id . 'emailAddressOptOutFlag'] as $v) {
1002
-              $optOut[] = $v;
1003
-           }
1001
+            foreach($_POST[$mod . $widget_id . 'emailAddressOptOutFlag'] as $v) {
1002
+                $optOut[] = $v;
1003
+            }
1004 1004
         }
1005 1005
 
1006 1006
         if(isset($_POST[$mod . $widget_id . 'emailAddressInvalidFlag'])) {
1007
-           foreach($_POST[$mod . $widget_id . 'emailAddressInvalidFlag'] as $v) {
1008
-              $invalid[] = $v;
1009
-           }
1007
+            foreach($_POST[$mod . $widget_id . 'emailAddressInvalidFlag'] as $v) {
1008
+                $invalid[] = $v;
1009
+            }
1010 1010
         }
1011 1011
 
1012 1012
         if(isset($_POST[$mod . $widget_id . 'emailAddressReplyToFlag'])) {
1013
-           foreach($_POST[$mod . $widget_id . 'emailAddressReplyToFlag'] as $v) {
1014
-              $replyTo[] = $v;
1015
-           }
1013
+            foreach($_POST[$mod . $widget_id . 'emailAddressReplyToFlag'] as $v) {
1014
+                $replyTo[] = $v;
1015
+            }
1016 1016
         }
1017 1017
 
1018 1018
         if(isset($_POST[$mod . $widget_id . 'emailAddressDeleteFlag'])) {
1019
-           foreach($_POST[$mod . $widget_id . 'emailAddressDeleteFlag'] as $v) {
1020
-              $delete[] = $v;
1021
-           }
1019
+            foreach($_POST[$mod . $widget_id . 'emailAddressDeleteFlag'] as $v) {
1020
+                $delete[] = $v;
1021
+            }
1022 1022
         }
1023 1023
 
1024 1024
         while(isset($_POST[$mod . $widget_id . "emailAddressVerifiedValue" . $count])) {
@@ -1052,13 +1052,13 @@  discard block
 block discarded – undo
1052 1052
         $get .= '&emailAddressWidget='.$_POST['emailAddressWidget'];
1053 1053
 
1054 1054
         while(isset($_REQUEST[$mod . $widget_id . 'emailAddress' . $count])) {
1055
-              $get .= "&" . $mod . $widget_id . "emailAddress" . $count . "=" . urlencode($_REQUEST[$mod . $widget_id . 'emailAddress' . $count]);
1056
-              $count++;
1055
+                $get .= "&" . $mod . $widget_id . "emailAddress" . $count . "=" . urlencode($_REQUEST[$mod . $widget_id . 'emailAddress' . $count]);
1056
+                $count++;
1057 1057
         } //while
1058 1058
 
1059 1059
         while(isset($_REQUEST[$mod . $widget_id . 'emailAddressVerifiedValue' . $count])) {
1060
-              $get .= "&" . $mod . $widget_id . "emailAddressVerifiedValue" . $count . "=" . urlencode($_REQUEST[$mod . $widget_id . 'emailAddressVerifiedValue' . $count]);
1061
-              $count++;
1060
+                $get .= "&" . $mod . $widget_id . "emailAddressVerifiedValue" . $count . "=" . urlencode($_REQUEST[$mod . $widget_id . 'emailAddressVerifiedValue' . $count]);
1061
+                $count++;
1062 1062
         } //while
1063 1063
 
1064 1064
         $options = array('emailAddressPrimaryFlag', 'emailAddressOptOutFlag', 'emailAddressInvalidFlag', 'emailAddressDeleteFlag', 'emailAddressReplyToFlag');
@@ -1067,14 +1067,14 @@  discard block
 block discarded – undo
1067 1067
             $count = 0;
1068 1068
             $optionIdentifier = $mod.$widget_id.$option;
1069 1069
             if(isset($_REQUEST[$optionIdentifier])) {
1070
-               if(is_array($_REQUEST[$optionIdentifier])) {
1071
-                   foreach($_REQUEST[$optionIdentifier] as $optOut) {
1072
-                      $get .= "&" . $optionIdentifier . "[" . $count . "]=" . $optOut;
1073
-                      $count++;
1074
-                   } //foreach
1075
-               } else {
1076
-                   $get .= "&" . $optionIdentifier . "=" . $_REQUEST[$optionIdentifier];
1077
-               }
1070
+                if(is_array($_REQUEST[$optionIdentifier])) {
1071
+                    foreach($_REQUEST[$optionIdentifier] as $optOut) {
1072
+                        $get .= "&" . $optionIdentifier . "[" . $count . "]=" . $optOut;
1073
+                        $count++;
1074
+                    } //foreach
1075
+                } else {
1076
+                    $get .= "&" . $optionIdentifier . "=" . $_REQUEST[$optionIdentifier];
1077
+                }
1078 1078
             } //if
1079 1079
         } //foreach
1080 1080
         return $get;
@@ -1082,7 +1082,7 @@  discard block
 block discarded – undo
1082 1082
     }
1083 1083
 
1084 1084
     function setView($view) {
1085
-       $this->view = $view;
1085
+        $this->view = $view;
1086 1086
     }
1087 1087
 
1088 1088
 /**
Please login to merge, or discard this patch.
Spacing   +171 added lines, -171 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
     /**
82 82
      * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead
83 83
      */
84
-    public function SugarEmailAddress(){
84
+    public function SugarEmailAddress() {
85 85
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
86
-        if(isset($GLOBALS['log'])) {
86
+        if (isset($GLOBALS['log'])) {
87 87
             $GLOBALS['log']->deprecated($deprecatedMessage);
88 88
         }
89 89
         else {
@@ -99,16 +99,16 @@  discard block
 block discarded – undo
99 99
      * @param string $module
100 100
      */
101 101
     function handleLegacySave($bean, $prefix = "") {
102
-        if(!isset($_REQUEST) || !isset($_REQUEST['useEmailWidget'])) {
102
+        if (!isset($_REQUEST) || !isset($_REQUEST['useEmailWidget'])) {
103 103
             if (empty($this->addresses) || !isset($_REQUEST['massupdate'])) {
104 104
                 $this->addresses = array();
105 105
                 $optOut = (isset($bean->email_opt_out) && $bean->email_opt_out == "1") ? true : false;
106 106
                 $invalid = (isset($bean->invalid_email) && $bean->invalid_email == "1") ? true : false;
107 107
 
108 108
                 $isPrimary = true;
109
-                for($i = 1; $i <= 10; $i++){
109
+                for ($i = 1; $i <= 10; $i++) {
110 110
                     $email = 'email'.$i;
111
-                    if(isset($bean->$email) && !empty($bean->$email)){
111
+                    if (isset($bean->$email) && !empty($bean->$email)) {
112 112
                         $opt_out_field = $email.'_opt_out';
113 113
                         $invalid_field = $email.'_invalid';
114 114
                         $field_optOut = (isset($bean->$opt_out_field)) ? $bean->$opt_out_field : $optOut;
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
                 }
120 120
             }
121 121
         }
122
-        $this->populateAddresses($bean->id, $bean->module_dir, array(),'');
123
-        if(isset($_REQUEST) && isset($_REQUEST['useEmailWidget'])) {
122
+        $this->populateAddresses($bean->id, $bean->module_dir, array(), '');
123
+        if (isset($_REQUEST) && isset($_REQUEST['useEmailWidget'])) {
124 124
             $this->populateLegacyFields($bean);
125 125
         }
126 126
     }
@@ -142,11 +142,11 @@  discard block
 block discarded – undo
142 142
         return;
143 143
     }
144 144
 
145
-    function populateLegacyFields(&$bean){
145
+    function populateLegacyFields(&$bean) {
146 146
         $primary_found = false;
147 147
         $alternate_found = false;
148 148
         $alternate2_found = false;
149
-        foreach($this->addresses as $k=>$address) {
149
+        foreach ($this->addresses as $k=>$address) {
150 150
             if ($primary_found && $alternate_found)
151 151
                 break;
152 152
             if ($address['primary_address'] == 1 && !$primary_found) {
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
             } elseif (!$alternate_found) {
156 156
                 $alternate_index = $k;
157 157
                 $alternate_found = true;
158
-            } elseif (!$alternate2_found){
158
+            } elseif (!$alternate2_found) {
159 159
                 $alternate2_index = $k;
160 160
                 $alternate2_found = true;
161 161
             }
@@ -192,27 +192,27 @@  discard block
 block discarded – undo
192 192
         $args = func_get_args();
193 193
         return call_user_func_array(array($this, '_save'), $args);
194 194
     }
195
-    private function _save($id, $module, $new_addrs=array(), $primary='', $replyTo='', $invalid='', $optOut='', $in_workflow=false) {
196
-        if(empty($this->addresses) || $in_workflow){
197
-            $this->populateAddresses($id, $module, $new_addrs,$primary);
195
+    private function _save($id, $module, $new_addrs = array(), $primary = '', $replyTo = '', $invalid = '', $optOut = '', $in_workflow = false) {
196
+        if (empty($this->addresses) || $in_workflow) {
197
+            $this->populateAddresses($id, $module, $new_addrs, $primary);
198 198
         }
199 199
 
200 200
         //find all email addresses..
201
-        $current_links=array();
201
+        $current_links = array();
202 202
         // Need to correct this to handle the Employee/User split
203 203
         $module = $this->getCorrectedModule($module);
204
-        $q2="select *  from email_addr_bean_rel eabr WHERE eabr.bean_id = '".$this->db->quote($id)."' AND eabr.bean_module = '".$this->db->quote($module)."' and eabr.deleted=0";
204
+        $q2 = "select *  from email_addr_bean_rel eabr WHERE eabr.bean_id = '".$this->db->quote($id)."' AND eabr.bean_module = '".$this->db->quote($module)."' and eabr.deleted=0";
205 205
         $r2 = $this->db->query($q2);
206
-        while(($row2=$this->db->fetchByAssoc($r2)) != null ) {
207
-            $current_links[$row2['email_address_id']]=$row2;
206
+        while (($row2 = $this->db->fetchByAssoc($r2)) != null) {
207
+            $current_links[$row2['email_address_id']] = $row2;
208 208
         }
209 209
 
210 210
         $isConversion = (isset($_REQUEST) && isset($_REQUEST['action']) && $_REQUEST['action'] == 'ConvertLead') ? true : false;
211 211
 
212 212
         if (!empty($this->addresses)) {
213 213
             // insert new relationships and create email address record, if they don't exist
214
-            foreach($this->addresses as $address) {
215
-                if(!empty($address['email_address'])) {
214
+            foreach ($this->addresses as $address) {
215
+                if (!empty($address['email_address'])) {
216 216
                     $guid = create_guid();
217 217
                     $emailId = isset($address['email_address_id'])
218 218
                         && isset($current_links[$address['email_address_id']])
@@ -220,14 +220,14 @@  discard block
 block discarded – undo
220 220
                     $emailId = $this->AddUpdateEmailAddress($address['email_address'],
221 221
                                                             $address['invalid_email'],
222 222
                                                             $address['opt_out'],
223
-                                                            $emailId);// this will save the email address if not found
223
+                                                            $emailId); // this will save the email address if not found
224 224
 
225 225
                     //verify linkage and flags.
226
-                    $upd_eabr="";
226
+                    $upd_eabr = "";
227 227
                     if (isset($current_links[$emailId])) {
228 228
                         if (!$isConversion) { // do not update anything if this is for lead conversion
229
-                        if ($address['primary_address'] != $current_links[$emailId]['primary_address'] or $address['reply_to_address'] != $current_links[$emailId]['reply_to_address'] ) {
230
-                            $upd_eabr="UPDATE email_addr_bean_rel SET primary_address='".$this->db->quote($address['primary_address'])."', reply_to_address='".$this->db->quote($address['reply_to_address'])."' WHERE id='".$this->db->quote($current_links[$emailId]['id'])."'";
229
+                        if ($address['primary_address'] != $current_links[$emailId]['primary_address'] or $address['reply_to_address'] != $current_links[$emailId]['reply_to_address']) {
230
+                            $upd_eabr = "UPDATE email_addr_bean_rel SET primary_address='".$this->db->quote($address['primary_address'])."', reply_to_address='".$this->db->quote($address['reply_to_address'])."' WHERE id='".$this->db->quote($current_links[$emailId]['id'])."'";
231 231
                         }
232 232
 
233 233
                         unset($current_links[$emailId]);
@@ -258,13 +258,13 @@  discard block
 block discarded – undo
258 258
         // for lead conversion, do not delete email addresses
259 259
         if (!empty($current_links) && !$isConversion) {
260 260
 
261
-            $delete="";
261
+            $delete = "";
262 262
             foreach ($current_links as $eabr) {
263 263
 
264
-                $delete.=empty($delete) ? "'".$this->db->quote($eabr['id']) . "' " : ",'" . $this->db->quote($eabr['id']) . "'";
264
+                $delete .= empty($delete) ? "'".$this->db->quote($eabr['id'])."' " : ",'".$this->db->quote($eabr['id'])."'";
265 265
             }
266 266
 
267
-            $eabr_unlink="update email_addr_bean_rel set deleted=1 where id in ({$delete})";
267
+            $eabr_unlink = "update email_addr_bean_rel set deleted=1 where id in ({$delete})";
268 268
             $this->db->query($eabr_unlink);
269 269
         }
270 270
         $this->stateBeforeWorkflow = null;
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
         )
287 287
     {
288 288
         $emailCaps = strtoupper(trim($email));
289
-        if(empty($emailCaps))
289
+        if (empty($emailCaps))
290 290
             return 0;
291 291
 
292 292
         $q = "SELECT *
@@ -324,10 +324,10 @@  discard block
 block discarded – undo
324 324
         $r = $this->db->query($q, true);
325 325
 
326 326
         $retArr = array();
327
-        while($a = $this->db->fetchByAssoc($r)) {
327
+        while ($a = $this->db->fetchByAssoc($r)) {
328 328
             $retArr[] = $a['bean_id'];
329 329
         }
330
-        if(count($retArr) > 0) {
330
+        if (count($retArr) > 0) {
331 331
             return $retArr;
332 332
         } else {
333 333
             return false;
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 
348 348
         $email = trim($email);
349 349
 
350
-        if(empty($email)) {
350
+        if (empty($email)) {
351 351
             return array();
352 352
         }
353 353
 
@@ -356,12 +356,12 @@  discard block
 block discarded – undo
356 356
                 WHERE ea.email_address_caps = $emailCaps and eabl.deleted=0 ";
357 357
         $r = $this->db->query($q);
358 358
 
359
-        while($a = $this->db->fetchByAssoc($r)) {
360
-            if(isset($beanList[$a['bean_module']]) && !empty($beanList[$a['bean_module']])) {
359
+        while ($a = $this->db->fetchByAssoc($r)) {
360
+            if (isset($beanList[$a['bean_module']]) && !empty($beanList[$a['bean_module']])) {
361 361
                 $className = $beanList[$a['bean_module']];
362 362
 
363
-                if(isset($beanFiles[$className]) && !empty($beanFiles[$className])) {
364
-                    if(!class_exists($className)) {
363
+                if (isset($beanFiles[$className]) && !empty($beanFiles[$className])) {
364
+                    if (!class_exists($className)) {
365 365
                         require_once($beanFiles[$className]);
366 366
                     }
367 367
 
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
      * @param string $replyTo GUID of reply-to address
390 390
      * @param string $invalid GUID of invalid address
391 391
      */
392
-    function populateAddresses($id, $module, $new_addrs=array(), $primary='', $replyTo='', $invalid='', $optOut='') {
392
+    function populateAddresses($id, $module, $new_addrs = array(), $primary = '', $replyTo = '', $invalid = '', $optOut = '') {
393 393
         $module = $this->getCorrectedModule($module);
394 394
         //One last check for the ConvertLead action in which case we need to change $module to 'Leads'
395 395
         $module = (isset($_REQUEST) && isset($_REQUEST['action']) && $_REQUEST['action'] == 'ConvertLead') ? 'Leads' : $module;
@@ -400,54 +400,54 @@  discard block
 block discarded – undo
400 400
         $hasEmailValue = false;
401 401
         $email_ids = array();
402 402
 
403
-        if (isset($_REQUEST) && isset($_REQUEST[$module .'_email_widget_id'])) {
403
+        if (isset($_REQUEST) && isset($_REQUEST[$module.'_email_widget_id'])) {
404 404
 
405 405
             $fromRequest = false;
406 406
             // determine which array to process
407
-            foreach($_REQUEST as $k => $v) {
408
-                if(strpos($k, 'emailAddress') !== false) {
407
+            foreach ($_REQUEST as $k => $v) {
408
+                if (strpos($k, 'emailAddress') !== false) {
409 409
                    $fromRequest = true;
410 410
                    break;
411 411
                 }
412
-            $widget_id = $_REQUEST[$module .'_email_widget_id'];
412
+            $widget_id = $_REQUEST[$module.'_email_widget_id'];
413 413
     }
414 414
 
415 415
             //Iterate over the widgets for this module, in case there are multiple email widgets for this module
416
-            while(isset($_REQUEST[$module . $widget_id . "emailAddress" . $widgetCount]))
416
+            while (isset($_REQUEST[$module.$widget_id."emailAddress".$widgetCount]))
417 417
             {
418
-                if (empty($_REQUEST[$module . $widget_id . "emailAddress" . $widgetCount])) {
418
+                if (empty($_REQUEST[$module.$widget_id."emailAddress".$widgetCount])) {
419 419
                     $widgetCount++;
420 420
                     continue;
421 421
                 }
422 422
 
423 423
                 $hasEmailValue = true;
424 424
 
425
-                $eId = $module . $widget_id;
426
-                if(isset($_REQUEST[$eId . 'emailAddressPrimaryFlag'])) {
427
-                   $primaryValue = $_REQUEST[$eId . 'emailAddressPrimaryFlag'];
428
-                } else if(isset($_REQUEST[$module . 'emailAddressPrimaryFlag'])) {
429
-                   $primaryValue = $_REQUEST[$module . 'emailAddressPrimaryFlag'];
425
+                $eId = $module.$widget_id;
426
+                if (isset($_REQUEST[$eId.'emailAddressPrimaryFlag'])) {
427
+                   $primaryValue = $_REQUEST[$eId.'emailAddressPrimaryFlag'];
428
+                } else if (isset($_REQUEST[$module.'emailAddressPrimaryFlag'])) {
429
+                   $primaryValue = $_REQUEST[$module.'emailAddressPrimaryFlag'];
430 430
                 }
431 431
 
432 432
                 $optOutValues = array();
433
-                if(isset($_REQUEST[$eId .'emailAddressOptOutFlag'])) {
434
-                   $optOutValues = $_REQUEST[$eId .'emailAddressOptOutFlag'];
435
-                } else if(isset($_REQUEST[$module . 'emailAddressOptOutFlag'])) {
436
-                   $optOutValues = $_REQUEST[$module . 'emailAddressOptOutFlag'];
433
+                if (isset($_REQUEST[$eId.'emailAddressOptOutFlag'])) {
434
+                   $optOutValues = $_REQUEST[$eId.'emailAddressOptOutFlag'];
435
+                } else if (isset($_REQUEST[$module.'emailAddressOptOutFlag'])) {
436
+                   $optOutValues = $_REQUEST[$module.'emailAddressOptOutFlag'];
437 437
                 }
438 438
 
439 439
                 $invalidValues = array();
440
-                if(isset($_REQUEST[$eId .'emailAddressInvalidFlag'])) {
441
-                   $invalidValues = $_REQUEST[$eId .'emailAddressInvalidFlag'];
442
-                } else if(isset($_REQUEST[$module . 'emailAddressInvalidFlag'])) {
443
-                   $invalidValues = $_REQUEST[$module . 'emailAddressInvalidFlag'];
440
+                if (isset($_REQUEST[$eId.'emailAddressInvalidFlag'])) {
441
+                   $invalidValues = $_REQUEST[$eId.'emailAddressInvalidFlag'];
442
+                } else if (isset($_REQUEST[$module.'emailAddressInvalidFlag'])) {
443
+                   $invalidValues = $_REQUEST[$module.'emailAddressInvalidFlag'];
444 444
                 }
445 445
 
446 446
                 $deleteValues = array();
447
-                if(isset($_REQUEST[$eId .'emailAddressDeleteFlag'])) {
448
-                   $deleteValues = $_REQUEST[$eId .'emailAddressDeleteFlag'];
449
-                } else if(isset($_REQUEST[$module . 'emailAddressDeleteFlag'])) {
450
-                   $deleteValues = $_REQUEST[$module . 'emailAddressDeleteFlag'];
447
+                if (isset($_REQUEST[$eId.'emailAddressDeleteFlag'])) {
448
+                   $deleteValues = $_REQUEST[$eId.'emailAddressDeleteFlag'];
449
+                } else if (isset($_REQUEST[$module.'emailAddressDeleteFlag'])) {
450
+                   $deleteValues = $_REQUEST[$module.'emailAddressDeleteFlag'];
451 451
                 }
452 452
 
453 453
                 // prep from form save
@@ -455,36 +455,36 @@  discard block
 block discarded – undo
455 455
                 $replyToField = '';
456 456
                 $invalidField = '';
457 457
                 $optOutField = '';
458
-                if($fromRequest && empty($primary) && isset($primaryValue)) {
458
+                if ($fromRequest && empty($primary) && isset($primaryValue)) {
459 459
                     $primaryField = $primaryValue;
460 460
                 }
461 461
 
462
-                if($fromRequest && empty($replyTo)) {
463
-                    if(isset($_REQUEST[$eId .'emailAddressReplyToFlag'])) {
464
-                       $replyToField = $_REQUEST[$eId .'emailAddressReplyToFlag'];
465
-                    } else if(isset($_REQUEST[$module . 'emailAddressReplyToFlag'])) {
466
-                       $replyToField = $_REQUEST[$module . 'emailAddressReplyToFlag'];
462
+                if ($fromRequest && empty($replyTo)) {
463
+                    if (isset($_REQUEST[$eId.'emailAddressReplyToFlag'])) {
464
+                       $replyToField = $_REQUEST[$eId.'emailAddressReplyToFlag'];
465
+                    } else if (isset($_REQUEST[$module.'emailAddressReplyToFlag'])) {
466
+                       $replyToField = $_REQUEST[$module.'emailAddressReplyToFlag'];
467 467
                     }
468 468
                 }
469
-                if($fromRequest && empty($new_addrs)) {
470
-                    foreach($_REQUEST as $k => $v) {
471
-                        if(preg_match('/'.$eId.'emailAddress[0-9]+$/i', $k) && !empty($v)) {
469
+                if ($fromRequest && empty($new_addrs)) {
470
+                    foreach ($_REQUEST as $k => $v) {
471
+                        if (preg_match('/'.$eId.'emailAddress[0-9]+$/i', $k) && !empty($v)) {
472 472
                             $new_addrs[$k] = $v;
473 473
                         }
474 474
                     }
475 475
                 }
476
-                if($fromRequest && empty($email_ids)) {
477
-                    foreach($_REQUEST as $k => $v) {
478
-                        if(preg_match('/'.$eId.'emailAddressId[0-9]+$/i', $k) && !empty($v)) {
476
+                if ($fromRequest && empty($email_ids)) {
477
+                    foreach ($_REQUEST as $k => $v) {
478
+                        if (preg_match('/'.$eId.'emailAddressId[0-9]+$/i', $k) && !empty($v)) {
479 479
                             $key = str_replace('emailAddressId', 'emailAddress', $k);
480 480
                             $email_ids[$key] = $v;
481 481
                         }
482 482
                     }
483 483
                 }
484 484
 
485
-                if($fromRequest && empty($new_addrs)) {
486
-                    foreach($_REQUEST as $k => $v) {
487
-                        if(preg_match('/'.$eId.'emailAddressVerifiedValue[0-9]+$/i', $k) && !empty($v)) {
485
+                if ($fromRequest && empty($new_addrs)) {
486
+                    foreach ($_REQUEST as $k => $v) {
487
+                        if (preg_match('/'.$eId.'emailAddressVerifiedValue[0-9]+$/i', $k) && !empty($v)) {
488 488
                             $validateFlag = str_replace("Value", "Flag", $k);
489 489
                             if (isset($_REQUEST[$validateFlag]) && $_REQUEST[$validateFlag] == "true")
490 490
                               $new_addrs[$k] = $v;
@@ -493,21 +493,21 @@  discard block
 block discarded – undo
493 493
                 }
494 494
 
495 495
                 //empty the addresses array if the post happened from email address widget.
496
-                if($post_from_email_address_widget) {
497
-                    $this->addresses=array();  //this gets populated during retrieve of the contact bean.
496
+                if ($post_from_email_address_widget) {
497
+                    $this->addresses = array(); //this gets populated during retrieve of the contact bean.
498 498
                 } else {
499 499
                     $optOutValues = array();
500 500
                     $invalidValues = array();
501
-                    foreach($new_addrs as $k=>$email) {
501
+                    foreach ($new_addrs as $k=>$email) {
502 502
                        preg_match('/emailAddress([0-9])+$/', $k, $matches);
503 503
                        $count = $matches[1];
504
-                       $result = $this->db->query("SELECT opt_out, invalid_email from email_addresses where email_address_caps = '" . $this->db->quote(strtoupper($email)) . "'");
505
-                       if(!empty($result)) {
506
-                          $row=$this->db->fetchByAssoc($result);
507
-                          if(!empty($row['opt_out'])) {
504
+                       $result = $this->db->query("SELECT opt_out, invalid_email from email_addresses where email_address_caps = '".$this->db->quote(strtoupper($email))."'");
505
+                       if (!empty($result)) {
506
+                          $row = $this->db->fetchByAssoc($result);
507
+                          if (!empty($row['opt_out'])) {
508 508
                              $optOutValues[$k] = "emailAddress$count";
509 509
                           }
510
-                          if(!empty($row['invalid_email'])) {
510
+                          if (!empty($row['invalid_email'])) {
511 511
                              $invalidValues[$k] = "emailAddress$count";
512 512
                           }
513 513
                        }
@@ -515,11 +515,11 @@  discard block
 block discarded – undo
515 515
                 }
516 516
                 // Re-populate the addresses class variable if we have new address(es).
517 517
                 if (!empty($new_addrs)) {
518
-                    foreach($new_addrs as $k => $reqVar) {
518
+                    foreach ($new_addrs as $k => $reqVar) {
519 519
                         //$key = preg_match("/^$eId/s", $k) ? substr($k, strlen($eId)) : $k;
520 520
                         $reqVar = trim($reqVar);
521
-                        if(strpos($k, 'emailAddress') !== false) {
522
-                            if(!empty($reqVar) && !in_array($k, $deleteValues)) {
521
+                        if (strpos($k, 'emailAddress') !== false) {
522
+                            if (!empty($reqVar) && !in_array($k, $deleteValues)) {
523 523
                                 $email_id   = (array_key_exists($k, $email_ids)) ? $email_ids[$k] : null;
524 524
                                 $primary    = ($k == $primaryValue) ? true : false;
525 525
                                 $replyTo    = ($k == $replyToField) ? true : false;
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
         }
537 537
 
538 538
         //If no widgets, set addresses array to empty
539
-        if($post_from_email_address_widget && !$hasEmailValue) {
539
+        if ($post_from_email_address_widget && !$hasEmailValue) {
540 540
            $this->addresses = array();
541 541
         }
542 542
     }
@@ -547,9 +547,9 @@  discard block
 block discarded – undo
547 547
      * @param bool $primary Default false
548 548
      * @param bool $replyTo Default false
549 549
      */
550
-    function addAddress($addr, $primary=false, $replyTo=false, $invalid=false, $optOut=false, $email_id = null) {
550
+    function addAddress($addr, $primary = false, $replyTo = false, $invalid = false, $optOut = false, $email_id = null) {
551 551
         $addr = html_entity_decode($addr, ENT_QUOTES);
552
-        if(preg_match($this->regex, $addr)) {
552
+        if (preg_match($this->regex, $addr)) {
553 553
             $primaryFlag = ($primary) ? '1' : '0';
554 554
             $replyToFlag = ($replyTo) ? '1' : '0';
555 555
             $invalidFlag = ($invalid) ? '1' : '0';
@@ -585,17 +585,17 @@  discard block
 block discarded – undo
585 585
      * Updates invalid_email and opt_out flags for each address
586 586
      */
587 587
     function updateFlags() {
588
-        if(!empty($this->addresses)) {
589
-            foreach($this->addresses as $addressMeta) {
590
-                if(isset($addressMeta['email_address']) && !empty($addressMeta['email_address'])) {
588
+        if (!empty($this->addresses)) {
589
+            foreach ($this->addresses as $addressMeta) {
590
+                if (isset($addressMeta['email_address']) && !empty($addressMeta['email_address'])) {
591 591
                     $address = $this->db->quote($this->_cleanAddress($addressMeta['email_address']));
592 592
 
593 593
                     $q = "SELECT * FROM email_addresses WHERE email_address = '{$address}'";
594 594
                     $r = $this->db->query($q);
595 595
                     $a = $this->db->fetchByAssoc($r);
596 596
 
597
-                    if(!empty($a)) {
598
-                        if(isset($a['invalid_email']) && isset($addressMeta['invalid_email']) && isset($addressMeta['opt_out']) && $a['invalid_email'] != $addressMeta['invalid_email'] || $a['opt_out'] != $addressMeta['opt_out']) {
597
+                    if (!empty($a)) {
598
+                        if (isset($a['invalid_email']) && isset($addressMeta['invalid_email']) && isset($addressMeta['opt_out']) && $a['invalid_email'] != $addressMeta['invalid_email'] || $a['opt_out'] != $addressMeta['opt_out']) {
599 599
                             $qUpdate = "UPDATE email_addresses SET invalid_email = ".intval($addressMeta['invalid_email']).", opt_out = ".intval($addressMeta['opt_out']).", date_modified = '".TimeDate::getInstance()->nowDb()."' WHERE id = '".$this->db->quote($a['id'])."'";
600 600
                             $rUpdate = $this->db->query($qUpdate);
601 601
                         }
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
     public function splitEmailAddress($addr)
609 609
     {
610 610
         $email = $this->_cleanAddress($addr);
611
-        if(!preg_match($this->regex, $email)) {
611
+        if (!preg_match($this->regex, $email)) {
612 612
             $email = ''; // remove bad email addr
613 613
         }
614 614
         $name = trim(str_replace(array($email, '<', '>', '"', "'"), '', $addr));
@@ -624,8 +624,8 @@  discard block
 block discarded – undo
624 624
     function _cleanAddress($addr) {
625 625
         $addr = trim(from_html($addr));
626 626
 
627
-        if(strpos($addr, "<") !== false && strpos($addr, ">") !== false) {
628
-            $address = trim(substr($addr, strrpos($addr, "<") +1, strrpos($addr, ">") - strrpos($addr, "<") -1));
627
+        if (strpos($addr, "<") !== false && strpos($addr, ">") !== false) {
628
+            $address = trim(substr($addr, strrpos($addr, "<") + 1, strrpos($addr, ">") - strrpos($addr, "<") - 1));
629 629
         } else {
630 630
             $address = trim($addr);
631 631
         }
@@ -646,11 +646,11 @@  discard block
 block discarded – undo
646 646
         $r = $this->db->query($q);
647 647
         $a = $this->db->fetchByAssoc($r);
648 648
 
649
-        if(!empty($a) && !empty($a['id'])) {
649
+        if (!empty($a) && !empty($a['id'])) {
650 650
             return $a['id'];
651 651
         } else {
652 652
             $guid = '';
653
-            if(!empty($address)){
653
+            if (!empty($address)) {
654 654
                 $guid = create_guid();
655 655
                 $now = TimeDate::getInstance()->nowDb();
656 656
                 $qa = "INSERT INTO email_addresses (id, email_address, email_address_caps, date_created, date_modified, deleted)
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
      *        to propagate to the new SugarEmailAddress - see bug 39188
673 673
      * @return String GUID of Email Address or '' if cleaned address was empty.
674 674
      */
675
-    public function AddUpdateEmailAddress($addr,$invalid=0,$opt_out=0,$id=null)
675
+    public function AddUpdateEmailAddress($addr, $invalid = 0, $opt_out = 0, $id = null)
676 676
     {
677 677
         // sanity checks to avoid SQL injection.
678 678
         $invalid = intval($invalid);
@@ -722,12 +722,12 @@  discard block
 block discarded – undo
722 722
             if ($duplicate_email['invalid_email'] != $new_invalid ||
723 723
                 $duplicate_email['opt_out'] != $new_opt_out ||
724 724
                 (trim($duplicate_email['email_address']) != $address)) {
725
-                $upd_q = 'UPDATE ' . $this->table_name . ' ' .
726
-                    'SET email_address=\'' . $address . '\', ' .
727
-                    'invalid_email=' . $new_invalid . ', ' .
728
-                    'opt_out=' . $new_opt_out . ', ' .
729
-                    'date_modified=' . $this->db->now() . ' ' .
730
-                    'WHERE id=\'' . $this->db->quote($duplicate_email['id']) . '\'';
725
+                $upd_q = 'UPDATE '.$this->table_name.' '.
726
+                    'SET email_address=\''.$address.'\', '.
727
+                    'invalid_email='.$new_invalid.', '.
728
+                    'opt_out='.$new_opt_out.', '.
729
+                    'date_modified='.$this->db->now().' '.
730
+                    'WHERE id=\''.$this->db->quote($duplicate_email['id']).'\'';
731 731
                 $upd_r = $this->db->query($upd_q);
732 732
             }
733 733
             return $duplicate_email['id'];
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
         else {
736 736
             // no case-insensitive address match - it's new, or undeleted.
737 737
             $guid = '';
738
-            if(!empty($address)){
738
+            if (!empty($address)) {
739 739
                 $guid = create_guid();
740 740
                 $now = TimeDate::getInstance()->nowDb();
741 741
                 $qa = "INSERT INTO email_addresses (id, email_address, email_address_caps, date_created, date_modified, deleted, invalid_email, opt_out)
@@ -751,12 +751,12 @@  discard block
 block discarded – undo
751 751
      * @param object $focus Object in focus
752 752
      * @return string email
753 753
      */
754
-    function getPrimaryAddress($focus,$parent_id=null,$parent_type=null) {
754
+    function getPrimaryAddress($focus, $parent_id = null, $parent_type = null) {
755 755
 
756
-        $parent_type=empty($parent_type) ? $focus->module_dir : $parent_type;
756
+        $parent_type = empty($parent_type) ? $focus->module_dir : $parent_type;
757 757
         // Bug63174: Email address is not shown in the list view for employees
758 758
         $parent_type = $this->getCorrectedModule($parent_type);
759
-        $parent_id=empty($parent_id) ? $focus->id : $parent_id;
759
+        $parent_id = empty($parent_id) ? $focus->id : $parent_id;
760 760
 
761 761
         $q = "SELECT ea.email_address FROM email_addresses ea
762 762
                 LEFT JOIN email_addr_bean_rel ear ON ea.id = ear.email_address_id
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
         $r = $this->db->limitQuery($q, 0, 1);
769 769
         $a = $this->db->fetchByAssoc($r);
770 770
 
771
-        if(isset($a['email_address'])) {
771
+        if (isset($a['email_address'])) {
772 772
             return $a['email_address'];
773 773
         }
774 774
         return '';
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
         $r = $this->db->query($q);
810 810
         $a = $this->db->fetchByAssoc($r);
811 811
 
812
-        if(isset($a['email_address'])) {
812
+        if (isset($a['email_address'])) {
813 813
             return $a['email_address'];
814 814
         }
815 815
         return '';
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
                 ORDER BY ear.reply_to_address, ear.primary_address DESC";
835 835
         $r = $this->db->query($q);
836 836
 
837
-        while($a = $this->db->fetchByAssoc($r, FALSE)) {
837
+        while ($a = $this->db->fetchByAssoc($r, FALSE)) {
838 838
             $return[] = $a;
839 839
         }
840 840
 
@@ -848,9 +848,9 @@  discard block
 block discarded – undo
848 848
      * @param bool asMetadata Default false
849 849
      * @return string HTML/JS for widget
850 850
      */
851
-    function getEmailAddressWidgetEditView($id, $module, $asMetadata=false, $tpl='',$tabindex='0')
851
+    function getEmailAddressWidgetEditView($id, $module, $asMetadata = false, $tpl = '', $tabindex = '0')
852 852
     {
853
-        if ( !($this->smarty instanceOf Sugar_Smarty ) )
853
+        if (!($this->smarty instanceOf Sugar_Smarty))
854 854
             $this->smarty = new Sugar_Smarty();
855 855
 
856 856
         global $app_strings, $dictionary, $beanList;
@@ -861,33 +861,33 @@  discard block
 block discarded – undo
861 861
         $passedModule = $module;
862 862
         $module = $this->getCorrectedModule($module);
863 863
         $saveModule = $module;
864
-        if(isset($_POST['is_converted']) && $_POST['is_converted']==true){
865
-            $id=$_POST['return_id'];
866
-            $module=$_POST['return_module'];
864
+        if (isset($_POST['is_converted']) && $_POST['is_converted'] == true) {
865
+            $id = $_POST['return_id'];
866
+            $module = $_POST['return_module'];
867 867
         }
868 868
         $prefillDataArr = array();
869
-        if(!empty($id)) {
869
+        if (!empty($id)) {
870 870
             $prefillDataArr = $this->getAddressesByGUID($id, $module);
871 871
             //When coming from convert leads, sometimes module is Contacts while the id is for a lead.
872 872
             if (empty($prefillDataArr) && $module == "Contacts")
873 873
                 $prefillDataArr = $this->getAddressesByGUID($id, "Leads");
874
-        } else if(isset($_REQUEST['full_form']) && !empty($_REQUEST['emailAddressWidget'])){
875
-            $widget_id = isset($_REQUEST[$module . '_email_widget_id']) ? $_REQUEST[$module . '_email_widget_id'] : '0';
874
+        } else if (isset($_REQUEST['full_form']) && !empty($_REQUEST['emailAddressWidget'])) {
875
+            $widget_id = isset($_REQUEST[$module.'_email_widget_id']) ? $_REQUEST[$module.'_email_widget_id'] : '0';
876 876
             $count = 0;
877
-            $key = $module . $widget_id . 'emailAddress'.$count;
878
-            while(isset($_REQUEST[$key])) {
877
+            $key = $module.$widget_id.'emailAddress'.$count;
878
+            while (isset($_REQUEST[$key])) {
879 879
                    $email = $_REQUEST[$key];
880
-                   $prefillDataArr[] =  array('email_address'=>$email,
880
+                   $prefillDataArr[] = array('email_address'=>$email,
881 881
                                              'primary_address'=>isset($_REQUEST['emailAddressPrimaryFlag']) && $_REQUEST['emailAddressPrimaryFlag'] == $key,
882 882
                                              'invalid_email'=>isset($_REQUEST['emailAddressInvalidFlag']) && in_array($key, $_REQUEST['emailAddressInvalidFlag']),
883 883
                                              'opt_out'=>isset($_REQUEST['emailAddressOptOutFlag']) && in_array($key, $_REQUEST['emailAddressOptOutFlag']),
884 884
                                              'reply_to_address'=>false
885 885
                                         );
886
-                   $key = $module . $widget_id . 'emailAddress' . ++$count;
886
+                   $key = $module.$widget_id.'emailAddress'.++$count;
887 887
             } //while
888 888
         }
889 889
 
890
-        if(!empty($prefillDataArr)) {
890
+        if (!empty($prefillDataArr)) {
891 891
             $json = new JSON(JSON_LOOSE_TYPE);
892 892
             $prefillData = $json->encode($prefillDataArr);
893 893
             $prefill = !empty($prefillDataArr) ? 'true' : 'false';
@@ -910,16 +910,16 @@  discard block
 block discarded – undo
910 910
         $form = $this->view;
911 911
 
912 912
         //determine if this should be a quickcreate form, or a quick create form under subpanels
913
-        if ($this->view == "QuickCreate"){
914
-            $form = 'form_DC'.$this->view .'_'.$module;
915
-            if(isset($_REQUEST['action']) && $_REQUEST['action']=='SubpanelCreates' ||  $_REQUEST['action']=='SubpanelEdits'){
916
-                $form = 'form_Subpanel'.$this->view .'_'.$module;
913
+        if ($this->view == "QuickCreate") {
914
+            $form = 'form_DC'.$this->view.'_'.$module;
915
+            if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'SubpanelCreates' || $_REQUEST['action'] == 'SubpanelEdits') {
916
+                $form = 'form_Subpanel'.$this->view.'_'.$module;
917 917
             }
918 918
         }
919 919
 
920 920
         $this->smarty->assign('emailView', $form);
921 921
 
922
-        if($module == 'Users') {
922
+        if ($module == 'Users') {
923 923
             $this->smarty->assign('useReplyTo', true);
924 924
         } else {
925 925
             $this->smarty->assign('useOptOut', true);
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
         $newEmail = $this->smarty->fetch($template);
931 931
 
932 932
 
933
-        if($asMetadata) {
933
+        if ($asMetadata) {
934 934
             // used by Email 2.0
935 935
             $ret = array();
936 936
             $ret['prefillData'] = $prefillDataArr;
@@ -948,18 +948,18 @@  discard block
 block discarded – undo
948 948
      * @param object $focus Bean in focus
949 949
      * @return string HTML/JS for widget
950 950
      */
951
-    function getEmailAddressWidgetDetailView($focus, $tpl='')
951
+    function getEmailAddressWidgetDetailView($focus, $tpl = '')
952 952
     {
953
-        if ( !($this->smarty instanceOf Sugar_Smarty ) )
953
+        if (!($this->smarty instanceOf Sugar_Smarty))
954 954
             $this->smarty = new Sugar_Smarty();
955 955
 
956 956
         global $app_strings;
957 957
         global $current_user;
958 958
         $assign = array();
959
-        if(empty($focus->id))return '';
959
+        if (empty($focus->id))return '';
960 960
         $prefillData = $this->getAddressesByGUID($focus->id, $focus->module_dir);
961 961
 
962
-        foreach($prefillData as $addressItem) {
962
+        foreach ($prefillData as $addressItem) {
963 963
             $key = ($addressItem['primary_address'] == 1) ? 'primary' : "";
964 964
             $key = ($addressItem['reply_to_address'] == 1) ? 'reply_to' : $key;
965 965
             $key = ($addressItem['opt_out'] == 1) ? 'opt_out' : $key;
@@ -985,7 +985,7 @@  discard block
 block discarded – undo
985 985
      */
986 986
     function getEmailAddressWidgetDuplicatesView($focus)
987 987
     {
988
-        if ( !($this->smarty instanceOf Sugar_Smarty ) )
988
+        if (!($this->smarty instanceOf Sugar_Smarty))
989 989
             $this->smarty = new Sugar_Smarty();
990 990
 
991 991
         $count = 0;
@@ -995,49 +995,49 @@  discard block
 block discarded – undo
995 995
         $invalid = array();
996 996
         $mod = isset($focus) ? $focus->module_dir : "";
997 997
 
998
-        $widget_id = $_POST[$mod .'_email_widget_id'];
999
-        $this->smarty->assign('email_widget_id',$widget_id);
1000
-        $this->smarty->assign('emailAddressWidget',$_POST['emailAddressWidget']);
998
+        $widget_id = $_POST[$mod.'_email_widget_id'];
999
+        $this->smarty->assign('email_widget_id', $widget_id);
1000
+        $this->smarty->assign('emailAddressWidget', $_POST['emailAddressWidget']);
1001 1001
 
1002
-        if(isset($_POST[$mod . $widget_id . 'emailAddressPrimaryFlag'])) {
1003
-           $primary = $_POST[$mod . $widget_id . 'emailAddressPrimaryFlag'];
1002
+        if (isset($_POST[$mod.$widget_id.'emailAddressPrimaryFlag'])) {
1003
+           $primary = $_POST[$mod.$widget_id.'emailAddressPrimaryFlag'];
1004 1004
         }
1005 1005
 
1006
-        while(isset($_POST[$mod . $widget_id . "emailAddress" . $count])) {
1007
-            $emails[] = $_POST[$mod . $widget_id . 'emailAddress' . $count];
1006
+        while (isset($_POST[$mod.$widget_id."emailAddress".$count])) {
1007
+            $emails[] = $_POST[$mod.$widget_id.'emailAddress'.$count];
1008 1008
             $count++;
1009 1009
         }
1010 1010
 
1011
-        if($count == 0) {
1011
+        if ($count == 0) {
1012 1012
            return "";
1013 1013
         }
1014 1014
 
1015
-        if(isset($_POST[$mod . $widget_id . 'emailAddressOptOutFlag'])) {
1016
-           foreach($_POST[$mod . $widget_id . 'emailAddressOptOutFlag'] as $v) {
1015
+        if (isset($_POST[$mod.$widget_id.'emailAddressOptOutFlag'])) {
1016
+           foreach ($_POST[$mod.$widget_id.'emailAddressOptOutFlag'] as $v) {
1017 1017
               $optOut[] = $v;
1018 1018
            }
1019 1019
         }
1020 1020
 
1021
-        if(isset($_POST[$mod . $widget_id . 'emailAddressInvalidFlag'])) {
1022
-           foreach($_POST[$mod . $widget_id . 'emailAddressInvalidFlag'] as $v) {
1021
+        if (isset($_POST[$mod.$widget_id.'emailAddressInvalidFlag'])) {
1022
+           foreach ($_POST[$mod.$widget_id.'emailAddressInvalidFlag'] as $v) {
1023 1023
               $invalid[] = $v;
1024 1024
            }
1025 1025
         }
1026 1026
 
1027
-        if(isset($_POST[$mod . $widget_id . 'emailAddressReplyToFlag'])) {
1028
-           foreach($_POST[$mod . $widget_id . 'emailAddressReplyToFlag'] as $v) {
1027
+        if (isset($_POST[$mod.$widget_id.'emailAddressReplyToFlag'])) {
1028
+           foreach ($_POST[$mod.$widget_id.'emailAddressReplyToFlag'] as $v) {
1029 1029
               $replyTo[] = $v;
1030 1030
            }
1031 1031
         }
1032 1032
 
1033
-        if(isset($_POST[$mod . $widget_id . 'emailAddressDeleteFlag'])) {
1034
-           foreach($_POST[$mod . $widget_id . 'emailAddressDeleteFlag'] as $v) {
1033
+        if (isset($_POST[$mod.$widget_id.'emailAddressDeleteFlag'])) {
1034
+           foreach ($_POST[$mod.$widget_id.'emailAddressDeleteFlag'] as $v) {
1035 1035
               $delete[] = $v;
1036 1036
            }
1037 1037
         }
1038 1038
 
1039
-        while(isset($_POST[$mod . $widget_id . "emailAddressVerifiedValue" . $count])) {
1040
-            $verified[] = $_POST[$mod . $widget_id . 'emailAddressVerifiedValue' . $count];
1039
+        while (isset($_POST[$mod.$widget_id."emailAddressVerifiedValue".$count])) {
1040
+            $verified[] = $_POST[$mod.$widget_id.'emailAddressVerifiedValue'.$count];
1041 1041
             $count++;
1042 1042
         }
1043 1043
 
@@ -1062,33 +1062,33 @@  discard block
 block discarded – undo
1062 1062
         $count = 0;
1063 1063
         $mod = isset($focus) ? $focus->module_dir : "";
1064 1064
 
1065
-        $widget_id = $_POST[$mod .'_email_widget_id'];
1066
-        $get .= '&' . $mod . '_email_widget_id='. $widget_id;
1065
+        $widget_id = $_POST[$mod.'_email_widget_id'];
1066
+        $get .= '&'.$mod.'_email_widget_id='.$widget_id;
1067 1067
         $get .= '&emailAddressWidget='.$_POST['emailAddressWidget'];
1068 1068
 
1069
-        while(isset($_REQUEST[$mod . $widget_id . 'emailAddress' . $count])) {
1070
-              $get .= "&" . $mod . $widget_id . "emailAddress" . $count . "=" . urlencode($_REQUEST[$mod . $widget_id . 'emailAddress' . $count]);
1069
+        while (isset($_REQUEST[$mod.$widget_id.'emailAddress'.$count])) {
1070
+              $get .= "&".$mod.$widget_id."emailAddress".$count."=".urlencode($_REQUEST[$mod.$widget_id.'emailAddress'.$count]);
1071 1071
               $count++;
1072 1072
         } //while
1073 1073
 
1074
-        while(isset($_REQUEST[$mod . $widget_id . 'emailAddressVerifiedValue' . $count])) {
1075
-              $get .= "&" . $mod . $widget_id . "emailAddressVerifiedValue" . $count . "=" . urlencode($_REQUEST[$mod . $widget_id . 'emailAddressVerifiedValue' . $count]);
1074
+        while (isset($_REQUEST[$mod.$widget_id.'emailAddressVerifiedValue'.$count])) {
1075
+              $get .= "&".$mod.$widget_id."emailAddressVerifiedValue".$count."=".urlencode($_REQUEST[$mod.$widget_id.'emailAddressVerifiedValue'.$count]);
1076 1076
               $count++;
1077 1077
         } //while
1078 1078
 
1079 1079
         $options = array('emailAddressPrimaryFlag', 'emailAddressOptOutFlag', 'emailAddressInvalidFlag', 'emailAddressDeleteFlag', 'emailAddressReplyToFlag');
1080 1080
 
1081
-        foreach($options as $option) {
1081
+        foreach ($options as $option) {
1082 1082
             $count = 0;
1083 1083
             $optionIdentifier = $mod.$widget_id.$option;
1084
-            if(isset($_REQUEST[$optionIdentifier])) {
1085
-               if(is_array($_REQUEST[$optionIdentifier])) {
1086
-                   foreach($_REQUEST[$optionIdentifier] as $optOut) {
1087
-                      $get .= "&" . $optionIdentifier . "[" . $count . "]=" . $optOut;
1084
+            if (isset($_REQUEST[$optionIdentifier])) {
1085
+               if (is_array($_REQUEST[$optionIdentifier])) {
1086
+                   foreach ($_REQUEST[$optionIdentifier] as $optOut) {
1087
+                      $get .= "&".$optionIdentifier."[".$count."]=".$optOut;
1088 1088
                       $count++;
1089 1089
                    } //foreach
1090 1090
                } else {
1091
-                   $get .= "&" . $optionIdentifier . "=" . $_REQUEST[$optionIdentifier];
1091
+                   $get .= "&".$optionIdentifier."=".$_REQUEST[$optionIdentifier];
1092 1092
                }
1093 1093
             } //if
1094 1094
         } //foreach
@@ -1106,7 +1106,7 @@  discard block
 block discarded – undo
1106 1106
  * @return string The value for the bean_module column in the email_addr_bean_rel table
1107 1107
  */
1108 1108
     function getCorrectedModule(&$module) {
1109
-        return ($module == "Employees")? "Users" : $module;
1109
+        return ($module == "Employees") ? "Users" : $module;
1110 1110
     }
1111 1111
 
1112 1112
     public function stash($parentBeanId, $moduleName)
@@ -1116,7 +1116,7 @@  discard block
 block discarded – undo
1116 1116
         $ids = array();
1117 1117
         while ($row = $this->db->fetchByAssoc($result, false))
1118 1118
         {
1119
-            $ids[] =$this->db->quote($row['email_address_id']); // avoid 2nd order SQL Injection
1119
+            $ids[] = $this->db->quote($row['email_address_id']); // avoid 2nd order SQL Injection
1120 1120
         }
1121 1121
         if (!empty($ids))
1122 1122
         {
@@ -1140,15 +1140,15 @@  discard block
 block discarded – undo
1140 1140
  * @param string $view DetailView or EditView
1141 1141
  * @return string
1142 1142
  */
1143
-function getEmailAddressWidget($focus, $field, $value, $view, $tabindex='0') {
1143
+function getEmailAddressWidget($focus, $field, $value, $view, $tabindex = '0') {
1144 1144
     $sea = new SugarEmailAddress();
1145 1145
     $sea->setView($view);
1146 1146
 
1147
-        if($view == 'EditView' || $view == 'QuickCreate' || $view == 'ConvertLead') {
1147
+        if ($view == 'EditView' || $view == 'QuickCreate' || $view == 'ConvertLead') {
1148 1148
             $module = $focus->module_dir;
1149 1149
             if ($view == 'ConvertLead' && $module == "Contacts")  $module = "Leads";
1150 1150
 
1151
-            return $sea->getEmailAddressWidgetEditView($focus->id, $module, false,'',$tabindex);
1151
+            return $sea->getEmailAddressWidgetEditView($focus->id, $module, false, '', $tabindex);
1152 1152
         }
1153 1153
 
1154 1154
     return $sea->getEmailAddressWidgetDetailView($focus);
Please login to merge, or discard this patch.
Braces   +40 added lines, -28 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -85,8 +87,7 @@  discard block
 block discarded – undo
85 87
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
86 88
         if(isset($GLOBALS['log'])) {
87 89
             $GLOBALS['log']->deprecated($deprecatedMessage);
88
-        }
89
-        else {
90
+        } else {
90 91
             trigger_error($deprecatedMessage, E_USER_DEPRECATED);
91 92
         }
92 93
         self::__construct();
@@ -147,8 +148,9 @@  discard block
 block discarded – undo
147 148
         $alternate_found = false;
148 149
         $alternate2_found = false;
149 150
         foreach($this->addresses as $k=>$address) {
150
-            if ($primary_found && $alternate_found)
151
-                break;
151
+            if ($primary_found && $alternate_found) {
152
+                            break;
153
+            }
152 154
             if ($address['primary_address'] == 1 && !$primary_found) {
153 155
                 $primary_index = $k;
154 156
                 $primary_found = true;
@@ -286,8 +288,9 @@  discard block
 block discarded – undo
286 288
         )
287 289
     {
288 290
         $emailCaps = strtoupper(trim($email));
289
-        if(empty($emailCaps))
290
-            return 0;
291
+        if(empty($emailCaps)) {
292
+                    return 0;
293
+        }
291 294
 
292 295
         $q = "SELECT *
293 296
                 FROM email_addr_bean_rel eabl JOIN email_addresses ea
@@ -303,7 +306,9 @@  discard block
 block discarded – undo
303 306
 
304 307
         // do it this way to make the count accurate in oracle
305 308
         $i = 0;
306
-        while ($this->db->fetchByAssoc($r)) ++$i;
309
+        while ($this->db->fetchByAssoc($r)) {
310
+            ++$i;
311
+        }
307 312
 
308 313
         return $i;
309 314
     }
@@ -486,8 +491,9 @@  discard block
 block discarded – undo
486 491
                     foreach($_REQUEST as $k => $v) {
487 492
                         if(preg_match('/'.$eId.'emailAddressVerifiedValue[0-9]+$/i', $k) && !empty($v)) {
488 493
                             $validateFlag = str_replace("Value", "Flag", $k);
489
-                            if (isset($_REQUEST[$validateFlag]) && $_REQUEST[$validateFlag] == "true")
490
-                              $new_addrs[$k] = $v;
494
+                            if (isset($_REQUEST[$validateFlag]) && $_REQUEST[$validateFlag] == "true") {
495
+                                                          $new_addrs[$k] = $v;
496
+                            }
491 497
                         }
492 498
                     }
493 499
                 }
@@ -690,8 +696,7 @@  discard block
 block discarded – undo
690 696
         if ($id) {
691 697
             $r = $this->db->query("SELECT * FROM email_addresses WHERE id='".$this->db->quote($id)."'");
692 698
             $current_email = $this->db->fetchByAssoc($r);
693
-        }
694
-        else {
699
+        } else {
695 700
             $current_email = null;
696 701
         }
697 702
 
@@ -731,8 +736,7 @@  discard block
 block discarded – undo
731 736
                 $upd_r = $this->db->query($upd_q);
732 737
             }
733 738
             return $duplicate_email['id'];
734
-        }
735
-        else {
739
+        } else {
736 740
             // no case-insensitive address match - it's new, or undeleted.
737 741
             $guid = '';
738 742
             if(!empty($address)){
@@ -798,8 +802,7 @@  discard block
 block discarded – undo
798 802
             // otherwise
799 803
             $q .= "
800 804
                 ORDER BY ear.reply_to_address DESC";
801
-        }
802
-        else
805
+        } else
803 806
         {
804 807
             // retrieve reply-to address only
805 808
             $q .= "
@@ -850,8 +853,9 @@  discard block
 block discarded – undo
850 853
      */
851 854
     function getEmailAddressWidgetEditView($id, $module, $asMetadata=false, $tpl='',$tabindex='0')
852 855
     {
853
-        if ( !($this->smarty instanceOf Sugar_Smarty ) )
854
-            $this->smarty = new Sugar_Smarty();
856
+        if ( !($this->smarty instanceOf Sugar_Smarty ) ) {
857
+                    $this->smarty = new Sugar_Smarty();
858
+        }
855 859
 
856 860
         global $app_strings, $dictionary, $beanList;
857 861
 
@@ -869,8 +873,9 @@  discard block
 block discarded – undo
869 873
         if(!empty($id)) {
870 874
             $prefillDataArr = $this->getAddressesByGUID($id, $module);
871 875
             //When coming from convert leads, sometimes module is Contacts while the id is for a lead.
872
-            if (empty($prefillDataArr) && $module == "Contacts")
873
-                $prefillDataArr = $this->getAddressesByGUID($id, "Leads");
876
+            if (empty($prefillDataArr) && $module == "Contacts") {
877
+                            $prefillDataArr = $this->getAddressesByGUID($id, "Leads");
878
+            }
874 879
         } else if(isset($_REQUEST['full_form']) && !empty($_REQUEST['emailAddressWidget'])){
875 880
             $widget_id = isset($_REQUEST[$module . '_email_widget_id']) ? $_REQUEST[$module . '_email_widget_id'] : '0';
876 881
             $count = 0;
@@ -895,8 +900,9 @@  discard block
 block discarded – undo
895 900
 
896 901
         $required = false;
897 902
         $vardefs = $dictionary[$beanList[$passedModule]]['fields'];
898
-        if (!empty($vardefs['email1']) && isset($vardefs['email1']['required']) && $vardefs['email1']['required'])
899
-            $required = true;
903
+        if (!empty($vardefs['email1']) && isset($vardefs['email1']['required']) && $vardefs['email1']['required']) {
904
+                    $required = true;
905
+        }
900 906
         $this->smarty->assign('required', $required);
901 907
 
902 908
         $this->smarty->assign('module', $saveModule);
@@ -950,13 +956,16 @@  discard block
 block discarded – undo
950 956
      */
951 957
     function getEmailAddressWidgetDetailView($focus, $tpl='')
952 958
     {
953
-        if ( !($this->smarty instanceOf Sugar_Smarty ) )
954
-            $this->smarty = new Sugar_Smarty();
959
+        if ( !($this->smarty instanceOf Sugar_Smarty ) ) {
960
+                    $this->smarty = new Sugar_Smarty();
961
+        }
955 962
 
956 963
         global $app_strings;
957 964
         global $current_user;
958 965
         $assign = array();
959
-        if(empty($focus->id))return '';
966
+        if(empty($focus->id)) {
967
+            return '';
968
+        }
960 969
         $prefillData = $this->getAddressesByGUID($focus->id, $focus->module_dir);
961 970
 
962 971
         foreach($prefillData as $addressItem) {
@@ -985,8 +994,9 @@  discard block
 block discarded – undo
985 994
      */
986 995
     function getEmailAddressWidgetDuplicatesView($focus)
987 996
     {
988
-        if ( !($this->smarty instanceOf Sugar_Smarty ) )
989
-            $this->smarty = new Sugar_Smarty();
997
+        if ( !($this->smarty instanceOf Sugar_Smarty ) ) {
998
+                    $this->smarty = new Sugar_Smarty();
999
+        }
990 1000
 
991 1001
         $count = 0;
992 1002
         $emails = array();
@@ -1146,7 +1156,9 @@  discard block
 block discarded – undo
1146 1156
 
1147 1157
         if($view == 'EditView' || $view == 'QuickCreate' || $view == 'ConvertLead') {
1148 1158
             $module = $focus->module_dir;
1149
-            if ($view == 'ConvertLead' && $module == "Contacts")  $module = "Leads";
1159
+            if ($view == 'ConvertLead' && $module == "Contacts") {
1160
+                $module = "Leads";
1161
+            }
1150 1162
 
1151 1163
             return $sea->getEmailAddressWidgetEditView($focus->id, $module, false,'',$tabindex);
1152 1164
         }
Please login to merge, or discard this patch.
include/SugarOauth.php 3 patches
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -145,34 +145,34 @@  discard block
 block discarded – undo
145 145
          * @return array
146 146
          */
147 147
         public function getAccessToken($url,
148
-                                       Zend_Oauth_Token_Request $token = null,
149
-                                       $httpMethod = null,
150
-                                       Zend_Oauth_Http_AccessToken $request = null)
148
+                                        Zend_Oauth_Token_Request $token = null,
149
+                                        $httpMethod = null,
150
+                                        Zend_Oauth_Http_AccessToken $request = null)
151 151
         {
152 152
             $this->setAccessTokenUrl($url);
153 153
             $this->_last = $token = parent::getAccessToken($_REQUEST, $this->makeRequestToken());
154 154
             return array('oauth_token' => $token->getToken(), 'oauth_token_secret' => $token->getTokenSecret());
155 155
         }
156 156
 
157
-       /**
158
-        * Fetch URL with OAuth
159
-        * @param string $url
160
-        * @param string $params Query params
161
-        * @param string $method HTTP method
162
-        * @param array $headers HTTP headers
163
-        * @return string
164
-        */
157
+        /**
158
+         * Fetch URL with OAuth
159
+         * @param string $url
160
+         * @param string $params Query params
161
+         * @param string $method HTTP method
162
+         * @param array $headers HTTP headers
163
+         * @return string
164
+         */
165 165
         
166 166
         public function fetch($url, $params = null, $method = 'GET', $headers = null)
167 167
         {
168 168
             $acc = $this->makeAccessToken();
169 169
             if ( strpos($url,'?') ) {
170
-               list($clean_url, $query) = explode('?', $url);
171
-               if($query) {
172
-                   $url = $clean_url;
173
-                   parse_str($query, $query_params);
174
-                   $params = array_merge($params?$params:array(), $query_params);
175
-               }
170
+                list($clean_url, $query) = explode('?', $url);
171
+                if($query) {
172
+                    $url = $clean_url;
173
+                    parse_str($query, $query_params);
174
+                    $params = array_merge($params?$params:array(), $query_params);
175
+                }
176 176
             }
177 177
             $client = $acc->getHttpClient($this->_oauth_config, $url);
178 178
             
@@ -212,33 +212,33 @@  discard block
 block discarded – undo
212 212
             $this->_last = $resp = $client->request();
213 213
             $this->_lastReq = $client->getLastRequest();
214 214
             return $resp->getBody();
215
-       }
215
+        }
216 216
 
217
-       /**
218
-        * Get HTTP client
219
-        * @return Zend_Oauth_Client
220
-        */
221
-       public function getClient()
222
-       {
217
+        /**
218
+         * Get HTTP client
219
+         * @return Zend_Oauth_Client
220
+         */
221
+        public function getClient()
222
+        {
223 223
             $acc = $this->makeAccessToken();
224 224
             return $acc->getHttpClient($this->_oauth_config);
225
-       }
225
+        }
226 226
 
227
-       /**
228
-        * Get last response
229
-        * @return string
230
-        */
231
-       public function getLastResponse()
232
-       {
227
+        /**
228
+         * Get last response
229
+         * @return string
230
+         */
231
+        public function getLastResponse()
232
+        {
233 233
             return $this->_last;
234
-       }
234
+        }
235 235
 
236
-       /**
237
-        * Get last request
238
-        * @return string
239
-        */
240
-       public function getLastRequest()
241
-       {
236
+        /**
237
+         * Get last request
238
+         * @return string
239
+         */
240
+        public function getLastRequest()
241
+        {
242 242
             return $this->_lastReq;
243
-       }
243
+        }
244 244
     }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -55,13 +55,13 @@  discard block
 block discarded – undo
55 55
          * @param string $consumer_secret
56 56
          * @param array $params OAuth options
57 57
          */
58
-        public function __construct($consumer_key , $consumer_secret, $params = null)
58
+        public function __construct($consumer_key, $consumer_secret, $params = null)
59 59
         {
60 60
             $this->_oauth_config = array(
61 61
                 'consumerKey' => $consumer_key,
62 62
                 'consumerSecret' => $consumer_secret,
63 63
             );
64
-            if(!empty($params)) {
64
+            if (!empty($params)) {
65 65
                 $this->_oauth_config = array_merge($this->_oauth_config, $params);
66 66
             }
67 67
             parent::__construct($this->_oauth_config);
@@ -120,20 +120,20 @@  discard block
 block discarded – undo
120 120
          */
121 121
         public function getRequestTokenByUrl($url, $callback = null, $params = array())
122 122
         {
123
-            if(!empty($callback)) {
123
+            if (!empty($callback)) {
124 124
                 $this->setCallbackUrl($callback);
125 125
             }
126 126
             list($clean_url, $query) = explode('?', $url);
127
-            if($query) {
127
+            if ($query) {
128 128
                 $url = $clean_url;
129 129
                 parse_str($query, $query_params);
130 130
                 $params = array_merge($params, $query_params);
131 131
             }
132 132
             $this->setRequestTokenUrl($url);
133
-            try{
133
+            try {
134 134
                 $this->_last = $token = parent::getRequestToken($params);
135 135
                 return array('oauth_token' => $token->getToken(), 'oauth_token_secret' => $token->getTokenSecret());
136
-            }catch(Zend_Oauth_Exception $e){
136
+            }catch (Zend_Oauth_Exception $e) {
137 137
                 return array('oauth_token' => '', 'oauth_token_secret' => '');
138 138
             }
139 139
         }
@@ -166,12 +166,12 @@  discard block
 block discarded – undo
166 166
         public function fetch($url, $params = null, $method = 'GET', $headers = null)
167 167
         {
168 168
             $acc = $this->makeAccessToken();
169
-            if ( strpos($url,'?') ) {
169
+            if (strpos($url, '?')) {
170 170
                list($clean_url, $query) = explode('?', $url);
171
-               if($query) {
171
+               if ($query) {
172 172
                    $url = $clean_url;
173 173
                    parse_str($query, $query_params);
174
-                   $params = array_merge($params?$params:array(), $query_params);
174
+                   $params = array_merge($params ? $params : array(), $query_params);
175 175
                }
176 176
             }
177 177
             $client = $acc->getHttpClient($this->_oauth_config, $url);
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
             $proxy_config = SugarModule::get('Administration')->loadBean();
181 181
             $proxy_config->retrieveSettings('proxy');
182 182
             
183
-            if( !empty($proxy_config) && 
183
+            if (!empty($proxy_config) && 
184 184
                 !empty($proxy_config->settings['proxy_on']) &&
185 185
                 $proxy_config->settings['proxy_on'] == 1) {
186 186
                 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
                 $proxy_settings['proxy_host'] = $proxy_config->settings['proxy_host'];
189 189
                 $proxy_settings['proxy_port'] = $proxy_config->settings['proxy_port'];
190 190
     
191
-                if(!empty($proxy_config->settings['proxy_auth'])){
191
+                if (!empty($proxy_config->settings['proxy_auth'])) {
192 192
                     $proxy_settings['proxy_user'] = $proxy_config->settings['proxy_username'];
193 193
                     $proxy_settings['proxy_pass'] = $proxy_config->settings['proxy_password'];
194 194
                 }
@@ -199,11 +199,11 @@  discard block
 block discarded – undo
199 199
             }
200 200
             
201 201
             $client->setMethod($method);
202
-            if(!empty($headers)) {
202
+            if (!empty($headers)) {
203 203
                 $client->setHeaders($headers);
204 204
             }
205
-            if(!empty($params)) {
206
-                if($method == 'GET') {
205
+            if (!empty($params)) {
206
+                if ($method == 'GET') {
207 207
                     $client->setParameterGet($params);
208 208
                 } else {
209 209
                     $client->setParameterPost($params);
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -133,7 +133,7 @@
 block discarded – undo
133 133
             try{
134 134
                 $this->_last = $token = parent::getRequestToken($params);
135 135
                 return array('oauth_token' => $token->getToken(), 'oauth_token_secret' => $token->getTokenSecret());
136
-            }catch(Zend_Oauth_Exception $e){
136
+            } catch(Zend_Oauth_Exception $e){
137 137
                 return array('oauth_token' => '', 'oauth_token_secret' => '');
138 138
             }
139 139
         }
Please login to merge, or discard this patch.
include/phpmailer/language/phpmailer.lang-ar.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 $PHPMAILER_LANG['mailer_not_supported'] = ' برنامج الإرسال غير مدعوم.';
20 20
 $PHPMAILER_LANG['provide_address']      = 'يجب توفير عنوان البريد الإلكتروني لمستلم واحد على الأقل.';
21 21
 $PHPMAILER_LANG['recipients_failed']    = 'خطأ SMTP: الأخطاء التالية ' .
22
-                                          'فشل في الارسال لكل من : ';
22
+                                            'فشل في الارسال لكل من : ';
23 23
 $PHPMAILER_LANG['signing']              = 'خطأ في التوقيع: ';
24 24
 $PHPMAILER_LANG['smtp_connect_failed']  = 'SMTP Connect() غير ممكن.';
25 25
 $PHPMAILER_LANG['smtp_error']           = 'خطأ على مستوى الخادم SMTP: ';
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 $PHPMAILER_LANG['invalid_address']      = 'الإرسال غير ممكن لأن عنوان البريد الإلكتروني غير صالح.';
19 19
 $PHPMAILER_LANG['mailer_not_supported'] = ' برنامج الإرسال غير مدعوم.';
20 20
 $PHPMAILER_LANG['provide_address']      = 'يجب توفير عنوان البريد الإلكتروني لمستلم واحد على الأقل.';
21
-$PHPMAILER_LANG['recipients_failed']    = 'خطأ SMTP: الأخطاء التالية ' .
21
+$PHPMAILER_LANG['recipients_failed']    = 'خطأ SMTP: الأخطاء التالية '.
22 22
                                           'فشل في الارسال لكل من : ';
23 23
 $PHPMAILER_LANG['signing']              = 'خطأ في التوقيع: ';
24 24
 $PHPMAILER_LANG['smtp_connect_failed']  = 'SMTP Connect() غير ممكن.';
Please login to merge, or discard this patch.