Completed
Push — develop ( 7c1bda...edae1e )
by Adam
18:38 queued 03:14
created
modules/AOR_Fields/vardefs.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
23 23
  */
24 24
 
25 25
 $dictionary['AOR_Field'] = array(
26
-	'table'=>'aor_fields',
27
-	'audited'=>false,
28
-	'duplicate_merge'=>true,
29
-	'fields'=>array (
26
+    'table'=>'aor_fields',
27
+    'audited'=>false,
28
+    'duplicate_merge'=>true,
29
+    'fields'=>array (
30 30
         'aor_report_id' =>
31 31
         array (
32 32
             'required' => false,
@@ -338,8 +338,8 @@  discard block
 block discarded – undo
338 338
             'fields' => array('aor_report_id'),
339 339
         ),
340 340
     ),
341
-	'optimistic_locking'=>true,
342
-		'unified_search'=>true,
341
+    'optimistic_locking'=>true,
342
+        'unified_search'=>true,
343 343
 );
344 344
 if (!class_exists('VardefManager')){
345 345
         require_once('include/SugarObjects/VardefManager.php');
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@  discard block
 block discarded – undo
26 26
 	'table'=>'aor_fields',
27 27
 	'audited'=>false,
28 28
 	'duplicate_merge'=>true,
29
-	'fields'=>array (
29
+	'fields'=>array(
30 30
         'aor_report_id' =>
31
-        array (
31
+        array(
32 32
             'required' => false,
33 33
             'name' => 'aor_report_id',
34 34
             'vname' => 'LBL_AOR_REPORT_ID',
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
             'size' => '20',
48 48
         ),
49 49
         'field_order' =>
50
-        array (
50
+        array(
51 51
             'required' => false,
52 52
             'name' => 'field_order',
53 53
             'vname' => 'LBL_ORDER',
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
             'disable_num_format' => '',
69 69
         ),
70 70
         'module_path' =>
71
-        array (
71
+        array(
72 72
             'name' => 'module_path',
73 73
             'type' => 'longtext',
74 74
             'vname' => 'LBL_MODULE_PATH',
75 75
             'isnull' => true,
76 76
         ),
77 77
         'field' =>
78
-        array (
78
+        array(
79 79
             'required' => false,
80 80
             'name' => 'field',
81 81
             'vname' => 'LBL_FIELD',
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
             'dependency' => false,
98 98
         ),
99 99
         'display' =>
100
-        array (
100
+        array(
101 101
             'required' => false,
102 102
             'name' => 'display',
103 103
             'vname' => 'LBL_DISPLAY',
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
             'studio' => 'visible',
116 116
         ),
117 117
         'link' =>
118
-        array (
118
+        array(
119 119
             'required' => false,
120 120
             'name' => 'link',
121 121
             'vname' => 'LBL_LINK',
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
             'studio' => 'visible',
134 134
         ),
135 135
         'label' =>
136
-        array (
136
+        array(
137 137
             'required' => false,
138 138
             'name' => 'label',
139 139
             'vname' => 'LBL_LABEL',
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
             'size' => '20',
153 153
         ),
154 154
         'field_function' =>
155
-        array (
155
+        array(
156 156
             'required' => false,
157 157
             'name' => 'field_function',
158 158
             'vname' => 'LBL_FUNCTION',
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
             'dependency' => false,
175 175
         ),
176 176
         'sort_by' =>
177
-        array (
177
+        array(
178 178
             'required' => false,
179 179
             'name' => 'sort_by',
180 180
             'vname' => 'LBL_SORT',
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
             'dependency' => false,
197 197
         ),
198 198
         'format' =>
199
-            array (
199
+            array(
200 200
                 'required' => false,
201 201
                 'name' => 'format',
202 202
                 'vname' => 'LBL_FORMAT',
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
                 'dependency' => false,
219 219
             ),
220 220
         'total' =>
221
-            array (
221
+            array(
222 222
                 'required' => false,
223 223
                 'name' => 'total',
224 224
                 'vname' => 'LBL_TOTAL',
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
                 'dependency' => false,
241 241
             ),
242 242
         'sort_order' =>
243
-        array (
243
+        array(
244 244
             'required' => false,
245 245
             'name' => 'sort_order',
246 246
             'vname' => 'LBL_SORT_ORDER',
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
             'dependency' => false,
263 263
         ),
264 264
         'group_by' =>
265
-        array (
265
+        array(
266 266
             'required' => false,
267 267
             'name' => 'group_by',
268 268
             'vname' => 'LBL_GROUP',
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
             'studio' => 'visible',
281 281
         ),
282 282
         'group_order' =>
283
-        array (
283
+        array(
284 284
             'required' => false,
285 285
             'name' => 'group_order',
286 286
             'vname' => 'LBL_GROUP_ORDER',
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
             'dependency' => false,
303 303
         ),
304 304
         'group_display' =>
305
-        array (
305
+        array(
306 306
             'required' => false,
307 307
             'name' => 'group_display',
308 308
             'vname' => 'LBL_GROUP_DISPLAY',
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
             'studio' => 'visible',
321 321
         ),
322 322
         'aor_reports' =>
323
-        array (
323
+        array(
324 324
             'name' => 'aor_reports',
325 325
             'type' => 'link',
326 326
             'relationship' => 'aor_reports_aor_fields',
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
             'source'=>'non-db',
330 330
         ),
331 331
     ),
332
-    'relationships'=>array (
332
+    'relationships'=>array(
333 333
     ),
334 334
     'indices' => array(
335 335
         array(
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 	'optimistic_locking'=>true,
342 342
 		'unified_search'=>true,
343 343
 );
344
-if (!class_exists('VardefManager')){
344
+if (!class_exists('VardefManager')) {
345 345
         require_once('include/SugarObjects/VardefManager.php');
346 346
 }
347
-VardefManager::createVardef('AOR_Fields','AOR_Field', array('basic'));
347
+VardefManager::createVardef('AOR_Fields', 'AOR_Field', array('basic'));
Please login to merge, or discard this patch.
modules/AOW_WorkFlow/aow_utils.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -656,7 +656,7 @@
 block discarded – undo
656 656
         }
657 657
     }
658 658
 
659
-   return $users[0];
659
+    return $users[0];
660 660
 }
661 661
 
662 662
 function setLastUser($user_id, $id) {
Please login to merge, or discard this patch.
Spacing   +180 added lines, -180 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  */
24 24
 
25 25
 
26
-function getModuleFields($module, $view='EditView',$value = '', $valid = array())
26
+function getModuleFields($module, $view = 'EditView', $value = '', $valid = array())
27 27
 {
28 28
     global $app_strings, $beanList;
29 29
 
@@ -31,67 +31,67 @@  discard block
 block discarded – undo
31 31
     $unset = array();
32 32
 
33 33
     if ($module != '') {
34
-        if(isset($beanList[$module]) && $beanList[$module]){
34
+        if (isset($beanList[$module]) && $beanList[$module]) {
35 35
             $mod = new $beanList[$module]();
36
-            foreach($mod->field_defs as $name => $arr){
37
-                if(ACLController::checkAccess($mod->module_dir, 'list', true)) {
38
-                    if($arr['type'] != 'link' &&((!isset($arr['source']) || $arr['source'] != 'non-db') || ($arr['type'] == 'relate' && isset($arr['id_name']))) && (empty($valid) || in_array($arr['type'], $valid)) && $name != 'currency_name' && $name != 'currency_symbol'){
39
-                        if(isset($arr['vname']) && $arr['vname'] != ''){
40
-                            $fields[$name] = rtrim(translate($arr['vname'],$mod->module_dir), ':');
36
+            foreach ($mod->field_defs as $name => $arr) {
37
+                if (ACLController::checkAccess($mod->module_dir, 'list', true)) {
38
+                    if ($arr['type'] != 'link' && ((!isset($arr['source']) || $arr['source'] != 'non-db') || ($arr['type'] == 'relate' && isset($arr['id_name']))) && (empty($valid) || in_array($arr['type'], $valid)) && $name != 'currency_name' && $name != 'currency_symbol') {
39
+                        if (isset($arr['vname']) && $arr['vname'] != '') {
40
+                            $fields[$name] = rtrim(translate($arr['vname'], $mod->module_dir), ':');
41 41
                         } else {
42 42
                             $fields[$name] = $name;
43 43
                         }
44
-                        if($arr['type'] == 'relate' && isset($arr['id_name']) && $arr['id_name'] != ''){
44
+                        if ($arr['type'] == 'relate' && isset($arr['id_name']) && $arr['id_name'] != '') {
45 45
                             $unset[] = $arr['id_name'];
46 46
                         }
47 47
                     }
48 48
                 }
49 49
             } //End loop.
50 50
 
51
-            foreach($unset as $name){
52
-                if(isset($fields[$name])) unset( $fields[$name]);
51
+            foreach ($unset as $name) {
52
+                if (isset($fields[$name])) unset($fields[$name]);
53 53
             }
54 54
 
55 55
         }
56 56
     }
57
-    if($view == 'JSON'){
57
+    if ($view == 'JSON') {
58 58
         return json_encode($fields);
59 59
     }
60
-    if($view == 'EditView'){
60
+    if ($view == 'EditView') {
61 61
         return get_select_options_with_id($fields, $value);
62 62
     } else {
63 63
         return $fields[$value];
64 64
     }
65 65
 }
66 66
 
67
-function getRelModuleFields($module, $rel_field, $view='EditView',$value = ''){
67
+function getRelModuleFields($module, $rel_field, $view = 'EditView', $value = '') {
68 68
     global $beanList;
69 69
 
70
-    if($module == $rel_field){
70
+    if ($module == $rel_field) {
71 71
         return getModuleFields($module, $view, $value);
72 72
     }
73 73
 
74 74
     $mod = new $beanList[$module]();
75 75
     $data = $mod->field_defs[$rel_field];
76 76
 
77
-    if(isset($data['module']) && $data['module'] != ''){
77
+    if (isset($data['module']) && $data['module'] != '') {
78 78
         return getModuleFields($data['module'], $view, $value);
79 79
     }
80 80
 
81 81
 }
82 82
 
83
-function getRelatedModule($module, $rel_field){
83
+function getRelatedModule($module, $rel_field) {
84 84
     global $beanList;
85 85
 
86
-    if($module == $rel_field){
86
+    if ($module == $rel_field) {
87 87
         return $module;
88 88
     }
89 89
 
90 90
     $mod = new $beanList[$module]();
91 91
 
92
-    if(isset($arr['module']) && $arr['module'] != '') {
92
+    if (isset($arr['module']) && $arr['module'] != '') {
93 93
         return $arr['module'];
94
-    } else if($mod->load_relationship($rel_field)){
94
+    } else if ($mod->load_relationship($rel_field)) {
95 95
         return $mod->$rel_field->getRelatedModuleName();
96 96
     }
97 97
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 
100 100
 }
101 101
 
102
-function getModuleTreeData($module){
102
+function getModuleTreeData($module) {
103 103
     global $beanList, $app_list_strings;
104 104
 
105 105
     $sort_fields = array();
@@ -112,33 +112,33 @@  discard block
 block discarded – undo
112 112
     );
113 113
 
114 114
     if ($module != '') {
115
-        if(isset($beanList[$module]) && $beanList[$module]){
115
+        if (isset($beanList[$module]) && $beanList[$module]) {
116 116
             $mod = new $beanList[$module]();
117 117
 
118
-            foreach($mod->get_linked_fields() as $name => $arr){
119
-                if(isset($arr['module']) && $arr['module'] != '') {
118
+            foreach ($mod->get_linked_fields() as $name => $arr) {
119
+                if (isset($arr['module']) && $arr['module'] != '') {
120 120
                     $rel_module = $arr['module'];
121
-                } else if($mod->load_relationship($name)){
121
+                } else if ($mod->load_relationship($name)) {
122 122
                     $rel_module = $mod->$name->getRelatedModuleName();
123 123
                 }
124 124
 
125 125
                 $rel_module_label = isset($app_list_strings['moduleList'][$rel_module]) ? $app_list_strings['moduleList'][$rel_module] : $rel_module;
126
-                if(isset($arr['vname']) && $arr['vname'] != '') {
127
-                    $label = $rel_module_label . ' : ' . translate($arr['vname'], $mod->module_dir);
128
-                    $module_label = trim(translate($arr['vname'],$mod->module_dir),':');
129
-                }else {
130
-                    $label = $rel_module_label . ' : '. $name;
126
+                if (isset($arr['vname']) && $arr['vname'] != '') {
127
+                    $label = $rel_module_label.' : '.translate($arr['vname'], $mod->module_dir);
128
+                    $module_label = trim(translate($arr['vname'], $mod->module_dir), ':');
129
+                } else {
130
+                    $label = $rel_module_label.' : '.$name;
131 131
                     $module_label = $name;
132 132
                 }
133
-                $sort_fields[$name] = array('label'=>$label,'type'=>'relationship','module' => $rel_module,'module_label'=>$module_label);
134
-                if($arr['type'] == 'relate' && isset($arr['id_name']) && $arr['id_name'] != ''){
135
-                    if(isset($fields[$arr['id_name']])){
136
-                        unset( $fields[$arr['id_name']]);
133
+                $sort_fields[$name] = array('label'=>$label, 'type'=>'relationship', 'module' => $rel_module, 'module_label'=>$module_label);
134
+                if ($arr['type'] == 'relate' && isset($arr['id_name']) && $arr['id_name'] != '') {
135
+                    if (isset($fields[$arr['id_name']])) {
136
+                        unset($fields[$arr['id_name']]);
137 137
                     }
138 138
                 }
139 139
             } //End loop.
140
-            uasort($sort_fields,function($a,$b){
141
-                return strcmp($a['label'],$b['label']);
140
+            uasort($sort_fields, function($a, $b) {
141
+                return strcmp($a['label'], $b['label']);
142 142
             });
143 143
 
144 144
             $fields = array_merge((array)$fields, (array)$sort_fields);
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
     return json_encode($fields);
149 149
 }
150 150
 
151
-function getModuleRelationships($module, $view='EditView',$value = '')
151
+function getModuleRelationships($module, $view = 'EditView', $value = '')
152 152
 {
153 153
     global $beanList, $app_list_strings;
154 154
 
@@ -157,27 +157,27 @@  discard block
 block discarded – undo
157 157
     $invalid_modules = array();
158 158
 
159 159
     if ($module != '') {
160
-        if(isset($beanList[$module]) && $beanList[$module]){
160
+        if (isset($beanList[$module]) && $beanList[$module]) {
161 161
             $mod = new $beanList[$module]();
162 162
 
163 163
             /*if($mod->is_AuditEnabled()){
164 164
                 $fields['Audit'] = translate('LBL_AUDIT_TABLE','AOR_Fields');
165 165
             }*/
166
-            foreach($mod->get_linked_fields() as $name => $arr){
167
-                if(isset($arr['module']) && $arr['module'] != '') {
166
+            foreach ($mod->get_linked_fields() as $name => $arr) {
167
+                if (isset($arr['module']) && $arr['module'] != '') {
168 168
                     $rel_module = $arr['module'];
169
-                } else if($mod->load_relationship($name)){
169
+                } else if ($mod->load_relationship($name)) {
170 170
                     $rel_module = $mod->$name->getRelatedModuleName();
171 171
                 }
172
-                if(!in_array($rel_module,$invalid_modules)){
172
+                if (!in_array($rel_module, $invalid_modules)) {
173 173
                     $relModuleName = isset($app_list_strings['moduleList'][$rel_module]) ? $app_list_strings['moduleList'][$rel_module] : $rel_module;
174
-                    if(isset($arr['vname']) && $arr['vname'] != ''){
175
-                        $sort_fields[$name] = $relModuleName.' : '.translate($arr['vname'],$mod->module_dir);
174
+                    if (isset($arr['vname']) && $arr['vname'] != '') {
175
+                        $sort_fields[$name] = $relModuleName.' : '.translate($arr['vname'], $mod->module_dir);
176 176
                     } else {
177
-                        $sort_fields[$name] = $relModuleName.' : '. $name;
177
+                        $sort_fields[$name] = $relModuleName.' : '.$name;
178 178
                     }
179
-                    if($arr['type'] == 'relate' && isset($arr['id_name']) && $arr['id_name'] != ''){
180
-                        if(isset($fields[$arr['id_name']])) unset( $fields[$arr['id_name']]);
179
+                    if ($arr['type'] == 'relate' && isset($arr['id_name']) && $arr['id_name'] != '') {
180
+                        if (isset($fields[$arr['id_name']])) unset($fields[$arr['id_name']]);
181 181
                     }
182 182
                 }
183 183
             } //End loop.
@@ -185,26 +185,26 @@  discard block
 block discarded – undo
185 185
             $fields = array_merge((array)$fields, (array)$sort_fields);
186 186
         }
187 187
     }
188
-    if($view == 'EditView'){
188
+    if ($view == 'EditView') {
189 189
         return get_select_options_with_id($fields, $value);
190 190
     } else {
191 191
         return $fields[$value];
192 192
     }
193 193
 }
194 194
 
195
-function getValidFieldsTypes($module, $field){
195
+function getValidFieldsTypes($module, $field) {
196 196
     global $beanFiles, $beanList;
197 197
 
198 198
     require_once($beanFiles[$beanList[$module]]);
199 199
     $focus = new $beanList[$module];
200 200
     $vardef = $focus->getFieldDefinition($field);
201 201
 
202
-    switch($vardef['type']) {
202
+    switch ($vardef['type']) {
203 203
         case 'double':
204 204
         case 'decimal':
205 205
         case 'float':
206 206
         case 'currency':
207
-            $valid_type = array('double','decimal','float','currency');
207
+            $valid_type = array('double', 'decimal', 'float', 'currency');
208 208
             break;
209 209
         case 'uint':
210 210
         case 'ulong':
@@ -212,12 +212,12 @@  discard block
 block discarded – undo
212 212
         case 'short':
213 213
         case 'tinyint':
214 214
         case 'int':
215
-            $valid_type = array('uint','ulong','long','short','tinyint','int');
215
+            $valid_type = array('uint', 'ulong', 'long', 'short', 'tinyint', 'int');
216 216
             break;
217 217
         case 'date':
218 218
         case 'datetime':
219 219
         case 'datetimecombo':
220
-            $valid_type = array('date','datetime', 'datetimecombo');
220
+            $valid_type = array('date', 'datetime', 'datetimecombo');
221 221
             break;
222 222
         case 'id':
223 223
         case 'relate':
@@ -234,29 +234,29 @@  discard block
 block discarded – undo
234 234
 }
235 235
 
236 236
 
237
-function getModuleField($module, $fieldname, $aow_field, $view='EditView',$value = '', $alt_type = '', $currency_id = '', $params= array()){
237
+function getModuleField($module, $fieldname, $aow_field, $view = 'EditView', $value = '', $alt_type = '', $currency_id = '', $params = array()) {
238 238
     global $current_language, $app_strings, $app_list_strings, $current_user, $beanFiles, $beanList;
239 239
 
240 240
     // use the mod_strings for this module
241
-    $mod_strings = return_module_language($current_language,$module);
241
+    $mod_strings = return_module_language($current_language, $module);
242 242
 
243 243
     // set the filename for this control
244
-    $file = create_cache_directory('modules/AOW_WorkFlow/') . $module . $view . $alt_type . $fieldname . '.tpl';
244
+    $file = create_cache_directory('modules/AOW_WorkFlow/').$module.$view.$alt_type.$fieldname.'.tpl';
245 245
 
246 246
     $displayParams = array();
247 247
 
248
-    if ( !is_file($file)
248
+    if (!is_file($file)
249 249
         || inDeveloperMode()
250
-        || !empty($_SESSION['developerMode']) ) {
250
+        || !empty($_SESSION['developerMode'])) {
251 251
 
252
-        if ( !isset($vardef) ) {
252
+        if (!isset($vardef)) {
253 253
             require_once($beanFiles[$beanList[$module]]);
254 254
             $focus = new $beanList[$module];
255 255
             $vardef = $focus->getFieldDefinition($fieldname);
256 256
         }
257 257
 
258 258
         // Bug: check for AOR value SecurityGroups value missing
259
-        if(stristr($fieldname, 'securitygroups') != false && empty($vardef)) {
259
+        if (stristr($fieldname, 'securitygroups') != false && empty($vardef)) {
260 260
             require_once($beanFiles[$beanList['SecurityGroups']]);
261 261
             $module = 'SecurityGroups';
262 262
             $focus = new $beanList[$module];
@@ -267,36 +267,36 @@  discard block
 block discarded – undo
267 267
         //$displayParams['formName'] = 'EditView';
268 268
 
269 269
         // if this is the id relation field, then don't have a pop-up selector.
270
-        if( $vardef['type'] == 'relate' && $vardef['id_name'] == $vardef['name']) {
270
+        if ($vardef['type'] == 'relate' && $vardef['id_name'] == $vardef['name']) {
271 271
             $vardef['type'] = 'varchar';
272 272
         }
273 273
 
274
-        if(isset($vardef['precision'])) unset($vardef['precision']);
274
+        if (isset($vardef['precision'])) unset($vardef['precision']);
275 275
 
276 276
         //$vardef['precision'] = $locale->getPrecedentPreference('default_currency_significant_digits', $current_user);
277 277
 
278 278
         //TODO Fix datetimecomebo
279 279
         //temp work around
280
-        if( $vardef['type'] == 'datetimecombo') {
280
+        if ($vardef['type'] == 'datetimecombo') {
281 281
             $vardef['type'] = 'datetime';
282 282
         }
283 283
 
284 284
         // trim down textbox display
285
-        if( $vardef['type'] == 'text' ) {
285
+        if ($vardef['type'] == 'text') {
286 286
             $vardef['rows'] = 2;
287 287
             $vardef['cols'] = 32;
288 288
         }
289 289
 
290 290
         // create the dropdowns for the parent type fields
291
-        if ( $vardef['type'] == 'parent_type' ) {
291
+        if ($vardef['type'] == 'parent_type') {
292 292
             $vardef['type'] = 'enum';
293 293
         }
294 294
 
295
-        if($vardef['type'] == 'link'){
295
+        if ($vardef['type'] == 'link') {
296 296
             $vardef['type'] = 'relate';
297 297
             $vardef['rname'] = 'name';
298 298
             $vardef['id_name'] = $vardef['name'].'_id';
299
-            if((!isset($vardef['module']) || $vardef['module'] == '') && $focus->load_relationship($vardef['name'])) {
299
+            if ((!isset($vardef['module']) || $vardef['module'] == '') && $focus->load_relationship($vardef['name'])) {
300 300
                 $relName = $vardef['name'];
301 301
                 $vardef['module'] = $focus->$relName->getRelatedModuleName();
302 302
             }
@@ -304,24 +304,24 @@  discard block
 block discarded – undo
304 304
         }
305 305
 
306 306
         //check for $alt_type
307
-        if ( $alt_type != '' ) {
307
+        if ($alt_type != '') {
308 308
             $vardef['type'] = $alt_type;
309 309
         }
310 310
 
311 311
         // remove the special text entry field function 'getEmailAddressWidget'
312
-        if ( isset($vardef['function'])
313
-            && ( $vardef['function'] == 'getEmailAddressWidget'
314
-                || $vardef['function']['name'] == 'getEmailAddressWidget' ) )
312
+        if (isset($vardef['function'])
313
+            && ($vardef['function'] == 'getEmailAddressWidget'
314
+                || $vardef['function']['name'] == 'getEmailAddressWidget'))
315 315
             unset($vardef['function']);
316 316
 
317
-        if(isset($vardef['name']) && ($vardef['name'] == 'date_entered' || $vardef['name'] == 'date_modified')){
317
+        if (isset($vardef['name']) && ($vardef['name'] == 'date_entered' || $vardef['name'] == 'date_modified')) {
318 318
             $vardef['name'] = 'aow_temp_date';
319 319
         }
320 320
 
321 321
         // load SugarFieldHandler to render the field tpl file
322 322
         static $sfh;
323 323
 
324
-        if(!isset($sfh)) {
324
+        if (!isset($sfh)) {
325 325
             require_once('include/SugarFields/SugarFieldHandler.php');
326 326
             $sfh = new SugarFieldHandler();
327 327
         }
@@ -331,17 +331,17 @@  discard block
 block discarded – undo
331 331
         // Remove all the copyright comments
332 332
         $contents = preg_replace('/\{\*[^\}]*?\*\}/', '', $contents);
333 333
 
334
-        if( $view == 'EditView' &&  ($vardef['type'] == 'relate' || $vardef['type'] == 'parent')){
335
-            $contents = str_replace('"'.$vardef['id_name'].'"','{/literal}"{$fields.'.$vardef['name'].'.id_name}"{literal}', $contents);
336
-            $contents = str_replace('"'.$vardef['name'].'"','{/literal}"{$fields.'.$vardef['name'].'.name}"{literal}', $contents);
334
+        if ($view == 'EditView' && ($vardef['type'] == 'relate' || $vardef['type'] == 'parent')) {
335
+            $contents = str_replace('"'.$vardef['id_name'].'"', '{/literal}"{$fields.'.$vardef['name'].'.id_name}"{literal}', $contents);
336
+            $contents = str_replace('"'.$vardef['name'].'"', '{/literal}"{$fields.'.$vardef['name'].'.name}"{literal}', $contents);
337 337
         }
338 338
 
339 339
         // hack to disable one of the js calls in this control
340
-        if ( isset($vardef['function']) && ( $vardef['function'] == 'getCurrencyDropDown' || $vardef['function']['name'] == 'getCurrencyDropDown' ) )
340
+        if (isset($vardef['function']) && ($vardef['function'] == 'getCurrencyDropDown' || $vardef['function']['name'] == 'getCurrencyDropDown'))
341 341
             $contents .= "{literal}<script>function CurrencyConvertAll() { return; }</script>{/literal}";
342 342
 
343 343
         // Save it to the cache file
344
-        if($fh = @sugar_fopen($file, 'w')) {
344
+        if ($fh = @sugar_fopen($file, 'w')) {
345 345
             fputs($fh, $contents);
346 346
             fclose($fh);
347 347
         }
@@ -358,51 +358,51 @@  discard block
 block discarded – undo
358 358
     $ss->assign('TIME_FORMAT', $time_format);
359 359
     $time_separator = ":";
360 360
     $match = array();
361
-    if(preg_match('/\d+([^\d])\d+([^\d]*)/s', $time_format, $match)) {
361
+    if (preg_match('/\d+([^\d])\d+([^\d]*)/s', $time_format, $match)) {
362 362
         $time_separator = $match[1];
363 363
     }
364 364
     $t23 = strpos($time_format, '23') !== false ? '%H' : '%I';
365
-    if(!isset($match[2]) || $match[2] == '') {
366
-        $ss->assign('CALENDAR_FORMAT', $date_format . ' ' . $t23 . $time_separator . "%M");
365
+    if (!isset($match[2]) || $match[2] == '') {
366
+        $ss->assign('CALENDAR_FORMAT', $date_format.' '.$t23.$time_separator."%M");
367 367
     }
368 368
     else {
369 369
         $pm = $match[2] == "pm" ? "%P" : "%p";
370
-        $ss->assign('CALENDAR_FORMAT', $date_format . ' ' . $t23 . $time_separator . "%M" . $pm);
370
+        $ss->assign('CALENDAR_FORMAT', $date_format.' '.$t23.$time_separator."%M".$pm);
371 371
     }
372 372
 
373 373
     $ss->assign('CALENDAR_FDOW', $current_user->get_first_day_of_week());
374 374
 
375 375
     // populate the fieldlist from the vardefs
376 376
     $fieldlist = array();
377
-    if ( !isset($focus) || !($focus instanceof SugarBean) )
377
+    if (!isset($focus) || !($focus instanceof SugarBean))
378 378
         require_once($beanFiles[$beanList[$module]]);
379 379
     $focus = new $beanList[$module];
380 380
     // create the dropdowns for the parent type fields
381 381
     $vardefFields = $focus->getFieldDefinitions();
382
-    if (isset($vardefFields[$fieldname]['type']) && $vardefFields[$fieldname]['type'] == 'parent_type' ) {
382
+    if (isset($vardefFields[$fieldname]['type']) && $vardefFields[$fieldname]['type'] == 'parent_type') {
383 383
         $focus->field_defs[$fieldname]['options'] = $focus->field_defs[$vardefFields[$fieldname]['group']]['options'];
384 384
     }
385
-    foreach ( $vardefFields as $name => $properties ) {
385
+    foreach ($vardefFields as $name => $properties) {
386 386
         $fieldlist[$name] = $properties;
387 387
         // fill in enums
388
-        if(isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($app_list_strings[$fieldlist[$name]['options']]))
388
+        if (isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($app_list_strings[$fieldlist[$name]['options']]))
389 389
             $fieldlist[$name]['options'] = $app_list_strings[$fieldlist[$name]['options']];
390 390
         // Bug 32626: fall back on checking the mod_strings if not in the app_list_strings
391
-        elseif(isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($mod_strings[$fieldlist[$name]['options']]))
391
+        elseif (isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($mod_strings[$fieldlist[$name]['options']]))
392 392
             $fieldlist[$name]['options'] = $mod_strings[$fieldlist[$name]['options']];
393 393
         // Bug 22730: make sure all enums have the ability to select blank as the default value.
394
-        if(!isset($fieldlist[$name]['options']['']))
394
+        if (!isset($fieldlist[$name]['options']['']))
395 395
             $fieldlist[$name]['options'][''] = '';
396 396
     }
397 397
 
398 398
     // fill in function return values
399
-    if ( !in_array($fieldname,array('email1','email2')) )
399
+    if (!in_array($fieldname, array('email1', 'email2')))
400 400
     {
401 401
         if (!empty($fieldlist[$fieldname]['function']['returns']) && $fieldlist[$fieldname]['function']['returns'] == 'html')
402 402
         {
403 403
             $function = $fieldlist[$fieldname]['function']['name'];
404 404
             // include various functions required in the various vardefs
405
-            if ( isset($fieldlist[$fieldname]['function']['include']) && is_file($fieldlist[$fieldname]['function']['include']))
405
+            if (isset($fieldlist[$fieldname]['function']['include']) && is_file($fieldlist[$fieldname]['function']['include']))
406 406
                 require_once($fieldlist[$fieldname]['function']['include']);
407 407
             $_REQUEST[$fieldname] = $value;
408 408
             $value = $function($focus, $fieldname, $value, $view);
@@ -411,40 +411,40 @@  discard block
 block discarded – undo
411 411
         }
412 412
     }
413 413
 
414
-    if(isset($fieldlist[$fieldname]['type']) && $fieldlist[$fieldname]['type'] == 'link'){
414
+    if (isset($fieldlist[$fieldname]['type']) && $fieldlist[$fieldname]['type'] == 'link') {
415 415
         $fieldlist[$fieldname]['id_name'] = $fieldlist[$fieldname]['name'].'_id';
416 416
 
417
-        if((!isset($fieldlist[$fieldname]['module']) || $fieldlist[$fieldname]['module'] == '') && $focus->load_relationship($fieldlist[$fieldname]['name'])) {
417
+        if ((!isset($fieldlist[$fieldname]['module']) || $fieldlist[$fieldname]['module'] == '') && $focus->load_relationship($fieldlist[$fieldname]['name'])) {
418 418
             $relName = $fieldlist[$fieldname]['name'];
419 419
             $fieldlist[$fieldname]['module'] = $focus->$relName->getRelatedModuleName();
420 420
         }
421 421
     }
422 422
 
423
-    if(isset($fieldlist[$fieldname]['name']) && ($fieldlist[$fieldname]['name'] == 'date_entered' || $fieldlist[$fieldname]['name'] == 'date_modified')){
423
+    if (isset($fieldlist[$fieldname]['name']) && ($fieldlist[$fieldname]['name'] == 'date_entered' || $fieldlist[$fieldname]['name'] == 'date_modified')) {
424 424
         $fieldlist[$fieldname]['name'] = 'aow_temp_date';
425 425
         $fieldlist['aow_temp_date'] = $fieldlist[$fieldname];
426 426
         $fieldname = 'aow_temp_date';
427 427
     }
428 428
 
429 429
     $quicksearch_js = '';
430
-    if(isset( $fieldlist[$fieldname]['id_name'] ) && $fieldlist[$fieldname]['id_name'] != '' && $fieldlist[$fieldname]['id_name'] != $fieldlist[$fieldname]['name']){
430
+    if (isset($fieldlist[$fieldname]['id_name']) && $fieldlist[$fieldname]['id_name'] != '' && $fieldlist[$fieldname]['id_name'] != $fieldlist[$fieldname]['name']) {
431 431
         $rel_value = $value;
432 432
 
433 433
         require_once("include/TemplateHandler/TemplateHandler.php");
434 434
         $template_handler = new TemplateHandler();
435
-        $quicksearch_js = $template_handler->createQuickSearchCode($fieldlist,$fieldlist,$view);
435
+        $quicksearch_js = $template_handler->createQuickSearchCode($fieldlist, $fieldlist, $view);
436 436
         $quicksearch_js = str_replace($fieldname, $aow_field.'_display', $quicksearch_js);
437 437
         $quicksearch_js = str_replace($fieldlist[$fieldname]['id_name'], $aow_field, $quicksearch_js);
438 438
 
439 439
         echo $quicksearch_js;
440 440
 
441
-        if(isset($fieldlist[$fieldname]['module']) && $fieldlist[$fieldname]['module'] == 'Users'){
441
+        if (isset($fieldlist[$fieldname]['module']) && $fieldlist[$fieldname]['module'] == 'Users') {
442 442
             $rel_value = get_assigned_user_name($value);
443
-        } else if(isset($fieldlist[$fieldname]['module'])){
443
+        } else if (isset($fieldlist[$fieldname]['module'])) {
444 444
             require_once($beanFiles[$beanList[$fieldlist[$fieldname]['module']]]);
445 445
             $rel_focus = new $beanList[$fieldlist[$fieldname]['module']];
446 446
             $rel_focus->retrieve($value);
447
-            if(isset($fieldlist[$fieldname]['rname']) && $fieldlist[$fieldname]['rname'] != ''){
447
+            if (isset($fieldlist[$fieldname]['rname']) && $fieldlist[$fieldname]['rname'] != '') {
448 448
                 $relDisplayField = $fieldlist[$fieldname]['rname'];
449 449
             } else {
450 450
                 $relDisplayField = 'name';
@@ -457,17 +457,17 @@  discard block
 block discarded – undo
457 457
         $fieldlist[$fieldname]['id_name'] = $aow_field;
458 458
         $fieldlist[$fieldlist[$fieldname]['id_name']]['name'] = $aow_field;
459 459
         $fieldlist[$fieldname]['name'] = $aow_field.'_display';
460
-    } else if(isset( $fieldlist[$fieldname]['type'] ) && $view == 'DetailView' && ($fieldlist[$fieldname]['type'] == 'datetimecombo' || $fieldlist[$fieldname]['type'] == 'datetime' || $fieldlist[$fieldname]['type'] == 'date')){
460
+    } else if (isset($fieldlist[$fieldname]['type']) && $view == 'DetailView' && ($fieldlist[$fieldname]['type'] == 'datetimecombo' || $fieldlist[$fieldname]['type'] == 'datetime' || $fieldlist[$fieldname]['type'] == 'date')) {
461 461
         $value = $focus->convertField($value, $fieldlist[$fieldname]);
462
-        if(!empty($params['date_format']) && isset($params['date_format'])){
462
+        if (!empty($params['date_format']) && isset($params['date_format'])) {
463 463
             $convert_format = "Y-m-d H:i:s";
464
-            if($fieldlist[$fieldname]['type'] == 'date') $convert_format = "Y-m-d";
464
+            if ($fieldlist[$fieldname]['type'] == 'date') $convert_format = "Y-m-d";
465 465
             $fieldlist[$fieldname]['value'] = $timedate->to_display($value, $convert_format, $params['date_format']);
466
-        }else{
466
+        } else {
467 467
             $fieldlist[$fieldname]['value'] = $timedate->to_display_date_time($value, true, true);
468 468
         }
469 469
         $fieldlist[$fieldname]['name'] = $aow_field;
470
-    } else if(isset( $fieldlist[$fieldname]['type'] ) && ($fieldlist[$fieldname]['type'] == 'datetimecombo' || $fieldlist[$fieldname]['type'] == 'datetime' || $fieldlist[$fieldname]['type'] == 'date')){
470
+    } else if (isset($fieldlist[$fieldname]['type']) && ($fieldlist[$fieldname]['type'] == 'datetimecombo' || $fieldlist[$fieldname]['type'] == 'datetime' || $fieldlist[$fieldname]['type'] == 'date')) {
471 471
         $value = $focus->convertField($value, $fieldlist[$fieldname]);
472 472
         $fieldlist[$fieldname]['value'] = $timedate->to_display_date($value);
473 473
         //$fieldlist[$fieldname]['value'] = $timedate->to_display_date_time($value, true, true);
@@ -479,17 +479,17 @@  discard block
 block discarded – undo
479 479
 
480 480
     }
481 481
 
482
-    if(isset($fieldlist[$fieldname]['type']) && $fieldlist[$fieldname]['type'] == 'currency' && $view != 'EditView'){
482
+    if (isset($fieldlist[$fieldname]['type']) && $fieldlist[$fieldname]['type'] == 'currency' && $view != 'EditView') {
483 483
         static $sfh;
484 484
 
485
-        if(!isset($sfh)) {
485
+        if (!isset($sfh)) {
486 486
             require_once('include/SugarFields/SugarFieldHandler.php');
487 487
             $sfh = new SugarFieldHandler();
488 488
         }
489 489
 
490
-        if($currency_id != '' && !stripos($fieldname, '_USD')){
490
+        if ($currency_id != '' && !stripos($fieldname, '_USD')) {
491 491
             $userCurrencyId = $current_user->getPreference('currency');
492
-            if($currency_id != $userCurrencyId){
492
+            if ($currency_id != $userCurrencyId) {
493 493
                 $currency = new Currency();
494 494
                 $currency->retrieve($currency_id);
495 495
                 $value = $currency->convertToDollar($value);
@@ -504,9 +504,9 @@  discard block
 block discarded – undo
504 504
     }
505 505
 
506 506
     $ss->assign("QS_JS", $quicksearch_js);
507
-    $ss->assign("fields",$fieldlist);
508
-    $ss->assign("form_name",$view);
509
-    $ss->assign("bean",$focus);
507
+    $ss->assign("fields", $fieldlist);
508
+    $ss->assign("form_name", $view);
509
+    $ss->assign("bean", $focus);
510 510
 
511 511
     // add in any additional strings
512 512
     $ss->assign("MOD", $mod_strings);
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
 
520 520
 
521 521
 
522
-function getDateField($module, $aow_field, $view, $value, $field_option = true){
522
+function getDateField($module, $aow_field, $view, $value, $field_option = true) {
523 523
     global $app_list_strings;
524 524
 
525 525
     // set $view = 'EditView' as default
@@ -529,21 +529,21 @@  discard block
 block discarded – undo
529 529
 
530 530
     $value = json_decode(html_entity_decode_utf8($value), true);
531 531
 
532
-    if(!file_exists('modules/AOBH_BusinessHours/AOBH_BusinessHours.php')) unset($app_list_strings['aow_date_type_list']['business_hours']);
532
+    if (!file_exists('modules/AOBH_BusinessHours/AOBH_BusinessHours.php')) unset($app_list_strings['aow_date_type_list']['business_hours']);
533 533
 
534 534
     $field = '';
535 535
 
536
-    if($view == 'EditView'){
537
-        $field .= "<select type='text' name='$aow_field".'[0]'."' id='$aow_field".'[0]'."' title='' tabindex='116'>". getDateFields($module, $view, $value[0], $field_option) ."</select>&nbsp;&nbsp;";
538
-        $field .= "<select type='text' name='$aow_field".'[1]'."' id='$aow_field".'[1]'."' onchange='date_field_change(\"$aow_field\")'  title='' tabindex='116'>". get_select_options_with_id($app_list_strings['aow_date_operator'], $value[1]) ."</select>&nbsp;";
536
+    if ($view == 'EditView') {
537
+        $field .= "<select type='text' name='$aow_field".'[0]'."' id='$aow_field".'[0]'."' title='' tabindex='116'>".getDateFields($module, $view, $value[0], $field_option)."</select>&nbsp;&nbsp;";
538
+        $field .= "<select type='text' name='$aow_field".'[1]'."' id='$aow_field".'[1]'."' onchange='date_field_change(\"$aow_field\")'  title='' tabindex='116'>".get_select_options_with_id($app_list_strings['aow_date_operator'], $value[1])."</select>&nbsp;";
539 539
         $display = 'none';
540
-        if($value[1] == 'plus' || $value[1] == 'minus') $display = '';
540
+        if ($value[1] == 'plus' || $value[1] == 'minus') $display = '';
541 541
         $field .= "<input  type='text' style='display:$display' name='$aow_field".'[2]'."' id='$aow_field".'[2]'."' title='' value='$value[2]' tabindex='116'>&nbsp;";
542
-        $field .= "<select type='text' style='display:$display' name='$aow_field".'[3]'."' id='$aow_field".'[3]'."' title='' tabindex='116'>". get_select_options_with_id($app_list_strings['aow_date_type_list'], $value[3]) ."</select>";
542
+        $field .= "<select type='text' style='display:$display' name='$aow_field".'[3]'."' id='$aow_field".'[3]'."' title='' tabindex='116'>".get_select_options_with_id($app_list_strings['aow_date_type_list'], $value[3])."</select>";
543 543
     }
544 544
     else {
545 545
         $field = getDateFields($module, $view, $value[0], $field_option).' '.$app_list_strings['aow_date_operator'][$value[1]];
546
-        if($value[1] == 'plus' || $value[1] == 'minus'){
546
+        if ($value[1] == 'plus' || $value[1] == 'minus') {
547 547
             $field .= ' '.$value[2].' '.$app_list_strings['aow_date_type_list'][$value[3]];
548 548
         }
549 549
     }
@@ -551,21 +551,21 @@  discard block
 block discarded – undo
551 551
 
552 552
 }
553 553
 
554
-function getDateFields($module, $view='EditView',$value = '', $field_option = true)
554
+function getDateFields($module, $view = 'EditView', $value = '', $field_option = true)
555 555
 {
556 556
     global $beanList, $app_list_strings;
557 557
 
558 558
     $fields = $app_list_strings['aow_date_options'];
559 559
 
560
-    if(!$field_option) unset($fields['field']);
560
+    if (!$field_option) unset($fields['field']);
561 561
 
562 562
     if ($module != '') {
563
-        if(isset($beanList[$module]) && $beanList[$module]){
563
+        if (isset($beanList[$module]) && $beanList[$module]) {
564 564
             $mod = new $beanList[$module]();
565
-            foreach($mod->field_defs as $name => $arr){
566
-                if($arr['type'] == 'date' || $arr['type'] == 'datetime' || $arr['type'] == 'datetimecombo'){
567
-                    if(isset($arr['vname']) && $arr['vname'] != ''){
568
-                        $fields[$name] = translate($arr['vname'],$mod->module_dir);
565
+            foreach ($mod->field_defs as $name => $arr) {
566
+                if ($arr['type'] == 'date' || $arr['type'] == 'datetime' || $arr['type'] == 'datetimecombo') {
567
+                    if (isset($arr['vname']) && $arr['vname'] != '') {
568
+                        $fields[$name] = translate($arr['vname'], $mod->module_dir);
569 569
                     } else {
570 570
                         $fields[$name] = $name;
571 571
                     }
@@ -574,42 +574,42 @@  discard block
 block discarded – undo
574 574
 
575 575
         }
576 576
     }
577
-    if($view == 'EditView'){
577
+    if ($view == 'EditView') {
578 578
         return get_select_options_with_id($fields, $value);
579 579
     } else {
580 580
         return $fields[$value];
581 581
     }
582 582
 }
583 583
 
584
-function getAssignField($aow_field, $view, $value){
584
+function getAssignField($aow_field, $view, $value) {
585 585
     global $app_list_strings;
586 586
 
587 587
     $value = json_decode(html_entity_decode_utf8($value), true);
588 588
 
589
-    $roles = get_bean_select_array(true, 'ACLRole','name', '','name',true);
589
+    $roles = get_bean_select_array(true, 'ACLRole', 'name', '', 'name', true);
590 590
 
591
-    if(!file_exists('modules/SecurityGroups/SecurityGroup.php')){
591
+    if (!file_exists('modules/SecurityGroups/SecurityGroup.php')) {
592 592
         unset($app_list_strings['aow_assign_options']['security_group']);
593 593
     }
594
-    else{
595
-        $securityGroups = get_bean_select_array(true, 'SecurityGroup','name', '','name',true);
594
+    else {
595
+        $securityGroups = get_bean_select_array(true, 'SecurityGroup', 'name', '', 'name', true);
596 596
     }
597 597
 
598 598
     $field = '';
599 599
 
600
-    if($view == 'EditView'){
601
-        $field .= "<select type='text' name='$aow_field".'[0]'."' id='$aow_field".'[0]'."' onchange='assign_field_change(\"$aow_field\")' title='' tabindex='116'>". get_select_options_with_id($app_list_strings['aow_assign_options'], $value[0]) ."</select>&nbsp;&nbsp;";
602
-        if(!file_exists('modules/SecurityGroups/SecurityGroup.php')){
600
+    if ($view == 'EditView') {
601
+        $field .= "<select type='text' name='$aow_field".'[0]'."' id='$aow_field".'[0]'."' onchange='assign_field_change(\"$aow_field\")' title='' tabindex='116'>".get_select_options_with_id($app_list_strings['aow_assign_options'], $value[0])."</select>&nbsp;&nbsp;";
602
+        if (!file_exists('modules/SecurityGroups/SecurityGroup.php')) {
603 603
             $field .= "<input type='hidden' name='$aow_field".'[1]'."' id='$aow_field".'[1]'."' value=''  />";
604 604
         }
605 605
         else {
606 606
             $display = 'none';
607
-            if($value[0] == 'security_group') $display = '';
608
-            $field .= "<select type='text' style='display:$display' name='$aow_field".'[1]'."' id='$aow_field".'[1]'."' title='' tabindex='116'>". get_select_options_with_id($securityGroups, $value[1]) ."</select>&nbsp;&nbsp;";
607
+            if ($value[0] == 'security_group') $display = '';
608
+            $field .= "<select type='text' style='display:$display' name='$aow_field".'[1]'."' id='$aow_field".'[1]'."' title='' tabindex='116'>".get_select_options_with_id($securityGroups, $value[1])."</select>&nbsp;&nbsp;";
609 609
         }
610 610
         $display = 'none';
611
-        if($value[0] == 'role' || $value[0] == 'security_group') $display = '';
612
-        $field .= "<select type='text' style='display:$display' name='$aow_field".'[2]'."' id='$aow_field".'[2]'."' title='' tabindex='116'>". get_select_options_with_id($roles, $value[2]) ."</select>&nbsp;&nbsp;";
611
+        if ($value[0] == 'role' || $value[0] == 'security_group') $display = '';
612
+        $field .= "<select type='text' style='display:$display' name='$aow_field".'[2]'."' id='$aow_field".'[2]'."' title='' tabindex='116'>".get_select_options_with_id($roles, $value[2])."</select>&nbsp;&nbsp;";
613 613
     }
614 614
     else {
615 615
         $field = $app_list_strings['aow_assign_options'][$value[1]];
@@ -621,10 +621,10 @@  discard block
 block discarded – undo
621 621
 function getDropdownList($list_id, $selected_value) {
622 622
     global $app_list_strings;
623 623
     $option = '';
624
-    foreach($app_list_strings[$list_id] as $key => $value) {
625
-        if(base64_decode($selected_value) == $key) {
624
+    foreach ($app_list_strings[$list_id] as $key => $value) {
625
+        if (base64_decode($selected_value) == $key) {
626 626
             $option .= '<option value="'.$key.'" selected>'.$value.'</option>';
627
-        } else if($selected_value == $key) {
627
+        } else if ($selected_value == $key) {
628 628
             $option .= '<option value="'.$key.'" selected>'.$value.'</option>';
629 629
         }
630 630
         else {
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
 }
636 636
 function getLeastBusyUser($users, $field, SugarBean $bean) {
637 637
     $counts = array();
638
-    foreach($users as $id) {
638
+    foreach ($users as $id) {
639 639
         $c = $bean->db->getOne("SELECT count(*) AS c FROM ".$bean->table_name." WHERE $field = '$id' AND deleted = 0");
640 640
         $counts[$id] = $c;
641 641
     }
@@ -646,21 +646,21 @@  discard block
 block discarded – undo
646 646
 
647 647
 function getRoundRobinUser($users, $id) {
648 648
 
649
-    $file = create_cache_directory('modules/AOW_WorkFlow/Users/') . $id . 'lastUser.cache.php';
649
+    $file = create_cache_directory('modules/AOW_WorkFlow/Users/').$id.'lastUser.cache.php';
650 650
 
651
-    if(isset($_SESSION['lastuser'][$id]) && $_SESSION['lastuser'][$id] != '') {
651
+    if (isset($_SESSION['lastuser'][$id]) && $_SESSION['lastuser'][$id] != '') {
652 652
         $users_by_key = array_flip($users); // now keys are values
653 653
         $key = $users_by_key[$_SESSION['lastuser'][$id]] + 1;
654
-        if(!empty($users[$key])) {
654
+        if (!empty($users[$key])) {
655 655
             return $users[$key];
656 656
         }
657 657
     }
658
-    else if (is_file($file)){
658
+    else if (is_file($file)) {
659 659
         require_once($file);
660
-        if(isset($lastUser['User']) && $lastUser['User'] != '') {
660
+        if (isset($lastUser['User']) && $lastUser['User'] != '') {
661 661
             $users_by_key = array_flip($users); // now keys are values
662 662
             $key = $users_by_key[$lastUser['User']] + 1;
663
-            if(!empty($users[$key])) {
663
+            if (!empty($users[$key])) {
664 664
                 return $users[$key];
665 665
             }
666 666
         }
@@ -673,31 +673,31 @@  discard block
 block discarded – undo
673 673
 
674 674
     $_SESSION['lastuser'][$id] = $user_id;
675 675
 
676
-    $file = create_cache_directory('modules/AOW_WorkFlow/Users/') . $id . 'lastUser.cache.php';
676
+    $file = create_cache_directory('modules/AOW_WorkFlow/Users/').$id.'lastUser.cache.php';
677 677
 
678 678
     $arrayString = var_export_helper(array('User' => $user_id));
679 679
 
680
-    $content =<<<eoq
680
+    $content = <<<eoq
681 681
 <?php
682 682
 	\$lastUser = {$arrayString};
683 683
 ?>
684 684
 eoq;
685 685
 
686
-    if($fh = @sugar_fopen($file, 'w')) {
686
+    if ($fh = @sugar_fopen($file, 'w')) {
687 687
         fputs($fh, $content);
688 688
         fclose($fh);
689 689
     }
690 690
     return true;
691 691
 }
692 692
 
693
-function getEmailableModules(){
693
+function getEmailableModules() {
694 694
     global $beanFiles, $beanList, $app_list_strings;
695 695
     $emailableModules = array();
696
-    foreach($app_list_strings['aow_moduleList'] as $bean_name => $bean_dis) {
697
-        if(isset($beanList[$bean_name]) && isset($beanFiles[$beanList[$bean_name]])){
696
+    foreach ($app_list_strings['aow_moduleList'] as $bean_name => $bean_dis) {
697
+        if (isset($beanList[$bean_name]) && isset($beanFiles[$beanList[$bean_name]])) {
698 698
             require_once($beanFiles[$beanList[$bean_name]]);
699 699
             $obj = new $beanList[$bean_name];
700
-            if($obj instanceof Person || $obj instanceof Company){
700
+            if ($obj instanceof Person || $obj instanceof Company) {
701 701
                 $emailableModules[] = $bean_name;
702 702
             }
703 703
         }
@@ -706,37 +706,37 @@  discard block
 block discarded – undo
706 706
     return $emailableModules;
707 707
 }
708 708
 
709
-function getRelatedEmailableFields($module){
709
+function getRelatedEmailableFields($module) {
710 710
     global $beanList, $app_list_strings;
711 711
     $relEmailFields = array();
712 712
     $checked_link = array();
713 713
     $emailableModules = getEmailableModules();
714 714
     if ($module != '') {
715
-        if(isset($beanList[$module]) && $beanList[$module]){
715
+        if (isset($beanList[$module]) && $beanList[$module]) {
716 716
             $mod = new $beanList[$module]();
717 717
 
718
-            foreach($mod->get_related_fields() as $field){
719
-                if(isset($field['link'])) $checked_link[] = $field['link'];
720
-                if(!isset($field['module']) || !in_array($field['module'],$emailableModules) || (isset($field['dbType']) && $field['dbType'] == "id")){
718
+            foreach ($mod->get_related_fields() as $field) {
719
+                if (isset($field['link'])) $checked_link[] = $field['link'];
720
+                if (!isset($field['module']) || !in_array($field['module'], $emailableModules) || (isset($field['dbType']) && $field['dbType'] == "id")) {
721 721
                     continue;
722 722
                 }
723
-                $relEmailFields[$field['name']] = $field['module'].": ".trim(translate($field['vname'],$mod->module_name),":");
723
+                $relEmailFields[$field['name']] = $field['module'].": ".trim(translate($field['vname'], $mod->module_name), ":");
724 724
             }
725 725
 
726
-            foreach($mod->get_linked_fields() as $field){
727
-                if(!in_array($field['name'],$checked_link) && !in_array($field['relationship'],$checked_link)){
728
-                    if(isset($field['module']) && $field['module'] != '') {
726
+            foreach ($mod->get_linked_fields() as $field) {
727
+                if (!in_array($field['name'], $checked_link) && !in_array($field['relationship'], $checked_link)) {
728
+                    if (isset($field['module']) && $field['module'] != '') {
729 729
                         $rel_module = $field['module'];
730
-                    } else if($mod->load_relationship($field['name'])){
730
+                    } else if ($mod->load_relationship($field['name'])) {
731 731
                         $relField = $field['name'];
732 732
                         $rel_module = $mod->$relField->getRelatedModuleName();
733 733
                     }
734 734
 
735
-                    if(in_array($rel_module,$emailableModules)) {
735
+                    if (in_array($rel_module, $emailableModules)) {
736 736
                         if (isset($field['vname']) && $field['vname'] != '') {
737
-                            $relEmailFields[$field['name']] = $app_list_strings['moduleList'][$rel_module] . ' : ' . translate($field['vname'], $mod->module_dir);
737
+                            $relEmailFields[$field['name']] = $app_list_strings['moduleList'][$rel_module].' : '.translate($field['vname'], $mod->module_dir);
738 738
                         } else {
739
-                            $relEmailFields[$field['name']] = $app_list_strings['moduleList'][$rel_module] . ' : ' . $field['name'];
739
+                            $relEmailFields[$field['name']] = $app_list_strings['moduleList'][$rel_module].' : '.$field['name'];
740 740
                         }
741 741
                     }
742 742
                 }
@@ -757,37 +757,37 @@  discard block
 block discarded – undo
757 757
     
758 758
     static $boolean_false_values = array('off', 'false', '0', 'no');
759 759
 
760
-    switch($bean->field_defs[$field]['type']) {
760
+    switch ($bean->field_defs[$field]['type']) {
761 761
         case 'datetime':
762 762
         case 'datetimecombo':
763
-            if(empty($value)) break;
763
+            if (empty($value)) break;
764 764
             if ($value == 'NULL') {
765 765
                 $value = '';
766 766
                 break;
767 767
             }
768
-            if ( ! preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$/',$value) ) {
768
+            if (!preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$/', $value)) {
769 769
                 // This appears to be formatted in user date/time
770 770
                 $value = $timedate->to_db($value);
771 771
             }
772 772
             break;
773 773
         case 'date':
774
-            if(empty($value)) break;
774
+            if (empty($value)) break;
775 775
             if ($value == 'NULL') {
776 776
                 $value = '';
777 777
                 break;
778 778
             }
779
-            if ( ! preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/',$value) ) {
779
+            if (!preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/', $value)) {
780 780
                 // This date appears to be formatted in the user's format
781 781
                 $value = $timedate->to_db_date($value, false);
782 782
             }
783 783
             break;
784 784
         case 'time':
785
-            if(empty($value)) break;
785
+            if (empty($value)) break;
786 786
             if ($value == 'NULL') {
787 787
                 $value = '';
788 788
                 break;
789 789
             }
790
-            if ( preg_match('/(am|pm)/i',$value) ) {
790
+            if (preg_match('/(am|pm)/i', $value)) {
791 791
                 // This time appears to be formatted in the user's format
792 792
                 $value = $timedate->fromUserTime($value)->format(TimeDate::DB_TIME_FORMAT);
793 793
             }
@@ -796,10 +796,10 @@  discard block
 block discarded – undo
796 796
         case 'decimal':
797 797
         case 'currency':
798 798
         case 'float':
799
-            if ( $value === '' || $value == NULL || $value == 'NULL') {
799
+            if ($value === '' || $value == NULL || $value == 'NULL') {
800 800
                 continue;
801 801
             }
802
-            if ( is_string($value) ) {
802
+            if (is_string($value)) {
803 803
                 $value = (float)unformat_number($value);
804 804
             }
805 805
             break;
@@ -809,19 +809,19 @@  discard block
 block discarded – undo
809 809
         case 'short':
810 810
         case 'tinyint':
811 811
         case 'int':
812
-            if ( $value === '' || $value == NULL || $value == 'NULL') {
812
+            if ($value === '' || $value == NULL || $value == 'NULL') {
813 813
                 continue;
814 814
             }
815
-            if ( is_string($value) ) {
815
+            if (is_string($value)) {
816 816
                 $value = (int)unformat_number($value);
817 817
             }
818 818
             break;
819 819
         case 'bool':
820 820
             if (empty($value)) {
821 821
                 $value = false;
822
-            } else if(true === $value || 1 == $value) {
822
+            } else if (true === $value || 1 == $value) {
823 823
                 $value = true;
824
-            } else if(in_array(strval($value), $boolean_false_values)) {
824
+            } else if (in_array(strval($value), $boolean_false_values)) {
825 825
                 $value = false;
826 826
             } else {
827 827
                 $value = true;
Please login to merge, or discard this patch.
Braces   +69 added lines, -43 removed lines patch added patch discarded remove patch
@@ -49,7 +49,9 @@  discard block
 block discarded – undo
49 49
             } //End loop.
50 50
 
51 51
             foreach($unset as $name){
52
-                if(isset($fields[$name])) unset( $fields[$name]);
52
+                if(isset($fields[$name])) {
53
+                    unset( $fields[$name]);
54
+                }
53 55
             }
54 56
 
55 57
         }
@@ -126,7 +128,7 @@  discard block
 block discarded – undo
126 128
                 if(isset($arr['vname']) && $arr['vname'] != '') {
127 129
                     $label = $rel_module_label . ' : ' . translate($arr['vname'], $mod->module_dir);
128 130
                     $module_label = trim(translate($arr['vname'],$mod->module_dir),':');
129
-                }else {
131
+                } else {
130 132
                     $label = $rel_module_label . ' : '. $name;
131 133
                     $module_label = $name;
132 134
                 }
@@ -177,7 +179,9 @@  discard block
 block discarded – undo
177 179
                         $sort_fields[$name] = $relModuleName.' : '. $name;
178 180
                     }
179 181
                     if($arr['type'] == 'relate' && isset($arr['id_name']) && $arr['id_name'] != ''){
180
-                        if(isset($fields[$arr['id_name']])) unset( $fields[$arr['id_name']]);
182
+                        if(isset($fields[$arr['id_name']])) {
183
+                            unset( $fields[$arr['id_name']]);
184
+                        }
181 185
                     }
182 186
                 }
183 187
             } //End loop.
@@ -271,7 +275,9 @@  discard block
 block discarded – undo
271 275
             $vardef['type'] = 'varchar';
272 276
         }
273 277
 
274
-        if(isset($vardef['precision'])) unset($vardef['precision']);
278
+        if(isset($vardef['precision'])) {
279
+            unset($vardef['precision']);
280
+        }
275 281
 
276 282
         //$vardef['precision'] = $locale->getPrecedentPreference('default_currency_significant_digits', $current_user);
277 283
 
@@ -311,8 +317,9 @@  discard block
 block discarded – undo
311 317
         // remove the special text entry field function 'getEmailAddressWidget'
312 318
         if ( isset($vardef['function'])
313 319
             && ( $vardef['function'] == 'getEmailAddressWidget'
314
-                || $vardef['function']['name'] == 'getEmailAddressWidget' ) )
315
-            unset($vardef['function']);
320
+                || $vardef['function']['name'] == 'getEmailAddressWidget' ) ) {
321
+                    unset($vardef['function']);
322
+        }
316 323
 
317 324
         if(isset($vardef['name']) && ($vardef['name'] == 'date_entered' || $vardef['name'] == 'date_modified')){
318 325
             $vardef['name'] = 'aow_temp_date';
@@ -337,8 +344,9 @@  discard block
 block discarded – undo
337 344
         }
338 345
 
339 346
         // hack to disable one of the js calls in this control
340
-        if ( isset($vardef['function']) && ( $vardef['function'] == 'getCurrencyDropDown' || $vardef['function']['name'] == 'getCurrencyDropDown' ) )
341
-            $contents .= "{literal}<script>function CurrencyConvertAll() { return; }</script>{/literal}";
347
+        if ( isset($vardef['function']) && ( $vardef['function'] == 'getCurrencyDropDown' || $vardef['function']['name'] == 'getCurrencyDropDown' ) ) {
348
+                    $contents .= "{literal}<script>function CurrencyConvertAll() { return; }</script>{/literal}";
349
+        }
342 350
 
343 351
         // Save it to the cache file
344 352
         if($fh = @sugar_fopen($file, 'w')) {
@@ -364,8 +372,7 @@  discard block
 block discarded – undo
364 372
     $t23 = strpos($time_format, '23') !== false ? '%H' : '%I';
365 373
     if(!isset($match[2]) || $match[2] == '') {
366 374
         $ss->assign('CALENDAR_FORMAT', $date_format . ' ' . $t23 . $time_separator . "%M");
367
-    }
368
-    else {
375
+    } else {
369 376
         $pm = $match[2] == "pm" ? "%P" : "%p";
370 377
         $ss->assign('CALENDAR_FORMAT', $date_format . ' ' . $t23 . $time_separator . "%M" . $pm);
371 378
     }
@@ -374,8 +381,9 @@  discard block
 block discarded – undo
374 381
 
375 382
     // populate the fieldlist from the vardefs
376 383
     $fieldlist = array();
377
-    if ( !isset($focus) || !($focus instanceof SugarBean) )
378
-        require_once($beanFiles[$beanList[$module]]);
384
+    if ( !isset($focus) || !($focus instanceof SugarBean) ) {
385
+            require_once($beanFiles[$beanList[$module]]);
386
+    }
379 387
     $focus = new $beanList[$module];
380 388
     // create the dropdowns for the parent type fields
381 389
     $vardefFields = $focus->getFieldDefinitions();
@@ -385,14 +393,17 @@  discard block
 block discarded – undo
385 393
     foreach ( $vardefFields as $name => $properties ) {
386 394
         $fieldlist[$name] = $properties;
387 395
         // fill in enums
388
-        if(isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($app_list_strings[$fieldlist[$name]['options']]))
389
-            $fieldlist[$name]['options'] = $app_list_strings[$fieldlist[$name]['options']];
396
+        if(isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($app_list_strings[$fieldlist[$name]['options']])) {
397
+                    $fieldlist[$name]['options'] = $app_list_strings[$fieldlist[$name]['options']];
398
+        }
390 399
         // Bug 32626: fall back on checking the mod_strings if not in the app_list_strings
391
-        elseif(isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($mod_strings[$fieldlist[$name]['options']]))
392
-            $fieldlist[$name]['options'] = $mod_strings[$fieldlist[$name]['options']];
400
+        elseif(isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($mod_strings[$fieldlist[$name]['options']])) {
401
+                    $fieldlist[$name]['options'] = $mod_strings[$fieldlist[$name]['options']];
402
+        }
393 403
         // Bug 22730: make sure all enums have the ability to select blank as the default value.
394
-        if(!isset($fieldlist[$name]['options']['']))
395
-            $fieldlist[$name]['options'][''] = '';
404
+        if(!isset($fieldlist[$name]['options'][''])) {
405
+                    $fieldlist[$name]['options'][''] = '';
406
+        }
396 407
     }
397 408
 
398 409
     // fill in function return values
@@ -402,8 +413,9 @@  discard block
 block discarded – undo
402 413
         {
403 414
             $function = $fieldlist[$fieldname]['function']['name'];
404 415
             // include various functions required in the various vardefs
405
-            if ( isset($fieldlist[$fieldname]['function']['include']) && is_file($fieldlist[$fieldname]['function']['include']))
406
-                require_once($fieldlist[$fieldname]['function']['include']);
416
+            if ( isset($fieldlist[$fieldname]['function']['include']) && is_file($fieldlist[$fieldname]['function']['include'])) {
417
+                            require_once($fieldlist[$fieldname]['function']['include']);
418
+            }
407 419
             $_REQUEST[$fieldname] = $value;
408 420
             $value = $function($focus, $fieldname, $value, $view);
409 421
 
@@ -461,9 +473,11 @@  discard block
 block discarded – undo
461 473
         $value = $focus->convertField($value, $fieldlist[$fieldname]);
462 474
         if(!empty($params['date_format']) && isset($params['date_format'])){
463 475
             $convert_format = "Y-m-d H:i:s";
464
-            if($fieldlist[$fieldname]['type'] == 'date') $convert_format = "Y-m-d";
476
+            if($fieldlist[$fieldname]['type'] == 'date') {
477
+                $convert_format = "Y-m-d";
478
+            }
465 479
             $fieldlist[$fieldname]['value'] = $timedate->to_display($value, $convert_format, $params['date_format']);
466
-        }else{
480
+        } else{
467 481
             $fieldlist[$fieldname]['value'] = $timedate->to_display_date_time($value, true, true);
468 482
         }
469 483
         $fieldlist[$fieldname]['name'] = $aow_field;
@@ -529,7 +543,9 @@  discard block
 block discarded – undo
529 543
 
530 544
     $value = json_decode(html_entity_decode_utf8($value), true);
531 545
 
532
-    if(!file_exists('modules/AOBH_BusinessHours/AOBH_BusinessHours.php')) unset($app_list_strings['aow_date_type_list']['business_hours']);
546
+    if(!file_exists('modules/AOBH_BusinessHours/AOBH_BusinessHours.php')) {
547
+        unset($app_list_strings['aow_date_type_list']['business_hours']);
548
+    }
533 549
 
534 550
     $field = '';
535 551
 
@@ -537,11 +553,12 @@  discard block
 block discarded – undo
537 553
         $field .= "<select type='text' name='$aow_field".'[0]'."' id='$aow_field".'[0]'."' title='' tabindex='116'>". getDateFields($module, $view, $value[0], $field_option) ."</select>&nbsp;&nbsp;";
538 554
         $field .= "<select type='text' name='$aow_field".'[1]'."' id='$aow_field".'[1]'."' onchange='date_field_change(\"$aow_field\")'  title='' tabindex='116'>". get_select_options_with_id($app_list_strings['aow_date_operator'], $value[1]) ."</select>&nbsp;";
539 555
         $display = 'none';
540
-        if($value[1] == 'plus' || $value[1] == 'minus') $display = '';
556
+        if($value[1] == 'plus' || $value[1] == 'minus') {
557
+            $display = '';
558
+        }
541 559
         $field .= "<input  type='text' style='display:$display' name='$aow_field".'[2]'."' id='$aow_field".'[2]'."' title='' value='$value[2]' tabindex='116'>&nbsp;";
542 560
         $field .= "<select type='text' style='display:$display' name='$aow_field".'[3]'."' id='$aow_field".'[3]'."' title='' tabindex='116'>". get_select_options_with_id($app_list_strings['aow_date_type_list'], $value[3]) ."</select>";
543
-    }
544
-    else {
561
+    } else {
545 562
         $field = getDateFields($module, $view, $value[0], $field_option).' '.$app_list_strings['aow_date_operator'][$value[1]];
546 563
         if($value[1] == 'plus' || $value[1] == 'minus'){
547 564
             $field .= ' '.$value[2].' '.$app_list_strings['aow_date_type_list'][$value[3]];
@@ -557,7 +574,9 @@  discard block
 block discarded – undo
557 574
 
558 575
     $fields = $app_list_strings['aow_date_options'];
559 576
 
560
-    if(!$field_option) unset($fields['field']);
577
+    if(!$field_option) {
578
+        unset($fields['field']);
579
+    }
561 580
 
562 581
     if ($module != '') {
563 582
         if(isset($beanList[$module]) && $beanList[$module]){
@@ -590,8 +609,7 @@  discard block
 block discarded – undo
590 609
 
591 610
     if(!file_exists('modules/SecurityGroups/SecurityGroup.php')){
592 611
         unset($app_list_strings['aow_assign_options']['security_group']);
593
-    }
594
-    else{
612
+    } else{
595 613
         $securityGroups = get_bean_select_array(true, 'SecurityGroup','name', '','name',true);
596 614
     }
597 615
 
@@ -601,17 +619,19 @@  discard block
 block discarded – undo
601 619
         $field .= "<select type='text' name='$aow_field".'[0]'."' id='$aow_field".'[0]'."' onchange='assign_field_change(\"$aow_field\")' title='' tabindex='116'>". get_select_options_with_id($app_list_strings['aow_assign_options'], $value[0]) ."</select>&nbsp;&nbsp;";
602 620
         if(!file_exists('modules/SecurityGroups/SecurityGroup.php')){
603 621
             $field .= "<input type='hidden' name='$aow_field".'[1]'."' id='$aow_field".'[1]'."' value=''  />";
604
-        }
605
-        else {
622
+        } else {
606 623
             $display = 'none';
607
-            if($value[0] == 'security_group') $display = '';
624
+            if($value[0] == 'security_group') {
625
+                $display = '';
626
+            }
608 627
             $field .= "<select type='text' style='display:$display' name='$aow_field".'[1]'."' id='$aow_field".'[1]'."' title='' tabindex='116'>". get_select_options_with_id($securityGroups, $value[1]) ."</select>&nbsp;&nbsp;";
609 628
         }
610 629
         $display = 'none';
611
-        if($value[0] == 'role' || $value[0] == 'security_group') $display = '';
630
+        if($value[0] == 'role' || $value[0] == 'security_group') {
631
+            $display = '';
632
+        }
612 633
         $field .= "<select type='text' style='display:$display' name='$aow_field".'[2]'."' id='$aow_field".'[2]'."' title='' tabindex='116'>". get_select_options_with_id($roles, $value[2]) ."</select>&nbsp;&nbsp;";
613
-    }
614
-    else {
634
+    } else {
615 635
         $field = $app_list_strings['aow_assign_options'][$value[1]];
616 636
     }
617 637
     return $field;
@@ -626,8 +646,7 @@  discard block
 block discarded – undo
626 646
             $option .= '<option value="'.$key.'" selected>'.$value.'</option>';
627 647
         } else if($selected_value == $key) {
628 648
             $option .= '<option value="'.$key.'" selected>'.$value.'</option>';
629
-        }
630
-        else {
649
+        } else {
631 650
             $option .= '<option value="'.$key.'">'.$value.'</option>';
632 651
         }
633 652
     }
@@ -654,8 +673,7 @@  discard block
 block discarded – undo
654 673
         if(!empty($users[$key])) {
655 674
             return $users[$key];
656 675
         }
657
-    }
658
-    else if (is_file($file)){
676
+    } else if (is_file($file)){
659 677
         require_once($file);
660 678
         if(isset($lastUser['User']) && $lastUser['User'] != '') {
661 679
             $users_by_key = array_flip($users); // now keys are values
@@ -716,7 +734,9 @@  discard block
 block discarded – undo
716 734
             $mod = new $beanList[$module]();
717 735
 
718 736
             foreach($mod->get_related_fields() as $field){
719
-                if(isset($field['link'])) $checked_link[] = $field['link'];
737
+                if(isset($field['link'])) {
738
+                    $checked_link[] = $field['link'];
739
+                }
720 740
                 if(!isset($field['module']) || !in_array($field['module'],$emailableModules) || (isset($field['dbType']) && $field['dbType'] == "id")){
721 741
                     continue;
722 742
                 }
@@ -760,7 +780,9 @@  discard block
 block discarded – undo
760 780
     switch($bean->field_defs[$field]['type']) {
761 781
         case 'datetime':
762 782
         case 'datetimecombo':
763
-            if(empty($value)) break;
783
+            if(empty($value)) {
784
+                break;
785
+            }
764 786
             if ($value == 'NULL') {
765 787
                 $value = '';
766 788
                 break;
@@ -771,7 +793,9 @@  discard block
 block discarded – undo
771 793
             }
772 794
             break;
773 795
         case 'date':
774
-            if(empty($value)) break;
796
+            if(empty($value)) {
797
+                break;
798
+            }
775 799
             if ($value == 'NULL') {
776 800
                 $value = '';
777 801
                 break;
@@ -782,7 +806,9 @@  discard block
 block discarded – undo
782 806
             }
783 807
             break;
784 808
         case 'time':
785
-            if(empty($value)) break;
809
+            if(empty($value)) {
810
+                break;
811
+            }
786 812
             if ($value == 'NULL') {
787 813
                 $value = '';
788 814
                 break;
Please login to merge, or discard this patch.
tests/tests/modules/Project/ProjectTest.php 3 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -69,8 +69,7 @@
 block discarded – undo
69 69
     	try {
70 70
     		$project->save_relationship_changes(true);
71 71
     		$this->assertTrue(true);
72
-    	}
73
-    	catch (Exception $e) {
72
+    	} catch (Exception $e) {
74 73
     		$this->fail();
75 74
     	}
76 75
         	
Please login to merge, or discard this patch.
Indentation   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -3,132 +3,132 @@  discard block
 block discarded – undo
3 3
 class ProjectTest extends PHPUnit_Framework_TestCase {
4 4
 
5 5
 
6
-	public function testProject()
7
-	{
8
-		//execute the contructor and check for the Object type and  attributes
9
-		$project = new Project();
6
+    public function testProject()
7
+    {
8
+        //execute the contructor and check for the Object type and  attributes
9
+        $project = new Project();
10 10
 
11
-		$this->assertInstanceOf('Project',$project);
12
-		$this->assertInstanceOf('SugarBean',$project);
11
+        $this->assertInstanceOf('Project',$project);
12
+        $this->assertInstanceOf('SugarBean',$project);
13 13
 
14 14
 
15
-		$this->assertAttributeEquals('project', 'table_name', $project);
16
-		$this->assertAttributeEquals('Project', 'module_dir', $project);
17
-		$this->assertAttributeEquals('Project', 'object_name', $project);
15
+        $this->assertAttributeEquals('project', 'table_name', $project);
16
+        $this->assertAttributeEquals('Project', 'module_dir', $project);
17
+        $this->assertAttributeEquals('Project', 'object_name', $project);
18 18
 
19
-		$this->assertAttributeEquals(true, 'new_schema', $project);
19
+        $this->assertAttributeEquals(true, 'new_schema', $project);
20 20
 
21
-	}
21
+    }
22 22
 
23
-	public function testfill_in_additional_detail_fields()
24
-	{
25
-		error_reporting(E_ERROR | E_PARSE);
23
+    public function testfill_in_additional_detail_fields()
24
+    {
25
+        error_reporting(E_ERROR | E_PARSE);
26 26
 
27
-		$project = new Project();
27
+        $project = new Project();
28 28
 
29
-		//test without setting assigned_user_id
30
-		$project->fill_in_additional_detail_fields();
31
-		$this->assertEquals("", $project->assigned_user_name);
29
+        //test without setting assigned_user_id
30
+        $project->fill_in_additional_detail_fields();
31
+        $this->assertEquals("", $project->assigned_user_name);
32 32
 
33 33
 
34
-		//test with assigned_user_id set
35
-		$project->assigned_user_id = 1;
36
-		$project->fill_in_additional_detail_fields();
37
-		$this->assertEquals("Administrator", $project->assigned_user_name);
34
+        //test with assigned_user_id set
35
+        $project->assigned_user_id = 1;
36
+        $project->fill_in_additional_detail_fields();
37
+        $this->assertEquals("Administrator", $project->assigned_user_name);
38 38
 
39
-	}
39
+    }
40 40
 
41 41
 
42
-	public function testfill_in_additional_list_fields()
43
-	{
44
-		$project = new Project();
42
+    public function testfill_in_additional_list_fields()
43
+    {
44
+        $project = new Project();
45 45
 
46
-		//test without setting assigned_user_id
47
-		$project->fill_in_additional_list_fields();
48
-		$this->assertEquals("", $project->assigned_user_name);
46
+        //test without setting assigned_user_id
47
+        $project->fill_in_additional_list_fields();
48
+        $this->assertEquals("", $project->assigned_user_name);
49 49
 
50 50
 
51
-		//test with assigned_user_id set
52
-		$project->assigned_user_id = 1;
53
-		$project->fill_in_additional_list_fields();
54
-		$this->assertEquals("Administrator", $project->assigned_user_name);
51
+        //test with assigned_user_id set
52
+        $project->assigned_user_id = 1;
53
+        $project->fill_in_additional_list_fields();
54
+        $this->assertEquals("Administrator", $project->assigned_user_name);
55 55
 
56
-	}
56
+    }
57 57
 
58 58
 
59 59
     public function testsave_relationship_changes()
60 60
     {
61 61
 
62
-    	$project = new Project();
62
+        $project = new Project();
63 63
 
64
-    	$project->id =1;
65
-    	$_REQUEST['relate_id'] = 2;
66
-    	$_REQUEST['relate_to'] = "contacts";
64
+        $project->id =1;
65
+        $_REQUEST['relate_id'] = 2;
66
+        $_REQUEST['relate_to'] = "contacts";
67 67
 
68
-    	//execute the method and test if it works and does not throws an exception.
69
-    	try {
70
-    		$project->save_relationship_changes(true);
71
-    		$this->assertTrue(true);
72
-    	}
73
-    	catch (Exception $e) {
74
-    		$this->fail();
75
-    	}
68
+        //execute the method and test if it works and does not throws an exception.
69
+        try {
70
+            $project->save_relationship_changes(true);
71
+            $this->assertTrue(true);
72
+        }
73
+        catch (Exception $e) {
74
+            $this->fail();
75
+        }
76 76
 
77 77
     }
78 78
 
79 79
 
80
-	public function test_get_total_estimated_effort()
81
-	{
82
-		//$project = new Project();
83
-		//$result = $project->_get_total_estimated_effort("1");
84
-		$this->markTestIncomplete('Can Not be implemented: Unknown column parent_id in where clause \n Argument 3 passed to MysqlManager::convert() must be of the type array, integer given');
80
+    public function test_get_total_estimated_effort()
81
+    {
82
+        //$project = new Project();
83
+        //$result = $project->_get_total_estimated_effort("1");
84
+        $this->markTestIncomplete('Can Not be implemented: Unknown column parent_id in where clause \n Argument 3 passed to MysqlManager::convert() must be of the type array, integer given');
85 85
 
86
-	}
86
+    }
87 87
 
88 88
 
89
-	public function test_get_total_actual_effort()
90
-	{
91
-		$this->markTestIncomplete('Can Not be implemented: Unknown column parent_id in where clause \n Argument 3 passed to MysqlManager::convert() must be of the type array, integer given');
92
-	}
89
+    public function test_get_total_actual_effort()
90
+    {
91
+        $this->markTestIncomplete('Can Not be implemented: Unknown column parent_id in where clause \n Argument 3 passed to MysqlManager::convert() must be of the type array, integer given');
92
+    }
93 93
 
94 94
 
95
-	public function testget_summary_text()
96
-	{
97
-		$project = new Project();
95
+    public function testget_summary_text()
96
+    {
97
+        $project = new Project();
98 98
 
99
-		//test without setting name
100
-		$this->assertEquals(Null,$project->get_summary_text());
99
+        //test without setting name
100
+        $this->assertEquals(Null,$project->get_summary_text());
101 101
 
102
-		//test with name set
103
-		$project->name = "test";
104
-		$this->assertEquals('test',$project->get_summary_text());
102
+        //test with name set
103
+        $project->name = "test";
104
+        $this->assertEquals('test',$project->get_summary_text());
105 105
 
106
-	}
106
+    }
107 107
 
108 108
 
109
-	public function testbuild_generic_where_clause ()
110
-	{
109
+    public function testbuild_generic_where_clause ()
110
+    {
111 111
 
112
-		$project = new Project();
112
+        $project = new Project();
113 113
 
114
-		//test with empty string params
115
-		$expected = "project.name LIKE '%%'";
116
-		$actual = $project->build_generic_where_clause('');
117
-		$this->assertSame($expected,$actual);
114
+        //test with empty string params
115
+        $expected = "project.name LIKE '%%'";
116
+        $actual = $project->build_generic_where_clause('');
117
+        $this->assertSame($expected,$actual);
118 118
 
119 119
 
120
-		//test with valid string params
121
-		$expected = "project.name LIKE '%%'";
122
-		$actual = $project->build_generic_where_clause('test');
123
-		$this->assertSame($expected,$actual);
120
+        //test with valid string params
121
+        $expected = "project.name LIKE '%%'";
122
+        $actual = $project->build_generic_where_clause('test');
123
+        $this->assertSame($expected,$actual);
124 124
 
125
-	}
125
+    }
126 126
 
127 127
     /**
128 128
      * @todo: NEEDS FIXING!
129 129
      */
130
-	public function testget_list_view_data()
131
-	{
130
+    public function testget_list_view_data()
131
+    {
132 132
         /*
133 133
 		$project = new Project();
134 134
 
@@ -146,44 +146,44 @@  discard block
 block discarded – undo
146 146
 		$this->assertSame($expected, $actual);
147 147
 		*/
148 148
         $this->assertTrue(true, "NEEDS FIXING!");
149
-	}
149
+    }
150 150
 
151
-	public function testbean_implements(){
151
+    public function testbean_implements(){
152 152
 
153
-		$project = new Project();
153
+        $project = new Project();
154 154
 
155
-		$this->assertEquals(false, $project->bean_implements('')); //test with blank value
156
-		$this->assertEquals(false, $project->bean_implements('test')); //test with invalid value
157
-		$this->assertEquals(true, $project->bean_implements('ACL')); //test with valid value
155
+        $this->assertEquals(false, $project->bean_implements('')); //test with blank value
156
+        $this->assertEquals(false, $project->bean_implements('test')); //test with invalid value
157
+        $this->assertEquals(true, $project->bean_implements('ACL')); //test with valid value
158 158
 
159
-	}
159
+    }
160 160
 
161 161
     public function testcreate_export_query()
162 162
     {
163
-    	$project = new Project();
163
+        $project = new Project();
164 164
 
165
-    	//test with empty string params
166
-    	$expected = "SELECT\n				project.*,\n                users.user_name as assigned_user_name ,project_cstm.jjwg_maps_lng_c,project_cstm.jjwg_maps_lat_c,project_cstm.jjwg_maps_geocode_status_c,project_cstm.jjwg_maps_address_c FROM project  LEFT JOIN project_cstm ON project.id = project_cstm.id_c  LEFT JOIN users\n                   	ON project.assigned_user_id=users.id where  project.deleted=0 ";
167
-    	$actual = $project->create_export_query('','');
168
-    	$this->assertSame($expected,$actual);
165
+        //test with empty string params
166
+        $expected = "SELECT\n				project.*,\n                users.user_name as assigned_user_name ,project_cstm.jjwg_maps_lng_c,project_cstm.jjwg_maps_lat_c,project_cstm.jjwg_maps_geocode_status_c,project_cstm.jjwg_maps_address_c FROM project  LEFT JOIN project_cstm ON project.id = project_cstm.id_c  LEFT JOIN users\n                   	ON project.assigned_user_id=users.id where  project.deleted=0 ";
167
+        $actual = $project->create_export_query('','');
168
+        $this->assertSame($expected,$actual);
169 169
 
170 170
 
171
-    	//test with valid string params
172
-    	$expected = "SELECT\n				project.*,\n                users.user_name as assigned_user_name ,project_cstm.jjwg_maps_lng_c,project_cstm.jjwg_maps_lat_c,project_cstm.jjwg_maps_geocode_status_c,project_cstm.jjwg_maps_address_c FROM project  LEFT JOIN project_cstm ON project.id = project_cstm.id_c  LEFT JOIN users\n                   	ON project.assigned_user_id=users.id where (users.user_name) AND  project.deleted=0  ORDER BY project.id";
173
-    	$actual = $project->create_export_query('project.id','users.user_name');
174
-    	$this->assertSame($expected,$actual);
171
+        //test with valid string params
172
+        $expected = "SELECT\n				project.*,\n                users.user_name as assigned_user_name ,project_cstm.jjwg_maps_lng_c,project_cstm.jjwg_maps_lat_c,project_cstm.jjwg_maps_geocode_status_c,project_cstm.jjwg_maps_address_c FROM project  LEFT JOIN project_cstm ON project.id = project_cstm.id_c  LEFT JOIN users\n                   	ON project.assigned_user_id=users.id where (users.user_name) AND  project.deleted=0  ORDER BY project.id";
173
+        $actual = $project->create_export_query('project.id','users.user_name');
174
+        $this->assertSame($expected,$actual);
175 175
 
176 176
     }
177 177
 
178
-	public function testgetAllProjectTasks(){
178
+    public function testgetAllProjectTasks(){
179 179
 
180
-		$project = new Project();
180
+        $project = new Project();
181 181
 
182
-		$project->id = 1;
183
-		$result = $project->getAllProjectTasks();
184
-		$this->assertTrue(is_array($result));
182
+        $project->id = 1;
183
+        $result = $project->getAllProjectTasks();
184
+        $this->assertTrue(is_array($result));
185 185
 
186
-	}
186
+    }
187 187
 
188 188
 }
189 189
 ?>
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@  discard block
 block discarded – undo
8 8
 		//execute the contructor and check for the Object type and  attributes
9 9
 		$project = new Project();
10 10
 
11
-		$this->assertInstanceOf('Project',$project);
12
-		$this->assertInstanceOf('SugarBean',$project);
11
+		$this->assertInstanceOf('Project', $project);
12
+		$this->assertInstanceOf('SugarBean', $project);
13 13
 
14 14
 
15 15
 		$this->assertAttributeEquals('project', 'table_name', $project);
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
     	$project = new Project();
63 63
 
64
-    	$project->id =1;
64
+    	$project->id = 1;
65 65
     	$_REQUEST['relate_id'] = 2;
66 66
     	$_REQUEST['relate_to'] = "contacts";
67 67
 
@@ -97,16 +97,16 @@  discard block
 block discarded – undo
97 97
 		$project = new Project();
98 98
 
99 99
 		//test without setting name
100
-		$this->assertEquals(Null,$project->get_summary_text());
100
+		$this->assertEquals(Null, $project->get_summary_text());
101 101
 
102 102
 		//test with name set
103 103
 		$project->name = "test";
104
-		$this->assertEquals('test',$project->get_summary_text());
104
+		$this->assertEquals('test', $project->get_summary_text());
105 105
 
106 106
 	}
107 107
 
108 108
 
109
-	public function testbuild_generic_where_clause ()
109
+	public function testbuild_generic_where_clause()
110 110
 	{
111 111
 
112 112
 		$project = new Project();
@@ -114,13 +114,13 @@  discard block
 block discarded – undo
114 114
 		//test with empty string params
115 115
 		$expected = "project.name LIKE '%%'";
116 116
 		$actual = $project->build_generic_where_clause('');
117
-		$this->assertSame($expected,$actual);
117
+		$this->assertSame($expected, $actual);
118 118
 
119 119
 
120 120
 		//test with valid string params
121 121
 		$expected = "project.name LIKE '%%'";
122 122
 		$actual = $project->build_generic_where_clause('test');
123
-		$this->assertSame($expected,$actual);
123
+		$this->assertSame($expected, $actual);
124 124
 
125 125
 	}
126 126
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
         $this->assertTrue(true, "NEEDS FIXING!");
149 149
 	}
150 150
 
151
-	public function testbean_implements(){
151
+	public function testbean_implements() {
152 152
 
153 153
 		$project = new Project();
154 154
 
@@ -164,18 +164,18 @@  discard block
 block discarded – undo
164 164
 
165 165
     	//test with empty string params
166 166
     	$expected = "SELECT\n				project.*,\n                users.user_name as assigned_user_name ,project_cstm.jjwg_maps_lng_c,project_cstm.jjwg_maps_lat_c,project_cstm.jjwg_maps_geocode_status_c,project_cstm.jjwg_maps_address_c FROM project  LEFT JOIN project_cstm ON project.id = project_cstm.id_c  LEFT JOIN users\n                   	ON project.assigned_user_id=users.id where  project.deleted=0 ";
167
-    	$actual = $project->create_export_query('','');
168
-    	$this->assertSame($expected,$actual);
167
+    	$actual = $project->create_export_query('', '');
168
+    	$this->assertSame($expected, $actual);
169 169
 
170 170
 
171 171
     	//test with valid string params
172 172
     	$expected = "SELECT\n				project.*,\n                users.user_name as assigned_user_name ,project_cstm.jjwg_maps_lng_c,project_cstm.jjwg_maps_lat_c,project_cstm.jjwg_maps_geocode_status_c,project_cstm.jjwg_maps_address_c FROM project  LEFT JOIN project_cstm ON project.id = project_cstm.id_c  LEFT JOIN users\n                   	ON project.assigned_user_id=users.id where (users.user_name) AND  project.deleted=0  ORDER BY project.id";
173
-    	$actual = $project->create_export_query('project.id','users.user_name');
174
-    	$this->assertSame($expected,$actual);
173
+    	$actual = $project->create_export_query('project.id', 'users.user_name');
174
+    	$this->assertSame($expected, $actual);
175 175
 
176 176
     }
177 177
 
178
-	public function testgetAllProjectTasks(){
178
+	public function testgetAllProjectTasks() {
179 179
 
180 180
 		$project = new Project();
181 181
 
Please login to merge, or discard this patch.
tests/tests/modules/Users/UserTest.php 3 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -221,8 +221,7 @@  discard block
 block discarded – undo
221 221
 		try {
222 222
 			$user->savePreferencesToDB();
223 223
 			$this->assertTrue(true);
224
-		}
225
-		catch (Exception $e) {
224
+		} catch (Exception $e) {
226 225
 			$this->fail();
227 226
 		}
228 227
 		
@@ -1095,8 +1094,7 @@  discard block
 block discarded – undo
1095 1094
     	try {
1096 1095
     		$result = $user->afterImportSave();
1097 1096
     		$this->assertTrue(true);
1098
-    	}
1099
-    	catch (Exception $e) {
1097
+    	} catch (Exception $e) {
1100 1098
     		$this->assertStringStartsWith('Cannot modify header information', $e->getMessage());
1101 1099
     	}
1102 1100
     	
Please login to merge, or discard this patch.
Indentation   +642 added lines, -642 removed lines patch added patch discarded remove patch
@@ -4,976 +4,976 @@  discard block
 block discarded – undo
4 4
 class UserTest extends PHPUnit_Framework_TestCase {
5 5
 
6 6
 
7
-	public function testUser() {
7
+    public function testUser() {
8 8
 
9
-		//execute the contructor and check for the Object type and  attributes
10
-		$user = new User();
9
+        //execute the contructor and check for the Object type and  attributes
10
+        $user = new User();
11 11
 
12
-		$this->assertInstanceOf('User',$user);
13
-		$this->assertInstanceOf('Person',$user);
14
-		$this->assertInstanceOf('SugarBean',$user);
12
+        $this->assertInstanceOf('User',$user);
13
+        $this->assertInstanceOf('Person',$user);
14
+        $this->assertInstanceOf('SugarBean',$user);
15 15
 
16
-		$this->assertAttributeEquals('Users', 'module_dir', $user);
17
-		$this->assertAttributeEquals('User', 'object_name', $user);
18
-		$this->assertAttributeEquals('users', 'table_name', $user);
16
+        $this->assertAttributeEquals('Users', 'module_dir', $user);
17
+        $this->assertAttributeEquals('User', 'object_name', $user);
18
+        $this->assertAttributeEquals('users', 'table_name', $user);
19 19
 
20
-		$this->assertAttributeEquals(true, 'new_schema', $user);
21
-		$this->assertAttributeEquals(false, 'authenticated', $user);
22
-		$this->assertAttributeEquals(true, 'importable', $user);
23
-		$this->assertAttributeEquals(false, 'team_exists', $user);
20
+        $this->assertAttributeEquals(true, 'new_schema', $user);
21
+        $this->assertAttributeEquals(false, 'authenticated', $user);
22
+        $this->assertAttributeEquals(true, 'importable', $user);
23
+        $this->assertAttributeEquals(false, 'team_exists', $user);
24 24
 
25
-	}
25
+    }
26 26
 
27 27
 
28 28
     public function testgetSystemUser()
29 29
     {
30
-    	//unset and reconnect Db to resolve mysqli fetch exeception
31
-    	global $db;
32
-    	unset ($db->database);
33
-    	$db->checkConnection();
30
+        //unset and reconnect Db to resolve mysqli fetch exeception
31
+        global $db;
32
+        unset ($db->database);
33
+        $db->checkConnection();
34 34
 
35
-    	$user = new User();
35
+        $user = new User();
36 36
 
37
-    	$result = $user->getSystemUser();
37
+        $result = $user->getSystemUser();
38 38
 
39
-    	$this->assertInstanceOf('User',$result);
40
-    	$this->assertEquals(1, $result->id);
39
+        $this->assertInstanceOf('User',$result);
40
+        $this->assertEquals(1, $result->id);
41 41
 
42 42
     }
43 43
 
44 44
 
45
-	public function testgetDefaultSignature()
46
-	{
47
-		//unset and reconnect Db to resolve mysqli fetch exeception
48
-		global $db;
49
-		unset ($db->database);
50
-		$db->checkConnection();
45
+    public function testgetDefaultSignature()
46
+    {
47
+        //unset and reconnect Db to resolve mysqli fetch exeception
48
+        global $db;
49
+        unset ($db->database);
50
+        $db->checkConnection();
51 51
 
52
-		$user = new User();
52
+        $user = new User();
53 53
 
54
-		$user->retrieve(1);
54
+        $user->retrieve(1);
55 55
 
56
-		$result = $user->getDefaultSignature();
57
-		$this->assertTrue(is_array($result));
56
+        $result = $user->getDefaultSignature();
57
+        $this->assertTrue(is_array($result));
58 58
 
59
-	}
59
+    }
60 60
 
61 61
 
62
-	public function testgetSignature()
63
-	{
64
-		$user = new User();
62
+    public function testgetSignature()
63
+    {
64
+        $user = new User();
65 65
 
66
-		$user->retrieve(1);
66
+        $user->retrieve(1);
67 67
 
68
-		$result = $user->getSignature(1);
69
-		$this->assertEquals(false,$result);
68
+        $result = $user->getSignature(1);
69
+        $this->assertEquals(false,$result);
70 70
 
71
-	}
71
+    }
72 72
 
73
-	public function testgetSignaturesArray() {
73
+    public function testgetSignaturesArray() {
74 74
 
75
-		$user = new User();
75
+        $user = new User();
76 76
 
77
-		$user->retrieve(1);
77
+        $user->retrieve(1);
78 78
 
79
-		$result = $user->getSignaturesArray();
80
-		$this->assertTrue(is_array($result));
79
+        $result = $user->getSignaturesArray();
80
+        $this->assertTrue(is_array($result));
81 81
 
82
-	}
82
+    }
83 83
 
84 84
 
85
-	public function testgetSignatures()
86
-	{
87
-		$user = new User();
85
+    public function testgetSignatures()
86
+    {
87
+        $user = new User();
88 88
 
89
-		$user->retrieve(1);
89
+        $user->retrieve(1);
90 90
 
91
-		$expected = "<select onChange='setSigEditButtonVisibility();' id='signature_id' name='signature_id'>\n<OPTION selected value=''>--None--</OPTION></select>";
92
-		$actual = $user->getSignatures();
93
-		$this->assertSame($expected, $actual);
91
+        $expected = "<select onChange='setSigEditButtonVisibility();' id='signature_id' name='signature_id'>\n<OPTION selected value=''>--None--</OPTION></select>";
92
+        $actual = $user->getSignatures();
93
+        $this->assertSame($expected, $actual);
94 94
 
95
-	}
95
+    }
96 96
 
97 97
 
98
-	public function testgetSignatureButtons()
99
-	{
98
+    public function testgetSignatureButtons()
99
+    {
100 100
 
101
-		global $mod_strings;
101
+        global $mod_strings;
102 102
 
103
-		$user = new User();
103
+        $user = new User();
104 104
 
105
-		//preset required values
106
-		$user->retrieve(1);
107
-		$mod_strings['LBL_BUTTON_EDIT'] = "";
108
-		$mod_strings['LBL_BUTTON_CREATE'] = "";
105
+        //preset required values
106
+        $user->retrieve(1);
107
+        $mod_strings['LBL_BUTTON_EDIT'] = "";
108
+        $mod_strings['LBL_BUTTON_CREATE'] = "";
109 109
 
110 110
 
111
-		//test with defaultDisplay false
112
-		$expected = "<input class='button' onclick='javascript:open_email_signature_form(\"\", \"1\");' value='' type='button'>&nbsp;<span name=\"edit_sig\" id=\"edit_sig\" style=\"visibility:hidden;\"><input class=\"button\" onclick=\"javascript:open_email_signature_form(document.getElementById('signature_id', '').value)\" value=\"\" type=\"button\" tabindex=\"392\">&nbsp;\n					</span>";
113
-		$actual = $user->getSignatureButtons('');
114
-		$this->assertSame($expected, $actual);
111
+        //test with defaultDisplay false
112
+        $expected = "<input class='button' onclick='javascript:open_email_signature_form(\"\", \"1\");' value='' type='button'>&nbsp;<span name=\"edit_sig\" id=\"edit_sig\" style=\"visibility:hidden;\"><input class=\"button\" onclick=\"javascript:open_email_signature_form(document.getElementById('signature_id', '').value)\" value=\"\" type=\"button\" tabindex=\"392\">&nbsp;\n					</span>";
113
+        $actual = $user->getSignatureButtons('');
114
+        $this->assertSame($expected, $actual);
115 115
 
116 116
 
117
-		//test with defaultDisplay true
118
-		$expected = "<input class='button' onclick='javascript:open_email_signature_form(\"\", \"1\");' value='' type='button'>&nbsp;<span name=\"edit_sig\" id=\"edit_sig\" style=\"visibility:inherit;\"><input class=\"button\" onclick=\"javascript:open_email_signature_form(document.getElementById('signature_id', '').value)\" value=\"\" type=\"button\" tabindex=\"392\">&nbsp;\n					</span>";
119
-		$actual = $user->getSignatureButtons('',true);
120
-		$this->assertSame($expected, $actual);
117
+        //test with defaultDisplay true
118
+        $expected = "<input class='button' onclick='javascript:open_email_signature_form(\"\", \"1\");' value='' type='button'>&nbsp;<span name=\"edit_sig\" id=\"edit_sig\" style=\"visibility:inherit;\"><input class=\"button\" onclick=\"javascript:open_email_signature_form(document.getElementById('signature_id', '').value)\" value=\"\" type=\"button\" tabindex=\"392\">&nbsp;\n					</span>";
119
+        $actual = $user->getSignatureButtons('',true);
120
+        $this->assertSame($expected, $actual);
121 121
 
122
-	}
122
+    }
123 123
 
124 124
 
125
-	public function testhasPersonalEmail()
126
-	{
125
+    public function testhasPersonalEmail()
126
+    {
127 127
 
128
-		$user = new User();
128
+        $user = new User();
129 129
 
130
-		$user->retrieve(2);
130
+        $user->retrieve(2);
131 131
 
132
-		$result = $user->hasPersonalEmail();
133
-		$this->assertEquals(false,$result);
132
+        $result = $user->hasPersonalEmail();
133
+        $this->assertEquals(false,$result);
134 134
 
135
-	}
135
+    }
136 136
 
137 137
 
138
-	public function testgetUserPrivGuid()
139
-	{
140
-		//unset and reconnect Db to resolve mysqli fetch exeception
141
-		global $db;
142
-		unset ($db->database);
143
-		$db->checkConnection();
138
+    public function testgetUserPrivGuid()
139
+    {
140
+        //unset and reconnect Db to resolve mysqli fetch exeception
141
+        global $db;
142
+        unset ($db->database);
143
+        $db->checkConnection();
144 144
 
145
-		$user = new User();
145
+        $user = new User();
146 146
 
147
-		$user->retrieve(1);
147
+        $user->retrieve(1);
148 148
 
149
-		$result = $user->getUserPrivGuid();
149
+        $result = $user->getUserPrivGuid();
150 150
 
151
-		$this->assertTrue(isset($result));
152
-		$this->assertEquals(36, strlen($result));
151
+        $this->assertTrue(isset($result));
152
+        $this->assertEquals(36, strlen($result));
153 153
 
154
-	}
154
+    }
155 155
 
156
-	public function testsetUserPrivGuid()
157
-	{
158
-		//unset and reconnect Db to resolve mysqli fetch exeception
159
-		global $db;
160
-		unset ($db->database);
161
-		$db->checkConnection();
156
+    public function testsetUserPrivGuid()
157
+    {
158
+        //unset and reconnect Db to resolve mysqli fetch exeception
159
+        global $db;
160
+        unset ($db->database);
161
+        $db->checkConnection();
162 162
 
163 163
 
164
-		$user = new User();
164
+        $user = new User();
165 165
 
166
-		$user->retrieve(1);
166
+        $user->retrieve(1);
167 167
 
168
-		$user->setUserPrivGuid();
168
+        $user->setUserPrivGuid();
169 169
 
170
-		$result = $user->getPreference('userPrivGuid', 'global', $user);
170
+        $result = $user->getPreference('userPrivGuid', 'global', $user);
171 171
 
172
-		$this->assertTrue(isset($result));
173
-		$this->assertEquals(36, strlen($result));
172
+        $this->assertTrue(isset($result));
173
+        $this->assertEquals(36, strlen($result));
174 174
 
175
-	}
175
+    }
176 176
 
177
-	public function testSetAndGetAndResetPreference( )
178
-	{
179
-		//unset and reconnect Db to resolve mysqli fetch exeception
180
-		global $db;
181
-		unset ($db->database);
182
-		$db->checkConnection();
177
+    public function testSetAndGetAndResetPreference( )
178
+    {
179
+        //unset and reconnect Db to resolve mysqli fetch exeception
180
+        global $db;
181
+        unset ($db->database);
182
+        $db->checkConnection();
183 183
 
184
-		$user = new User();
184
+        $user = new User();
185 185
 
186
-		$user->retrieve(1);
186
+        $user->retrieve(1);
187 187
 
188 188
 
189
-		//test setPreference method
190
-		$user->setPreference('userPrivGuid', 'someGuid', 0, 'global', $user);
189
+        //test setPreference method
190
+        $user->setPreference('userPrivGuid', 'someGuid', 0, 'global', $user);
191 191
 
192 192
 
193
-		//test getPreference method
194
-		$result = $user->getPreference('userPrivGuid', 'global', $user);
195
-		$this->assertTrue(isset($result));
196
-		$this->assertEquals('someGuid', $result);
193
+        //test getPreference method
194
+        $result = $user->getPreference('userPrivGuid', 'global', $user);
195
+        $this->assertTrue(isset($result));
196
+        $this->assertEquals('someGuid', $result);
197 197
 
198 198
 
199
-		//test resetPreferences method and verify that created preference is no longer available
200
-		$user->resetPreferences();
201
-		$result = $user->getPreference('userPrivGuid', 'global', $user);
202
-		$this->assertFalse(isset($result));
199
+        //test resetPreferences method and verify that created preference is no longer available
200
+        $user->resetPreferences();
201
+        $result = $user->getPreference('userPrivGuid', 'global', $user);
202
+        $this->assertFalse(isset($result));
203 203
 
204
-	}
204
+    }
205 205
 
206 206
 
207 207
 
208 208
 
209
-	public function testsavePreferencesToDB()
210
-	{
211
-		//unset and reconnect Db to resolve mysqli fetch exeception
212
-		global $db;
213
-		unset ($db->database);
214
-		$db->checkConnection();
209
+    public function testsavePreferencesToDB()
210
+    {
211
+        //unset and reconnect Db to resolve mysqli fetch exeception
212
+        global $db;
213
+        unset ($db->database);
214
+        $db->checkConnection();
215 215
 
216
-		$user = new User();
216
+        $user = new User();
217 217
 
218
-		$user->retrieve(1);
218
+        $user->retrieve(1);
219 219
 
220
-		//execute the method and test if it works and does not throws an exception.
221
-		try {
222
-			$user->savePreferencesToDB();
223
-			$this->assertTrue(true);
224
-		}
225
-		catch (Exception $e) {
226
-			$this->fail();
227
-		}
220
+        //execute the method and test if it works and does not throws an exception.
221
+        try {
222
+            $user->savePreferencesToDB();
223
+            $this->assertTrue(true);
224
+        }
225
+        catch (Exception $e) {
226
+            $this->fail();
227
+        }
228 228
 
229
-	}
229
+    }
230 230
 
231 231
 
232
-	public function testreloadPreferences()
233
-	{
234
-		//unset and reconnect Db to resolve mysqli fetch exeception
235
-		global $db;
236
-		unset ($db->database);
237
-		$db->checkConnection();
232
+    public function testreloadPreferences()
233
+    {
234
+        //unset and reconnect Db to resolve mysqli fetch exeception
235
+        global $db;
236
+        unset ($db->database);
237
+        $db->checkConnection();
238 238
 
239
-		$user = new User();
239
+        $user = new User();
240 240
 
241
-		$user->retrieve(1);
241
+        $user->retrieve(1);
242 242
 
243
-		$result = $user->reloadPreferences();
244
-		$this->assertEquals(true, $result);
243
+        $result = $user->reloadPreferences();
244
+        $this->assertEquals(true, $result);
245 245
 
246
-	}
246
+    }
247 247
 
248 248
 
249
-	public function testgetUserDateTimePreferences()
250
-	{
251
-		//unset and reconnect Db to resolve mysqli fetch exeception
252
-		global $db;
253
-		unset ($db->database);
254
-		$db->checkConnection();
249
+    public function testgetUserDateTimePreferences()
250
+    {
251
+        //unset and reconnect Db to resolve mysqli fetch exeception
252
+        global $db;
253
+        unset ($db->database);
254
+        $db->checkConnection();
255 255
 
256
-		$user = new User();
256
+        $user = new User();
257 257
 
258
-		$user->retrieve(1);
258
+        $user->retrieve(1);
259 259
 
260
-		$result = $user->getUserDateTimePreferences();
260
+        $result = $user->getUserDateTimePreferences();
261 261
 
262
-		$this->assertTrue(is_array($result));
263
-		$this->assertTrue(isset($result['date']));
264
-		$this->assertTrue(isset($result['time']));
265
-		$this->assertTrue(isset($result['userGmt']));
266
-		$this->assertTrue(isset($result['userGmtOffset']));
262
+        $this->assertTrue(is_array($result));
263
+        $this->assertTrue(isset($result['date']));
264
+        $this->assertTrue(isset($result['time']));
265
+        $this->assertTrue(isset($result['userGmt']));
266
+        $this->assertTrue(isset($result['userGmtOffset']));
267 267
 
268
-	}
268
+    }
269 269
 
270 270
 
271
-	public function testloadPreferences( )
272
-	{
273
-		//unset and reconnect Db to resolve mysqli fetch exeception
274
-		global $db;
275
-		unset ($db->database);
276
-		$db->checkConnection();
271
+    public function testloadPreferences( )
272
+    {
273
+        //unset and reconnect Db to resolve mysqli fetch exeception
274
+        global $db;
275
+        unset ($db->database);
276
+        $db->checkConnection();
277 277
 
278
-		$user = new User();
278
+        $user = new User();
279 279
 
280
-		$user->retrieve(1);
280
+        $user->retrieve(1);
281 281
 
282
-		$result = $user->loadPreferences();
283
-		$this->assertEquals(true, $result);
282
+        $result = $user->loadPreferences();
283
+        $this->assertEquals(true, $result);
284 284
 
285
-	}
285
+    }
286 286
 
287 287
 
288 288
     public function testGetETagSeedAndIncrementETag(){
289 289
 
290
-    	//unset and reconnect Db to resolve mysqli fetch exeception
291
-    	global $db;
292
-    	unset ($db->database);
293
-    	$db->checkConnection();
290
+        //unset and reconnect Db to resolve mysqli fetch exeception
291
+        global $db;
292
+        unset ($db->database);
293
+        $db->checkConnection();
294 294
 
295
-    	$user = new User();
295
+        $user = new User();
296 296
 
297
-    	$user->retrieve(1);
297
+        $user->retrieve(1);
298 298
 
299
-    	//execute getETagSeed method, get Etag value
300
-    	$ETagInitial = $user->getETagSeed('test');
301
-    	$this->assertGreaterThanOrEqual(0,$ETagInitial);
299
+        //execute getETagSeed method, get Etag value
300
+        $ETagInitial = $user->getETagSeed('test');
301
+        $this->assertGreaterThanOrEqual(0,$ETagInitial);
302 302
 
303 303
 
304
-    	//execute incrementETag to increment
305
-    	$user->incrementETag('test');
304
+        //execute incrementETag to increment
305
+        $user->incrementETag('test');
306 306
 
307 307
 
308
-    	//execute getETagSeed method again, get Etag final value and  compare final and initial values
309
-    	$ETagFinal = $user->getETagSeed('test');
310
-    	$this->assertGreaterThan($ETagInitial, $ETagFinal);
308
+        //execute getETagSeed method again, get Etag final value and  compare final and initial values
309
+        $ETagFinal = $user->getETagSeed('test');
310
+        $this->assertGreaterThan($ETagInitial, $ETagFinal);
311 311
 
312 312
     }
313 313
 
314 314
 
315 315
 
316
-	public function testgetLicensedUsersWhere()
317
-	{
318
-		$expected = "deleted=0 AND status='Active' AND user_name IS NOT NULL AND is_group=0 AND portal_only=0  AND LENGTH(user_name)>0";
319
-		$actual = User::getLicensedUsersWhere();
320
-		$this->assertSame($expected, $actual);
316
+    public function testgetLicensedUsersWhere()
317
+    {
318
+        $expected = "deleted=0 AND status='Active' AND user_name IS NOT NULL AND is_group=0 AND portal_only=0  AND LENGTH(user_name)>0";
319
+        $actual = User::getLicensedUsersWhere();
320
+        $this->assertSame($expected, $actual);
321 321
 
322
-	}
322
+    }
323 323
 
324 324
     public function testget_summary_text()
325 325
     {
326
-    	$user = new User();
326
+        $user = new User();
327 327
 
328
-    	//test without setting name
329
-    	$this->assertEquals(Null,$user->get_summary_text());
328
+        //test without setting name
329
+        $this->assertEquals(Null,$user->get_summary_text());
330 330
 
331
-    	//test with name set
332
-    	$user->name = "test";
333
-    	$this->assertEquals('test',$user->get_summary_text());
331
+        //test with name set
332
+        $user->name = "test";
333
+        $this->assertEquals('test',$user->get_summary_text());
334 334
 
335
-	}
335
+    }
336 336
 
337
-	public function testbean_implements()
338
-	{
339
-		$user = new User();
337
+    public function testbean_implements()
338
+    {
339
+        $user = new User();
340 340
 
341
-		$this->assertEquals(false, $user->bean_implements('')); //test with blank value
342
-		$this->assertEquals(false, $user->bean_implements('test')); //test with invalid value
343
-		$this->assertEquals(true, $user->bean_implements('ACL')); //test with valid value
344
-	}
341
+        $this->assertEquals(false, $user->bean_implements('')); //test with blank value
342
+        $this->assertEquals(false, $user->bean_implements('test')); //test with invalid value
343
+        $this->assertEquals(true, $user->bean_implements('ACL')); //test with valid value
344
+    }
345 345
 
346 346
 
347
-	public function testcheck_role_membership()
348
-	{
349
-		//unset and reconnect Db to resolve mysqli fetch exeception
350
-		global $db;
351
-		unset ($db->database);
352
-		$db->checkConnection();
347
+    public function testcheck_role_membership()
348
+    {
349
+        //unset and reconnect Db to resolve mysqli fetch exeception
350
+        global $db;
351
+        unset ($db->database);
352
+        $db->checkConnection();
353 353
 
354
-		$user = new User();
354
+        $user = new User();
355 355
 
356
-		$result = $user->check_role_membership("test", '');
357
-		$this->assertEquals(false, $result);
356
+        $result = $user->check_role_membership("test", '');
357
+        $this->assertEquals(false, $result);
358 358
 
359 359
 
360
-		$result = $user->check_role_membership("test", '1');
361
-		$this->assertEquals(false, $result);
360
+        $result = $user->check_role_membership("test", '1');
361
+        $this->assertEquals(false, $result);
362 362
 
363
-	}
363
+    }
364 364
 
365 365
 
366
-	public function testsaveAndOthers()
367
-	{
368
-		error_reporting(E_ERROR | E_PARSE);
366
+    public function testsaveAndOthers()
367
+    {
368
+        error_reporting(E_ERROR | E_PARSE);
369 369
 
370
-		//unset and reconnect Db to resolve mysqli fetch exeception
371
-		global $db;
372
-		unset ($db->database);
373
-		$db->checkConnection();
370
+        //unset and reconnect Db to resolve mysqli fetch exeception
371
+        global $db;
372
+        unset ($db->database);
373
+        $db->checkConnection();
374 374
 
375 375
 
376
-		$user = new User();
376
+        $user = new User();
377 377
 
378
-		$user->user_name  = "test";
378
+        $user->user_name  = "test";
379 379
 
380
-		$user->first_name  = "firstn";
381
-		$user->last_name  = "lastn";
380
+        $user->first_name  = "firstn";
381
+        $user->last_name  = "lastn";
382 382
 
383
-		$user->email1 = "[email protected]";
384
-		$user->email2 = "[email protected]";
383
+        $user->email1 = "[email protected]";
384
+        $user->email2 = "[email protected]";
385 385
 
386
-		$result = $user->save();
386
+        $result = $user->save();
387 387
 
388
-		//test for record ID to verify that record is saved
389
-		$this->assertTrue(isset($user->id));
390
-		$this->assertEquals(36, strlen($user->id));
388
+        //test for record ID to verify that record is saved
389
+        $this->assertTrue(isset($user->id));
390
+        $this->assertEquals(36, strlen($user->id));
391 391
 
392 392
 
393
-		//test retrieve method
394
-		$this->retrieve($user->id);
393
+        //test retrieve method
394
+        $this->retrieve($user->id);
395 395
 
396 396
 
397
-		//test retrieve_by_email_address method
398
-		$this->retrieve_by_email_address($user->id);
397
+        //test retrieve_by_email_address method
398
+        $this->retrieve_by_email_address($user->id);
399 399
 
400 400
 
401
-		//test newPassword And findUserPassword methods
402
-		$this->NewPasswordAndFindUserPassword($user->id);
401
+        //test newPassword And findUserPassword methods
402
+        $this->NewPasswordAndFindUserPassword($user->id);
403 403
 
404 404
 
405
-		//test authenticate_user method
406
-		$this->authenticate_user($user->id);
405
+        //test authenticate_user method
406
+        $this->authenticate_user($user->id);
407 407
 
408 408
 
409
-		//test load_user method
410
-		$this->load_user($user->id);
409
+        //test load_user method
410
+        $this->load_user($user->id);
411 411
 
412 412
 
413
-		//test change_password method
414
-		$this->change_password($user->id);
413
+        //test change_password method
414
+        $this->change_password($user->id);
415 415
 
416 416
 
417
-		//test getPreferredEmail method
418
-		$this->getPreferredEmail($user->id);
417
+        //test getPreferredEmail method
418
+        $this->getPreferredEmail($user->id);
419 419
 
420 420
 
421
-		//test getUsersNameAndEmail method
422
-		$this->getUsersNameAndEmail($user->id);
421
+        //test getUsersNameAndEmail method
422
+        $this->getUsersNameAndEmail($user->id);
423 423
 
424 424
 
425
-		//test getEmailInfo method
426
-		$this->getEmailInfo($user->id);
425
+        //test getEmailInfo method
426
+        $this->getEmailInfo($user->id);
427 427
 
428 428
 
429
-		//change username and delete the user to avoid picking it up by password in future
430
-		$user->user_name  = "test_deleted";
431
-		$user->save();
432
-		$user->mark_deleted($user->id);
429
+        //change username and delete the user to avoid picking it up by password in future
430
+        $user->user_name  = "test_deleted";
431
+        $user->save();
432
+        $user->mark_deleted($user->id);
433 433
 
434
-	}
434
+    }
435 435
 
436
-	public function retrieve($id)
437
-	{
438
-		$user = new User();
436
+    public function retrieve($id)
437
+    {
438
+        $user = new User();
439 439
 
440
-		$user->retrieve($id);
440
+        $user->retrieve($id);
441 441
 
442
-		$this->assertEquals("test", $user->user_name);
442
+        $this->assertEquals("test", $user->user_name);
443 443
 
444
-		$this->assertEquals("firstn", $user->first_name);
445
-		$this->assertEquals("lastn", $user->last_name);
444
+        $this->assertEquals("firstn", $user->first_name);
445
+        $this->assertEquals("lastn", $user->last_name);
446 446
 
447
-		$this->assertEquals("[email protected]", $user->email1);
448
-		$this->assertEquals("[email protected]", $user->email2);
447
+        $this->assertEquals("[email protected]", $user->email1);
448
+        $this->assertEquals("[email protected]", $user->email2);
449 449
 
450
-	}
450
+    }
451 451
 
452
-	public function retrieve_by_email_address($id)
453
-	{
454
-		$user = new User();
452
+    public function retrieve_by_email_address($id)
453
+    {
454
+        $user = new User();
455 455
 
456
-		//test with invalid email
457
-		$user->retrieve_by_email_address("[email protected]");
458
-		$this->assertEquals('', $user->id);
456
+        //test with invalid email
457
+        $user->retrieve_by_email_address("[email protected]");
458
+        $this->assertEquals('', $user->id);
459 459
 
460 460
 
461
-		//test with valid email and test for record ID to verify that record is same
462
-		$user->retrieve_by_email_address("[email protected]");
463
-		$this->assertTrue(isset($user->id));
464
-		$this->assertEquals($id, $user->id);
461
+        //test with valid email and test for record ID to verify that record is same
462
+        $user->retrieve_by_email_address("[email protected]");
463
+        $this->assertTrue(isset($user->id));
464
+        $this->assertEquals($id, $user->id);
465 465
 
466
-	}
466
+    }
467 467
 
468
-	public function NewPasswordAndFindUserPassword($id)
469
-	{
470
-		$user = new User();
468
+    public function NewPasswordAndFindUserPassword($id)
469
+    {
470
+        $user = new User();
471 471
 
472
-		$user->retrieve($id);
472
+        $user->retrieve($id);
473 473
 
474
-		//set user password and then retrieve user by created password
475
-		$user->setNewPassword("test");
474
+        //set user password and then retrieve user by created password
475
+        $user->setNewPassword("test");
476 476
 
477
-		$result = User::findUserPassword("test",md5("test"));
477
+        $result = User::findUserPassword("test",md5("test"));
478 478
 
479
-		$this->assertTrue(isset($result['id']));
480
-		$this->assertEquals($id, $result['id']);
479
+        $this->assertTrue(isset($result['id']));
480
+        $this->assertEquals($id, $result['id']);
481 481
 
482
-	}
482
+    }
483 483
 
484 484
 
485
-	public function authenticate_user($id)
486
-	{
487
-		$user = new User();
485
+    public function authenticate_user($id)
486
+    {
487
+        $user = new User();
488 488
 
489
-		$user->retrieve($id);
489
+        $user->retrieve($id);
490 490
 
491
-		//test with invalid password
492
-		$result = $user->authenticate_user(md5("pass"));
493
-		$this->assertEquals(false ,$result);
491
+        //test with invalid password
492
+        $result = $user->authenticate_user(md5("pass"));
493
+        $this->assertEquals(false ,$result);
494 494
 
495
-		//test with invalid password
496
-		$result = $user->authenticate_user(md5("test"));
497
-		$this->assertEquals(true ,$result);
495
+        //test with invalid password
496
+        $result = $user->authenticate_user(md5("test"));
497
+        $this->assertEquals(true ,$result);
498 498
 
499
-	}
499
+    }
500 500
 
501 501
 
502
-	public function load_user($id)
503
-	{
504
-		$user = new User();
502
+    public function load_user($id)
503
+    {
504
+        $user = new User();
505 505
 
506
-		$user->retrieve($id);
506
+        $user->retrieve($id);
507 507
 
508
-		$result = $user->load_user("test");
508
+        $result = $user->load_user("test");
509 509
 
510
-		$this->assertEquals(true, $result->authenticated);
510
+        $this->assertEquals(true, $result->authenticated);
511 511
 
512
-	}
512
+    }
513 513
 
514
-	public function change_password($id)
515
-	{
516
-		$user = new User();
514
+    public function change_password($id)
515
+    {
516
+        $user = new User();
517 517
 
518
-		$user->retrieve($id);
518
+        $user->retrieve($id);
519 519
 
520
-		//execute the method and verifh that it returns true
521
-		$result = $user->change_password("test", "testpass");
522
-		$this->assertEquals(true, $result);
520
+        //execute the method and verifh that it returns true
521
+        $result = $user->change_password("test", "testpass");
522
+        $this->assertEquals(true, $result);
523 523
 
524 524
 
525
-		//find the user by new password
526
-		$result = User::findUserPassword("test",md5("testpass"));
525
+        //find the user by new password
526
+        $result = User::findUserPassword("test",md5("testpass"));
527 527
 
528
-		$this->assertTrue(isset($result['id']));
529
-		$this->assertEquals($id, $result['id']);
528
+        $this->assertTrue(isset($result['id']));
529
+        $this->assertEquals($id, $result['id']);
530 530
 
531
-	}
531
+    }
532 532
 
533
-	public function getPreferredEmail($id)
534
-	{
535
-		$user = new User();
533
+    public function getPreferredEmail($id)
534
+    {
535
+        $user = new User();
536 536
 
537
-		$user->retrieve($id);
537
+        $user->retrieve($id);
538 538
 
539
-		$expected = array("name"=>"firstn lastn", "email"=>"[email protected]" );
539
+        $expected = array("name"=>"firstn lastn", "email"=>"[email protected]" );
540 540
 
541
-		$actual = $user->getPreferredEmail();
541
+        $actual = $user->getPreferredEmail();
542 542
 
543
-		$this->assertSame($actual,$expected);
543
+        $this->assertSame($actual,$expected);
544 544
 
545
-	}
545
+    }
546 546
 
547
-	public function getUsersNameAndEmail($id)
548
-	{
549
-		$user = new User();
547
+    public function getUsersNameAndEmail($id)
548
+    {
549
+        $user = new User();
550 550
 
551
-		$user->retrieve($id);
551
+        $user->retrieve($id);
552 552
 
553
-		$expected = array("name"=>"firstn lastn", "email"=>"[email protected]" );
553
+        $expected = array("name"=>"firstn lastn", "email"=>"[email protected]" );
554 554
 
555
-		$actual = $user->getUsersNameAndEmail();
555
+        $actual = $user->getUsersNameAndEmail();
556 556
 
557
-		$this->assertEquals($actual,$expected);
558
-	}
557
+        $this->assertEquals($actual,$expected);
558
+    }
559 559
 
560 560
 
561
-	public function getEmailInfo($id)
562
-	{
563
-		$user = new User();
561
+    public function getEmailInfo($id)
562
+    {
563
+        $user = new User();
564 564
 
565
-		$expected = array("name"=>"firstn lastn", "email"=>"[email protected]" );
565
+        $expected = array("name"=>"firstn lastn", "email"=>"[email protected]" );
566 566
 
567
-		$actual = $user->getEmailInfo($id);
567
+        $actual = $user->getEmailInfo($id);
568 568
 
569
-		$this->assertEquals($actual,$expected);
570
-	}
569
+        $this->assertEquals($actual,$expected);
570
+    }
571 571
 
572 572
 
573
-	public function testencrypt_password()
574
-	{
575
-		$user = new User();
573
+    public function testencrypt_password()
574
+    {
575
+        $user = new User();
576 576
 
577
-		$result = $user->encrypt_password("test");
578
-		$this->assertTrue(isset($result));
579
-		$this->assertGreaterThan(0,strlen($result));
577
+        $result = $user->encrypt_password("test");
578
+        $this->assertTrue(isset($result));
579
+        $this->assertGreaterThan(0,strlen($result));
580 580
 
581
-	}
581
+    }
582 582
 
583
-	public function testgetPasswordHash()
584
-	{
583
+    public function testgetPasswordHash()
584
+    {
585 585
 
586
-		$result= User::getPasswordHash("test");
586
+        $result= User::getPasswordHash("test");
587 587
 
588
-		$this->assertTrue(isset($result));
589
-		$this->assertGreaterThan(0,strlen($result));
588
+        $this->assertTrue(isset($result));
589
+        $this->assertGreaterThan(0,strlen($result));
590 590
 
591
-		$this->markTestIncomplete('Error: crypt(): No salt parameter was specified. You must use a randomly generated salt and a strong hash function to produce a secure hash.');
591
+        $this->markTestIncomplete('Error: crypt(): No salt parameter was specified. You must use a randomly generated salt and a strong hash function to produce a secure hash.');
592 592
 
593
-	}
593
+    }
594 594
 
595 595
 
596
-	public function testcheckPassword()
597
-	{
596
+    public function testcheckPassword()
597
+    {
598 598
 
599
-		//test with empty password and empty hash
600
-		$result = User::checkPassword("", '');
601
-		$this->assertEquals(false,$result);
599
+        //test with empty password and empty hash
600
+        $result = User::checkPassword("", '');
601
+        $this->assertEquals(false,$result);
602 602
 
603 603
 
604
-		//test with valid hash and empty password
605
-		$result = User::checkPassword("", '$1$Gt0.XI4.$tVVSXgE36sfsVMBNo/9la1');
606
-		$this->assertEquals(false,$result);
604
+        //test with valid hash and empty password
605
+        $result = User::checkPassword("", '$1$Gt0.XI4.$tVVSXgE36sfsVMBNo/9la1');
606
+        $this->assertEquals(false,$result);
607 607
 
608 608
 
609
-		//test with valid password and invalid hash
610
-		$result = User::checkPassword("test", '$1$Gt0.XI4.$tVVSXgE36sfsVMBNo/9la2');
611
-		$this->assertEquals(false,$result);
609
+        //test with valid password and invalid hash
610
+        $result = User::checkPassword("test", '$1$Gt0.XI4.$tVVSXgE36sfsVMBNo/9la2');
611
+        $this->assertEquals(false,$result);
612 612
 
613 613
 
614
-		//test with valid password and valid hash
615
-		$result = User::checkPassword("test", '$1$Gt0.XI4.$tVVSXgE36sfsVMBNo/9la1');
616
-		$this->assertEquals(true,$result);
614
+        //test with valid password and valid hash
615
+        $result = User::checkPassword("test", '$1$Gt0.XI4.$tVVSXgE36sfsVMBNo/9la1');
616
+        $this->assertEquals(true,$result);
617 617
 
618
-	}
618
+    }
619 619
 
620 620
 
621
-	public function testcheckPasswordMD5()
622
-	{
621
+    public function testcheckPasswordMD5()
622
+    {
623 623
 
624
-		//test with empty password and empty hash
625
-		$result = User::checkPasswordMD5(md5(""), '');
626
-		$this->assertEquals(false,$result);
624
+        //test with empty password and empty hash
625
+        $result = User::checkPasswordMD5(md5(""), '');
626
+        $this->assertEquals(false,$result);
627 627
 
628 628
 
629
-		//test with valid hash and empty password
630
-		$result = User::checkPasswordMD5(md5(""), '$1$Gt0.XI4.$tVVSXgE36sfsVMBNo/9la1');
631
-		$this->assertEquals(false,$result);
629
+        //test with valid hash and empty password
630
+        $result = User::checkPasswordMD5(md5(""), '$1$Gt0.XI4.$tVVSXgE36sfsVMBNo/9la1');
631
+        $this->assertEquals(false,$result);
632 632
 
633 633
 
634
-		//test with valid password and invalid hash
635
-		$result = User::checkPasswordMD5(md5("test"), '$1$Gt0.XI4.$tVVSXgE36sfsVMBNo/9la2');
636
-		$this->assertEquals(false,$result);
634
+        //test with valid password and invalid hash
635
+        $result = User::checkPasswordMD5(md5("test"), '$1$Gt0.XI4.$tVVSXgE36sfsVMBNo/9la2');
636
+        $this->assertEquals(false,$result);
637 637
 
638 638
 
639
-		//test with valid password and valid hash
640
-		$result = User::checkPasswordMD5(md5("test"), '$1$Gt0.XI4.$tVVSXgE36sfsVMBNo/9la1');
641
-		$this->assertEquals(true,$result);
639
+        //test with valid password and valid hash
640
+        $result = User::checkPasswordMD5(md5("test"), '$1$Gt0.XI4.$tVVSXgE36sfsVMBNo/9la1');
641
+        $this->assertEquals(true,$result);
642 642
 
643
-	}
643
+    }
644 644
 
645 645
 
646
-	public function testis_authenticated()
647
-	{
646
+    public function testis_authenticated()
647
+    {
648 648
 
649
-		$user = new User();
649
+        $user = new User();
650 650
 
651
-		//test without setting name
652
-		$this->assertEquals(false, $user->is_authenticated());
651
+        //test without setting name
652
+        $this->assertEquals(false, $user->is_authenticated());
653 653
 
654
-		//test with name set
655
-		$user->authenticated = true;
656
-		$this->assertEquals(true,$user->is_authenticated());
654
+        //test with name set
655
+        $user->authenticated = true;
656
+        $this->assertEquals(true,$user->is_authenticated());
657 657
 
658
-	}
658
+    }
659 659
 
660
-	public function testfill_in_additional_list_fields()
661
-	{
660
+    public function testfill_in_additional_list_fields()
661
+    {
662 662
 
663
-		$user = new User();
663
+        $user = new User();
664 664
 
665
-		$user->retrieve(1);
665
+        $user->retrieve(1);
666 666
 
667
-		$user->fill_in_additional_list_fields();
667
+        $user->fill_in_additional_list_fields();
668 668
 
669
-		$this->assertEquals("Administrator",$user->full_name);
669
+        $this->assertEquals("Administrator",$user->full_name);
670 670
 
671
-	}
671
+    }
672 672
 
673
-	public function testfill_in_additional_detail_fields()
674
-	{
673
+    public function testfill_in_additional_detail_fields()
674
+    {
675 675
 
676
-		$user = new User();
676
+        $user = new User();
677 677
 
678
-		$user->retrieve(1);
678
+        $user->retrieve(1);
679 679
 
680
-		$user->fill_in_additional_detail_fields();
680
+        $user->fill_in_additional_detail_fields();
681 681
 
682
-		$this->assertEquals("Administrator",$user->full_name);
682
+        $this->assertEquals("Administrator",$user->full_name);
683 683
 
684
-	}
684
+    }
685 685
 
686
-	public function testretrieve_user_id()
687
-	{
688
-		$user = new User();
686
+    public function testretrieve_user_id()
687
+    {
688
+        $user = new User();
689 689
 
690
-		$result = $user->retrieve_user_id("admin");
691
-		$this->assertEquals(1, $result);
692
-	}
690
+        $result = $user->retrieve_user_id("admin");
691
+        $this->assertEquals(1, $result);
692
+    }
693 693
 
694 694
 
695
-	public function testverify_data()
696
-	{
695
+    public function testverify_data()
696
+    {
697 697
 
698
-		global $mod_strings;
698
+        global $mod_strings;
699 699
 
700
-		$mod_strings['ERR_EMAIL_NO_OPTS'] = "";
700
+        $mod_strings['ERR_EMAIL_NO_OPTS'] = "";
701 701
 
702
-		$user = new User();
702
+        $user = new User();
703 703
 
704
-		$user->retrieve(1);
704
+        $user->retrieve(1);
705 705
 
706
-		//test with default/true
707
-		$result = $user->verify_data();
708
-		$this->assertEquals(true, $result);
706
+        //test with default/true
707
+        $result = $user->verify_data();
708
+        $this->assertEquals(true, $result);
709 709
 
710 710
 
711
-		//test with false
712
-		$result = $user->verify_data(false);
713
-		$this->assertEquals(false, $result);
711
+        //test with false
712
+        $result = $user->verify_data(false);
713
+        $this->assertEquals(false, $result);
714 714
 
715
-	}
715
+    }
716 716
 
717
-	public function testget_list_view_data()
718
-	{
719
-		global $mod_strings;
720
-		$mod_strings['LBL_CHECKMARK'] = "";
717
+    public function testget_list_view_data()
718
+    {
719
+        global $mod_strings;
720
+        $mod_strings['LBL_CHECKMARK'] = "";
721 721
 
722
-		$user = new User();
722
+        $user = new User();
723 723
 
724
-		$user->retrieve(1);
724
+        $user->retrieve(1);
725 725
 
726
-		$result = $user->get_list_view_data();
727
-		$this->assertTrue(is_array($result));
726
+        $result = $user->get_list_view_data();
727
+        $this->assertTrue(is_array($result));
728 728
 
729
-	}
729
+    }
730 730
 
731
-	public function testlist_view_parse_additional_sections()
732
-	{
731
+    public function testlist_view_parse_additional_sections()
732
+    {
733 733
 
734
-		$user = new User();
734
+        $user = new User();
735 735
 
736
-		$list_form = array();
737
-		$result = $user->list_view_parse_additional_sections($list_form);
738
-		$this->assertSame($list_form, $result);
736
+        $list_form = array();
737
+        $result = $user->list_view_parse_additional_sections($list_form);
738
+        $this->assertSame($list_form, $result);
739 739
 
740
-	}
740
+    }
741 741
 
742 742
     public function testGetAllUsersAndGetActiveUsers()
743 743
     {
744 744
 
745
-    	$all_users = User::getAllUsers();
746
-    	$this->assertTrue(is_array($all_users));
745
+        $all_users = User::getAllUsers();
746
+        $this->assertTrue(is_array($all_users));
747 747
 
748
-    	$active_users = User::getActiveUsers();
749
-    	$this->assertTrue(is_array($active_users));
748
+        $active_users = User::getActiveUsers();
749
+        $this->assertTrue(is_array($active_users));
750 750
 
751
-    	$this->assertGreaterThanOrEqual(count($active_users), count($all_users));
751
+        $this->assertGreaterThanOrEqual(count($active_users), count($all_users));
752 752
     }
753 753
 
754 754
 
755
-	public function testcreate_export_query() {
755
+    public function testcreate_export_query() {
756 756
 
757
-		$user = new User();
757
+        $user = new User();
758 758
 
759
-    	//test with empty string params
760
-    	$expected = "SELECT id, user_name, first_name, last_name, description, date_entered, date_modified, modified_user_id, created_by, title, department, is_admin, phone_home, phone_mobile, phone_work, phone_other, phone_fax, address_street, address_city, address_state, address_postalcode, address_country, reports_to_id, portal_only, status, receive_notifications, employee_status, messenger_id, messenger_type, is_group FROM users  WHERE  users.deleted = 0 AND users.is_admin=0 ORDER BY users.user_name";
761
-    	$actual = $user->create_export_query('','');
762
-    	$this->assertSame($expected,$actual);
759
+        //test with empty string params
760
+        $expected = "SELECT id, user_name, first_name, last_name, description, date_entered, date_modified, modified_user_id, created_by, title, department, is_admin, phone_home, phone_mobile, phone_work, phone_other, phone_fax, address_street, address_city, address_state, address_postalcode, address_country, reports_to_id, portal_only, status, receive_notifications, employee_status, messenger_id, messenger_type, is_group FROM users  WHERE  users.deleted = 0 AND users.is_admin=0 ORDER BY users.user_name";
761
+        $actual = $user->create_export_query('','');
762
+        $this->assertSame($expected,$actual);
763 763
 
764 764
 
765
-    	//test with valid string params
766
-    	$expected = "SELECT id, user_name, first_name, last_name, description, date_entered, date_modified, modified_user_id, created_by, title, department, is_admin, phone_home, phone_mobile, phone_work, phone_other, phone_fax, address_street, address_city, address_state, address_postalcode, address_country, reports_to_id, portal_only, status, receive_notifications, employee_status, messenger_id, messenger_type, is_group FROM users  WHERE user_name=\"\" AND  users.deleted = 0 AND users.is_admin=0 ORDER BY id";
767
-    	$actual = $user->create_export_query('id','user_name=""');
768
-    	$this->assertSame($expected,$actual);
765
+        //test with valid string params
766
+        $expected = "SELECT id, user_name, first_name, last_name, description, date_entered, date_modified, modified_user_id, created_by, title, department, is_admin, phone_home, phone_mobile, phone_work, phone_other, phone_fax, address_street, address_city, address_state, address_postalcode, address_country, reports_to_id, portal_only, status, receive_notifications, employee_status, messenger_id, messenger_type, is_group FROM users  WHERE user_name=\"\" AND  users.deleted = 0 AND users.is_admin=0 ORDER BY id";
767
+        $actual = $user->create_export_query('id','user_name=""');
768
+        $this->assertSame($expected,$actual);
769 769
 
770
-	}
770
+    }
771 771
 
772 772
 
773
-	public function testget_meetings() {
773
+    public function testget_meetings() {
774 774
 
775
-		$user = new User();
775
+        $user = new User();
776 776
 
777
-		$result = $user->get_meetings();
778
-		$this->assertTrue(is_array($result));
777
+        $result = $user->get_meetings();
778
+        $this->assertTrue(is_array($result));
779 779
 
780
-	}
780
+    }
781 781
 
782
-	public function testget_calls() {
782
+    public function testget_calls() {
783 783
 
784
-		$user = new User();
784
+        $user = new User();
785 785
 
786
-		//$result = $user->get_calls();
787
-		//$this->assertTrue(is_array($result));
786
+        //$result = $user->get_calls();
787
+        //$this->assertTrue(is_array($result));
788 788
 
789
-		$this->markTestIncomplete('Error:Only variables should be passed by reference');
790
-	}
789
+        $this->markTestIncomplete('Error:Only variables should be passed by reference');
790
+    }
791 791
 
792 792
 
793
-	public function testdisplayEmailCounts() {
793
+    public function testdisplayEmailCounts() {
794 794
 
795
-		//unset and reconnect Db to resolve mysqli fetch exeception
796
-		global $db;
797
-		unset ($db->database);
798
-		$db->checkConnection();
795
+        //unset and reconnect Db to resolve mysqli fetch exeception
796
+        global $db;
797
+        unset ($db->database);
798
+        $db->checkConnection();
799 799
 
800 800
 
801
-		$user = new User();
801
+        $user = new User();
802 802
 
803
-		$expected = '<script type="text/javascript" language="Javascript">var welcome = document.getElementById("welcome");var welcomeContent = welcome.innerHTML;welcome.innerHTML = welcomeContent + "&nbsp;&nbsp;&nbsp;&nbsp;<a href=index.php?module=Emails&action=ListViewGroup>Group Inbox: (0 New)</a>";</script>';
803
+        $expected = '<script type="text/javascript" language="Javascript">var welcome = document.getElementById("welcome");var welcomeContent = welcome.innerHTML;welcome.innerHTML = welcomeContent + "&nbsp;&nbsp;&nbsp;&nbsp;<a href=index.php?module=Emails&action=ListViewGroup>Group Inbox: (0 New)</a>";</script>';
804 804
 
805
-		//cpature the screen output and compare with exected values
805
+        //cpature the screen output and compare with exected values
806 806
 
807
-		ob_start();
807
+        ob_start();
808 808
 
809
-		$user->displayEmailCounts();
809
+        $user->displayEmailCounts();
810 810
 
811
-		$renderedContent = ob_get_contents();
812
-		ob_end_clean();
811
+        $renderedContent = ob_get_contents();
812
+        ob_end_clean();
813 813
 
814
-		$this->assertSame($expected,$renderedContent);
814
+        $this->assertSame($expected,$renderedContent);
815 815
 
816
-	}
816
+    }
817 817
 
818 818
 
819
-	public function testgetSystemDefaultNameAndEmail()
820
-	{
819
+    public function testgetSystemDefaultNameAndEmail()
820
+    {
821 821
 
822
-		$user = new User();
822
+        $user = new User();
823 823
 
824
-		$expected = array( 'email' => '[email protected]', 'name' => 'SuiteCRM');
825
-		$actual = $user->getSystemDefaultNameAndEmail();
826
-		$this->assertSame($expected,$actual);
824
+        $expected = array( 'email' => '[email protected]', 'name' => 'SuiteCRM');
825
+        $actual = $user->getSystemDefaultNameAndEmail();
826
+        $this->assertSame($expected,$actual);
827 827
 
828
-	}
828
+    }
829 829
 
830 830
 
831
-	public function testsetDefaultsInConfig()
832
-	{
833
-		$user = new User();
831
+    public function testsetDefaultsInConfig()
832
+    {
833
+        $user = new User();
834 834
 
835
-		$result = $user->setDefaultsInConfig();
835
+        $result = $user->setDefaultsInConfig();
836 836
 
837
-		$this->assertTrue(is_array($result));
838
-		$this->assertEquals('sugar', $result['email_default_client']);
839
-		$this->assertEquals('html', $result['email_default_editor']);
837
+        $this->assertTrue(is_array($result));
838
+        $this->assertEquals('sugar', $result['email_default_client']);
839
+        $this->assertEquals('html', $result['email_default_editor']);
840 840
 
841
-	}
841
+    }
842 842
 
843 843
 
844
-	public function testgetEmailLink2()
845
-	{
846
-		$user = new User();
844
+    public function testgetEmailLink2()
845
+    {
846
+        $user = new User();
847 847
 
848
-		$user->retrieve(1);
848
+        $user->retrieve(1);
849 849
 
850 850
 
851
-		//test with accounts module
852
-		$account = new Account();
853
-		$account->name = "test";
851
+        //test with accounts module
852
+        $account = new Account();
853
+        $account->name = "test";
854 854
 
855
-		$expected = "<a href='javascript:void(0);' onclick='SUGAR.quickCompose.init({\"fullComposeUrl\":\"contact_id=\u0026parent_type=Accounts\u0026parent_id=\u0026parent_name=test\u0026to_addrs_ids=\u0026to_addrs_names=\u0026to_addrs_emails=\u0026to_email_addrs=test%26nbsp%3B%26lt%3Babc%40email.com%26gt%3B\u0026return_module=Accounts\u0026return_action=DetailView\u0026return_id=\",\"composePackage\":{\"contact_id\":\"\",\"parent_type\":\"Accounts\",\"parent_id\":\"\",\"parent_name\":\"test\",\"to_addrs_ids\":\"\",\"to_addrs_names\":\"\",\"to_addrs_emails\":\"\",\"to_email_addrs\":\"test \[email protected]\u003E\",\"return_module\":\"Accounts\",\"return_action\":\"DetailView\",\"return_id\":\"\"}});' class=''>";
856
-		$actual = $user->getEmailLink2("[email protected]", $account);
857
-		$this->assertSame($expected,$actual);
855
+        $expected = "<a href='javascript:void(0);' onclick='SUGAR.quickCompose.init({\"fullComposeUrl\":\"contact_id=\u0026parent_type=Accounts\u0026parent_id=\u0026parent_name=test\u0026to_addrs_ids=\u0026to_addrs_names=\u0026to_addrs_emails=\u0026to_email_addrs=test%26nbsp%3B%26lt%3Babc%40email.com%26gt%3B\u0026return_module=Accounts\u0026return_action=DetailView\u0026return_id=\",\"composePackage\":{\"contact_id\":\"\",\"parent_type\":\"Accounts\",\"parent_id\":\"\",\"parent_name\":\"test\",\"to_addrs_ids\":\"\",\"to_addrs_names\":\"\",\"to_addrs_emails\":\"\",\"to_email_addrs\":\"test \[email protected]\u003E\",\"return_module\":\"Accounts\",\"return_action\":\"DetailView\",\"return_id\":\"\"}});' class=''>";
856
+        $actual = $user->getEmailLink2("[email protected]", $account);
857
+        $this->assertSame($expected,$actual);
858 858
 
859 859
 
860
-		//test with contacts module
861
-		$contact = new Contact();
862
-		$contact->name = "test";
860
+        //test with contacts module
861
+        $contact = new Contact();
862
+        $contact->name = "test";
863 863
 
864
-		$expected = "<a href='javascript:void(0);' onclick='SUGAR.quickCompose.init({\"fullComposeUrl\":\"contact_id=\u0026parent_type=Contacts\u0026parent_id=\u0026parent_name=+\u0026to_addrs_ids=\u0026to_addrs_names=+\u0026to_addrs_emails=\u0026to_email_addrs=+%26nbsp%3B%26lt%3Babc%40email.com%26gt%3B\u0026return_module=Contacts\u0026return_action=DetailView\u0026return_id=\",\"composePackage\":{\"contact_id\":\"\",\"parent_type\":\"Contacts\",\"parent_id\":\"\",\"parent_name\":\" \",\"to_addrs_ids\":\"\",\"to_addrs_names\":\" \",\"to_addrs_emails\":\"\",\"to_email_addrs\":\"  \[email protected]\u003E\",\"return_module\":\"Contacts\",\"return_action\":\"DetailView\",\"return_id\":\"\"}});' class=''>";
865
-		$actual = $user->getEmailLink2("[email protected]", $contact);
866
-		$this->assertSame($expected,$actual);
864
+        $expected = "<a href='javascript:void(0);' onclick='SUGAR.quickCompose.init({\"fullComposeUrl\":\"contact_id=\u0026parent_type=Contacts\u0026parent_id=\u0026parent_name=+\u0026to_addrs_ids=\u0026to_addrs_names=+\u0026to_addrs_emails=\u0026to_email_addrs=+%26nbsp%3B%26lt%3Babc%40email.com%26gt%3B\u0026return_module=Contacts\u0026return_action=DetailView\u0026return_id=\",\"composePackage\":{\"contact_id\":\"\",\"parent_type\":\"Contacts\",\"parent_id\":\"\",\"parent_name\":\" \",\"to_addrs_ids\":\"\",\"to_addrs_names\":\" \",\"to_addrs_emails\":\"\",\"to_email_addrs\":\"  \[email protected]\u003E\",\"return_module\":\"Contacts\",\"return_action\":\"DetailView\",\"return_id\":\"\"}});' class=''>";
865
+        $actual = $user->getEmailLink2("[email protected]", $contact);
866
+        $this->assertSame($expected,$actual);
867 867
 
868
-	}
868
+    }
869 869
 
870 870
 
871
-	public function testgetEmailLink()
872
-	{
871
+    public function testgetEmailLink()
872
+    {
873 873
 
874
-		$user = new User();
874
+        $user = new User();
875 875
 
876
-		$user->retrieve(1);
876
+        $user->retrieve(1);
877 877
 
878 878
 
879
-		//test with accounts module
880
-		$account = new Account();
881
-		$account->name = "test";
879
+        //test with accounts module
880
+        $account = new Account();
881
+        $account->name = "test";
882 882
 
883
-		$expected = "<a href='javascript:void(0);' onclick='SUGAR.quickCompose.init({\"fullComposeUrl\":\"contact_id=\u0026parent_type=Accounts\u0026parent_id=\u0026parent_name=test\u0026to_addrs_ids=\u0026to_addrs_names=\u0026to_addrs_emails=\u0026to_email_addrs=test%26nbsp%3B%26lt%3Btest%26gt%3B\u0026return_module=Accounts\u0026return_action=DetailView\u0026return_id=\",\"composePackage\":{\"contact_id\":\"\",\"parent_type\":\"Accounts\",\"parent_id\":\"\",\"parent_name\":\"test\",\"to_addrs_ids\":\"\",\"to_addrs_names\":\"\",\"to_addrs_emails\":\"\",\"to_email_addrs\":\"test \u003Ctest\u003E\",\"return_module\":\"Accounts\",\"return_action\":\"DetailView\",\"return_id\":\"\"}});' class=''>";
884
-		$actual = $user->getEmailLink("name", $account);
885
-		$this->assertSame($expected,$actual);
883
+        $expected = "<a href='javascript:void(0);' onclick='SUGAR.quickCompose.init({\"fullComposeUrl\":\"contact_id=\u0026parent_type=Accounts\u0026parent_id=\u0026parent_name=test\u0026to_addrs_ids=\u0026to_addrs_names=\u0026to_addrs_emails=\u0026to_email_addrs=test%26nbsp%3B%26lt%3Btest%26gt%3B\u0026return_module=Accounts\u0026return_action=DetailView\u0026return_id=\",\"composePackage\":{\"contact_id\":\"\",\"parent_type\":\"Accounts\",\"parent_id\":\"\",\"parent_name\":\"test\",\"to_addrs_ids\":\"\",\"to_addrs_names\":\"\",\"to_addrs_emails\":\"\",\"to_email_addrs\":\"test \u003Ctest\u003E\",\"return_module\":\"Accounts\",\"return_action\":\"DetailView\",\"return_id\":\"\"}});' class=''>";
884
+        $actual = $user->getEmailLink("name", $account);
885
+        $this->assertSame($expected,$actual);
886 886
 
887 887
 
888
-		//test with contacts module
889
-		$contact = new Contact();
890
-		$contact->name = "test";
888
+        //test with contacts module
889
+        $contact = new Contact();
890
+        $contact->name = "test";
891 891
 
892
-		$expected = "<a href='javascript:void(0);' onclick='SUGAR.quickCompose.init({\"fullComposeUrl\":\"contact_id=\u0026parent_type=Contacts\u0026parent_id=\u0026parent_name=+\u0026to_addrs_ids=\u0026to_addrs_names=+\u0026to_addrs_emails=\u0026to_email_addrs=+%26nbsp%3B%26lt%3Btest%26gt%3B\u0026return_module=Contacts\u0026return_action=DetailView\u0026return_id=\",\"composePackage\":{\"contact_id\":\"\",\"parent_type\":\"Contacts\",\"parent_id\":\"\",\"parent_name\":\" \",\"to_addrs_ids\":\"\",\"to_addrs_names\":\" \",\"to_addrs_emails\":\"\",\"to_email_addrs\":\"  \u003Ctest\u003E\",\"return_module\":\"Contacts\",\"return_action\":\"DetailView\",\"return_id\":\"\"}});' class=''>";
893
-		$actual = $user->getEmailLink("name", $contact);
894
-		$this->assertSame($expected,$actual);
892
+        $expected = "<a href='javascript:void(0);' onclick='SUGAR.quickCompose.init({\"fullComposeUrl\":\"contact_id=\u0026parent_type=Contacts\u0026parent_id=\u0026parent_name=+\u0026to_addrs_ids=\u0026to_addrs_names=+\u0026to_addrs_emails=\u0026to_email_addrs=+%26nbsp%3B%26lt%3Btest%26gt%3B\u0026return_module=Contacts\u0026return_action=DetailView\u0026return_id=\",\"composePackage\":{\"contact_id\":\"\",\"parent_type\":\"Contacts\",\"parent_id\":\"\",\"parent_name\":\" \",\"to_addrs_ids\":\"\",\"to_addrs_names\":\" \",\"to_addrs_emails\":\"\",\"to_email_addrs\":\"  \u003Ctest\u003E\",\"return_module\":\"Contacts\",\"return_action\":\"DetailView\",\"return_id\":\"\"}});' class=''>";
893
+        $actual = $user->getEmailLink("name", $contact);
894
+        $this->assertSame($expected,$actual);
895 895
 
896
-	}
896
+    }
897 897
 
898
-	public function testgetLocaleFormatDesc()
899
-	{
900
-		$user = new User();
898
+    public function testgetLocaleFormatDesc()
899
+    {
900
+        $user = new User();
901 901
 
902
-		$result = $user->getLocaleFormatDesc();
903
-		$this->assertTrue(isset($result));
904
-		$this->assertGreaterThan(0,strlen($result));
902
+        $result = $user->getLocaleFormatDesc();
903
+        $this->assertTrue(isset($result));
904
+        $this->assertGreaterThan(0,strlen($result));
905 905
 
906
-	}
906
+    }
907 907
 
908 908
     public function testisAdmin()
909 909
     {
910
-    	$user = new User();
910
+        $user = new User();
911 911
 
912
-    	//test without setting attribute
913
-    	$this->assertEquals(false, $user->isAdmin());
912
+        //test without setting attribute
913
+        $this->assertEquals(false, $user->isAdmin());
914 914
 
915
-    	//test with attribute set
916
-    	$user->is_admin = 1;
917
-    	$this->assertEquals(true, $user->isAdmin());
915
+        //test with attribute set
916
+        $user->is_admin = 1;
917
+        $this->assertEquals(true, $user->isAdmin());
918 918
 
919 919
     }
920 920
 
921 921
     public function testisDeveloperForAnyModule()
922 922
     {
923
-    	$user = new User();
923
+        $user = new User();
924 924
 
925
-    	//test without setting is_admin
926
-    	$this->assertEquals(false, $user->isDeveloperForAnyModule());
925
+        //test without setting is_admin
926
+        $this->assertEquals(false, $user->isDeveloperForAnyModule());
927 927
 
928 928
 
929
-    	//test with id set
930
-    	$user->id = 1;
931
-    	$this->assertEquals(false, $user->isDeveloperForAnyModule());
929
+        //test with id set
930
+        $user->id = 1;
931
+        $this->assertEquals(false, $user->isDeveloperForAnyModule());
932 932
 
933 933
 
934
-    	//test with id and is_admin set
935
-    	$user->is_admin = 1;
936
-    	$this->assertEquals(true, $user->isDeveloperForAnyModule());
934
+        //test with id and is_admin set
935
+        $user->is_admin = 1;
936
+        $this->assertEquals(true, $user->isDeveloperForAnyModule());
937 937
 
938 938
     }
939 939
 
940 940
     public function testgetDeveloperModules()
941 941
     {
942
-    	//unset and reconnect Db to resolve mysqli fetch exeception
943
-    	global $db;
944
-    	unset ($db->database);
945
-    	$db->checkConnection();
942
+        //unset and reconnect Db to resolve mysqli fetch exeception
943
+        global $db;
944
+        unset ($db->database);
945
+        $db->checkConnection();
946 946
 
947
-    	$user = new User();
947
+        $user = new User();
948 948
 
949
-    	$user->retrieve(1);
949
+        $user->retrieve(1);
950 950
 
951
-    	$result = $user->getDeveloperModules();
952
-    	$this->assertTrue(is_array($result));
951
+        $result = $user->getDeveloperModules();
952
+        $this->assertTrue(is_array($result));
953 953
 
954 954
     }
955 955
 
956 956
     public function testisDeveloperForModule()
957 957
     {
958
-    	global $db;
959
-    	unset ($db->database);
960
-    	$db->checkConnection();
958
+        global $db;
959
+        unset ($db->database);
960
+        $db->checkConnection();
961 961
 
962
-    	$user = new User();
962
+        $user = new User();
963 963
 
964 964
 
965
-    	//test without setting is_admin
966
-    	$this->assertEquals(false, $user->isDeveloperForModule("Accounts"));
965
+        //test without setting is_admin
966
+        $this->assertEquals(false, $user->isDeveloperForModule("Accounts"));
967 967
 
968 968
 
969
-    	//test with id set
970
-    	$user->id = 1;
971
-    	$this->assertEquals(false, $user->isDeveloperForModule("Accounts"));
969
+        //test with id set
970
+        $user->id = 1;
971
+        $this->assertEquals(false, $user->isDeveloperForModule("Accounts"));
972 972
 
973 973
 
974
-    	//test with id and is_admin set
975
-    	$user->is_admin = 1;
976
-    	$this->assertEquals(true, $user->isDeveloperForModule("Accounts"));
974
+        //test with id and is_admin set
975
+        $user->is_admin = 1;
976
+        $this->assertEquals(true, $user->isDeveloperForModule("Accounts"));
977 977
 
978 978
 
979 979
     }
@@ -981,59 +981,59 @@  discard block
 block discarded – undo
981 981
     public function testgetAdminModules()
982 982
     {
983 983
         //unset and reconnect Db to resolve mysqli fetch exeception
984
-    	global $db;
985
-    	unset ($db->database);
986
-    	$db->checkConnection();
984
+        global $db;
985
+        unset ($db->database);
986
+        $db->checkConnection();
987 987
 
988
-    	$user = new User();
988
+        $user = new User();
989 989
 
990
-    	$user->retrieve(1);
990
+        $user->retrieve(1);
991 991
 
992
-    	$result = $user->getAdminModules();
993
-    	$this->assertTrue(is_array($result));
992
+        $result = $user->getAdminModules();
993
+        $this->assertTrue(is_array($result));
994 994
 
995 995
     }
996 996
 
997 997
     public function testisAdminForModule()
998 998
     {
999
-    	global $db;
1000
-    	unset ($db->database);
1001
-    	$db->checkConnection();
999
+        global $db;
1000
+        unset ($db->database);
1001
+        $db->checkConnection();
1002 1002
 
1003
-    	$user = new User();
1003
+        $user = new User();
1004 1004
 
1005 1005
 
1006
-    	//test without setting is_admin
1007
-    	$this->assertEquals(false, $user->isAdminForModule("Accounts"));
1006
+        //test without setting is_admin
1007
+        $this->assertEquals(false, $user->isAdminForModule("Accounts"));
1008 1008
 
1009 1009
 
1010
-    	//test with id set
1011
-    	$user->id = 1;
1012
-    	$this->assertEquals(false, $user->isAdminForModule("Accounts"));
1010
+        //test with id set
1011
+        $user->id = 1;
1012
+        $this->assertEquals(false, $user->isAdminForModule("Accounts"));
1013 1013
 
1014 1014
 
1015
-    	//test with id and is_admin set
1016
-    	$user->is_admin = 1;
1017
-    	$this->assertEquals(true, $user->isAdminForModule("Accounts"));
1015
+        //test with id and is_admin set
1016
+        $user->is_admin = 1;
1017
+        $this->assertEquals(true, $user->isAdminForModule("Accounts"));
1018 1018
 
1019 1019
 
1020 1020
     }
1021 1021
 
1022
-	public function testshowLastNameFirst()
1023
-	{
1024
-		$user = new User();
1022
+    public function testshowLastNameFirst()
1023
+    {
1024
+        $user = new User();
1025 1025
 
1026
-		$result = $user->showLastNameFirst();
1027
-		$this->assertEquals(false, $result);
1026
+        $result = $user->showLastNameFirst();
1027
+        $this->assertEquals(false, $result);
1028 1028
 
1029
-	}
1029
+    }
1030 1030
 
1031 1031
     /**
1032 1032
      * @todo: NEEDS FIXING!
1033 1033
      */
1034
-   public function testcreate_new_list_query()
1035
-   {
1036
-       /*
1034
+    public function testcreate_new_list_query()
1035
+    {
1036
+        /*
1037 1037
 	   	$user = new User();
1038 1038
 
1039 1039
 	   	//test with empty string params
@@ -1048,31 +1048,31 @@  discard block
 block discarded – undo
1048 1048
 	   	$actual = $user->create_new_list_query('id','user_name=""');
1049 1049
 	   	$this->assertSame($expected,$actual);
1050 1050
        */
1051
-       $this->assertTrue(true, "NEEDS FIXING!");
1052
-   }
1051
+        $this->assertTrue(true, "NEEDS FIXING!");
1052
+    }
1053 1053
 
1054 1054
 
1055 1055
     public function testget_first_day_of_week()
1056 1056
     {
1057
-    	$user = new User();
1057
+        $user = new User();
1058 1058
 
1059
-    	$result = $user->get_first_day_of_week();
1060
-    	$this->assertTrue(is_numeric($result));
1059
+        $result = $user->get_first_day_of_week();
1060
+        $this->assertTrue(is_numeric($result));
1061 1061
 
1062 1062
     }
1063 1063
 
1064 1064
 
1065 1065
     public function testgeneratePassword()
1066 1066
     {
1067
-    	//generate apsswords and verify they are not same
1067
+        //generate apsswords and verify they are not same
1068 1068
 
1069
-    	$password1 = User::generatePassword();
1070
-    	$this->assertGreaterThan(0,strlen($password1));
1069
+        $password1 = User::generatePassword();
1070
+        $this->assertGreaterThan(0,strlen($password1));
1071 1071
 
1072
-    	$password2 = User::generatePassword();
1073
-    	$this->assertGreaterThan(0,strlen($password2));
1072
+        $password2 = User::generatePassword();
1073
+        $this->assertGreaterThan(0,strlen($password2));
1074 1074
 
1075
-    	$this->assertNotEquals($password1, $password2);
1075
+        $this->assertNotEquals($password1, $password2);
1076 1076
 
1077 1077
     }
1078 1078
 
@@ -1080,50 +1080,50 @@  discard block
 block discarded – undo
1080 1080
     public function testsendEmailForPassword()
1081 1081
     {
1082 1082
 
1083
-    	$user = new User();
1083
+        $user = new User();
1084 1084
 
1085
-    	$result = $user->sendEmailForPassword("1");
1085
+        $result = $user->sendEmailForPassword("1");
1086 1086
 
1087
-    	//expected result is a array with template not found message.
1088
-    	$this->assertTrue(is_array($result));
1087
+        //expected result is a array with template not found message.
1088
+        $this->assertTrue(is_array($result));
1089 1089
 
1090 1090
     }
1091 1091
 
1092 1092
 
1093 1093
     public function testafterImportSave()
1094 1094
     {
1095
-    	error_reporting(E_ALL);
1095
+        error_reporting(E_ALL);
1096 1096
 
1097
-    	$user = new User();
1097
+        $user = new User();
1098 1098
 
1099
-    	//execute the method and test if it works and does not throws an exception.
1100
-    	try {
1101
-    		$result = $user->afterImportSave();
1102
-    		$this->assertTrue(true);
1103
-    	}
1104
-    	catch (Exception $e) {
1105
-    		$this->assertStringStartsWith('Cannot modify header information', $e->getMessage());
1106
-    	}
1099
+        //execute the method and test if it works and does not throws an exception.
1100
+        try {
1101
+            $result = $user->afterImportSave();
1102
+            $this->assertTrue(true);
1103
+        }
1104
+        catch (Exception $e) {
1105
+            $this->assertStringStartsWith('Cannot modify header information', $e->getMessage());
1106
+        }
1107 1107
 
1108 1108
     }
1109 1109
 
1110 1110
 
1111 1111
     public function testisPrimaryEmail()
1112 1112
     {
1113
-    	$user = new User();
1113
+        $user = new User();
1114 1114
 
1115
-    	//test without user email
1116
-    	$this->assertEquals(false, $user->isPrimaryEmail("[email protected]"));
1115
+        //test without user email
1116
+        $this->assertEquals(false, $user->isPrimaryEmail("[email protected]"));
1117 1117
 
1118 1118
 
1119
-    	//test with non matching user email
1120
-    	$user->email1 = "[email protected]";
1121
-    	$this->assertEquals(false, $user->isPrimaryEmail("[email protected]"));
1119
+        //test with non matching user email
1120
+        $user->email1 = "[email protected]";
1121
+        $this->assertEquals(false, $user->isPrimaryEmail("[email protected]"));
1122 1122
 
1123 1123
 
1124
-    	//test with matching user email
1125
-    	$user->email1 = "[email protected]";
1126
-    	$this->assertEquals(true, $user->isPrimaryEmail("[email protected]"));
1124
+        //test with matching user email
1125
+        $user->email1 = "[email protected]";
1126
+        $this->assertEquals(true, $user->isPrimaryEmail("[email protected]"));
1127 1127
 
1128 1128
     }
1129 1129
 
Please login to merge, or discard this patch.
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@  discard block
 block discarded – undo
9 9
 		//execute the contructor and check for the Object type and  attributes
10 10
 		$user = new User();
11 11
 
12
-		$this->assertInstanceOf('User',$user);
13
-		$this->assertInstanceOf('Person',$user);
14
-		$this->assertInstanceOf('SugarBean',$user);
12
+		$this->assertInstanceOf('User', $user);
13
+		$this->assertInstanceOf('Person', $user);
14
+		$this->assertInstanceOf('SugarBean', $user);
15 15
 
16 16
 		$this->assertAttributeEquals('Users', 'module_dir', $user);
17 17
 		$this->assertAttributeEquals('User', 'object_name', $user);
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
     	$result = $user->getSystemUser();
38 38
 
39
-    	$this->assertInstanceOf('User',$result);
39
+    	$this->assertInstanceOf('User', $result);
40 40
     	$this->assertEquals(1, $result->id);
41 41
 
42 42
     }
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 		$user->retrieve(1);
67 67
 
68 68
 		$result = $user->getSignature(1);
69
-		$this->assertEquals(false,$result);
69
+		$this->assertEquals(false, $result);
70 70
 
71 71
 	}
72 72
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 
117 117
 		//test with defaultDisplay true
118 118
 		$expected = "<input class='button' onclick='javascript:open_email_signature_form(\"\", \"1\");' value='' type='button'>&nbsp;<span name=\"edit_sig\" id=\"edit_sig\" style=\"visibility:inherit;\"><input class=\"button\" onclick=\"javascript:open_email_signature_form(document.getElementById('signature_id', '').value)\" value=\"\" type=\"button\" tabindex=\"392\">&nbsp;\n					</span>";
119
-		$actual = $user->getSignatureButtons('',true);
119
+		$actual = $user->getSignatureButtons('', true);
120 120
 		$this->assertSame($expected, $actual);
121 121
 
122 122
 	}
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 		$user->retrieve(2);
131 131
 
132 132
 		$result = $user->hasPersonalEmail();
133
-		$this->assertEquals(false,$result);
133
+		$this->assertEquals(false, $result);
134 134
 
135 135
 	}
136 136
 
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 	}
286 286
 
287 287
 
288
-    public function testGetETagSeedAndIncrementETag(){
288
+    public function testGetETagSeedAndIncrementETag() {
289 289
 
290 290
     	//unset and reconnect Db to resolve mysqli fetch exeception
291 291
     	global $db;
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 
299 299
     	//execute getETagSeed method, get Etag value
300 300
     	$ETagInitial = $user->getETagSeed('test');
301
-    	$this->assertGreaterThanOrEqual(0,$ETagInitial);
301
+    	$this->assertGreaterThanOrEqual(0, $ETagInitial);
302 302
 
303 303
 
304 304
     	//execute incrementETag to increment
@@ -326,11 +326,11 @@  discard block
 block discarded – undo
326 326
     	$user = new User();
327 327
 
328 328
     	//test without setting name
329
-    	$this->assertEquals(Null,$user->get_summary_text());
329
+    	$this->assertEquals(Null, $user->get_summary_text());
330 330
 
331 331
     	//test with name set
332 332
     	$user->name = "test";
333
-    	$this->assertEquals('test',$user->get_summary_text());
333
+    	$this->assertEquals('test', $user->get_summary_text());
334 334
 
335 335
 	}
336 336
 
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 
378 378
 		$user->user_name  = "test";
379 379
 
380
-		$user->first_name  = "firstn";
380
+		$user->first_name = "firstn";
381 381
 		$user->last_name  = "lastn";
382 382
 
383 383
 		$user->email1 = "[email protected]";
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 
428 428
 
429 429
 		//change username and delete the user to avoid picking it up by password in future
430
-		$user->user_name  = "test_deleted";
430
+		$user->user_name = "test_deleted";
431 431
 		$user->save();
432 432
 		$user->mark_deleted($user->id);
433 433
 
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
 		//set user password and then retrieve user by created password
475 475
 		$user->setNewPassword("test");
476 476
 
477
-		$result = User::findUserPassword("test",md5("test"));
477
+		$result = User::findUserPassword("test", md5("test"));
478 478
 
479 479
 		$this->assertTrue(isset($result['id']));
480 480
 		$this->assertEquals($id, $result['id']);
@@ -490,11 +490,11 @@  discard block
 block discarded – undo
490 490
 
491 491
 		//test with invalid password
492 492
 		$result = $user->authenticate_user(md5("pass"));
493
-		$this->assertEquals(false ,$result);
493
+		$this->assertEquals(false, $result);
494 494
 
495 495
 		//test with invalid password
496 496
 		$result = $user->authenticate_user(md5("test"));
497
-		$this->assertEquals(true ,$result);
497
+		$this->assertEquals(true, $result);
498 498
 
499 499
 	}
500 500
 
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
 
524 524
 
525 525
 		//find the user by new password
526
-		$result = User::findUserPassword("test",md5("testpass"));
526
+		$result = User::findUserPassword("test", md5("testpass"));
527 527
 
528 528
 		$this->assertTrue(isset($result['id']));
529 529
 		$this->assertEquals($id, $result['id']);
@@ -536,11 +536,11 @@  discard block
 block discarded – undo
536 536
 
537 537
 		$user->retrieve($id);
538 538
 
539
-		$expected = array("name"=>"firstn lastn", "email"=>"[email protected]" );
539
+		$expected = array("name"=>"firstn lastn", "email"=>"[email protected]");
540 540
 
541 541
 		$actual = $user->getPreferredEmail();
542 542
 
543
-		$this->assertSame($actual,$expected);
543
+		$this->assertSame($actual, $expected);
544 544
 
545 545
 	}
546 546
 
@@ -550,11 +550,11 @@  discard block
 block discarded – undo
550 550
 
551 551
 		$user->retrieve($id);
552 552
 
553
-		$expected = array("name"=>"firstn lastn", "email"=>"[email protected]" );
553
+		$expected = array("name"=>"firstn lastn", "email"=>"[email protected]");
554 554
 
555 555
 		$actual = $user->getUsersNameAndEmail();
556 556
 
557
-		$this->assertEquals($actual,$expected);
557
+		$this->assertEquals($actual, $expected);
558 558
 	}
559 559
 
560 560
 
@@ -562,11 +562,11 @@  discard block
 block discarded – undo
562 562
 	{
563 563
 		$user = new User();
564 564
 
565
-		$expected = array("name"=>"firstn lastn", "email"=>"[email protected]" );
565
+		$expected = array("name"=>"firstn lastn", "email"=>"[email protected]");
566 566
 
567 567
 		$actual = $user->getEmailInfo($id);
568 568
 
569
-		$this->assertEquals($actual,$expected);
569
+		$this->assertEquals($actual, $expected);
570 570
 	}
571 571
 
572 572
 
@@ -576,17 +576,17 @@  discard block
 block discarded – undo
576 576
 
577 577
 		$result = $user->encrypt_password("test");
578 578
 		$this->assertTrue(isset($result));
579
-		$this->assertGreaterThan(0,strlen($result));
579
+		$this->assertGreaterThan(0, strlen($result));
580 580
 
581 581
 	}
582 582
 
583 583
 	public function testgetPasswordHash()
584 584
 	{
585 585
 
586
-		$result= User::getPasswordHash("test");
586
+		$result = User::getPasswordHash("test");
587 587
 
588 588
 		$this->assertTrue(isset($result));
589
-		$this->assertGreaterThan(0,strlen($result));
589
+		$this->assertGreaterThan(0, strlen($result));
590 590
 
591 591
 		$this->markTestIncomplete('Error: crypt(): No salt parameter was specified. You must use a randomly generated salt and a strong hash function to produce a secure hash.');
592 592
 
@@ -598,22 +598,22 @@  discard block
 block discarded – undo
598 598
 
599 599
 		//test with empty password and empty hash
600 600
 		$result = User::checkPassword("", '');
601
-		$this->assertEquals(false,$result);
601
+		$this->assertEquals(false, $result);
602 602
 
603 603
 
604 604
 		//test with valid hash and empty password
605 605
 		$result = User::checkPassword("", '$1$Gt0.XI4.$tVVSXgE36sfsVMBNo/9la1');
606
-		$this->assertEquals(false,$result);
606
+		$this->assertEquals(false, $result);
607 607
 
608 608
 
609 609
 		//test with valid password and invalid hash
610 610
 		$result = User::checkPassword("test", '$1$Gt0.XI4.$tVVSXgE36sfsVMBNo/9la2');
611
-		$this->assertEquals(false,$result);
611
+		$this->assertEquals(false, $result);
612 612
 
613 613
 
614 614
 		//test with valid password and valid hash
615 615
 		$result = User::checkPassword("test", '$1$Gt0.XI4.$tVVSXgE36sfsVMBNo/9la1');
616
-		$this->assertEquals(true,$result);
616
+		$this->assertEquals(true, $result);
617 617
 
618 618
 	}
619 619
 
@@ -623,22 +623,22 @@  discard block
 block discarded – undo
623 623
 
624 624
 		//test with empty password and empty hash
625 625
 		$result = User::checkPasswordMD5(md5(""), '');
626
-		$this->assertEquals(false,$result);
626
+		$this->assertEquals(false, $result);
627 627
 
628 628
 
629 629
 		//test with valid hash and empty password
630 630
 		$result = User::checkPasswordMD5(md5(""), '$1$Gt0.XI4.$tVVSXgE36sfsVMBNo/9la1');
631
-		$this->assertEquals(false,$result);
631
+		$this->assertEquals(false, $result);
632 632
 
633 633
 
634 634
 		//test with valid password and invalid hash
635 635
 		$result = User::checkPasswordMD5(md5("test"), '$1$Gt0.XI4.$tVVSXgE36sfsVMBNo/9la2');
636
-		$this->assertEquals(false,$result);
636
+		$this->assertEquals(false, $result);
637 637
 
638 638
 
639 639
 		//test with valid password and valid hash
640 640
 		$result = User::checkPasswordMD5(md5("test"), '$1$Gt0.XI4.$tVVSXgE36sfsVMBNo/9la1');
641
-		$this->assertEquals(true,$result);
641
+		$this->assertEquals(true, $result);
642 642
 
643 643
 	}
644 644
 
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 
654 654
 		//test with name set
655 655
 		$user->authenticated = true;
656
-		$this->assertEquals(true,$user->is_authenticated());
656
+		$this->assertEquals(true, $user->is_authenticated());
657 657
 
658 658
 	}
659 659
 
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
 
667 667
 		$user->fill_in_additional_list_fields();
668 668
 
669
-		$this->assertEquals("Administrator",$user->full_name);
669
+		$this->assertEquals("Administrator", $user->full_name);
670 670
 
671 671
 	}
672 672
 
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
 
680 680
 		$user->fill_in_additional_detail_fields();
681 681
 
682
-		$this->assertEquals("Administrator",$user->full_name);
682
+		$this->assertEquals("Administrator", $user->full_name);
683 683
 
684 684
 	}
685 685
 
@@ -758,14 +758,14 @@  discard block
 block discarded – undo
758 758
 
759 759
     	//test with empty string params
760 760
     	$expected = "SELECT id, user_name, first_name, last_name, description, date_entered, date_modified, modified_user_id, created_by, title, department, is_admin, phone_home, phone_mobile, phone_work, phone_other, phone_fax, address_street, address_city, address_state, address_postalcode, address_country, reports_to_id, portal_only, status, receive_notifications, employee_status, messenger_id, messenger_type, is_group FROM users  WHERE  users.deleted = 0 AND users.is_admin=0 ORDER BY users.user_name";
761
-    	$actual = $user->create_export_query('','');
762
-    	$this->assertSame($expected,$actual);
761
+    	$actual = $user->create_export_query('', '');
762
+    	$this->assertSame($expected, $actual);
763 763
 
764 764
 
765 765
     	//test with valid string params
766 766
     	$expected = "SELECT id, user_name, first_name, last_name, description, date_entered, date_modified, modified_user_id, created_by, title, department, is_admin, phone_home, phone_mobile, phone_work, phone_other, phone_fax, address_street, address_city, address_state, address_postalcode, address_country, reports_to_id, portal_only, status, receive_notifications, employee_status, messenger_id, messenger_type, is_group FROM users  WHERE user_name=\"\" AND  users.deleted = 0 AND users.is_admin=0 ORDER BY id";
767
-    	$actual = $user->create_export_query('id','user_name=""');
768
-    	$this->assertSame($expected,$actual);
767
+    	$actual = $user->create_export_query('id', 'user_name=""');
768
+    	$this->assertSame($expected, $actual);
769 769
 
770 770
 	}
771 771
 
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
 		$renderedContent = ob_get_contents();
812 812
 		ob_end_clean();
813 813
 
814
-		$this->assertSame($expected,$renderedContent);
814
+		$this->assertSame($expected, $renderedContent);
815 815
 
816 816
 	}
817 817
 
@@ -821,9 +821,9 @@  discard block
 block discarded – undo
821 821
 
822 822
 		$user = new User();
823 823
 
824
-		$expected = array( 'email' => '[email protected]', 'name' => 'SuiteCRM');
824
+		$expected = array('email' => '[email protected]', 'name' => 'SuiteCRM');
825 825
 		$actual = $user->getSystemDefaultNameAndEmail();
826
-		$this->assertSame($expected,$actual);
826
+		$this->assertSame($expected, $actual);
827 827
 
828 828
 	}
829 829
 
@@ -854,7 +854,7 @@  discard block
 block discarded – undo
854 854
 
855 855
 		$expected = "<a href='javascript:void(0);' onclick='SUGAR.quickCompose.init({\"fullComposeUrl\":\"contact_id=\u0026parent_type=Accounts\u0026parent_id=\u0026parent_name=test\u0026to_addrs_ids=\u0026to_addrs_names=\u0026to_addrs_emails=\u0026to_email_addrs=test%26nbsp%3B%26lt%3Babc%40email.com%26gt%3B\u0026return_module=Accounts\u0026return_action=DetailView\u0026return_id=\",\"composePackage\":{\"contact_id\":\"\",\"parent_type\":\"Accounts\",\"parent_id\":\"\",\"parent_name\":\"test\",\"to_addrs_ids\":\"\",\"to_addrs_names\":\"\",\"to_addrs_emails\":\"\",\"to_email_addrs\":\"test \[email protected]\u003E\",\"return_module\":\"Accounts\",\"return_action\":\"DetailView\",\"return_id\":\"\"}});' class=''>";
856 856
 		$actual = $user->getEmailLink2("[email protected]", $account);
857
-		$this->assertSame($expected,$actual);
857
+		$this->assertSame($expected, $actual);
858 858
 
859 859
 
860 860
 		//test with contacts module
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
 
864 864
 		$expected = "<a href='javascript:void(0);' onclick='SUGAR.quickCompose.init({\"fullComposeUrl\":\"contact_id=\u0026parent_type=Contacts\u0026parent_id=\u0026parent_name=+\u0026to_addrs_ids=\u0026to_addrs_names=+\u0026to_addrs_emails=\u0026to_email_addrs=+%26nbsp%3B%26lt%3Babc%40email.com%26gt%3B\u0026return_module=Contacts\u0026return_action=DetailView\u0026return_id=\",\"composePackage\":{\"contact_id\":\"\",\"parent_type\":\"Contacts\",\"parent_id\":\"\",\"parent_name\":\" \",\"to_addrs_ids\":\"\",\"to_addrs_names\":\" \",\"to_addrs_emails\":\"\",\"to_email_addrs\":\"  \[email protected]\u003E\",\"return_module\":\"Contacts\",\"return_action\":\"DetailView\",\"return_id\":\"\"}});' class=''>";
865 865
 		$actual = $user->getEmailLink2("[email protected]", $contact);
866
-		$this->assertSame($expected,$actual);
866
+		$this->assertSame($expected, $actual);
867 867
 
868 868
 	}
869 869
 
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
 
883 883
 		$expected = "<a href='javascript:void(0);' onclick='SUGAR.quickCompose.init({\"fullComposeUrl\":\"contact_id=\u0026parent_type=Accounts\u0026parent_id=\u0026parent_name=test\u0026to_addrs_ids=\u0026to_addrs_names=\u0026to_addrs_emails=\u0026to_email_addrs=test%26nbsp%3B%26lt%3Btest%26gt%3B\u0026return_module=Accounts\u0026return_action=DetailView\u0026return_id=\",\"composePackage\":{\"contact_id\":\"\",\"parent_type\":\"Accounts\",\"parent_id\":\"\",\"parent_name\":\"test\",\"to_addrs_ids\":\"\",\"to_addrs_names\":\"\",\"to_addrs_emails\":\"\",\"to_email_addrs\":\"test \u003Ctest\u003E\",\"return_module\":\"Accounts\",\"return_action\":\"DetailView\",\"return_id\":\"\"}});' class=''>";
884 884
 		$actual = $user->getEmailLink("name", $account);
885
-		$this->assertSame($expected,$actual);
885
+		$this->assertSame($expected, $actual);
886 886
 
887 887
 
888 888
 		//test with contacts module
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
 
892 892
 		$expected = "<a href='javascript:void(0);' onclick='SUGAR.quickCompose.init({\"fullComposeUrl\":\"contact_id=\u0026parent_type=Contacts\u0026parent_id=\u0026parent_name=+\u0026to_addrs_ids=\u0026to_addrs_names=+\u0026to_addrs_emails=\u0026to_email_addrs=+%26nbsp%3B%26lt%3Btest%26gt%3B\u0026return_module=Contacts\u0026return_action=DetailView\u0026return_id=\",\"composePackage\":{\"contact_id\":\"\",\"parent_type\":\"Contacts\",\"parent_id\":\"\",\"parent_name\":\" \",\"to_addrs_ids\":\"\",\"to_addrs_names\":\" \",\"to_addrs_emails\":\"\",\"to_email_addrs\":\"  \u003Ctest\u003E\",\"return_module\":\"Contacts\",\"return_action\":\"DetailView\",\"return_id\":\"\"}});' class=''>";
893 893
 		$actual = $user->getEmailLink("name", $contact);
894
-		$this->assertSame($expected,$actual);
894
+		$this->assertSame($expected, $actual);
895 895
 
896 896
 	}
897 897
 
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
 
902 902
 		$result = $user->getLocaleFormatDesc();
903 903
 		$this->assertTrue(isset($result));
904
-		$this->assertGreaterThan(0,strlen($result));
904
+		$this->assertGreaterThan(0, strlen($result));
905 905
 
906 906
 	}
907 907
 
@@ -1067,10 +1067,10 @@  discard block
 block discarded – undo
1067 1067
     	//generate apsswords and verify they are not same
1068 1068
 
1069 1069
     	$password1 = User::generatePassword();
1070
-    	$this->assertGreaterThan(0,strlen($password1));
1070
+    	$this->assertGreaterThan(0, strlen($password1));
1071 1071
 
1072 1072
     	$password2 = User::generatePassword();
1073
-    	$this->assertGreaterThan(0,strlen($password2));
1073
+    	$this->assertGreaterThan(0, strlen($password2));
1074 1074
 
1075 1075
     	$this->assertNotEquals($password1, $password2);
1076 1076
 
Please login to merge, or discard this patch.
tests/tests/modules/ProspectLists/ProspectListTest.php 3 patches
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -179,8 +179,7 @@  discard block
 block discarded – undo
179 179
 		try {
180 180
 			$prospectList->mark_relationships_deleted('');
181 181
 			$this->assertTrue(true);
182
-		}
183
-		catch (Exception $e) {
182
+		} catch (Exception $e) {
184 183
 			$this->fail();
185 184
 		}
186 185
 		 
@@ -196,8 +195,7 @@  discard block
 block discarded – undo
196 195
 		try {
197 196
 			$prospectList->fill_in_additional_list_fields();
198 197
 			$this->assertTrue(true);
199
-		}
200
-		catch (Exception $e) {
198
+		} catch (Exception $e) {
201 199
 			$this->fail();
202 200
 		}
203 201
 		 
@@ -224,8 +222,7 @@  discard block
 block discarded – undo
224 222
 		try {
225 223
 			$prospectList->update_currency_id('','');
226 224
 			$this->assertTrue(true);
227
-		}
228
-		catch (Exception $e) {
225
+		} catch (Exception $e) {
229 226
 			$this->fail();
230 227
 		}
231 228
 		 
Please login to merge, or discard this patch.
Indentation   +173 added lines, -173 removed lines patch added patch discarded remove patch
@@ -3,79 +3,79 @@  discard block
 block discarded – undo
3 3
 class ProspectListTest extends PHPUnit_Framework_TestCase {
4 4
 
5 5
 
6
-	public function testProspectList()
7
-	{
6
+    public function testProspectList()
7
+    {
8 8
 
9
-		//execute the contructor and check for the Object type and  attributes
10
-		$prospectList = new ProspectList();
9
+        //execute the contructor and check for the Object type and  attributes
10
+        $prospectList = new ProspectList();
11 11
 
12
-		$this->assertInstanceOf('ProspectList',$prospectList);
13
-		$this->assertInstanceOf('SugarBean',$prospectList);
12
+        $this->assertInstanceOf('ProspectList',$prospectList);
13
+        $this->assertInstanceOf('SugarBean',$prospectList);
14 14
 
15
-		$this->assertAttributeEquals('prospect_lists', 'table_name', $prospectList);
16
-		$this->assertAttributeEquals('ProspectLists', 'module_dir', $prospectList);
17
-		$this->assertAttributeEquals('ProspectList', 'object_name', $prospectList);
15
+        $this->assertAttributeEquals('prospect_lists', 'table_name', $prospectList);
16
+        $this->assertAttributeEquals('ProspectLists', 'module_dir', $prospectList);
17
+        $this->assertAttributeEquals('ProspectList', 'object_name', $prospectList);
18 18
 
19
-		$this->assertAttributeEquals("prospect_lists_prospects", 'rel_prospects_table', $prospectList);
19
+        $this->assertAttributeEquals("prospect_lists_prospects", 'rel_prospects_table', $prospectList);
20 20
 
21
-	}
21
+    }
22 22
 
23
-	public function testget_summary_text()
24
-	{
25
-		error_reporting(E_ERROR | E_PARSE);
23
+    public function testget_summary_text()
24
+    {
25
+        error_reporting(E_ERROR | E_PARSE);
26 26
 
27
-		$prospectList = new ProspectList();
27
+        $prospectList = new ProspectList();
28 28
 
29
-		//test without setting name
30
-		$this->assertEquals(Null,$prospectList->get_summary_text());
29
+        //test without setting name
30
+        $this->assertEquals(Null,$prospectList->get_summary_text());
31 31
 
32
-		//test with name set
33
-		$prospectList->name = "test";
34
-		$this->assertEquals('test',$prospectList->get_summary_text());
35
-	}
32
+        //test with name set
33
+        $prospectList->name = "test";
34
+        $this->assertEquals('test',$prospectList->get_summary_text());
35
+    }
36 36
 
37
-	public function testcreate_list_query()
38
-	{
37
+    public function testcreate_list_query()
38
+    {
39 39
 
40
-		$prospectList = new ProspectList();
40
+        $prospectList = new ProspectList();
41 41
 
42
-		//test with empty string params
43
-		$expected = "SELECT users.user_name as assigned_user_name, prospect_lists.* FROM prospect_lists LEFT JOIN users\n					ON prospect_lists.assigned_user_id=users.id where prospect_lists.deleted=0 ORDER BY prospect_lists.name";
44
-		$actual = $prospectList->create_list_query('','');
45
-		$this->assertSame($expected,$actual);
42
+        //test with empty string params
43
+        $expected = "SELECT users.user_name as assigned_user_name, prospect_lists.* FROM prospect_lists LEFT JOIN users\n					ON prospect_lists.assigned_user_id=users.id where prospect_lists.deleted=0 ORDER BY prospect_lists.name";
44
+        $actual = $prospectList->create_list_query('','');
45
+        $this->assertSame($expected,$actual);
46 46
 
47 47
 
48
-		//test with valid string params
49
-		$expected = "SELECT users.user_name as assigned_user_name, prospect_lists.* FROM prospect_lists LEFT JOIN users\n					ON prospect_lists.assigned_user_id=users.id where users.user_name = \"\" AND prospect_lists.deleted=0 ORDER BY prospect_lists.id";
50
-		$actual = $prospectList->create_list_query('prospect_lists.id','users.user_name = ""');
51
-		$this->assertSame($expected,$actual);
48
+        //test with valid string params
49
+        $expected = "SELECT users.user_name as assigned_user_name, prospect_lists.* FROM prospect_lists LEFT JOIN users\n					ON prospect_lists.assigned_user_id=users.id where users.user_name = \"\" AND prospect_lists.deleted=0 ORDER BY prospect_lists.id";
50
+        $actual = $prospectList->create_list_query('prospect_lists.id','users.user_name = ""');
51
+        $this->assertSame($expected,$actual);
52 52
 
53
-	}
53
+    }
54 54
 
55 55
 
56
-	public function testcreate_export_query()
57
-	{
56
+    public function testcreate_export_query()
57
+    {
58 58
 
59
-		$prospectList = new ProspectList();
59
+        $prospectList = new ProspectList();
60 60
 
61
-		//test with empty string params
62
-		$expected = "SELECT\n                                prospect_lists.*,\n                                users.user_name as assigned_user_name FROM prospect_lists LEFT JOIN users\n                                ON prospect_lists.assigned_user_id=users.id  WHERE  prospect_lists.deleted=0 ORDER BY prospect_lists.name";
63
-		$actual = $prospectList->create_export_query('','');
64
-		$this->assertSame($expected,$actual);
61
+        //test with empty string params
62
+        $expected = "SELECT\n                                prospect_lists.*,\n                                users.user_name as assigned_user_name FROM prospect_lists LEFT JOIN users\n                                ON prospect_lists.assigned_user_id=users.id  WHERE  prospect_lists.deleted=0 ORDER BY prospect_lists.name";
63
+        $actual = $prospectList->create_export_query('','');
64
+        $this->assertSame($expected,$actual);
65 65
 
66 66
 
67
-		//test with valid string params
68
-		$expected = "SELECT\n                                prospect_lists.*,\n                                users.user_name as assigned_user_name FROM prospect_lists LEFT JOIN users\n                                ON prospect_lists.assigned_user_id=users.id  WHERE users.user_name = \"\" AND  prospect_lists.deleted=0 ORDER BY prospect_lists.id";
69
-		$actual = $prospectList->create_export_query('prospect_lists.id','users.user_name = ""');
70
-		$this->assertSame($expected,$actual);
67
+        //test with valid string params
68
+        $expected = "SELECT\n                                prospect_lists.*,\n                                users.user_name as assigned_user_name FROM prospect_lists LEFT JOIN users\n                                ON prospect_lists.assigned_user_id=users.id  WHERE users.user_name = \"\" AND  prospect_lists.deleted=0 ORDER BY prospect_lists.id";
69
+        $actual = $prospectList->create_export_query('prospect_lists.id','users.user_name = ""');
70
+        $this->assertSame($expected,$actual);
71 71
 
72 72
     }
73 73
 
74 74
     /**
75 75
      * @todo: NEEDS FIXING!
76 76
      */
77
-	public function testcreate_export_members_query()
78
-	{
77
+    public function testcreate_export_members_query()
78
+    {
79 79
         /*
80 80
     	$prospectList = new ProspectList();
81 81
 
@@ -85,208 +85,208 @@  discard block
 block discarded – undo
85 85
     	$this->assertSame($expected,$actual);
86 86
         */
87 87
         $this->assertTrue(true, "NEEDS FIXING!");
88
-	}
88
+    }
89 89
 
90
-	public function testsave() {
90
+    public function testsave() {
91 91
 
92
-		$prospectList = new ProspectList();
92
+        $prospectList = new ProspectList();
93 93
 
94
-		$prospectList->name = "test";
95
-		$prospectList->description ="test description";
94
+        $prospectList->name = "test";
95
+        $prospectList->description ="test description";
96 96
 
97
-		$result = $prospectList->save();
97
+        $result = $prospectList->save();
98 98
 
99
-		//test for record ID to verify that record is saved
100
-		$this->assertTrue(isset($prospectList->id));
101
-		$this->assertEquals(36, strlen($prospectList->id));
99
+        //test for record ID to verify that record is saved
100
+        $this->assertTrue(isset($prospectList->id));
101
+        $this->assertEquals(36, strlen($prospectList->id));
102 102
 
103 103
 
104
-		//test set_prospect_relationship method
105
-		$this->set_prospect_relationship($prospectList->id);
104
+        //test set_prospect_relationship method
105
+        $this->set_prospect_relationship($prospectList->id);
106 106
 
107 107
 
108
-		//test set_prospect_relationship_single method
109
-		$this->set_prospect_relationship_single($prospectList->id);
108
+        //test set_prospect_relationship_single method
109
+        $this->set_prospect_relationship_single($prospectList->id);
110 110
 
111 111
 
112
-		//mark the record as deleted and verify that this record cannot be retrieved anymore.
113
-		$prospectList->mark_deleted($prospectList->id);
114
-		$result = $prospectList->retrieve($prospectList->id);
115
-		$this->assertEquals(null,$result);
112
+        //mark the record as deleted and verify that this record cannot be retrieved anymore.
113
+        $prospectList->mark_deleted($prospectList->id);
114
+        $result = $prospectList->retrieve($prospectList->id);
115
+        $this->assertEquals(null,$result);
116 116
 
117
-	}
117
+    }
118 118
 
119 119
 
120
-	public function testsave_relationship_changes()
120
+    public function testsave_relationship_changes()
121 121
     {
122
-    	$this->markTestIncomplete('Error in query: columns mismatch | Error in methodd call params: 2nd param should be array but string given');
122
+        $this->markTestIncomplete('Error in query: columns mismatch | Error in methodd call params: 2nd param should be array but string given');
123 123
     }
124 124
 
125
-	public function set_prospect_relationship($id)
126
-	{
127
-		$prospectList = new ProspectList();
125
+    public function set_prospect_relationship($id)
126
+    {
127
+        $prospectList = new ProspectList();
128 128
 
129
-		//preset the required attributes, retrive the bean by id and verify the count of records
130
-		$link_ids = array('1','2');
129
+        //preset the required attributes, retrive the bean by id and verify the count of records
130
+        $link_ids = array('1','2');
131 131
 
132
-		$prospectList->retrieve($id);
133
-		$prospectList->set_prospect_relationship($id, $link_ids ,'related');
132
+        $prospectList->retrieve($id);
133
+        $prospectList->set_prospect_relationship($id, $link_ids ,'related');
134 134
 
135
-		$expected_count = $prospectList->get_entry_count();
135
+        $expected_count = $prospectList->get_entry_count();
136 136
 
137
-		$this->assertEquals(2,$expected_count);
137
+        $this->assertEquals(2,$expected_count);
138 138
 
139 139
 
140
-		//test clear_prospect_relationship method with expected counts
141
-		$this->clear_prospect_relationship($id, '1');
142
-		$this->clear_prospect_relationship($id, '2');
140
+        //test clear_prospect_relationship method with expected counts
141
+        $this->clear_prospect_relationship($id, '1');
142
+        $this->clear_prospect_relationship($id, '2');
143 143
 
144
-	}
144
+    }
145 145
 
146
-	public function set_prospect_relationship_single($id)
147
-	{
148
-		$prospectList = new ProspectList();
146
+    public function set_prospect_relationship_single($id)
147
+    {
148
+        $prospectList = new ProspectList();
149 149
 
150
-		$prospectList->retrieve($id);
151
-		$prospectList->set_prospect_relationship_single($id, '3' ,'related');
150
+        $prospectList->retrieve($id);
151
+        $prospectList->set_prospect_relationship_single($id, '3' ,'related');
152 152
 
153
-		$expected_count = $prospectList->get_entry_count();
153
+        $expected_count = $prospectList->get_entry_count();
154 154
 
155
-		$this->assertEquals(1,$expected_count);
155
+        $this->assertEquals(1,$expected_count);
156 156
 
157
-		$this->clear_prospect_relationship($id, '3');
157
+        $this->clear_prospect_relationship($id, '3');
158 158
 
159
-	}
159
+    }
160 160
 
161 161
 
162
-	public function clear_prospect_relationship($id, $related_id)
163
-	{
164
-		$prospectList = new ProspectList();
162
+    public function clear_prospect_relationship($id, $related_id)
163
+    {
164
+        $prospectList = new ProspectList();
165 165
 
166
-		//retrieve the bean and get counts before and after method execution for comparison.
166
+        //retrieve the bean and get counts before and after method execution for comparison.
167 167
 
168
-		$prospectList->retrieve($id);
168
+        $prospectList->retrieve($id);
169 169
 
170
-		$initial_count = (int)$prospectList->get_entry_count();
170
+        $initial_count = (int)$prospectList->get_entry_count();
171 171
 
172
-		$prospectList->clear_prospect_relationship($id, $related_id, 'related');
172
+        $prospectList->clear_prospect_relationship($id, $related_id, 'related');
173 173
 
174
-		$expected_count = (int)$prospectList->get_entry_count();
175
-		$this->assertEquals($initial_count - 1 , $expected_count);
176
-	}
174
+        $expected_count = (int)$prospectList->get_entry_count();
175
+        $this->assertEquals($initial_count - 1 , $expected_count);
176
+    }
177 177
 
178 178
 
179
-	public function testmark_relationships_deleted()
180
-	{
181
-		$prospectList = new ProspectList();
179
+    public function testmark_relationships_deleted()
180
+    {
181
+        $prospectList = new ProspectList();
182 182
 
183
-		//execute the method and test if it works and does not throws an exception.
184
-		try {
185
-			$prospectList->mark_relationships_deleted('');
186
-			$this->assertTrue(true);
187
-		}
188
-		catch (Exception $e) {
189
-			$this->fail();
190
-		}
183
+        //execute the method and test if it works and does not throws an exception.
184
+        try {
185
+            $prospectList->mark_relationships_deleted('');
186
+            $this->assertTrue(true);
187
+        }
188
+        catch (Exception $e) {
189
+            $this->fail();
190
+        }
191 191
 
192
-		$this->markTestIncomplete('Method has no implementation');
192
+        $this->markTestIncomplete('Method has no implementation');
193 193
 
194
-	}
194
+    }
195 195
 
196
-	public function testfill_in_additional_list_fields()
197
-	{
198
-		$prospectList = new ProspectList();
196
+    public function testfill_in_additional_list_fields()
197
+    {
198
+        $prospectList = new ProspectList();
199 199
 
200
-		//execute the method and test if it works and does not throws an exception.
201
-		try {
202
-			$prospectList->fill_in_additional_list_fields();
203
-			$this->assertTrue(true);
204
-		}
205
-		catch (Exception $e) {
206
-			$this->fail();
207
-		}
200
+        //execute the method and test if it works and does not throws an exception.
201
+        try {
202
+            $prospectList->fill_in_additional_list_fields();
203
+            $this->assertTrue(true);
204
+        }
205
+        catch (Exception $e) {
206
+            $this->fail();
207
+        }
208 208
 
209
-		$this->markTestIncomplete('Method has no implementation');
209
+        $this->markTestIncomplete('Method has no implementation');
210 210
 
211
-	}
211
+    }
212 212
 
213
-	public function testfill_in_additional_detail_fields()
214
-	{
215
-		$prospectList = new ProspectList();
213
+    public function testfill_in_additional_detail_fields()
214
+    {
215
+        $prospectList = new ProspectList();
216 216
 
217
-		$prospectList->fill_in_additional_detail_fields();
218
-		$this->assertEquals(0,$prospectList->entry_count);
217
+        $prospectList->fill_in_additional_detail_fields();
218
+        $this->assertEquals(0,$prospectList->entry_count);
219 219
 
220
-	}
220
+    }
221 221
 
222 222
 
223
-	public function testupdate_currency_id()
224
-	{
223
+    public function testupdate_currency_id()
224
+    {
225 225
 
226
-		$prospectList = new ProspectList();
226
+        $prospectList = new ProspectList();
227 227
 
228
-		//execute the method and test if it works and does not throws an exception.
229
-		try {
230
-			$prospectList->update_currency_id('','');
231
-			$this->assertTrue(true);
232
-		}
233
-		catch (Exception $e) {
234
-			$this->fail();
235
-		}
228
+        //execute the method and test if it works and does not throws an exception.
229
+        try {
230
+            $prospectList->update_currency_id('','');
231
+            $this->assertTrue(true);
232
+        }
233
+        catch (Exception $e) {
234
+            $this->fail();
235
+        }
236 236
 
237
-		$this->markTestIncomplete('Method has no implementation');
237
+        $this->markTestIncomplete('Method has no implementation');
238 238
 
239
-	}
239
+    }
240 240
 
241 241
 
242
-	public function testget_entry_count()
243
-	{
244
-		$prospectList = new ProspectList();
242
+    public function testget_entry_count()
243
+    {
244
+        $prospectList = new ProspectList();
245 245
 
246
-		$result = $prospectList->get_entry_count();
247
-		$this->assertEquals(0, $result);
246
+        $result = $prospectList->get_entry_count();
247
+        $this->assertEquals(0, $result);
248 248
 
249
-	}
249
+    }
250 250
 
251 251
 
252
-	public function testget_list_view_data(){
252
+    public function testget_list_view_data(){
253 253
 
254
-		$prospectList = new ProspectList();
254
+        $prospectList = new ProspectList();
255 255
 
256
-		$expected = array( "DELETED"=> 0, "ENTRY_COUNT"=> '0' );
257
-		$actual = $prospectList->get_list_view_data();
258
-		$this->assertSame($expected, $actual);
256
+        $expected = array( "DELETED"=> 0, "ENTRY_COUNT"=> '0' );
257
+        $actual = $prospectList->get_list_view_data();
258
+        $this->assertSame($expected, $actual);
259 259
 
260
-	}
260
+    }
261 261
 
262
-	public function testbuild_generic_where_clause()
263
-	{
262
+    public function testbuild_generic_where_clause()
263
+    {
264 264
 
265
-		$prospectList = new ProspectList();
265
+        $prospectList = new ProspectList();
266 266
 
267
-		//test with empty string params
268
-		$expected = "prospect_lists.name like '%'";
269
-		$actual = $prospectList->build_generic_where_clause('');
270
-		$this->assertSame($expected,$actual);
267
+        //test with empty string params
268
+        $expected = "prospect_lists.name like '%'";
269
+        $actual = $prospectList->build_generic_where_clause('');
270
+        $this->assertSame($expected,$actual);
271 271
 
272 272
 
273
-		//test with valid string params
274
-		$expected = "prospect_lists.name like '%'";
275
-		$actual = $prospectList->build_generic_where_clause('1');
276
-		$this->assertSame($expected,$actual);
273
+        //test with valid string params
274
+        $expected = "prospect_lists.name like '%'";
275
+        $actual = $prospectList->build_generic_where_clause('1');
276
+        $this->assertSame($expected,$actual);
277 277
 
278
-	}
278
+    }
279 279
 
280 280
 
281
-	public function testbean_implements(){
281
+    public function testbean_implements(){
282 282
 
283
-		$prospectList = new ProspectList();
283
+        $prospectList = new ProspectList();
284 284
 
285
-		$this->assertEquals(false, $prospectList->bean_implements('')); //test with blank value
286
-		$this->assertEquals(false, $prospectList->bean_implements('test')); //test with invalid value
287
-		$this->assertEquals(true, $prospectList->bean_implements('ACL')); //test with valid value
285
+        $this->assertEquals(false, $prospectList->bean_implements('')); //test with blank value
286
+        $this->assertEquals(false, $prospectList->bean_implements('test')); //test with invalid value
287
+        $this->assertEquals(true, $prospectList->bean_implements('ACL')); //test with valid value
288 288
 
289
-	}
289
+    }
290 290
 
291 291
 }
292 292
 
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -9,8 +9,8 @@  discard block
 block discarded – undo
9 9
 		//execute the contructor and check for the Object type and  attributes
10 10
 		$prospectList = new ProspectList();
11 11
 
12
-		$this->assertInstanceOf('ProspectList',$prospectList);
13
-		$this->assertInstanceOf('SugarBean',$prospectList);
12
+		$this->assertInstanceOf('ProspectList', $prospectList);
13
+		$this->assertInstanceOf('SugarBean', $prospectList);
14 14
 
15 15
 		$this->assertAttributeEquals('prospect_lists', 'table_name', $prospectList);
16 16
 		$this->assertAttributeEquals('ProspectLists', 'module_dir', $prospectList);
@@ -27,11 +27,11 @@  discard block
 block discarded – undo
27 27
 		$prospectList = new ProspectList();
28 28
 
29 29
 		//test without setting name
30
-		$this->assertEquals(Null,$prospectList->get_summary_text());
30
+		$this->assertEquals(Null, $prospectList->get_summary_text());
31 31
 
32 32
 		//test with name set
33 33
 		$prospectList->name = "test";
34
-		$this->assertEquals('test',$prospectList->get_summary_text());
34
+		$this->assertEquals('test', $prospectList->get_summary_text());
35 35
 	}
36 36
 
37 37
 	public function testcreate_list_query()
@@ -41,14 +41,14 @@  discard block
 block discarded – undo
41 41
 
42 42
 		//test with empty string params
43 43
 		$expected = "SELECT users.user_name as assigned_user_name, prospect_lists.* FROM prospect_lists LEFT JOIN users\n					ON prospect_lists.assigned_user_id=users.id where prospect_lists.deleted=0 ORDER BY prospect_lists.name";
44
-		$actual = $prospectList->create_list_query('','');
45
-		$this->assertSame($expected,$actual);
44
+		$actual = $prospectList->create_list_query('', '');
45
+		$this->assertSame($expected, $actual);
46 46
 
47 47
 
48 48
 		//test with valid string params
49 49
 		$expected = "SELECT users.user_name as assigned_user_name, prospect_lists.* FROM prospect_lists LEFT JOIN users\n					ON prospect_lists.assigned_user_id=users.id where users.user_name = \"\" AND prospect_lists.deleted=0 ORDER BY prospect_lists.id";
50
-		$actual = $prospectList->create_list_query('prospect_lists.id','users.user_name = ""');
51
-		$this->assertSame($expected,$actual);
50
+		$actual = $prospectList->create_list_query('prospect_lists.id', 'users.user_name = ""');
51
+		$this->assertSame($expected, $actual);
52 52
 
53 53
 	}
54 54
 
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
 
61 61
 		//test with empty string params
62 62
 		$expected = "SELECT\n                                prospect_lists.*,\n                                users.user_name as assigned_user_name FROM prospect_lists LEFT JOIN users\n                                ON prospect_lists.assigned_user_id=users.id  WHERE  prospect_lists.deleted=0 ORDER BY prospect_lists.name";
63
-		$actual = $prospectList->create_export_query('','');
64
-		$this->assertSame($expected,$actual);
63
+		$actual = $prospectList->create_export_query('', '');
64
+		$this->assertSame($expected, $actual);
65 65
 
66 66
 
67 67
 		//test with valid string params
68 68
 		$expected = "SELECT\n                                prospect_lists.*,\n                                users.user_name as assigned_user_name FROM prospect_lists LEFT JOIN users\n                                ON prospect_lists.assigned_user_id=users.id  WHERE users.user_name = \"\" AND  prospect_lists.deleted=0 ORDER BY prospect_lists.id";
69
-		$actual = $prospectList->create_export_query('prospect_lists.id','users.user_name = ""');
70
-		$this->assertSame($expected,$actual);
69
+		$actual = $prospectList->create_export_query('prospect_lists.id', 'users.user_name = ""');
70
+		$this->assertSame($expected, $actual);
71 71
 
72 72
     }
73 73
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 		$prospectList = new ProspectList();
93 93
 
94 94
 		$prospectList->name = "test";
95
-		$prospectList->description ="test description";
95
+		$prospectList->description = "test description";
96 96
 
97 97
 		$result = $prospectList->save();
98 98
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 		//mark the record as deleted and verify that this record cannot be retrieved anymore.
113 113
 		$prospectList->mark_deleted($prospectList->id);
114 114
 		$result = $prospectList->retrieve($prospectList->id);
115
-		$this->assertEquals(null,$result);
115
+		$this->assertEquals(null, $result);
116 116
 
117 117
 	}
118 118
 
@@ -127,14 +127,14 @@  discard block
 block discarded – undo
127 127
 		$prospectList = new ProspectList();
128 128
 
129 129
 		//preset the required attributes, retrive the bean by id and verify the count of records
130
-		$link_ids = array('1','2');
130
+		$link_ids = array('1', '2');
131 131
 
132 132
 		$prospectList->retrieve($id);
133
-		$prospectList->set_prospect_relationship($id, $link_ids ,'related');
133
+		$prospectList->set_prospect_relationship($id, $link_ids, 'related');
134 134
 
135 135
 		$expected_count = $prospectList->get_entry_count();
136 136
 
137
-		$this->assertEquals(2,$expected_count);
137
+		$this->assertEquals(2, $expected_count);
138 138
 
139 139
 
140 140
 		//test clear_prospect_relationship method with expected counts
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
 		$prospectList = new ProspectList();
149 149
 
150 150
 		$prospectList->retrieve($id);
151
-		$prospectList->set_prospect_relationship_single($id, '3' ,'related');
151
+		$prospectList->set_prospect_relationship_single($id, '3', 'related');
152 152
 
153 153
 		$expected_count = $prospectList->get_entry_count();
154 154
 
155
-		$this->assertEquals(1,$expected_count);
155
+		$this->assertEquals(1, $expected_count);
156 156
 
157 157
 		$this->clear_prospect_relationship($id, '3');
158 158
 
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 		$prospectList->clear_prospect_relationship($id, $related_id, 'related');
173 173
 
174 174
 		$expected_count = (int)$prospectList->get_entry_count();
175
-		$this->assertEquals($initial_count - 1 , $expected_count);
175
+		$this->assertEquals($initial_count - 1, $expected_count);
176 176
 	}
177 177
 
178 178
 
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 		$prospectList = new ProspectList();
216 216
 
217 217
 		$prospectList->fill_in_additional_detail_fields();
218
-		$this->assertEquals(0,$prospectList->entry_count);
218
+		$this->assertEquals(0, $prospectList->entry_count);
219 219
 
220 220
 	}
221 221
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 
228 228
 		//execute the method and test if it works and does not throws an exception.
229 229
 		try {
230
-			$prospectList->update_currency_id('','');
230
+			$prospectList->update_currency_id('', '');
231 231
 			$this->assertTrue(true);
232 232
 		}
233 233
 		catch (Exception $e) {
@@ -249,11 +249,11 @@  discard block
 block discarded – undo
249 249
 	}
250 250
 
251 251
 
252
-	public function testget_list_view_data(){
252
+	public function testget_list_view_data() {
253 253
 
254 254
 		$prospectList = new ProspectList();
255 255
 
256
-		$expected = array( "DELETED"=> 0, "ENTRY_COUNT"=> '0' );
256
+		$expected = array("DELETED"=> 0, "ENTRY_COUNT"=> '0');
257 257
 		$actual = $prospectList->get_list_view_data();
258 258
 		$this->assertSame($expected, $actual);
259 259
 
@@ -267,18 +267,18 @@  discard block
 block discarded – undo
267 267
 		//test with empty string params
268 268
 		$expected = "prospect_lists.name like '%'";
269 269
 		$actual = $prospectList->build_generic_where_clause('');
270
-		$this->assertSame($expected,$actual);
270
+		$this->assertSame($expected, $actual);
271 271
 
272 272
 
273 273
 		//test with valid string params
274 274
 		$expected = "prospect_lists.name like '%'";
275 275
 		$actual = $prospectList->build_generic_where_clause('1');
276
-		$this->assertSame($expected,$actual);
276
+		$this->assertSame($expected, $actual);
277 277
 
278 278
 	}
279 279
 
280 280
 
281
-	public function testbean_implements(){
281
+	public function testbean_implements() {
282 282
 
283 283
 		$prospectList = new ProspectList();
284 284
 
Please login to merge, or discard this patch.
tests/tests/modules/Employees/EmployeeTest.php 3 patches
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -43,8 +43,7 @@  discard block
 block discarded – undo
43 43
 		try {
44 44
 			$employee->fill_in_additional_list_fields();
45 45
 			$this->assertTrue(true);
46
-		}
47
-		catch (Exception $e) {
46
+		} catch (Exception $e) {
48 47
 			$this->fail();
49 48
 		}
50 49
 		
@@ -118,8 +117,7 @@  discard block
 block discarded – undo
118 117
 		try {
119 118
 			$employee->list_view_parse_additional_sections(new Sugar_Smarty(), $xTemplateSection);
120 119
 			$this->assertTrue(true);
121
-		}
122
-		catch (Exception $e) {
120
+		} catch (Exception $e) {
123 121
 			$this->fail();
124 122
 		}
125 123
 		
@@ -151,8 +149,7 @@  discard block
 block discarded – undo
151 149
 		try {
152 150
 			$employee->preprocess_fields_on_save();
153 151
 			$this->assertTrue(true);
154
-		}
155
-		catch (Exception $e) {
152
+		} catch (Exception $e) {
156 153
 			$this->fail();
157 154
 		}
158 155
 
Please login to merge, or discard this patch.
Indentation   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -3,165 +3,165 @@  discard block
 block discarded – undo
3 3
 class EmployeeTest extends PHPUnit_Framework_TestCase {
4 4
 
5 5
 
6
-	public function testEmployee() {
6
+    public function testEmployee() {
7 7
 
8
-		//execute the contructor and check for the Object type and  attributes
9
-		$employee = new Employee();
10
-		$this->assertInstanceOf('Employee',$employee);
11
-		$this->assertInstanceOf('Person',$employee);
12
-		$this->assertInstanceOf('SugarBean',$employee);
8
+        //execute the contructor and check for the Object type and  attributes
9
+        $employee = new Employee();
10
+        $this->assertInstanceOf('Employee',$employee);
11
+        $this->assertInstanceOf('Person',$employee);
12
+        $this->assertInstanceOf('SugarBean',$employee);
13 13
 
14
-		$this->assertAttributeEquals('Employees', 'module_dir', $employee);
15
-		$this->assertAttributeEquals('Employee', 'object_name', $employee);
16
-		$this->assertAttributeEquals('users', 'table_name', $employee);
17
-		$this->assertAttributeEquals(true, 'new_schema', $employee);
14
+        $this->assertAttributeEquals('Employees', 'module_dir', $employee);
15
+        $this->assertAttributeEquals('Employee', 'object_name', $employee);
16
+        $this->assertAttributeEquals('users', 'table_name', $employee);
17
+        $this->assertAttributeEquals(true, 'new_schema', $employee);
18 18
 
19
-	}
19
+    }
20 20
 
21 21
 
22
-	public function testget_summary_text() {
22
+    public function testget_summary_text() {
23 23
 
24
-		error_reporting(E_ERROR | E_PARSE);
24
+        error_reporting(E_ERROR | E_PARSE);
25 25
 
26
-		$employee = new Employee();
26
+        $employee = new Employee();
27 27
 
28
-		//test without setting name
29
-		$this->assertEquals(' ',$employee->get_summary_text());
28
+        //test without setting name
29
+        $this->assertEquals(' ',$employee->get_summary_text());
30 30
 
31
-		//test with name set
32
-		$employee->retrieve(1);
33
-		$this->assertEquals('Administrator',$employee->get_summary_text());
31
+        //test with name set
32
+        $employee->retrieve(1);
33
+        $this->assertEquals('Administrator',$employee->get_summary_text());
34 34
 
35 35
     }
36 36
 
37 37
 
38
-	public function testfill_in_additional_list_fields() {
39
-
40
-		$employee = new Employee();
41
-
42
-		//execute the method and test if it works and does not throws an exception.
43
-		try {
44
-			$employee->fill_in_additional_list_fields();
45
-			$this->assertTrue(true);
46
-		}
47
-		catch (Exception $e) {
48
-			$this->fail();
49
-		}
50
-
51
-	}
38
+    public function testfill_in_additional_list_fields() {
52 39
 
53
-	public function testfill_in_additional_detail_fields()
54
-	{
55
-		$employee = new Employee();
40
+        $employee = new Employee();
56 41
 
42
+        //execute the method and test if it works and does not throws an exception.
43
+        try {
44
+            $employee->fill_in_additional_list_fields();
45
+            $this->assertTrue(true);
46
+        }
47
+        catch (Exception $e) {
48
+            $this->fail();
49
+        }
57 50
 
58
-		//test with a empty employee bean
59
-		$employee->fill_in_additional_detail_fields();
60
-		$this->assertEquals("", $employee->reports_to_name);
51
+    }
61 52
 
53
+    public function testfill_in_additional_detail_fields()
54
+    {
55
+        $employee = new Employee();
62 56
 
63
-		//test with a valid employee bean
64
-		$employee->retrieve(1);
65
-		$employee->fill_in_additional_detail_fields();
66
-		$this->assertEquals("", $employee->reports_to_name);
67 57
 
68
-	}
58
+        //test with a empty employee bean
59
+        $employee->fill_in_additional_detail_fields();
60
+        $this->assertEquals("", $employee->reports_to_name);
69 61
 
70
-	public function testretrieve_employee_id()
71
-	{
72
-		$employee = new Employee();
73
-		//$this->assertEquals('1' ,$employee->retrieve_employee_id('admin'));
74 62
 
75
-		$this->markTestSkipped('Bug in query: employee_name parameter is wrongly used as user_name');
63
+        //test with a valid employee bean
64
+        $employee->retrieve(1);
65
+        $employee->fill_in_additional_detail_fields();
66
+        $this->assertEquals("", $employee->reports_to_name);
76 67
 
77
-	}
68
+    }
78 69
 
70
+    public function testretrieve_employee_id()
71
+    {
72
+        $employee = new Employee();
73
+        //$this->assertEquals('1' ,$employee->retrieve_employee_id('admin'));
79 74
 
80
-	public function testverify_data()
81
-	{
82
-		$employee = new Employee();
83
-		$this->assertEquals(true ,$employee->verify_data() );
75
+        $this->markTestSkipped('Bug in query: employee_name parameter is wrongly used as user_name');
84 76
 
85
-	}
77
+    }
86 78
 
87
-	public function testget_list_view_data(){
88 79
 
89
-		$employee = new Employee();
80
+    public function testverify_data()
81
+    {
82
+        $employee = new Employee();
83
+        $this->assertEquals(true ,$employee->verify_data() );
90 84
 
91
-		$expected = array (
92
-					  'SUGAR_LOGIN' => '1',
93
-					  'FULL_NAME' => ' ',
94
-					  'NAME' => ' ',
95
-					  'IS_ADMIN' => '0',
96
-					  'EXTERNAL_AUTH_ONLY' => '0',
97
-					  'RECEIVE_NOTIFICATIONS' => '1',
98
-					  'DELETED' => 0,
99
-					  'PORTAL_ONLY' => '0',
100
-					  'SHOW_ON_EMPLOYEES' => '1',
101
-					  'ENCODED_NAME' => ' ',
102
-					  'EMAIL1' => '',
103
-					  'EMAIL1_LINK' => '<a href=\'javascript:void(0);\' onclick=\'SUGAR.quickCompose.init({"fullComposeUrl":"contact_id=\\u0026parent_type=Employees\\u0026parent_id=\\u0026parent_name=+\\u0026to_addrs_ids=\\u0026to_addrs_names=\\u0026to_addrs_emails=\\u0026to_email_addrs=+%26nbsp%3B%26lt%3B%26gt%3B\\u0026return_module=Employees\\u0026return_action=ListView\\u0026return_id=","composePackage":{"contact_id":"","parent_type":"Employees","parent_id":"","parent_name":" ","to_addrs_ids":"","to_addrs_names":"","to_addrs_emails":"","to_email_addrs":"  \\u003C\\u003E","return_module":"Employees","return_action":"ListView","return_id":""}});\' class=\'\'>',
104
-					  'MESSENGER_TYPE' => '',
105
-					  'REPORTS_TO_NAME' => NULL,
106
-					);
85
+    }
107 86
 
108
-		$actual = $employee->get_list_view_data();
109
-		$this->assertSame($expected, $actual);
87
+    public function testget_list_view_data(){
88
+
89
+        $employee = new Employee();
90
+
91
+        $expected = array (
92
+                        'SUGAR_LOGIN' => '1',
93
+                        'FULL_NAME' => ' ',
94
+                        'NAME' => ' ',
95
+                        'IS_ADMIN' => '0',
96
+                        'EXTERNAL_AUTH_ONLY' => '0',
97
+                        'RECEIVE_NOTIFICATIONS' => '1',
98
+                        'DELETED' => 0,
99
+                        'PORTAL_ONLY' => '0',
100
+                        'SHOW_ON_EMPLOYEES' => '1',
101
+                        'ENCODED_NAME' => ' ',
102
+                        'EMAIL1' => '',
103
+                        'EMAIL1_LINK' => '<a href=\'javascript:void(0);\' onclick=\'SUGAR.quickCompose.init({"fullComposeUrl":"contact_id=\\u0026parent_type=Employees\\u0026parent_id=\\u0026parent_name=+\\u0026to_addrs_ids=\\u0026to_addrs_names=\\u0026to_addrs_emails=\\u0026to_email_addrs=+%26nbsp%3B%26lt%3B%26gt%3B\\u0026return_module=Employees\\u0026return_action=ListView\\u0026return_id=","composePackage":{"contact_id":"","parent_type":"Employees","parent_id":"","parent_name":" ","to_addrs_ids":"","to_addrs_names":"","to_addrs_emails":"","to_email_addrs":"  \\u003C\\u003E","return_module":"Employees","return_action":"ListView","return_id":""}});\' class=\'\'>',
104
+                        'MESSENGER_TYPE' => '',
105
+                        'REPORTS_TO_NAME' => NULL,
106
+                    );
107
+
108
+        $actual = $employee->get_list_view_data();
109
+        $this->assertSame($expected, $actual);
110 110
 
111
-	}
111
+    }
112 112
 
113
-	public function testlist_view_parse_additional_sections(){
113
+    public function testlist_view_parse_additional_sections(){
114 114
 
115
-		$employee = new Employee();
115
+        $employee = new Employee();
116 116
 
117
-		//execute the method and test if it works and does not throws an exception.
118
-		try {
119
-			$employee->list_view_parse_additional_sections(new Sugar_Smarty(), $xTemplateSection);
120
-			$this->assertTrue(true);
121
-		}
122
-		catch (Exception $e) {
123
-			$this->fail();
124
-		}
117
+        //execute the method and test if it works and does not throws an exception.
118
+        try {
119
+            $employee->list_view_parse_additional_sections(new Sugar_Smarty(), $xTemplateSection);
120
+            $this->assertTrue(true);
121
+        }
122
+        catch (Exception $e) {
123
+            $this->fail();
124
+        }
125 125
 
126
-	}
126
+    }
127 127
 
128 128
 
129
-	public function testcreate_export_query() {
129
+    public function testcreate_export_query() {
130 130
 
131
-		$employee = new Employee();
131
+        $employee = new Employee();
132 132
 
133
-		//test with empty string params
134
-		$expected = "SELECT id, user_name, first_name, last_name, description, date_entered, date_modified, modified_user_id, created_by, title, department, is_admin, phone_home, phone_mobile, phone_work, phone_other, phone_fax, address_street, address_city, address_state, address_postalcode, address_country, reports_to_id, portal_only, status, receive_notifications, employee_status, messenger_id, messenger_type, is_group FROM users  WHERE  users.deleted = 0 ORDER BY users.user_name";
135
-		$actual = $employee->create_export_query('','');
136
-		$this->assertSame($expected,$actual);
133
+        //test with empty string params
134
+        $expected = "SELECT id, user_name, first_name, last_name, description, date_entered, date_modified, modified_user_id, created_by, title, department, is_admin, phone_home, phone_mobile, phone_work, phone_other, phone_fax, address_street, address_city, address_state, address_postalcode, address_country, reports_to_id, portal_only, status, receive_notifications, employee_status, messenger_id, messenger_type, is_group FROM users  WHERE  users.deleted = 0 ORDER BY users.user_name";
135
+        $actual = $employee->create_export_query('','');
136
+        $this->assertSame($expected,$actual);
137 137
 
138 138
 
139
-		//test with valid string params
140
-		$expected = "SELECT id, user_name, first_name, last_name, description, date_entered, date_modified, modified_user_id, created_by, title, department, is_admin, phone_home, phone_mobile, phone_work, phone_other, phone_fax, address_street, address_city, address_state, address_postalcode, address_country, reports_to_id, portal_only, status, receive_notifications, employee_status, messenger_id, messenger_type, is_group FROM users  WHERE users.user_name=\"\" AND  users.deleted = 0 ORDER BY users.id";
141
-		$actual = $employee->create_export_query('users.id','users.user_name=""');
142
-		$this->assertSame($expected,$actual);
139
+        //test with valid string params
140
+        $expected = "SELECT id, user_name, first_name, last_name, description, date_entered, date_modified, modified_user_id, created_by, title, department, is_admin, phone_home, phone_mobile, phone_work, phone_other, phone_fax, address_street, address_city, address_state, address_postalcode, address_country, reports_to_id, portal_only, status, receive_notifications, employee_status, messenger_id, messenger_type, is_group FROM users  WHERE users.user_name=\"\" AND  users.deleted = 0 ORDER BY users.id";
141
+        $actual = $employee->create_export_query('users.id','users.user_name=""');
142
+        $this->assertSame($expected,$actual);
143 143
 
144
-	}
144
+    }
145 145
 
146
-	public function testpreprocess_fields_on_save(){
146
+    public function testpreprocess_fields_on_save(){
147 147
 
148
-		$employee = new Employee();
148
+        $employee = new Employee();
149 149
 
150
-		//execute the method and test if it works and does not throws an exception.
151
-		try {
152
-			$employee->preprocess_fields_on_save();
153
-			$this->assertTrue(true);
154
-		}
155
-		catch (Exception $e) {
156
-			$this->fail();
157
-		}
150
+        //execute the method and test if it works and does not throws an exception.
151
+        try {
152
+            $employee->preprocess_fields_on_save();
153
+            $this->assertTrue(true);
154
+        }
155
+        catch (Exception $e) {
156
+            $this->fail();
157
+        }
158 158
 
159
-	}
159
+    }
160 160
 
161 161
     /**
162 162
      * @todo: NEEDS FIXING!
163 163
      */
164
-	public function testcreate_new_list_query()
164
+    public function testcreate_new_list_query()
165 165
     {
166 166
         /*
167 167
     	$employee = new Employee();
@@ -183,9 +183,9 @@  discard block
 block discarded – undo
183 183
 
184 184
     public function testhasCustomFields()
185 185
     {
186
-    	$employee = new Employee();
187
-    	$result = $employee->hasCustomFields();
188
-    	$this->assertEquals(false,$result);
186
+        $employee = new Employee();
187
+        $result = $employee->hasCustomFields();
188
+        $this->assertEquals(false,$result);
189 189
     }
190 190
 
191 191
 }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@  discard block
 block discarded – undo
7 7
 
8 8
 		//execute the contructor and check for the Object type and  attributes
9 9
 		$employee = new Employee();
10
-		$this->assertInstanceOf('Employee',$employee);
11
-		$this->assertInstanceOf('Person',$employee);
12
-		$this->assertInstanceOf('SugarBean',$employee);
10
+		$this->assertInstanceOf('Employee', $employee);
11
+		$this->assertInstanceOf('Person', $employee);
12
+		$this->assertInstanceOf('SugarBean', $employee);
13 13
 
14 14
 		$this->assertAttributeEquals('Employees', 'module_dir', $employee);
15 15
 		$this->assertAttributeEquals('Employee', 'object_name', $employee);
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
 		$employee = new Employee();
27 27
 
28 28
 		//test without setting name
29
-		$this->assertEquals(' ',$employee->get_summary_text());
29
+		$this->assertEquals(' ', $employee->get_summary_text());
30 30
 
31 31
 		//test with name set
32 32
 		$employee->retrieve(1);
33
-		$this->assertEquals('Administrator',$employee->get_summary_text());
33
+		$this->assertEquals('Administrator', $employee->get_summary_text());
34 34
 
35 35
     }
36 36
 
@@ -80,15 +80,15 @@  discard block
 block discarded – undo
80 80
 	public function testverify_data()
81 81
 	{
82 82
 		$employee = new Employee();
83
-		$this->assertEquals(true ,$employee->verify_data() );
83
+		$this->assertEquals(true, $employee->verify_data());
84 84
 
85 85
 	}
86 86
 
87
-	public function testget_list_view_data(){
87
+	public function testget_list_view_data() {
88 88
 
89 89
 		$employee = new Employee();
90 90
 
91
-		$expected = array (
91
+		$expected = array(
92 92
 					  'SUGAR_LOGIN' => '1',
93 93
 					  'FULL_NAME' => ' ',
94 94
 					  'NAME' => ' ',
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
 	}
112 112
 
113
-	public function testlist_view_parse_additional_sections(){
113
+	public function testlist_view_parse_additional_sections() {
114 114
 
115 115
 		$employee = new Employee();
116 116
 
@@ -132,18 +132,18 @@  discard block
 block discarded – undo
132 132
 
133 133
 		//test with empty string params
134 134
 		$expected = "SELECT id, user_name, first_name, last_name, description, date_entered, date_modified, modified_user_id, created_by, title, department, is_admin, phone_home, phone_mobile, phone_work, phone_other, phone_fax, address_street, address_city, address_state, address_postalcode, address_country, reports_to_id, portal_only, status, receive_notifications, employee_status, messenger_id, messenger_type, is_group FROM users  WHERE  users.deleted = 0 ORDER BY users.user_name";
135
-		$actual = $employee->create_export_query('','');
136
-		$this->assertSame($expected,$actual);
135
+		$actual = $employee->create_export_query('', '');
136
+		$this->assertSame($expected, $actual);
137 137
 
138 138
 
139 139
 		//test with valid string params
140 140
 		$expected = "SELECT id, user_name, first_name, last_name, description, date_entered, date_modified, modified_user_id, created_by, title, department, is_admin, phone_home, phone_mobile, phone_work, phone_other, phone_fax, address_street, address_city, address_state, address_postalcode, address_country, reports_to_id, portal_only, status, receive_notifications, employee_status, messenger_id, messenger_type, is_group FROM users  WHERE users.user_name=\"\" AND  users.deleted = 0 ORDER BY users.id";
141
-		$actual = $employee->create_export_query('users.id','users.user_name=""');
142
-		$this->assertSame($expected,$actual);
141
+		$actual = $employee->create_export_query('users.id', 'users.user_name=""');
142
+		$this->assertSame($expected, $actual);
143 143
 
144 144
 	}
145 145
 
146
-	public function testpreprocess_fields_on_save(){
146
+	public function testpreprocess_fields_on_save() {
147 147
 
148 148
 		$employee = new Employee();
149 149
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
     {
186 186
     	$employee = new Employee();
187 187
     	$result = $employee->hasCustomFields();
188
-    	$this->assertEquals(false,$result);
188
+    	$this->assertEquals(false, $result);
189 189
     }
190 190
 
191 191
 }
Please login to merge, or discard this patch.
tests/tests/modules/Contacts/ContactTest.php 3 patches
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -154,8 +154,7 @@  discard block
 block discarded – undo
154 154
 		try {
155 155
 			$contact->load_contacts_users_relationship();
156 156
 			$this->assertTrue(true);
157
-		}
158
-		catch (Exception $e) {
157
+		} catch (Exception $e) {
159 158
 			$this->fail();
160 159
 		}
161 160
 		
@@ -254,8 +253,7 @@  discard block
 block discarded – undo
254 253
 			$contact->save_relationship_changes(true);
255 254
 			$contact->save_relationship_changes(false);
256 255
 			$this->assertTrue(true);
257
-		}
258
-		catch (Exception $e) {
256
+		} catch (Exception $e) {
259 257
 			$this->fail();
260 258
 		}
261 259
 		
@@ -289,8 +287,7 @@  discard block
 block discarded – undo
289 287
     	try {
290 288
    			$contact->process_sync_to_outlook("all");
291 289
     		$this->assertTrue(true);
292
-    	}
293
-    	catch (Exception $e) {
290
+    	} catch (Exception $e) {
294 291
     		$this->fail();
295 292
     	}
296 293
     	 
@@ -299,8 +296,7 @@  discard block
 block discarded – undo
299 296
     	try {
300 297
     		$contact->process_sync_to_outlook("1");
301 298
     		$this->assertTrue(true);
302
-    	}
303
-    	catch (Exception $e) {
299
+    	} catch (Exception $e) {
304 300
     		$this->fail();
305 301
     	}
306 302
     	 	
Please login to merge, or discard this patch.
Indentation   +211 added lines, -211 removed lines patch added patch discarded remove patch
@@ -2,68 +2,68 @@  discard block
 block discarded – undo
2 2
 
3 3
 class ContactTest extends PHPUnit_Framework_TestCase {
4 4
 
5
-	public function testContact() {
5
+    public function testContact() {
6 6
 
7
-		//execute the contructor and check for the Object type and  attributes
8
-		$contact = new Contact();
9
-		$this->assertInstanceOf('Contact',$contact);
10
-		$this->assertInstanceOf('Person',$contact);
11
-		$this->assertInstanceOf('SugarBean',$contact);
7
+        //execute the contructor and check for the Object type and  attributes
8
+        $contact = new Contact();
9
+        $this->assertInstanceOf('Contact',$contact);
10
+        $this->assertInstanceOf('Person',$contact);
11
+        $this->assertInstanceOf('SugarBean',$contact);
12 12
 
13
-		$this->assertAttributeEquals('Contacts', 'module_dir', $contact);
14
-		$this->assertAttributeEquals('Contact', 'object_name', $contact);
15
-		$this->assertAttributeEquals('contacts', 'table_name', $contact);
16
-		$this->assertAttributeEquals('accounts_contacts', 'rel_account_table', $contact);
17
-		$this->assertAttributeEquals('opportunities_contacts', 'rel_opportunity_table', $contact);
18
-		$this->assertAttributeEquals(true, 'importable', $contact);
19
-		$this->assertAttributeEquals(true, 'new_schema', $contact);
13
+        $this->assertAttributeEquals('Contacts', 'module_dir', $contact);
14
+        $this->assertAttributeEquals('Contact', 'object_name', $contact);
15
+        $this->assertAttributeEquals('contacts', 'table_name', $contact);
16
+        $this->assertAttributeEquals('accounts_contacts', 'rel_account_table', $contact);
17
+        $this->assertAttributeEquals('opportunities_contacts', 'rel_opportunity_table', $contact);
18
+        $this->assertAttributeEquals(true, 'importable', $contact);
19
+        $this->assertAttributeEquals(true, 'new_schema', $contact);
20 20
 
21
-	}
21
+    }
22 22
 
23
-	public function testadd_list_count_joins()
24
-	{
25
-		error_reporting(E_ERROR | E_PARSE);
23
+    public function testadd_list_count_joins()
24
+    {
25
+        error_reporting(E_ERROR | E_PARSE);
26 26
 
27
-		$contact = new Contact();
27
+        $contact = new Contact();
28 28
 
29
-		//test with empty strings
30
-		$query = "";
31
-		$contact->add_list_count_joins($query, '');
32
-		$this->assertEquals(" LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c ",$query);
29
+        //test with empty strings
30
+        $query = "";
31
+        $contact->add_list_count_joins($query, '');
32
+        $this->assertEquals(" LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c ",$query);
33 33
 
34 34
 
35
-		//test with valid string
36
-		$query = "";
37
-		$expected = "\n	            LEFT JOIN accounts_contacts\n	            ON contacts.id=accounts_contacts.contact_id\n	            LEFT JOIN accounts\n	            ON accounts_contacts.account_id=accounts.id\n                    LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c ";
38
-		$contact->add_list_count_joins($query, 'accounts.name');
39
-		$query = preg_replace('/\s+/', '', $query);
40
-		$expected =preg_replace('/\s+/', '', $expected);
41
-		$this->assertSame($expected,$query);
35
+        //test with valid string
36
+        $query = "";
37
+        $expected = "\n	            LEFT JOIN accounts_contacts\n	            ON contacts.id=accounts_contacts.contact_id\n	            LEFT JOIN accounts\n	            ON accounts_contacts.account_id=accounts.id\n                    LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c ";
38
+        $contact->add_list_count_joins($query, 'accounts.name');
39
+        $query = preg_replace('/\s+/', '', $query);
40
+        $expected =preg_replace('/\s+/', '', $expected);
41
+        $this->assertSame($expected,$query);
42 42
 		
43
-		//test with valid string
44
-		$query = "";
45
-		$expected = "\n	            LEFT JOIN accounts_contacts\n	            ON contacts.id=accounts_contacts.contact_id\n	            LEFT JOIN accounts\n	            ON accounts_contacts.account_id=accounts.id\n	                 LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c ";
46
-		$contact->add_list_count_joins($query, 'contacts.name');
47
-		$this->assertSame(" LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c ",$query);
43
+        //test with valid string
44
+        $query = "";
45
+        $expected = "\n	            LEFT JOIN accounts_contacts\n	            ON contacts.id=accounts_contacts.contact_id\n	            LEFT JOIN accounts\n	            ON accounts_contacts.account_id=accounts.id\n	                 LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c ";
46
+        $contact->add_list_count_joins($query, 'contacts.name');
47
+        $this->assertSame(" LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c ",$query);
48 48
 
49 49
 
50
-	}
50
+    }
51 51
 
52
-	public function testlistviewACLHelper()
53
-	{
54
-		$contact = new Contact();
52
+    public function testlistviewACLHelper()
53
+    {
54
+        $contact = new Contact();
55 55
 
56
-		$expected = array( "MAIN"=>"a", "ACCOUNT"=>"a");
57
-		$actual = $contact->listviewACLHelper();
58
-		$this->assertSame($expected,$actual);
56
+        $expected = array( "MAIN"=>"a", "ACCOUNT"=>"a");
57
+        $actual = $contact->listviewACLHelper();
58
+        $this->assertSame($expected,$actual);
59 59
 
60
-	}
60
+    }
61 61
 
62 62
     /**
63 63
      * @todo: NEEDS FIXING!
64 64
      */
65
-	public function testcreate_new_list_query()
66
-	{
65
+    public function testcreate_new_list_query()
66
+    {
67 67
         /*
68 68
 		$contact = new Contact();
69 69
 
@@ -79,239 +79,239 @@  discard block
 block discarded – undo
79 79
 		$this->assertSame($expected,$actual);
80 80
 		*/
81 81
         $this->assertTrue(true, "NEEDS FIXING!");
82
-	}
82
+    }
83 83
 
84 84
 
85
-	public function testaddress_popup_create_new_list_query()
86
-	{
85
+    public function testaddress_popup_create_new_list_query()
86
+    {
87 87
 
88
-		$contact = new Contact();
88
+        $contact = new Contact();
89 89
 
90
-		//test with empty string params
91
-		$expected = "SELECT LTRIM(RTRIM(CONCAT(IFNULL(contacts.first_name,''),'',IFNULL(contacts.last_name,'')))) name, \n				contacts.*,\n                accounts.name as account_name,\n                accounts.id as account_id,\n                accounts.assigned_user_id account_id_owner,\n                users.user_name as assigned_user_name ,contacts_cstm.*\n                FROM contacts LEFT JOIN users\n	                    ON contacts.assigned_user_id=users.id\n	                    LEFT JOIN accounts_contacts\n	                    ON contacts.id=accounts_contacts.contact_id  and accounts_contacts.deleted = 0\n	                    LEFT JOIN accounts\n	                    ON accounts_contacts.account_id=accounts.id AND accounts.deleted=0 LEFT JOIN email_addr_bean_rel eabl  ON eabl.bean_id = contacts.id AND eabl.bean_module = 'Contacts' and eabl.primary_address = 1 and eabl.deleted=0 LEFT JOIN email_addresses ea ON (ea.id = eabl.email_address_id)  LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c where  contacts.deleted=0 ";
92
-		$actual = $contact->address_popup_create_new_list_query('','');
93
-		$this->assertSame($expected,$actual);
90
+        //test with empty string params
91
+        $expected = "SELECT LTRIM(RTRIM(CONCAT(IFNULL(contacts.first_name,''),'',IFNULL(contacts.last_name,'')))) name, \n				contacts.*,\n                accounts.name as account_name,\n                accounts.id as account_id,\n                accounts.assigned_user_id account_id_owner,\n                users.user_name as assigned_user_name ,contacts_cstm.*\n                FROM contacts LEFT JOIN users\n	                    ON contacts.assigned_user_id=users.id\n	                    LEFT JOIN accounts_contacts\n	                    ON contacts.id=accounts_contacts.contact_id  and accounts_contacts.deleted = 0\n	                    LEFT JOIN accounts\n	                    ON accounts_contacts.account_id=accounts.id AND accounts.deleted=0 LEFT JOIN email_addr_bean_rel eabl  ON eabl.bean_id = contacts.id AND eabl.bean_module = 'Contacts' and eabl.primary_address = 1 and eabl.deleted=0 LEFT JOIN email_addresses ea ON (ea.id = eabl.email_address_id)  LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c where  contacts.deleted=0 ";
92
+        $actual = $contact->address_popup_create_new_list_query('','');
93
+        $this->assertSame($expected,$actual);
94 94
 
95 95
 
96
-		//test with valid string params
97
-		$expected = "SELECT LTRIM(RTRIM(CONCAT(IFNULL(contacts.first_name,''),'',IFNULL(contacts.last_name,'')))) name, \n				contacts.*,\n                accounts.name as account_name,\n                accounts.id as account_id,\n                accounts.assigned_user_id account_id_owner,\n                users.user_name as assigned_user_name ,contacts_cstm.*\n                FROM contacts LEFT JOIN users\n	                    ON contacts.assigned_user_id=users.id\n	                    LEFT JOIN accounts_contacts\n	                    ON contacts.id=accounts_contacts.contact_id  and accounts_contacts.deleted = 0\n	                    LEFT JOIN accounts\n	                    ON accounts_contacts.account_id=accounts.id AND accounts.deleted=0 LEFT JOIN email_addr_bean_rel eabl  ON eabl.bean_id = contacts.id AND eabl.bean_module = 'Contacts' and eabl.primary_address = 1 and eabl.deleted=0 LEFT JOIN email_addresses ea ON (ea.id = eabl.email_address_id)  LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c where (contacts.name=\"\") AND  contacts.deleted=0 ";
98
-		$actual = $contact->address_popup_create_new_list_query('contacts.id','contacts.name=""');
99
-		$this->assertSame($expected,$actual);
96
+        //test with valid string params
97
+        $expected = "SELECT LTRIM(RTRIM(CONCAT(IFNULL(contacts.first_name,''),'',IFNULL(contacts.last_name,'')))) name, \n				contacts.*,\n                accounts.name as account_name,\n                accounts.id as account_id,\n                accounts.assigned_user_id account_id_owner,\n                users.user_name as assigned_user_name ,contacts_cstm.*\n                FROM contacts LEFT JOIN users\n	                    ON contacts.assigned_user_id=users.id\n	                    LEFT JOIN accounts_contacts\n	                    ON contacts.id=accounts_contacts.contact_id  and accounts_contacts.deleted = 0\n	                    LEFT JOIN accounts\n	                    ON accounts_contacts.account_id=accounts.id AND accounts.deleted=0 LEFT JOIN email_addr_bean_rel eabl  ON eabl.bean_id = contacts.id AND eabl.bean_module = 'Contacts' and eabl.primary_address = 1 and eabl.deleted=0 LEFT JOIN email_addresses ea ON (ea.id = eabl.email_address_id)  LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c where (contacts.name=\"\") AND  contacts.deleted=0 ";
98
+        $actual = $contact->address_popup_create_new_list_query('contacts.id','contacts.name=""');
99
+        $this->assertSame($expected,$actual);
100 100
 
101
-	}
101
+    }
102 102
 
103
-	public function testcreate_export_query()
104
-	{
105
-		$contact = new Contact();
103
+    public function testcreate_export_query()
104
+    {
105
+        $contact = new Contact();
106 106
 
107
-		//test with empty string params
108
-		$expected = "SELECT\n                                contacts.*,\n                                email_addresses.email_address email_address,\n                                '' email_addresses_non_primary, accounts.name as account_name,\n                                users.user_name as assigned_user_name ,contacts_cstm.jjwg_maps_lng_c,contacts_cstm.jjwg_maps_lat_c,contacts_cstm.jjwg_maps_geocode_status_c,contacts_cstm.jjwg_maps_address_c FROM contacts LEFT JOIN users\n	                                ON contacts.assigned_user_id=users.id LEFT JOIN accounts_contacts\n	                                ON ( contacts.id=accounts_contacts.contact_id and (accounts_contacts.deleted is null or accounts_contacts.deleted = 0))\n	                                LEFT JOIN accounts\n	                                ON accounts_contacts.account_id=accounts.id  LEFT JOIN  email_addr_bean_rel on contacts.id = email_addr_bean_rel.bean_id and email_addr_bean_rel.bean_module='Contacts' and email_addr_bean_rel.deleted=0 and email_addr_bean_rel.primary_address=1  LEFT JOIN email_addresses on email_addresses.id = email_addr_bean_rel.email_address_id  LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c where ( accounts.deleted IS NULL OR accounts.deleted=0 )\n                      AND contacts.deleted=0 ";
109
-		$actual = $contact->create_export_query('','');
110
-		$this->assertSame($expected,$actual);
107
+        //test with empty string params
108
+        $expected = "SELECT\n                                contacts.*,\n                                email_addresses.email_address email_address,\n                                '' email_addresses_non_primary, accounts.name as account_name,\n                                users.user_name as assigned_user_name ,contacts_cstm.jjwg_maps_lng_c,contacts_cstm.jjwg_maps_lat_c,contacts_cstm.jjwg_maps_geocode_status_c,contacts_cstm.jjwg_maps_address_c FROM contacts LEFT JOIN users\n	                                ON contacts.assigned_user_id=users.id LEFT JOIN accounts_contacts\n	                                ON ( contacts.id=accounts_contacts.contact_id and (accounts_contacts.deleted is null or accounts_contacts.deleted = 0))\n	                                LEFT JOIN accounts\n	                                ON accounts_contacts.account_id=accounts.id  LEFT JOIN  email_addr_bean_rel on contacts.id = email_addr_bean_rel.bean_id and email_addr_bean_rel.bean_module='Contacts' and email_addr_bean_rel.deleted=0 and email_addr_bean_rel.primary_address=1  LEFT JOIN email_addresses on email_addresses.id = email_addr_bean_rel.email_address_id  LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c where ( accounts.deleted IS NULL OR accounts.deleted=0 )\n                      AND contacts.deleted=0 ";
109
+        $actual = $contact->create_export_query('','');
110
+        $this->assertSame($expected,$actual);
111 111
 
112 112
 
113
-		//test with valid string params
114
-		$expected = "SELECT\n                                contacts.*,\n                                email_addresses.email_address email_address,\n                                '' email_addresses_non_primary, accounts.name as account_name,\n                                users.user_name as assigned_user_name ,contacts_cstm.jjwg_maps_lng_c,contacts_cstm.jjwg_maps_lat_c,contacts_cstm.jjwg_maps_geocode_status_c,contacts_cstm.jjwg_maps_address_c FROM contacts LEFT JOIN users\n	                                ON contacts.assigned_user_id=users.id LEFT JOIN accounts_contacts\n	                                ON ( contacts.id=accounts_contacts.contact_id and (accounts_contacts.deleted is null or accounts_contacts.deleted = 0))\n	                                LEFT JOIN accounts\n	                                ON accounts_contacts.account_id=accounts.id  LEFT JOIN  email_addr_bean_rel on contacts.id = email_addr_bean_rel.bean_id and email_addr_bean_rel.bean_module='Contacts' and email_addr_bean_rel.deleted=0 and email_addr_bean_rel.primary_address=1  LEFT JOIN email_addresses on email_addresses.id = email_addr_bean_rel.email_address_id  LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c where (contacts.name=\"\") AND ( accounts.deleted IS NULL OR accounts.deleted=0 )\n                      AND contacts.deleted=0 ";
115
-		$actual = $contact->create_export_query('contacts.id','contacts.name=""');
116
-		$this->assertSame($expected,$actual);
113
+        //test with valid string params
114
+        $expected = "SELECT\n                                contacts.*,\n                                email_addresses.email_address email_address,\n                                '' email_addresses_non_primary, accounts.name as account_name,\n                                users.user_name as assigned_user_name ,contacts_cstm.jjwg_maps_lng_c,contacts_cstm.jjwg_maps_lat_c,contacts_cstm.jjwg_maps_geocode_status_c,contacts_cstm.jjwg_maps_address_c FROM contacts LEFT JOIN users\n	                                ON contacts.assigned_user_id=users.id LEFT JOIN accounts_contacts\n	                                ON ( contacts.id=accounts_contacts.contact_id and (accounts_contacts.deleted is null or accounts_contacts.deleted = 0))\n	                                LEFT JOIN accounts\n	                                ON accounts_contacts.account_id=accounts.id  LEFT JOIN  email_addr_bean_rel on contacts.id = email_addr_bean_rel.bean_id and email_addr_bean_rel.bean_module='Contacts' and email_addr_bean_rel.deleted=0 and email_addr_bean_rel.primary_address=1  LEFT JOIN email_addresses on email_addresses.id = email_addr_bean_rel.email_address_id  LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c where (contacts.name=\"\") AND ( accounts.deleted IS NULL OR accounts.deleted=0 )\n                      AND contacts.deleted=0 ";
115
+        $actual = $contact->create_export_query('contacts.id','contacts.name=""');
116
+        $this->assertSame($expected,$actual);
117 117
 
118
-	}
118
+    }
119 119
 
120
-	public function testfill_in_additional_list_fields() {
120
+    public function testfill_in_additional_list_fields() {
121 121
 
122
-		$contact = new Contact();
122
+        $contact = new Contact();
123 123
 
124
-		//test with attributes preset and verify attributes are set accordingly
125
-		$contact->first_name = "firstn";
126
-		$contact->last_name = "lastn";
127
-		$contact->email1 = "[email protected]";
128
-		$contact->email2 = "[email protected]";
124
+        //test with attributes preset and verify attributes are set accordingly
125
+        $contact->first_name = "firstn";
126
+        $contact->last_name = "lastn";
127
+        $contact->email1 = "[email protected]";
128
+        $contact->email2 = "[email protected]";
129 129
 
130 130
 
131
-		$contact->fill_in_additional_list_fields();
131
+        $contact->fill_in_additional_list_fields();
132 132
 
133
-		$this->assertEquals("firstn lastn",$contact->full_name);
134
-		$this->assertEquals("firstn lastn &lt;[email protected]&gt;",$contact->email_and_name1);
135
-		$this->assertEquals("firstn lastn &lt;[email protected]&gt;",$contact->email_and_name2);
133
+        $this->assertEquals("firstn lastn",$contact->full_name);
134
+        $this->assertEquals("firstn lastn &lt;[email protected]&gt;",$contact->email_and_name1);
135
+        $this->assertEquals("firstn lastn &lt;[email protected]&gt;",$contact->email_and_name2);
136 136
 
137
-	}
137
+    }
138 138
 
139
-	public function testfill_in_additional_detail_fields() {
139
+    public function testfill_in_additional_detail_fields() {
140 140
 
141
-		$contact = new Contact();
141
+        $contact = new Contact();
142 142
 
143
-		//test with attributes preset and verify attributes are set accordingly
144
-		$contact->id = "1";
143
+        //test with attributes preset and verify attributes are set accordingly
144
+        $contact->id = "1";
145 145
 
146
-		$contact->fill_in_additional_detail_fields();
146
+        $contact->fill_in_additional_detail_fields();
147 147
 
148
-		$this->assertEquals("",$contact->account_name);
149
-		$this->assertEquals("",$contact->account_id);
150
-		$this->assertEquals("",$contact->report_to_name);
148
+        $this->assertEquals("",$contact->account_name);
149
+        $this->assertEquals("",$contact->account_id);
150
+        $this->assertEquals("",$contact->report_to_name);
151 151
 
152
-	}
152
+    }
153 153
 
154 154
 
155
-	public function testload_contacts_users_relationship(){
155
+    public function testload_contacts_users_relationship(){
156 156
 
157
-		$contact = new Contact();
157
+        $contact = new Contact();
158 158
 
159
-		//execute the method and test if it works and does not throws an exception.
160
-		try {
161
-			$contact->load_contacts_users_relationship();
162
-			$this->assertTrue(true);
163
-		}
164
-		catch (Exception $e) {
165
-			$this->fail();
166
-		}
159
+        //execute the method and test if it works and does not throws an exception.
160
+        try {
161
+            $contact->load_contacts_users_relationship();
162
+            $this->assertTrue(true);
163
+        }
164
+        catch (Exception $e) {
165
+            $this->fail();
166
+        }
167 167
 
168
-	}
168
+    }
169 169
 
170
-	public function testget_list_view_data() {
170
+    public function testget_list_view_data() {
171 171
 
172
-		$contact = new Contact();
172
+        $contact = new Contact();
173 173
 
174
-		//test with attributes preset and verify attributes are set accordingly
175
-		$contact->first_name = "first";
176
-		$contact->last_name = "last";
177
-
178
-		$expected = array (
179
-					  'NAME' => 'first last',
180
-					  'DELETED' => 0,
181
-					  'FIRST_NAME' => 'first',
182
-					  'LAST_NAME' => 'last',
183
-					  'FULL_NAME' => 'first last',
184
-					  'DO_NOT_CALL' => '0',
185
-					  'PORTAL_USER_TYPE' => 'Single user',
186
-					  'ENCODED_NAME' => 'first last',
187
-					  'EMAIL1' => '',
188
-					  'EMAIL1_LINK' => '<a href=\'javascript:void(0);\' onclick=\'SUGAR.quickCompose.init({"fullComposeUrl":"contact_id=\\u0026parent_type=Contacts\\u0026parent_id=\\u0026parent_name=first+last\\u0026to_addrs_ids=\\u0026to_addrs_names=first+last\\u0026to_addrs_emails=\\u0026to_email_addrs=first+last%26nbsp%3B%26lt%3B%26gt%3B\\u0026return_module=Contacts\\u0026return_action=ListView\\u0026return_id=","composePackage":{"contact_id":"","parent_type":"Contacts","parent_id":"","parent_name":"first last","to_addrs_ids":"","to_addrs_names":"first last","to_addrs_emails":"","to_email_addrs":"first last \\u003C\\u003E","return_module":"Contacts","return_action":"ListView","return_id":""}});\' class=\'\'>',
189
-					  'EMAIL_AND_NAME1' => 'first last &lt;&gt;',
190
-					);
191
-
192
-		$actual = $contact->get_list_view_data();
193
-		//$this->assertSame($expected, $actual);
194
-		$this->assertEquals($expected['NAME'], $actual['NAME']);
195
-		$this->assertEquals($expected['FIRST_NAME'], $actual['FIRST_NAME']);
196
-		$this->assertEquals($expected['LAST_NAME'], $actual['LAST_NAME']);
197
-		$this->assertEquals($expected['FULL_NAME'], $actual['FULL_NAME']);
198
-		$this->assertEquals($expected['ENCODED_NAME'], $actual['ENCODED_NAME']);
199
-		$this->assertEquals($expected['EMAIL_AND_NAME1'], $actual['EMAIL_AND_NAME1']);
200
-
201
-	}
202
-
203
-
204
-	public function testbuild_generic_where_clause ()
205
-	{
174
+        //test with attributes preset and verify attributes are set accordingly
175
+        $contact->first_name = "first";
176
+        $contact->last_name = "last";
206 177
 
207
-		$contact = new Contact();
178
+        $expected = array (
179
+                        'NAME' => 'first last',
180
+                        'DELETED' => 0,
181
+                        'FIRST_NAME' => 'first',
182
+                        'LAST_NAME' => 'last',
183
+                        'FULL_NAME' => 'first last',
184
+                        'DO_NOT_CALL' => '0',
185
+                        'PORTAL_USER_TYPE' => 'Single user',
186
+                        'ENCODED_NAME' => 'first last',
187
+                        'EMAIL1' => '',
188
+                        'EMAIL1_LINK' => '<a href=\'javascript:void(0);\' onclick=\'SUGAR.quickCompose.init({"fullComposeUrl":"contact_id=\\u0026parent_type=Contacts\\u0026parent_id=\\u0026parent_name=first+last\\u0026to_addrs_ids=\\u0026to_addrs_names=first+last\\u0026to_addrs_emails=\\u0026to_email_addrs=first+last%26nbsp%3B%26lt%3B%26gt%3B\\u0026return_module=Contacts\\u0026return_action=ListView\\u0026return_id=","composePackage":{"contact_id":"","parent_type":"Contacts","parent_id":"","parent_name":"first last","to_addrs_ids":"","to_addrs_names":"first last","to_addrs_emails":"","to_email_addrs":"first last \\u003C\\u003E","return_module":"Contacts","return_action":"ListView","return_id":""}});\' class=\'\'>',
189
+                        'EMAIL_AND_NAME1' => 'first last &lt;&gt;',
190
+                    );
208 191
 
209
-		//test with string
210
-		$expected = "contacts.last_name like 'test%' or contacts.first_name like 'test%' or accounts.name like 'test%' or contacts.assistant like 'test%' or ea.email_address like 'test%'";
211
-		$actual = $contact->build_generic_where_clause('test');
212
-		$this->assertSame($expected,$actual);
192
+        $actual = $contact->get_list_view_data();
193
+        //$this->assertSame($expected, $actual);
194
+        $this->assertEquals($expected['NAME'], $actual['NAME']);
195
+        $this->assertEquals($expected['FIRST_NAME'], $actual['FIRST_NAME']);
196
+        $this->assertEquals($expected['LAST_NAME'], $actual['LAST_NAME']);
197
+        $this->assertEquals($expected['FULL_NAME'], $actual['FULL_NAME']);
198
+        $this->assertEquals($expected['ENCODED_NAME'], $actual['ENCODED_NAME']);
199
+        $this->assertEquals($expected['EMAIL_AND_NAME1'], $actual['EMAIL_AND_NAME1']);
213 200
 
201
+    }
214 202
 
215
-		//test with number
216
-		$expected = "contacts.last_name like '1%' or contacts.first_name like '1%' or accounts.name like '1%' or contacts.assistant like '1%' or ea.email_address like '1%' or contacts.phone_home like '%1%' or contacts.phone_mobile like '%1%' or contacts.phone_work like '%1%' or contacts.phone_other like '%1%' or contacts.phone_fax like '%1%' or contacts.assistant_phone like '%1%'";
217
-		$actual = $contact->build_generic_where_clause(1);
218
-		$this->assertSame($expected,$actual);
219 203
 
220
-	}
204
+    public function testbuild_generic_where_clause ()
205
+    {
221 206
 
222
-	public function testset_notification_body()
223
-	{
224
-		$contact = new Contact();
207
+        $contact = new Contact();
225 208
 
226
-		//test with attributes preset and verify attributes are set accordingly
227
-		$contact->first_name = "first";
228
-		$contact->last_name = "last";
229
-		$contact->description = "some text";
230
-		$contact->fill_in_additional_list_fields();
209
+        //test with string
210
+        $expected = "contacts.last_name like 'test%' or contacts.first_name like 'test%' or accounts.name like 'test%' or contacts.assistant like 'test%' or ea.email_address like 'test%'";
211
+        $actual = $contact->build_generic_where_clause('test');
212
+        $this->assertSame($expected,$actual);
231 213
 
232
-		$result = $contact->set_notification_body(new Sugar_Smarty(), $contact);
233 214
 
234
-		$this->assertEquals($contact->full_name ,$result->_tpl_vars['CONTACT_NAME']);
235
-		$this->assertEquals($contact->description ,$result->_tpl_vars['CONTACT_DESCRIPTION']);
215
+        //test with number
216
+        $expected = "contacts.last_name like '1%' or contacts.first_name like '1%' or accounts.name like '1%' or contacts.assistant like '1%' or ea.email_address like '1%' or contacts.phone_home like '%1%' or contacts.phone_mobile like '%1%' or contacts.phone_work like '%1%' or contacts.phone_other like '%1%' or contacts.phone_fax like '%1%' or contacts.assistant_phone like '%1%'";
217
+        $actual = $contact->build_generic_where_clause(1);
218
+        $this->assertSame($expected,$actual);
236 219
 
237
-	}
220
+    }
238 221
 
239
-	public function testget_contact_id_by_email()
240
-	{
241
-		$contact = new Contact();
222
+    public function testset_notification_body()
223
+    {
224
+        $contact = new Contact();
242 225
 
243
-		$result = $contact->get_contact_id_by_email("");
244
-		$this->assertEquals(null,$result);
226
+        //test with attributes preset and verify attributes are set accordingly
227
+        $contact->first_name = "first";
228
+        $contact->last_name = "last";
229
+        $contact->description = "some text";
230
+        $contact->fill_in_additional_list_fields();
245 231
 
232
+        $result = $contact->set_notification_body(new Sugar_Smarty(), $contact);
246 233
 
247
-		//$result = $contact->get_contact_id_by_email("[email protected]");
248
-		//$this->assertEquals(null,$result);
234
+        $this->assertEquals($contact->full_name ,$result->_tpl_vars['CONTACT_NAME']);
235
+        $this->assertEquals($contact->description ,$result->_tpl_vars['CONTACT_DESCRIPTION']);
249 236
 
250
-		$this->markTestSkipped('Invalid Columns(email1,email2) in Query ');
237
+    }
251 238
 
252
-	}
239
+    public function testget_contact_id_by_email()
240
+    {
241
+        $contact = new Contact();
253 242
 
254
-	public function testsave_relationship_changes() {
243
+        $result = $contact->get_contact_id_by_email("");
244
+        $this->assertEquals(null,$result);
255 245
 
256
-		$contact = new Contact();
257 246
 
258
-		//execute the method and test if it works and does not throws an exception.
259
-		try {
260
-			$contact->save_relationship_changes(true);
261
-			$contact->save_relationship_changes(false);
262
-			$this->assertTrue(true);
263
-		}
264
-		catch (Exception $e) {
265
-			$this->fail();
266
-		}
247
+        //$result = $contact->get_contact_id_by_email("[email protected]");
248
+        //$this->assertEquals(null,$result);
267 249
 
268
-	}
250
+        $this->markTestSkipped('Invalid Columns(email1,email2) in Query ');
269 251
 
270
-	public function testbean_implements()
271
-	{
272
-		$contact = new Contact();
273
-		$this->assertEquals(false, $contact->bean_implements('')); //test with blank value
274
-		$this->assertEquals(false, $contact->bean_implements('test')); //test with invalid value
275
-		$this->assertEquals(true, $contact->bean_implements('ACL')); //test with valid value
276
-	}
252
+    }
277 253
 
278
-	public function testget_unlinked_email_query()
279
-	{
280
-		$contact = new Contact();
254
+    public function testsave_relationship_changes() {
281 255
 
282
-		//execute the method and verify that it retunrs expected results
283
-		$expected = "SELECT emails.id FROM emails  JOIN (select DISTINCT email_id from emails_email_addr_rel eear\n\n	join email_addr_bean_rel eabr on eabr.bean_id ='' and eabr.bean_module = 'Contacts' and\n	eabr.email_address_id = eear.email_address_id and eabr.deleted=0\n	where eear.deleted=0 and eear.email_id not in\n	(select eb.email_id from emails_beans eb where eb.bean_module ='Contacts' and eb.bean_id = '')\n	) derivedemails on derivedemails.email_id = emails.id";
284
-		$actual = $contact->get_unlinked_email_query();
285
-		$this->assertSame($expected,$actual);
256
+        $contact = new Contact();
257
+
258
+        //execute the method and test if it works and does not throws an exception.
259
+        try {
260
+            $contact->save_relationship_changes(true);
261
+            $contact->save_relationship_changes(false);
262
+            $this->assertTrue(true);
263
+        }
264
+        catch (Exception $e) {
265
+            $this->fail();
266
+        }
267
+
268
+    }
269
+
270
+    public function testbean_implements()
271
+    {
272
+        $contact = new Contact();
273
+        $this->assertEquals(false, $contact->bean_implements('')); //test with blank value
274
+        $this->assertEquals(false, $contact->bean_implements('test')); //test with invalid value
275
+        $this->assertEquals(true, $contact->bean_implements('ACL')); //test with valid value
276
+    }
277
+
278
+    public function testget_unlinked_email_query()
279
+    {
280
+        $contact = new Contact();
281
+
282
+        //execute the method and verify that it retunrs expected results
283
+        $expected = "SELECT emails.id FROM emails  JOIN (select DISTINCT email_id from emails_email_addr_rel eear\n\n	join email_addr_bean_rel eabr on eabr.bean_id ='' and eabr.bean_module = 'Contacts' and\n	eabr.email_address_id = eear.email_address_id and eabr.deleted=0\n	where eear.deleted=0 and eear.email_id not in\n	(select eb.email_id from emails_beans eb where eb.bean_module ='Contacts' and eb.bean_id = '')\n	) derivedemails on derivedemails.email_id = emails.id";
284
+        $actual = $contact->get_unlinked_email_query();
285
+        $this->assertSame($expected,$actual);
286 286
 
287
-	}
287
+    }
288 288
 
289 289
 
290 290
     public function testprocess_sync_to_outlook()
291 291
     {
292
-    	$contact = new Contact();
292
+        $contact = new Contact();
293 293
 
294
-    	//execute the method and test if it works and does not throws an exception.
295
-    	try {
296
-   			$contact->process_sync_to_outlook("all");
297
-    		$this->assertTrue(true);
298
-    	}
299
-    	catch (Exception $e) {
300
-    		$this->fail();
301
-    	}
294
+        //execute the method and test if it works and does not throws an exception.
295
+        try {
296
+                $contact->process_sync_to_outlook("all");
297
+            $this->assertTrue(true);
298
+        }
299
+        catch (Exception $e) {
300
+            $this->fail();
301
+        }
302 302
 
303 303
 
304
-    	//execute the method and test if it works and does not throws an exception.
305
-    	try {
306
-    		$contact->process_sync_to_outlook("1");
307
-    		$this->assertTrue(true);
308
-    	}
309
-    	catch (Exception $e) {
310
-    		$this->fail();
311
-    	}
304
+        //execute the method and test if it works and does not throws an exception.
305
+        try {
306
+            $contact->process_sync_to_outlook("1");
307
+            $this->assertTrue(true);
308
+        }
309
+        catch (Exception $e) {
310
+            $this->fail();
311
+        }
312 312
 
313 313
 
314 314
 
315
-	}
315
+    }
316 316
 
317 317
 }
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -6,9 +6,9 @@  discard block
 block discarded – undo
6 6
 
7 7
 		//execute the contructor and check for the Object type and  attributes
8 8
 		$contact = new Contact();
9
-		$this->assertInstanceOf('Contact',$contact);
10
-		$this->assertInstanceOf('Person',$contact);
11
-		$this->assertInstanceOf('SugarBean',$contact);
9
+		$this->assertInstanceOf('Contact', $contact);
10
+		$this->assertInstanceOf('Person', $contact);
11
+		$this->assertInstanceOf('SugarBean', $contact);
12 12
 
13 13
 		$this->assertAttributeEquals('Contacts', 'module_dir', $contact);
14 14
 		$this->assertAttributeEquals('Contact', 'object_name', $contact);
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 		//test with empty strings
30 30
 		$query = "";
31 31
 		$contact->add_list_count_joins($query, '');
32
-		$this->assertEquals(" LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c ",$query);
32
+		$this->assertEquals(" LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c ", $query);
33 33
 
34 34
 
35 35
 		//test with valid string
@@ -37,14 +37,14 @@  discard block
 block discarded – undo
37 37
 		$expected = "\n	            LEFT JOIN accounts_contacts\n	            ON contacts.id=accounts_contacts.contact_id\n	            LEFT JOIN accounts\n	            ON accounts_contacts.account_id=accounts.id\n                    LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c ";
38 38
 		$contact->add_list_count_joins($query, 'accounts.name');
39 39
 		$query = preg_replace('/\s+/', '', $query);
40
-		$expected =preg_replace('/\s+/', '', $expected);
41
-		$this->assertSame($expected,$query);
40
+		$expected = preg_replace('/\s+/', '', $expected);
41
+		$this->assertSame($expected, $query);
42 42
 		
43 43
 		//test with valid string
44 44
 		$query = "";
45 45
 		$expected = "\n	            LEFT JOIN accounts_contacts\n	            ON contacts.id=accounts_contacts.contact_id\n	            LEFT JOIN accounts\n	            ON accounts_contacts.account_id=accounts.id\n	                 LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c ";
46 46
 		$contact->add_list_count_joins($query, 'contacts.name');
47
-		$this->assertSame(" LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c ",$query);
47
+		$this->assertSame(" LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c ", $query);
48 48
 
49 49
 
50 50
 	}
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 	{
54 54
 		$contact = new Contact();
55 55
 
56
-		$expected = array( "MAIN"=>"a", "ACCOUNT"=>"a");
56
+		$expected = array("MAIN"=>"a", "ACCOUNT"=>"a");
57 57
 		$actual = $contact->listviewACLHelper();
58
-		$this->assertSame($expected,$actual);
58
+		$this->assertSame($expected, $actual);
59 59
 
60 60
 	}
61 61
 
@@ -89,14 +89,14 @@  discard block
 block discarded – undo
89 89
 
90 90
 		//test with empty string params
91 91
 		$expected = "SELECT LTRIM(RTRIM(CONCAT(IFNULL(contacts.first_name,''),'',IFNULL(contacts.last_name,'')))) name, \n				contacts.*,\n                accounts.name as account_name,\n                accounts.id as account_id,\n                accounts.assigned_user_id account_id_owner,\n                users.user_name as assigned_user_name ,contacts_cstm.*\n                FROM contacts LEFT JOIN users\n	                    ON contacts.assigned_user_id=users.id\n	                    LEFT JOIN accounts_contacts\n	                    ON contacts.id=accounts_contacts.contact_id  and accounts_contacts.deleted = 0\n	                    LEFT JOIN accounts\n	                    ON accounts_contacts.account_id=accounts.id AND accounts.deleted=0 LEFT JOIN email_addr_bean_rel eabl  ON eabl.bean_id = contacts.id AND eabl.bean_module = 'Contacts' and eabl.primary_address = 1 and eabl.deleted=0 LEFT JOIN email_addresses ea ON (ea.id = eabl.email_address_id)  LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c where  contacts.deleted=0 ";
92
-		$actual = $contact->address_popup_create_new_list_query('','');
93
-		$this->assertSame($expected,$actual);
92
+		$actual = $contact->address_popup_create_new_list_query('', '');
93
+		$this->assertSame($expected, $actual);
94 94
 
95 95
 
96 96
 		//test with valid string params
97 97
 		$expected = "SELECT LTRIM(RTRIM(CONCAT(IFNULL(contacts.first_name,''),'',IFNULL(contacts.last_name,'')))) name, \n				contacts.*,\n                accounts.name as account_name,\n                accounts.id as account_id,\n                accounts.assigned_user_id account_id_owner,\n                users.user_name as assigned_user_name ,contacts_cstm.*\n                FROM contacts LEFT JOIN users\n	                    ON contacts.assigned_user_id=users.id\n	                    LEFT JOIN accounts_contacts\n	                    ON contacts.id=accounts_contacts.contact_id  and accounts_contacts.deleted = 0\n	                    LEFT JOIN accounts\n	                    ON accounts_contacts.account_id=accounts.id AND accounts.deleted=0 LEFT JOIN email_addr_bean_rel eabl  ON eabl.bean_id = contacts.id AND eabl.bean_module = 'Contacts' and eabl.primary_address = 1 and eabl.deleted=0 LEFT JOIN email_addresses ea ON (ea.id = eabl.email_address_id)  LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c where (contacts.name=\"\") AND  contacts.deleted=0 ";
98
-		$actual = $contact->address_popup_create_new_list_query('contacts.id','contacts.name=""');
99
-		$this->assertSame($expected,$actual);
98
+		$actual = $contact->address_popup_create_new_list_query('contacts.id', 'contacts.name=""');
99
+		$this->assertSame($expected, $actual);
100 100
 
101 101
 	}
102 102
 
@@ -106,14 +106,14 @@  discard block
 block discarded – undo
106 106
 
107 107
 		//test with empty string params
108 108
 		$expected = "SELECT\n                                contacts.*,\n                                email_addresses.email_address email_address,\n                                '' email_addresses_non_primary, accounts.name as account_name,\n                                users.user_name as assigned_user_name ,contacts_cstm.jjwg_maps_lng_c,contacts_cstm.jjwg_maps_lat_c,contacts_cstm.jjwg_maps_geocode_status_c,contacts_cstm.jjwg_maps_address_c FROM contacts LEFT JOIN users\n	                                ON contacts.assigned_user_id=users.id LEFT JOIN accounts_contacts\n	                                ON ( contacts.id=accounts_contacts.contact_id and (accounts_contacts.deleted is null or accounts_contacts.deleted = 0))\n	                                LEFT JOIN accounts\n	                                ON accounts_contacts.account_id=accounts.id  LEFT JOIN  email_addr_bean_rel on contacts.id = email_addr_bean_rel.bean_id and email_addr_bean_rel.bean_module='Contacts' and email_addr_bean_rel.deleted=0 and email_addr_bean_rel.primary_address=1  LEFT JOIN email_addresses on email_addresses.id = email_addr_bean_rel.email_address_id  LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c where ( accounts.deleted IS NULL OR accounts.deleted=0 )\n                      AND contacts.deleted=0 ";
109
-		$actual = $contact->create_export_query('','');
110
-		$this->assertSame($expected,$actual);
109
+		$actual = $contact->create_export_query('', '');
110
+		$this->assertSame($expected, $actual);
111 111
 
112 112
 
113 113
 		//test with valid string params
114 114
 		$expected = "SELECT\n                                contacts.*,\n                                email_addresses.email_address email_address,\n                                '' email_addresses_non_primary, accounts.name as account_name,\n                                users.user_name as assigned_user_name ,contacts_cstm.jjwg_maps_lng_c,contacts_cstm.jjwg_maps_lat_c,contacts_cstm.jjwg_maps_geocode_status_c,contacts_cstm.jjwg_maps_address_c FROM contacts LEFT JOIN users\n	                                ON contacts.assigned_user_id=users.id LEFT JOIN accounts_contacts\n	                                ON ( contacts.id=accounts_contacts.contact_id and (accounts_contacts.deleted is null or accounts_contacts.deleted = 0))\n	                                LEFT JOIN accounts\n	                                ON accounts_contacts.account_id=accounts.id  LEFT JOIN  email_addr_bean_rel on contacts.id = email_addr_bean_rel.bean_id and email_addr_bean_rel.bean_module='Contacts' and email_addr_bean_rel.deleted=0 and email_addr_bean_rel.primary_address=1  LEFT JOIN email_addresses on email_addresses.id = email_addr_bean_rel.email_address_id  LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c where (contacts.name=\"\") AND ( accounts.deleted IS NULL OR accounts.deleted=0 )\n                      AND contacts.deleted=0 ";
115
-		$actual = $contact->create_export_query('contacts.id','contacts.name=""');
116
-		$this->assertSame($expected,$actual);
115
+		$actual = $contact->create_export_query('contacts.id', 'contacts.name=""');
116
+		$this->assertSame($expected, $actual);
117 117
 
118 118
 	}
119 119
 
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
 
131 131
 		$contact->fill_in_additional_list_fields();
132 132
 
133
-		$this->assertEquals("firstn lastn",$contact->full_name);
134
-		$this->assertEquals("firstn lastn &lt;[email protected]&gt;",$contact->email_and_name1);
135
-		$this->assertEquals("firstn lastn &lt;[email protected]&gt;",$contact->email_and_name2);
133
+		$this->assertEquals("firstn lastn", $contact->full_name);
134
+		$this->assertEquals("firstn lastn &lt;[email protected]&gt;", $contact->email_and_name1);
135
+		$this->assertEquals("firstn lastn &lt;[email protected]&gt;", $contact->email_and_name2);
136 136
 
137 137
 	}
138 138
 
@@ -145,14 +145,14 @@  discard block
 block discarded – undo
145 145
 
146 146
 		$contact->fill_in_additional_detail_fields();
147 147
 
148
-		$this->assertEquals("",$contact->account_name);
149
-		$this->assertEquals("",$contact->account_id);
150
-		$this->assertEquals("",$contact->report_to_name);
148
+		$this->assertEquals("", $contact->account_name);
149
+		$this->assertEquals("", $contact->account_id);
150
+		$this->assertEquals("", $contact->report_to_name);
151 151
 
152 152
 	}
153 153
 
154 154
 
155
-	public function testload_contacts_users_relationship(){
155
+	public function testload_contacts_users_relationship() {
156 156
 
157 157
 		$contact = new Contact();
158 158
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 		$contact->first_name = "first";
176 176
 		$contact->last_name = "last";
177 177
 
178
-		$expected = array (
178
+		$expected = array(
179 179
 					  'NAME' => 'first last',
180 180
 					  'DELETED' => 0,
181 181
 					  'FIRST_NAME' => 'first',
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	}
202 202
 
203 203
 
204
-	public function testbuild_generic_where_clause ()
204
+	public function testbuild_generic_where_clause()
205 205
 	{
206 206
 
207 207
 		$contact = new Contact();
@@ -209,13 +209,13 @@  discard block
 block discarded – undo
209 209
 		//test with string
210 210
 		$expected = "contacts.last_name like 'test%' or contacts.first_name like 'test%' or accounts.name like 'test%' or contacts.assistant like 'test%' or ea.email_address like 'test%'";
211 211
 		$actual = $contact->build_generic_where_clause('test');
212
-		$this->assertSame($expected,$actual);
212
+		$this->assertSame($expected, $actual);
213 213
 
214 214
 
215 215
 		//test with number
216 216
 		$expected = "contacts.last_name like '1%' or contacts.first_name like '1%' or accounts.name like '1%' or contacts.assistant like '1%' or ea.email_address like '1%' or contacts.phone_home like '%1%' or contacts.phone_mobile like '%1%' or contacts.phone_work like '%1%' or contacts.phone_other like '%1%' or contacts.phone_fax like '%1%' or contacts.assistant_phone like '%1%'";
217 217
 		$actual = $contact->build_generic_where_clause(1);
218
-		$this->assertSame($expected,$actual);
218
+		$this->assertSame($expected, $actual);
219 219
 
220 220
 	}
221 221
 
@@ -231,8 +231,8 @@  discard block
 block discarded – undo
231 231
 
232 232
 		$result = $contact->set_notification_body(new Sugar_Smarty(), $contact);
233 233
 
234
-		$this->assertEquals($contact->full_name ,$result->_tpl_vars['CONTACT_NAME']);
235
-		$this->assertEquals($contact->description ,$result->_tpl_vars['CONTACT_DESCRIPTION']);
234
+		$this->assertEquals($contact->full_name, $result->_tpl_vars['CONTACT_NAME']);
235
+		$this->assertEquals($contact->description, $result->_tpl_vars['CONTACT_DESCRIPTION']);
236 236
 
237 237
 	}
238 238
 
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 		$contact = new Contact();
242 242
 
243 243
 		$result = $contact->get_contact_id_by_email("");
244
-		$this->assertEquals(null,$result);
244
+		$this->assertEquals(null, $result);
245 245
 
246 246
 
247 247
 		//$result = $contact->get_contact_id_by_email("[email protected]");
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 		//execute the method and verify that it retunrs expected results
283 283
 		$expected = "SELECT emails.id FROM emails  JOIN (select DISTINCT email_id from emails_email_addr_rel eear\n\n	join email_addr_bean_rel eabr on eabr.bean_id ='' and eabr.bean_module = 'Contacts' and\n	eabr.email_address_id = eear.email_address_id and eabr.deleted=0\n	where eear.deleted=0 and eear.email_id not in\n	(select eb.email_id from emails_beans eb where eb.bean_module ='Contacts' and eb.bean_id = '')\n	) derivedemails on derivedemails.email_id = emails.id";
284 284
 		$actual = $contact->get_unlinked_email_query();
285
-		$this->assertSame($expected,$actual);
285
+		$this->assertSame($expected, $actual);
286 286
 
287 287
 	}
288 288
 
Please login to merge, or discard this patch.
include/Smarty/plugins/modifier.spacify.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
 function smarty_modifier_spacify($string, $spacify_char = ' ')
23 23
 {
24 24
     return implode($spacify_char,
25
-                   preg_split('//', $string, -1, PREG_SPLIT_NO_EMPTY));
25
+                    preg_split('//', $string, -1, PREG_SPLIT_NO_EMPTY));
26 26
 }
27 27
 
28 28
 /* vim: set expandtab: */
Please login to merge, or discard this patch.
modules/AOR_Reports/metadata/searchdefs.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -22,21 +22,21 @@
 block discarded – undo
22 22
  * @author SalesAgility <[email protected]>
23 23
  */
24 24
  
25
-  $searchdefs['AOR_Reports'] = array(
26
-					'templateMeta' => array(
27
-							'maxColumns' => '3',
28
-  							'maxColumnsBasic' => '4', 
25
+    $searchdefs['AOR_Reports'] = array(
26
+                    'templateMeta' => array(
27
+                            'maxColumns' => '3',
28
+                                'maxColumnsBasic' => '4', 
29 29
                             'widths' => array('label' => '10', 'field' => '30'),                 
30
-                           ),
30
+                            ),
31 31
                     'layout' => array(  					
32
-						'basic_search' => array(
33
-							'name', 
34
-							array('name'=>'current_user_only', 'label'=>'LBL_CURRENT_USER_FILTER', 'type'=>'bool'),
35
-							),
36
-						'advanced_search' => array(
37
-							'name', 
38
-							array('name' => 'assigned_user_id', 'label' => 'LBL_ASSIGNED_TO', 'type' => 'enum', 'function' => array('name' => 'get_user_array', 'params' => array(false))),
39
-						),
40
-					),
41
- 			   );
32
+                        'basic_search' => array(
33
+                            'name', 
34
+                            array('name'=>'current_user_only', 'label'=>'LBL_CURRENT_USER_FILTER', 'type'=>'bool'),
35
+                            ),
36
+                        'advanced_search' => array(
37
+                            'name', 
38
+                            array('name' => 'assigned_user_id', 'label' => 'LBL_ASSIGNED_TO', 'type' => 'enum', 'function' => array('name' => 'get_user_array', 'params' => array(false))),
39
+                        ),
40
+                    ),
41
+                );
42 42
 ?>
Please login to merge, or discard this patch.