@@ -189,8 +189,9 @@ discard block |
||
| 189 | 189 | $GLOBALS['log']->info('Query Execution Time:'.$this->query_time); |
| 190 | 190 | |
| 191 | 191 | |
| 192 | - if($keepResult) |
|
| 193 | - $this->lastResult = $result; |
|
| 192 | + if($keepResult) { |
|
| 193 | + $this->lastResult = $result; |
|
| 194 | + } |
|
| 194 | 195 | |
| 195 | 196 | $this->checkError($msg.' Query Failed:' . $sql . '::', $dieOnError); |
| 196 | 197 | return $result; |
@@ -240,8 +241,9 @@ discard block |
||
| 240 | 241 | */ |
| 241 | 242 | protected function freeDbResult($dbResult) |
| 242 | 243 | { |
| 243 | - if(!empty($dbResult)) |
|
| 244 | - mysql_free_result($dbResult); |
|
| 244 | + if(!empty($dbResult)) { |
|
| 245 | + mysql_free_result($dbResult); |
|
| 246 | + } |
|
| 245 | 247 | } |
| 246 | 248 | |
| 247 | 249 | |
@@ -264,8 +266,9 @@ discard block |
||
| 264 | 266 | { |
| 265 | 267 | $start = (int)$start; |
| 266 | 268 | $count = (int)$count; |
| 267 | - if ($start < 0) |
|
| 268 | - $start = 0; |
|
| 269 | + if ($start < 0) { |
|
| 270 | + $start = 0; |
|
| 271 | + } |
|
| 269 | 272 | $GLOBALS['log']->debug('Limit Query:' . $sql. ' Start: ' .$start . ' count: ' . $count); |
| 270 | 273 | |
| 271 | 274 | $sql = "$sql LIMIT $start,$count"; |
@@ -290,21 +293,27 @@ discard block |
||
| 290 | 293 | $result = $this->query('EXPLAIN ' . $sql); |
| 291 | 294 | $badQuery = array(); |
| 292 | 295 | while ($row = $this->fetchByAssoc($result)) { |
| 293 | - if (empty($row['table'])) |
|
| 294 | - continue; |
|
| 296 | + if (empty($row['table'])) { |
|
| 297 | + continue; |
|
| 298 | + } |
|
| 295 | 299 | $badQuery[$row['table']] = ''; |
| 296 | - if (strtoupper($row['type']) == 'ALL') |
|
| 297 | - $badQuery[$row['table']] .= ' Full Table Scan;'; |
|
| 298 | - if (empty($row['key'])) |
|
| 299 | - $badQuery[$row['table']] .= ' No Index Key Used;'; |
|
| 300 | - if (!empty($row['Extra']) && substr_count($row['Extra'], 'Using filesort') > 0) |
|
| 301 | - $badQuery[$row['table']] .= ' Using FileSort;'; |
|
| 302 | - if (!empty($row['Extra']) && substr_count($row['Extra'], 'Using temporary') > 0) |
|
| 303 | - $badQuery[$row['table']] .= ' Using Temporary Table;'; |
|
| 300 | + if (strtoupper($row['type']) == 'ALL') { |
|
| 301 | + $badQuery[$row['table']] .= ' Full Table Scan;'; |
|
| 302 | + } |
|
| 303 | + if (empty($row['key'])) { |
|
| 304 | + $badQuery[$row['table']] .= ' No Index Key Used;'; |
|
| 305 | + } |
|
| 306 | + if (!empty($row['Extra']) && substr_count($row['Extra'], 'Using filesort') > 0) { |
|
| 307 | + $badQuery[$row['table']] .= ' Using FileSort;'; |
|
| 308 | + } |
|
| 309 | + if (!empty($row['Extra']) && substr_count($row['Extra'], 'Using temporary') > 0) { |
|
| 310 | + $badQuery[$row['table']] .= ' Using Temporary Table;'; |
|
| 311 | + } |
|
| 304 | 312 | } |
| 305 | 313 | |
| 306 | - if ( empty($badQuery) ) |
|
| 307 | - return true; |
|
| 314 | + if ( empty($badQuery) ) { |
|
| 315 | + return true; |
|
| 316 | + } |
|
| 308 | 317 | |
| 309 | 318 | foreach($badQuery as $table=>$data ){ |
| 310 | 319 | if(!empty($data)){ |
@@ -312,8 +321,7 @@ discard block |
||
| 312 | 321 | if(!empty($GLOBALS['sugar_config']['check_query_log'])){ |
| 313 | 322 | $GLOBALS['log']->fatal($sql); |
| 314 | 323 | $GLOBALS['log']->fatal('CHECK QUERY:' .$warning); |
| 315 | - } |
|
| 316 | - else{ |
|
| 324 | + } else{ |
|
| 317 | 325 | $GLOBALS['log']->warn('CHECK QUERY:' .$warning); |
| 318 | 326 | } |
| 319 | 327 | } |
@@ -337,14 +345,18 @@ discard block |
||
| 337 | 345 | $matches = array(); |
| 338 | 346 | preg_match_all('/(\w+)(?:\(([0-9]+,?[0-9]*)\)|)( unsigned)?/i', $row['Type'], $matches); |
| 339 | 347 | $columns[$name]['type']=strtolower($matches[1][0]); |
| 340 | - if ( isset($matches[2][0]) && in_array(strtolower($matches[1][0]),array('varchar','char','varchar2','int','decimal','float')) ) |
|
| 341 | - $columns[$name]['len']=strtolower($matches[2][0]); |
|
| 342 | - if ( stristr($row['Extra'],'auto_increment') ) |
|
| 343 | - $columns[$name]['auto_increment'] = '1'; |
|
| 344 | - if ($row['Null'] == 'NO' && !stristr($row['Key'],'PRI')) |
|
| 345 | - $columns[$name]['required'] = 'true'; |
|
| 346 | - if (!empty($row['Default']) ) |
|
| 347 | - $columns[$name]['default'] = $row['Default']; |
|
| 348 | + if ( isset($matches[2][0]) && in_array(strtolower($matches[1][0]),array('varchar','char','varchar2','int','decimal','float')) ) { |
|
| 349 | + $columns[$name]['len']=strtolower($matches[2][0]); |
|
| 350 | + } |
|
| 351 | + if ( stristr($row['Extra'],'auto_increment') ) { |
|
| 352 | + $columns[$name]['auto_increment'] = '1'; |
|
| 353 | + } |
|
| 354 | + if ($row['Null'] == 'NO' && !stristr($row['Key'],'PRI')) { |
|
| 355 | + $columns[$name]['required'] = 'true'; |
|
| 356 | + } |
|
| 357 | + if (!empty($row['Default']) ) { |
|
| 358 | + $columns[$name]['default'] = $row['Default']; |
|
| 359 | + } |
|
| 348 | 360 | } |
| 349 | 361 | return $columns; |
| 350 | 362 | } |
@@ -356,17 +368,20 @@ discard block |
||
| 356 | 368 | { |
| 357 | 369 | $field_array = array(); |
| 358 | 370 | |
| 359 | - if(empty($result)) |
|
| 360 | - return 0; |
|
| 371 | + if(empty($result)) { |
|
| 372 | + return 0; |
|
| 373 | + } |
|
| 361 | 374 | |
| 362 | 375 | $fields = mysql_num_fields($result); |
| 363 | 376 | for ($i=0; $i < $fields; $i++) { |
| 364 | 377 | $meta = mysql_fetch_field($result, $i); |
| 365 | - if (!$meta) |
|
| 366 | - return array(); |
|
| 378 | + if (!$meta) { |
|
| 379 | + return array(); |
|
| 380 | + } |
|
| 367 | 381 | |
| 368 | - if($make_lower_case == true) |
|
| 369 | - $meta->name = strtolower($meta->name); |
|
| 382 | + if($make_lower_case == true) { |
|
| 383 | + $meta->name = strtolower($meta->name); |
|
| 384 | + } |
|
| 370 | 385 | |
| 371 | 386 | $field_array[] = $meta->name; |
| 372 | 387 | } |
@@ -379,7 +394,9 @@ discard block |
||
| 379 | 394 | */ |
| 380 | 395 | public function fetchRow($result) |
| 381 | 396 | { |
| 382 | - if (empty($result)) return false; |
|
| 397 | + if (empty($result)) { |
|
| 398 | + return false; |
|
| 399 | + } |
|
| 383 | 400 | |
| 384 | 401 | return mysql_fetch_assoc($result); |
| 385 | 402 | } |
@@ -423,7 +440,9 @@ discard block |
||
| 423 | 440 | |
| 424 | 441 | if ($this->getDatabase()) { |
| 425 | 442 | $result = $this->query("SHOW TABLES LIKE ".$this->quoted($tableName)); |
| 426 | - if(empty($result)) return false; |
|
| 443 | + if(empty($result)) { |
|
| 444 | + return false; |
|
| 445 | + } |
|
| 427 | 446 | $row = $this->fetchByAssoc($result); |
| 428 | 447 | return !empty($row); |
| 429 | 448 | } |
@@ -478,8 +497,9 @@ discard block |
||
| 478 | 497 | { |
| 479 | 498 | global $sugar_config; |
| 480 | 499 | |
| 481 | - if(is_null($configOptions)) |
|
| 482 | - $configOptions = $sugar_config['dbconfig']; |
|
| 500 | + if(is_null($configOptions)) { |
|
| 501 | + $configOptions = $sugar_config['dbconfig']; |
|
| 502 | + } |
|
| 483 | 503 | |
| 484 | 504 | if ($this->getOption('persistent')) { |
| 485 | 505 | $this->database = @mysql_pconnect( |
@@ -532,8 +552,9 @@ discard block |
||
| 532 | 552 | } |
| 533 | 553 | mysql_query($names, $this->database); |
| 534 | 554 | |
| 535 | - if(!$this->checkError('Could Not Connect:', $dieOnError)) |
|
| 536 | - $GLOBALS['log']->info("connected to db"); |
|
| 555 | + if(!$this->checkError('Could Not Connect:', $dieOnError)) { |
|
| 556 | + $GLOBALS['log']->info("connected to db"); |
|
| 557 | + } |
|
| 537 | 558 | $this->connectOptions = $configOptions; |
| 538 | 559 | |
| 539 | 560 | $GLOBALS['log']->info("Connect:".$this->database); |
@@ -550,8 +571,9 @@ discard block |
||
| 550 | 571 | { |
| 551 | 572 | $sql = parent::repairTableParams($tablename,$fielddefs,$indices,false,$engine); |
| 552 | 573 | |
| 553 | - if ( $sql == '' ) |
|
| 554 | - return ''; |
|
| 574 | + if ( $sql == '' ) { |
|
| 575 | + return ''; |
|
| 576 | + } |
|
| 555 | 577 | |
| 556 | 578 | if ( stristr($sql,'create table') ) |
| 557 | 579 | { |
@@ -578,8 +600,9 @@ discard block |
||
| 578 | 600 | $sql = str_replace("\n","",$sql); |
| 579 | 601 | $sql = "ALTER TABLE $tablename $sql"; |
| 580 | 602 | |
| 581 | - if ( $execute ) |
|
| 582 | - $this->query($sql,'Error with MySQL repair table'); |
|
| 603 | + if ( $execute ) { |
|
| 604 | + $this->query($sql,'Error with MySQL repair table'); |
|
| 605 | + } |
|
| 583 | 606 | |
| 584 | 607 | // and re-add the comments at the beginning |
| 585 | 608 | $sql = implode("\n",$commentBlocks) . "\n". $sql . "\n"; |
@@ -676,15 +699,18 @@ discard block |
||
| 676 | 699 | */ |
| 677 | 700 | protected function isEngineEnabled($engine) |
| 678 | 701 | { |
| 679 | - if(!is_string($engine)) return false; |
|
| 702 | + if(!is_string($engine)) { |
|
| 703 | + return false; |
|
| 704 | + } |
|
| 680 | 705 | |
| 681 | 706 | $engine = strtoupper($engine); |
| 682 | 707 | |
| 683 | 708 | $r = $this->query("SHOW ENGINES"); |
| 684 | 709 | |
| 685 | - while ( $row = $this->fetchByAssoc($r) ) |
|
| 686 | - if ( strtoupper($row['Engine']) == $engine ) |
|
| 710 | + while ( $row = $this->fetchByAssoc($r) ) { |
|
| 711 | + if ( strtoupper($row['Engine']) == $engine ) |
|
| 687 | 712 | return ($row['Support']=='YES' || $row['Support']=='DEFAULT'); |
| 713 | + } |
|
| 688 | 714 | |
| 689 | 715 | return false; |
| 690 | 716 | } |
@@ -712,18 +738,22 @@ discard block |
||
| 712 | 738 | */ |
| 713 | 739 | public function createTableSQLParams($tablename, $fieldDefs, $indices, $engine = null) |
| 714 | 740 | { |
| 715 | - if ( empty($engine) && isset($fieldDefs['engine'])) |
|
| 716 | - $engine = $fieldDefs['engine']; |
|
| 717 | - if ( !$this->isEngineEnabled($engine) ) |
|
| 718 | - $engine = ''; |
|
| 741 | + if ( empty($engine) && isset($fieldDefs['engine'])) { |
|
| 742 | + $engine = $fieldDefs['engine']; |
|
| 743 | + } |
|
| 744 | + if ( !$this->isEngineEnabled($engine) ) { |
|
| 745 | + $engine = ''; |
|
| 746 | + } |
|
| 719 | 747 | |
| 720 | 748 | $columns = $this->columnSQLRep($fieldDefs, false, $tablename); |
| 721 | - if (empty($columns)) |
|
| 722 | - return false; |
|
| 749 | + if (empty($columns)) { |
|
| 750 | + return false; |
|
| 751 | + } |
|
| 723 | 752 | |
| 724 | 753 | $keys = $this->keysSQL($indices); |
| 725 | - if (!empty($keys)) |
|
| 726 | - $keys = ",$keys"; |
|
| 754 | + if (!empty($keys)) { |
|
| 755 | + $keys = ",$keys"; |
|
| 756 | + } |
|
| 727 | 757 | |
| 728 | 758 | // cn: bug 9873 - module tables do not get created in utf8 with assoc collation |
| 729 | 759 | $collation = $this->getOption('collation'); |
@@ -732,8 +762,9 @@ discard block |
||
| 732 | 762 | } |
| 733 | 763 | $sql = "CREATE TABLE $tablename ($columns $keys) CHARACTER SET utf8 COLLATE $collation"; |
| 734 | 764 | |
| 735 | - if (!empty($engine)) |
|
| 736 | - $sql.= " ENGINE=$engine"; |
|
| 765 | + if (!empty($engine)) { |
|
| 766 | + $sql.= " ENGINE=$engine"; |
|
| 767 | + } |
|
| 737 | 768 | |
| 738 | 769 | return $sql; |
| 739 | 770 | } |
@@ -762,13 +793,15 @@ discard block |
||
| 762 | 793 | |
| 763 | 794 | // bug 22338 - don't set a default value on text or blob fields |
| 764 | 795 | if ( isset($ref['default']) && |
| 765 | - in_array($ref['colBaseType'], array('text', 'blob', 'longtext', 'longblob'))) |
|
| 766 | - $ref['default'] = ''; |
|
| 796 | + in_array($ref['colBaseType'], array('text', 'blob', 'longtext', 'longblob'))) { |
|
| 797 | + $ref['default'] = ''; |
|
| 798 | + } |
|
| 767 | 799 | |
| 768 | - if ( $return_as_array ) |
|
| 769 | - return $ref; |
|
| 770 | - else |
|
| 771 | - return "{$ref['name']} {$ref['colType']} {$ref['default']} {$ref['required']} {$ref['auto_increment']}"; |
|
| 800 | + if ( $return_as_array ) { |
|
| 801 | + return $ref; |
|
| 802 | + } else { |
|
| 803 | + return "{$ref['name']} {$ref['colType']} {$ref['default']} {$ref['required']} {$ref['auto_increment']}"; |
|
| 804 | + } |
|
| 772 | 805 | } |
| 773 | 806 | |
| 774 | 807 | /** |
@@ -779,16 +812,18 @@ discard block |
||
| 779 | 812 | $columns = array(); |
| 780 | 813 | if ($this->isFieldArray($fieldDefs)){ |
| 781 | 814 | foreach ($fieldDefs as $def){ |
| 782 | - if ($action == 'drop') |
|
| 783 | - $columns[] = $def['name']; |
|
| 784 | - else |
|
| 785 | - $columns[] = $this->oneColumnSQLRep($def, $ignoreRequired); |
|
| 815 | + if ($action == 'drop') { |
|
| 816 | + $columns[] = $def['name']; |
|
| 817 | + } else { |
|
| 818 | + $columns[] = $this->oneColumnSQLRep($def, $ignoreRequired); |
|
| 819 | + } |
|
| 786 | 820 | } |
| 787 | 821 | } else { |
| 788 | - if ($action == 'drop') |
|
| 789 | - $columns[] = $fieldDefs['name']; |
|
| 790 | - else |
|
| 791 | - $columns[] = $this->oneColumnSQLRep($fieldDefs); |
|
| 822 | + if ($action == 'drop') { |
|
| 823 | + $columns[] = $fieldDefs['name']; |
|
| 824 | + } else { |
|
| 825 | + $columns[] = $this->oneColumnSQLRep($fieldDefs); |
|
| 826 | + } |
|
| 792 | 827 | } |
| 793 | 828 | |
| 794 | 829 | return "ALTER TABLE $tablename $action COLUMN ".implode(",$action column ", $columns); |
@@ -810,23 +845,27 @@ discard block |
||
| 810 | 845 | { |
| 811 | 846 | // check if the passed value is an array of fields. |
| 812 | 847 | // if not, convert it into an array |
| 813 | - if (!$this->isFieldArray($indices)) |
|
| 814 | - $indices[] = $indices; |
|
| 848 | + if (!$this->isFieldArray($indices)) { |
|
| 849 | + $indices[] = $indices; |
|
| 850 | + } |
|
| 815 | 851 | |
| 816 | 852 | $columns = array(); |
| 817 | 853 | foreach ($indices as $index) { |
| 818 | - if(!empty($index['db']) && $index['db'] != $this->dbType) |
|
| 819 | - continue; |
|
| 820 | - if (isset($index['source']) && $index['source'] != 'db') |
|
| 821 | - continue; |
|
| 854 | + if(!empty($index['db']) && $index['db'] != $this->dbType) { |
|
| 855 | + continue; |
|
| 856 | + } |
|
| 857 | + if (isset($index['source']) && $index['source'] != 'db') { |
|
| 858 | + continue; |
|
| 859 | + } |
|
| 822 | 860 | |
| 823 | 861 | $type = $index['type']; |
| 824 | 862 | $name = $index['name']; |
| 825 | 863 | |
| 826 | - if (is_array($index['fields'])) |
|
| 827 | - $fields = implode(", ", $index['fields']); |
|
| 828 | - else |
|
| 829 | - $fields = $index['fields']; |
|
| 864 | + if (is_array($index['fields'])) { |
|
| 865 | + $fields = implode(", ", $index['fields']); |
|
| 866 | + } else { |
|
| 867 | + $fields = $index['fields']; |
|
| 868 | + } |
|
| 830 | 869 | |
| 831 | 870 | switch ($type) { |
| 832 | 871 | case 'unique': |
@@ -845,16 +884,18 @@ discard block |
||
| 845 | 884 | * that this can easily be fixed by referring to db dictionary |
| 846 | 885 | * to find the correct primary field name |
| 847 | 886 | */ |
| 848 | - if ( $alter_table ) |
|
| 849 | - $columns[] = " INDEX $name ($fields)"; |
|
| 850 | - else |
|
| 851 | - $columns[] = " KEY $name ($fields)"; |
|
| 887 | + if ( $alter_table ) { |
|
| 888 | + $columns[] = " INDEX $name ($fields)"; |
|
| 889 | + } else { |
|
| 890 | + $columns[] = " KEY $name ($fields)"; |
|
| 891 | + } |
|
| 852 | 892 | break; |
| 853 | 893 | case 'fulltext': |
| 854 | - if ($this->full_text_indexing_installed()) |
|
| 855 | - $columns[] = " FULLTEXT ($fields)"; |
|
| 856 | - else |
|
| 857 | - $GLOBALS['log']->debug('MYISAM engine is not available/enabled, full-text indexes will be skipped. Skipping:',$name); |
|
| 894 | + if ($this->full_text_indexing_installed()) { |
|
| 895 | + $columns[] = " FULLTEXT ($fields)"; |
|
| 896 | + } else { |
|
| 897 | + $GLOBALS['log']->debug('MYISAM engine is not available/enabled, full-text indexes will be skipped. Skipping:',$name); |
|
| 898 | + } |
|
| 858 | 899 | break; |
| 859 | 900 | } |
| 860 | 901 | } |
@@ -896,8 +937,9 @@ discard block |
||
| 896 | 937 | { |
| 897 | 938 | $result = $this->query("SHOW TABLE STATUS LIKE '$table'"); |
| 898 | 939 | $row = $this->fetchByAssoc($result); |
| 899 | - if (!empty($row['Auto_increment'])) |
|
| 900 | - return $row['Auto_increment']; |
|
| 940 | + if (!empty($row['Auto_increment'])) { |
|
| 941 | + return $row['Auto_increment']; |
|
| 942 | + } |
|
| 901 | 943 | |
| 902 | 944 | return ""; |
| 903 | 945 | } |
@@ -915,8 +957,7 @@ discard block |
||
| 915 | 957 | $index_type='index'; |
| 916 | 958 | if ($row['Key_name'] =='PRIMARY') { |
| 917 | 959 | $index_type='primary'; |
| 918 | - } |
|
| 919 | - elseif ( $row['Non_unique'] == '0' ) { |
|
| 960 | + } elseif ( $row['Non_unique'] == '0' ) { |
|
| 920 | 961 | $index_type='unique'; |
| 921 | 962 | } |
| 922 | 963 | $name = strtolower($row['Key_name']); |
@@ -942,29 +983,33 @@ discard block |
||
| 942 | 983 | case 'index': |
| 943 | 984 | case 'alternate_key': |
| 944 | 985 | case 'clustered': |
| 945 | - if ($drop) |
|
| 946 | - $sql = "ALTER TABLE {$table} DROP INDEX {$name} "; |
|
| 947 | - else |
|
| 948 | - $sql = "ALTER TABLE {$table} ADD INDEX {$name} ({$fields})"; |
|
| 986 | + if ($drop) { |
|
| 987 | + $sql = "ALTER TABLE {$table} DROP INDEX {$name} "; |
|
| 988 | + } else { |
|
| 989 | + $sql = "ALTER TABLE {$table} ADD INDEX {$name} ({$fields})"; |
|
| 990 | + } |
|
| 949 | 991 | break; |
| 950 | 992 | // constraints as indices |
| 951 | 993 | case 'unique': |
| 952 | - if ($drop) |
|
| 953 | - $sql = "ALTER TABLE {$table} DROP INDEX $name"; |
|
| 954 | - else |
|
| 955 | - $sql = "ALTER TABLE {$table} ADD CONSTRAINT UNIQUE {$name} ({$fields})"; |
|
| 994 | + if ($drop) { |
|
| 995 | + $sql = "ALTER TABLE {$table} DROP INDEX $name"; |
|
| 996 | + } else { |
|
| 997 | + $sql = "ALTER TABLE {$table} ADD CONSTRAINT UNIQUE {$name} ({$fields})"; |
|
| 998 | + } |
|
| 956 | 999 | break; |
| 957 | 1000 | case 'primary': |
| 958 | - if ($drop) |
|
| 959 | - $sql = "ALTER TABLE {$table} DROP PRIMARY KEY"; |
|
| 960 | - else |
|
| 961 | - $sql = "ALTER TABLE {$table} ADD CONSTRAINT PRIMARY KEY ({$fields})"; |
|
| 1001 | + if ($drop) { |
|
| 1002 | + $sql = "ALTER TABLE {$table} DROP PRIMARY KEY"; |
|
| 1003 | + } else { |
|
| 1004 | + $sql = "ALTER TABLE {$table} ADD CONSTRAINT PRIMARY KEY ({$fields})"; |
|
| 1005 | + } |
|
| 962 | 1006 | break; |
| 963 | 1007 | case 'foreign': |
| 964 | - if ($drop) |
|
| 965 | - $sql = "ALTER TABLE {$table} DROP FOREIGN KEY ({$fields})"; |
|
| 966 | - else |
|
| 967 | - $sql = "ALTER TABLE {$table} ADD CONSTRAINT FOREIGN KEY {$name} ({$fields}) REFERENCES {$definition['foreignTable']}({$definition['foreignField']})"; |
|
| 1008 | + if ($drop) { |
|
| 1009 | + $sql = "ALTER TABLE {$table} DROP FOREIGN KEY ({$fields})"; |
|
| 1010 | + } else { |
|
| 1011 | + $sql = "ALTER TABLE {$table} ADD CONSTRAINT FOREIGN KEY {$name} ({$fields}) REFERENCES {$definition['foreignTable']}({$definition['foreignField']})"; |
|
| 1012 | + } |
|
| 968 | 1013 | break; |
| 969 | 1014 | } |
| 970 | 1015 | return $sql; |
@@ -1007,22 +1052,30 @@ discard block |
||
| 1007 | 1052 | ($fieldDef['dbType'] == 'text' |
| 1008 | 1053 | || $fieldDef['dbType'] == 'blob' |
| 1009 | 1054 | || $fieldDef['dbType'] == 'longtext' |
| 1010 | - || $fieldDef['dbType'] == 'longblob' )) |
|
| 1011 | - unset($fieldDef['default']); |
|
| 1012 | - if ($fieldDef['dbType'] == 'uint') |
|
| 1013 | - $fieldDef['len'] = '10'; |
|
| 1014 | - if ($fieldDef['dbType'] == 'ulong') |
|
| 1015 | - $fieldDef['len'] = '20'; |
|
| 1016 | - if ($fieldDef['dbType'] == 'bool') |
|
| 1017 | - $fieldDef['type'] = 'tinyint'; |
|
| 1018 | - if ($fieldDef['dbType'] == 'bool' && empty($fieldDef['default']) ) |
|
| 1019 | - $fieldDef['default'] = '0'; |
|
| 1020 | - if (($fieldDef['dbType'] == 'varchar' || $fieldDef['dbType'] == 'enum') && empty($fieldDef['len']) ) |
|
| 1021 | - $fieldDef['len'] = '255'; |
|
| 1022 | - if ($fieldDef['dbType'] == 'uint') |
|
| 1023 | - $fieldDef['len'] = '10'; |
|
| 1024 | - if ($fieldDef['dbType'] == 'int' && empty($fieldDef['len']) ) |
|
| 1025 | - $fieldDef['len'] = '11'; |
|
| 1055 | + || $fieldDef['dbType'] == 'longblob' )) { |
|
| 1056 | + unset($fieldDef['default']); |
|
| 1057 | + } |
|
| 1058 | + if ($fieldDef['dbType'] == 'uint') { |
|
| 1059 | + $fieldDef['len'] = '10'; |
|
| 1060 | + } |
|
| 1061 | + if ($fieldDef['dbType'] == 'ulong') { |
|
| 1062 | + $fieldDef['len'] = '20'; |
|
| 1063 | + } |
|
| 1064 | + if ($fieldDef['dbType'] == 'bool') { |
|
| 1065 | + $fieldDef['type'] = 'tinyint'; |
|
| 1066 | + } |
|
| 1067 | + if ($fieldDef['dbType'] == 'bool' && empty($fieldDef['default']) ) { |
|
| 1068 | + $fieldDef['default'] = '0'; |
|
| 1069 | + } |
|
| 1070 | + if (($fieldDef['dbType'] == 'varchar' || $fieldDef['dbType'] == 'enum') && empty($fieldDef['len']) ) { |
|
| 1071 | + $fieldDef['len'] = '255'; |
|
| 1072 | + } |
|
| 1073 | + if ($fieldDef['dbType'] == 'uint') { |
|
| 1074 | + $fieldDef['len'] = '10'; |
|
| 1075 | + } |
|
| 1076 | + if ($fieldDef['dbType'] == 'int' && empty($fieldDef['len']) ) { |
|
| 1077 | + $fieldDef['len'] = '11'; |
|
| 1078 | + } |
|
| 1026 | 1079 | |
| 1027 | 1080 | if($fieldDef['dbType'] == 'decimal') { |
| 1028 | 1081 | if(isset($fieldDef['len'])) { |
@@ -1062,8 +1115,9 @@ discard block |
||
| 1062 | 1115 | } |
| 1063 | 1116 | if (!empty($sql)) { |
| 1064 | 1117 | $sql = "ALTER TABLE $tablename " . join(",", $sql) . ";"; |
| 1065 | - if($execute) |
|
| 1066 | - $this->query($sql); |
|
| 1118 | + if($execute) { |
|
| 1119 | + $this->query($sql); |
|
| 1120 | + } |
|
| 1067 | 1121 | } else { |
| 1068 | 1122 | $sql = ''; |
| 1069 | 1123 | } |
@@ -88,8 +88,7 @@ |
||
| 88 | 88 | if ($bean_name === 'Team'){ |
| 89 | 89 | $focus->retrieve($record); |
| 90 | 90 | $focus->remove_user_from_team($linked_id); |
| 91 | - } |
|
| 92 | - else{ |
|
| 91 | + } else{ |
|
| 93 | 92 | |
| 94 | 93 | // cut it off: |
| 95 | 94 | $focus->load_relationship($linked_field); |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | if ($layout_def['fields']['ID']===$layout_def['fields']['LATEST_REVISION_ID']) { |
| 72 | 72 | $hideremove=true; |
| 73 | 73 | } |
| 74 | - }elseif ($_REQUEST['module'] === 'Teams' && $current_module === 'Users') { |
|
| 74 | + } elseif ($_REQUEST['module'] === 'Teams' && $current_module === 'Users') { |
|
| 75 | 75 | // Implicit Team-memberships are not "removeable" |
| 76 | 76 | |
| 77 | 77 | if($layout_def['fields']['UPLINE'] !== translate('LBL_TEAM_UPLINE_EXPLICIT', 'Users')) { |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | $hideremove = true; |
| 87 | 87 | }} elseif ($current_module === 'ACLRoles' && (!ACLController::checkAccess($current_module, 'edit', true))) { |
| 88 | 88 | $hideremove = true; |
| 89 | - }elseif ($current_module === 'ACLRoles' && (!ACLController::checkAccess($current_module, 'edit', true))) { |
|
| 89 | + } elseif ($current_module === 'ACLRoles' && (!ACLController::checkAccess($current_module, 'edit', true))) { |
|
| 90 | 90 | $hideremove = true; |
| 91 | 91 | } |
| 92 | 92 | |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | if(isset($arr['vname']) && $arr['vname'] != '') { |
| 180 | 180 | $label = $rel_module_label . ' : ' . translate($arr['vname'], $mod->module_dir); |
| 181 | 181 | $module_label = trim(translate($arr['vname'],$mod->module_dir),':'); |
| 182 | - }else { |
|
| 182 | + } else { |
|
| 183 | 183 | $label = $rel_module_label . ' : '. $name; |
| 184 | 184 | $module_label = $name; |
| 185 | 185 | } |
@@ -230,7 +230,9 @@ discard block |
||
| 230 | 230 | $sort_fields[$name] = $relModuleName.' : '. $name; |
| 231 | 231 | } |
| 232 | 232 | if($arr['type'] == 'relate' && isset($arr['id_name']) && $arr['id_name'] != ''){ |
| 233 | - if(isset($fields[$arr['id_name']])) unset( $fields[$arr['id_name']]); |
|
| 233 | + if(isset($fields[$arr['id_name']])) { |
|
| 234 | + unset( $fields[$arr['id_name']]); |
|
| 235 | + } |
|
| 234 | 236 | } |
| 235 | 237 | } |
| 236 | 238 | } //End loop. |
@@ -324,7 +326,9 @@ discard block |
||
| 324 | 326 | $vardef['type'] = 'varchar'; |
| 325 | 327 | } |
| 326 | 328 | |
| 327 | - if(isset($vardef['precision'])) unset($vardef['precision']); |
|
| 329 | + if(isset($vardef['precision'])) { |
|
| 330 | + unset($vardef['precision']); |
|
| 331 | + } |
|
| 328 | 332 | |
| 329 | 333 | //$vardef['precision'] = $locale->getPrecedentPreference('default_currency_significant_digits', $current_user); |
| 330 | 334 | |
@@ -364,8 +368,9 @@ discard block |
||
| 364 | 368 | // remove the special text entry field function 'getEmailAddressWidget' |
| 365 | 369 | if ( isset($vardef['function']) |
| 366 | 370 | && ( $vardef['function'] == 'getEmailAddressWidget' |
| 367 | - || $vardef['function']['name'] == 'getEmailAddressWidget' ) ) |
|
| 368 | - unset($vardef['function']); |
|
| 371 | + || $vardef['function']['name'] == 'getEmailAddressWidget' ) ) { |
|
| 372 | + unset($vardef['function']); |
|
| 373 | + } |
|
| 369 | 374 | |
| 370 | 375 | if(isset($vardef['name']) && ($vardef['name'] == 'date_entered' || $vardef['name'] == 'date_modified')){ |
| 371 | 376 | $vardef['name'] = 'aow_temp_date'; |
@@ -390,8 +395,9 @@ discard block |
||
| 390 | 395 | } |
| 391 | 396 | |
| 392 | 397 | // hack to disable one of the js calls in this control |
| 393 | - if ( isset($vardef['function']) && ( $vardef['function'] == 'getCurrencyDropDown' || $vardef['function']['name'] == 'getCurrencyDropDown' ) ) |
|
| 394 | - $contents .= "{literal}<script>function CurrencyConvertAll() { return; }</script>{/literal}"; |
|
| 398 | + if ( isset($vardef['function']) && ( $vardef['function'] == 'getCurrencyDropDown' || $vardef['function']['name'] == 'getCurrencyDropDown' ) ) { |
|
| 399 | + $contents .= "{literal}<script>function CurrencyConvertAll() { return; }</script>{/literal}"; |
|
| 400 | + } |
|
| 395 | 401 | |
| 396 | 402 | // Save it to the cache file |
| 397 | 403 | if($fh = @sugar_fopen($file, 'w')) { |
@@ -417,8 +423,7 @@ discard block |
||
| 417 | 423 | $t23 = strpos($time_format, '23') !== false ? '%H' : '%I'; |
| 418 | 424 | if(!isset($match[2]) || $match[2] == '') { |
| 419 | 425 | $ss->assign('CALENDAR_FORMAT', $date_format . ' ' . $t23 . $time_separator . "%M"); |
| 420 | - } |
|
| 421 | - else { |
|
| 426 | + } else { |
|
| 422 | 427 | $pm = $match[2] == "pm" ? "%P" : "%p"; |
| 423 | 428 | $ss->assign('CALENDAR_FORMAT', $date_format . ' ' . $t23 . $time_separator . "%M" . $pm); |
| 424 | 429 | } |
@@ -427,8 +432,9 @@ discard block |
||
| 427 | 432 | |
| 428 | 433 | // populate the fieldlist from the vardefs |
| 429 | 434 | $fieldlist = array(); |
| 430 | - if ( !isset($focus) || !($focus instanceof SugarBean) ) |
|
| 431 | - require_once($beanFiles[$beanList[$module]]); |
|
| 435 | + if ( !isset($focus) || !($focus instanceof SugarBean) ) { |
|
| 436 | + require_once($beanFiles[$beanList[$module]]); |
|
| 437 | + } |
|
| 432 | 438 | $focus = new $beanList[$module]; |
| 433 | 439 | // create the dropdowns for the parent type fields |
| 434 | 440 | $vardefFields = $focus->getFieldDefinitions(); |
@@ -438,14 +444,17 @@ discard block |
||
| 438 | 444 | foreach ( $vardefFields as $name => $properties ) { |
| 439 | 445 | $fieldlist[$name] = $properties; |
| 440 | 446 | // fill in enums |
| 441 | - if(isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($app_list_strings[$fieldlist[$name]['options']])) |
|
| 442 | - $fieldlist[$name]['options'] = $app_list_strings[$fieldlist[$name]['options']]; |
|
| 447 | + if(isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($app_list_strings[$fieldlist[$name]['options']])) { |
|
| 448 | + $fieldlist[$name]['options'] = $app_list_strings[$fieldlist[$name]['options']]; |
|
| 449 | + } |
|
| 443 | 450 | // Bug 32626: fall back on checking the mod_strings if not in the app_list_strings |
| 444 | - elseif(isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($mod_strings[$fieldlist[$name]['options']])) |
|
| 445 | - $fieldlist[$name]['options'] = $mod_strings[$fieldlist[$name]['options']]; |
|
| 451 | + elseif(isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($mod_strings[$fieldlist[$name]['options']])) { |
|
| 452 | + $fieldlist[$name]['options'] = $mod_strings[$fieldlist[$name]['options']]; |
|
| 453 | + } |
|
| 446 | 454 | // Bug 22730: make sure all enums have the ability to select blank as the default value. |
| 447 | - if(!isset($fieldlist[$name]['options'][''])) |
|
| 448 | - $fieldlist[$name]['options'][''] = ''; |
|
| 455 | + if(!isset($fieldlist[$name]['options'][''])) { |
|
| 456 | + $fieldlist[$name]['options'][''] = ''; |
|
| 457 | + } |
|
| 449 | 458 | } |
| 450 | 459 | |
| 451 | 460 | // fill in function return values |
@@ -455,8 +464,9 @@ discard block |
||
| 455 | 464 | { |
| 456 | 465 | $function = $fieldlist[$fieldname]['function']['name']; |
| 457 | 466 | // include various functions required in the various vardefs |
| 458 | - if ( isset($fieldlist[$fieldname]['function']['include']) && is_file($fieldlist[$fieldname]['function']['include'])) |
|
| 459 | - require_once($fieldlist[$fieldname]['function']['include']); |
|
| 467 | + if ( isset($fieldlist[$fieldname]['function']['include']) && is_file($fieldlist[$fieldname]['function']['include'])) { |
|
| 468 | + require_once($fieldlist[$fieldname]['function']['include']); |
|
| 469 | + } |
|
| 460 | 470 | $_REQUEST[$fieldname] = $value; |
| 461 | 471 | $value = $function($focus, $fieldname, $value, $view); |
| 462 | 472 | |
@@ -514,9 +524,11 @@ discard block |
||
| 514 | 524 | $value = $focus->convertField($value, $fieldlist[$fieldname]); |
| 515 | 525 | if(!empty($params['date_format']) && isset($params['date_format'])){ |
| 516 | 526 | $convert_format = "Y-m-d H:i:s"; |
| 517 | - if($fieldlist[$fieldname]['type'] == 'date') $convert_format = "Y-m-d"; |
|
| 527 | + if($fieldlist[$fieldname]['type'] == 'date') { |
|
| 528 | + $convert_format = "Y-m-d"; |
|
| 529 | + } |
|
| 518 | 530 | $fieldlist[$fieldname]['value'] = $timedate->to_display($value, $convert_format, $params['date_format']); |
| 519 | - }else{ |
|
| 531 | + } else{ |
|
| 520 | 532 | $fieldlist[$fieldname]['value'] = $timedate->to_display_date_time($value, true, true); |
| 521 | 533 | } |
| 522 | 534 | $fieldlist[$fieldname]['name'] = $aow_field; |
@@ -582,7 +594,9 @@ discard block |
||
| 582 | 594 | |
| 583 | 595 | $value = json_decode(html_entity_decode_utf8($value), true); |
| 584 | 596 | |
| 585 | - if(!file_exists('modules/AOBH_BusinessHours/AOBH_BusinessHours.php')) unset($app_list_strings['aow_date_type_list']['business_hours']); |
|
| 597 | + if(!file_exists('modules/AOBH_BusinessHours/AOBH_BusinessHours.php')) { |
|
| 598 | + unset($app_list_strings['aow_date_type_list']['business_hours']); |
|
| 599 | + } |
|
| 586 | 600 | |
| 587 | 601 | $field = ''; |
| 588 | 602 | |
@@ -590,11 +604,12 @@ discard block |
||
| 590 | 604 | $field .= "<select type='text' name='$aow_field".'[0]'."' id='$aow_field".'[0]'."' title='' tabindex='116'>". getDateFields($module, $view, $value[0], $field_option) ."</select> "; |
| 591 | 605 | $field .= "<select type='text' name='$aow_field".'[1]'."' id='$aow_field".'[1]'."' onchange='date_field_change(\"$aow_field\")' title='' tabindex='116'>". get_select_options_with_id($app_list_strings['aow_date_operator'], $value[1]) ."</select> "; |
| 592 | 606 | $display = 'none'; |
| 593 | - if($value[1] == 'plus' || $value[1] == 'minus') $display = ''; |
|
| 607 | + if($value[1] == 'plus' || $value[1] == 'minus') { |
|
| 608 | + $display = ''; |
|
| 609 | + } |
|
| 594 | 610 | $field .= "<input type='text' style='display:$display' name='$aow_field".'[2]'."' id='$aow_field".'[2]'."' title='' value='$value[2]' tabindex='116'> "; |
| 595 | 611 | $field .= "<select type='text' style='display:$display' name='$aow_field".'[3]'."' id='$aow_field".'[3]'."' title='' tabindex='116'>". get_select_options_with_id($app_list_strings['aow_date_type_list'], $value[3]) ."</select>"; |
| 596 | - } |
|
| 597 | - else { |
|
| 612 | + } else { |
|
| 598 | 613 | $field = getDateFields($module, $view, $value[0], $field_option).' '.$app_list_strings['aow_date_operator'][$value[1]]; |
| 599 | 614 | if($value[1] == 'plus' || $value[1] == 'minus'){ |
| 600 | 615 | $field .= ' '.$value[2].' '.$app_list_strings['aow_date_type_list'][$value[3]]; |
@@ -610,7 +625,9 @@ discard block |
||
| 610 | 625 | |
| 611 | 626 | $fields = $app_list_strings['aow_date_options']; |
| 612 | 627 | |
| 613 | - if(!$field_option) unset($fields['field']); |
|
| 628 | + if(!$field_option) { |
|
| 629 | + unset($fields['field']); |
|
| 630 | + } |
|
| 614 | 631 | |
| 615 | 632 | if ($module != '') { |
| 616 | 633 | if(isset($beanList[$module]) && $beanList[$module]){ |
@@ -643,8 +660,7 @@ discard block |
||
| 643 | 660 | |
| 644 | 661 | if(!file_exists('modules/SecurityGroups/SecurityGroup.php')){ |
| 645 | 662 | unset($app_list_strings['aow_assign_options']['security_group']); |
| 646 | - } |
|
| 647 | - else{ |
|
| 663 | + } else{ |
|
| 648 | 664 | $securityGroups = get_bean_select_array(true, 'SecurityGroup','name', '','name',true); |
| 649 | 665 | } |
| 650 | 666 | |
@@ -654,17 +670,19 @@ discard block |
||
| 654 | 670 | $field .= "<select type='text' name='$aow_field".'[0]'."' id='$aow_field".'[0]'."' onchange='assign_field_change(\"$aow_field\")' title='' tabindex='116'>". get_select_options_with_id($app_list_strings['aow_assign_options'], $value[0]) ."</select> "; |
| 655 | 671 | if(!file_exists('modules/SecurityGroups/SecurityGroup.php')){ |
| 656 | 672 | $field .= "<input type='hidden' name='$aow_field".'[1]'."' id='$aow_field".'[1]'."' value='' />"; |
| 657 | - } |
|
| 658 | - else { |
|
| 673 | + } else { |
|
| 659 | 674 | $display = 'none'; |
| 660 | - if($value[0] == 'security_group') $display = ''; |
|
| 675 | + if($value[0] == 'security_group') { |
|
| 676 | + $display = ''; |
|
| 677 | + } |
|
| 661 | 678 | $field .= "<select type='text' style='display:$display' name='$aow_field".'[1]'."' id='$aow_field".'[1]'."' title='' tabindex='116'>". get_select_options_with_id($securityGroups, $value[1]) ."</select> "; |
| 662 | 679 | } |
| 663 | 680 | $display = 'none'; |
| 664 | - if($value[0] == 'role' || $value[0] == 'security_group') $display = ''; |
|
| 681 | + if($value[0] == 'role' || $value[0] == 'security_group') { |
|
| 682 | + $display = ''; |
|
| 683 | + } |
|
| 665 | 684 | $field .= "<select type='text' style='display:$display' name='$aow_field".'[2]'."' id='$aow_field".'[2]'."' title='' tabindex='116'>". get_select_options_with_id($roles, $value[2]) ."</select> "; |
| 666 | - } |
|
| 667 | - else { |
|
| 685 | + } else { |
|
| 668 | 686 | $field = $app_list_strings['aow_assign_options'][$value[1]]; |
| 669 | 687 | } |
| 670 | 688 | return $field; |
@@ -679,8 +697,7 @@ discard block |
||
| 679 | 697 | $option .= '<option value="'.$key.'" selected>'.$value.'</option>'; |
| 680 | 698 | } else if($selected_value == $key) { |
| 681 | 699 | $option .= '<option value="'.$key.'" selected>'.$value.'</option>'; |
| 682 | - } |
|
| 683 | - else { |
|
| 700 | + } else { |
|
| 684 | 701 | $option .= '<option value="'.$key.'">'.$value.'</option>'; |
| 685 | 702 | } |
| 686 | 703 | } |
@@ -707,8 +724,7 @@ discard block |
||
| 707 | 724 | if(!empty($users[$key])) { |
| 708 | 725 | return $users[$key]; |
| 709 | 726 | } |
| 710 | - } |
|
| 711 | - else if (is_file($file)){ |
|
| 727 | + } else if (is_file($file)){ |
|
| 712 | 728 | require_once($file); |
| 713 | 729 | if(isset($lastUser['User']) && $lastUser['User'] != '') { |
| 714 | 730 | $users_by_key = array_flip($users); // now keys are values |
@@ -769,7 +785,9 @@ discard block |
||
| 769 | 785 | $mod = new $beanList[$module](); |
| 770 | 786 | |
| 771 | 787 | foreach($mod->get_related_fields() as $field){ |
| 772 | - if(isset($field['link'])) $checked_link[] = $field['link']; |
|
| 788 | + if(isset($field['link'])) { |
|
| 789 | + $checked_link[] = $field['link']; |
|
| 790 | + } |
|
| 773 | 791 | if(!isset($field['module']) || !in_array($field['module'],$emailableModules) || (isset($field['dbType']) && $field['dbType'] == "id")){ |
| 774 | 792 | continue; |
| 775 | 793 | } |
@@ -813,7 +831,9 @@ discard block |
||
| 813 | 831 | switch($bean->field_defs[$field]['type']) { |
| 814 | 832 | case 'datetime': |
| 815 | 833 | case 'datetimecombo': |
| 816 | - if(empty($value)) break; |
|
| 834 | + if(empty($value)) { |
|
| 835 | + break; |
|
| 836 | + } |
|
| 817 | 837 | if ($value == 'NULL') { |
| 818 | 838 | $value = ''; |
| 819 | 839 | break; |
@@ -824,7 +844,9 @@ discard block |
||
| 824 | 844 | } |
| 825 | 845 | break; |
| 826 | 846 | case 'date': |
| 827 | - if(empty($value)) break; |
|
| 847 | + if(empty($value)) { |
|
| 848 | + break; |
|
| 849 | + } |
|
| 828 | 850 | if ($value == 'NULL') { |
| 829 | 851 | $value = ''; |
| 830 | 852 | break; |
@@ -835,7 +857,9 @@ discard block |
||
| 835 | 857 | } |
| 836 | 858 | break; |
| 837 | 859 | case 'time': |
| 838 | - if(empty($value)) break; |
|
| 860 | + if(empty($value)) { |
|
| 861 | + break; |
|
| 862 | + } |
|
| 839 | 863 | if ($value == 'NULL') { |
| 840 | 864 | $value = ''; |
| 841 | 865 | break; |
@@ -68,7 +68,9 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | |
| 70 | 70 | //setting default flag value so due date and time not required |
| 71 | -if (!isset($focus->id)) $focus->date_due_flag = 1; |
|
| 71 | +if (!isset($focus->id)) { |
|
| 72 | + $focus->date_due_flag = 1; |
|
| 73 | +} |
|
| 72 | 74 | |
| 73 | 75 | //needed when creating a new case with default values passed in |
| 74 | 76 | if (isset($_REQUEST['contact_name']) && is_null($focus->contact_name)) { |
@@ -130,12 +132,16 @@ discard block |
||
| 130 | 132 | $xtpl->parse("main.variable_option"); |
| 131 | 133 | |
| 132 | 134 | $returnAction = 'index'; |
| 133 | -if (isset($_REQUEST['return_module'])) $xtpl->assign("RETURN_MODULE", $_REQUEST['return_module']); |
|
| 135 | +if (isset($_REQUEST['return_module'])) { |
|
| 136 | + $xtpl->assign("RETURN_MODULE", $_REQUEST['return_module']); |
|
| 137 | +} |
|
| 134 | 138 | if (isset($_REQUEST['return_action'])) { |
| 135 | 139 | $xtpl->assign("RETURN_ACTION", $_REQUEST['return_action']); |
| 136 | 140 | $returnAction = $_REQUEST['return_action']; |
| 137 | 141 | } |
| 138 | -if (isset($_REQUEST['return_id'])) $xtpl->assign("RETURN_ID", $_REQUEST['return_id']); |
|
| 142 | +if (isset($_REQUEST['return_id'])) { |
|
| 143 | + $xtpl->assign("RETURN_ID", $_REQUEST['return_id']); |
|
| 144 | +} |
|
| 139 | 145 | // handle Create $module then Cancel |
| 140 | 146 | if (empty($_REQUEST['return_id'])) { |
| 141 | 147 | $xtpl->assign("RETURN_ACTION", 'index'); |
@@ -164,8 +170,9 @@ discard block |
||
| 164 | 170 | ); |
| 165 | 171 | $json = getJSONobj(); |
| 166 | 172 | $xtpl->assign('encoded_assigned_users_popup_request_data', $json->encode($popup_request_data)); |
| 167 | -if (!empty($focus->assigned_user_name)) |
|
| 173 | +if (!empty($focus->assigned_user_name)) { |
|
| 168 | 174 | $xtpl->assign("ASSIGNED_USER_NAME", $focus->assigned_user_name); |
| 175 | +} |
|
| 169 | 176 | |
| 170 | 177 | $xtpl->assign("assign_user_select", SugarThemeRegistry::current()->getImage('id-ff-select', '', null, null, '.png', $mod_strings['LBL_SELECT'])); |
| 171 | 178 | $xtpl->assign("assign_user_clear", SugarThemeRegistry::current()->getImage('id-ff-clear', '', null, null, '.gif', $mod_strings['LBL_ID_FF_CLEAR'])); |
@@ -187,23 +194,38 @@ discard block |
||
| 187 | 194 | $xtpl->assign("JSLANG", $jsLang); |
| 188 | 195 | |
| 189 | 196 | $xtpl->assign("ID", $focus->id); |
| 190 | -if (isset($focus->name)) $xtpl->assign("NAME", $focus->name); else $xtpl->assign("NAME", ""); |
|
| 197 | +if (isset($focus->name)) { |
|
| 198 | + $xtpl->assign("NAME", $focus->name); |
|
| 199 | +} else { |
|
| 200 | + $xtpl->assign("NAME", ""); |
|
| 201 | +} |
|
| 191 | 202 | |
| 192 | 203 | //Bug45632 |
| 193 | 204 | /* BEGIN - SECURITY GROUPS */ |
| 194 | 205 | /** |
| 195 | 206 | * if(isset($focus->assigned_user_id)) $xtpl->assign("ASSIGNED_USER_ID", $focus->assigned_user_id); else $xtpl->assign("ASSIGNED_USER_ID", ""); |
| 196 | 207 | */ |
| 197 | -if (isset($focus->assigned_user_id)) $xtpl->assign("ASSIGNED_USER_ID", $focus->assigned_user_id); |
|
| 198 | -else if (empty($focus->id) && empty($focus->assigned_user_id)) { |
|
| 208 | +if (isset($focus->assigned_user_id)) { |
|
| 209 | + $xtpl->assign("ASSIGNED_USER_ID", $focus->assigned_user_id); |
|
| 210 | +} else if (empty($focus->id) && empty($focus->assigned_user_id)) { |
|
| 199 | 211 | $xtpl->assign("ASSIGNED_USER_ID", $current_user->id); |
| 200 | 212 | $xtpl->assign("ASSIGNED_USER_NAME", get_assigned_user_name($current_user->id)); |
| 201 | -} else $xtpl->assign("ASSIGNED_USER_ID", ""); |
|
| 213 | +} else { |
|
| 214 | + $xtpl->assign("ASSIGNED_USER_ID", ""); |
|
| 215 | +} |
|
| 202 | 216 | /* END - SECURITY GROUPS */ |
| 203 | 217 | //Bug45632 |
| 204 | 218 | |
| 205 | -if (isset($focus->description)) $xtpl->assign("DESCRIPTION", $focus->description); else $xtpl->assign("DESCRIPTION", ""); |
|
| 206 | -if (isset($focus->subject)) $xtpl->assign("SUBJECT", $focus->subject); else $xtpl->assign("SUBJECT", ""); |
|
| 219 | +if (isset($focus->description)) { |
|
| 220 | + $xtpl->assign("DESCRIPTION", $focus->description); |
|
| 221 | +} else { |
|
| 222 | + $xtpl->assign("DESCRIPTION", ""); |
|
| 223 | +} |
|
| 224 | +if (isset($focus->subject)) { |
|
| 225 | + $xtpl->assign("SUBJECT", $focus->subject); |
|
| 226 | +} else { |
|
| 227 | + $xtpl->assign("SUBJECT", ""); |
|
| 228 | +} |
|
| 207 | 229 | if ($focus->published == 'on') { |
| 208 | 230 | $xtpl->assign("PUBLISHED", "CHECKED"); |
| 209 | 231 | } |
@@ -244,8 +266,16 @@ discard block |
||
| 244 | 266 | $xtpl->assign("TYPE_OPTIONS", get_select_options_with_id($app_list_strings['record_type_display'], $focus->parent_type)); |
| 245 | 267 | //$xtpl->assign("DEFAULT_MODULE","Accounts"); |
| 246 | 268 | |
| 247 | -if (isset($focus->body)) $xtpl->assign("BODY", $focus->body); else $xtpl->assign("BODY", ""); |
|
| 248 | -if (isset($focus->body_html)) $xtpl->assign("BODY_HTML", $focus->body_html); else $xtpl->assign("BODY_HTML", ""); |
|
| 269 | +if (isset($focus->body)) { |
|
| 270 | + $xtpl->assign("BODY", $focus->body); |
|
| 271 | +} else { |
|
| 272 | + $xtpl->assign("BODY", ""); |
|
| 273 | +} |
|
| 274 | +if (isset($focus->body_html)) { |
|
| 275 | + $xtpl->assign("BODY_HTML", $focus->body_html); |
|
| 276 | +} else { |
|
| 277 | + $xtpl->assign("BODY_HTML", ""); |
|
| 278 | +} |
|
| 249 | 279 | |
| 250 | 280 | |
| 251 | 281 | // --------------------------------- |
@@ -215,8 +215,7 @@ discard block |
||
| 215 | 215 | $detectedType = exif_imagetype($_FILES['company_logo']['tmp_name']); |
| 216 | 216 | if(!in_array($detectedType, $allowedTypes)) { |
| 217 | 217 | $errors[] = $mod_strings['ERR_UPLOAD_FILETYPE']; |
| 218 | - } |
|
| 219 | - else { |
|
| 218 | + } else { |
|
| 220 | 219 | // uploaded image stored in the /custom path instead of put into the original theme directory.. |
| 221 | 220 | |
| 222 | 221 | mkdir_recursive('custom/' . SugarThemeRegistry::current()->getDefaultImagePath(), true); |
@@ -224,8 +223,7 @@ discard block |
||
| 224 | 223 | $destFile = 'custom/' . $tmpvar[0]; |
| 225 | 224 | if (!move_uploaded_file($_FILES['company_logo']['tmp_name'], $destFile)) { |
| 226 | 225 | $errors[] = $mod_strings['ERR_LANG_UPLOAD_1']; |
| 227 | - } |
|
| 228 | - else { |
|
| 226 | + } else { |
|
| 229 | 227 | $filepath = $destFile; |
| 230 | 228 | } |
| 231 | 229 | } |
@@ -275,7 +273,9 @@ discard block |
||
| 275 | 273 | |
| 276 | 274 | if(isset($_REQUEST['storeConfig']) && ($_REQUEST['storeConfig'])){ |
| 277 | 275 | // store configuration by form to session |
| 278 | - if(!isset($_SESSION)) session_start(); |
|
| 276 | + if(!isset($_SESSION)) { |
|
| 277 | + session_start(); |
|
| 278 | + } |
|
| 279 | 279 | $_SESSION = array_merge($_SESSION, $_POST); |
| 280 | 280 | |
| 281 | 281 | // TODO--low: don't forget the custom type install settings! validate here.. |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | //define web root, which will be used as default for site_url |
| 369 | 369 | if($_SERVER['SERVER_PORT']=='80'){ |
| 370 | 370 | $web_root = $_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF']; |
| 371 | -}else{ |
|
| 371 | +} else{ |
|
| 372 | 372 | $web_root = $_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].$_SERVER['PHP_SELF']; |
| 373 | 373 | } |
| 374 | 374 | $web_root = str_replace("/install.php", "", $web_root); |
@@ -513,8 +513,7 @@ discard block |
||
| 513 | 513 | |
| 514 | 514 | <p>{$mod_strings['LBL_DISABLED_HELP_1']} <a href="{$mod_strings['LBL_DISABLED_HELP_LNK']}" target="_blank">{$mod_strings['LBL_DISABLED_HELP_2']}</a>.</p> |
| 515 | 515 | EOQ; |
| 516 | -} |
|
| 517 | -else{ |
|
| 516 | +} else{ |
|
| 518 | 517 | $validation_errors = array(); |
| 519 | 518 | // process the data posted |
| 520 | 519 | if($next_clicked) { |
@@ -605,27 +604,27 @@ discard block |
||
| 605 | 604 | $_SESSION['setup_site_custom_session_path'] = get_boolean_from_request('setup_site_custom_session_path'); |
| 606 | 605 | if($_SESSION['setup_site_custom_session_path']){ |
| 607 | 606 | $_SESSION['setup_site_session_path'] = $_REQUEST['setup_site_session_path']; |
| 608 | - }else{ |
|
| 607 | + } else{ |
|
| 609 | 608 | $_SESSION['setup_site_session_path'] = ''; |
| 610 | 609 | } |
| 611 | 610 | |
| 612 | 611 | $_SESSION['setup_site_custom_log_dir'] = get_boolean_from_request('setup_site_custom_log_dir'); |
| 613 | 612 | if($_SESSION['setup_site_custom_log_dir']){ |
| 614 | 613 | $_SESSION['setup_site_log_dir'] = $_REQUEST['setup_site_log_dir']; |
| 615 | - }else{ |
|
| 614 | + } else{ |
|
| 616 | 615 | $_SESSION['setup_site_log_dir'] = '.'; |
| 617 | 616 | } |
| 618 | 617 | |
| 619 | 618 | $_SESSION['setup_site_specify_guid'] = get_boolean_from_request('setup_site_specify_guid'); |
| 620 | 619 | if($_SESSION['setup_site_specify_guid']){ |
| 621 | 620 | $_SESSION['setup_site_guid'] = $_REQUEST['setup_site_guid']; |
| 622 | - }else{ |
|
| 621 | + } else{ |
|
| 623 | 622 | $_SESSION['setup_site_guid'] = ''; |
| 624 | 623 | } |
| 625 | 624 | $_SESSION['siteConfig_submitted'] = true; |
| 626 | 625 | if(isset($_REQUEST['setup_site_sugarbeet_anonymous_stats'])){ |
| 627 | 626 | $_SESSION['setup_site_sugarbeet_anonymous_stats'] = get_boolean_from_request('setup_site_sugarbeet_anonymous_stats'); |
| 628 | - }else{ |
|
| 627 | + } else{ |
|
| 629 | 628 | $_SESSION['setup_site_sugarbeet_anonymous_stats'] = 0; |
| 630 | 629 | } |
| 631 | 630 | |
@@ -640,13 +639,12 @@ discard block |
||
| 640 | 639 | |
| 641 | 640 | if($next_step == 9999) { |
| 642 | 641 | $the_file = 'SilentInstall'; |
| 643 | - }else if($next_step == 9191) { |
|
| 642 | + } else if($next_step == 9191) { |
|
| 644 | 643 | $_SESSION['oc_server_url'] = $_REQUEST['oc_server_url']; |
| 645 | 644 | $_SESSION['oc_username'] = $_REQUEST['oc_username']; |
| 646 | 645 | $_SESSION['oc_password'] = $_REQUEST['oc_password']; |
| 647 | 646 | $the_file = 'oc_convert.php'; |
| 648 | - } |
|
| 649 | - else{ |
|
| 647 | + } else{ |
|
| 650 | 648 | $the_file = $workflow[$next_step]; |
| 651 | 649 | |
| 652 | 650 | } |