@@ -1,6 +1,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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; |
@@ -76,7 +76,9 @@ discard block |
||
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 |
||
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 |
||
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) { |
@@ -159,7 +159,7 @@ discard block |
||
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 |
||
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 |
||
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']; |
@@ -10,13 +10,13 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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']; |
@@ -1,5 +1,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -1,5 +1,7 @@ discard block |
||
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. |
@@ -227,7 +229,9 @@ discard block |
||
227 | 229 | |
228 | 230 | // Bug 23354 - Make sure enclosure gets saved as an empty string if |
229 | 231 | // it is an empty string, instead of as a null |
230 | - if ( strlen($enclosure) <= 0 ) $enclosure = ' '; |
|
232 | + if ( strlen($enclosure) <= 0 ) { |
|
233 | + $enclosure = ' '; |
|
234 | + } |
|
231 | 235 | |
232 | 236 | $this->assigned_user_id = $owner_id; |
233 | 237 | $this->name = $name; |
@@ -266,8 +270,9 @@ discard block |
||
266 | 270 | $other_map = new ImportMap(); |
267 | 271 | $other_map->retrieve_by_string_fields(array('id'=> $id), false); |
268 | 272 | |
269 | - if ( $other_map->assigned_user_id != $current_user->id ) |
|
270 | - return false; |
|
273 | + if ( $other_map->assigned_user_id != $current_user->id ) { |
|
274 | + return false; |
|
275 | + } |
|
271 | 276 | } |
272 | 277 | |
273 | 278 | return parent::mark_deleted($id); |
@@ -287,8 +292,9 @@ discard block |
||
287 | 292 | { |
288 | 293 | global $current_user; |
289 | 294 | |
290 | - if ( !is_admin($current_user) ) |
|
291 | - return false; |
|
295 | + if ( !is_admin($current_user) ) { |
|
296 | + return false; |
|
297 | + } |
|
292 | 298 | |
293 | 299 | // check for problems |
294 | 300 | if ($flag) { |
@@ -299,8 +305,7 @@ discard block |
||
299 | 305 | 'name' =>$this->name, |
300 | 306 | 'is_published' =>'yes' |
301 | 307 | ); |
302 | - } |
|
303 | - else { |
|
308 | + } else { |
|
304 | 309 | // if you are trying to unpublish a map |
305 | 310 | // but you own an unpublished map by the same name |
306 | 311 | $query_arr = array( |
@@ -313,8 +318,9 @@ discard block |
||
313 | 318 | $other_map->retrieve_by_string_fields($query_arr, false); |
314 | 319 | |
315 | 320 | // if we find this other map, quit |
316 | - if ( isset($other_map->id) ) |
|
317 | - return false; |
|
321 | + if ( isset($other_map->id) ) { |
|
322 | + return false; |
|
323 | + } |
|
318 | 324 | |
319 | 325 | // otherwise update the is_published flag |
320 | 326 | $query = "UPDATE $this->table_name |
@@ -1,5 +1,7 @@ discard block |
||
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 |
@@ -83,18 +85,20 @@ discard block |
||
83 | 85 | $indexes = array_merge($custmIndexes,$indexes); |
84 | 86 | } |
85 | 87 | |
86 | - if ( $this->_focus->getFieldDefinition('email1') ) |
|
87 | - $indexes[] = array( |
|
88 | + if ( $this->_focus->getFieldDefinition('email1') ) { |
|
89 | + $indexes[] = array( |
|
88 | 90 | 'name' => 'special_idx_email1', |
89 | 91 | 'type' => 'index', |
90 | 92 | 'fields' => array('email1') |
91 | 93 | ); |
92 | - if ( $this->_focus->getFieldDefinition('email2') ) |
|
93 | - $indexes[] = array( |
|
94 | + } |
|
95 | + if ( $this->_focus->getFieldDefinition('email2') ) { |
|
96 | + $indexes[] = array( |
|
94 | 97 | 'name' => 'special_idx_email2', |
95 | 98 | 'type' => 'index', |
96 | 99 | 'fields' => array('email2') |
97 | 100 | ); |
101 | + } |
|
98 | 102 | |
99 | 103 | return $indexes; |
100 | 104 | } |
@@ -116,12 +120,15 @@ discard block |
||
116 | 120 | if ($index['type'] == "index"){ |
117 | 121 | $labelsArray = array(); |
118 | 122 | foreach ($index['fields'] as $field){ |
119 | - if ($field == 'deleted') continue; |
|
123 | + if ($field == 'deleted') { |
|
124 | + continue; |
|
125 | + } |
|
120 | 126 | $fieldDef = $this->_focus->getFieldDefinition($field); |
121 | - if ( isset($fieldDef['vname']) && isset($super_language_pack[$fieldDef['vname']]) ) |
|
122 | - $labelsArray[$fieldDef['name']] = $super_language_pack[$fieldDef['vname']]; |
|
123 | - else |
|
124 | - $labelsArray[$fieldDef['name']] = $fieldDef['name']; |
|
127 | + if ( isset($fieldDef['vname']) && isset($super_language_pack[$fieldDef['vname']]) ) { |
|
128 | + $labelsArray[$fieldDef['name']] = $super_language_pack[$fieldDef['vname']]; |
|
129 | + } else { |
|
130 | + $labelsArray[$fieldDef['name']] = $fieldDef['name']; |
|
131 | + } |
|
125 | 132 | } |
126 | 133 | $index_array[$index['name']] = str_replace(":", "",implode(", ",$labelsArray)); |
127 | 134 | } |
@@ -144,33 +151,37 @@ discard block |
||
144 | 151 | { |
145 | 152 | $emailAddress = new SugarEmailAddress(); |
146 | 153 | $email = $field; |
147 | - if ( $emailAddress->getCountEmailAddressByBean($this->_focus->$email,$this->_focus,($field == 'email1')) > 0 ) |
|
148 | - return true; |
|
149 | - } |
|
150 | - else |
|
154 | + if ( $emailAddress->getCountEmailAddressByBean($this->_focus->$email,$this->_focus,($field == 'email1')) > 0 ) { |
|
155 | + return true; |
|
156 | + } |
|
157 | + } else |
|
151 | 158 | { |
152 | 159 | $index_fields = array('deleted' => '0'); |
153 | 160 | if( is_array($field) ) |
154 | 161 | { |
155 | 162 | foreach($field as $tmpField) |
156 | 163 | { |
157 | - if ($tmpField == 'deleted') |
|
158 | - continue; |
|
159 | - if (strlen($this->_focus->$tmpField) > 0) |
|
160 | - $index_fields[$tmpField] = $this->_focus->$tmpField; |
|
164 | + if ($tmpField == 'deleted') { |
|
165 | + continue; |
|
166 | + } |
|
167 | + if (strlen($this->_focus->$tmpField) > 0) { |
|
168 | + $index_fields[$tmpField] = $this->_focus->$tmpField; |
|
169 | + } |
|
161 | 170 | } |
171 | + } elseif($field != 'deleted' && strlen($this->_focus->$field) > 0) { |
|
172 | + $index_fields[$field] = $this->_focus->$field; |
|
162 | 173 | } |
163 | - elseif($field != 'deleted' && strlen($this->_focus->$field) > 0) |
|
164 | - $index_fields[$field] = $this->_focus->$field; |
|
165 | 174 | |
166 | - if ( count($index_fields) <= 1 ) |
|
167 | - continue; |
|
175 | + if ( count($index_fields) <= 1 ) { |
|
176 | + continue; |
|
177 | + } |
|
168 | 178 | |
169 | 179 | $newfocus = loadBean($this->_focus->module_dir); |
170 | 180 | $result = $newfocus->retrieve_by_string_fields($index_fields,true); |
171 | 181 | |
172 | - if ( !is_null($result) ) |
|
173 | - return true; |
|
182 | + if ( !is_null($result) ) { |
|
183 | + return true; |
|
184 | + } |
|
174 | 185 | } |
175 | 186 | } |
176 | 187 | |
@@ -204,13 +215,15 @@ discard block |
||
204 | 215 | $fieldlist=array(); |
205 | 216 | $customIndexlist=array(); |
206 | 217 | foreach($origIndexList as $iv){ |
207 | - if(empty($iv)) continue; |
|
218 | + if(empty($iv)) { |
|
219 | + continue; |
|
220 | + } |
|
208 | 221 | $field_index_array = explode('::',$iv); |
209 | 222 | if($field_index_array[0] == 'customfield'){ |
210 | 223 | //this is a custom field, so place in custom array |
211 | 224 | $customIndexlist[] = $field_index_array[1]; |
212 | 225 | |
213 | - }else{ |
|
226 | + } else{ |
|
214 | 227 | //this is not a custom field, so place in index list |
215 | 228 | $indexlist[] = $field_index_array[0]; |
216 | 229 | if(isset($field_index_array[1])) { |
@@ -237,8 +250,9 @@ discard block |
||
237 | 250 | // loop through var def indexes and compare with selected indexes |
238 | 251 | foreach ($this->_getIndexVardefs() as $index){ |
239 | 252 | // if we get an index not in the indexlist, loop |
240 | - if ( !in_array($index['name'],$indexlist) ) |
|
241 | - continue; |
|
253 | + if ( !in_array($index['name'],$indexlist) ) { |
|
254 | + continue; |
|
255 | + } |
|
242 | 256 | |
243 | 257 | // This handles the special case of duplicate email checking |
244 | 258 | if ( $index['name'] == 'special_idx_email1' || $index['name'] == 'special_idx_email2' ) { |
@@ -249,31 +263,35 @@ discard block |
||
249 | 263 | $this->_focus, |
250 | 264 | ($index['name'] == 'special_idx_email1') |
251 | 265 | ) > 0 ){ foreach($index['fields'] as $field){ |
252 | - if($field !='deleted') |
|
253 | - $this->_dupedFields[] = $field; |
|
266 | + if($field !='deleted') { |
|
267 | + $this->_dupedFields[] = $field; |
|
268 | + } |
|
254 | 269 | } |
255 | 270 | } |
256 | 271 | } |
257 | 272 | // Adds a hook so you can define a method in the bean to handle dupe checking |
258 | 273 | elseif ( isset($index['dupeCheckFunction']) ) { |
259 | 274 | $functionName = substr_replace($index['dupeCheckFunction'],'',0,9); |
260 | - if ( method_exists($this->_focus,$functionName) && $this->_focus->$functionName($index) === true) |
|
261 | - return $this->_focus->$functionName($index); |
|
262 | - } |
|
263 | - else { |
|
275 | + if ( method_exists($this->_focus,$functionName) && $this->_focus->$functionName($index) === true) { |
|
276 | + return $this->_focus->$functionName($index); |
|
277 | + } |
|
278 | + } else { |
|
264 | 279 | $index_fields = array('deleted' => '0'); |
265 | 280 | //search only for the field we have selected |
266 | 281 | foreach($index['fields'] as $field){ |
267 | - if ($field == 'deleted' || !in_array($field,$fieldlist)) |
|
268 | - continue; |
|
269 | - if (!in_array($field,$index_fields)) |
|
270 | - if (isset($this->_focus->$field) && strlen($this->_focus->$field) > 0) |
|
282 | + if ($field == 'deleted' || !in_array($field,$fieldlist)) { |
|
283 | + continue; |
|
284 | + } |
|
285 | + if (!in_array($field,$index_fields)) { |
|
286 | + if (isset($this->_focus->$field) && strlen($this->_focus->$field) > 0) |
|
271 | 287 | $index_fields[$field] = $this->_focus->$field; |
288 | + } |
|
272 | 289 | } |
273 | 290 | |
274 | 291 | // if there are no valid fields in the index field list, loop |
275 | - if ( count($index_fields) <= 1 ) |
|
276 | - continue; |
|
292 | + if ( count($index_fields) <= 1 ) { |
|
293 | + continue; |
|
294 | + } |
|
277 | 295 | |
278 | 296 | $newfocus = loadBean($this->_focus->module_dir); |
279 | 297 | $result = $newfocus->retrieve_by_string_fields($index_fields,true); |
@@ -320,11 +338,15 @@ discard block |
||
320 | 338 | $fieldName=''; |
321 | 339 | |
322 | 340 | //skip this field if it is the deleted field, not in the importable keys array, or a field in the exclude array |
323 | - if (!in_array($field, $importable_keys) || in_array($field, $exclude_array)) continue; |
|
341 | + if (!in_array($field, $importable_keys) || in_array($field, $exclude_array)) { |
|
342 | + continue; |
|
343 | + } |
|
324 | 344 | $fieldDef = $this->_focus->getFieldDefinition($field); |
325 | 345 | |
326 | 346 | //skip if this field is already defined (from another index) |
327 | - if (in_array($fieldDef['name'],$fields_used)) continue; |
|
347 | + if (in_array($fieldDef['name'],$fields_used)) { |
|
348 | + continue; |
|
349 | + } |
|
328 | 350 | |
329 | 351 | //get the proper export label |
330 | 352 | $fieldName = translateForExport($fieldDef['name'],$this->_focus); |
@@ -1,5 +1,7 @@ discard block |
||
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. |
@@ -52,12 +54,16 @@ discard block |
||
52 | 54 | |
53 | 55 | if(!empty($fields['DESCRIPTION'])) { |
54 | 56 | $overlib_string .= '<b>'. $mod_strings['LBL_DESCRIPTION'] . '</b> ' . substr($fields['DESCRIPTION'], 0, 300); |
55 | - if(strlen($fields['DESCRIPTION']) > 300) $overlib_string .= '...'; |
|
57 | + if(strlen($fields['DESCRIPTION']) > 300) { |
|
58 | + $overlib_string .= '...'; |
|
59 | + } |
|
56 | 60 | $overlib_string .= '<br>'; |
57 | 61 | } |
58 | 62 | if(!empty($fields['RESOLUTION'])) { |
59 | 63 | $overlib_string .= '<b>'. $mod_strings['LBL_RESOLUTION'] . '</b> ' . substr($fields['RESOLUTION'], 0, 300); |
60 | - if(strlen($fields['RESOLUTION']) > 300) $overlib_string .= '...'; |
|
64 | + if(strlen($fields['RESOLUTION']) > 300) { |
|
65 | + $overlib_string .= '...'; |
|
66 | + } |
|
61 | 67 | } |
62 | 68 | |
63 | 69 | return array('fieldToAddTo' => 'NAME', |
@@ -1,5 +1,7 @@ discard block |
||
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. |
@@ -69,7 +71,9 @@ discard block |
||
69 | 71 | |
70 | 72 | $button = "<form action='index.php' method='post' name='form' id='form'>\n"; |
71 | 73 | $button .= "<input type='hidden' name='module' value='Opportunities'>\n"; |
72 | -if ($currentModule == 'Accounts') $button .= "<input type='hidden' name='account_id' value='$focus->id'>\n<input type='hidden' name='account_name' value=\"".urlencode($focus->name)."\">\n"; |
|
74 | +if ($currentModule == 'Accounts') { |
|
75 | + $button .= "<input type='hidden' name='account_id' value='$focus->id'>\n<input type='hidden' name='account_name' value=\"".urlencode($focus->name)."\">\n"; |
|
76 | +} |
|
73 | 77 | if ($currentModule == 'Contacts') { |
74 | 78 | $button .= "<input type='hidden' name='account_id' value='$focus->account_id'>\n<input type='hidden' name='account_name' value=\"".urlencode($focus->account_name)."\">\n"; |
75 | 79 | $button .= "<input type='hidden' name='contact_id' value='$focus->id'>\n"; |
@@ -105,8 +109,7 @@ discard block |
||
105 | 109 | ."' type='button' class='button' value=' ".$app_strings['LBL_SELECT_BUTTON_LABEL'] |
106 | 110 | ." ' name='button' onclick='open_popup(\"Opportunities\", 600, 400, \"\", false, true, {$encoded_popup_request_data});'>\n"; |
107 | 111 | // ." ' name='button' onclick='window.open(\"index.php?module=Opportunities&action=Popup&html=Popup_picker&form=DetailView&form_submit=true\",\"new\",\"width=600,height=400,resizable=1,scrollbars=1\");'>\n"; |
108 | -} |
|
109 | -else |
|
112 | +} else |
|
110 | 113 | { |
111 | 114 | /////////////////////////////////////// |
112 | 115 | /// |