@@ -131,28 +131,28 @@ discard block |
||
131 | 131 | $lhsLinkName = $this->lhsLink; |
132 | 132 | $rhsLinkName = $this->rhsLink; |
133 | 133 | |
134 | - /* BEGIN - SECURITY GROUPS */ |
|
135 | - //Need to hijack this as security groups will not contain a link on the module side |
|
136 | - //due to the way the module works. Plus it would remove the relative ease of adding custom module support |
|
134 | + /* BEGIN - SECURITY GROUPS */ |
|
135 | + //Need to hijack this as security groups will not contain a link on the module side |
|
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') { |
|
139 | - $rhs->$rhsLinkName->addBean($lhs); |
|
140 | - $this->callBeforeAdd($rhs, $lhs, $rhsLinkName); |
|
141 | - |
|
142 | - $dataToInsert = $this->getRowToInsert($lhs, $rhs, $additionalFields); |
|
143 | - $this->addRow($dataToInsert); |
|
144 | - $rhs->$rhsLinkName->addBean($lhs); |
|
145 | - $this->callAfterAdd($lhs, $rhs, $lhsLinkName); |
|
146 | - } else if(get_class($lhs) != 'User' && get_class($lhs) != 'ACLRole' && get_class($rhs) == 'SecurityGroup') { |
|
147 | - $lhs->$lhsLinkName->addBean($rhs); |
|
148 | - $this->callBeforeAdd($lhs, $rhs, $lhsLinkName); |
|
149 | - |
|
150 | - $dataToInsert = $this->getRowToInsert($lhs, $rhs, $additionalFields); |
|
151 | - $this->addRow($dataToInsert); |
|
152 | - $lhs->$lhsLinkName->addBean($rhs); |
|
153 | - $this->callAfterAdd($rhs, $lhs, $rhsLinkName); |
|
154 | - } else { |
|
155 | - /* END - SECURITY GROUPS */ |
|
138 | + if(get_class($rhs) != 'User' && get_class($rhs) != 'ACLRole' && get_class($lhs) == 'SecurityGroup') { |
|
139 | + $rhs->$rhsLinkName->addBean($lhs); |
|
140 | + $this->callBeforeAdd($rhs, $lhs, $rhsLinkName); |
|
141 | + |
|
142 | + $dataToInsert = $this->getRowToInsert($lhs, $rhs, $additionalFields); |
|
143 | + $this->addRow($dataToInsert); |
|
144 | + $rhs->$rhsLinkName->addBean($lhs); |
|
145 | + $this->callAfterAdd($lhs, $rhs, $lhsLinkName); |
|
146 | + } else if(get_class($lhs) != 'User' && get_class($lhs) != 'ACLRole' && get_class($rhs) == 'SecurityGroup') { |
|
147 | + $lhs->$lhsLinkName->addBean($rhs); |
|
148 | + $this->callBeforeAdd($lhs, $rhs, $lhsLinkName); |
|
149 | + |
|
150 | + $dataToInsert = $this->getRowToInsert($lhs, $rhs, $additionalFields); |
|
151 | + $this->addRow($dataToInsert); |
|
152 | + $lhs->$lhsLinkName->addBean($rhs); |
|
153 | + $this->callAfterAdd($rhs, $lhs, $rhsLinkName); |
|
154 | + } else { |
|
155 | + /* END - SECURITY GROUPS */ |
|
156 | 156 | |
157 | 157 | if (empty($lhs->$lhsLinkName) && !$lhs->load_relationship($lhsLinkName)) |
158 | 158 | { |
@@ -262,50 +262,50 @@ discard block |
||
262 | 262 | return false; |
263 | 263 | } |
264 | 264 | |
265 | - /* BEGIN - SECURITY GROUPS */ |
|
266 | - //Need to hijack this as security groups will not contain a link on the module side |
|
267 | - //due to the way the module works. Plus it would remove the relative ease of adding custom module support |
|
265 | + /* BEGIN - SECURITY GROUPS */ |
|
266 | + //Need to hijack this as security groups will not contain a link on the module side |
|
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') { |
|
270 | - $dataToRemove = array( |
|
271 | - $this->def['join_key_lhs'] => $lhs->id, |
|
272 | - $this->def['join_key_rhs'] => $rhs->id |
|
273 | - ); |
|
274 | - |
|
275 | - |
|
276 | - if (empty($_SESSION['disable_workflow']) || $_SESSION['disable_workflow'] != "Yes") |
|
277 | - { |
|
278 | - if (get_class($lhs) != 'SecurityGroup' && $lhs->$lhsLinkName instanceof Link2) |
|
279 | - { |
|
280 | - $lhs->$lhsLinkName->load(); |
|
281 | - $this->callBeforeDelete($lhs, $rhs, $lhsLinkName); |
|
282 | - } |
|
283 | - |
|
284 | - if (get_class($rhs) != 'SecurityGroup' && $rhs->$rhsLinkName instanceof Link2) |
|
285 | - { |
|
286 | - $rhs->$rhsLinkName->load(); |
|
287 | - $this->callBeforeDelete($rhs, $lhs, $rhsLinkName); |
|
288 | - } |
|
289 | - } |
|
290 | - |
|
291 | - $this->removeRow($dataToRemove); |
|
269 | + if(get_class($lhs) == 'SecurityGroup' || get_class($rhs) == 'SecurityGroup') { |
|
270 | + $dataToRemove = array( |
|
271 | + $this->def['join_key_lhs'] => $lhs->id, |
|
272 | + $this->def['join_key_rhs'] => $rhs->id |
|
273 | + ); |
|
274 | + |
|
275 | + |
|
276 | + if (empty($_SESSION['disable_workflow']) || $_SESSION['disable_workflow'] != "Yes") |
|
277 | + { |
|
278 | + if (get_class($lhs) != 'SecurityGroup' && $lhs->$lhsLinkName instanceof Link2) |
|
279 | + { |
|
280 | + $lhs->$lhsLinkName->load(); |
|
281 | + $this->callBeforeDelete($lhs, $rhs, $lhsLinkName); |
|
282 | + } |
|
283 | + |
|
284 | + if (get_class($rhs) != 'SecurityGroup' && $rhs->$rhsLinkName instanceof Link2) |
|
285 | + { |
|
286 | + $rhs->$rhsLinkName->load(); |
|
287 | + $this->callBeforeDelete($rhs, $lhs, $rhsLinkName); |
|
288 | + } |
|
289 | + } |
|
290 | + |
|
291 | + $this->removeRow($dataToRemove); |
|
292 | 292 | |
293 | - if (empty($_SESSION['disable_workflow']) || $_SESSION['disable_workflow'] != "Yes") |
|
294 | - { |
|
295 | - if (get_class($lhs) != 'SecurityGroup' && $lhs->$lhsLinkName instanceof Link2) |
|
296 | - { |
|
297 | - $lhs->$lhsLinkName->load(); |
|
298 | - $this->callAfterDelete($lhs, $rhs, $lhsLinkName); |
|
299 | - } |
|
300 | - |
|
301 | - if (get_class($rhs) != 'SecurityGroup' && $rhs->$rhsLinkName instanceof Link2) |
|
302 | - { |
|
303 | - $rhs->$rhsLinkName->load(); |
|
304 | - $this->callAfterDelete($rhs, $lhs, $rhsLinkName); |
|
305 | - } |
|
306 | - } |
|
307 | - } else { |
|
308 | - /* END - SECURITY GROUPS */ |
|
293 | + if (empty($_SESSION['disable_workflow']) || $_SESSION['disable_workflow'] != "Yes") |
|
294 | + { |
|
295 | + if (get_class($lhs) != 'SecurityGroup' && $lhs->$lhsLinkName instanceof Link2) |
|
296 | + { |
|
297 | + $lhs->$lhsLinkName->load(); |
|
298 | + $this->callAfterDelete($lhs, $rhs, $lhsLinkName); |
|
299 | + } |
|
300 | + |
|
301 | + if (get_class($rhs) != 'SecurityGroup' && $rhs->$rhsLinkName instanceof Link2) |
|
302 | + { |
|
303 | + $rhs->$rhsLinkName->load(); |
|
304 | + $this->callAfterDelete($rhs, $lhs, $rhsLinkName); |
|
305 | + } |
|
306 | + } |
|
307 | + } else { |
|
308 | + /* END - SECURITY GROUPS */ |
|
309 | 309 | if (empty($lhs->$lhsLinkName) && !$lhs->load_relationship($lhsLinkName)) |
310 | 310 | { |
311 | 311 | $GLOBALS['log']->fatal("could not load LHS $lhsLinkName"); |
@@ -512,9 +512,9 @@ 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 | - . "$join_type $targetTableWithAlias ON $join2 AND $targetTable.deleted=0\n"; |
|
517 | + . "$join_type $targetTableWithAlias ON $join2 AND $targetTable.deleted=0\n"; |
|
518 | 518 | |
519 | 519 | if($return_array){ |
520 | 520 | return array( |
@@ -566,7 +566,7 @@ 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; |
@@ -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,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'), |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | ); |
101 | 101 | if (!isset($this->lhsLinkDef['name']) && isset($this->lhsLinkDef[0])) |
102 | 102 | { |
103 | - $this->lhsLinkDef = $this->lhsLinkDef[0]; |
|
103 | + $this->lhsLinkDef = $this->lhsLinkDef[0]; |
|
104 | 104 | } |
105 | 105 | if (!isset($this->rhsLinkDef['name']) && isset($this->rhsLinkDef[0])) { |
106 | 106 | $this->rhsLinkDef = $this->rhsLinkDef[0]; |
@@ -128,35 +128,35 @@ discard block |
||
128 | 128 | //If the current data matches the existing data, don't do anything |
129 | 129 | if (!$this->checkExisting($dataToInsert)) |
130 | 130 | { |
131 | - // Pre-load the RHS relationship, which is used later in the add() function and expects a Bean |
|
132 | - // and we also use it for clearing relationships in case of non self-referencing O2M relations |
|
133 | - // (should be preloaded because when using the relate_to field for updating/saving relationships, |
|
134 | - // only the bean id is loaded into $rhs->$rhsLinkName) |
|
135 | - $rhsLinkName = $this->rhsLink; |
|
136 | - $rhs->load_relationship($rhsLinkName); |
|
131 | + // Pre-load the RHS relationship, which is used later in the add() function and expects a Bean |
|
132 | + // and we also use it for clearing relationships in case of non self-referencing O2M relations |
|
133 | + // (should be preloaded because when using the relate_to field for updating/saving relationships, |
|
134 | + // only the bean id is loaded into $rhs->$rhsLinkName) |
|
135 | + $rhsLinkName = $this->rhsLink; |
|
136 | + $rhs->load_relationship($rhsLinkName); |
|
137 | 137 | |
138 | - // If it's a One2Many self-referencing relationship |
|
139 | - // the positions of the default One (LHS) and Many (RHS) are swaped |
|
140 | - // so we should clear the links from the many (left) side |
|
141 | - if ($this->selfReferencing) { |
|
142 | - // Load right hand side relationship name |
|
143 | - $linkName = $this->rhsLink; |
|
144 | - // Load the relationship into the left hand side bean |
|
145 | - $lhs->load_relationship($linkName); |
|
138 | + // If it's a One2Many self-referencing relationship |
|
139 | + // the positions of the default One (LHS) and Many (RHS) are swaped |
|
140 | + // so we should clear the links from the many (left) side |
|
141 | + if ($this->selfReferencing) { |
|
142 | + // Load right hand side relationship name |
|
143 | + $linkName = $this->rhsLink; |
|
144 | + // Load the relationship into the left hand side bean |
|
145 | + $lhs->load_relationship($linkName); |
|
146 | 146 | |
147 | - // Pick the loaded link |
|
148 | - $link = $lhs->$linkName; |
|
149 | - // Get many (LHS) side bean |
|
150 | - $focus = $link->getFocus(); |
|
151 | - // Get relations |
|
152 | - $related = $link->getBeans(); |
|
147 | + // Pick the loaded link |
|
148 | + $link = $lhs->$linkName; |
|
149 | + // Get many (LHS) side bean |
|
150 | + $focus = $link->getFocus(); |
|
151 | + // Get relations |
|
152 | + $related = $link->getBeans(); |
|
153 | 153 | |
154 | - // Clear the relations from many side bean |
|
155 | - foreach($related as $relBean) { |
|
156 | - $this->remove($focus, $relBean); |
|
157 | - } |
|
154 | + // Clear the relations from many side bean |
|
155 | + foreach($related as $relBean) { |
|
156 | + $this->remove($focus, $relBean); |
|
157 | + } |
|
158 | 158 | } else { // For non self-referencing, remove all the relationships from the many (RHS) side |
159 | - $this->removeAll($rhs->$rhsLinkName); |
|
159 | + $this->removeAll($rhs->$rhsLinkName); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | // Add relationship |
@@ -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,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") |
@@ -213,9 +213,9 @@ |
||
213 | 213 | $buildingRelCache = false; |
214 | 214 | } |
215 | 215 | |
216 | - protected function getCacheFile() { |
|
217 | - return sugar_cached("Relationships/relationships.cache.php"); |
|
218 | - } |
|
216 | + protected function getCacheFile() { |
|
217 | + return sugar_cached("Relationships/relationships.cache.php"); |
|
218 | + } |
|
219 | 219 | |
220 | 220 | |
221 | 221 |
@@ -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,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,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,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"); |
@@ -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"); |
@@ -33,21 +33,21 @@ discard block |
||
33 | 33 | /* Dashlet CSS */ |
34 | 34 | |
35 | 35 | .dashletPanel .h3Row{ |
36 | -background: #<?php echo $sugar_config['theme_settings']['SuiteR']['dashlet'];?>; |
|
36 | +background: #<?php echo $sugar_config['theme_settings']['SuiteR']['dashlet']; ?>; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | .dashletPanel .h3Row h3{ |
40 | -color: #<?php echo $sugar_config['theme_settings']['SuiteR']['dashlet_headertext'];?> !important; |
|
40 | +color: #<?php echo $sugar_config['theme_settings']['SuiteR']['dashlet_headertext']; ?> !important; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | .dashletPanel .h3Row .dashletToolSet .icon{ |
44 | -fill: #<?php echo $sugar_config['theme_settings']['SuiteR']['dashlet_headertext'];?> !important; |
|
44 | +fill: #<?php echo $sugar_config['theme_settings']['SuiteR']['dashlet_headertext']; ?> !important; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /* Top navigation bar CSS */ |
48 | 48 | |
49 | 49 | .navbar-inverse { |
50 | -background:#<?php echo $sugar_config['theme_settings']['SuiteR']['navbar'];?> !important; |
|
50 | +background:#<?php echo $sugar_config['theme_settings']['SuiteR']['navbar']; ?> !important; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | .headerlinks a:link, .headerlinks a:visited, .navbar-inverse .navbar-brand, .moremenu a, a[id^=grouptab], a[id^=moduleTab] { |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | |
76 | 76 | #searchform .btn |
77 | 77 | { |
78 | -background:#<?php echo $sugar_config['theme_settings']['SuiteR']['navbar'];?> !important; |
|
79 | -color: #<?php echo $sugar_config['theme_settings']['SuiteR']['icon'];?> !important; |
|
78 | +background:#<?php echo $sugar_config['theme_settings']['SuiteR']['navbar']; ?> !important; |
|
79 | +color: #<?php echo $sugar_config['theme_settings']['SuiteR']['icon']; ?> !important; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | #usermenu a{ |
@@ -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"); |
@@ -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"); |
@@ -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. |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | //New API is in these files |
67 | 67 | if(!empty($administrator->settings['portal_on'])) { |
68 | - require_once('soap/SoapPortalUsers.php'); |
|
68 | + require_once('soap/SoapPortalUsers.php'); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | require_once('soap/SoapSugarUsers.php'); |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | $observers = $resourceManager->getObservers(); |
89 | 89 | //Call set_soap_server for SoapResourceObserver instance(s) |
90 | 90 | foreach($observers as $observer) { |
91 | - if(method_exists($observer, 'set_soap_server')) { |
|
92 | - $observer->set_soap_server($server); |
|
93 | - } |
|
91 | + if(method_exists($observer, 'set_soap_server')) { |
|
92 | + $observer->set_soap_server($server); |
|
93 | + } |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; |
@@ -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 | } |
@@ -1,6 +1,8 @@ |
||
1 | 1 | <?php |
2 | - if(!defined('sugarEntry'))define('sugarEntry', true); |
|
3 | -/********************************************************************************* |
|
2 | + if(!defined('sugarEntry')) { |
|
3 | + define('sugarEntry', true); |
|
4 | + } |
|
5 | + /********************************************************************************* |
|
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
6 | 8 |
@@ -40,26 +40,26 @@ discard block |
||
40 | 40 | |
41 | 41 | |
42 | 42 | $default_modules_sources = array ( |
43 | - 'Accounts' => |
|
44 | - array ( |
|
45 | - 'ext_rest_insideview' => 'ext_rest_insideview', |
|
46 | - ), |
|
47 | - 'Contacts' => |
|
48 | - array ( |
|
49 | - 'ext_rest_insideview' => 'ext_rest_insideview', |
|
50 | - ), |
|
51 | - 'Leads' => |
|
52 | - array ( |
|
53 | - 'ext_rest_insideview' => 'ext_rest_insideview', |
|
54 | - ), |
|
55 | - 'Prospects' => |
|
56 | - array ( |
|
43 | + 'Accounts' => |
|
44 | + array ( |
|
45 | + 'ext_rest_insideview' => 'ext_rest_insideview', |
|
46 | + ), |
|
47 | + 'Contacts' => |
|
48 | + array ( |
|
49 | + 'ext_rest_insideview' => 'ext_rest_insideview', |
|
50 | + ), |
|
51 | + 'Leads' => |
|
52 | + array ( |
|
53 | + 'ext_rest_insideview' => 'ext_rest_insideview', |
|
54 | + ), |
|
55 | + 'Prospects' => |
|
56 | + array ( |
|
57 | 57 | |
58 | - ), |
|
59 | - 'Opportunities' => |
|
60 | - array ( |
|
58 | + ), |
|
59 | + 'Opportunities' => |
|
60 | + array ( |
|
61 | 61 | 'ext_rest_insideview' => 'ext_rest_insideview', |
62 | - ), |
|
62 | + ), |
|
63 | 63 | ); |
64 | 64 | |
65 | 65 | $previous_connectors = array(); |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | } |
104 | 104 | |
105 | 105 | if(!file_exists('custom/modules/Connectors/metadata')) { |
106 | - mkdir_recursive('custom/modules/Connectors/metadata'); |
|
106 | + mkdir_recursive('custom/modules/Connectors/metadata'); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | if(!write_array_to_file('modules_sources', $default_modules_sources, 'custom/modules/Connectors/metadata/display_config.php')) { |
110 | - $GLOBALS['log']->fatal('Cannot write file custom/modules/Connectors/metadata/display_config.php'); |
|
110 | + $GLOBALS['log']->fatal('Cannot write file custom/modules/Connectors/metadata/display_config.php'); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | ?> |
@@ -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. |
@@ -39,34 +39,34 @@ discard block |
||
39 | 39 | ********************************************************************************/ |
40 | 40 | |
41 | 41 | |
42 | -$default_modules_sources = array ( |
|
42 | +$default_modules_sources = array( |
|
43 | 43 | 'Accounts' => |
44 | - array ( |
|
44 | + array( |
|
45 | 45 | 'ext_rest_insideview' => 'ext_rest_insideview', |
46 | 46 | ), |
47 | 47 | 'Contacts' => |
48 | - array ( |
|
48 | + array( |
|
49 | 49 | 'ext_rest_insideview' => 'ext_rest_insideview', |
50 | 50 | ), |
51 | 51 | 'Leads' => |
52 | - array ( |
|
52 | + array( |
|
53 | 53 | 'ext_rest_insideview' => 'ext_rest_insideview', |
54 | 54 | ), |
55 | 55 | 'Prospects' => |
56 | - array ( |
|
56 | + array( |
|
57 | 57 | |
58 | 58 | ), |
59 | 59 | 'Opportunities' => |
60 | - array ( |
|
60 | + array( |
|
61 | 61 | 'ext_rest_insideview' => 'ext_rest_insideview', |
62 | 62 | ), |
63 | 63 | ); |
64 | 64 | |
65 | 65 | $previous_connectors = array(); |
66 | -if(file_exists('custom/modules/Connectors/metadata/connectors.php')){ |
|
66 | +if (file_exists('custom/modules/Connectors/metadata/connectors.php')) { |
|
67 | 67 | require('custom/modules/Connectors/metadata/connectors.php'); |
68 | 68 | |
69 | - foreach($connectors as $connector_array){ |
|
69 | + foreach ($connectors as $connector_array) { |
|
70 | 70 | $connector_id = $connector_array['id']; |
71 | 71 | $previous_connectors[$connector_id] = $connector_id; |
72 | 72 | } |
@@ -74,14 +74,14 @@ discard block |
||
74 | 74 | |
75 | 75 | // Merge in old modules the customer added instead of overriding it completely with defaults |
76 | 76 | // If they have customized their connectors modules |
77 | -if(file_exists('custom/modules/Connectors/metadata/display_config.php')){ |
|
77 | +if (file_exists('custom/modules/Connectors/metadata/display_config.php')) { |
|
78 | 78 | require('custom/modules/Connectors/metadata/display_config.php'); |
79 | 79 | |
80 | 80 | // Remove the default settings from being copied over since they already existed |
81 | - foreach($default_modules_sources as $module => $sources){ |
|
82 | - foreach($sources as $source_key => $source){ |
|
83 | - foreach($previous_connectors as $previous_connector){ |
|
84 | - if(in_array($previous_connector, $default_modules_sources[$module])){ |
|
81 | + foreach ($default_modules_sources as $module => $sources) { |
|
82 | + foreach ($sources as $source_key => $source) { |
|
83 | + foreach ($previous_connectors as $previous_connector) { |
|
84 | + if (in_array($previous_connector, $default_modules_sources[$module])) { |
|
85 | 85 | unset($default_modules_sources[$module][$previous_connector]); |
86 | 86 | } |
87 | 87 | } |
@@ -89,24 +89,24 @@ discard block |
||
89 | 89 | } |
90 | 90 | |
91 | 91 | // Merge in the new connector default settings with the current settings |
92 | - if ( isset($modules_sources) && is_array($modules_sources) ) { |
|
93 | - foreach($modules_sources as $module => $sources){ |
|
94 | - if(!empty($default_modules_sources[$module])){ |
|
92 | + if (isset($modules_sources) && is_array($modules_sources)) { |
|
93 | + foreach ($modules_sources as $module => $sources) { |
|
94 | + if (!empty($default_modules_sources[$module])) { |
|
95 | 95 | $merged = array_merge($modules_sources[$module], $default_modules_sources[$module]); |
96 | 96 | $default_modules_sources[$module] = $merged; |
97 | 97 | } |
98 | - else{ |
|
98 | + else { |
|
99 | 99 | $default_modules_sources[$module] = $modules_sources[$module]; |
100 | 100 | } |
101 | 101 | } |
102 | 102 | } |
103 | 103 | } |
104 | 104 | |
105 | -if(!file_exists('custom/modules/Connectors/metadata')) { |
|
105 | +if (!file_exists('custom/modules/Connectors/metadata')) { |
|
106 | 106 | mkdir_recursive('custom/modules/Connectors/metadata'); |
107 | 107 | } |
108 | 108 | |
109 | -if(!write_array_to_file('modules_sources', $default_modules_sources, 'custom/modules/Connectors/metadata/display_config.php')) { |
|
109 | +if (!write_array_to_file('modules_sources', $default_modules_sources, 'custom/modules/Connectors/metadata/display_config.php')) { |
|
110 | 110 | $GLOBALS['log']->fatal('Cannot write file custom/modules/Connectors/metadata/display_config.php'); |
111 | 111 | } |
112 | 112 |
@@ -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. |
@@ -94,8 +96,7 @@ discard block |
||
94 | 96 | if(!empty($default_modules_sources[$module])){ |
95 | 97 | $merged = array_merge($modules_sources[$module], $default_modules_sources[$module]); |
96 | 98 | $default_modules_sources[$module] = $merged; |
97 | - } |
|
98 | - else{ |
|
99 | + } else{ |
|
99 | 100 | $default_modules_sources[$module] = $modules_sources[$module]; |
100 | 101 | } |
101 | 102 | } |
@@ -38,16 +38,16 @@ |
||
38 | 38 | ********************************************************************************/ |
39 | 39 | |
40 | 40 | |
41 | -$action_view_map['retrievesource']= 'retrievesource'; |
|
42 | -$action_view_map['step1']= 'step1'; |
|
43 | -$action_view_map['step2']= 'step2'; |
|
41 | +$action_view_map['retrievesource'] = 'retrievesource'; |
|
42 | +$action_view_map['step1'] = 'step1'; |
|
43 | +$action_view_map['step2'] = 'step2'; |
|
44 | 44 | |
45 | 45 | //Admin main page |
46 | 46 | $action_view_map['connectorsettings'] = 'connectorsettings'; |
47 | 47 | |
48 | 48 | //Admin pages for the connector properties |
49 | 49 | $action_view_map['modifyproperties'] = 'modifyproperties'; |
50 | -$action_view_map['sourceproperties']= 'sourceproperties'; |
|
50 | +$action_view_map['sourceproperties'] = 'sourceproperties'; |
|
51 | 51 | |
52 | 52 | //Admin pages to enable/disable connector for modules |
53 | 53 | $action_view_map['modifydisplay'] = 'modifydisplay'; |