Test Failed
Push — CI ( 0f01dd...c95a04 )
by Adam
55:13
created
modules/ModuleBuilder/parsers/parser.modifylistview.php 1 patch
Braces   +22 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (! defined ( 'sugarEntry' ) || ! sugarEntry)
3
-die ( 'Not A Valid Entry Point' ) ;
2
+if (! defined ( 'sugarEntry' ) || ! sugarEntry) {
3
+    die ( 'Not A Valid Entry Point' ) ;
4
+}
4 5
 /*********************************************************************************
5 6
  * SugarCRM Community Edition is a customer relationship management program developed by
6 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -121,8 +122,7 @@  discard block
 block discarded – undo
121 122
 			    if (! isset($def['studio']) || $def['studio'] === true)
122 123
 			    {
123 124
 			        $this->defaults [ $key ] = $def ;
124
-			    }
125
-			    else
125
+			    } else
126 126
 			    // anything which doesn't go into the defaults is a reserved field - this makes sure we don't miss anything
127 127
 			    {
128 128
 			        $this->reserved [ $key ] = $def;
@@ -167,13 +167,16 @@  discard block
 block discarded – undo
167 167
 		foreach ( $modFields as $key => $def )
168 168
 		{
169 169
 			$fieldName = strtolower ( $key ) ;
170
-            if ($fieldName == 'currency_id')
171
-                continue;
172
-			if (!isset ( $lowerFieldList [ $fieldName ] )) // bug 16728 - check this first, so that other conditions (e.g., studio == visible) can't override and add duplicate entries
170
+            if ($fieldName == 'currency_id') {
171
+                            continue;
172
+            }
173
+			if (!isset ( $lowerFieldList [ $fieldName ] )) {
174
+			    // bug 16728 - check this first, so that other conditions (e.g., studio == visible) can't override and add duplicate entries
173 175
 			{
174 176
             // bug 19656: this test changed after 5.0.0b - we now remove all ID type fields - whether set as type, or dbtype, from the fielddefs
175 177
             if ($this->isValidField($key, $def)){
176 178
 					$label = (isset ( $def [ 'vname' ] )) ? $def [ 'vname' ] : (isset($def [ 'label' ]) ? $def['label'] : $def['name']) ;
179
+			}
177 180
 					$this->availableFields [ $fieldName ] = array ( 'width' => '10' , 'label' => $label ) ;
178 181
 				}
179 182
 			}
@@ -190,20 +193,24 @@  discard block
 block discarded – undo
190 193
 	
191 194
 	function isValidField($key, $def) {
192 195
 	    //Allow fields that are studio visible  
193
-		if (! empty ( $def [ 'studio' ] ) && $def [ 'studio' ] == 'visible')
194
-		  return true;
196
+		if (! empty ( $def [ 'studio' ] ) && $def [ 'studio' ] == 'visible') {
197
+				  return true;
198
+		}
195 199
 		  
196 200
 		//No ID fields
197
-		if  ((!empty ( $def [ 'dbType' ] ) && $def [ 'dbType' ] == 'id') || (!empty ( $def [ 'type' ] ) && $def [ 'type' ] == 'id'))
198
-		  return false;
201
+		if  ((!empty ( $def [ 'dbType' ] ) && $def [ 'dbType' ] == 'id') || (!empty ( $def [ 'type' ] ) && $def [ 'type' ] == 'id')) {
202
+				  return false;
203
+		}
199 204
 		  
200 205
 		//only allow DB and custom fields (if a source is specified)
201
-	    if (!empty($def [ 'source' ]) && $def [ 'source' ] != 'db' && $def [ 'source' ] != 'custom_fields')
202
-		  return false;
206
+	    if (!empty($def [ 'source' ]) && $def [ 'source' ] != 'db' && $def [ 'source' ] != 'custom_fields') {
207
+	    		  return false;
208
+	    }
203 209
 
204 210
 		//Dont ever show the "deleted" fields or "_name" fields
205
-		if (strcmp ( $key, 'deleted' ) == 0 || (isset ( $def [ 'name' ] ) && strpos ( $def [ 'name' ], "_name" ) !== false))
206
-	       return false;
211
+		if (strcmp ( $key, 'deleted' ) == 0 || (isset ( $def [ 'name' ] ) && strpos ( $def [ 'name' ], "_name" ) !== false)) {
212
+			       return false;
213
+		}
207 214
 
208 215
 	    //If none of the "ifs" are true, the field is valid
209 216
 	    return true;
Please login to merge, or discard this patch.
modules/AOR_Fields/AOR_Field.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -94,11 +94,9 @@
 block discarded – undo
94 94
 
95 95
                             $field->$field_def['name'] = $post_data[$key . $field_def['name']][$i];
96 96
                         }
97
-                    }
98
-                    else if(is_null($post_data[$key.$field_def['name']])) {
97
+                    } else if(is_null($post_data[$key.$field_def['name']])) {
99 98
                         // do nothing
100
-                    }
101
-                    else {
99
+                    } else {
102 100
                         throw new Exception('illegal type in post data at key ' . $key.$field_def['name'] . ' ' . gettype($post_data[$key.$field_def['name']]));
103 101
                     }
104 102
 
Please login to merge, or discard this patch.
modules/Reminders_Invitees/Reminder_Invitee.php 1 patch
Braces   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -76,7 +76,9 @@  discard block
 block discarded – undo
76 76
     public static function saveRemindersInviteesData($reminderId, $inviteesData) {
77 77
         $savedInviteeIds = array();
78 78
         foreach($inviteesData as $k => $inviteeData) {
79
-            if(isset($_POST['isDuplicate']) && $_POST['isDuplicate']) $inviteeData->id = '';
79
+            if(isset($_POST['isDuplicate']) && $_POST['isDuplicate']) {
80
+                $inviteeData->id = '';
81
+            }
80 82
             $reminderInviteeBean = BeanFactory::getBean('Reminders_Invitees', $inviteeData->id);
81 83
             $reminderInviteeBean->reminder_id = $reminderId;
82 84
             $reminderInviteeBean->related_invitee_module = $inviteeData->module;
@@ -84,8 +86,7 @@  discard block
 block discarded – undo
84 86
             if(!$inviteeData->id) {
85 87
                 $reminderInviteeBean->save();
86 88
                 $savedInviteeIds[] = $reminderInviteeBean->id;
87
-            }
88
-            else {
89
+            } else {
89 90
                 $addedInvitees = BeanFactory::getBean('Reminders_Invitees')->get_full_list("", "reminders_invitees.id != '{$inviteeData->id}' AND reminders_invitees.reminder_id = '{$reminderInviteeBean->reminder_id}' AND reminders_invitees.related_invitee_module = '{$reminderInviteeBean->related_invitee_module}' AND reminders_invitees.related_invitee_module_id = '{$reminderInviteeBean->related_invitee_module_id}'");
90 91
                 if (!$addedInvitees) {
91 92
                     $reminderInviteeBean->save();
@@ -132,11 +133,9 @@  discard block
 block discarded – undo
132 133
             default:
133 134
                 if(isset($bean->first_name) && isset($bean->last_name)) {
134 135
                     $retValue = "{$bean->first_name} {$bean->last_name}";
135
-                }
136
-                else if(isset($bean->name)) {
136
+                } else if(isset($bean->name)) {
137 137
                     $retValue = $bean->name;
138
-                }
139
-                else if(isset($bean->email)) {
138
+                } else if(isset($bean->email)) {
140 139
                     $retValue = $bean->email;
141 140
                 }
142 141
                 if(!$retValue) {
Please login to merge, or discard this patch.
modules/AOP_Case_Updates/Case_Updates.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
         $bDate = $b->fetched_row['date_entered'];
160 160
         if($aDate < $bDate){
161 161
             return -1;
162
-        }elseif($aDate > $bDate){
162
+        } elseif($aDate > $bDate){
163 163
             return 1;
164 164
         }
165 165
         return 0;
@@ -195,9 +195,9 @@  discard block
 block discarded – undo
195 195
     global $mod_strings;
196 196
     if($update->contact_id){
197 197
         $name = $update->getUpdateContact()->name;
198
-    }elseif($update->assigned_user_id){
198
+    } elseif($update->assigned_user_id){
199 199
         $name = $update->getUpdateUser()->name;
200
-    }else{
200
+    } else{
201 201
         $name = "Unknown";
202 202
     }
203 203
     $html = "<a href='' onclick='toggleCaseUpdate(\"".$update->id."\");return false;'>";
@@ -281,7 +281,9 @@  discard block
 block discarded – undo
281 281
     global $action;
282 282
 
283 283
     //on DetailView only
284
-    if($action != 'DetailView') return;
284
+    if($action != 'DetailView') {
285
+        return;
286
+    }
285 287
 
286 288
     //current record id
287 289
     $record = $_GET['record'];
Please login to merge, or discard this patch.
modules/AOP_Case_Updates/AOP_Case_Updates.php 1 patch
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
                     $res = $this->sendEmail($emails, $email_template, $signature, $this->case_id, $addDelimiter, $contact->id);
67 67
                 }
68 68
             }
69
-        }else{
69
+        } else{
70 70
             $emails = $this->getEmailForUser();
71 71
             if($aop_config['user_email_template_id']){
72 72
                 $email_template = $email_template->retrieve($aop_config['user_email_template_id']);
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
             $emailObj->created_by = '1';
191 191
             $emailObj->status = 'sent';
192 192
             $emailObj->save();
193
-        }else{
193
+        } else{
194 194
             $GLOBALS['log']->info("AOPCaseUpdates: Could not send email:  " . $mailer->ErrorInfo);
195 195
             return false;
196 196
         }
Please login to merge, or discard this patch.
modules/AOP_Case_Updates/CaseUpdatesHook.php 1 patch
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
         }
285 285
         if($bean->state!= "Closed" || $bean->fetched_row['state'] == "Closed"){
286 286
             $bean->send_closure_email = false;
287
-        }else{
287
+        } else{
288 288
             $bean->send_closure_email = true;
289 289
         }
290 290
 
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
         $contact = $bean->get_linked_beans("contacts","Contact");
327 327
         if($contact){
328 328
             $contact = $contact[0];
329
-        }else{
329
+        } else{
330 330
             return false;
331 331
         }
332 332
 
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
         if (!$mailer->Send()){
347 347
             $GLOBALS['log']->info("CaseUpdatesHook: Could not send email:  " . $mailer->ErrorInfo);
348 348
             return false;
349
-        }else{
349
+        } else{
350 350
             $this->logEmail($email, $mailer, $bean->id);
351 351
             return true;
352 352
         }
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
         }
372 372
         if(!empty($arguments['related_bean'])){
373 373
             $contact = $arguments['related_bean'];
374
-        }else{
374
+        } else{
375 375
             $contact = BeanFactory::getBean("Contacts",$arguments['related_id']);
376 376
         }
377 377
         $this->sendCreationEmail($bean, $contact);
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
         if (!$mailer->Send()){
438 438
             $GLOBALS['log']->info("CaseUpdatesHook: Could not send email:  " . $mailer->ErrorInfo);
439 439
             return false;
440
-        }else{
440
+        } else{
441 441
             $this->logEmail($email, $mailer, $bean->id);
442 442
             return true;
443 443
         }
Please login to merge, or discard this patch.
modules/AOP_Case_Updates/AOPAssignManager.php 1 patch
Braces   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
         $this->ieX = $ieX;
11 11
         if($ieX) {
12 12
             $inboundDistribMethod = $ieX->get_stored_options("distrib_method", "");
13
-        }else{
13
+        } else{
14 14
             $inboundDistribMethod = '';
15 15
         }
16 16
         if($this->isAOPFallback($inboundDistribMethod)){
17 17
             $this->distributionMethod = $sugar_config['aop']['distribution_method'];
18 18
             $this->aopFallback = true;
19
-        }else{
19
+        } else{
20 20
             $this->distributionMethod = $inboundDistribMethod;
21 21
             $this->aopFallback = false;
22 22
         }
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
         global $sugar_config;
32 32
         if($this->aopFallback){
33 33
             return $sugar_config['aop']['distribution_options'];
34
-        }else{
34
+        } else{
35 35
             return $this->ieX->get_stored_options("distribution_options", '');
36 36
         }
37 37
     }
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         }
98 98
         if($this->aopFallback){
99 99
             $this->singleUser = !empty($sugar_config['aop']['distribution_user_id']) ? $sugar_config['aop']['distribution_user_id'] : '';
100
-        }else{
100
+        } else{
101 101
             $this->singleUser = $this->ieX->get_stored_options("distribution_user_id", "");
102 102
         }
103 103
         return $this->singleUser;
@@ -166,8 +166,7 @@  discard block
 block discarded – undo
166 166
         $file = create_cache_directory('modules/AOP_Case_Updates/Users/') . $id . 'lastUser.cache.php';
167 167
         if(isset($_SESSION['AOPlastuser'][$id]) && $_SESSION['AOPlastuser'][$id] != '') {
168 168
             $lastUserId = $_SESSION['AOPlastuser'][$id];
169
-        }
170
-        else if (is_file($file)){
169
+        } else if (is_file($file)){
171 170
             include $file;
172 171
             if(isset($lastUser['User']) && $lastUser['User'] != '') {
173 172
                 $lastUserId = $lastUser['User'];
Please login to merge, or discard this patch.
modules/SchedulersJobs/SchedulersJob.php 1 patch
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -573,12 +575,10 @@  discard block
 block discarded – undo
573 575
                 } else {
574 576
                     return $this->resolution != self::JOB_FAILURE;
575 577
                 }
576
-            }
577
-            else {
578
+            } else {
578 579
                 $this->resolveJob(self::JOB_FAILURE, sprintf(translate('ERR_JOBTYPE', 'SchedulersJobs'), strip_tags($this->target)));
579 580
             }
580
-        }
581
-        else {
581
+        } else {
582 582
 		    $this->resolveJob(self::JOB_FAILURE, sprintf(translate('ERR_JOBTYPE', 'SchedulersJobs'), strip_tags($this->target)));
583 583
 		}
584 584
 		return false;
Please login to merge, or discard this patch.
modules/Import/ImportFieldSanitize.php 1 patch
Braces   +56 added lines, -39 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 
4 6
 /*********************************************************************************
5 7
  * SugarCRM Community Edition is a customer relationship management program developed by
@@ -93,14 +95,16 @@  discard block
 block discarded – undo
93 95
         }
94 96
         $value = $params[0];
95 97
         $vardef = $params[1];
96
-        if ( isset($params[2]) )
97
-            $focus = $params[2];
98
-        else
99
-            $focus = null;
100
-        if ( $name == 'relate' && !empty($params[3]) )
101
-            $this->addRelatedBean = true;
102
-        else
103
-            $this->addRelatedBean = false;
98
+        if ( isset($params[2]) ) {
99
+                    $focus = $params[2];
100
+        } else {
101
+                    $focus = null;
102
+        }
103
+        if ( $name == 'relate' && !empty($params[3]) ) {
104
+                    $this->addRelatedBean = true;
105
+        } else {
106
+                    $this->addRelatedBean = false;
107
+        }
104 108
         
105 109
         $field = $sfh->getSugarField(ucfirst($name));
106 110
         if ( $field instanceOf SugarFieldBase ) {
@@ -128,11 +132,13 @@  discard block
 block discarded – undo
128 132
 
129 133
         $format = $this->dateformat;
130 134
 
131
-        if ( !$timedate->check_matching_format($value, $format) )
132
-            return false;
135
+        if ( !$timedate->check_matching_format($value, $format) ) {
136
+                    return false;
137
+        }
133 138
 
134
-        if ( !$this->isValidTimeDate($value, $format) )
135
-            return false;
139
+        if ( !$this->isValidTimeDate($value, $format) ) {
140
+                    return false;
141
+        }
136 142
 
137 143
         $value = $timedate->swap_formats(
138 144
             $value, $format, $timedate->get_date_format());
@@ -199,8 +205,7 @@  discard block
 block discarded – undo
199 205
                         || $focus_user->retrieve($eachItem)
200 206
                 ) {
201 207
                     // all good
202
-                }
203
-                else {
208
+                } else {
204 209
                     $isValid     = false;
205 210
                     $bad_names[] = $eachItem;
206 211
                     continue;
@@ -232,11 +237,13 @@  discard block
 block discarded – undo
232 237
 
233 238
         $format = $this->timeformat;
234 239
 
235
-        if ( !$timedate->check_matching_format($value, $format) )
236
-            return false;
240
+        if ( !$timedate->check_matching_format($value, $format) ) {
241
+                    return false;
242
+        }
237 243
 
238
-        if ( !$this->isValidTimeDate($value, $format) )
239
-            return false;
244
+        if ( !$this->isValidTimeDate($value, $format) ) {
245
+                    return false;
246
+        }
240 247
 
241 248
         $value = $timedate->swap_formats(
242 249
             $value, $format, $timedate->get_time_format());
@@ -266,47 +273,57 @@  discard block
 block discarded – undo
266 273
         $reg = $timedate->get_regular_expression($format);
267 274
         preg_match('@'.$reg['format'].'@', $value, $dateparts);
268 275
 
269
-        if ( empty($dateparts) )
270
-            return false;
276
+        if ( empty($dateparts) ) {
277
+                    return false;
278
+        }
271 279
         if ( isset($reg['positions']['a'])
272
-                && !in_array($dateparts[$reg['positions']['a']], array('am','pm')) )
273
-            return false;
280
+                && !in_array($dateparts[$reg['positions']['a']], array('am','pm')) ) {
281
+                    return false;
282
+        }
274 283
         if ( isset($reg['positions']['A'])
275
-                && !in_array($dateparts[$reg['positions']['A']], array('AM','PM')) )
276
-            return false;
284
+                && !in_array($dateparts[$reg['positions']['A']], array('AM','PM')) ) {
285
+                    return false;
286
+        }
277 287
         if ( isset($reg['positions']['h']) && (
278 288
                 !is_numeric($dateparts[$reg['positions']['h']])
279 289
                 || $dateparts[$reg['positions']['h']] < 1
280
-                || $dateparts[$reg['positions']['h']] > 12 ) )
281
-            return false;
290
+                || $dateparts[$reg['positions']['h']] > 12 ) ) {
291
+                    return false;
292
+        }
282 293
         if ( isset($reg['positions']['H']) && (
283 294
                 !is_numeric($dateparts[$reg['positions']['H']])
284 295
                 || $dateparts[$reg['positions']['H']] < 0
285
-                || $dateparts[$reg['positions']['H']] > 23 ) )
286
-            return false;
296
+                || $dateparts[$reg['positions']['H']] > 23 ) ) {
297
+                    return false;
298
+        }
287 299
         if ( isset($reg['positions']['i']) && (
288 300
                 !is_numeric($dateparts[$reg['positions']['i']])
289 301
                 || $dateparts[$reg['positions']['i']] < 0
290
-                || $dateparts[$reg['positions']['i']] > 59 ) )
291
-            return false;
302
+                || $dateparts[$reg['positions']['i']] > 59 ) ) {
303
+                    return false;
304
+        }
292 305
         if ( isset($reg['positions']['s']) && (
293 306
                 !is_numeric($dateparts[$reg['positions']['s']])
294 307
                 || $dateparts[$reg['positions']['s']] < 0
295
-                || $dateparts[$reg['positions']['s']] > 59 ) )
296
-            return false;
308
+                || $dateparts[$reg['positions']['s']] > 59 ) ) {
309
+                    return false;
310
+        }
297 311
         if ( isset($reg['positions']['d']) && (
298 312
                 !is_numeric($dateparts[$reg['positions']['d']])
299 313
                 || $dateparts[$reg['positions']['d']] < 1
300
-                || $dateparts[$reg['positions']['d']] > 31 ) )
301
-            return false;
314
+                || $dateparts[$reg['positions']['d']] > 31 ) ) {
315
+                    return false;
316
+        }
302 317
         if ( isset($reg['positions']['m']) && (
303 318
                 !is_numeric($dateparts[$reg['positions']['m']])
304 319
                 || $dateparts[$reg['positions']['m']] < 1
305
-                || $dateparts[$reg['positions']['m']] > 12 ) )
306
-            return false;
320
+                || $dateparts[$reg['positions']['m']] > 12 ) ) {
321
+                    return false;
322
+        }
307 323
         if ( isset($reg['positions']['Y']) &&
308
-                !is_numeric($dateparts[$reg['positions']['Y']]) )
309
-            return false;
324
+                !is_numeric($dateparts[$reg['positions']['Y']]) ) {
325
+                    return false;
326
+        }
310 327
 
311 328
         return true;
312 329
     }
Please login to merge, or discard this patch.