@@ -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. |
@@ -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"); |
@@ -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 |
@@ -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 | } |
@@ -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. |
@@ -60,20 +62,20 @@ discard block |
||
60 | 62 | $baseQuery = 'select id,first_name, last_name, title, email1, email2 from prospects where deleted!=1 and ('; |
61 | 63 | if(!empty($_POST[$prefix.'first_name']) && !empty($_POST[$prefix.'last_name'])){ |
62 | 64 | $query = $baseQuery ." (first_name like '". $_POST[$prefix.'first_name'] . "%' and last_name = '". $_POST[$prefix.'last_name'] ."')"; |
63 | - }else{ |
|
65 | + } else{ |
|
64 | 66 | $query = $baseQuery ." last_name = '". $_POST[$prefix.'last_name'] ."'"; |
65 | 67 | } |
66 | 68 | if(!empty($_POST[$prefix.'email1'])){ |
67 | 69 | if(empty($query)){ |
68 | 70 | $query = $baseQuery. " email1='". $_POST[$prefix.'email1'] . "' or email2 = '". $_POST[$prefix.'email1'] ."'"; |
69 | - }else { |
|
71 | + } else { |
|
70 | 72 | $query .= "or email1='". $_POST[$prefix.'email1'] . "' or email2 = '". $_POST[$prefix.'email1'] ."'"; |
71 | 73 | } |
72 | 74 | } |
73 | 75 | if(!empty($_POST[$prefix.'email2'])){ |
74 | 76 | if(empty($query)) { |
75 | 77 | $query = $baseQuery. " email1='". $_POST[$prefix.'email2'] . "' or email2 = '". $_POST[$prefix.'email2'] ."'"; |
76 | - }else{ |
|
78 | + } else{ |
|
77 | 79 | $query .= "or email1='". $_POST[$prefix.'email2'] . "' or email2 = '". $_POST[$prefix.'email2'] ."'"; |
78 | 80 | } |
79 | 81 | |
@@ -87,7 +89,9 @@ discard block |
||
87 | 89 | while($row = $db->fetchByAssoc($result)) { |
88 | 90 | $rows[] = $row; |
89 | 91 | } |
90 | - if(count($rows) > 0) return $rows; |
|
92 | + if(count($rows) > 0) { |
|
93 | + return $rows; |
|
94 | + } |
|
91 | 95 | } |
92 | 96 | return null; |
93 | 97 | } |
@@ -98,15 +102,16 @@ discard block |
||
98 | 102 | if(!empty($mod)){ |
99 | 103 | global $current_language; |
100 | 104 | $mod_strings = return_module_language($current_language, $mod); |
101 | - }else global $mod_strings; |
|
105 | + } else { |
|
106 | + global $mod_strings; |
|
107 | + } |
|
102 | 108 | global $app_strings; |
103 | 109 | $cols = sizeof($rows[0]) * 2 + 1; |
104 | 110 | if ($action != 'ShowDuplicates') |
105 | 111 | { |
106 | 112 | $form = '<table width="100%"><tr><td>'.$mod_strings['MSG_DUPLICATE']. '</td></tr><tr><td height="20"></td></tr></table>'; |
107 | 113 | $form .= "<form action='index.php' method='post' name='dupProspects'><input type='hidden' name='selectedProspect' value=''>"; |
108 | - } |
|
109 | - else |
|
114 | + } else |
|
110 | 115 | { |
111 | 116 | $form = '<table width="100%"><tr><td>'.$mod_strings['MSG_SHOW_DUPLICATES']. '</td></tr><tr><td height="20"></td></tr></table>'; |
112 | 117 | } |
@@ -132,8 +137,9 @@ discard block |
||
132 | 137 | foreach($rows as $row){ |
133 | 138 | |
134 | 139 | $form .= "<tr class='$rowColor'>"; |
135 | - if ($action != 'ShowDuplicates') |
|
136 | - $form .= "<td width='1%' nowrap='nowrap' ><a href='#' onClick=\"document.dupProspects.selectedProspect.value='${row['id']}';document.dupProspects.submit() \">[${app_strings['LBL_SELECT_BUTTON_LABEL']}]</a> </td>\n"; |
|
140 | + if ($action != 'ShowDuplicates') { |
|
141 | + $form .= "<td width='1%' nowrap='nowrap' ><a href='#' onClick=\"document.dupProspects.selectedProspect.value='${row['id']}';document.dupProspects.submit() \">[${app_strings['LBL_SELECT_BUTTON_LABEL']}]</a> </td>\n"; |
|
142 | + } |
|
137 | 143 | |
138 | 144 | $wasSet = false; |
139 | 145 | |
@@ -142,8 +148,7 @@ discard block |
||
142 | 148 | if(!$wasSet) { |
143 | 149 | $form .= "<td scope='row' ><a target='_blank' href='index.php?module=Prospects&action=DetailView&record=${row['id']}'>$value</a></td>\n"; |
144 | 150 | $wasSet = true; |
145 | - } |
|
146 | - else { |
|
151 | + } else { |
|
147 | 152 | $form .= "<td><a target='_blank' href='index.php?module=Prospects&action=DetailView&record=${row['id']}'>$value</a></td>\n"; |
148 | 153 | } |
149 | 154 | } |
@@ -151,7 +156,7 @@ discard block |
||
151 | 156 | |
152 | 157 | if($rowColor == 'evenListRowS1'){ |
153 | 158 | $rowColor = 'oddListRowS1'; |
154 | - }else{ |
|
159 | + } else{ |
|
155 | 160 | $rowColor = 'evenListRowS1'; |
156 | 161 | } |
157 | 162 | $form .= "</tr>"; |
@@ -374,7 +379,9 @@ discard block |
||
374 | 379 | if(!empty($mod)){ |
375 | 380 | global $current_language; |
376 | 381 | $mod_strings = return_module_language($current_language, $mod); |
377 | -}else global $mod_strings; |
|
382 | +} else { |
|
383 | + global $mod_strings; |
|
384 | +} |
|
378 | 385 | global $app_strings; |
379 | 386 | |
380 | 387 | $lbl_save_button_title = $app_strings['LBL_SAVE_BUTTON_TITLE']; |
@@ -423,10 +430,16 @@ discard block |
||
423 | 430 | if(!$focus->ACLAccess('Save')){ |
424 | 431 | return null; |
425 | 432 | } |
426 | - if (!isset($GLOBALS['check_notify'])) $GLOBALS['check_notify']=false; |
|
433 | + if (!isset($GLOBALS['check_notify'])) { |
|
434 | + $GLOBALS['check_notify']=false; |
|
435 | + } |
|
427 | 436 | |
428 | - if (!isset($_POST[$prefix.'email_opt_out'])) $focus->email_opt_out = 0; |
|
429 | - if (!isset($_POST[$prefix.'do_not_call'])) $focus->do_not_call = 0; |
|
437 | + if (!isset($_POST[$prefix.'email_opt_out'])) { |
|
438 | + $focus->email_opt_out = 0; |
|
439 | + } |
|
440 | + if (!isset($_POST[$prefix.'do_not_call'])) { |
|
441 | + $focus->do_not_call = 0; |
|
442 | + } |
|
430 | 443 | |
431 | 444 | if (empty($_POST['record']) && empty($_POST['dup_checked'])) { |
432 | 445 | /* |
@@ -482,15 +495,29 @@ discard block |
||
482 | 495 | $GLOBALS['log']->debug("Saved record with id of ".$return_id); |
483 | 496 | if(isset($_POST['popup']) && $_POST['popup'] == 'true') { |
484 | 497 | $get = '&module='; |
485 | - if(!empty($_POST['return_module'])) $get .= $_POST['return_module']; |
|
486 | - else $get .= 'Prospects'; |
|
498 | + if(!empty($_POST['return_module'])) { |
|
499 | + $get .= $_POST['return_module']; |
|
500 | + } else { |
|
501 | + $get .= 'Prospects'; |
|
502 | + } |
|
487 | 503 | $get .= '&action='; |
488 | - if(!empty($_POST['return_action'])) $get .= $_POST['return_action']; |
|
489 | - else $get .= 'Popup'; |
|
490 | - if(!empty($_POST['return_id'])) $get .= '&return_id='.$_POST['return_id']; |
|
491 | - if(!empty($_POST['popup'])) $get .= '&popup='.$_POST['popup']; |
|
492 | - if(!empty($_POST['create'])) $get .= '&create='.$_POST['create']; |
|
493 | - if(!empty($_POST['to_pdf'])) $get .= '&to_pdf='.$_POST['to_pdf']; |
|
504 | + if(!empty($_POST['return_action'])) { |
|
505 | + $get .= $_POST['return_action']; |
|
506 | + } else { |
|
507 | + $get .= 'Popup'; |
|
508 | + } |
|
509 | + if(!empty($_POST['return_id'])) { |
|
510 | + $get .= '&return_id='.$_POST['return_id']; |
|
511 | + } |
|
512 | + if(!empty($_POST['popup'])) { |
|
513 | + $get .= '&popup='.$_POST['popup']; |
|
514 | + } |
|
515 | + if(!empty($_POST['create'])) { |
|
516 | + $get .= '&create='.$_POST['create']; |
|
517 | + } |
|
518 | + if(!empty($_POST['to_pdf'])) { |
|
519 | + $get .= '&to_pdf='.$_POST['to_pdf']; |
|
520 | + } |
|
494 | 521 | $get .= '&first_name=' . $focus->first_name; |
495 | 522 | $get .= '&last_name=' . $focus->last_name; |
496 | 523 | $get .= '&query=true'; |
@@ -500,7 +527,7 @@ discard block |
||
500 | 527 | if($redirect){ |
501 | 528 | require_once('include/formbase.php'); |
502 | 529 | handleRedirect($return_id, 'Prospects'); |
503 | - }else{ |
|
530 | + } else{ |
|
504 | 531 | return $focus; |
505 | 532 | } |
506 | 533 | } |