@@ -114,11 +114,17 @@ discard block |
||
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | |
| 117 | + /** |
|
| 118 | + * @return string |
|
| 119 | + */ |
|
| 117 | 120 | public function unformatField($formattedField, $vardef){ |
| 118 | 121 | // The base field doesn't do any formatting, so override it in subclasses for more specific actions |
| 119 | 122 | return $formattedField; |
| 120 | 123 | } |
| 121 | 124 | |
| 125 | + /** |
|
| 126 | + * @param string $view |
|
| 127 | + */ |
|
| 122 | 128 | function getSmartyView($parentFieldArray, $vardef, $displayParams, $tabindex = -1, $view){ |
| 123 | 129 | $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex); |
| 124 | 130 | |
@@ -376,6 +382,9 @@ discard block |
||
| 376 | 382 | |
| 377 | 383 | } |
| 378 | 384 | |
| 385 | + /** |
|
| 386 | + * @param string $fieldType |
|
| 387 | + */ |
|
| 379 | 388 | protected function getAccessKey($vardef, $fieldType = null, $module = null) { |
| 380 | 389 | global $app_strings; |
| 381 | 390 | |
@@ -58,8 +58,7 @@ discard block |
||
| 58 | 58 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 59 | 59 | if(isset($GLOBALS['log'])) { |
| 60 | 60 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 61 | - } |
|
| 62 | - else { |
|
| 61 | + } else { |
|
| 63 | 62 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 64 | 63 | } |
| 65 | 64 | self::__construct($type); |
@@ -148,8 +147,7 @@ discard block |
||
| 148 | 147 | if ($this->type != 'Enum' && $this->type != 'Radioenum') |
| 149 | 148 | { |
| 150 | 149 | $parentFieldArray = $this->setupFieldArray($parentFieldArray, $vardef); |
| 151 | - } |
|
| 152 | - else |
|
| 150 | + } else |
|
| 153 | 151 | { |
| 154 | 152 | $vardef['name'] = strtoupper($vardef['name']); |
| 155 | 153 | } |
@@ -208,15 +206,18 @@ discard block |
||
| 208 | 206 | |
| 209 | 207 | |
| 210 | 208 | function getSearchViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) { |
| 211 | - if(!empty($vardef['auto_increment']))$vardef['len']=255; |
|
| 209 | + if(!empty($vardef['auto_increment'])) { |
|
| 210 | + $vardef['len']=255; |
|
| 211 | + } |
|
| 212 | 212 | return $this->getSmartyView($parentFieldArray, $vardef, $displayParams, $tabindex, 'EditView'); |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | function getPopupViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex){ |
| 216 | - if (is_array($displayParams) && !isset($displayParams['formName'])) |
|
| 217 | - $displayParams['formName'] = 'popup_query_form'; |
|
| 218 | - else if (empty($displayParams)) |
|
| 219 | - $displayParams = array('formName' => 'popup_query_form'); |
|
| 216 | + if (is_array($displayParams) && !isset($displayParams['formName'])) { |
|
| 217 | + $displayParams['formName'] = 'popup_query_form'; |
|
| 218 | + } else if (empty($displayParams)) { |
|
| 219 | + $displayParams = array('formName' => 'popup_query_form'); |
|
| 220 | + } |
|
| 220 | 221 | return $this->getSearchViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex); |
| 221 | 222 | } |
| 222 | 223 | |
@@ -340,8 +341,7 @@ discard block |
||
| 340 | 341 | { |
| 341 | 342 | $this->ss->left_delimiter = '{{'; |
| 342 | 343 | $this->ss->right_delimiter = '}}'; |
| 343 | - } |
|
| 344 | - else |
|
| 344 | + } else |
|
| 345 | 345 | { |
| 346 | 346 | $this->ss->left_delimiter = '{'; |
| 347 | 347 | $this->ss->right_delimiter = '}'; |
@@ -480,8 +480,7 @@ discard block |
||
| 480 | 480 | if ( isset($params[$prefix.$field]) ) { |
| 481 | 481 | if(isset($properties['len']) && isset($properties['type']) && $this->isTrimmable($properties['type'])){ |
| 482 | 482 | $bean->$field = trim($this->unformatField($params[$prefix.$field], $properties)); |
| 483 | - } |
|
| 484 | - else { |
|
| 483 | + } else { |
|
| 485 | 484 | $bean->$field = $this->unformatField($params[$prefix.$field], $properties); |
| 486 | 485 | } |
| 487 | 486 | } |
@@ -57,8 +57,7 @@ discard block |
||
| 57 | 57 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 58 | 58 | if(isset($GLOBALS['log'])) { |
| 59 | 59 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 60 | - } |
|
| 61 | - else { |
|
| 60 | + } else { |
|
| 62 | 61 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 63 | 62 | } |
| 64 | 63 | self::__construct(); |
@@ -124,8 +123,9 @@ discard block |
||
| 124 | 123 | $type_str = ''; |
| 125 | 124 | foreach($types as $type){ |
| 126 | 125 | $type_str .= "'".$type."'"; |
| 127 | - if($index < $count) |
|
| 128 | - $type_str .= ","; |
|
| 126 | + if($index < $count) { |
|
| 127 | + $type_str .= ","; |
|
| 128 | + } |
|
| 129 | 129 | $index++; |
| 130 | 130 | } |
| 131 | 131 | |
@@ -310,18 +310,20 @@ discard block |
||
| 310 | 310 | } |
| 311 | 311 | if(isset($_REQUEST['terms_checked'])) { |
| 312 | 312 | $terms_checked = $_REQUEST['terms_checked']; |
| 313 | - if($terms_checked == 'on') |
|
| 314 | - $terms_checked = true; |
|
| 313 | + if($terms_checked == 'on') { |
|
| 314 | + $terms_checked = true; |
|
| 315 | + } |
|
| 315 | 316 | } |
| 316 | 317 | |
| 317 | 318 | if(!empty($username) && !empty($password)){ |
| 318 | 319 | $password = md5($password); |
| 319 | 320 | $result = PackageManager::authenticate($username, $password, $servername, $terms_checked); |
| 320 | - if(!is_array($result) && $result == true) |
|
| 321 | - $status = 'success'; |
|
| 322 | - else |
|
| 323 | - $status = $result['faultstring']; |
|
| 324 | - }else{ |
|
| 321 | + if(!is_array($result) && $result == true) { |
|
| 322 | + $status = 'success'; |
|
| 323 | + } else { |
|
| 324 | + $status = $result['faultstring']; |
|
| 325 | + } |
|
| 326 | + } else{ |
|
| 325 | 327 | $status = 'failed'; |
| 326 | 328 | } |
| 327 | 329 | |
@@ -67,8 +67,7 @@ discard block |
||
| 67 | 67 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 68 | 68 | if(isset($GLOBALS['log'])) { |
| 69 | 69 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 70 | - } |
|
| 71 | - else { |
|
| 70 | + } else { |
|
| 72 | 71 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 73 | 72 | } |
| 74 | 73 | self::__construct(); |
@@ -88,7 +87,7 @@ discard block |
||
| 88 | 87 | if(!empty($name_value_list)){ |
| 89 | 88 | $name_value_list = PackageManager::fromNameValueList($name_value_list); |
| 90 | 89 | return $name_value_list['description']; |
| 91 | - }else { |
|
| 90 | + } else { |
|
| 92 | 91 | return ''; |
| 93 | 92 | } |
| 94 | 93 | } |
@@ -134,8 +133,9 @@ discard block |
||
| 134 | 133 | //check to see if we already this one installed |
| 135 | 134 | $result = $uh->determineIfUpgrade($myrelease['id_name'], $myrelease['version']); |
| 136 | 135 | $enable = false; |
| 137 | - if($result == true || is_array($result)) |
|
| 138 | - $enable = true; |
|
| 136 | + if($result == true || is_array($result)) { |
|
| 137 | + $enable = true; |
|
| 138 | + } |
|
| 139 | 139 | $nodes[$mypack['category_id']]['packages'][$mypack['id']]['releases'][$myrelease['id']] = array('id' => $myrelease['id'], 'version' => $myrelease['version'], 'label' => $myrelease['description'], 'category_id' => $mypack['category_id'], 'package_id' => $mypack['id'], 'type' => 'release', 'enable' => $enable); |
| 140 | 140 | } |
| 141 | 141 | } |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | $filepath = PackageManagerComm::performDownload($filename); |
| 214 | 214 | return $filepath; |
| 215 | 215 | } |
| 216 | - }else{ |
|
| 216 | + } else{ |
|
| 217 | 217 | return null; |
| 218 | 218 | } |
| 219 | 219 | } |
@@ -231,10 +231,11 @@ discard block |
||
| 231 | 231 | PackageManager::setCredentials($username, $password, $systemname); |
| 232 | 232 | PackageManagerComm::clearSession(); |
| 233 | 233 | $result = PackageManagerComm::login($terms_checked); |
| 234 | - if(is_array($result)) |
|
| 235 | - return $result; |
|
| 236 | - else |
|
| 237 | - return true; |
|
| 234 | + if(is_array($result)) { |
|
| 235 | + return $result; |
|
| 236 | + } else { |
|
| 237 | + return true; |
|
| 238 | + } |
|
| 238 | 239 | } |
| 239 | 240 | |
| 240 | 241 | function setCredentials($username, $password, $systemname){ |
@@ -285,7 +286,7 @@ discard block |
||
| 285 | 286 | if(!empty($release_id) || !empty($package_id)){ |
| 286 | 287 | $documents = PackageManagerComm::getDocumentation($package_id, $release_id); |
| 287 | 288 | return $documents; |
| 288 | - }else{ |
|
| 289 | + } else{ |
|
| 289 | 290 | return null; |
| 290 | 291 | } |
| 291 | 292 | } |
@@ -480,8 +481,9 @@ discard block |
||
| 480 | 481 | $base_tmp_upgrade_dir = "$base_upgrade_dir/temp"; |
| 481 | 482 | $manifest_file = $this->extractManifest( $base_filename,$base_tmp_upgrade_dir); |
| 482 | 483 | $GLOBALS['log']->debug("Manifest: ".$manifest_file); |
| 483 | - if($view == 'module') |
|
| 484 | - $license_file = $this->extractFile($base_filename, 'LICENSE.txt', $base_tmp_upgrade_dir); |
|
| 484 | + if($view == 'module') { |
|
| 485 | + $license_file = $this->extractFile($base_filename, 'LICENSE.txt', $base_tmp_upgrade_dir); |
|
| 486 | + } |
|
| 485 | 487 | if(is_file($manifest_file)){ |
| 486 | 488 | $GLOBALS['log']->debug("VALIDATING MANIFEST". $manifest_file); |
| 487 | 489 | require_once( $manifest_file ); |
@@ -492,14 +494,16 @@ discard block |
||
| 492 | 494 | if( $view == "module" ){ |
| 493 | 495 | if ($upgrade_zip_type != "module" && $upgrade_zip_type != "theme" && $upgrade_zip_type != "langpack"){ |
| 494 | 496 | $this->unlinkTempFiles(); |
| 495 | - if($display_messages) |
|
| 496 | - die($mod_strings['ERR_UW_NOT_ACCEPTIBLE_TYPE']); |
|
| 497 | + if($display_messages) { |
|
| 498 | + die($mod_strings['ERR_UW_NOT_ACCEPTIBLE_TYPE']); |
|
| 499 | + } |
|
| 497 | 500 | } |
| 498 | - }elseif( $view == "default" ){ |
|
| 501 | + } elseif( $view == "default" ){ |
|
| 499 | 502 | if($upgrade_zip_type != "patch" ){ |
| 500 | 503 | $this->unlinkTempFiles(); |
| 501 | - if($display_messages) |
|
| 502 | - die($mod_strings['ERR_UW_ONLY_PATCHES']); |
|
| 504 | + if($display_messages) { |
|
| 505 | + die($mod_strings['ERR_UW_ONLY_PATCHES']); |
|
| 506 | + } |
|
| 503 | 507 | } |
| 504 | 508 | } |
| 505 | 509 | |
@@ -517,20 +521,24 @@ discard block |
||
| 517 | 521 | |
| 518 | 522 | if( copy( $tempFile , $target_path ) ){ |
| 519 | 523 | copy( $manifest_file, $target_manifest ); |
| 520 | - if($display_messages) |
|
| 521 | - $messages = '<script>ajaxStatus.flashStatus("' .$base_filename.$mod_strings['LBL_UW_UPLOAD_SUCCESS'] . ', 5000");</script>'; |
|
| 522 | - }else{ |
|
| 523 | - if($display_messages) |
|
| 524 | - $messages = '<script>ajaxStatus.flashStatus("' .$mod_strings['ERR_UW_UPLOAD_ERROR'] . ', 5000");</script>'; |
|
| 524 | + if($display_messages) { |
|
| 525 | + $messages = '<script>ajaxStatus.flashStatus("' .$base_filename.$mod_strings['LBL_UW_UPLOAD_SUCCESS'] . ', 5000");</script>'; |
|
| 526 | + } |
|
| 527 | + } else{ |
|
| 528 | + if($display_messages) { |
|
| 529 | + $messages = '<script>ajaxStatus.flashStatus("' .$mod_strings['ERR_UW_UPLOAD_ERROR'] . ', 5000");</script>'; |
|
| 530 | + } |
|
| 525 | 531 | } |
| 526 | 532 | }//fi |
| 527 | 533 | else{ |
| 528 | 534 | $this->unlinkTempFiles(); |
| 529 | - if($display_messages) |
|
| 530 | - die($mod_strings['ERR_UW_NO_MANIFEST']); |
|
| 535 | + if($display_messages) { |
|
| 536 | + die($mod_strings['ERR_UW_NO_MANIFEST']); |
|
| 537 | + } |
|
| 538 | + } |
|
| 539 | + if(isset($messages)) { |
|
| 540 | + return $messages; |
|
| 531 | 541 | } |
| 532 | - if(isset($messages)) |
|
| 533 | - return $messages; |
|
| 534 | 542 | } |
| 535 | 543 | |
| 536 | 544 | function unlinkTempFiles() { |
@@ -568,14 +576,15 @@ discard block |
||
| 568 | 576 | $version = $manifest['version']; |
| 569 | 577 | $uh = new UpgradeHistory(); |
| 570 | 578 | $previous_install = array(); |
| 571 | - if(!empty($id_name) & !empty($version)) |
|
| 572 | - $previous_install = $uh->determineIfUpgrade($id_name, $version); |
|
| 579 | + if(!empty($id_name) & !empty($version)) { |
|
| 580 | + $previous_install = $uh->determineIfUpgrade($id_name, $version); |
|
| 581 | + } |
|
| 573 | 582 | $previous_version = (empty($previous_install['version'])) ? '' : $previous_install['version']; |
| 574 | 583 | $previous_id = (empty($previous_install['id'])) ? '' : $previous_install['id']; |
| 575 | 584 | |
| 576 | 585 | if(!empty($previous_version)){ |
| 577 | 586 | $mi->install($unzip_dir, true, $previous_version); |
| 578 | - }else{ |
|
| 587 | + } else{ |
|
| 579 | 588 | $mi->install($unzip_dir); |
| 580 | 589 | } |
| 581 | 590 | $GLOBALS['log']->debug("INSTALLED: ".$file); |
@@ -612,7 +621,9 @@ discard block |
||
| 612 | 621 | $base_upgrade_dir = $this->upload_dir.'/upgrades'; |
| 613 | 622 | $base_tmp_upgrade_dir = "$base_upgrade_dir/temp"; |
| 614 | 623 | if(is_file($found->filename)){ |
| 615 | - if(!isset($GLOBALS['mi_remove_tables']))$GLOBALS['mi_remove_tables'] = true; |
|
| 624 | + if(!isset($GLOBALS['mi_remove_tables'])) { |
|
| 625 | + $GLOBALS['mi_remove_tables'] = true; |
|
| 626 | + } |
|
| 616 | 627 | $unzip_dir = mk_temp_dir( $base_tmp_upgrade_dir ); |
| 617 | 628 | unzip($found->filename, $unzip_dir ); |
| 618 | 629 | $mi = new ModuleInstaller(); |
@@ -621,7 +632,7 @@ discard block |
||
| 621 | 632 | $found->delete(); |
| 622 | 633 | unlink(remove_file_extension( $found->filename ) . '-manifest.php'); |
| 623 | 634 | unlink($found->filename); |
| 624 | - }else{ |
|
| 635 | + } else{ |
|
| 625 | 636 | //file(s_ have been deleted or are not found in the directory, allow database delete to happen but no need to change filesystem |
| 626 | 637 | $found->delete(); |
| 627 | 638 | } |
@@ -767,7 +778,7 @@ discard block |
||
| 767 | 778 | if(is_file($license_file)){ |
| 768 | 779 | $contents = file_get_contents($license_file); |
| 769 | 780 | return $contents; |
| 770 | - }else{ |
|
| 781 | + } else{ |
|
| 771 | 782 | return null; |
| 772 | 783 | } |
| 773 | 784 | } |
@@ -849,7 +860,7 @@ discard block |
||
| 849 | 860 | $serial_manifest['upgrade_manifest'] = (isset($upgrade_manifest) ? $upgrade_manifest : ''); |
| 850 | 861 | $installed->manifest = base64_encode(serialize($serial_manifest)); |
| 851 | 862 | $installed->save(); |
| 852 | - }else{ |
|
| 863 | + } else{ |
|
| 853 | 864 | $serial_manifest = unserialize(base64_decode($installed->manifest)); |
| 854 | 865 | $manifest = $serial_manifest['manifest']; |
| 855 | 866 | } |
@@ -859,8 +870,9 @@ discard block |
||
| 859 | 870 | $uninstallable = true; |
| 860 | 871 | } |
| 861 | 872 | $enabled = $installed->enabled; |
| 862 | - if(!$enabled) |
|
| 863 | - $enabled_string = 'DISABLED'; |
|
| 873 | + if(!$enabled) { |
|
| 874 | + $enabled_string = 'DISABLED'; |
|
| 875 | + } |
|
| 864 | 876 | $file_uninstall = $filename; |
| 865 | 877 | if(!$uninstallable){ |
| 866 | 878 | $file_uninstall = 'UNINSTALLABLE'; |
@@ -1,6 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if (! defined ( 'sugarEntry' ) || ! sugarEntry) |
|
| 2 | +if (! defined ( 'sugarEntry' ) || ! sugarEntry) { |
|
| 3 | 3 | die ( 'Not A Valid Entry Point' ) ; |
| 4 | +} |
|
| 4 | 5 | |
| 5 | 6 | /********************************************************************************* |
| 6 | 7 | * SugarCRM Community Edition is a customer relationship management program developed by |
@@ -58,8 +59,7 @@ discard block |
||
| 58 | 59 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 59 | 60 | if(isset($GLOBALS['log'])) { |
| 60 | 61 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 61 | - } |
|
| 62 | - else { |
|
| 62 | + } else { |
|
| 63 | 63 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 64 | 64 | } |
| 65 | 65 | self::__construct($module); |
@@ -117,9 +117,12 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | function buildCache($module = false, $saveCache=true) { |
| 119 | 119 | //We can't build the cache while installing as the required database tables may not exist. |
| 120 | - if (!empty($GLOBALS['installing']) && $GLOBALS['installing'] == true|| empty($GLOBALS['db'])) |
|
| 120 | + if (!empty($GLOBALS['installing']) && $GLOBALS['installing'] == true|| empty($GLOBALS['db'])) { |
|
| 121 | + return false; |
|
| 122 | + } |
|
| 123 | + if($module == '../data') { |
|
| 121 | 124 | return false; |
| 122 | - if($module == '../data')return false; |
|
| 125 | + } |
|
| 123 | 126 | |
| 124 | 127 | static $results = array ( ) ; |
| 125 | 128 | |
@@ -127,8 +130,7 @@ discard block |
||
| 127 | 130 | if (! empty ( $module )) { |
| 128 | 131 | $where .= " custom_module='$module' AND "; |
| 129 | 132 | unset( $results[ $module ] ) ; // clear out any old results for the module as $results is declared static |
| 130 | - } |
|
| 131 | - else |
|
| 133 | + } else |
|
| 132 | 134 | { |
| 133 | 135 | $results = array ( ) ; // clear out results - if we remove a module we don't want to have its old vardefs hanging around |
| 134 | 136 | } |
@@ -152,10 +154,12 @@ discard block |
||
| 152 | 154 | $vardef = $field->get_field_def (); |
| 153 | 155 | $vardef ['id'] = $row ['id']; |
| 154 | 156 | $vardef ['custom_module'] = $row ['custom_module']; |
| 155 | - if (empty ( $vardef ['source'] )) |
|
| 156 | - $vardef ['source'] = 'custom_fields'; |
|
| 157 | - if (empty ( $results [$row ['custom_module']] )) |
|
| 158 | - $results [$row ['custom_module']] = array ( ); |
|
| 157 | + if (empty ( $vardef ['source'] )) { |
|
| 158 | + $vardef ['source'] = 'custom_fields'; |
|
| 159 | + } |
|
| 160 | + if (empty ( $results [$row ['custom_module']] )) { |
|
| 161 | + $results [$row ['custom_module']] = array ( ); |
|
| 162 | + } |
|
| 159 | 163 | $results [$row ['custom_module']] [$row ['name']] = $vardef; |
| 160 | 164 | } |
| 161 | 165 | if (empty ( $module )) { |
@@ -165,7 +169,7 @@ discard block |
||
| 165 | 169 | } else { |
| 166 | 170 | if (! empty ( $results [$module] )) { |
| 167 | 171 | $this->saveToVardef ( $module, $results [$module], $saveCache); |
| 168 | - }else{ |
|
| 172 | + } else{ |
|
| 169 | 173 | $this->saveToVardef ( $module, false, $saveCache); |
| 170 | 174 | } |
| 171 | 175 | } |
@@ -210,7 +214,9 @@ discard block |
||
| 210 | 214 | //if the vardef isn't loaded let's try loading it. |
| 211 | 215 | VardefManager::refreshVardefs($module,$object, null, false); |
| 212 | 216 | //if it's still not loaded we really don't have anything useful to cache |
| 213 | - if(empty($GLOBALS['dictionary'][$object]['fields']))return; |
|
| 217 | + if(empty($GLOBALS['dictionary'][$object]['fields'])) { |
|
| 218 | + return; |
|
| 219 | + } |
|
| 214 | 220 | } |
| 215 | 221 | if (!isset($GLOBALS['dictionary'][$object]['custom_fields'])) { |
| 216 | 222 | $GLOBALS['dictionary'][$object]['custom_fields'] = false; |
@@ -280,8 +286,7 @@ discard block |
||
| 280 | 286 | if (empty($expandedList) ) |
| 281 | 287 | { |
| 282 | 288 | $select = ",{$this->bean->table_name}_cstm.*" ; |
| 283 | - } |
|
| 284 | - else |
|
| 289 | + } else |
|
| 285 | 290 | { |
| 286 | 291 | $select = ''; |
| 287 | 292 | $isList = is_array($expandedList); |
@@ -290,8 +295,9 @@ discard block |
||
| 290 | 295 | if (!empty($field['source']) && $field['source'] == 'custom_fields' && (!$isList || !empty($expandedList[$name]))){ |
| 291 | 296 | // assumption: that the column name in _cstm is the same as the field name. Currently true. |
| 292 | 297 | // however, two types of dynamic fields do not have columns in the custom table - html fields (they're readonly) and flex relates (parent_name doesn't exist) |
| 293 | - if ( $field['type'] != 'html' && $name != 'parent_name') |
|
| 294 | - $select .= ",{$this->bean->table_name}_cstm.{$name}" ; |
|
| 298 | + if ( $field['type'] != 'html' && $name != 'parent_name') { |
|
| 299 | + $select .= ",{$this->bean->table_name}_cstm.{$name}" ; |
|
| 300 | + } |
|
| 295 | 301 | } |
| 296 | 302 | } |
| 297 | 303 | } |
@@ -346,8 +352,7 @@ discard block |
||
| 346 | 352 | else if(!empty($rel_mod->field_defs['name']['source']) && $rel_mod->field_defs['name']['source'] == "non-db" && !empty($field_def['rname'])) |
| 347 | 353 | { |
| 348 | 354 | $name_field = "$joinTableAlias." . $field_def['rname']; |
| 349 | - } |
|
| 350 | - else |
|
| 355 | + } else |
|
| 351 | 356 | { |
| 352 | 357 | $name_field = "$joinTableAlias.name"; |
| 353 | 358 | } |
@@ -369,12 +374,16 @@ discard block |
||
| 369 | 374 | function fill_relationships(){ |
| 370 | 375 | global $beanList, $beanFiles; |
| 371 | 376 | if(!empty($this->bean->relDepth)) { |
| 372 | - if($this->bean->relDepth > 1)return; |
|
| 373 | - }else{ |
|
| 377 | + if($this->bean->relDepth > 1) { |
|
| 378 | + return; |
|
| 379 | + } |
|
| 380 | + } else{ |
|
| 374 | 381 | $this->bean->relDepth = 0; |
| 375 | 382 | } |
| 376 | 383 | foreach($this->bean->field_defs as $field){ |
| 377 | - if(empty($field['source']) || $field['source'] != 'custom_fields')continue; |
|
| 384 | + if(empty($field['source']) || $field['source'] != 'custom_fields') { |
|
| 385 | + continue; |
|
| 386 | + } |
|
| 378 | 387 | if($field['type'] == 'relate'){ |
| 379 | 388 | $related_module =$field['ext2']; |
| 380 | 389 | $name = $field['name']; |
@@ -413,8 +422,12 @@ discard block |
||
| 413 | 422 | $first = true; |
| 414 | 423 | foreach($this->bean->field_defs as $name=>$field){ |
| 415 | 424 | |
| 416 | - if(empty($field['source']) || $field['source'] != 'custom_fields')continue; |
|
| 417 | - if($field['type'] == 'html' || $field['type'] == 'parent')continue; |
|
| 425 | + if(empty($field['source']) || $field['source'] != 'custom_fields') { |
|
| 426 | + continue; |
|
| 427 | + } |
|
| 428 | + if($field['type'] == 'html' || $field['type'] == 'parent') { |
|
| 429 | + continue; |
|
| 430 | + } |
|
| 418 | 431 | if(isset($this->bean->$name)){ |
| 419 | 432 | $quote = "'"; |
| 420 | 433 | |
@@ -423,16 +436,17 @@ discard block |
||
| 423 | 436 | if(!isset($this->bean->$name) || !is_numeric($this->bean->$name) ){ |
| 424 | 437 | if($field['required']){ |
| 425 | 438 | $this->bean->$name = 0; |
| 426 | - }else{ |
|
| 439 | + } else{ |
|
| 427 | 440 | $this->bean->$name = 'NULL'; |
| 428 | 441 | } |
| 429 | 442 | } |
| 430 | 443 | } |
| 431 | 444 | if ( $field['type'] == 'bool' ) { |
| 432 | - if ( $this->bean->$name === FALSE ) |
|
| 433 | - $this->bean->$name = '0'; |
|
| 434 | - elseif ( $this->bean->$name === TRUE ) |
|
| 435 | - $this->bean->$name = '1'; |
|
| 445 | + if ( $this->bean->$name === FALSE ) { |
|
| 446 | + $this->bean->$name = '0'; |
|
| 447 | + } elseif ( $this->bean->$name === TRUE ) { |
|
| 448 | + $this->bean->$name = '1'; |
|
| 449 | + } |
|
| 436 | 450 | } |
| 437 | 451 | |
| 438 | 452 | $val = $this->bean->$name; |
@@ -445,7 +459,7 @@ discard block |
||
| 445 | 459 | if($first){ |
| 446 | 460 | $query .= " $name=$quote".$GLOBALS['db']->quote($val)."$quote"; |
| 447 | 461 | |
| 448 | - }else{ |
|
| 462 | + } else{ |
|
| 449 | 463 | $query .= " ,$name=$quote".$GLOBALS['db']->quote($val)."$quote"; |
| 450 | 464 | } |
| 451 | 465 | } |
@@ -464,7 +478,7 @@ discard block |
||
| 464 | 478 | if(!$first){ |
| 465 | 479 | if(!$isUpdate){ |
| 466 | 480 | $GLOBALS['db']->query($queryInsert); |
| 467 | - }else{ |
|
| 481 | + } else{ |
|
| 468 | 482 | $checkquery = "SELECT id_c FROM {$this->bean->table_name}_cstm WHERE id_c = '{$this->bean->id}'"; |
| 469 | 483 | if ( $GLOBALS['db']->getOne($checkquery) ) { |
| 470 | 484 | $result = $GLOBALS['db']->query($query); |
@@ -499,8 +513,9 @@ discard block |
||
| 499 | 513 | |
| 500 | 514 | $GLOBALS['db']->query("DELETE FROM fields_meta_data WHERE id='" . $this->module . $widget->name . "'"); |
| 501 | 515 | $sql = $widget->get_db_delete_alter_table( $this->bean->table_name . "_cstm" ) ; |
| 502 | - if (! empty( $sql ) ) |
|
| 503 | - $GLOBALS['db']->query( $sql ); |
|
| 516 | + if (! empty( $sql ) ) { |
|
| 517 | + $GLOBALS['db']->query( $sql ); |
|
| 518 | + } |
|
| 504 | 519 | |
| 505 | 520 | $this->removeVardefExtension($widget); |
| 506 | 521 | VardefManager::clearVardef(); |
@@ -518,19 +533,21 @@ discard block |
||
| 518 | 533 | $name = $this->getDBName($name); |
| 519 | 534 | $vardefs = $GLOBALS['dictionary'][$this->bean->object_name]['fields']; |
| 520 | 535 | if(!empty($vardefs)){ |
| 521 | - if(empty($type) && empty($name)) |
|
| 522 | - return false; |
|
| 523 | - else if(empty($type)) |
|
| 524 | - return !empty($vardefs[$name]); |
|
| 525 | - else if(empty($name)){ |
|
| 536 | + if(empty($type) && empty($name)) { |
|
| 537 | + return false; |
|
| 538 | + } else if(empty($type)) { |
|
| 539 | + return !empty($vardefs[$name]); |
|
| 540 | + } else if(empty($name)){ |
|
| 526 | 541 | foreach($vardefs as $def){ |
| 527 | - if(!empty($def['type']) && $def['type'] == $type) |
|
| 528 | - return true; |
|
| 542 | + if(!empty($def['type']) && $def['type'] == $type) { |
|
| 543 | + return true; |
|
| 544 | + } |
|
| 529 | 545 | } |
| 530 | 546 | return false; |
| 531 | - }else |
|
| 532 | - return (!empty($vardefs[$name]) && ($vardefs[$name]['type'] == $type)); |
|
| 533 | - }else{ |
|
| 547 | + } else { |
|
| 548 | + return (!empty($vardefs[$name]) && ($vardefs[$name]['type'] == $type)); |
|
| 549 | + } |
|
| 550 | + } else{ |
|
| 534 | 551 | return false; |
| 535 | 552 | } |
| 536 | 553 | } |
@@ -553,7 +570,7 @@ discard block |
||
| 553 | 570 | $label = strtoupper( $field->label ); |
| 554 | 571 | if(!empty($id)){ |
| 555 | 572 | $is_update = true; |
| 556 | - }else{ |
|
| 573 | + } else{ |
|
| 557 | 574 | $db_name = $this->getDBName($field->name); |
| 558 | 575 | $field->name = $db_name; |
| 559 | 576 | } |
@@ -564,8 +581,10 @@ discard block |
||
| 564 | 581 | $fmd->vname = $label; |
| 565 | 582 | $fmd->type = $field->type; |
| 566 | 583 | $fmd->help = $field->help; |
| 567 | - if (!empty($field->len)) |
|
| 568 | - $fmd->len = $field->len; // tyoung bug 15407 - was being set to $field->size so changes weren't being saved |
|
| 584 | + if (!empty($field->len)) { |
|
| 585 | + $fmd->len = $field->len; |
|
| 586 | + } |
|
| 587 | + // tyoung bug 15407 - was being set to $field->size so changes weren't being saved |
|
| 569 | 588 | $fmd->required = ($field->required ? 1 : 0); |
| 570 | 589 | $fmd->default_value = $field->default; |
| 571 | 590 | $fmd->ext1 = $field->ext1; |
@@ -605,7 +624,7 @@ discard block |
||
| 605 | 624 | $GLOBALS['db']->query($query, true, "Cannot set default"); |
| 606 | 625 | } |
| 607 | 626 | } |
| 608 | - }else{ |
|
| 627 | + } else{ |
|
| 609 | 628 | $query = $field->get_db_modify_alter_table($this->bean->table_name . '_cstm'); |
| 610 | 629 | if(!empty($query)){ |
| 611 | 630 | $GLOBALS['db']->query($query, true, "Cannot modify field"); |
@@ -685,16 +704,16 @@ discard block |
||
| 685 | 704 | |
| 686 | 705 | $out .= "\n ?>"; |
| 687 | 706 | |
| 688 | - if (!file_exists($this->base_path)) |
|
| 689 | - mkdir_recursive($this->base_path); |
|
| 707 | + if (!file_exists($this->base_path)) { |
|
| 708 | + mkdir_recursive($this->base_path); |
|
| 709 | + } |
|
| 690 | 710 | |
| 691 | 711 | if( $fh = @sugar_fopen( $file_loc, 'w' ) ) |
| 692 | 712 | { |
| 693 | 713 | fputs( $fh, $out); |
| 694 | 714 | fclose( $fh ); |
| 695 | 715 | return true ; |
| 696 | - } |
|
| 697 | - else |
|
| 716 | + } else |
|
| 698 | 717 | { |
| 699 | 718 | return false ; |
| 700 | 719 | } |
@@ -815,8 +834,9 @@ discard block |
||
| 815 | 834 | $out = ""; |
| 816 | 835 | if($this->bean->hasCustomFields()){ |
| 817 | 836 | foreach($this->bean->field_defs as $name=>$data){ |
| 818 | - if(empty($data['source']) || $data['source'] != 'custom_fields') |
|
| 819 | - continue; |
|
| 837 | + if(empty($data['source']) || $data['source'] != 'custom_fields') { |
|
| 838 | + continue; |
|
| 839 | + } |
|
| 820 | 840 | $out .= $this->add_existing_custom_field($data, $execute); |
| 821 | 841 | } |
| 822 | 842 | } |
@@ -831,8 +851,9 @@ discard block |
||
| 831 | 851 | $query = "/*MISSING IN DATABASE - {$data['name']} - ROW*/\n" |
| 832 | 852 | . $field->get_db_add_alter_table($this->bean->table_name . '_cstm'); |
| 833 | 853 | $out = $query . "\n"; |
| 834 | - if ($execute) |
|
| 835 | - $GLOBALS['db']->query($query); |
|
| 854 | + if ($execute) { |
|
| 855 | + $GLOBALS['db']->query($query); |
|
| 856 | + } |
|
| 836 | 857 | |
| 837 | 858 | return $out; |
| 838 | 859 | } |
@@ -841,16 +862,18 @@ discard block |
||
| 841 | 862 | { |
| 842 | 863 | $out = $this->createCustomTable($execute); |
| 843 | 864 | //If the table didn't exist, createCustomTable will have returned all the SQL to create and populate it |
| 844 | - if (!empty($out)) |
|
| 845 | - return "/*Checking Custom Fields for module : {$this->module} */\n$out"; |
|
| 865 | + if (!empty($out)) { |
|
| 866 | + return "/*Checking Custom Fields for module : {$this->module} */\n$out"; |
|
| 867 | + } |
|
| 846 | 868 | //Otherwise make sure all the custom fields defined in the vardefs exist in the custom table. |
| 847 | 869 | //We aren't checking for data types, just that the column exists. |
| 848 | 870 | $db = $GLOBALS['db']; |
| 849 | 871 | $tablename = $this->bean->table_name."_cstm"; |
| 850 | 872 | $compareFieldDefs = $db->get_columns($tablename); |
| 851 | 873 | foreach($this->bean->field_defs as $name=>$data){ |
| 852 | - if(empty($data['source']) || $data['source'] != 'custom_fields') |
|
| 853 | - continue; |
|
| 874 | + if(empty($data['source']) || $data['source'] != 'custom_fields') { |
|
| 875 | + continue; |
|
| 876 | + } |
|
| 854 | 877 | /** |
| 855 | 878 | * @bug 43471 |
| 856 | 879 | * @issue 43471 |
@@ -864,8 +887,9 @@ discard block |
||
| 864 | 887 | } |
| 865 | 888 | $out .= $this->add_existing_custom_field($data, $execute); |
| 866 | 889 | } |
| 867 | - if (!empty($out)) |
|
| 868 | - $out = "/*Checking Custom Fields for module : {$this->module} */\n$out"; |
|
| 890 | + if (!empty($out)) { |
|
| 891 | + $out = "/*Checking Custom Fields for module : {$this->module} */\n$out"; |
|
| 892 | + } |
|
| 869 | 893 | |
| 870 | 894 | return $out; |
| 871 | 895 | } |
@@ -43,7 +43,9 @@ discard block |
||
| 43 | 43 | * Date: 06/03/15 |
| 44 | 44 | * Comments |
| 45 | 45 | */ |
| 46 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 46 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
| 47 | + die('Not A Valid Entry Point'); |
|
| 48 | +} |
|
| 47 | 49 | |
| 48 | 50 | class CasesController extends SugarController { |
| 49 | 51 | |
@@ -90,8 +92,7 @@ discard block |
||
| 90 | 92 | $count++; |
| 91 | 93 | } |
| 92 | 94 | echo '</table>'; |
| 93 | - } |
|
| 94 | - else { |
|
| 95 | + } else { |
|
| 95 | 96 | echo $mod_strings['LBL_NO_SUGGESTIONS']; |
| 96 | 97 | } |
| 97 | 98 | die(); |
@@ -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. |
@@ -83,8 +85,7 @@ discard block |
||
| 83 | 85 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 84 | 86 | if(isset($GLOBALS['log'])) { |
| 85 | 87 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 86 | - } |
|
| 87 | - else { |
|
| 88 | + } else { |
|
| 88 | 89 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 89 | 90 | } |
| 90 | 91 | self::__construct(); |
@@ -121,10 +122,11 @@ discard block |
||
| 121 | 122 | } |
| 122 | 123 | |
| 123 | 124 | while($row = $this->db->fetchByAssoc($result)) { |
| 124 | - if($row['category']."_".$row['name'] == 'ldap_admin_password' || $row['category']."_".$row['name'] == 'proxy_password') |
|
| 125 | - $this->settings[$row['category']."_".$row['name']] = $this->decrypt_after_retrieve($row['value']); |
|
| 126 | - else |
|
| 127 | - $this->settings[$row['category']."_".$row['name']] = $row['value']; |
|
| 125 | + if($row['category']."_".$row['name'] == 'ldap_admin_password' || $row['category']."_".$row['name'] == 'proxy_password') { |
|
| 126 | + $this->settings[$row['category']."_".$row['name']] = $this->decrypt_after_retrieve($row['value']); |
|
| 127 | + } else { |
|
| 128 | + $this->settings[$row['category']."_".$row['name']] = $row['value']; |
|
| 129 | + } |
|
| 128 | 130 | $this->settings[$row['category']] = true; |
| 129 | 131 | } |
| 130 | 132 | $this->settings[$category] = true; |
@@ -135,8 +137,9 @@ discard block |
||
| 135 | 137 | $oe->getSystemMailerSettings(); |
| 136 | 138 | |
| 137 | 139 | foreach ($oe->field_defs as $def) { |
| 138 | - if (strpos($def, "mail_") !== false) |
|
| 139 | - $this->settings[$def] = $oe->$def; |
|
| 140 | + if (strpos($def, "mail_") !== false) { |
|
| 141 | + $this->settings[$def] = $oe->$def; |
|
| 142 | + } |
|
| 140 | 143 | } |
| 141 | 144 | } |
| 142 | 145 | |
@@ -180,13 +183,13 @@ discard block |
||
| 180 | 183 | $row = $this->db->fetchByAssoc($result); |
| 181 | 184 | $row_count = $row['the_count']; |
| 182 | 185 | |
| 183 | - if($category."_".$key == 'ldap_admin_password' || $category."_".$key == 'proxy_password') |
|
| 184 | - $value = $this->encrpyt_before_save($value); |
|
| 186 | + if($category."_".$key == 'ldap_admin_password' || $category."_".$key == 'proxy_password') { |
|
| 187 | + $value = $this->encrpyt_before_save($value); |
|
| 188 | + } |
|
| 185 | 189 | |
| 186 | 190 | if( $row_count == 0){ |
| 187 | 191 | $result = $this->db->query("INSERT INTO config (value, category, name) VALUES ('$value','$category', '$key')"); |
| 188 | - } |
|
| 189 | - else{ |
|
| 192 | + } else{ |
|
| 190 | 193 | $result = $this->db->query("UPDATE config SET value = '{$value}' WHERE category = '{$category}' AND name = '{$key}'"); |
| 191 | 194 | } |
| 192 | 195 | sugar_cache_clear('admin_settings_cache'); |
@@ -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. |
@@ -85,8 +87,7 @@ discard block |
||
| 85 | 87 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 86 | 88 | if(isset($GLOBALS['log'])) { |
| 87 | 89 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 88 | - } |
|
| 89 | - else { |
|
| 90 | + } else { |
|
| 90 | 91 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 91 | 92 | } |
| 92 | 93 | self::__construct(); |
@@ -109,13 +110,13 @@ discard block |
||
| 109 | 110 | |
| 110 | 111 | if(empty($patch_to_check->id_name)){ |
| 111 | 112 | $where = " WHERE name = '$patch_to_check->name' "; |
| 112 | - }else{ |
|
| 113 | + } else{ |
|
| 113 | 114 | $where = " WHERE id_name = '$patch_to_check->id_name' "; |
| 114 | 115 | } |
| 115 | 116 | |
| 116 | 117 | if(!empty($patch_to_check->id)){ |
| 117 | 118 | $where .= " AND id != '$patch_to_check->id' "; |
| 118 | - }else{ |
|
| 119 | + } else{ |
|
| 119 | 120 | $where .= " AND id is not null "; |
| 120 | 121 | } |
| 121 | 122 | |
@@ -144,7 +145,7 @@ discard block |
||
| 144 | 145 | $result = $this->db->query($query); |
| 145 | 146 | if(empty($result)){ |
| 146 | 147 | return null; |
| 147 | - }else{ |
|
| 148 | + } else{ |
|
| 148 | 149 | $temp_version = 0; |
| 149 | 150 | $id = ''; |
| 150 | 151 | while($row = $this->db->fetchByAssoc($result)) |
@@ -154,10 +155,11 @@ discard block |
||
| 154 | 155 | $id = $row['id']; |
| 155 | 156 | } |
| 156 | 157 | }//end while |
| 157 | - if($this->is_right_version_greater(explode('.', $temp_version), explode('.', $version), false)) |
|
| 158 | - return array('id' => $id, 'version' => $temp_version); |
|
| 159 | - else |
|
| 160 | - return null; |
|
| 158 | + if($this->is_right_version_greater(explode('.', $temp_version), explode('.', $version), false)) { |
|
| 159 | + return array('id' => $id, 'version' => $temp_version); |
|
| 160 | + } else { |
|
| 161 | + return null; |
|
| 162 | + } |
|
| 161 | 163 | } |
| 162 | 164 | } |
| 163 | 165 | |
@@ -186,7 +188,7 @@ discard block |
||
| 186 | 188 | //we have found a match |
| 187 | 189 | //if the patch_to_check version is greater than the found version |
| 188 | 190 | return ($this->is_right_version_greater(explode('.', $history_object->version), explode('.', $patch_to_check->version))); |
| 189 | - }else{ |
|
| 191 | + } else{ |
|
| 190 | 192 | return true; |
| 191 | 193 | } |
| 192 | 194 | } |
@@ -194,8 +196,9 @@ discard block |
||
| 194 | 196 | //with a matching unique_key in the database |
| 195 | 197 | foreach($patch_list as $more_recent_patch) |
| 196 | 198 | { |
| 197 | - if($more_recent_patch->id == $patch_to_check->id) |
|
| 198 | - break; |
|
| 199 | + if($more_recent_patch->id == $patch_to_check->id) { |
|
| 200 | + break; |
|
| 201 | + } |
|
| 199 | 202 | |
| 200 | 203 | //we will only resort to checking the files if we cannot find the unique_keys |
| 201 | 204 | //or the unique_keys do not match |
@@ -219,25 +222,27 @@ discard block |
||
| 219 | 222 | { |
| 220 | 223 | if(is_file($check_path)) |
| 221 | 224 | { |
| 222 | - if(file_exists($recent_path)) |
|
| 223 | - return true; |
|
| 224 | - else |
|
| 225 | - return false; |
|
| 226 | - } |
|
| 227 | - elseif(is_dir($check_path)) |
|
| 225 | + if(file_exists($recent_path)) { |
|
| 226 | + return true; |
|
| 227 | + } else { |
|
| 228 | + return false; |
|
| 229 | + } |
|
| 230 | + } elseif(is_dir($check_path)) |
|
| 228 | 231 | { |
| 229 | 232 | $status = false; |
| 230 | 233 | |
| 231 | 234 | $d = dir( $check_path ); |
| 232 | 235 | while( $f = $d->read() ) |
| 233 | 236 | { |
| 234 | - if( $f == "." || $f == ".." ) |
|
| 235 | - continue; |
|
| 237 | + if( $f == "." || $f == ".." ) { |
|
| 238 | + continue; |
|
| 239 | + } |
|
| 236 | 240 | |
| 237 | 241 | $status = $this->foundConflict("$check_path/$f", "$recent_path/$f"); |
| 238 | 242 | |
| 239 | - if($status) |
|
| 240 | - break; |
|
| 243 | + if($status) { |
|
| 244 | + break; |
|
| 245 | + } |
|
| 241 | 246 | } |
| 242 | 247 | |
| 243 | 248 | $d->close(); |
@@ -259,20 +264,17 @@ discard block |
||
| 259 | 264 | function is_right_version_greater($left, $right, $equals_is_greater = true){ |
| 260 | 265 | if(count($left) == 0 && count($right) == 0){ |
| 261 | 266 | return $equals_is_greater; |
| 262 | - } |
|
| 263 | - else if(count($left) == 0 || count($right) == 0){ |
|
| 267 | + } else if(count($left) == 0 || count($right) == 0){ |
|
| 264 | 268 | return true; |
| 265 | - } |
|
| 266 | - else if($left[0] == $right[0]){ |
|
| 269 | + } else if($left[0] == $right[0]){ |
|
| 267 | 270 | array_shift($left); |
| 268 | 271 | array_shift($right); |
| 269 | 272 | return $this->is_right_version_greater($left, $right, $equals_is_greater); |
| 270 | - } |
|
| 271 | - else if($left[0] < $right[0]){ |
|
| 273 | + } else if($left[0] < $right[0]){ |
|
| 272 | 274 | return true; |
| 275 | + } else { |
|
| 276 | + return false; |
|
| 273 | 277 | } |
| 274 | - else |
|
| 275 | - return false; |
|
| 276 | 278 | } |
| 277 | 279 | |
| 278 | 280 | /** |
@@ -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. |
@@ -133,8 +135,7 @@ discard block |
||
| 133 | 135 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 134 | 136 | if(isset($GLOBALS['log'])) { |
| 135 | 137 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 136 | - } |
|
| 137 | - else { |
|
| 138 | + } else { |
|
| 138 | 139 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 139 | 140 | } |
| 140 | 141 | self::__construct(); |
@@ -221,8 +222,9 @@ discard block |
||
| 221 | 222 | }*/ |
| 222 | 223 | |
| 223 | 224 | // prevent a mass mailing for recurring meetings created in Calendar module |
| 224 | - if(empty($this->id) && !empty($_REQUEST['module']) && $_REQUEST['module'] == "Calendar" && !empty($_REQUEST['repeat_type']) && !empty($this->repeat_parent_id)) |
|
| 225 | - $check_notify = false; |
|
| 225 | + if(empty($this->id) && !empty($_REQUEST['module']) && $_REQUEST['module'] == "Calendar" && !empty($_REQUEST['repeat_type']) && !empty($this->repeat_parent_id)) { |
|
| 226 | + $check_notify = false; |
|
| 227 | + } |
|
| 226 | 228 | |
| 227 | 229 | if (empty($this->status) ) { |
| 228 | 230 | $this->status = $this->getDefaultStatus(); |
@@ -326,10 +328,11 @@ discard block |
||
| 326 | 328 | |
| 327 | 329 | $query .= $custom_join['join']; |
| 328 | 330 | |
| 329 | - if($where != "") |
|
| 330 | - $query .= " where $where AND ".$where_auto; |
|
| 331 | - else |
|
| 332 | - $query .= " where ".$where_auto; |
|
| 331 | + if($where != "") { |
|
| 332 | + $query .= " where $where AND ".$where_auto; |
|
| 333 | + } else { |
|
| 334 | + $query .= " where ".$where_auto; |
|
| 335 | + } |
|
| 333 | 336 | |
| 334 | 337 | $order_by = $this->process_order_by($order_by); |
| 335 | 338 | if (!empty($order_by)) { |
@@ -419,15 +422,18 @@ discard block |
||
| 419 | 422 | } |
| 420 | 423 | |
| 421 | 424 | //setting default date and time |
| 422 | - if (is_null($this->date_start)) |
|
| 423 | - $this->date_start = $timedate->now(); |
|
| 424 | - if (is_null($this->time_start)) |
|
| 425 | - $this->time_start = $timedate->to_display_time(TimeDate::getInstance()->nowDb(), true); |
|
| 425 | + if (is_null($this->date_start)) { |
|
| 426 | + $this->date_start = $timedate->now(); |
|
| 427 | + } |
|
| 428 | + if (is_null($this->time_start)) { |
|
| 429 | + $this->time_start = $timedate->to_display_time(TimeDate::getInstance()->nowDb(), true); |
|
| 430 | + } |
|
| 426 | 431 | if (is_null($this->duration_hours)) { |
| 427 | 432 | $this->duration_hours = "0"; |
| 428 | 433 | } |
| 429 | - if (is_null($this->duration_minutes)) |
|
| 430 | - $this->duration_minutes = "1"; |
|
| 434 | + if (is_null($this->duration_minutes)) { |
|
| 435 | + $this->duration_minutes = "1"; |
|
| 436 | + } |
|
| 431 | 437 | |
| 432 | 438 | if(empty($this->id) && !empty($_REQUEST['date_start'])){ |
| 433 | 439 | $this->date_start = $_REQUEST['date_start']; |
@@ -446,8 +452,7 @@ discard block |
||
| 446 | 452 | $td = $td->modify("+{$this->duration_minutes} mins"); |
| 447 | 453 | } |
| 448 | 454 | $this->date_end = $td->format($GLOBALS['timedate']->get_date_time_format()); |
| 449 | - } |
|
| 450 | - else |
|
| 455 | + } else |
|
| 451 | 456 | { |
| 452 | 457 | $GLOBALS['log']->fatal("Meeting::save: Bad date {$this->date_start} for format ".$GLOBALS['timedate']->get_date_time_format()); |
| 453 | 458 | } |
@@ -469,8 +474,9 @@ discard block |
||
| 469 | 474 | |
| 470 | 475 | if ( empty($this->id) ) { |
| 471 | 476 | $reminder_t = $GLOBALS['current_user']->getPreference('reminder_time'); |
| 472 | - if ( isset($reminder_t) ) |
|
| 473 | - $this->reminder_time = $reminder_t; |
|
| 477 | + if ( isset($reminder_t) ) { |
|
| 478 | + $this->reminder_time = $reminder_t; |
|
| 479 | + } |
|
| 474 | 480 | } |
| 475 | 481 | $this->reminder_checked = $this->reminder_time == -1 ? false : true; |
| 476 | 482 | |
@@ -479,8 +485,9 @@ discard block |
||
| 479 | 485 | } |
| 480 | 486 | if(empty($this->id)){ |
| 481 | 487 | $reminder_t = $GLOBALS['current_user']->getPreference('email_reminder_time'); |
| 482 | - if(isset($reminder_t)) |
|
| 483 | - $this->email_reminder_time = $reminder_t; |
|
| 488 | + if(isset($reminder_t)) { |
|
| 489 | + $this->email_reminder_time = $reminder_t; |
|
| 490 | + } |
|
| 484 | 491 | } |
| 485 | 492 | $this->email_reminder_checked = $this->email_reminder_time == -1 ? false : true; |
| 486 | 493 | |
@@ -496,12 +503,14 @@ discard block |
||
| 496 | 503 | $meeting_fields = $this->get_list_view_array(); |
| 497 | 504 | |
| 498 | 505 | global $app_list_strings, $focus, $action, $currentModule; |
| 499 | - if(isset($this->parent_type)) |
|
| 500 | - $meeting_fields['PARENT_MODULE'] = $this->parent_type; |
|
| 506 | + if(isset($this->parent_type)) { |
|
| 507 | + $meeting_fields['PARENT_MODULE'] = $this->parent_type; |
|
| 508 | + } |
|
| 501 | 509 | if($this->status == "Planned") { |
| 502 | 510 | //cn: added this if() to deal with sequential Closes in Meetings. this is a hack to a hack(formbase.php->handleRedirect) |
| 503 | - if(empty($action)) |
|
| 504 | - $action = "index"; |
|
| 511 | + if(empty($action)) { |
|
| 512 | + $action = "index"; |
|
| 513 | + } |
|
| 505 | 514 | $setCompleteUrl = "<a id='{$this->id}' onclick='SUGAR.util.closeActivityPanel.show(\"{$this->module_dir}\",\"{$this->id}\",\"Held\",\"listview\",\"1\");'>"; |
| 506 | 515 | if ($this->ACLAccess('edit')) { |
| 507 | 516 | $meeting_fields['SET_COMPLETE'] = $setCompleteUrl . SugarThemeRegistry::current()->getImage("close_inline"," border='0'",null,null,'.gif',translate('LBL_CLOSEINLINE'))."</a>"; |
@@ -516,7 +525,7 @@ discard block |
||
| 516 | 525 | $date_db = $timedate->to_db($mergeTime); |
| 517 | 526 | if($date_db < $today ) { |
| 518 | 527 | $meeting_fields['DATE_START']= "<font class='overdueTask'>".$meeting_fields['DATE_START']."</font>"; |
| 519 | - }else if($date_db < $nextday) { |
|
| 528 | + } else if($date_db < $nextday) { |
|
| 520 | 529 | $meeting_fields['DATE_START'] = "<font class='todaysTask'>".$meeting_fields['DATE_START']."</font>"; |
| 521 | 530 | } else { |
| 522 | 531 | $meeting_fields['DATE_START'] = "<font class='futureTask'>".$meeting_fields['DATE_START']."</font>"; |
@@ -683,14 +692,12 @@ discard block |
||
| 683 | 692 | { |
| 684 | 693 | vCal::cache_sugar_vcal($user); |
| 685 | 694 | } |
| 686 | - } |
|
| 687 | - else if($user->object_name == 'Contact') |
|
| 695 | + } else if($user->object_name == 'Contact') |
|
| 688 | 696 | { |
| 689 | 697 | $relate_values = array('contact_id'=>$user->id,'meeting_id'=>$this->id); |
| 690 | 698 | $data_values = array('accept_status'=>$status); |
| 691 | 699 | $this->set_relationship($this->rel_contacts_table, $relate_values, true, true,$data_values); |
| 692 | - } |
|
| 693 | - else if($user->object_name == 'Lead') |
|
| 700 | + } else if($user->object_name == 'Lead') |
|
| 694 | 701 | { |
| 695 | 702 | $relate_values = array('lead_id'=>$user->id,'meeting_id'=>$this->id); |
| 696 | 703 | $data_values = array('accept_status'=>$status); |
@@ -744,8 +751,9 @@ discard block |
||
| 744 | 751 | global $sugar_config; |
| 745 | 752 | if(isset($sugar_config['disable_notify_current_user']) && $sugar_config['disable_notify_current_user']) { |
| 746 | 753 | global $current_user; |
| 747 | - if(isset($list[$current_user->id])) |
|
| 748 | - unset($list[$current_user->id]); |
|
| 754 | + if(isset($list[$current_user->id])) { |
|
| 755 | + unset($list[$current_user->id]); |
|
| 756 | + } |
|
| 749 | 757 | } |
| 750 | 758 | return $list; |
| 751 | 759 | } |
@@ -836,11 +844,10 @@ discard block |
||
| 836 | 844 | //add assigned_user_id to exclude list and let the logic from MeetingFormBase determine whether assigned user id gets added to the relationship |
| 837 | 845 | if(!empty($GLOBALS['soap_server_object'])){ |
| 838 | 846 | $exclude = array('contact_id', 'user_id'); |
| 839 | - }else{ |
|
| 847 | + } else{ |
|
| 840 | 848 | $exclude = array('contact_id', 'user_id','assigned_user_id'); |
| 841 | 849 | } |
| 842 | - } |
|
| 843 | - else{ |
|
| 850 | + } else{ |
|
| 844 | 851 | $exclude = array('user_id'); |
| 845 | 852 | } |
| 846 | 853 | } |
@@ -855,13 +862,14 @@ discard block |
||
| 855 | 862 | { |
| 856 | 863 | if ( $this->parent_type == 'Contacts' ) { |
| 857 | 864 | $this->load_relationship('contacts'); |
| 858 | - if ( !$this->contacts->relationship_exists('contacts',array('id'=>$this->parent_id)) ) |
|
| 859 | - $this->contacts->add($this->parent_id); |
|
| 860 | - } |
|
| 861 | - elseif ( $this->parent_type == 'Leads' ) { |
|
| 865 | + if ( !$this->contacts->relationship_exists('contacts',array('id'=>$this->parent_id)) ) { |
|
| 866 | + $this->contacts->add($this->parent_id); |
|
| 867 | + } |
|
| 868 | + } elseif ( $this->parent_type == 'Leads' ) { |
|
| 862 | 869 | $this->load_relationship('leads'); |
| 863 | - if ( !$this->leads->relationship_exists('leads',array('id'=>$this->parent_id)) ) |
|
| 864 | - $this->leads->add($this->parent_id); |
|
| 870 | + if ( !$this->leads->relationship_exists('leads',array('id'=>$this->parent_id)) ) { |
|
| 871 | + $this->leads->add($this->parent_id); |
|
| 872 | + } |
|
| 865 | 873 | } |
| 866 | 874 | |
| 867 | 875 | parent::afterImportSave(); |
@@ -1,6 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 3 | +if (!defined('sugarEntry') || !sugarEntry) { |
|
| 4 | + die('Not A Valid Entry Point'); |
|
| 5 | +} |
|
| 4 | 6 | |
| 5 | 7 | class MeetingsJjwg_MapsLogicHook |
| 6 | 8 | { |
@@ -19,8 +21,7 @@ discard block |
||
| 19 | 21 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 20 | 22 | if(isset($GLOBALS['log'])) { |
| 21 | 23 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 22 | - } |
|
| 23 | - else { |
|
| 24 | + } else { |
|
| 24 | 25 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 25 | 26 | } |
| 26 | 27 | self::__construct(); |