@@ -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. |
@@ -58,8 +60,7 @@ discard block |
||
| 58 | 60 | if (is_array($list)) |
| 59 | 61 | { |
| 60 | 62 | $list = array_merge(array($currency), $list); |
| 61 | - } |
|
| 62 | - else |
|
| 63 | + } else |
|
| 63 | 64 | { |
| 64 | 65 | $list = array($currency); |
| 65 | 66 | } |
@@ -105,8 +106,7 @@ discard block |
||
| 105 | 106 | if (!empty ($field_def['sort_on'])) |
| 106 | 107 | { |
| 107 | 108 | $order_by = $layout_def['table_alias'].".".$field_def['sort_on']; |
| 108 | - } |
|
| 109 | - else |
|
| 109 | + } else |
|
| 110 | 110 | { |
| 111 | 111 | $order_by = $this->_get_column_select($layout_def); |
| 112 | 112 | } |
@@ -114,8 +114,7 @@ discard block |
||
| 114 | 114 | if (empty ($layout_def['sort_dir']) || $layout_def['sort_dir'] == 'a') |
| 115 | 115 | { |
| 116 | 116 | $order_dir = "ASC"; |
| 117 | - } |
|
| 118 | - else |
|
| 117 | + } else |
|
| 119 | 118 | { |
| 120 | 119 | $order_dir = "DESC"; |
| 121 | 120 | } |
@@ -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. |
@@ -69,8 +71,7 @@ discard block |
||
| 69 | 71 | global $app_list_strings; |
| 70 | 72 | if (empty($value)) { |
| 71 | 73 | $value = $app_list_strings['dom_switch_bool']['off']; |
| 72 | - } |
|
| 73 | - else { |
|
| 74 | + } else { |
|
| 74 | 75 | $value = $app_list_strings['dom_switch_bool']['on']; |
| 75 | 76 | } |
| 76 | 77 | return $value; |
@@ -97,11 +98,9 @@ discard block |
||
| 97 | 98 | $yes = $no = $default = ''; |
| 98 | 99 | if (isset($layout_def['input_name0']) && $layout_def['input_name0'] == 1) { |
| 99 | 100 | $yes = ' selected="selected"'; |
| 100 | - } |
|
| 101 | - elseif (isset($layout_def['input_name0']) && $layout_def['input_name0'] == 'off') { |
|
| 101 | + } elseif (isset($layout_def['input_name0']) && $layout_def['input_name0'] == 'off') { |
|
| 102 | 102 | $no = ' selected="selected"'; |
| 103 | - } |
|
| 104 | - else { |
|
| 103 | + } else { |
|
| 105 | 104 | $default = ' selected="selected"'; |
| 106 | 105 | } |
| 107 | 106 | |
@@ -1,5 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
| 3 | + die('Not A Valid Entry Point'); |
|
| 4 | +} |
|
| 3 | 5 | /********************************************************************************* |
| 4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
| 5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -65,18 +67,24 @@ discard block |
||
| 65 | 67 | } |
| 66 | 68 | |
| 67 | 69 | $additionalFormFields = array(); |
| 68 | - if(isset($defines['focus']->billing_address_street)) |
|
| 69 | - $additionalFormFields['primary_address_street'] = $defines['focus']->billing_address_street; |
|
| 70 | - if(isset($defines['focus']->billing_address_city)) |
|
| 71 | - $additionalFormFields['primary_address_city'] = $defines['focus']->billing_address_city; |
|
| 72 | - if(isset($defines['focus']->billing_address_state)) |
|
| 73 | - $additionalFormFields['primary_address_state'] = $defines['focus']->billing_address_state; |
|
| 74 | - if(isset($defines['focus']->billing_address_country)) |
|
| 75 | - $additionalFormFields['primary_address_country'] = $defines['focus']->billing_address_country; |
|
| 76 | - if(isset($defines['focus']->billing_address_postalcode)) |
|
| 77 | - $additionalFormFields['primary_address_postalcode'] = $defines['focus']->billing_address_postalcode; |
|
| 78 | - if(isset($defines['focus']->phone_office)) |
|
| 79 | - $additionalFormFields['phone_work'] = $defines['focus']->phone_office; |
|
| 70 | + if(isset($defines['focus']->billing_address_street)) { |
|
| 71 | + $additionalFormFields['primary_address_street'] = $defines['focus']->billing_address_street; |
|
| 72 | + } |
|
| 73 | + if(isset($defines['focus']->billing_address_city)) { |
|
| 74 | + $additionalFormFields['primary_address_city'] = $defines['focus']->billing_address_city; |
|
| 75 | + } |
|
| 76 | + if(isset($defines['focus']->billing_address_state)) { |
|
| 77 | + $additionalFormFields['primary_address_state'] = $defines['focus']->billing_address_state; |
|
| 78 | + } |
|
| 79 | + if(isset($defines['focus']->billing_address_country)) { |
|
| 80 | + $additionalFormFields['primary_address_country'] = $defines['focus']->billing_address_country; |
|
| 81 | + } |
|
| 82 | + if(isset($defines['focus']->billing_address_postalcode)) { |
|
| 83 | + $additionalFormFields['primary_address_postalcode'] = $defines['focus']->billing_address_postalcode; |
|
| 84 | + } |
|
| 85 | + if(isset($defines['focus']->phone_office)) { |
|
| 86 | + $additionalFormFields['phone_work'] = $defines['focus']->phone_office; |
|
| 87 | + } |
|
| 80 | 88 | |
| 81 | 89 | |
| 82 | 90 | $button = $this->_get_form($defines, $additionalFormFields); |
@@ -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. |
@@ -111,7 +113,7 @@ discard block |
||
| 111 | 113 | if($layout_def['ListView']) { |
| 112 | 114 | return "<a href=\"javascript:sub_p_rem('$subpanel', '$linked_field'" .", '$record', $refresh_page);\"" |
| 113 | 115 | . ' class="listViewTdToolsS1"' . " onclick=\"return sp_rem_conf();\"" . ">$icon_remove_text</a>"; |
| 114 | - }else{ |
|
| 116 | + } else{ |
|
| 115 | 117 | return ''; |
| 116 | 118 | } |
| 117 | 119 | } |
@@ -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. |
@@ -59,8 +61,7 @@ discard block |
||
| 59 | 61 | if(isset($layout_def['varname'])) |
| 60 | 62 | { |
| 61 | 63 | $key = strtoupper($layout_def['varname']); |
| 62 | - } |
|
| 63 | - else |
|
| 64 | + } else |
|
| 64 | 65 | { |
| 65 | 66 | $key = $this->_get_column_alias($layout_def); |
| 66 | 67 | $key = strtoupper($key); |
@@ -77,8 +78,7 @@ discard block |
||
| 77 | 78 | if(empty($layout_def['target_module'])) |
| 78 | 79 | { |
| 79 | 80 | $module = $layout_def['module']; |
| 80 | - } |
|
| 81 | - else |
|
| 81 | + } else |
|
| 82 | 82 | { |
| 83 | 83 | $module = $layout_def['target_module']; |
| 84 | 84 | } |
@@ -87,8 +87,7 @@ discard block |
||
| 87 | 87 | if(empty($layout_def['target_record_key'])) |
| 88 | 88 | { |
| 89 | 89 | $record = $layout_def['fields']['ID']; |
| 90 | - } |
|
| 91 | - else |
|
| 90 | + } else |
|
| 92 | 91 | { |
| 93 | 92 | $record_key = strtoupper($layout_def['target_record_key']); |
| 94 | 93 | $record = $layout_def['fields'][$record_key]; |
@@ -56,8 +56,9 @@ discard block |
||
| 56 | 56 | } |
| 57 | 57 | $temp_mod_strings = $mod_strings; |
| 58 | 58 | $lang = $current_language; |
| 59 | - if(empty($lang)) |
|
| 60 | - $lang = $GLOBALS['sugar_config']['default_language']; |
|
| 59 | + if(empty($lang)) { |
|
| 60 | + $lang = $GLOBALS['sugar_config']['default_language']; |
|
| 61 | + } |
|
| 61 | 62 | static $createdModules = array(); |
| 62 | 63 | if(empty($createdModules[$module]) && ($refresh || !file_exists(sugar_cached('modules/').$module.'/language/'.$lang.'.lang.php'))){ |
| 63 | 64 | $loaded_mod_strings = array(); |
@@ -84,7 +85,9 @@ discard block |
||
| 84 | 85 | } |
| 85 | 86 | |
| 86 | 87 | static function addTemplate($module, $lang, $template){ |
| 87 | - if($template == 'default')$template = 'basic'; |
|
| 88 | + if($template == 'default') { |
|
| 89 | + $template = 'basic'; |
|
| 90 | + } |
|
| 88 | 91 | $templates = array(); |
| 89 | 92 | $fields = array(); |
| 90 | 93 | if(empty($templates[$template])){ |
@@ -92,7 +95,7 @@ discard block |
||
| 92 | 95 | if(file_exists($path)){ |
| 93 | 96 | require($path); |
| 94 | 97 | $templates[$template] = $mod_strings; |
| 95 | - }else{ |
|
| 98 | + } else{ |
|
| 96 | 99 | $path = 'include/SugarObjects/implements/' . $template . '/language/'.$lang.'.lang.php'; |
| 97 | 100 | if(file_exists($path)){ |
| 98 | 101 | require($path); |
@@ -106,8 +109,9 @@ discard block |
||
| 106 | 109 | } |
| 107 | 110 | |
| 108 | 111 | static function saveCache($module,$lang, $loaded_mod_strings, $additonal_objects= array()){ |
| 109 | - if(empty($lang)) |
|
| 110 | - $lang = $GLOBALS['sugar_config']['default_language']; |
|
| 112 | + if(empty($lang)) { |
|
| 113 | + $lang = $GLOBALS['sugar_config']['default_language']; |
|
| 114 | + } |
|
| 111 | 115 | |
| 112 | 116 | $file = create_cache_directory('modules/' . $module . '/language/'.$lang.'.lang.php'); |
| 113 | 117 | write_array_to_file('mod_strings',$loaded_mod_strings, $file); |
@@ -140,7 +144,9 @@ discard block |
||
| 140 | 144 | $cache_dir = sugar_cached('modules/'); |
| 141 | 145 | if(file_exists($cache_dir) && $dir = @opendir($cache_dir)) { |
| 142 | 146 | while(($entry = readdir($dir)) !== false) { |
| 143 | - if ($entry == "." || $entry == "..") continue; |
|
| 147 | + if ($entry == "." || $entry == "..") { |
|
| 148 | + continue; |
|
| 149 | + } |
|
| 144 | 150 | foreach($languages as $clean_lang) { |
| 145 | 151 | LanguageManager::_clearCache($entry, $clean_lang); |
| 146 | 152 | } |
@@ -188,8 +194,9 @@ discard block |
||
| 188 | 194 | if(empty($createdModules[$module]) && isset($GLOBALS['beanList'][$module])){ |
| 189 | 195 | $object = $GLOBALS['beanList'][$module]; |
| 190 | 196 | |
| 191 | - if ($object == 'aCase') |
|
| 192 | - $object = 'Case'; |
|
| 197 | + if ($object == 'aCase') { |
|
| 198 | + $object = 'Case'; |
|
| 199 | + } |
|
| 193 | 200 | |
| 194 | 201 | if(!empty($GLOBALS["dictionary"]["$object"]["templates"])){ |
| 195 | 202 | $templates = $GLOBALS["dictionary"]["$object"]["templates"]; |
@@ -212,8 +219,7 @@ discard block |
||
| 212 | 219 | if(!empty($mod_strings)){ |
| 213 | 220 | if (function_exists('sugarArrayMergeRecursive')){ |
| 214 | 221 | $loaded_mod_strings = sugarArrayMergeRecursive($loaded_mod_strings, $mod_strings); |
| 215 | - } |
|
| 216 | - else{ |
|
| 222 | + } else{ |
|
| 217 | 223 | $loaded_mod_strings = sugarLangArrayMerge($loaded_mod_strings, $mod_strings); |
| 218 | 224 | } |
| 219 | 225 | } |
@@ -222,8 +228,9 @@ discard block |
||
| 222 | 228 | |
| 223 | 229 | //great! now that we have loaded all of our vardefs. |
| 224 | 230 | //let's go save them to the cache file. |
| 225 | - if(!empty($loaded_mod_strings)) |
|
| 226 | - LanguageManager::saveCache($module, $lang, $loaded_mod_strings); |
|
| 231 | + if(!empty($loaded_mod_strings)) { |
|
| 232 | + LanguageManager::saveCache($module, $lang, $loaded_mod_strings); |
|
| 233 | + } |
|
| 227 | 234 | } |
| 228 | 235 | |
| 229 | 236 | static function loadModuleLanguage($module, $lang, $refresh=false){ |
@@ -256,8 +263,9 @@ discard block |
||
| 256 | 263 | require $cachedfile; |
| 257 | 264 | |
| 258 | 265 | // now that we hae loaded the data from disk, put it in the cache. |
| 259 | - if(!empty($mod_strings)) |
|
| 260 | - sugar_cache_put($key,$mod_strings); |
|
| 266 | + if(!empty($mod_strings)) { |
|
| 267 | + sugar_cache_put($key,$mod_strings); |
|
| 268 | + } |
|
| 261 | 269 | if(!empty($_SESSION['translation_mode'])){ |
| 262 | 270 | $mod_strings = array_map('translated_prefix', $mod_strings); |
| 263 | 271 | } |
@@ -292,10 +300,11 @@ discard block |
||
| 292 | 300 | unlink($file); |
| 293 | 301 | } |
| 294 | 302 | |
| 295 | - if( empty($GLOBALS['sugar_config']['js_lang_version']) ) |
|
| 296 | - $GLOBALS['sugar_config']['js_lang_version'] = 1; |
|
| 297 | - else |
|
| 298 | - $GLOBALS['sugar_config']['js_lang_version'] += 1; |
|
| 303 | + if( empty($GLOBALS['sugar_config']['js_lang_version']) ) { |
|
| 304 | + $GLOBALS['sugar_config']['js_lang_version'] = 1; |
|
| 305 | + } else { |
|
| 306 | + $GLOBALS['sugar_config']['js_lang_version'] += 1; |
|
| 307 | + } |
|
| 299 | 308 | |
| 300 | 309 | write_array_to_file( "sugar_config", $GLOBALS['sugar_config'], "config.php"); |
| 301 | 310 | } |
@@ -1,5 +1,7 @@ |
||
| 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. |
@@ -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. |
@@ -153,16 +155,18 @@ discard block |
||
| 153 | 155 | { |
| 154 | 156 | global $sugar_config; |
| 155 | 157 | |
| 156 | - if (is_null($configOptions)) |
|
| 157 | - $configOptions = $sugar_config['dbconfig']; |
|
| 158 | + if (is_null($configOptions)) { |
|
| 159 | + $configOptions = $sugar_config['dbconfig']; |
|
| 160 | + } |
|
| 158 | 161 | |
| 159 | 162 | //set the connections parameters |
| 160 | 163 | $connect_param = ''; |
| 161 | 164 | $configOptions['db_host_instance'] = trim($configOptions['db_host_instance']); |
| 162 | - if (empty($configOptions['db_host_instance'])) |
|
| 163 | - $connect_param = $configOptions['db_host_name']; |
|
| 164 | - else |
|
| 165 | - $connect_param = $configOptions['db_host_name']."\\".$configOptions['db_host_instance']; |
|
| 165 | + if (empty($configOptions['db_host_instance'])) { |
|
| 166 | + $connect_param = $configOptions['db_host_name']; |
|
| 167 | + } else { |
|
| 168 | + $connect_param = $configOptions['db_host_name']."\\".$configOptions['db_host_instance']; |
|
| 169 | + } |
|
| 166 | 170 | |
| 167 | 171 | /* |
| 168 | 172 | * Don't try to specifically use a persistent connection |
@@ -192,8 +196,9 @@ discard block |
||
| 192 | 196 | } |
| 193 | 197 | } |
| 194 | 198 | |
| 195 | - if($this->checkError('Could Not Connect:', $dieOnError)) |
|
| 196 | - $GLOBALS['log']->info("connected to db"); |
|
| 199 | + if($this->checkError('Could Not Connect:', $dieOnError)) { |
|
| 200 | + $GLOBALS['log']->info("connected to db"); |
|
| 201 | + } |
|
| 197 | 202 | |
| 198 | 203 | sqlsrv_query($this->database, 'SET DATEFORMAT mdy'); |
| 199 | 204 | |
@@ -245,8 +250,9 @@ discard block |
||
| 245 | 250 | |
| 246 | 251 | foreach ( sqlsrv_field_metadata($result) as $fieldMetadata ) { |
| 247 | 252 | $key = $fieldMetadata['Name']; |
| 248 | - if($make_lower_case==true) |
|
| 249 | - $key = strtolower($key); |
|
| 253 | + if($make_lower_case==true) { |
|
| 254 | + $key = strtolower($key); |
|
| 255 | + } |
|
| 250 | 256 | |
| 251 | 257 | $field_array[] = $key; |
| 252 | 258 | } |
@@ -259,7 +265,9 @@ discard block |
||
| 259 | 265 | */ |
| 260 | 266 | public function fetchRow($result) |
| 261 | 267 | { |
| 262 | - if (empty($result)) return false; |
|
| 268 | + if (empty($result)) { |
|
| 269 | + return false; |
|
| 270 | + } |
|
| 263 | 271 | |
| 264 | 272 | $row = sqlsrv_fetch_array($result,SQLSRV_FETCH_ASSOC); |
| 265 | 273 | if (empty($row)) { |
@@ -284,11 +292,12 @@ discard block |
||
| 284 | 292 | */ |
| 285 | 293 | public function convert($string, $type, array $additional_parameters = array()) |
| 286 | 294 | { |
| 287 | - if ( $type == 'datetime') |
|
| 288 | - // see http://msdn.microsoft.com/en-us/library/ms187928.aspx for details |
|
| 295 | + if ( $type == 'datetime') { |
|
| 296 | + // see http://msdn.microsoft.com/en-us/library/ms187928.aspx for details |
|
| 289 | 297 | return "CONVERT(datetime,$string,120)"; |
| 290 | - else |
|
| 291 | - return parent::convert($string, $type, $additional_parameters); |
|
| 298 | + } else { |
|
| 299 | + return parent::convert($string, $type, $additional_parameters); |
|
| 300 | + } |
|
| 292 | 301 | } |
| 293 | 302 | |
| 294 | 303 | /** |
@@ -330,8 +339,9 @@ discard block |
||
| 330 | 339 | */ |
| 331 | 340 | protected function freeDbResult($dbResult) |
| 332 | 341 | { |
| 333 | - if(!empty($dbResult)) |
|
| 334 | - sqlsrv_free_stmt($dbResult); |
|
| 342 | + if(!empty($dbResult)) { |
|
| 343 | + sqlsrv_free_stmt($dbResult); |
|
| 344 | + } |
|
| 335 | 345 | } |
| 336 | 346 | |
| 337 | 347 | |
@@ -377,14 +387,12 @@ discard block |
||
| 377 | 387 | if ( $row['TYPE_NAME'] == 'decimal' ) { |
| 378 | 388 | $columns[$column_name]['len']=strtolower($row['PRECISION']); |
| 379 | 389 | $columns[$column_name]['len'].=','.strtolower($row['SCALE']); |
| 380 | - } |
|
| 381 | - elseif ( in_array($row['TYPE_NAME'],array('nchar','nvarchar')) ) { |
|
| 390 | + } elseif ( in_array($row['TYPE_NAME'],array('nchar','nvarchar')) ) { |
|
| 382 | 391 | $columns[$column_name]['len']=strtolower($row['PRECISION']); |
| 383 | 392 | if ( $row['TYPE_NAME'] == 'nvarchar' && $row['PRECISION'] == '0' ) { |
| 384 | 393 | $columns[$column_name]['len']='max'; |
| 385 | 394 | } |
| 386 | - } |
|
| 387 | - elseif ( !in_array($row['TYPE_NAME'],array('datetime','text')) ) { |
|
| 395 | + } elseif ( !in_array($row['TYPE_NAME'],array('datetime','text')) ) { |
|
| 388 | 396 | $columns[$column_name]['len']=strtolower($row['LENGTH']); |
| 389 | 397 | } |
| 390 | 398 | if ( stristr($row['TYPE_NAME'],'identity') ) { |
@@ -392,8 +400,9 @@ discard block |
||
| 392 | 400 | $columns[$column_name]['type']=str_replace(' identity','',strtolower($row['TYPE_NAME'])); |
| 393 | 401 | } |
| 394 | 402 | |
| 395 | - if (!empty($row['IS_NULLABLE']) && $row['IS_NULLABLE'] == 'NO' && (empty($row['KEY']) || !stristr($row['KEY'],'PRI'))) |
|
| 396 | - $columns[strtolower($row['COLUMN_NAME'])]['required'] = 'true'; |
|
| 403 | + if (!empty($row['IS_NULLABLE']) && $row['IS_NULLABLE'] == 'NO' && (empty($row['KEY']) || !stristr($row['KEY'],'PRI'))) { |
|
| 404 | + $columns[strtolower($row['COLUMN_NAME'])]['required'] = 'true'; |
|
| 405 | + } |
|
| 397 | 406 | |
| 398 | 407 | $column_def = 1; |
| 399 | 408 | if ( strtolower($tablename) == 'relationships' ) { |
@@ -402,12 +411,13 @@ discard block |
||
| 402 | 411 | if ( $column_def != 0 && ($row['COLUMN_DEF'] != null)) { // NOTE Not using !empty as an empty string may be a viable default value. |
| 403 | 412 | $matches = array(); |
| 404 | 413 | $row['COLUMN_DEF'] = html_entity_decode($row['COLUMN_DEF'],ENT_QUOTES); |
| 405 | - if ( preg_match('/\([\(|\'](.*)[\)|\']\)/i',$row['COLUMN_DEF'],$matches) ) |
|
| 406 | - $columns[$column_name]['default'] = $matches[1]; |
|
| 407 | - elseif ( preg_match('/\(N\'(.*)\'\)/i',$row['COLUMN_DEF'],$matches) ) |
|
| 408 | - $columns[$column_name]['default'] = $matches[1]; |
|
| 409 | - else |
|
| 410 | - $columns[$column_name]['default'] = $row['COLUMN_DEF']; |
|
| 414 | + if ( preg_match('/\([\(|\'](.*)[\)|\']\)/i',$row['COLUMN_DEF'],$matches) ) { |
|
| 415 | + $columns[$column_name]['default'] = $matches[1]; |
|
| 416 | + } elseif ( preg_match('/\(N\'(.*)\'\)/i',$row['COLUMN_DEF'],$matches) ) { |
|
| 417 | + $columns[$column_name]['default'] = $matches[1]; |
|
| 418 | + } else { |
|
| 419 | + $columns[$column_name]['default'] = $row['COLUMN_DEF']; |
|
| 420 | + } |
|
| 411 | 421 | } |
| 412 | 422 | } |
| 413 | 423 | return $columns; |
@@ -495,7 +505,9 @@ discard block |
||
| 495 | 505 | public function lastDbError() |
| 496 | 506 | { |
| 497 | 507 | $errors = sqlsrv_errors(SQLSRV_ERR_ERRORS); |
| 498 | - if(empty($errors)) return false; |
|
| 508 | + if(empty($errors)) { |
|
| 509 | + return false; |
|
| 510 | + } |
|
| 499 | 511 | global $app_strings; |
| 500 | 512 | if (empty($app_strings) |
| 501 | 513 | or !isset($app_strings['ERR_MSSQL_DB_CONTEXT']) |
@@ -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. |
@@ -191,15 +193,25 @@ discard block |
||
| 191 | 193 | */ |
| 192 | 194 | protected static function scanDriverDir($dir, &$drivers, $validate = true) |
| 193 | 195 | { |
| 194 | - if(!is_dir($dir)) return; |
|
| 196 | + if(!is_dir($dir)) { |
|
| 197 | + return; |
|
| 198 | + } |
|
| 195 | 199 | $scandir = opendir($dir); |
| 196 | - if($scandir === false) return; |
|
| 200 | + if($scandir === false) { |
|
| 201 | + return; |
|
| 202 | + } |
|
| 197 | 203 | while(($name = readdir($scandir)) !== false) { |
| 198 | - if(substr($name, -11) != "Manager.php") continue; |
|
| 199 | - if($name == "DBManager.php") continue; |
|
| 204 | + if(substr($name, -11) != "Manager.php") { |
|
| 205 | + continue; |
|
| 206 | + } |
|
| 207 | + if($name == "DBManager.php") { |
|
| 208 | + continue; |
|
| 209 | + } |
|
| 200 | 210 | require_once("$dir/$name"); |
| 201 | 211 | $classname = substr($name, 0, -4); |
| 202 | - if(!class_exists($classname)) continue; |
|
| 212 | + if(!class_exists($classname)) { |
|
| 213 | + continue; |
|
| 214 | + } |
|
| 203 | 215 | $driver = new $classname; |
| 204 | 216 | if(!$validate || $driver->valid()) { |
| 205 | 217 | if(empty($drivers[$driver->dbType])) { |
@@ -236,7 +248,9 @@ discard block |
||
| 236 | 248 | |
| 237 | 249 | $result = array(); |
| 238 | 250 | foreach($drivers as $type => $tdrivers) { |
| 239 | - if(empty($tdrivers)) continue; |
|
| 251 | + if(empty($tdrivers)) { |
|
| 252 | + continue; |
|
| 253 | + } |
|
| 240 | 254 | if(count($tdrivers) > 1) { |
| 241 | 255 | usort($tdrivers, array(__CLASS__, "_compareDrivers")); |
| 242 | 256 | } |