@@ -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. |
@@ -135,8 +137,7 @@ discard block |
||
135 | 137 | if ($link->getSide() == REL_LHS) |
136 | 138 | { |
137 | 139 | $sub_result = $this->remove($focus, $relBean); |
138 | - } |
|
139 | - else |
|
140 | + } else |
|
140 | 141 | { |
141 | 142 | $sub_result = $this->remove($relBean, $focus); |
142 | 143 | } |
@@ -202,8 +203,10 @@ discard block |
||
202 | 203 | protected function addRow($row) |
203 | 204 | { |
204 | 205 | $existing = $this->checkExisting($row); |
205 | - if (!empty($existing)) //Update the existing row, overriding the values with those passed in |
|
206 | + if (!empty($existing)) { |
|
207 | + //Update the existing row, overriding the values with those passed in |
|
206 | 208 | return $this->updateRow($existing['id'], array_merge($existing, $row)); |
209 | + } |
|
207 | 210 | |
208 | 211 | $values = array(); |
209 | 212 | foreach($this->getFields() as $def) |
@@ -232,7 +235,9 @@ discard block |
||
232 | 235 | { |
233 | 236 | $newVals = array(); |
234 | 237 | //Unset the ID since we are using it to update the row |
235 | - if (isset($values['id'])) unset($values['id']); |
|
238 | + if (isset($values['id'])) { |
|
239 | + unset($values['id']); |
|
240 | + } |
|
236 | 241 | foreach($values as $field => $val) |
237 | 242 | { |
238 | 243 | $newVals[] = "$field='$val'"; |
@@ -252,8 +257,9 @@ discard block |
||
252 | 257 | */ |
253 | 258 | protected function removeRow($where) |
254 | 259 | { |
255 | - if (empty($where)) |
|
256 | - return false; |
|
260 | + if (empty($where)) { |
|
261 | + return false; |
|
262 | + } |
|
257 | 263 | |
258 | 264 | $date_modified = TimeDate::getInstance()->getNow()->asDb(); |
259 | 265 | $stringSets = array(); |
@@ -278,8 +284,9 @@ discard block |
||
278 | 284 | { |
279 | 285 | $leftIDName = $this->def['join_key_lhs']; |
280 | 286 | $rightIDName = $this->def['join_key_rhs']; |
281 | - if (empty($row[$leftIDName]) || empty($row[$rightIDName])) |
|
282 | - return false; |
|
287 | + if (empty($row[$leftIDName]) || empty($row[$rightIDName])) { |
|
288 | + return false; |
|
289 | + } |
|
283 | 290 | |
284 | 291 | $leftID = $row[$leftIDName]; |
285 | 292 | $rightID = $row[$rightIDName]; |
@@ -308,14 +315,16 @@ discard block |
||
308 | 315 | { |
309 | 316 | $ignore_role_filter = $ignore_role_filter || $this->ignore_role_filter; |
310 | 317 | $roleCheck = ""; |
311 | - if (empty ($table)) |
|
312 | - $table = $this->getRelationshipTable(); |
|
318 | + if (empty ($table)) { |
|
319 | + $table = $this->getRelationshipTable(); |
|
320 | + } |
|
313 | 321 | if (!empty($this->def['relationship_role_column']) && !empty($this->def["relationship_role_column_value"]) && !$ignore_role_filter ) |
314 | 322 | { |
315 | - if (empty($table)) |
|
316 | - $roleCheck = " AND $this->relationship_role_column"; |
|
317 | - else |
|
318 | - $roleCheck = " AND $table.{$this->relationship_role_column}"; |
|
323 | + if (empty($table)) { |
|
324 | + $roleCheck = " AND $this->relationship_role_column"; |
|
325 | + } else { |
|
326 | + $roleCheck = " AND $table.{$this->relationship_role_column}"; |
|
327 | + } |
|
319 | 328 | //role column value. |
320 | 329 | if (empty($this->def['relationship_role_column_value'])) |
321 | 330 | { |
@@ -406,8 +415,9 @@ discard block |
||
406 | 415 | protected function getOptionalWhereClause($optional_array) { |
407 | 416 | //lhs_field, operator, and rhs_value must be set in optional_array |
408 | 417 | foreach(array("lhs_field", "operator", "rhs_value") as $required){ |
409 | - if (empty($optional_array[$required])) |
|
410 | - return ""; |
|
418 | + if (empty($optional_array[$required])) { |
|
419 | + return ""; |
|
420 | + } |
|
411 | 421 | } |
412 | 422 | |
413 | 423 | return $optional_array['lhs_field']."".$optional_array['operator']."'".$optional_array['rhs_value']."'"; |
@@ -445,8 +455,7 @@ discard block |
||
445 | 455 | if (empty($bean->deleted) && empty($bean->in_save)) |
446 | 456 | { |
447 | 457 | $bean->save(); |
448 | - } |
|
449 | - else |
|
458 | + } else |
|
450 | 459 | { |
451 | 460 | // Bug 55942 save the in-save id which will be used to send workflow alert later |
452 | 461 | if (isset($bean->id) && !empty($_SESSION['WORKFLOW_ALERTS'])) |
@@ -479,8 +488,9 @@ discard block |
||
479 | 488 | |
480 | 489 | public function __get($name) |
481 | 490 | { |
482 | - if (isset($this->def[$name])) |
|
483 | - return $this->def[$name]; |
|
491 | + if (isset($this->def[$name])) { |
|
492 | + return $this->def[$name]; |
|
493 | + } |
|
484 | 494 | |
485 | 495 | switch($name) |
486 | 496 | { |
@@ -500,8 +510,9 @@ discard block |
||
500 | 510 | return array('lhs_table', 'lhs_key', 'rhs_module', 'rhs_table', 'rhs_key', 'relationship_type'); |
501 | 511 | } |
502 | 512 | |
503 | - if (isset($this->$name)) |
|
504 | - return $this->$name; |
|
513 | + if (isset($this->$name)) { |
|
514 | + return $this->$name; |
|
515 | + } |
|
505 | 516 | |
506 | 517 | return null; |
507 | 518 | } |
@@ -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. |
@@ -72,11 +74,13 @@ discard block |
||
72 | 74 | protected function updateLinks($lhs, $lhsLinkName, $rhs, $rhsLinkName) |
73 | 75 | { |
74 | 76 | //RHS and LHS only ever have one bean |
75 | - if (isset($lhs->$lhsLinkName)) |
|
76 | - $lhs->$lhsLinkName->beans = array($rhs->id => $rhs); |
|
77 | + if (isset($lhs->$lhsLinkName)) { |
|
78 | + $lhs->$lhsLinkName->beans = array($rhs->id => $rhs); |
|
79 | + } |
|
77 | 80 | |
78 | - if (isset($rhs->$rhsLinkName)) |
|
79 | - $rhs->$rhsLinkName->beans = array($lhs->id => $lhs); |
|
81 | + if (isset($rhs->$rhsLinkName)) { |
|
82 | + $rhs->$rhsLinkName->beans = array($lhs->id => $lhs); |
|
83 | + } |
|
80 | 84 | } |
81 | 85 | |
82 | 86 | public function getJoin($link, $params = array(), $return_array = false) |
@@ -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. |
@@ -66,7 +68,9 @@ discard block |
||
66 | 68 | // test to see if the relationship exist if the relationship between the two beans |
67 | 69 | // exist then we just fail out with false as we don't want to re-trigger this |
68 | 70 | // the save and such as it causes problems with the related() in sugarlogic |
69 | - if($this->relationship_exists($lhs, $rhs) && !empty($GLOBALS['resavingRelatedBeans'])) return false; |
|
71 | + if($this->relationship_exists($lhs, $rhs) && !empty($GLOBALS['resavingRelatedBeans'])) { |
|
72 | + return false; |
|
73 | + } |
|
70 | 74 | |
71 | 75 | $lhsLinkName = $this->lhsLink; |
72 | 76 | $rhsLinkName = $this->rhsLink; |
@@ -79,8 +83,9 @@ discard block |
||
79 | 83 | $prevRelated = $oldLink->getBeans(null); |
80 | 84 | foreach($prevRelated as $oldLHS) |
81 | 85 | { |
82 | - if ($oldLHS->id != $lhs->id) |
|
83 | - $this->remove($oldLHS, $rhs, false); |
|
86 | + if ($oldLHS->id != $lhs->id) { |
|
87 | + $this->remove($oldLHS, $rhs, false); |
|
88 | + } |
|
84 | 89 | } |
85 | 90 | } |
86 | 91 | |
@@ -111,19 +116,22 @@ discard block |
||
111 | 116 | |
112 | 117 | //One2MBean relationships require that the RHS bean be saved or else the relationship will not be saved. |
113 | 118 | //If we aren't already in a relationship save, intitiate a save now. |
114 | - if (empty($GLOBALS['resavingRelatedBeans'])) |
|
115 | - SugarRelationship::resaveRelatedBeans(); |
|
119 | + if (empty($GLOBALS['resavingRelatedBeans'])) { |
|
120 | + SugarRelationship::resaveRelatedBeans(); |
|
121 | + } |
|
116 | 122 | |
117 | 123 | return true; |
118 | 124 | } |
119 | 125 | |
120 | 126 | protected function updateLinks($lhs, $lhsLinkName, $rhs, $rhsLinkName) |
121 | 127 | { |
122 | - if (isset($lhs->$lhsLinkName)) |
|
123 | - $lhs->$lhsLinkName->addBean($rhs); |
|
128 | + if (isset($lhs->$lhsLinkName)) { |
|
129 | + $lhs->$lhsLinkName->addBean($rhs); |
|
130 | + } |
|
124 | 131 | //RHS only has one bean ever, so we don't need to preload the relationship |
125 | - if (isset($rhs->$rhsLinkName)) |
|
126 | - $rhs->$rhsLinkName->beans = array($lhs->id => $lhs); |
|
132 | + if (isset($rhs->$rhsLinkName)) { |
|
133 | + $rhs->$rhsLinkName->beans = array($lhs->id => $lhs); |
|
134 | + } |
|
127 | 135 | } |
128 | 136 | |
129 | 137 | protected function updateFields($lhs, $rhs, $additionalFields) |
@@ -148,8 +156,9 @@ discard block |
||
148 | 156 | $rhsID = $this->def['rhs_key']; |
149 | 157 | |
150 | 158 | //If this relationship has already been removed, we can just return |
151 | - if ($rhs->$rhsID != $lhs->id) |
|
152 | - return false; |
|
159 | + if ($rhs->$rhsID != $lhs->id) { |
|
160 | + return false; |
|
161 | + } |
|
153 | 162 | |
154 | 163 | $rhs->$rhsID = ''; |
155 | 164 | |
@@ -192,8 +201,7 @@ discard block |
||
192 | 201 | { |
193 | 202 | $rows[$id] = array('id' => $id); |
194 | 203 | } |
195 | - } |
|
196 | - else //If the link is LHS, we need to query to get the full list and load all the beans. |
|
204 | + } else //If the link is LHS, we need to query to get the full list and load all the beans. |
|
197 | 205 | { |
198 | 206 | $db = DBManagerFactory::getInstance(); |
199 | 207 | $query = $this->getQuery($link, $params); |
@@ -241,8 +249,9 @@ discard block |
||
241 | 249 | //Add any optional where clause |
242 | 250 | if (!empty($params['where'])) { |
243 | 251 | $add_where = is_string($params['where']) ? $params['where'] : "$rhsTable." . $this->getOptionalWhereClause($params['where']); |
244 | - if (!empty($add_where)) |
|
245 | - $where .= " AND $add_where"; |
|
252 | + if (!empty($add_where)) { |
|
253 | + $where .= " AND $add_where"; |
|
254 | + } |
|
246 | 255 | } |
247 | 256 | |
248 | 257 | //Add any optional order clauses |
@@ -255,7 +264,9 @@ discard block |
||
255 | 264 | if (empty($params['return_as_array'])) { |
256 | 265 | //Limit is not compatible with return_as_array |
257 | 266 | $query = "SELECT id FROM $from $where"; |
258 | - if (!empty($order_by)) $query .= ' ORDER BY '.$order_by; |
|
267 | + if (!empty($order_by)) { |
|
268 | + $query .= ' ORDER BY '.$order_by; |
|
269 | + } |
|
259 | 270 | if (!empty($params['limit']) && $params['limit'] > 0) { |
260 | 271 | $offset = isset($params['offset']) ? $params['offset'] : 0; |
261 | 272 | $query = DBManagerFactory::getInstance()->limitQuery($query, $offset, $params['limit'], false, "", false); |
@@ -276,8 +287,9 @@ discard block |
||
276 | 287 | { |
277 | 288 | $linkIsLHS = $link->getSide() == REL_LHS; |
278 | 289 | $startingTable = (empty($params['left_join_table_alias']) ? $this->def['lhs_table'] : $params['left_join_table_alias']); |
279 | - if (!$linkIsLHS) |
|
280 | - $startingTable = (empty($params['right_join_table_alias']) ? $this->def['rhs_table'] : $params['right_join_table_alias']); |
|
290 | + if (!$linkIsLHS) { |
|
291 | + $startingTable = (empty($params['right_join_table_alias']) ? $this->def['rhs_table'] : $params['right_join_table_alias']); |
|
292 | + } |
|
281 | 293 | $startingKey = $linkIsLHS ? $this->def['lhs_key'] : $this->def['rhs_key']; |
282 | 294 | $targetTable = $linkIsLHS ? $this->def['rhs_table'] : $this->def['lhs_table']; |
283 | 295 | $targetTableWithAlias = $targetTable; |
@@ -315,8 +327,9 @@ discard block |
||
315 | 327 | |
316 | 328 | $linkIsLHS = $link->getSide() == REL_RHS; |
317 | 329 | $startingTable = (empty($params['left_join_table_alias']) ? $this->def['lhs_table'] : $params['left_join_table_alias']); |
318 | - if (!$linkIsLHS) |
|
319 | - $startingTable = (empty($params['right_join_table_alias']) ? $this->def['rhs_table'] : $params['right_join_table_alias']); |
|
330 | + if (!$linkIsLHS) { |
|
331 | + $startingTable = (empty($params['right_join_table_alias']) ? $this->def['rhs_table'] : $params['right_join_table_alias']); |
|
332 | + } |
|
320 | 333 | $startingKey = $linkIsLHS ? $this->def['lhs_key'] : $this->def['rhs_key']; |
321 | 334 | $targetTable = $linkIsLHS ? $this->def['rhs_table'] : $this->def['lhs_table']; |
322 | 335 | $targetKey = $linkIsLHS ? $this->def['rhs_key'] : $this->def['lhs_key']; |
@@ -393,9 +406,10 @@ discard block |
||
393 | 406 | |
394 | 407 | public function getRelationshipTable() |
395 | 408 | { |
396 | - if (isset($this->def['table'])) |
|
397 | - return $this->def['table']; |
|
398 | - else |
|
399 | - return $this->def['rhs_table']; |
|
409 | + if (isset($this->def['table'])) { |
|
410 | + return $this->def['table']; |
|
411 | + } else { |
|
412 | + return $this->def['rhs_table']; |
|
413 | + } |
|
400 | 414 | } |
401 | 415 | } |
@@ -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. |
@@ -84,8 +86,7 @@ discard block |
||
84 | 86 | { |
85 | 87 | $GLOBALS['log']->error("Warning: Multiple links found for relationship {$this->name} within module {$module}"); |
86 | 88 | return $this->getMostAppropriateLinkedDefinition($results); |
87 | - } |
|
88 | - else |
|
89 | + } else |
|
89 | 90 | { |
90 | 91 | return FALSE; |
91 | 92 | } |
@@ -178,8 +179,9 @@ discard block |
||
178 | 179 | |
179 | 180 | $this->addRow($dataToInsert); |
180 | 181 | |
181 | - if ($this->self_referencing) |
|
182 | - $this->addSelfReferencing($lhs, $rhs, $additionalFields); |
|
182 | + if ($this->self_referencing) { |
|
183 | + $this->addSelfReferencing($lhs, $rhs, $additionalFields); |
|
184 | + } |
|
183 | 185 | |
184 | 186 | $lhs->$lhsLinkName->addBean($rhs); |
185 | 187 | $rhs->$rhsLinkName->addBean($lhs); |
@@ -339,8 +341,9 @@ discard block |
||
339 | 341 | |
340 | 342 | $this->removeRow($dataToRemove); |
341 | 343 | |
342 | - if ($this->self_referencing) |
|
343 | - $this->removeSelfReferencing($lhs, $rhs); |
|
344 | + if ($this->self_referencing) { |
|
345 | + $this->removeSelfReferencing($lhs, $rhs); |
|
346 | + } |
|
344 | 347 | |
345 | 348 | if (empty($_SESSION['disable_workflow']) || $_SESSION['disable_workflow'] != "Yes") |
346 | 349 | { |
@@ -395,8 +398,9 @@ discard block |
||
395 | 398 | $idField = $link->getSide() == REL_LHS ? $this->def['join_key_rhs'] : $this->def['join_key_lhs']; |
396 | 399 | while ($row = $db->fetchByAssoc($result, FALSE)) |
397 | 400 | { |
398 | - if (empty($row['id']) && empty($row[$idField])) |
|
399 | - continue; |
|
401 | + if (empty($row['id']) && empty($row[$idField])) { |
|
402 | + continue; |
|
403 | + } |
|
400 | 404 | $id = empty($row['id']) ? $row[$idField] : $row['id']; |
401 | 405 | $rows[$id] = $row; |
402 | 406 | } |
@@ -414,15 +418,17 @@ discard block |
||
414 | 418 | $targetKey = $this->def['join_key_rhs']; |
415 | 419 | $relatedSeed = BeanFactory::getBean($this->getRHSModule()); |
416 | 420 | $relatedSeedKey = $this->def['rhs_key']; |
417 | - if (!empty($params['where']) || !empty($params['order_by'])) |
|
418 | - $whereTable = (empty($params['right_join_table_alias']) ? $relatedSeed->table_name : $params['right_join_table_alias']); |
|
421 | + if (!empty($params['where']) || !empty($params['order_by'])) { |
|
422 | + $whereTable = (empty($params['right_join_table_alias']) ? $relatedSeed->table_name : $params['right_join_table_alias']); |
|
423 | + } |
|
419 | 424 | } else { |
420 | 425 | $knownKey = $this->def['join_key_rhs']; |
421 | 426 | $targetKey = $this->def['join_key_lhs']; |
422 | 427 | $relatedSeed = BeanFactory::getBean($this->getLHSModule()); |
423 | 428 | $relatedSeedKey = $this->def['lhs_key']; |
424 | - if (!empty($params['where']) || !empty($params['order_by'])) |
|
425 | - $whereTable = (empty($params['left_join_table_alias']) ? $relatedSeed->table_name : $params['left_join_table_alias']); |
|
429 | + if (!empty($params['where']) || !empty($params['order_by'])) { |
|
430 | + $whereTable = (empty($params['left_join_table_alias']) ? $relatedSeed->table_name : $params['left_join_table_alias']); |
|
431 | + } |
|
426 | 432 | } |
427 | 433 | $rel_table = $this->getRelationshipTable(); |
428 | 434 | |
@@ -432,8 +438,9 @@ discard block |
||
432 | 438 | //Add any optional where clause |
433 | 439 | if (!empty($params['where'])) { |
434 | 440 | $add_where = is_string($params['where']) ? $params['where'] : "$whereTable." . $this->getOptionalWhereClause($params['where']); |
435 | - if (!empty($add_where)) |
|
436 | - $where .= " AND $add_where"; |
|
441 | + if (!empty($add_where)) { |
|
442 | + $where .= " AND $add_where"; |
|
443 | + } |
|
437 | 444 | } |
438 | 445 | |
439 | 446 | //Add any optional order clauses |
@@ -454,7 +461,9 @@ discard block |
||
454 | 461 | |
455 | 462 | if (empty($params['return_as_array'])) { |
456 | 463 | $query = "SELECT $targetKey id FROM $from WHERE $where AND $rel_table.deleted=$deleted"; |
457 | - if(!empty($order_by)) $query .= ' ORDER BY '.$order_by; |
|
464 | + if(!empty($order_by)) { |
|
465 | + $query .= ' ORDER BY '.$order_by; |
|
466 | + } |
|
458 | 467 | //Limit is not compatible with return_as_array |
459 | 468 | if (!empty($params['limit']) && $params['limit'] > 0) { |
460 | 469 | $offset = isset($params['offset']) ? $params['offset'] : 0; |
@@ -636,18 +645,20 @@ discard block |
||
636 | 645 | |
637 | 646 | public function getRelationshipTable() |
638 | 647 | { |
639 | - if (!empty($this->def['table'])) |
|
640 | - return $this->def['table']; |
|
641 | - else if(!empty($this->def['join_table'])) |
|
642 | - return $this->def['join_table']; |
|
648 | + if (!empty($this->def['table'])) { |
|
649 | + return $this->def['table']; |
|
650 | + } else if(!empty($this->def['join_table'])) { |
|
651 | + return $this->def['join_table']; |
|
652 | + } |
|
643 | 653 | |
644 | 654 | return false; |
645 | 655 | } |
646 | 656 | |
647 | 657 | public function getFields() |
648 | 658 | { |
649 | - if (!empty($this->def['fields'])) |
|
650 | - return $this->def['fields']; |
|
659 | + if (!empty($this->def['fields'])) { |
|
660 | + return $this->def['fields']; |
|
661 | + } |
|
651 | 662 | $fields = array( |
652 | 663 | "id" => array('name' => 'id'), |
653 | 664 | 'date_modified' => array('name' => 'date_modified'), |
@@ -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. |
@@ -67,13 +69,13 @@ discard block |
||
67 | 69 | if (empty($links)) |
68 | 70 | { |
69 | 71 | $GLOBALS['log']->fatal("No Links found for relationship {$this->name}"); |
70 | - } |
|
71 | - else { |
|
72 | - if (!is_array($links)) //Only one link for a self referencing relationship, this is very bad. |
|
72 | + } else { |
|
73 | + if (!is_array($links)) { |
|
74 | + //Only one link for a self referencing relationship, this is very bad. |
|
73 | 75 | { |
74 | 76 | $this->lhsLinkDef = $this->rhsLinkDef = $links; |
75 | 77 | } |
76 | - else if (!empty($links[0]) && !empty($links[1])) |
|
78 | + } else if (!empty($links[0]) && !empty($links[1])) |
|
77 | 79 | { |
78 | 80 | |
79 | 81 | if ((!empty($links[0]['side']) && $links[0]['side'] == "right") |
@@ -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. |
@@ -62,8 +64,9 @@ discard block |
||
62 | 64 | */ |
63 | 65 | public static function getInstance() |
64 | 66 | { |
65 | - if (is_null(self::$rfInstance)) |
|
66 | - self::$rfInstance = new SugarRelationshipFactory(); |
|
67 | + if (is_null(self::$rfInstance)) { |
|
68 | + self::$rfInstance = new SugarRelationshipFactory(); |
|
69 | + } |
|
67 | 70 | return self::$rfInstance; |
68 | 71 | } |
69 | 72 | |
@@ -114,8 +117,7 @@ discard block |
||
114 | 117 | //If a relationship has no table or join keys, it must be bean based |
115 | 118 | if (empty($def['true_relationship_type']) || (empty($def['table']) && empty($def['join_table'])) || empty($def['join_key_rhs'])){ |
116 | 119 | return new One2MBeanRelationship($def); |
117 | - } |
|
118 | - else { |
|
120 | + } else { |
|
119 | 121 | return new One2MRelationship($def); |
120 | 122 | } |
121 | 123 | break; |
@@ -123,8 +125,7 @@ discard block |
||
123 | 125 | if (empty($def['true_relationship_type'])){ |
124 | 126 | require_once("data/Relationships/One2OneBeanRelationship.php"); |
125 | 127 | return new One2OneBeanRelationship($def); |
126 | - } |
|
127 | - else { |
|
128 | + } else { |
|
128 | 129 | require_once("data/Relationships/One2OneRelationship.php"); |
129 | 130 | return new One2OneRelationship($def); |
130 | 131 | } |
@@ -161,13 +162,15 @@ discard block |
||
161 | 162 | protected function buildRelationshipCache() |
162 | 163 | { |
163 | 164 | global $beanList, $dictionary, $buildingRelCache; |
164 | - if ($buildingRelCache) |
|
165 | - return; |
|
165 | + if ($buildingRelCache) { |
|
166 | + return; |
|
167 | + } |
|
166 | 168 | $buildingRelCache = true; |
167 | 169 | include("modules/TableDictionary.php"); |
168 | 170 | |
169 | - if (empty($beanList)) |
|
170 | - include("include/modules.php"); |
|
171 | + if (empty($beanList)) { |
|
172 | + include("include/modules.php"); |
|
173 | + } |
|
171 | 174 | //Reload ALL the module vardefs.... |
172 | 175 | foreach($beanList as $moduleName => $beanName) |
173 | 176 | { |
@@ -186,9 +189,10 @@ discard block |
||
186 | 189 | { |
187 | 190 | foreach($def['relationships'] as $relKey => $relDef) |
188 | 191 | { |
189 | - if ($key == $relKey) //Relationship only entry, we need to capture everything |
|
192 | + if ($key == $relKey) { |
|
193 | + //Relationship only entry, we need to capture everything |
|
190 | 194 | $relationships[$key] = array_merge(array('name' => $key), (array)$def, (array)$relDef); |
191 | - else { |
|
195 | + } else { |
|
192 | 196 | $relationships[$relKey] = array_merge(array('name' => $relKey), (array)$relDef); |
193 | 197 | if(!empty($relationships[$relKey]['join_table']) && empty($relationships[$relKey]['fields']) |
194 | 198 | && isset($dictionary[$relationships[$relKey]['join_table']]['fields'])) { |
@@ -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. |
@@ -65,8 +67,9 @@ discard block |
||
65 | 67 | return false; |
66 | 68 | } |
67 | 69 | |
68 | - if ($lhs->$lhsLinkName->beansAreLoaded()) |
|
69 | - $lhs->$lhsLinkName->addBean($rhs); |
|
70 | + if ($lhs->$lhsLinkName->beansAreLoaded()) { |
|
71 | + $lhs->$lhsLinkName->addBean($rhs); |
|
72 | + } |
|
70 | 73 | |
71 | 74 | $this->callBeforeAdd($lhs, $rhs, $lhsLinkName); |
72 | 75 | |
@@ -75,11 +78,13 @@ discard block |
||
75 | 78 | |
76 | 79 | $this->addRow($dataToInsert); |
77 | 80 | |
78 | - if ($this->self_referencing) |
|
79 | - $this->addSelfReferencing($lhs, $rhs, $additionalFields); |
|
81 | + if ($this->self_referencing) { |
|
82 | + $this->addSelfReferencing($lhs, $rhs, $additionalFields); |
|
83 | + } |
|
80 | 84 | |
81 | - if ($lhs->$lhsLinkName->beansAreLoaded()) |
|
82 | - $lhs->$lhsLinkName->addBean($rhs); |
|
85 | + if ($lhs->$lhsLinkName->beansAreLoaded()) { |
|
86 | + $lhs->$lhsLinkName->addBean($rhs); |
|
87 | + } |
|
83 | 88 | |
84 | 89 | $this->callAfterAdd($lhs, $rhs, $lhsLinkName); |
85 | 90 | |
@@ -120,8 +125,9 @@ discard block |
||
120 | 125 | |
121 | 126 | $this->removeRow($dataToRemove); |
122 | 127 | |
123 | - if ($this->self_referencing) |
|
124 | - $this->removeSelfReferencing($lhs, $rhs); |
|
128 | + if ($this->self_referencing) { |
|
129 | + $this->removeSelfReferencing($lhs, $rhs); |
|
130 | + } |
|
125 | 131 | |
126 | 132 | if (empty($_SESSION['disable_workflow']) || $_SESSION['disable_workflow'] != "Yes") |
127 | 133 | { |
@@ -10,7 +10,9 @@ |
||
10 | 10 | require_once('../../../config_override.php'); |
11 | 11 | } |
12 | 12 | |
13 | -if(!isset($sugar_config['theme_settings']['SuiteR'])) return; |
|
13 | +if(!isset($sugar_config['theme_settings']['SuiteR'])) { |
|
14 | + return; |
|
15 | +} |
|
14 | 16 | |
15 | 17 | //set file type back to css from php |
16 | 18 | header("Content-type: text/css; charset: UTF-8"); |
@@ -10,7 +10,9 @@ |
||
10 | 10 | require_once('../../../config_override.php'); |
11 | 11 | } |
12 | 12 | |
13 | -if(!isset($sugar_config['theme_settings']['Suite7'])) return; |
|
13 | +if(!isset($sugar_config['theme_settings']['Suite7'])) { |
|
14 | + return; |
|
15 | +} |
|
14 | 16 | |
15 | 17 | //set file type back to css from php |
16 | 18 | header("Content-type: text/css; charset: UTF-8"); |