@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -87,14 +87,14 @@ discard block |
||
87 | 87 | $targetTable = $linkIsLHS ? $this->def['rhs_table'] : $this->def['lhs_table']; |
88 | 88 | $targetTableWithAlias = $targetTable; |
89 | 89 | $targetKey = $linkIsLHS ? $this->def['rhs_key'] : $this->def['lhs_key']; |
90 | - $join_type= isset($params['join_type']) ? $params['join_type'] : ' INNER JOIN '; |
|
90 | + $join_type = isset($params['join_type']) ? $params['join_type'] : ' INNER JOIN '; |
|
91 | 91 | |
92 | 92 | $join = ''; |
93 | 93 | |
94 | 94 | //Set up any table aliases required |
95 | - if ( ! empty($params['join_table_alias'])) |
|
95 | + if (!empty($params['join_table_alias'])) |
|
96 | 96 | { |
97 | - $targetTableWithAlias = $targetTable . " ". $params['join_table_alias']; |
|
97 | + $targetTableWithAlias = $targetTable." ".$params['join_table_alias']; |
|
98 | 98 | $targetTable = $params['join_table_alias']; |
99 | 99 | } |
100 | 100 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | //Next add any role filters |
107 | 107 | . $this->getRoleWhere(); |
108 | 108 | |
109 | - if($return_array){ |
|
109 | + if ($return_array) { |
|
110 | 110 | return array( |
111 | 111 | 'join' => $join, |
112 | 112 | 'type' => $this->type, |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | // test to see if the relationship exist if the relationship between the two beans |
67 | 67 | // exist then we just fail out with false as we don't want to re-trigger this |
68 | 68 | // 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; |
|
69 | + if ($this->relationship_exists($lhs, $rhs) && !empty($GLOBALS['resavingRelatedBeans'])) return false; |
|
70 | 70 | |
71 | 71 | $lhsLinkName = $this->lhsLink; |
72 | 72 | $rhsLinkName = $this->rhsLink; |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | { |
78 | 78 | $oldLink = $rhs->$rhsLinkName; |
79 | 79 | $prevRelated = $oldLink->getBeans(null); |
80 | - foreach($prevRelated as $oldLHS) |
|
80 | + foreach ($prevRelated as $oldLHS) |
|
81 | 81 | { |
82 | 82 | if ($oldLHS->id != $lhs->id) |
83 | 83 | $this->remove($oldLHS, $rhs, false); |
@@ -131,12 +131,12 @@ discard block |
||
131 | 131 | //Now update the RHS bean's ID field |
132 | 132 | $rhsID = $this->def['rhs_key']; |
133 | 133 | $rhs->$rhsID = $lhs->id; |
134 | - foreach($additionalFields as $field => $val) |
|
134 | + foreach ($additionalFields as $field => $val) |
|
135 | 135 | { |
136 | 136 | $rhs->$field = $val; |
137 | 137 | } |
138 | 138 | //Update role fields |
139 | - if(!empty($this->def["relationship_role_column"]) && !empty($this->def["relationship_role_column_value"])) |
|
139 | + if (!empty($this->def["relationship_role_column"]) && !empty($this->def["relationship_role_column_value"])) |
|
140 | 140 | { |
141 | 141 | $roleField = $this->def["relationship_role_column"]; |
142 | 142 | $rhs->$roleField = $this->def["relationship_role_column_value"]; |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | |
241 | 241 | //Add any optional where clause |
242 | 242 | if (!empty($params['where'])) { |
243 | - $add_where = is_string($params['where']) ? $params['where'] : "$rhsTable." . $this->getOptionalWhereClause($params['where']); |
|
243 | + $add_where = is_string($params['where']) ? $params['where'] : "$rhsTable.".$this->getOptionalWhereClause($params['where']); |
|
244 | 244 | if (!empty($add_where)) |
245 | 245 | $where .= " AND $add_where"; |
246 | 246 | } |
@@ -282,22 +282,22 @@ discard block |
||
282 | 282 | $targetTable = $linkIsLHS ? $this->def['rhs_table'] : $this->def['lhs_table']; |
283 | 283 | $targetTableWithAlias = $targetTable; |
284 | 284 | $targetKey = $linkIsLHS ? $this->def['rhs_key'] : $this->def['lhs_key']; |
285 | - $join_type= isset($params['join_type']) ? $params['join_type'] : ' INNER JOIN '; |
|
285 | + $join_type = isset($params['join_type']) ? $params['join_type'] : ' INNER JOIN '; |
|
286 | 286 | $join = ''; |
287 | 287 | |
288 | 288 | //Set up any table aliases required |
289 | - if ( ! empty($params['join_table_alias'])) |
|
289 | + if (!empty($params['join_table_alias'])) |
|
290 | 290 | { |
291 | - $targetTableWithAlias = $targetTable. " ".$params['join_table_alias']; |
|
291 | + $targetTableWithAlias = $targetTable." ".$params['join_table_alias']; |
|
292 | 292 | $targetTable = $params['join_table_alias']; |
293 | 293 | } |
294 | 294 | |
295 | 295 | //First join the relationship table |
296 | 296 | $join .= "$join_type $targetTableWithAlias ON $startingTable.$startingKey=$targetTable.$targetKey AND $targetTable.deleted=0\n" |
297 | 297 | //Next add any role filters |
298 | - . $this->getRoleWhere(($linkIsLHS) ? $targetTable : $startingTable) . "\n"; |
|
298 | + . $this->getRoleWhere(($linkIsLHS) ? $targetTable : $startingTable)."\n"; |
|
299 | 299 | |
300 | - if($return_array){ |
|
300 | + if ($return_array) { |
|
301 | 301 | return array( |
302 | 302 | 'join' => $join, |
303 | 303 | 'type' => $this->type, |
@@ -320,10 +320,10 @@ discard block |
||
320 | 320 | $startingKey = $linkIsLHS ? $this->def['lhs_key'] : $this->def['rhs_key']; |
321 | 321 | $targetTable = $linkIsLHS ? $this->def['rhs_table'] : $this->def['lhs_table']; |
322 | 322 | $targetKey = $linkIsLHS ? $this->def['rhs_key'] : $this->def['lhs_key']; |
323 | - $join_type= isset($params['join_type']) ? $params['join_type'] : ' INNER JOIN '; |
|
323 | + $join_type = isset($params['join_type']) ? $params['join_type'] : ' INNER JOIN '; |
|
324 | 324 | $query = ''; |
325 | 325 | |
326 | - $alias = empty($params['join_table_alias']) ? "{$link->name}_rel": $params['join_table_alias']; |
|
326 | + $alias = empty($params['join_table_alias']) ? "{$link->name}_rel" : $params['join_table_alias']; |
|
327 | 327 | $alias = $GLOBALS['db']->getValidDBName($alias, false, 'alias'); |
328 | 328 | |
329 | 329 | $tableInRoleFilter = ""; |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | || $targetTable == "tasks" |
343 | 343 | || $targetTable == "calls" |
344 | 344 | ) |
345 | - && substr($alias, 0, 12 + strlen($targetTable)) == $targetTable . "_activities_" |
|
345 | + && substr($alias, 0, 12 + strlen($targetTable)) == $targetTable."_activities_" |
|
346 | 346 | ) |
347 | 347 | { |
348 | 348 | $tableInRoleFilter = $linkIsLHS ? $alias : $startingTable; |
@@ -354,13 +354,13 @@ discard block |
||
354 | 354 | |
355 | 355 | $query .= "$join_type $targetTableWithAlias ON $startingTable.$startingKey=$targetTable.$targetKey AND $targetTable.deleted=0\n" |
356 | 356 | //Next add any role filters |
357 | - . $this->getRoleWhere($tableInRoleFilter) . "\n"; |
|
357 | + . $this->getRoleWhere($tableInRoleFilter)."\n"; |
|
358 | 358 | |
359 | 359 | if (!empty($params['return_as_array'])) { |
360 | 360 | $return_array = true; |
361 | 361 | } |
362 | 362 | |
363 | - if($return_array){ |
|
363 | + if ($return_array) { |
|
364 | 364 | return array( |
365 | 365 | 'join' => $query, |
366 | 366 | 'type' => $this->type, |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -73,14 +73,14 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function getLinkedDefForModuleByRelationship($module) |
75 | 75 | { |
76 | - $results = VardefManager::getLinkFieldForRelationship( $module, BeanFactory::getObjectName($module), $this->name); |
|
76 | + $results = VardefManager::getLinkFieldForRelationship($module, BeanFactory::getObjectName($module), $this->name); |
|
77 | 77 | //Only a single link was found |
78 | - if( isset($results['name']) ) |
|
78 | + if (isset($results['name'])) |
|
79 | 79 | { |
80 | 80 | return $results; |
81 | 81 | } |
82 | 82 | //Multiple links with same relationship name |
83 | - else if( is_array($results) ) |
|
83 | + else if (is_array($results)) |
|
84 | 84 | { |
85 | 85 | $GLOBALS['log']->error("Warning: Multiple links found for relationship {$this->name} within module {$module}"); |
86 | 86 | return $this->getMostAppropriateLinkedDefinition($results); |
@@ -101,17 +101,17 @@ discard block |
||
101 | 101 | protected function getMostAppropriateLinkedDefinition($links) |
102 | 102 | { |
103 | 103 | //First priority is to find a link name that matches the relationship name |
104 | - foreach($links as $link) |
|
104 | + foreach ($links as $link) |
|
105 | 105 | { |
106 | - if( isset($link['name']) && $link['name'] == $this->name ) |
|
106 | + if (isset($link['name']) && $link['name'] == $this->name) |
|
107 | 107 | { |
108 | 108 | return $link; |
109 | 109 | } |
110 | 110 | } |
111 | 111 | //Next would be a relationship that has a side defined |
112 | - foreach($links as $link) |
|
112 | + foreach ($links as $link) |
|
113 | 113 | { |
114 | - if( isset($link['id_name'])) |
|
114 | + if (isset($link['id_name'])) |
|
115 | 115 | { |
116 | 116 | return $link; |
117 | 117 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | //Need to hijack this as security groups will not contain a link on the module side |
136 | 136 | //due to the way the module works. Plus it would remove the relative ease of adding custom module support |
137 | 137 | |
138 | - if(get_class($rhs) != 'User' && get_class($rhs) != 'ACLRole' && get_class($lhs) == 'SecurityGroup') { |
|
138 | + if (get_class($rhs) != 'User' && get_class($rhs) != 'ACLRole' && get_class($lhs) == 'SecurityGroup') { |
|
139 | 139 | $rhs->$rhsLinkName->addBean($lhs); |
140 | 140 | $this->callBeforeAdd($rhs, $lhs, $rhsLinkName); |
141 | 141 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $this->addRow($dataToInsert); |
144 | 144 | $rhs->$rhsLinkName->addBean($lhs); |
145 | 145 | $this->callAfterAdd($lhs, $rhs, $lhsLinkName); |
146 | - } else if(get_class($lhs) != 'User' && get_class($lhs) != 'ACLRole' && get_class($rhs) == 'SecurityGroup') { |
|
146 | + } else if (get_class($lhs) != 'User' && get_class($lhs) != 'ACLRole' && get_class($rhs) == 'SecurityGroup') { |
|
147 | 147 | $lhs->$lhsLinkName->addBean($rhs); |
148 | 148 | $this->callBeforeAdd($lhs, $rhs, $lhsLinkName); |
149 | 149 | |
@@ -205,14 +205,14 @@ discard block |
||
205 | 205 | ); |
206 | 206 | |
207 | 207 | |
208 | - if (!empty($this->def['relationship_role_column']) && !empty($this->def['relationship_role_column_value']) && !$this->ignore_role_filter ) |
|
208 | + if (!empty($this->def['relationship_role_column']) && !empty($this->def['relationship_role_column_value']) && !$this->ignore_role_filter) |
|
209 | 209 | { |
210 | 210 | $row[$this->relationship_role_column] = $this->relationship_role_column_value; |
211 | 211 | } |
212 | 212 | |
213 | 213 | if (!empty($this->def['fields'])) |
214 | 214 | { |
215 | - foreach($this->def['fields'] as $fieldDef) |
|
215 | + foreach ($this->def['fields'] as $fieldDef) |
|
216 | 216 | { |
217 | 217 | if (!empty($fieldDef['name']) && !isset($row[$fieldDef['name']]) && !empty($fieldDef['default'])) |
218 | 218 | { |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | |
247 | 247 | public function remove($lhs, $rhs) |
248 | 248 | { |
249 | - if(!($lhs instanceof SugarBean) || !($rhs instanceof SugarBean)) { |
|
249 | + if (!($lhs instanceof SugarBean) || !($rhs instanceof SugarBean)) { |
|
250 | 250 | $GLOBALS['log']->fatal("LHS and RHS must be beans"); |
251 | 251 | return false; |
252 | 252 | } |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | //Need to hijack this as security groups will not contain a link on the module side |
267 | 267 | //due to the way the module works. Plus it would remove the relative ease of adding custom module support |
268 | 268 | |
269 | - if(get_class($lhs) == 'SecurityGroup' || get_class($rhs) == 'SecurityGroup') { |
|
269 | + if (get_class($lhs) == 'SecurityGroup' || get_class($rhs) == 'SecurityGroup') { |
|
270 | 270 | $dataToRemove = array( |
271 | 271 | $this->def['join_key_lhs'] => $lhs->id, |
272 | 272 | $this->def['join_key_rhs'] => $rhs->id |
@@ -426,12 +426,12 @@ discard block |
||
426 | 426 | } |
427 | 427 | $rel_table = $this->getRelationshipTable(); |
428 | 428 | |
429 | - $where = "$rel_table.$knownKey = '{$link->getFocus()->id}'" . $this->getRoleWhere(); |
|
429 | + $where = "$rel_table.$knownKey = '{$link->getFocus()->id}'".$this->getRoleWhere(); |
|
430 | 430 | $order_by = ''; |
431 | 431 | |
432 | 432 | //Add any optional where clause |
433 | 433 | if (!empty($params['where'])) { |
434 | - $add_where = is_string($params['where']) ? $params['where'] : "$whereTable." . $this->getOptionalWhereClause($params['where']); |
|
434 | + $add_where = is_string($params['where']) ? $params['where'] : "$whereTable.".$this->getOptionalWhereClause($params['where']); |
|
435 | 435 | if (!empty($add_where)) |
436 | 436 | $where .= " AND $add_where"; |
437 | 437 | } |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | } |
443 | 443 | |
444 | 444 | $deleted = !empty($params['deleted']) ? 1 : 0; |
445 | - $from = $rel_table . " "; |
|
445 | + $from = $rel_table." "; |
|
446 | 446 | if (!empty($params['where']) || !empty($params['order_by'])) { |
447 | 447 | $from .= ", $whereTable"; |
448 | 448 | if (isset($relatedSeed->custom_fields)) { |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | |
455 | 455 | if (empty($params['return_as_array'])) { |
456 | 456 | $query = "SELECT $targetKey id FROM $from WHERE $where AND $rel_table.deleted=$deleted"; |
457 | - if(!empty($order_by)) $query .= ' ORDER BY '.$order_by; |
|
457 | + if (!empty($order_by)) $query .= ' ORDER BY '.$order_by; |
|
458 | 458 | //Limit is not compatible with return_as_array |
459 | 459 | if (!empty($params['limit']) && $params['limit'] > 0) { |
460 | 460 | $offset = isset($params['offset']) ? $params['offset'] : 0; |
@@ -488,19 +488,19 @@ discard block |
||
488 | 488 | $targetTable = $linkIsLHS ? $this->def['rhs_table'] : $this->def['lhs_table']; |
489 | 489 | $targetTableWithAlias = $targetTable; |
490 | 490 | $targetKey = $linkIsLHS ? $this->def['rhs_key'] : $this->def['lhs_key']; |
491 | - $join_type= isset($params['join_type']) ? $params['join_type'] : ' INNER JOIN '; |
|
491 | + $join_type = isset($params['join_type']) ? $params['join_type'] : ' INNER JOIN '; |
|
492 | 492 | |
493 | 493 | $join = ''; |
494 | 494 | |
495 | 495 | //Set up any table aliases required |
496 | 496 | if (!empty($params['join_table_link_alias'])) |
497 | 497 | { |
498 | - $joinTableWithAlias = $joinTable . " ". $params['join_table_link_alias']; |
|
498 | + $joinTableWithAlias = $joinTable." ".$params['join_table_link_alias']; |
|
499 | 499 | $joinTable = $params['join_table_link_alias']; |
500 | 500 | } |
501 | - if ( ! empty($params['join_table_alias'])) |
|
501 | + if (!empty($params['join_table_alias'])) |
|
502 | 502 | { |
503 | - $targetTableWithAlias = $targetTable . " ". $params['join_table_alias']; |
|
503 | + $targetTableWithAlias = $targetTable." ".$params['join_table_alias']; |
|
504 | 504 | $targetTable = $params['join_table_alias']; |
505 | 505 | } |
506 | 506 | |
@@ -512,11 +512,11 @@ discard block |
||
512 | 512 | //First join the relationship table |
513 | 513 | $join .= "$join_type $joinTableWithAlias ON $join1 AND $joinTable.deleted=0\n" |
514 | 514 | //Next add any role filters |
515 | - . $this->getRoleWhere($joinTable) . "\n" |
|
515 | + . $this->getRoleWhere($joinTable)."\n" |
|
516 | 516 | //Then finally join the related module's table |
517 | 517 | . "$join_type $targetTableWithAlias ON $join2 AND $targetTable.deleted=0\n"; |
518 | 518 | |
519 | - if($return_array){ |
|
519 | + if ($return_array) { |
|
520 | 520 | return array( |
521 | 521 | 'join' => $join, |
522 | 522 | 'type' => $this->type, |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | 'select' => "$targetTable.id", |
527 | 527 | ); |
528 | 528 | } |
529 | - return $join . $where; |
|
529 | + return $join.$where; |
|
530 | 530 | } |
531 | 531 | |
532 | 532 | /** |
@@ -540,21 +540,21 @@ discard block |
||
540 | 540 | public function getSubpanelQuery($link, $params = array(), $return_array = false) |
541 | 541 | { |
542 | 542 | $targetIsLHS = $link->getSide() == REL_RHS; |
543 | - $startingTable = $targetIsLHS ? $this->def['lhs_table'] : $this->def['rhs_table'];; |
|
543 | + $startingTable = $targetIsLHS ? $this->def['lhs_table'] : $this->def['rhs_table']; ; |
|
544 | 544 | $startingKey = $targetIsLHS ? $this->def['lhs_key'] : $this->def['rhs_key']; |
545 | 545 | $startingJoinKey = $targetIsLHS ? $this->def['join_key_lhs'] : $this->def['join_key_rhs']; |
546 | 546 | $joinTable = $this->getRelationshipTable(); |
547 | 547 | $joinTableWithAlias = $joinTable; |
548 | 548 | $joinKey = $targetIsLHS ? $this->def['join_key_rhs'] : $this->def['join_key_lhs']; |
549 | 549 | $targetKey = $targetIsLHS ? $this->def['rhs_key'] : $this->def['lhs_key']; |
550 | - $join_type= isset($params['join_type']) ? $params['join_type'] : ' INNER JOIN '; |
|
550 | + $join_type = isset($params['join_type']) ? $params['join_type'] : ' INNER JOIN '; |
|
551 | 551 | |
552 | 552 | $query = ''; |
553 | 553 | |
554 | 554 | //Set up any table aliases required |
555 | 555 | if (!empty($params['join_table_link_alias'])) |
556 | 556 | { |
557 | - $joinTableWithAlias = $joinTable . " ". $params['join_table_link_alias']; |
|
557 | + $joinTableWithAlias = $joinTable." ".$params['join_table_link_alias']; |
|
558 | 558 | $joinTable = $params['join_table_link_alias']; |
559 | 559 | } |
560 | 560 | |
@@ -566,12 +566,12 @@ discard block |
||
566 | 566 | //First join the relationship table |
567 | 567 | $query .= "$join_type $joinTableWithAlias ON $where AND $joinTable.deleted=0\n" |
568 | 568 | //Next add any role filters |
569 | - . $this->getRoleWhere($joinTable, $ignoreRole) . "\n"; |
|
569 | + . $this->getRoleWhere($joinTable, $ignoreRole)."\n"; |
|
570 | 570 | |
571 | 571 | if (!empty($params['return_as_array'])) { |
572 | 572 | $return_array = true; |
573 | 573 | } |
574 | - if($return_array){ |
|
574 | + if ($return_array) { |
|
575 | 575 | return array( |
576 | 576 | 'join' => $query, |
577 | 577 | 'type' => $this->type, |
@@ -594,11 +594,11 @@ discard block |
||
594 | 594 | //role column value. |
595 | 595 | if (empty($this->relationship_role_column_value)) |
596 | 596 | { |
597 | - $ret.=' IS NULL'; |
|
597 | + $ret .= ' IS NULL'; |
|
598 | 598 | } else { |
599 | - $ret.= "='".$this->relationship_role_column_value."'"; |
|
599 | + $ret .= "='".$this->relationship_role_column_value."'"; |
|
600 | 600 | } |
601 | - $ret.= "\n"; |
|
601 | + $ret .= "\n"; |
|
602 | 602 | } |
603 | 603 | return $ret; |
604 | 604 | } |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | $query = "SELECT id FROM {$this->getRelationshipTable()} WHERE {$this->join_key_lhs} = '{$lhs->id}' AND {$this->join_key_rhs} = '{$rhs->id}'"; |
614 | 614 | |
615 | 615 | //Roles can allow for multiple links between two records with different roles |
616 | - $query .= $this->getRoleWhere() . " and deleted = 0"; |
|
616 | + $query .= $this->getRoleWhere()." and deleted = 0"; |
|
617 | 617 | |
618 | 618 | return $GLOBALS['db']->getOne($query); |
619 | 619 | } |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | { |
639 | 639 | if (!empty($this->def['table'])) |
640 | 640 | return $this->def['table']; |
641 | - else if(!empty($this->def['join_table'])) |
|
641 | + else if (!empty($this->def['join_table'])) |
|
642 | 642 | return $this->def['join_table']; |
643 | 643 | |
644 | 644 | return false; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | $related = $link->getBeans(); |
153 | 153 | |
154 | 154 | // Clear the relations from many side bean |
155 | - foreach($related as $relBean) { |
|
155 | + foreach ($related as $relBean) { |
|
156 | 156 | $this->remove($focus, $relBean); |
157 | 157 | } |
158 | 158 | } else { // For non self-referencing, remove all the relationships from the many (RHS) side |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | protected $relationships; |
53 | 53 | |
54 | - protected function __construct(){ |
|
54 | + protected function __construct() { |
|
55 | 55 | //Load the relationship definitions from the cache. |
56 | 56 | $this->loadRelationships(); |
57 | 57 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | public static function deleteCache() |
76 | 76 | { |
77 | 77 | $file = self::getInstance()->getCacheFile(); |
78 | - if(sugar_is_file($file)) |
|
78 | + if (sugar_is_file($file)) |
|
79 | 79 | { |
80 | 80 | unlink($file); |
81 | 81 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $def = $this->relationships[$relationshipName]; |
99 | 99 | |
100 | 100 | $type = isset($def['true_relationship_type']) ? $def['true_relationship_type'] : $def['relationship_type']; |
101 | - switch($type) |
|
101 | + switch ($type) |
|
102 | 102 | { |
103 | 103 | case "many-to-many": |
104 | 104 | if (isset($def['rhs_module']) && $def['rhs_module'] == 'EmailAddresses') |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | case "one-to-many": |
113 | 113 | require_once("data/Relationships/One2MBeanRelationship.php"); |
114 | 114 | //If a relationship has no table or join keys, it must be bean based |
115 | - if (empty($def['true_relationship_type']) || (empty($def['table']) && empty($def['join_table'])) || empty($def['join_key_rhs'])){ |
|
115 | + if (empty($def['true_relationship_type']) || (empty($def['table']) && empty($def['join_table'])) || empty($def['join_key_rhs'])) { |
|
116 | 116 | return new One2MBeanRelationship($def); |
117 | 117 | } |
118 | 118 | else { |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | } |
121 | 121 | break; |
122 | 122 | case "one-to-one": |
123 | - if (empty($def['true_relationship_type'])){ |
|
123 | + if (empty($def['true_relationship_type'])) { |
|
124 | 124 | require_once("data/Relationships/One2OneBeanRelationship.php"); |
125 | 125 | return new One2OneBeanRelationship($def); |
126 | 126 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | break; |
132 | 132 | } |
133 | 133 | |
134 | - $GLOBALS['log']->fatal ("$relationshipName had an unknown type $type "); |
|
134 | + $GLOBALS['log']->fatal("$relationshipName had an unknown type $type "); |
|
135 | 135 | |
136 | 136 | return false; |
137 | 137 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | |
150 | 150 | protected function loadRelationships() |
151 | 151 | { |
152 | - if(sugar_is_file($this->getCacheFile())) |
|
152 | + if (sugar_is_file($this->getCacheFile())) |
|
153 | 153 | { |
154 | 154 | include($this->getCacheFile()); |
155 | 155 | $this->relationships = $relationships; |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | if (empty($beanList)) |
170 | 170 | include("include/modules.php"); |
171 | 171 | //Reload ALL the module vardefs.... |
172 | - foreach($beanList as $moduleName => $beanName) |
|
172 | + foreach ($beanList as $moduleName => $beanName) |
|
173 | 173 | { |
174 | 174 | VardefManager::loadVardef($moduleName, BeanFactory::getObjectName($moduleName), false, array( |
175 | 175 | //If relationships are not yet loaded, we can't figure out the rel_calc_fields. |
@@ -184,13 +184,13 @@ discard block |
||
184 | 184 | { |
185 | 185 | if (!empty($def['relationships'])) |
186 | 186 | { |
187 | - foreach($def['relationships'] as $relKey => $relDef) |
|
187 | + foreach ($def['relationships'] as $relKey => $relDef) |
|
188 | 188 | { |
189 | 189 | if ($key == $relKey) //Relationship only entry, we need to capture everything |
190 | 190 | $relationships[$key] = array_merge(array('name' => $key), (array)$def, (array)$relDef); |
191 | 191 | else { |
192 | 192 | $relationships[$relKey] = array_merge(array('name' => $relKey), (array)$relDef); |
193 | - if(!empty($relationships[$relKey]['join_table']) && empty($relationships[$relKey]['fields']) |
|
193 | + if (!empty($relationships[$relKey]['join_table']) && empty($relationships[$relKey]['fields']) |
|
194 | 194 | && isset($dictionary[$relationships[$relKey]['join_table']]['fields'])) { |
195 | 195 | $relationships[$relKey]['fields'] = $dictionary[$relationships[$relKey]['join_table']]['fields']; |
196 | 196 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | } |
201 | 201 | //Save it out |
202 | 202 | sugar_mkdir(dirname($this->getCacheFile()), null, true); |
203 | - $out = "<?php \n \$relationships = " . var_export($relationships, true) . ";"; |
|
203 | + $out = "<?php \n \$relationships = ".var_export($relationships, true).";"; |
|
204 | 204 | sugar_file_put_contents_atomic($this->getCacheFile(), $out); |
205 | 205 | |
206 | 206 | $this->relationships = $relationships; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | } else { |
154 | 154 | $roleCheck .= " AND $table.bean_module"; |
155 | 155 | } |
156 | - $roleCheck .= " = '" . $this->getLHSModule() . "'"; |
|
156 | + $roleCheck .= " = '".$this->getLHSModule()."'"; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | return $roleCheck; |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // config|_override.php |
4 | -if(is_file('../../../config.php')) { |
|
4 | +if (is_file('../../../config.php')) { |
|
5 | 5 | require_once('../../../config.php'); |
6 | 6 | } |
7 | 7 | |
8 | 8 | // load up the config_override.php file. This is used to provide default user settings |
9 | -if(is_file('../../../config_override.php')) { |
|
9 | +if (is_file('../../../config_override.php')) { |
|
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'])) return; |
|
14 | 14 | |
15 | 15 | //set file type back to css from php |
16 | 16 | header("Content-type: text/css; charset: UTF-8"); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | /* Top navigation bar CSS */ |
44 | 44 | |
45 | 45 | .navbar-inverse { |
46 | -background:#<?php echo $sugar_config['theme_settings']['SuiteR']['navbar'];?> !important; |
|
46 | +background:#<?php echo $sugar_config['theme_settings']['SuiteR']['navbar']; ?> !important; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | .headerlinks a:link, .headerlinks a:visited, .navbar-inverse .navbar-brand, .moremenu a, a[id^=grouptab], a[id^=moduleTab] { |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | #searchform .btn |
73 | 73 | { |
74 | -background:#<?php echo $sugar_config['theme_settings']['SuiteR']['navbar'];?>; |
|
74 | +background:#<?php echo $sugar_config['theme_settings']['SuiteR']['navbar']; ?>; |
|
75 | 75 | color: #<?php echo $sugar_config['theme_settings']['SuiteR']['icon']; ?>; |
76 | 76 | } |
77 | 77 |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // config|_override.php |
4 | -if(is_file('../../../config.php')) { |
|
4 | +if (is_file('../../../config.php')) { |
|
5 | 5 | require_once('../../../config.php'); |
6 | 6 | } |
7 | 7 | |
8 | 8 | // load up the config_override.php file. This is used to provide default user settings |
9 | -if(is_file('../../../config_override.php')) { |
|
9 | +if (is_file('../../../config_override.php')) { |
|
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'])) return; |
|
14 | 14 | |
15 | 15 | //set file type back to css from php |
16 | 16 | header("Content-type: text/css; charset: UTF-8"); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | - if(!defined('sugarEntry'))define('sugarEntry', true); |
|
2 | + if (!defined('sugarEntry'))define('sugarEntry', true); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $server->configureWSDL('sugarsoap', $NAMESPACE, $sugar_config['site_url'].'/soap.php'); |
65 | 65 | |
66 | 66 | //New API is in these files |
67 | -if(!empty($administrator->settings['portal_on'])) { |
|
67 | +if (!empty($administrator->settings['portal_on'])) { |
|
68 | 68 | require_once('soap/SoapPortalUsers.php'); |
69 | 69 | } |
70 | 70 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | /* Begin the HTTP listener service and exit. */ |
79 | 79 | ob_clean(); |
80 | 80 | |
81 | -if (!isset($HTTP_RAW_POST_DATA)){ |
|
81 | +if (!isset($HTTP_RAW_POST_DATA)) { |
|
82 | 82 | $HTTP_RAW_POST_DATA = file_get_contents('php://input'); |
83 | 83 | } |
84 | 84 | |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | $resourceManager->setup('Soap'); |
88 | 88 | $observers = $resourceManager->getObservers(); |
89 | 89 | //Call set_soap_server for SoapResourceObserver instance(s) |
90 | -foreach($observers as $observer) { |
|
91 | - if(method_exists($observer, 'set_soap_server')) { |
|
90 | +foreach ($observers as $observer) { |
|
91 | + if (method_exists($observer, 'set_soap_server')) { |
|
92 | 92 | $observer->set_soap_server($server); |
93 | 93 | } |
94 | 94 | } |