@@ -43,11 +43,11 @@ discard block |
||
| 43 | 43 | require_once('modules/Administration/UpgradeWizardCommon.php'); |
| 44 | 44 | require_once('modules/Configurator/Configurator.php'); |
| 45 | 45 | function UWrebuild() { |
| 46 | - global $log; |
|
| 47 | - global $db; |
|
| 48 | - $log->info('Deleting Relationship Cache. Relationships will automatically refresh.'); |
|
| 46 | + global $log; |
|
| 47 | + global $db; |
|
| 48 | + $log->info('Deleting Relationship Cache. Relationships will automatically refresh.'); |
|
| 49 | 49 | |
| 50 | - echo " |
|
| 50 | + echo " |
|
| 51 | 51 | <div id='rrresult'></div> |
| 52 | 52 | <script> |
| 53 | 53 | var xmlhttp=false; |
@@ -88,10 +88,10 @@ discard block |
||
| 88 | 88 | xmlhttp.send(null); |
| 89 | 89 | </script>"; |
| 90 | 90 | |
| 91 | - $log->info('Rebuilding everything.'); |
|
| 92 | - require_once('ModuleInstall/ModuleInstaller.php'); |
|
| 93 | - $mi = new ModuleInstaller(); |
|
| 94 | - $mi->rebuild_all(); |
|
| 91 | + $log->info('Rebuilding everything.'); |
|
| 92 | + require_once('ModuleInstall/ModuleInstaller.php'); |
|
| 93 | + $mi = new ModuleInstaller(); |
|
| 94 | + $mi->rebuild_all(); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | unset($_SESSION['rebuild_relationships']); |
@@ -140,19 +140,19 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | $id_name = ''; |
| 142 | 142 | if(isset($_REQUEST['id_name'])){ |
| 143 | - $id_name = $_REQUEST['id_name']; |
|
| 143 | + $id_name = $_REQUEST['id_name']; |
|
| 144 | 144 | } |
| 145 | 145 | $s_manifest = ''; |
| 146 | 146 | if(isset($_REQUEST['s_manifest'])){ |
| 147 | - $s_manifest = $_REQUEST['s_manifest']; |
|
| 147 | + $s_manifest = $_REQUEST['s_manifest']; |
|
| 148 | 148 | } |
| 149 | 149 | $previous_version = ''; |
| 150 | 150 | if(isset($_REQUEST['previous_version'])){ |
| 151 | - $previous_version = $_REQUEST['previous_version']; |
|
| 151 | + $previous_version = $_REQUEST['previous_version']; |
|
| 152 | 152 | } |
| 153 | 153 | $previous_id = ''; |
| 154 | 154 | if(isset($_REQUEST['previous_id'])){ |
| 155 | - $previous_id = $_REQUEST['previous_id']; |
|
| 155 | + $previous_id = $_REQUEST['previous_id']; |
|
| 156 | 156 | } |
| 157 | 157 | if( $install_type != "module" ){ |
| 158 | 158 | if( !isset($_REQUEST['zip_from_dir']) || ($_REQUEST['zip_from_dir'] == "") ){ |
@@ -170,11 +170,11 @@ discard block |
||
| 170 | 170 | } |
| 171 | 171 | $remove_tables = 'true'; |
| 172 | 172 | if(isset($_REQUEST['remove_tables'])){ |
| 173 | - $remove_tables = $_REQUEST['remove_tables']; |
|
| 173 | + $remove_tables = $_REQUEST['remove_tables']; |
|
| 174 | 174 | } |
| 175 | 175 | $overwrite_files = true; |
| 176 | 176 | if(isset($_REQUEST['radio_overwrite'])){ |
| 177 | - $overwrite_files = (($_REQUEST['radio_overwrite'] == 'do_not_overwrite') ? false : true); |
|
| 177 | + $overwrite_files = (($_REQUEST['radio_overwrite'] == 'do_not_overwrite') ? false : true); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | //rrs |
@@ -200,13 +200,13 @@ discard block |
||
| 200 | 200 | |
| 201 | 201 | if (((defined('MODULE_INSTALLER_PACKAGE_SCAN') && MODULE_INSTALLER_PACKAGE_SCAN) |
| 202 | 202 | || !empty($GLOBALS['sugar_config']['moduleInstaller']['packageScan'])) && $install_type != 'patch') { |
| 203 | - require_once('ModuleInstall/ModuleScanner.php'); |
|
| 204 | - $ms = new ModuleScanner(); |
|
| 205 | - $ms->scanPackage($unzip_dir); |
|
| 206 | - if($ms->hasIssues()){ |
|
| 207 | - $ms->displayIssues(); |
|
| 208 | - sugar_cleanup(true); |
|
| 209 | - } |
|
| 203 | + require_once('ModuleInstall/ModuleScanner.php'); |
|
| 204 | + $ms = new ModuleScanner(); |
|
| 205 | + $ms->scanPackage($unzip_dir); |
|
| 206 | + if($ms->hasIssues()){ |
|
| 207 | + $ms->displayIssues(); |
|
| 208 | + sugar_cleanup(true); |
|
| 209 | + } |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | // |
@@ -214,29 +214,29 @@ discard block |
||
| 214 | 214 | // |
| 215 | 215 | if($install_type == 'patch' || $install_type == 'module') |
| 216 | 216 | { |
| 217 | - switch($mode) |
|
| 218 | - { |
|
| 219 | - case 'Install': |
|
| 220 | - $file = "$unzip_dir/" . constant('SUGARCRM_PRE_INSTALL_FILE'); |
|
| 221 | - if(is_file($file)) |
|
| 222 | - { |
|
| 223 | - print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n"); |
|
| 224 | - include($file); |
|
| 225 | - pre_install(); |
|
| 226 | - } |
|
| 227 | - break; |
|
| 228 | - case 'Uninstall': |
|
| 229 | - $file = "$unzip_dir/" . constant('SUGARCRM_PRE_UNINSTALL_FILE'); |
|
| 230 | - if(is_file($file)) |
|
| 231 | - { |
|
| 232 | - print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n"); |
|
| 233 | - include($file); |
|
| 234 | - pre_uninstall(); |
|
| 235 | - } |
|
| 236 | - break; |
|
| 237 | - default: |
|
| 238 | - break; |
|
| 239 | - } |
|
| 217 | + switch($mode) |
|
| 218 | + { |
|
| 219 | + case 'Install': |
|
| 220 | + $file = "$unzip_dir/" . constant('SUGARCRM_PRE_INSTALL_FILE'); |
|
| 221 | + if(is_file($file)) |
|
| 222 | + { |
|
| 223 | + print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n"); |
|
| 224 | + include($file); |
|
| 225 | + pre_install(); |
|
| 226 | + } |
|
| 227 | + break; |
|
| 228 | + case 'Uninstall': |
|
| 229 | + $file = "$unzip_dir/" . constant('SUGARCRM_PRE_UNINSTALL_FILE'); |
|
| 230 | + if(is_file($file)) |
|
| 231 | + { |
|
| 232 | + print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n"); |
|
| 233 | + include($file); |
|
| 234 | + pre_uninstall(); |
|
| 235 | + } |
|
| 236 | + break; |
|
| 237 | + default: |
|
| 238 | + break; |
|
| 239 | + } |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | // |
@@ -251,9 +251,9 @@ discard block |
||
| 251 | 251 | $sugar_home_dir = getCwd(); |
| 252 | 252 | $dest_file = clean_path( "$sugar_home_dir/$zip_to_dir/$file_to_copy" ); |
| 253 | 253 | if($zip_to_dir != '.') |
| 254 | - $rest_file = clean_path("$rest_dir/$zip_to_dir/$file_to_copy"); |
|
| 254 | + $rest_file = clean_path("$rest_dir/$zip_to_dir/$file_to_copy"); |
|
| 255 | 255 | else |
| 256 | - $rest_file = clean_path("$rest_dir/$file_to_copy"); |
|
| 256 | + $rest_file = clean_path("$rest_dir/$file_to_copy"); |
|
| 257 | 257 | |
| 258 | 258 | switch( $mode ){ |
| 259 | 259 | case "Install": |
@@ -261,11 +261,11 @@ discard block |
||
| 261 | 261 | |
| 262 | 262 | if($install_type=="patch" && is_file($dest_file)) |
| 263 | 263 | { |
| 264 | - if(!is_dir(dirname( $rest_file ))) |
|
| 265 | - mkdir_recursive( dirname( $rest_file ) ); |
|
| 264 | + if(!is_dir(dirname( $rest_file ))) |
|
| 265 | + mkdir_recursive( dirname( $rest_file ) ); |
|
| 266 | 266 | |
| 267 | - copy( $dest_file, $rest_file); |
|
| 268 | - sugar_touch( $rest_file, filemtime($dest_file) ); |
|
| 267 | + copy( $dest_file, $rest_file); |
|
| 268 | + sugar_touch( $rest_file, filemtime($dest_file) ); |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | if( !copy( $src_file, $dest_file ) ){ |
@@ -276,8 +276,8 @@ discard block |
||
| 276 | 276 | case "Uninstall": |
| 277 | 277 | if($install_type=="patch" && is_file($rest_file)) |
| 278 | 278 | { |
| 279 | - copy( $rest_file, $dest_file); |
|
| 280 | - sugar_touch( $dest_file, filemtime($rest_file) ); |
|
| 279 | + copy( $rest_file, $dest_file); |
|
| 280 | + sugar_touch( $dest_file, filemtime($rest_file) ); |
|
| 281 | 281 | } |
| 282 | 282 | elseif(file_exists($dest_file) && !unlink($dest_file)) |
| 283 | 283 | { |
@@ -312,21 +312,21 @@ discard block |
||
| 312 | 312 | $new_langs += array( $key => $value ); |
| 313 | 313 | } |
| 314 | 314 | } |
| 315 | - $sugar_config['languages'] = $new_langs; |
|
| 316 | - |
|
| 317 | - $default_sugar_instance_lang = 'en_us'; |
|
| 318 | - if($current_language == $_REQUEST['new_lang_name']){ |
|
| 319 | - $_SESSION['authenticated_user_language'] =$default_sugar_instance_lang; |
|
| 320 | - $lang_changed_string = $mod_strings['LBL_CURRENT_LANGUAGE_CHANGE'].$sugar_config['languages'][$default_sugar_instance_lang].'<br/>'; |
|
| 321 | - } |
|
| 322 | - |
|
| 323 | - if($sugar_config['default_language'] == $_REQUEST['new_lang_name']){ |
|
| 324 | - $cfg = new Configurator(); |
|
| 325 | - $cfg->config['languages'] = $new_langs; |
|
| 326 | - $cfg->config['default_language'] = $default_sugar_instance_lang; |
|
| 327 | - $cfg->handleOverride(); |
|
| 328 | - $lang_changed_string .= $mod_strings['LBL_DEFAULT_LANGUAGE_CHANGE'].$sugar_config['languages'][$default_sugar_instance_lang].'<br/>'; |
|
| 329 | - } |
|
| 315 | + $sugar_config['languages'] = $new_langs; |
|
| 316 | + |
|
| 317 | + $default_sugar_instance_lang = 'en_us'; |
|
| 318 | + if($current_language == $_REQUEST['new_lang_name']){ |
|
| 319 | + $_SESSION['authenticated_user_language'] =$default_sugar_instance_lang; |
|
| 320 | + $lang_changed_string = $mod_strings['LBL_CURRENT_LANGUAGE_CHANGE'].$sugar_config['languages'][$default_sugar_instance_lang].'<br/>'; |
|
| 321 | + } |
|
| 322 | + |
|
| 323 | + if($sugar_config['default_language'] == $_REQUEST['new_lang_name']){ |
|
| 324 | + $cfg = new Configurator(); |
|
| 325 | + $cfg->config['languages'] = $new_langs; |
|
| 326 | + $cfg->config['default_language'] = $default_sugar_instance_lang; |
|
| 327 | + $cfg->handleOverride(); |
|
| 328 | + $lang_changed_string .= $mod_strings['LBL_DEFAULT_LANGUAGE_CHANGE'].$sugar_config['languages'][$default_sugar_instance_lang].'<br/>'; |
|
| 329 | + } |
|
| 330 | 330 | } |
| 331 | 331 | ksort( $sugar_config ); |
| 332 | 332 | if( !write_array_to_file( "sugar_config", $sugar_config, "config.php" ) ){ |
@@ -339,39 +339,39 @@ discard block |
||
| 339 | 339 | switch( $mode ){ |
| 340 | 340 | case "Install": |
| 341 | 341 | //here we can determine if this is an upgrade or a new version |
| 342 | - if(!empty($previous_version)){ |
|
| 343 | - $mi->install( "$unzip_dir", true, $previous_version); |
|
| 344 | - }else{ |
|
| 345 | - $mi->install( "$unzip_dir" ); |
|
| 346 | - } |
|
| 347 | - |
|
| 348 | - $file = "$unzip_dir/" . constant('SUGARCRM_POST_INSTALL_FILE'); |
|
| 349 | - if(is_file($file)) |
|
| 350 | - { |
|
| 351 | - print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n"); |
|
| 352 | - include($file); |
|
| 353 | - post_install(); |
|
| 354 | - } |
|
| 355 | - break; |
|
| 342 | + if(!empty($previous_version)){ |
|
| 343 | + $mi->install( "$unzip_dir", true, $previous_version); |
|
| 344 | + }else{ |
|
| 345 | + $mi->install( "$unzip_dir" ); |
|
| 346 | + } |
|
| 347 | + |
|
| 348 | + $file = "$unzip_dir/" . constant('SUGARCRM_POST_INSTALL_FILE'); |
|
| 349 | + if(is_file($file)) |
|
| 350 | + { |
|
| 351 | + print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n"); |
|
| 352 | + include($file); |
|
| 353 | + post_install(); |
|
| 354 | + } |
|
| 355 | + break; |
|
| 356 | 356 | case "Uninstall": |
| 357 | 357 | if($remove_tables == 'false') |
| 358 | - $GLOBALS['mi_remove_tables'] = false; |
|
| 358 | + $GLOBALS['mi_remove_tables'] = false; |
|
| 359 | 359 | else |
| 360 | - $GLOBALS['mi_remove_tables'] = true; |
|
| 360 | + $GLOBALS['mi_remove_tables'] = true; |
|
| 361 | 361 | $mi->uninstall( "$unzip_dir" ); |
| 362 | 362 | break; |
| 363 | - case "Disable": |
|
| 363 | + case "Disable": |
|
| 364 | 364 | if(!$overwrite_files) |
| 365 | - $GLOBALS['mi_overwrite_files'] = false; |
|
| 365 | + $GLOBALS['mi_overwrite_files'] = false; |
|
| 366 | 366 | else |
| 367 | - $GLOBALS['mi_overwrite_files'] = true; |
|
| 367 | + $GLOBALS['mi_overwrite_files'] = true; |
|
| 368 | 368 | $mi->disable( "$unzip_dir" ); |
| 369 | 369 | break; |
| 370 | - case "Enable": |
|
| 370 | + case "Enable": |
|
| 371 | 371 | if(!$overwrite_files) |
| 372 | - $GLOBALS['mi_overwrite_files'] = false; |
|
| 372 | + $GLOBALS['mi_overwrite_files'] = false; |
|
| 373 | 373 | else |
| 374 | - $GLOBALS['mi_overwrite_files'] = true; |
|
| 374 | + $GLOBALS['mi_overwrite_files'] = true; |
|
| 375 | 375 | $mi->enable( "$unzip_dir" ); |
| 376 | 376 | break; |
| 377 | 377 | default: |
@@ -382,46 +382,46 @@ discard block |
||
| 382 | 382 | case "full": |
| 383 | 383 | // purposely flow into "case: patch" |
| 384 | 384 | case "patch": |
| 385 | - switch($mode) |
|
| 386 | - { |
|
| 387 | - case 'Install': |
|
| 388 | - $file = "$unzip_dir/" . constant('SUGARCRM_POST_INSTALL_FILE'); |
|
| 389 | - if(is_file($file)) |
|
| 390 | - { |
|
| 391 | - print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n"); |
|
| 392 | - include($file); |
|
| 393 | - post_install(); |
|
| 394 | - } |
|
| 395 | - |
|
| 396 | - UWrebuild(); |
|
| 397 | - break; |
|
| 398 | - case 'Uninstall': |
|
| 399 | - $file = "$unzip_dir/" . constant('SUGARCRM_POST_UNINSTALL_FILE'); |
|
| 400 | - if(is_file($file)) { |
|
| 401 | - print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n"); |
|
| 402 | - include($file); |
|
| 403 | - post_uninstall(); |
|
| 404 | - } |
|
| 405 | - |
|
| 406 | - if(is_dir($rest_dir)) |
|
| 407 | - { |
|
| 408 | - rmdir_recursive($rest_dir); |
|
| 409 | - } |
|
| 410 | - |
|
| 411 | - UWrebuild(); |
|
| 412 | - break; |
|
| 413 | - default: |
|
| 414 | - break; |
|
| 415 | - } |
|
| 416 | - |
|
| 417 | - require( "sugar_version.php" ); |
|
| 418 | - $sugar_config['sugar_version'] = $sugar_version; |
|
| 419 | - ksort( $sugar_config ); |
|
| 420 | - |
|
| 421 | - if( !write_array_to_file( "sugar_config", $sugar_config, "config.php" ) ) |
|
| 422 | - { |
|
| 423 | - die($mod_strings['ERR_UW_UPDATE_CONFIG']); |
|
| 424 | - } |
|
| 385 | + switch($mode) |
|
| 386 | + { |
|
| 387 | + case 'Install': |
|
| 388 | + $file = "$unzip_dir/" . constant('SUGARCRM_POST_INSTALL_FILE'); |
|
| 389 | + if(is_file($file)) |
|
| 390 | + { |
|
| 391 | + print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n"); |
|
| 392 | + include($file); |
|
| 393 | + post_install(); |
|
| 394 | + } |
|
| 395 | + |
|
| 396 | + UWrebuild(); |
|
| 397 | + break; |
|
| 398 | + case 'Uninstall': |
|
| 399 | + $file = "$unzip_dir/" . constant('SUGARCRM_POST_UNINSTALL_FILE'); |
|
| 400 | + if(is_file($file)) { |
|
| 401 | + print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n"); |
|
| 402 | + include($file); |
|
| 403 | + post_uninstall(); |
|
| 404 | + } |
|
| 405 | + |
|
| 406 | + if(is_dir($rest_dir)) |
|
| 407 | + { |
|
| 408 | + rmdir_recursive($rest_dir); |
|
| 409 | + } |
|
| 410 | + |
|
| 411 | + UWrebuild(); |
|
| 412 | + break; |
|
| 413 | + default: |
|
| 414 | + break; |
|
| 415 | + } |
|
| 416 | + |
|
| 417 | + require( "sugar_version.php" ); |
|
| 418 | + $sugar_config['sugar_version'] = $sugar_version; |
|
| 419 | + ksort( $sugar_config ); |
|
| 420 | + |
|
| 421 | + if( !write_array_to_file( "sugar_config", $sugar_config, "config.php" ) ) |
|
| 422 | + { |
|
| 423 | + die($mod_strings['ERR_UW_UPDATE_CONFIG']); |
|
| 424 | + } |
|
| 425 | 425 | break; |
| 426 | 426 | default: |
| 427 | 427 | break; |
@@ -434,15 +434,15 @@ discard block |
||
| 434 | 434 | $new_upgrade = new UpgradeHistory(); |
| 435 | 435 | //determine if this module has already been installed given the unique_key to |
| 436 | 436 | //identify the module |
| 437 | - // $new_upgrade->checkForExisting($unique_key); |
|
| 438 | - if(!empty($previous_id)){ |
|
| 439 | - $new_upgrade->id = $previous_id; |
|
| 440 | - $uh = new UpgradeHistory(); |
|
| 441 | - $uh->retrieve($previous_id); |
|
| 442 | - if(is_file($uh->filename)) { |
|
| 443 | - unlink($uh->filename); |
|
| 444 | - } |
|
| 445 | - } |
|
| 437 | + // $new_upgrade->checkForExisting($unique_key); |
|
| 438 | + if(!empty($previous_id)){ |
|
| 439 | + $new_upgrade->id = $previous_id; |
|
| 440 | + $uh = new UpgradeHistory(); |
|
| 441 | + $uh->retrieve($previous_id); |
|
| 442 | + if(is_file($uh->filename)) { |
|
| 443 | + unlink($uh->filename); |
|
| 444 | + } |
|
| 445 | + } |
|
| 446 | 446 | $new_upgrade->filename = $install_file; |
| 447 | 447 | $new_upgrade->md5sum = md5_file( $install_file ); |
| 448 | 448 | $new_upgrade->type = $install_type; |
@@ -457,25 +457,25 @@ discard block |
||
| 457 | 457 | //Check if we need to show a page for the user to finalize their install with. |
| 458 | 458 | if (is_file("$unzip_dir/manifest.php")) |
| 459 | 459 | { |
| 460 | - include("$unzip_dir/manifest.php"); |
|
| 461 | - if (!empty($manifest['post_install_url'])) |
|
| 462 | - { |
|
| 463 | - $url_conf = $manifest['post_install_url']; |
|
| 464 | - if (is_string($url_conf)) |
|
| 465 | - $url_conf = array('url' => $url_conf); |
|
| 466 | - if (isset($url_conf['type']) && $url_conf['type'] == 'popup') |
|
| 467 | - { |
|
| 468 | - echo '<script type="text/javascript">window.open("' . $url_conf['url'] |
|
| 469 | - . '","' . (empty($url_conf['name']) ? 'sugar_popup' : $url_conf['name']) . '","' |
|
| 470 | - . 'height=' . (empty($url_conf['height']) ? '500' : $url_conf['height']) . ',' |
|
| 471 | - . 'width=' . (empty($url_conf['width']) ? '800' : $url_conf['width']) . '");</script>'; |
|
| 472 | - } else |
|
| 473 | - { |
|
| 474 | - echo '<iframe src="' . $url_conf['url'] . '" ' |
|
| 475 | - . 'width="' . (empty($url_conf['width']) ? '100%' : $url_conf['width']) . '" ' |
|
| 476 | - . 'height="' . (empty($url_conf['height']) ? '500px' : $url_conf['height']) . '"></iframe>'; |
|
| 477 | - } |
|
| 478 | - } |
|
| 460 | + include("$unzip_dir/manifest.php"); |
|
| 461 | + if (!empty($manifest['post_install_url'])) |
|
| 462 | + { |
|
| 463 | + $url_conf = $manifest['post_install_url']; |
|
| 464 | + if (is_string($url_conf)) |
|
| 465 | + $url_conf = array('url' => $url_conf); |
|
| 466 | + if (isset($url_conf['type']) && $url_conf['type'] == 'popup') |
|
| 467 | + { |
|
| 468 | + echo '<script type="text/javascript">window.open("' . $url_conf['url'] |
|
| 469 | + . '","' . (empty($url_conf['name']) ? 'sugar_popup' : $url_conf['name']) . '","' |
|
| 470 | + . 'height=' . (empty($url_conf['height']) ? '500' : $url_conf['height']) . ',' |
|
| 471 | + . 'width=' . (empty($url_conf['width']) ? '800' : $url_conf['width']) . '");</script>'; |
|
| 472 | + } else |
|
| 473 | + { |
|
| 474 | + echo '<iframe src="' . $url_conf['url'] . '" ' |
|
| 475 | + . 'width="' . (empty($url_conf['width']) ? '100%' : $url_conf['width']) . '" ' |
|
| 476 | + . 'height="' . (empty($url_conf['height']) ? '500px' : $url_conf['height']) . '"></iframe>'; |
|
| 477 | + } |
|
| 478 | + } |
|
| 479 | 479 | } |
| 480 | 480 | break; |
| 481 | 481 | case "Uninstall": |
@@ -499,7 +499,7 @@ discard block |
||
| 499 | 499 | die( "{$mod_strings['ERR_UW_NO_UPDATE_RECORD']} $install_file." ); |
| 500 | 500 | } |
| 501 | 501 | foreach( $md5_matches as $md5_match ){ |
| 502 | - $md5_match->enabled = 0; |
|
| 502 | + $md5_match->enabled = 0; |
|
| 503 | 503 | $md5_match->save(); |
| 504 | 504 | } |
| 505 | 505 | break; |
@@ -532,7 +532,7 @@ discard block |
||
| 532 | 532 | echo "</div>"; |
| 533 | 533 | echo "<br>"; |
| 534 | 534 | if(isset($lang_changed_string)) |
| 535 | - print($lang_changed_string); |
|
| 535 | + print($lang_changed_string); |
|
| 536 | 536 | if ($install_type != "module" && $install_type != "langpack"){ |
| 537 | 537 | if( sizeof( $files_to_handle ) > 0 ){ |
| 538 | 538 | echo '<div style="text-align: left; cursor: hand; cursor: pointer; text-decoration: underline;" onclick=\'this.style.display="none"; toggleDisplay("more");\' id="all_text">' . SugarThemeRegistry::current()->getImage('advanced_search', '', null, null, ".gif", $mod_strings['LBL_ADVANCED_SEARCH']) . ' Show Details</div><div id=\'more\' style=\'display: none\'> |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 3 | 3 | /********************************************************************************* |
| 4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
| 5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -64,12 +64,12 @@ discard block |
||
| 64 | 64 | var $tracker_visibility = false; |
| 65 | 65 | var $table_name = "upgrade_history"; |
| 66 | 66 | var $object_name = "UpgradeHistory"; |
| 67 | - var $column_fields = Array( "id", "filename", "md5sum", "type", "version", "status", "date_entered" ); |
|
| 67 | + var $column_fields = Array("id", "filename", "md5sum", "type", "version", "status", "date_entered"); |
|
| 68 | 68 | var $disable_custom_fields = true; |
| 69 | 69 | |
| 70 | 70 | function delete() |
| 71 | 71 | { |
| 72 | - $this->db->query( "delete from " . $this->table_name . " where id = " . $this->db->quoted($this->id)); |
|
| 72 | + $this->db->query("delete from ".$this->table_name." where id = ".$this->db->quoted($this->id)); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | public function __construct() |
@@ -81,9 +81,9 @@ discard block |
||
| 81 | 81 | /** |
| 82 | 82 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 83 | 83 | */ |
| 84 | - public function UpgradeHistory(){ |
|
| 84 | + public function UpgradeHistory() { |
|
| 85 | 85 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 86 | - if(isset($GLOBALS['log'])) { |
|
| 86 | + if (isset($GLOBALS['log'])) { |
|
| 87 | 87 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 88 | 88 | } |
| 89 | 89 | else { |
@@ -93,8 +93,8 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | |
| 96 | - function getAllOrderBy($orderBy){ |
|
| 97 | - $query = "SELECT id FROM " . $this->table_name . " ORDER BY ".$orderBy; |
|
| 96 | + function getAllOrderBy($orderBy) { |
|
| 97 | + $query = "SELECT id FROM ".$this->table_name." ORDER BY ".$orderBy; |
|
| 98 | 98 | return $this->getList($query); |
| 99 | 99 | } |
| 100 | 100 | /** |
@@ -103,33 +103,33 @@ discard block |
||
| 103 | 103 | * @param id the id of the item you are comparing to |
| 104 | 104 | * @return upgrade_history object if found, null otherwise |
| 105 | 105 | */ |
| 106 | - function checkForExisting($patch_to_check){ |
|
| 106 | + function checkForExisting($patch_to_check) { |
|
| 107 | 107 | $uh = new UpgradeHistory(); |
| 108 | - if($patch_to_check != null){ |
|
| 108 | + if ($patch_to_check != null) { |
|
| 109 | 109 | |
| 110 | - if(empty($patch_to_check->id_name)){ |
|
| 110 | + if (empty($patch_to_check->id_name)) { |
|
| 111 | 111 | $where = " WHERE name = '$patch_to_check->name' "; |
| 112 | - }else{ |
|
| 112 | + } else { |
|
| 113 | 113 | $where = " WHERE id_name = '$patch_to_check->id_name' "; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - if(!empty($patch_to_check->id)){ |
|
| 116 | + if (!empty($patch_to_check->id)) { |
|
| 117 | 117 | $where .= " AND id != '$patch_to_check->id' "; |
| 118 | - }else{ |
|
| 118 | + } else { |
|
| 119 | 119 | $where .= " AND id is not null "; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - $query = "SELECT id FROM " . $this->table_name . " ". $where; |
|
| 122 | + $query = "SELECT id FROM ".$this->table_name." ".$where; |
|
| 123 | 123 | |
| 124 | 124 | $result = $uh->db->query($query); |
| 125 | - if(empty($result)){ |
|
| 125 | + if (empty($result)) { |
|
| 126 | 126 | return null; |
| 127 | 127 | } |
| 128 | 128 | $row = $uh->db->fetchByAssoc($result); |
| 129 | - if(empty($row)){ |
|
| 129 | + if (empty($row)) { |
|
| 130 | 130 | return null; |
| 131 | 131 | } |
| 132 | - if(!empty($row['id'])){ |
|
| 132 | + if (!empty($row['id'])) { |
|
| 133 | 133 | return $uh->retrieve($row['id']); |
| 134 | 134 | } |
| 135 | 135 | } |
@@ -139,22 +139,22 @@ discard block |
||
| 139 | 139 | /** |
| 140 | 140 | * Check if this is an upgrade, if it is then return the latest version before this installation |
| 141 | 141 | */ |
| 142 | - function determineIfUpgrade($id_name, $version){ |
|
| 143 | - $query = "SELECT id, version FROM " . $this->table_name . " WHERE id_name = '$id_name' ORDER BY date_entered DESC"; |
|
| 142 | + function determineIfUpgrade($id_name, $version) { |
|
| 143 | + $query = "SELECT id, version FROM ".$this->table_name." WHERE id_name = '$id_name' ORDER BY date_entered DESC"; |
|
| 144 | 144 | $result = $this->db->query($query); |
| 145 | - if(empty($result)){ |
|
| 145 | + if (empty($result)) { |
|
| 146 | 146 | return null; |
| 147 | - }else{ |
|
| 147 | + } else { |
|
| 148 | 148 | $temp_version = 0; |
| 149 | 149 | $id = ''; |
| 150 | - while($row = $this->db->fetchByAssoc($result)) |
|
| 150 | + while ($row = $this->db->fetchByAssoc($result)) |
|
| 151 | 151 | { |
| 152 | - if(!$this->is_right_version_greater(explode('.', $row['version']), explode('.', $temp_version))){ |
|
| 152 | + if (!$this->is_right_version_greater(explode('.', $row['version']), explode('.', $temp_version))) { |
|
| 153 | 153 | $temp_version = $row['version']; |
| 154 | 154 | $id = $row['id']; |
| 155 | 155 | } |
| 156 | 156 | }//end while |
| 157 | - if($this->is_right_version_greater(explode('.', $temp_version), explode('.', $version), false)) |
|
| 157 | + if ($this->is_right_version_greater(explode('.', $temp_version), explode('.', $version), false)) |
|
| 158 | 158 | return array('id' => $id, 'version' => $temp_version); |
| 159 | 159 | else |
| 160 | 160 | return null; |
@@ -163,38 +163,38 @@ discard block |
||
| 163 | 163 | |
| 164 | 164 | function getAll() |
| 165 | 165 | { |
| 166 | - $query = "SELECT id FROM " . $this->table_name . " ORDER BY date_entered desc"; |
|
| 166 | + $query = "SELECT id FROM ".$this->table_name." ORDER BY date_entered desc"; |
|
| 167 | 167 | return $this->getList($query); |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - function getList($query){ |
|
| 171 | - return( parent::build_related_list( $query, $this ) ); |
|
| 170 | + function getList($query) { |
|
| 171 | + return(parent::build_related_list($query, $this)); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - function findByMd5( $var_md5 ) |
|
| 174 | + function findByMd5($var_md5) |
|
| 175 | 175 | { |
| 176 | - $query = "SELECT id FROM " . $this->table_name . " where md5sum = '$var_md5'"; |
|
| 177 | - return( parent::build_related_list( $query, $this ) ); |
|
| 176 | + $query = "SELECT id FROM ".$this->table_name." where md5sum = '$var_md5'"; |
|
| 177 | + return(parent::build_related_list($query, $this)); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | function UninstallAvailable($patch_list, $patch_to_check) |
| 181 | 181 | { |
| 182 | 182 | //before we even go through the list, let us try to see if we find a match. |
| 183 | 183 | $history_object = $this->checkForExisting($patch_to_check); |
| 184 | - if($history_object != null){ |
|
| 185 | - if((!empty($history_object->id_name) && !empty($patch_to_check->id_name) && strcmp($history_object->id_name, $patch_to_check->id_name) == 0) || strcmp($history_object->name, $patch_to_check->name) == 0){ |
|
| 184 | + if ($history_object != null) { |
|
| 185 | + if ((!empty($history_object->id_name) && !empty($patch_to_check->id_name) && strcmp($history_object->id_name, $patch_to_check->id_name) == 0) || strcmp($history_object->name, $patch_to_check->name) == 0) { |
|
| 186 | 186 | //we have found a match |
| 187 | 187 | //if the patch_to_check version is greater than the found version |
| 188 | 188 | return ($this->is_right_version_greater(explode('.', $history_object->version), explode('.', $patch_to_check->version))); |
| 189 | - }else{ |
|
| 189 | + } else { |
|
| 190 | 190 | return true; |
| 191 | 191 | } |
| 192 | 192 | } |
| 193 | 193 | //we will only go through this loop if we have not found another UpgradeHistory object |
| 194 | 194 | //with a matching unique_key in the database |
| 195 | - foreach($patch_list as $more_recent_patch) |
|
| 195 | + foreach ($patch_list as $more_recent_patch) |
|
| 196 | 196 | { |
| 197 | - if($more_recent_patch->id == $patch_to_check->id) |
|
| 197 | + if ($more_recent_patch->id == $patch_to_check->id) |
|
| 198 | 198 | break; |
| 199 | 199 | |
| 200 | 200 | //we will only resort to checking the files if we cannot find the unique_keys |
@@ -217,31 +217,31 @@ discard block |
||
| 217 | 217 | |
| 218 | 218 | function foundConflict($check_path, $recent_path) |
| 219 | 219 | { |
| 220 | - if(is_file($check_path)) |
|
| 220 | + if (is_file($check_path)) |
|
| 221 | 221 | { |
| 222 | - if(file_exists($recent_path)) |
|
| 222 | + if (file_exists($recent_path)) |
|
| 223 | 223 | return true; |
| 224 | 224 | else |
| 225 | 225 | return false; |
| 226 | 226 | } |
| 227 | - elseif(is_dir($check_path)) |
|
| 227 | + elseif (is_dir($check_path)) |
|
| 228 | 228 | { |
| 229 | 229 | $status = false; |
| 230 | 230 | |
| 231 | - $d = dir( $check_path ); |
|
| 232 | - while( $f = $d->read() ) |
|
| 231 | + $d = dir($check_path); |
|
| 232 | + while ($f = $d->read()) |
|
| 233 | 233 | { |
| 234 | - if( $f == "." || $f == ".." ) |
|
| 234 | + if ($f == "." || $f == "..") |
|
| 235 | 235 | continue; |
| 236 | 236 | |
| 237 | 237 | $status = $this->foundConflict("$check_path/$f", "$recent_path/$f"); |
| 238 | 238 | |
| 239 | - if($status) |
|
| 239 | + if ($status) |
|
| 240 | 240 | break; |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | $d->close(); |
| 244 | - return( $status ); |
|
| 244 | + return($status); |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | return false; |
@@ -256,19 +256,19 @@ discard block |
||
| 256 | 256 | * return true if the right version is greater or they are equal |
| 257 | 257 | * false if the left version is greater |
| 258 | 258 | */ |
| 259 | - function is_right_version_greater($left, $right, $equals_is_greater = true){ |
|
| 260 | - if(count($left) == 0 && count($right) == 0){ |
|
| 259 | + function is_right_version_greater($left, $right, $equals_is_greater = true) { |
|
| 260 | + if (count($left) == 0 && count($right) == 0) { |
|
| 261 | 261 | return $equals_is_greater; |
| 262 | 262 | } |
| 263 | - else if(count($left) == 0 || count($right) == 0){ |
|
| 263 | + else if (count($left) == 0 || count($right) == 0) { |
|
| 264 | 264 | return true; |
| 265 | 265 | } |
| 266 | - else if($left[0] == $right[0]){ |
|
| 266 | + else if ($left[0] == $right[0]) { |
|
| 267 | 267 | array_shift($left); |
| 268 | 268 | array_shift($right); |
| 269 | 269 | return $this->is_right_version_greater($left, $right, $equals_is_greater); |
| 270 | 270 | } |
| 271 | - else if($left[0] < $right[0]){ |
|
| 271 | + else if ($left[0] < $right[0]) { |
|
| 272 | 272 | return true; |
| 273 | 273 | } |
| 274 | 274 | else |
@@ -283,28 +283,28 @@ discard block |
||
| 283 | 283 | * |
| 284 | 284 | * @return not_found an array of id_names that were not found to be installed on the system |
| 285 | 285 | */ |
| 286 | - function checkDependencies($dependencies = array()){ |
|
| 286 | + function checkDependencies($dependencies = array()) { |
|
| 287 | 287 | $not_found = array(); |
| 288 | - foreach($dependencies as $dependent){ |
|
| 288 | + foreach ($dependencies as $dependent) { |
|
| 289 | 289 | $found = false; |
| 290 | 290 | $query = "SELECT id FROM $this->table_name WHERE id_name = '".$dependent['id_name']."'"; |
| 291 | 291 | $matches = $this->getList($query); |
| 292 | - if(0 != sizeof($matches)){ |
|
| 293 | - foreach($matches as $match){ |
|
| 294 | - if($this->is_right_version_greater(explode('.', $match->version), explode('.', $dependent['version']))){ |
|
| 292 | + if (0 != sizeof($matches)) { |
|
| 293 | + foreach ($matches as $match) { |
|
| 294 | + if ($this->is_right_version_greater(explode('.', $match->version), explode('.', $dependent['version']))) { |
|
| 295 | 295 | $found = true; |
| 296 | 296 | break; |
| 297 | 297 | }//fi |
| 298 | 298 | }//rof |
| 299 | 299 | }//fi |
| 300 | - if(!$found){ |
|
| 300 | + if (!$found) { |
|
| 301 | 301 | $not_found[] = $dependent['id_name']; |
| 302 | 302 | }//fi |
| 303 | 303 | }//rof |
| 304 | 304 | return $not_found; |
| 305 | 305 | } |
| 306 | - function retrieve($id = -1, $encode=true,$deleted=true) { |
|
| 307 | - return parent::retrieve($id,$encode,false); //ignore the deleted filter. the table does not have the deleted column in it. |
|
| 306 | + function retrieve($id = -1, $encode = true, $deleted = true) { |
|
| 307 | + return parent::retrieve($id, $encode, false); //ignore the deleted filter. the table does not have the deleted column in it. |
|
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | } |
@@ -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 | /** |
@@ -43,16 +43,16 @@ |
||
| 43 | 43 | require_once('modules/AOK_KnowledgeBase/AOK_KnowledgeBase_sugar.php'); |
| 44 | 44 | class AOK_KnowledgeBase extends AOK_KnowledgeBase_sugar { |
| 45 | 45 | |
| 46 | - public function __construct(){ |
|
| 46 | + public function __construct() { |
|
| 47 | 47 | parent::__construct(); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | 51 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 52 | 52 | */ |
| 53 | - public function AOK_KnowledgeBase(){ |
|
| 53 | + public function AOK_KnowledgeBase() { |
|
| 54 | 54 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 55 | - if(isset($GLOBALS['log'])) { |
|
| 55 | + if (isset($GLOBALS['log'])) { |
|
| 56 | 56 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 57 | 57 | } |
| 58 | 58 | else { |
@@ -40,9 +40,9 @@ |
||
| 40 | 40 | require_once('modules/AM_TaskTemplates/AM_TaskTemplates_sugar.php'); |
| 41 | 41 | class AM_TaskTemplates extends AM_TaskTemplates_sugar { |
| 42 | 42 | |
| 43 | - public function __construct(){ |
|
| 44 | - parent::__construct(); |
|
| 45 | - } |
|
| 43 | + public function __construct(){ |
|
| 44 | + parent::__construct(); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
@@ -23,8 +23,7 @@ |
||
| 23 | 23 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 24 | 24 | if(isset($GLOBALS['log'])) { |
| 25 | 25 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 26 | - } |
|
| 27 | - else { |
|
| 26 | + } else { |
|
| 28 | 27 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 29 | 28 | } |
| 30 | 29 | self::__construct($seed, $module, $subPanel, $options); |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | var $object_name = 'AOK_KnowledgeBase'; |
| 51 | 51 | var $table_name = 'aok_knowledgebase'; |
| 52 | 52 | var $importable = false; |
| 53 | - var $disable_row_level_security = true ; // to ensure that modules created and deployed under CE will continue to function under team security if the instance is upgraded to PRO |
|
| 53 | + var $disable_row_level_security = true; // to ensure that modules created and deployed under CE will continue to function under team security if the instance is upgraded to PRO |
|
| 54 | 54 | var $id; |
| 55 | 55 | var $name; |
| 56 | 56 | var $date_entered; |
@@ -73,16 +73,16 @@ discard block |
||
| 73 | 73 | var $user_id1_c; |
| 74 | 74 | var $approver; |
| 75 | 75 | |
| 76 | - public function __construct(){ |
|
| 76 | + public function __construct() { |
|
| 77 | 77 | parent::__construct(); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | 81 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 82 | 82 | */ |
| 83 | - public function AOK_KnowledgeBase_sugar(){ |
|
| 83 | + public function AOK_KnowledgeBase_sugar() { |
|
| 84 | 84 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 85 | - if(isset($GLOBALS['log'])) { |
|
| 85 | + if (isset($GLOBALS['log'])) { |
|
| 86 | 86 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 87 | 87 | } |
| 88 | 88 | else { |
@@ -92,8 +92,8 @@ discard block |
||
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | |
| 95 | - function bean_implements($interface){ |
|
| 96 | - switch($interface){ |
|
| 95 | + function bean_implements($interface) { |
|
| 96 | + switch ($interface) { |
|
| 97 | 97 | case 'ACL': return true; |
| 98 | 98 | } |
| 99 | 99 | return false; |
@@ -23,8 +23,7 @@ |
||
| 23 | 23 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 24 | 24 | if(isset($GLOBALS['log'])) { |
| 25 | 25 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 26 | - } |
|
| 27 | - else { |
|
| 26 | + } else { |
|
| 28 | 27 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 29 | 28 | } |
| 30 | 29 | self::__construct($seed, $module, $subPanel, $options); |
@@ -40,150 +40,150 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | |
| 42 | 42 | class Meeting extends SugarBean { |
| 43 | - // Stored fields |
|
| 44 | - var $id; |
|
| 45 | - var $date_entered; |
|
| 46 | - var $date_modified; |
|
| 47 | - var $assigned_user_id; |
|
| 48 | - var $modified_user_id; |
|
| 49 | - var $created_by; |
|
| 50 | - var $created_by_name; |
|
| 51 | - var $modified_by_name; |
|
| 52 | - var $description; |
|
| 53 | - var $name; |
|
| 54 | - var $location; |
|
| 55 | - var $status; |
|
| 56 | - var $type; |
|
| 57 | - var $date_start; |
|
| 58 | - var $time_start; |
|
| 59 | - var $date_end; |
|
| 60 | - var $duration_hours; |
|
| 61 | - var $duration_minutes; |
|
| 62 | - var $time_meridiem; |
|
| 63 | - var $parent_type; |
|
| 64 | - var $parent_type_options; |
|
| 65 | - var $parent_id; |
|
| 66 | - var $field_name_map; |
|
| 67 | - var $contact_id; |
|
| 68 | - var $user_id; |
|
| 69 | - var $meeting_id; |
|
| 70 | - var $reminder_time; |
|
| 71 | - var $reminder_checked; |
|
| 72 | - var $email_reminder_time; |
|
| 73 | - var $email_reminder_checked; |
|
| 74 | - var $email_reminder_sent; |
|
| 75 | - var $required; |
|
| 76 | - var $accept_status; |
|
| 77 | - var $parent_name; |
|
| 78 | - var $contact_name; |
|
| 79 | - var $contact_phone; |
|
| 80 | - var $contact_email; |
|
| 81 | - var $account_id; |
|
| 82 | - var $opportunity_id; |
|
| 83 | - var $case_id; |
|
| 84 | - var $assigned_user_name; |
|
| 85 | - var $outlook_id; |
|
| 86 | - var $sequence; |
|
| 87 | - var $syncing = false; |
|
| 88 | - var $recurring_source; |
|
| 89 | - |
|
| 90 | - var $update_vcal = true; |
|
| 91 | - var $contacts_arr; |
|
| 92 | - var $users_arr; |
|
| 93 | - var $meetings_arr; |
|
| 94 | - // when assoc w/ a user/contact: |
|
| 95 | - var $minutes_value_default = 15; |
|
| 96 | - var $minutes_values = array('0'=>'00','15'=>'15','30'=>'30','45'=>'45'); |
|
| 97 | - var $table_name = "meetings"; |
|
| 98 | - var $rel_users_table = "meetings_users"; |
|
| 99 | - var $rel_contacts_table = "meetings_contacts"; |
|
| 100 | - var $rel_leads_table = "meetings_leads"; |
|
| 101 | - var $module_dir = "Meetings"; |
|
| 102 | - var $object_name = "Meeting"; |
|
| 103 | - |
|
| 104 | - var $importable = true; |
|
| 105 | - // This is used to retrieve related fields from form posts. |
|
| 106 | - var $additional_column_fields = array('assigned_user_name', 'assigned_user_id', 'contact_id', 'user_id', 'contact_name', 'accept_status'); |
|
| 107 | - var $relationship_fields = array('account_id'=>'accounts','opportunity_id'=>'opportunity','case_id'=>'case', |
|
| 108 | - 'assigned_user_id'=>'users','contact_id'=>'contacts', 'user_id'=>'users', 'meeting_id'=>'meetings'); |
|
| 109 | - // so you can run get_users() twice and run query only once |
|
| 110 | - var $cached_get_users = null; |
|
| 111 | - var $new_schema = true; |
|
| 43 | + // Stored fields |
|
| 44 | + var $id; |
|
| 45 | + var $date_entered; |
|
| 46 | + var $date_modified; |
|
| 47 | + var $assigned_user_id; |
|
| 48 | + var $modified_user_id; |
|
| 49 | + var $created_by; |
|
| 50 | + var $created_by_name; |
|
| 51 | + var $modified_by_name; |
|
| 52 | + var $description; |
|
| 53 | + var $name; |
|
| 54 | + var $location; |
|
| 55 | + var $status; |
|
| 56 | + var $type; |
|
| 57 | + var $date_start; |
|
| 58 | + var $time_start; |
|
| 59 | + var $date_end; |
|
| 60 | + var $duration_hours; |
|
| 61 | + var $duration_minutes; |
|
| 62 | + var $time_meridiem; |
|
| 63 | + var $parent_type; |
|
| 64 | + var $parent_type_options; |
|
| 65 | + var $parent_id; |
|
| 66 | + var $field_name_map; |
|
| 67 | + var $contact_id; |
|
| 68 | + var $user_id; |
|
| 69 | + var $meeting_id; |
|
| 70 | + var $reminder_time; |
|
| 71 | + var $reminder_checked; |
|
| 72 | + var $email_reminder_time; |
|
| 73 | + var $email_reminder_checked; |
|
| 74 | + var $email_reminder_sent; |
|
| 75 | + var $required; |
|
| 76 | + var $accept_status; |
|
| 77 | + var $parent_name; |
|
| 78 | + var $contact_name; |
|
| 79 | + var $contact_phone; |
|
| 80 | + var $contact_email; |
|
| 81 | + var $account_id; |
|
| 82 | + var $opportunity_id; |
|
| 83 | + var $case_id; |
|
| 84 | + var $assigned_user_name; |
|
| 85 | + var $outlook_id; |
|
| 86 | + var $sequence; |
|
| 87 | + var $syncing = false; |
|
| 88 | + var $recurring_source; |
|
| 89 | + |
|
| 90 | + var $update_vcal = true; |
|
| 91 | + var $contacts_arr; |
|
| 92 | + var $users_arr; |
|
| 93 | + var $meetings_arr; |
|
| 94 | + // when assoc w/ a user/contact: |
|
| 95 | + var $minutes_value_default = 15; |
|
| 96 | + var $minutes_values = array('0'=>'00','15'=>'15','30'=>'30','45'=>'45'); |
|
| 97 | + var $table_name = "meetings"; |
|
| 98 | + var $rel_users_table = "meetings_users"; |
|
| 99 | + var $rel_contacts_table = "meetings_contacts"; |
|
| 100 | + var $rel_leads_table = "meetings_leads"; |
|
| 101 | + var $module_dir = "Meetings"; |
|
| 102 | + var $object_name = "Meeting"; |
|
| 103 | + |
|
| 104 | + var $importable = true; |
|
| 105 | + // This is used to retrieve related fields from form posts. |
|
| 106 | + var $additional_column_fields = array('assigned_user_name', 'assigned_user_id', 'contact_id', 'user_id', 'contact_name', 'accept_status'); |
|
| 107 | + var $relationship_fields = array('account_id'=>'accounts','opportunity_id'=>'opportunity','case_id'=>'case', |
|
| 108 | + 'assigned_user_id'=>'users','contact_id'=>'contacts', 'user_id'=>'users', 'meeting_id'=>'meetings'); |
|
| 109 | + // so you can run get_users() twice and run query only once |
|
| 110 | + var $cached_get_users = null; |
|
| 111 | + var $new_schema = true; |
|
| 112 | 112 | var $date_changed = false; |
| 113 | 113 | |
| 114 | - /** |
|
| 115 | - * sole constructor |
|
| 116 | - */ |
|
| 117 | - public function __construct() { |
|
| 118 | - parent::__construct(); |
|
| 119 | - $this->setupCustomFields('Meetings'); |
|
| 120 | - foreach($this->field_defs as $field) { |
|
| 121 | - $this->field_name_map[$field['name']] = $field; |
|
| 122 | - } |
|
| 114 | + /** |
|
| 115 | + * sole constructor |
|
| 116 | + */ |
|
| 117 | + public function __construct() { |
|
| 118 | + parent::__construct(); |
|
| 119 | + $this->setupCustomFields('Meetings'); |
|
| 120 | + foreach($this->field_defs as $field) { |
|
| 121 | + $this->field_name_map[$field['name']] = $field; |
|
| 122 | + } |
|
| 123 | 123 | // $this->fill_in_additional_detail_fields(); |
| 124 | 124 | if(!empty($GLOBALS['app_list_strings']['duration_intervals'])) { |
| 125 | 125 | $this->minutes_values = $GLOBALS['app_list_strings']['duration_intervals']; |
| 126 | 126 | } |
| 127 | - } |
|
| 128 | - |
|
| 129 | - /** |
|
| 130 | - * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
|
| 131 | - */ |
|
| 132 | - public function Meeting(){ |
|
| 133 | - $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
|
| 134 | - if(isset($GLOBALS['log'])) { |
|
| 135 | - $GLOBALS['log']->deprecated($deprecatedMessage); |
|
| 136 | - } |
|
| 137 | - else { |
|
| 138 | - trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
|
| 139 | - } |
|
| 140 | - self::__construct(); |
|
| 141 | - } |
|
| 142 | - |
|
| 143 | - /** |
|
| 144 | - * Disable edit if meeting is recurring and source is not Sugar. It should be edited only from Outlook. |
|
| 145 | - * @param $view string |
|
| 146 | - * @param $is_owner bool |
|
| 147 | - */ |
|
| 148 | - function ACLAccess($view,$is_owner='not_set',$in_group='not_set'){ |
|
| 149 | - // don't check if meeting is being synced from Outlook |
|
| 150 | - if($this->syncing == false){ |
|
| 151 | - $view = strtolower($view); |
|
| 152 | - switch($view){ |
|
| 153 | - case 'edit': |
|
| 154 | - case 'save': |
|
| 155 | - case 'editview': |
|
| 156 | - case 'delete': |
|
| 157 | - if(!empty($this->recurring_source) && $this->recurring_source != "Sugar"){ |
|
| 158 | - return false; |
|
| 159 | - } |
|
| 160 | - } |
|
| 161 | - } |
|
| 162 | - return parent::ACLAccess($view,$is_owner,$in_group); |
|
| 163 | - } |
|
| 164 | - |
|
| 165 | - /** |
|
| 166 | - * Stub for integration |
|
| 167 | - * @return bool |
|
| 168 | - */ |
|
| 169 | - function hasIntegratedMeeting() { |
|
| 170 | - return false; |
|
| 171 | - } |
|
| 172 | - |
|
| 173 | - // save date_end by calculating user input |
|
| 174 | - // this is for calendar |
|
| 175 | - function save($check_notify = FALSE) { |
|
| 176 | - global $timedate; |
|
| 177 | - global $current_user; |
|
| 178 | - |
|
| 179 | - global $disable_date_format; |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + /** |
|
| 130 | + * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
|
| 131 | + */ |
|
| 132 | + public function Meeting(){ |
|
| 133 | + $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
|
| 134 | + if(isset($GLOBALS['log'])) { |
|
| 135 | + $GLOBALS['log']->deprecated($deprecatedMessage); |
|
| 136 | + } |
|
| 137 | + else { |
|
| 138 | + trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
|
| 139 | + } |
|
| 140 | + self::__construct(); |
|
| 141 | + } |
|
| 142 | + |
|
| 143 | + /** |
|
| 144 | + * Disable edit if meeting is recurring and source is not Sugar. It should be edited only from Outlook. |
|
| 145 | + * @param $view string |
|
| 146 | + * @param $is_owner bool |
|
| 147 | + */ |
|
| 148 | + function ACLAccess($view,$is_owner='not_set',$in_group='not_set'){ |
|
| 149 | + // don't check if meeting is being synced from Outlook |
|
| 150 | + if($this->syncing == false){ |
|
| 151 | + $view = strtolower($view); |
|
| 152 | + switch($view){ |
|
| 153 | + case 'edit': |
|
| 154 | + case 'save': |
|
| 155 | + case 'editview': |
|
| 156 | + case 'delete': |
|
| 157 | + if(!empty($this->recurring_source) && $this->recurring_source != "Sugar"){ |
|
| 158 | + return false; |
|
| 159 | + } |
|
| 160 | + } |
|
| 161 | + } |
|
| 162 | + return parent::ACLAccess($view,$is_owner,$in_group); |
|
| 163 | + } |
|
| 164 | + |
|
| 165 | + /** |
|
| 166 | + * Stub for integration |
|
| 167 | + * @return bool |
|
| 168 | + */ |
|
| 169 | + function hasIntegratedMeeting() { |
|
| 170 | + return false; |
|
| 171 | + } |
|
| 172 | + |
|
| 173 | + // save date_end by calculating user input |
|
| 174 | + // this is for calendar |
|
| 175 | + function save($check_notify = FALSE) { |
|
| 176 | + global $timedate; |
|
| 177 | + global $current_user; |
|
| 178 | + |
|
| 179 | + global $disable_date_format; |
|
| 180 | 180 | |
| 181 | 181 | if(isset($this->date_start)) |
| 182 | 182 | { |
| 183 | 183 | $td = $timedate->fromDb($this->date_start); |
| 184 | 184 | if(!$td){ |
| 185 | - $this->date_start = $timedate->to_db($this->date_start); |
|
| 186 | - $td = $timedate->fromDb($this->date_start); |
|
| 185 | + $this->date_start = $timedate->to_db($this->date_start); |
|
| 186 | + $td = $timedate->fromDb($this->date_start); |
|
| 187 | 187 | } |
| 188 | 188 | if($td) |
| 189 | 189 | { |
@@ -199,30 +199,30 @@ discard block |
||
| 199 | 199 | } |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - $check_notify =(!empty($_REQUEST['send_invites']) && $_REQUEST['send_invites'] == '1') ? true : false; |
|
| 203 | - if(empty($_REQUEST['send_invites'])) { |
|
| 204 | - if(!empty($this->id)) { |
|
| 205 | - $old_record = new Meeting(); |
|
| 206 | - $old_record->retrieve($this->id); |
|
| 207 | - $old_assigned_user_id = $old_record->assigned_user_id; |
|
| 208 | - } |
|
| 209 | - if((empty($this->id) && isset($_REQUEST['assigned_user_id']) && !empty($_REQUEST['assigned_user_id']) && $GLOBALS['current_user']->id != $_REQUEST['assigned_user_id']) || (isset($old_assigned_user_id) && !empty($old_assigned_user_id) && isset($_REQUEST['assigned_user_id']) && !empty($_REQUEST['assigned_user_id']) && $old_assigned_user_id != $_REQUEST['assigned_user_id']) ){ |
|
| 210 | - $this->special_notification = true; |
|
| 211 | - $check_notify = true; |
|
| 202 | + $check_notify =(!empty($_REQUEST['send_invites']) && $_REQUEST['send_invites'] == '1') ? true : false; |
|
| 203 | + if(empty($_REQUEST['send_invites'])) { |
|
| 204 | + if(!empty($this->id)) { |
|
| 205 | + $old_record = new Meeting(); |
|
| 206 | + $old_record->retrieve($this->id); |
|
| 207 | + $old_assigned_user_id = $old_record->assigned_user_id; |
|
| 208 | + } |
|
| 209 | + if((empty($this->id) && isset($_REQUEST['assigned_user_id']) && !empty($_REQUEST['assigned_user_id']) && $GLOBALS['current_user']->id != $_REQUEST['assigned_user_id']) || (isset($old_assigned_user_id) && !empty($old_assigned_user_id) && isset($_REQUEST['assigned_user_id']) && !empty($_REQUEST['assigned_user_id']) && $old_assigned_user_id != $_REQUEST['assigned_user_id']) ){ |
|
| 210 | + $this->special_notification = true; |
|
| 211 | + $check_notify = true; |
|
| 212 | 212 | if(isset($_REQUEST['assigned_user_name'])) { |
| 213 | 213 | $this->new_assigned_user_name = $_REQUEST['assigned_user_name']; |
| 214 | 214 | } |
| 215 | - } |
|
| 216 | - } |
|
| 217 | - /*nsingh 7/3/08 commenting out as bug #20814 is invalid |
|
| 215 | + } |
|
| 216 | + } |
|
| 217 | + /*nsingh 7/3/08 commenting out as bug #20814 is invalid |
|
| 218 | 218 | if($current_user->getPreference('reminder_time')!= -1 && isset($_POST['reminder_checked']) && isset($_POST['reminder_time']) && $_POST['reminder_checked']==0 && $_POST['reminder_time']==-1){ |
| 219 | 219 | $this->reminder_checked = '1'; |
| 220 | 220 | $this->reminder_time = $current_user->getPreference('reminder_time'); |
| 221 | 221 | }*/ |
| 222 | 222 | |
| 223 | - // 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; |
|
| 223 | + // 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; |
|
| 226 | 226 | |
| 227 | 227 | if (empty($this->status) ) { |
| 228 | 228 | $this->status = $this->getDefaultStatus(); |
@@ -243,8 +243,8 @@ discard block |
||
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | if (empty($this->type)) { |
| 246 | - $this->type = 'Sugar'; |
|
| 247 | - } |
|
| 246 | + $this->type = 'Sugar'; |
|
| 247 | + } |
|
| 248 | 248 | |
| 249 | 249 | if ( isset($api) && is_a($api,'WebMeeting') && empty($this->in_relationship_update) ) { |
| 250 | 250 | // Make sure the API initialized and it supports Web Meetings |
@@ -272,175 +272,175 @@ discard block |
||
| 272 | 272 | $api->logoff(); |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | - $return_id = parent::save($check_notify); |
|
| 275 | + $return_id = parent::save($check_notify); |
|
| 276 | 276 | |
| 277 | - if($this->update_vcal) { |
|
| 278 | - vCal::cache_sugar_vcal($current_user); |
|
| 279 | - } |
|
| 277 | + if($this->update_vcal) { |
|
| 278 | + vCal::cache_sugar_vcal($current_user); |
|
| 279 | + } |
|
| 280 | 280 | |
| 281 | - if(isset($_REQUEST['reminders_data'])) { |
|
| 282 | - Reminder::saveRemindersDataJson('Meetings', $return_id, html_entity_decode($_REQUEST['reminders_data'])); |
|
| 283 | - } |
|
| 281 | + if(isset($_REQUEST['reminders_data'])) { |
|
| 282 | + Reminder::saveRemindersDataJson('Meetings', $return_id, html_entity_decode($_REQUEST['reminders_data'])); |
|
| 283 | + } |
|
| 284 | 284 | |
| 285 | 285 | |
| 286 | - return $return_id; |
|
| 287 | - } |
|
| 286 | + return $return_id; |
|
| 287 | + } |
|
| 288 | 288 | |
| 289 | - // this is for calendar |
|
| 290 | - function mark_deleted($id) { |
|
| 289 | + // this is for calendar |
|
| 290 | + function mark_deleted($id) { |
|
| 291 | 291 | |
| 292 | - require_once("modules/Calendar/CalendarUtils.php"); |
|
| 293 | - CalendarUtils::correctRecurrences($this, $id); |
|
| 292 | + require_once("modules/Calendar/CalendarUtils.php"); |
|
| 293 | + CalendarUtils::correctRecurrences($this, $id); |
|
| 294 | 294 | |
| 295 | - global $current_user; |
|
| 295 | + global $current_user; |
|
| 296 | 296 | |
| 297 | - parent::mark_deleted($id); |
|
| 297 | + parent::mark_deleted($id); |
|
| 298 | 298 | |
| 299 | - if($this->update_vcal) { |
|
| 300 | - vCal::cache_sugar_vcal($current_user); |
|
| 301 | - } |
|
| 302 | - } |
|
| 299 | + if($this->update_vcal) { |
|
| 300 | + vCal::cache_sugar_vcal($current_user); |
|
| 301 | + } |
|
| 302 | + } |
|
| 303 | 303 | |
| 304 | - function get_summary_text() { |
|
| 305 | - return "$this->name"; |
|
| 306 | - } |
|
| 304 | + function get_summary_text() { |
|
| 305 | + return "$this->name"; |
|
| 306 | + } |
|
| 307 | 307 | |
| 308 | 308 | function create_export_query($order_by, $where, $relate_link_join='') |
| 309 | 309 | { |
| 310 | 310 | $custom_join = $this->getCustomJoin(true, true, $where); |
| 311 | 311 | $custom_join['join'] .= $relate_link_join; |
| 312 | - $contact_required = stristr($where, "contacts"); |
|
| 312 | + $contact_required = stristr($where, "contacts"); |
|
| 313 | 313 | |
| 314 | - if($contact_required) { |
|
| 315 | - $query = "SELECT meetings.*, contacts.first_name, contacts.last_name, contacts.assigned_user_id contact_name_owner, users.user_name as assigned_user_name "; |
|
| 314 | + if($contact_required) { |
|
| 315 | + $query = "SELECT meetings.*, contacts.first_name, contacts.last_name, contacts.assigned_user_id contact_name_owner, users.user_name as assigned_user_name "; |
|
| 316 | 316 | $query .= $custom_join['select']; |
| 317 | - $query .= " FROM contacts, meetings, meetings_contacts "; |
|
| 318 | - $where_auto = " meetings_contacts.contact_id = contacts.id AND meetings_contacts.meeting_id = meetings.id AND meetings.deleted=0 AND contacts.deleted=0"; |
|
| 319 | - } else { |
|
| 320 | - $query = 'SELECT meetings.*, users.user_name as assigned_user_name '; |
|
| 317 | + $query .= " FROM contacts, meetings, meetings_contacts "; |
|
| 318 | + $where_auto = " meetings_contacts.contact_id = contacts.id AND meetings_contacts.meeting_id = meetings.id AND meetings.deleted=0 AND contacts.deleted=0"; |
|
| 319 | + } else { |
|
| 320 | + $query = 'SELECT meetings.*, users.user_name as assigned_user_name '; |
|
| 321 | 321 | $query .= $custom_join['select']; |
| 322 | - $query .= ' FROM meetings '; |
|
| 323 | - $where_auto = "meetings.deleted=0"; |
|
| 324 | - } |
|
| 325 | - $query .= " LEFT JOIN users ON meetings.assigned_user_id=users.id "; |
|
| 322 | + $query .= ' FROM meetings '; |
|
| 323 | + $where_auto = "meetings.deleted=0"; |
|
| 324 | + } |
|
| 325 | + $query .= " LEFT JOIN users ON meetings.assigned_user_id=users.id "; |
|
| 326 | 326 | |
| 327 | 327 | $query .= $custom_join['join']; |
| 328 | 328 | |
| 329 | - if($where != "") |
|
| 330 | - $query .= " where $where AND ".$where_auto; |
|
| 331 | - else |
|
| 332 | - $query .= " where ".$where_auto; |
|
| 329 | + if($where != "") |
|
| 330 | + $query .= " where $where AND ".$where_auto; |
|
| 331 | + else |
|
| 332 | + $query .= " where ".$where_auto; |
|
| 333 | 333 | |
| 334 | 334 | $order_by = $this->process_order_by($order_by); |
| 335 | 335 | if (!empty($order_by)) { |
| 336 | 336 | $query .= ' ORDER BY ' . $order_by; |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | - return $query; |
|
| 340 | - } |
|
| 341 | - |
|
| 342 | - |
|
| 343 | - |
|
| 344 | - function fill_in_additional_detail_fields() { |
|
| 345 | - global $locale; |
|
| 346 | - // Fill in the assigned_user_name |
|
| 347 | - $this->assigned_user_name = get_assigned_user_name($this->assigned_user_id); |
|
| 348 | - |
|
| 349 | - if (!empty($this->contact_id)) { |
|
| 350 | - $query = "SELECT first_name, last_name FROM contacts "; |
|
| 351 | - $query .= "WHERE id='$this->contact_id' AND deleted=0"; |
|
| 352 | - $result = $this->db->limitQuery($query,0,1,true," Error filling in additional detail fields: "); |
|
| 339 | + return $query; |
|
| 340 | + } |
|
| 353 | 341 | |
| 354 | - // Get the contact name. |
|
| 355 | - $row = $this->db->fetchByAssoc($result); |
|
| 356 | - $GLOBALS['log']->info("additional call fields $query"); |
|
| 357 | - if($row != null) |
|
| 358 | - { |
|
| 359 | - $this->contact_name = $locale->getLocaleFormattedName($row['first_name'], $row['last_name'], '', ''); |
|
| 360 | - $GLOBALS['log']->debug("Call($this->id): contact_name = $this->contact_name"); |
|
| 361 | - $GLOBALS['log']->debug("Call($this->id): contact_id = $this->contact_id"); |
|
| 362 | - } |
|
| 363 | - } |
|
| 364 | 342 | |
| 365 | 343 | |
| 344 | + function fill_in_additional_detail_fields() { |
|
| 345 | + global $locale; |
|
| 346 | + // Fill in the assigned_user_name |
|
| 347 | + $this->assigned_user_name = get_assigned_user_name($this->assigned_user_id); |
|
| 366 | 348 | |
| 367 | - $this->created_by_name = get_assigned_user_name($this->created_by); |
|
| 368 | - $this->modified_by_name = get_assigned_user_name($this->modified_user_id); |
|
| 369 | - $this->fill_in_additional_parent_fields(); |
|
| 349 | + if (!empty($this->contact_id)) { |
|
| 350 | + $query = "SELECT first_name, last_name FROM contacts "; |
|
| 351 | + $query .= "WHERE id='$this->contact_id' AND deleted=0"; |
|
| 352 | + $result = $this->db->limitQuery($query,0,1,true," Error filling in additional detail fields: "); |
|
| 370 | 353 | |
| 371 | - if (!isset($this->time_hour_start)) { |
|
| 372 | - $this->time_start_hour = intval(substr($this->time_start, 0, 2)); |
|
| 373 | - } //if-else |
|
| 354 | + // Get the contact name. |
|
| 355 | + $row = $this->db->fetchByAssoc($result); |
|
| 356 | + $GLOBALS['log']->info("additional call fields $query"); |
|
| 357 | + if($row != null) |
|
| 358 | + { |
|
| 359 | + $this->contact_name = $locale->getLocaleFormattedName($row['first_name'], $row['last_name'], '', ''); |
|
| 360 | + $GLOBALS['log']->debug("Call($this->id): contact_name = $this->contact_name"); |
|
| 361 | + $GLOBALS['log']->debug("Call($this->id): contact_id = $this->contact_id"); |
|
| 362 | + } |
|
| 363 | + } |
|
| 374 | 364 | |
| 375 | - if (isset($this->time_minute_start)) { |
|
| 376 | - $time_start_minutes = $this->time_minute_start; |
|
| 377 | - } else { |
|
| 378 | - $time_start_minutes = substr($this->time_start, 3, 5); |
|
| 379 | - if ($time_start_minutes > 0 && $time_start_minutes < 15) { |
|
| 380 | - $time_start_minutes = "15"; |
|
| 381 | - } else if ($time_start_minutes > 15 && $time_start_minutes < 30) { |
|
| 382 | - $time_start_minutes = "30"; |
|
| 383 | - } else if ($time_start_minutes > 30 && $time_start_minutes < 45) { |
|
| 384 | - $time_start_minutes = "45"; |
|
| 385 | - } else if ($time_start_minutes > 45) { |
|
| 386 | - $this->time_start_hour += 1; |
|
| 387 | - $time_start_minutes = "00"; |
|
| 388 | - } //if-else |
|
| 389 | - } //if-else |
|
| 390 | 365 | |
| 391 | 366 | |
| 392 | - if (isset($this->time_hour_start)) { |
|
| 393 | - $time_start_hour = $this->time_hour_start; |
|
| 394 | - } else { |
|
| 395 | - $time_start_hour = intval(substr($this->time_start, 0, 2)); |
|
| 396 | - } |
|
| 367 | + $this->created_by_name = get_assigned_user_name($this->created_by); |
|
| 368 | + $this->modified_by_name = get_assigned_user_name($this->modified_user_id); |
|
| 369 | + $this->fill_in_additional_parent_fields(); |
|
| 370 | + |
|
| 371 | + if (!isset($this->time_hour_start)) { |
|
| 372 | + $this->time_start_hour = intval(substr($this->time_start, 0, 2)); |
|
| 373 | + } //if-else |
|
| 374 | + |
|
| 375 | + if (isset($this->time_minute_start)) { |
|
| 376 | + $time_start_minutes = $this->time_minute_start; |
|
| 377 | + } else { |
|
| 378 | + $time_start_minutes = substr($this->time_start, 3, 5); |
|
| 379 | + if ($time_start_minutes > 0 && $time_start_minutes < 15) { |
|
| 380 | + $time_start_minutes = "15"; |
|
| 381 | + } else if ($time_start_minutes > 15 && $time_start_minutes < 30) { |
|
| 382 | + $time_start_minutes = "30"; |
|
| 383 | + } else if ($time_start_minutes > 30 && $time_start_minutes < 45) { |
|
| 384 | + $time_start_minutes = "45"; |
|
| 385 | + } else if ($time_start_minutes > 45) { |
|
| 386 | + $this->time_start_hour += 1; |
|
| 387 | + $time_start_minutes = "00"; |
|
| 388 | + } //if-else |
|
| 389 | + } //if-else |
|
| 390 | + |
|
| 391 | + |
|
| 392 | + if (isset($this->time_hour_start)) { |
|
| 393 | + $time_start_hour = $this->time_hour_start; |
|
| 394 | + } else { |
|
| 395 | + $time_start_hour = intval(substr($this->time_start, 0, 2)); |
|
| 396 | + } |
|
| 397 | 397 | |
| 398 | - global $timedate; |
|
| 398 | + global $timedate; |
|
| 399 | 399 | $this->time_meridiem = $timedate->AMPMMenu('', $this->time_start, 'onchange="SugarWidgetScheduler.update_time();"'); |
| 400 | - $hours_arr = array (); |
|
| 401 | - $num_of_hours = 13; |
|
| 402 | - $start_at = 1; |
|
| 403 | - |
|
| 404 | - if (empty ($time_meridiem)) { |
|
| 405 | - $num_of_hours = 24; |
|
| 406 | - $start_at = 0; |
|
| 407 | - } //if |
|
| 408 | - |
|
| 409 | - for ($i = $start_at; $i < $num_of_hours; $i ++) { |
|
| 410 | - $i = $i.""; |
|
| 411 | - if (strlen($i) == 1) { |
|
| 412 | - $i = "0".$i; |
|
| 413 | - } |
|
| 414 | - $hours_arr[$i] = $i; |
|
| 415 | - } //for |
|
| 400 | + $hours_arr = array (); |
|
| 401 | + $num_of_hours = 13; |
|
| 402 | + $start_at = 1; |
|
| 403 | + |
|
| 404 | + if (empty ($time_meridiem)) { |
|
| 405 | + $num_of_hours = 24; |
|
| 406 | + $start_at = 0; |
|
| 407 | + } //if |
|
| 408 | + |
|
| 409 | + for ($i = $start_at; $i < $num_of_hours; $i ++) { |
|
| 410 | + $i = $i.""; |
|
| 411 | + if (strlen($i) == 1) { |
|
| 412 | + $i = "0".$i; |
|
| 413 | + } |
|
| 414 | + $hours_arr[$i] = $i; |
|
| 415 | + } //for |
|
| 416 | 416 | |
| 417 | 417 | if (!isset($this->duration_minutes)) { |
| 418 | - $this->duration_minutes = $this->minutes_value_default; |
|
| 419 | - } |
|
| 418 | + $this->duration_minutes = $this->minutes_value_default; |
|
| 419 | + } |
|
| 420 | 420 | |
| 421 | 421 | //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); |
|
| 426 | - if (is_null($this->duration_hours)) { |
|
| 427 | - $this->duration_hours = "0"; |
|
| 428 | - } |
|
| 429 | - if (is_null($this->duration_minutes)) |
|
| 430 | - $this->duration_minutes = "1"; |
|
| 431 | - |
|
| 432 | - if(empty($this->id) && !empty($_REQUEST['date_start'])){ |
|
| 433 | - $this->date_start = $_REQUEST['date_start']; |
|
| 434 | - } |
|
| 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); |
|
| 426 | + if (is_null($this->duration_hours)) { |
|
| 427 | + $this->duration_hours = "0"; |
|
| 428 | + } |
|
| 429 | + if (is_null($this->duration_minutes)) |
|
| 430 | + $this->duration_minutes = "1"; |
|
| 431 | + |
|
| 432 | + if(empty($this->id) && !empty($_REQUEST['date_start'])){ |
|
| 433 | + $this->date_start = $_REQUEST['date_start']; |
|
| 434 | + } |
|
| 435 | 435 | if(!empty($this->date_start)) |
| 436 | 436 | { |
| 437 | 437 | $td = SugarDateTime::createFromFormat($GLOBALS['timedate']->get_date_time_format(),$this->date_start); |
| 438 | 438 | if (!empty($td)) |
| 439 | 439 | { |
| 440 | - if (!empty($this->duration_hours) && $this->duration_hours != '') |
|
| 440 | + if (!empty($this->duration_hours) && $this->duration_hours != '') |
|
| 441 | 441 | { |
| 442 | - $td = $td->modify("+{$this->duration_hours} hours"); |
|
| 443 | - } |
|
| 442 | + $td = $td->modify("+{$this->duration_hours} hours"); |
|
| 443 | + } |
|
| 444 | 444 | if (!empty($this->duration_minutes) && $this->duration_minutes != '') |
| 445 | 445 | { |
| 446 | 446 | $td = $td->modify("+{$this->duration_minutes} mins"); |
@@ -451,77 +451,77 @@ discard block |
||
| 451 | 451 | { |
| 452 | 452 | $GLOBALS['log']->fatal("Meeting::save: Bad date {$this->date_start} for format ".$GLOBALS['timedate']->get_date_time_format()); |
| 453 | 453 | } |
| 454 | - } |
|
| 455 | - |
|
| 456 | - global $app_list_strings; |
|
| 457 | - $parent_types = $app_list_strings['record_type_display']; |
|
| 458 | - $disabled_parent_types = ACLController::disabledModuleList($parent_types,false, 'list'); |
|
| 459 | - foreach($disabled_parent_types as $disabled_parent_type){ |
|
| 460 | - if($disabled_parent_type != $this->parent_type){ |
|
| 461 | - unset($parent_types[$disabled_parent_type]); |
|
| 462 | - } |
|
| 463 | - } |
|
| 464 | - |
|
| 465 | - $this->parent_type_options = get_select_options_with_id($parent_types, $this->parent_type); |
|
| 466 | - if (empty($this->reminder_time)) { |
|
| 467 | - $this->reminder_time = -1; |
|
| 468 | - } |
|
| 469 | - |
|
| 470 | - if ( empty($this->id) ) { |
|
| 471 | - $reminder_t = $GLOBALS['current_user']->getPreference('reminder_time'); |
|
| 472 | - if ( isset($reminder_t) ) |
|
| 473 | - $this->reminder_time = $reminder_t; |
|
| 474 | - } |
|
| 475 | - $this->reminder_checked = $this->reminder_time == -1 ? false : true; |
|
| 476 | - |
|
| 477 | - if (empty($this->email_reminder_time)) { |
|
| 478 | - $this->email_reminder_time = -1; |
|
| 479 | - } |
|
| 480 | - if(empty($this->id)){ |
|
| 481 | - $reminder_t = $GLOBALS['current_user']->getPreference('email_reminder_time'); |
|
| 482 | - if(isset($reminder_t)) |
|
| 483 | - $this->email_reminder_time = $reminder_t; |
|
| 484 | - } |
|
| 485 | - $this->email_reminder_checked = $this->email_reminder_time == -1 ? false : true; |
|
| 486 | - |
|
| 487 | - if (isset ($_REQUEST['parent_type']) && empty($this->parent_type)) { |
|
| 488 | - $this->parent_type = $_REQUEST['parent_type']; |
|
| 489 | - } elseif (is_null($this->parent_type)) { |
|
| 490 | - $this->parent_type = $app_list_strings['record_type_default_key']; |
|
| 491 | - } |
|
| 492 | - |
|
| 493 | - } |
|
| 494 | - |
|
| 495 | - function get_list_view_data() { |
|
| 496 | - $meeting_fields = $this->get_list_view_array(); |
|
| 497 | - |
|
| 498 | - global $app_list_strings, $focus, $action, $currentModule; |
|
| 499 | - if(isset($this->parent_type)) |
|
| 500 | - $meeting_fields['PARENT_MODULE'] = $this->parent_type; |
|
| 501 | - if($this->status == "Planned") { |
|
| 502 | - //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"; |
|
| 454 | + } |
|
| 455 | + |
|
| 456 | + global $app_list_strings; |
|
| 457 | + $parent_types = $app_list_strings['record_type_display']; |
|
| 458 | + $disabled_parent_types = ACLController::disabledModuleList($parent_types,false, 'list'); |
|
| 459 | + foreach($disabled_parent_types as $disabled_parent_type){ |
|
| 460 | + if($disabled_parent_type != $this->parent_type){ |
|
| 461 | + unset($parent_types[$disabled_parent_type]); |
|
| 462 | + } |
|
| 463 | + } |
|
| 464 | + |
|
| 465 | + $this->parent_type_options = get_select_options_with_id($parent_types, $this->parent_type); |
|
| 466 | + if (empty($this->reminder_time)) { |
|
| 467 | + $this->reminder_time = -1; |
|
| 468 | + } |
|
| 469 | + |
|
| 470 | + if ( empty($this->id) ) { |
|
| 471 | + $reminder_t = $GLOBALS['current_user']->getPreference('reminder_time'); |
|
| 472 | + if ( isset($reminder_t) ) |
|
| 473 | + $this->reminder_time = $reminder_t; |
|
| 474 | + } |
|
| 475 | + $this->reminder_checked = $this->reminder_time == -1 ? false : true; |
|
| 476 | + |
|
| 477 | + if (empty($this->email_reminder_time)) { |
|
| 478 | + $this->email_reminder_time = -1; |
|
| 479 | + } |
|
| 480 | + if(empty($this->id)){ |
|
| 481 | + $reminder_t = $GLOBALS['current_user']->getPreference('email_reminder_time'); |
|
| 482 | + if(isset($reminder_t)) |
|
| 483 | + $this->email_reminder_time = $reminder_t; |
|
| 484 | + } |
|
| 485 | + $this->email_reminder_checked = $this->email_reminder_time == -1 ? false : true; |
|
| 486 | + |
|
| 487 | + if (isset ($_REQUEST['parent_type']) && empty($this->parent_type)) { |
|
| 488 | + $this->parent_type = $_REQUEST['parent_type']; |
|
| 489 | + } elseif (is_null($this->parent_type)) { |
|
| 490 | + $this->parent_type = $app_list_strings['record_type_default_key']; |
|
| 491 | + } |
|
| 492 | + |
|
| 493 | + } |
|
| 494 | + |
|
| 495 | + function get_list_view_data() { |
|
| 496 | + $meeting_fields = $this->get_list_view_array(); |
|
| 497 | + |
|
| 498 | + global $app_list_strings, $focus, $action, $currentModule; |
|
| 499 | + if(isset($this->parent_type)) |
|
| 500 | + $meeting_fields['PARENT_MODULE'] = $this->parent_type; |
|
| 501 | + if($this->status == "Planned") { |
|
| 502 | + //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"; |
|
| 505 | 505 | $setCompleteUrl = "<a id='{$this->id}' onclick='SUGAR.util.closeActivityPanel.show(\"{$this->module_dir}\",\"{$this->id}\",\"Held\",\"listview\",\"1\");'>"; |
| 506 | - if ($this->ACLAccess('edit')) { |
|
| 506 | + if ($this->ACLAccess('edit')) { |
|
| 507 | 507 | $meeting_fields['SET_COMPLETE'] = $setCompleteUrl . SugarThemeRegistry::current()->getImage("close_inline"," border='0'",null,null,'.gif',translate('LBL_CLOSEINLINE'))."</a>"; |
| 508 | 508 | } else { |
| 509 | 509 | $meeting_fields['SET_COMPLETE'] = ''; |
| 510 | 510 | } |
| 511 | - } |
|
| 512 | - global $timedate; |
|
| 513 | - $today = $timedate->nowDb(); |
|
| 514 | - $nextday = $timedate->asDbDate($timedate->getNow()->get("+1 day")); |
|
| 515 | - $mergeTime = $meeting_fields['DATE_START']; //$timedate->merge_date_time($meeting_fields['DATE_START'], $meeting_fields['TIME_START']); |
|
| 516 | - $date_db = $timedate->to_db($mergeTime); |
|
| 517 | - if($date_db < $today ) { |
|
| 518 | - $meeting_fields['DATE_START']= "<font class='overdueTask'>".$meeting_fields['DATE_START']."</font>"; |
|
| 519 | - }else if($date_db < $nextday) { |
|
| 520 | - $meeting_fields['DATE_START'] = "<font class='todaysTask'>".$meeting_fields['DATE_START']."</font>"; |
|
| 521 | - } else { |
|
| 522 | - $meeting_fields['DATE_START'] = "<font class='futureTask'>".$meeting_fields['DATE_START']."</font>"; |
|
| 523 | - } |
|
| 524 | - $this->fill_in_additional_detail_fields(); |
|
| 511 | + } |
|
| 512 | + global $timedate; |
|
| 513 | + $today = $timedate->nowDb(); |
|
| 514 | + $nextday = $timedate->asDbDate($timedate->getNow()->get("+1 day")); |
|
| 515 | + $mergeTime = $meeting_fields['DATE_START']; //$timedate->merge_date_time($meeting_fields['DATE_START'], $meeting_fields['TIME_START']); |
|
| 516 | + $date_db = $timedate->to_db($mergeTime); |
|
| 517 | + if($date_db < $today ) { |
|
| 518 | + $meeting_fields['DATE_START']= "<font class='overdueTask'>".$meeting_fields['DATE_START']."</font>"; |
|
| 519 | + }else if($date_db < $nextday) { |
|
| 520 | + $meeting_fields['DATE_START'] = "<font class='todaysTask'>".$meeting_fields['DATE_START']."</font>"; |
|
| 521 | + } else { |
|
| 522 | + $meeting_fields['DATE_START'] = "<font class='futureTask'>".$meeting_fields['DATE_START']."</font>"; |
|
| 523 | + } |
|
| 524 | + $this->fill_in_additional_detail_fields(); |
|
| 525 | 525 | |
| 526 | 526 | // make sure we grab the localized version of the contact name, if a contact is provided |
| 527 | 527 | if (!empty($this->contact_id)) |
@@ -537,342 +537,342 @@ discard block |
||
| 537 | 537 | |
| 538 | 538 | $meeting_fields['CONTACT_ID'] = $this->contact_id; |
| 539 | 539 | $meeting_fields['CONTACT_NAME'] = $this->contact_name; |
| 540 | - $meeting_fields['PARENT_NAME'] = $this->parent_name; |
|
| 540 | + $meeting_fields['PARENT_NAME'] = $this->parent_name; |
|
| 541 | 541 | $meeting_fields['REMINDER_CHECKED'] = $this->reminder_time==-1 ? false : true; |
| 542 | 542 | $meeting_fields['EMAIL_REMINDER_CHECKED'] = $this->email_reminder_time==-1 ? false : true; |
| 543 | 543 | |
| 544 | 544 | |
| 545 | - return $meeting_fields; |
|
| 546 | - } |
|
| 547 | - |
|
| 548 | - function set_notification_body($xtpl, &$meeting) { |
|
| 549 | - global $sugar_config; |
|
| 550 | - global $app_list_strings; |
|
| 551 | - global $current_user; |
|
| 552 | - global $timedate; |
|
| 553 | - |
|
| 554 | - |
|
| 555 | - // cn: bug 9494 - passing a contact breaks this call |
|
| 556 | - $notifyUser =($meeting->current_notify_user->object_name == 'User') ? $meeting->current_notify_user : $current_user; |
|
| 557 | - // cn: bug 8078 - fixed call to $timedate |
|
| 558 | - if(strtolower(get_class($meeting->current_notify_user)) == 'contact') { |
|
| 559 | - $xtpl->assign("ACCEPT_URL", $sugar_config['site_url']. |
|
| 560 | - '/index.php?entryPoint=acceptDecline&module=Meetings&contact_id='.$meeting->current_notify_user->id.'&record='.$meeting->id); |
|
| 561 | - } elseif(strtolower(get_class($meeting->current_notify_user)) == 'lead') { |
|
| 562 | - $xtpl->assign("ACCEPT_URL", $sugar_config['site_url']. |
|
| 563 | - '/index.php?entryPoint=acceptDecline&module=Meetings&lead_id='.$meeting->current_notify_user->id.'&record='.$meeting->id); |
|
| 564 | - } else { |
|
| 565 | - $xtpl->assign("ACCEPT_URL", $sugar_config['site_url']. |
|
| 566 | - '/index.php?entryPoint=acceptDecline&module=Meetings&user_id='.$meeting->current_notify_user->id.'&record='.$meeting->id); |
|
| 567 | - } |
|
| 568 | - $xtpl->assign("MEETING_TO", $meeting->current_notify_user->new_assigned_user_name); |
|
| 569 | - $xtpl->assign("MEETING_SUBJECT", trim($meeting->name)); |
|
| 570 | - $xtpl->assign("MEETING_STATUS",(isset($meeting->status)? $app_list_strings['meeting_status_dom'][$meeting->status]:"")); |
|
| 571 | - $typekey = strtolower($meeting->type); |
|
| 572 | - if(isset($meeting->type)) { |
|
| 573 | - if(!empty($app_list_strings['eapm_list'][$typekey])) { |
|
| 574 | - $typestring = $app_list_strings['eapm_list'][$typekey]; |
|
| 575 | - } else { |
|
| 576 | - $typestring = $app_list_strings['meeting_type_dom'][$meeting->type]; |
|
| 577 | - } |
|
| 578 | - } |
|
| 579 | - $xtpl->assign("MEETING_TYPE", isset($meeting->type)? $typestring:""); |
|
| 580 | - $startdate = $timedate->fromDb($meeting->date_start); |
|
| 581 | - $xtpl->assign("MEETING_STARTDATE", $timedate->asUser($startdate, $notifyUser)." ".TimeDate::userTimezoneSuffix($startdate, $notifyUser)); |
|
| 582 | - $enddate = $timedate->fromDb($meeting->date_end); |
|
| 583 | - $xtpl->assign("MEETING_ENDDATE", $timedate->asUser($enddate, $notifyUser)." ".TimeDate::userTimezoneSuffix($enddate, $notifyUser)); |
|
| 584 | - $xtpl->assign("MEETING_HOURS", $meeting->duration_hours); |
|
| 585 | - $xtpl->assign("MEETING_MINUTES", $meeting->duration_minutes); |
|
| 586 | - $xtpl->assign("MEETING_DESCRIPTION", $meeting->description); |
|
| 545 | + return $meeting_fields; |
|
| 546 | + } |
|
| 547 | + |
|
| 548 | + function set_notification_body($xtpl, &$meeting) { |
|
| 549 | + global $sugar_config; |
|
| 550 | + global $app_list_strings; |
|
| 551 | + global $current_user; |
|
| 552 | + global $timedate; |
|
| 553 | + |
|
| 554 | + |
|
| 555 | + // cn: bug 9494 - passing a contact breaks this call |
|
| 556 | + $notifyUser =($meeting->current_notify_user->object_name == 'User') ? $meeting->current_notify_user : $current_user; |
|
| 557 | + // cn: bug 8078 - fixed call to $timedate |
|
| 558 | + if(strtolower(get_class($meeting->current_notify_user)) == 'contact') { |
|
| 559 | + $xtpl->assign("ACCEPT_URL", $sugar_config['site_url']. |
|
| 560 | + '/index.php?entryPoint=acceptDecline&module=Meetings&contact_id='.$meeting->current_notify_user->id.'&record='.$meeting->id); |
|
| 561 | + } elseif(strtolower(get_class($meeting->current_notify_user)) == 'lead') { |
|
| 562 | + $xtpl->assign("ACCEPT_URL", $sugar_config['site_url']. |
|
| 563 | + '/index.php?entryPoint=acceptDecline&module=Meetings&lead_id='.$meeting->current_notify_user->id.'&record='.$meeting->id); |
|
| 564 | + } else { |
|
| 565 | + $xtpl->assign("ACCEPT_URL", $sugar_config['site_url']. |
|
| 566 | + '/index.php?entryPoint=acceptDecline&module=Meetings&user_id='.$meeting->current_notify_user->id.'&record='.$meeting->id); |
|
| 567 | + } |
|
| 568 | + $xtpl->assign("MEETING_TO", $meeting->current_notify_user->new_assigned_user_name); |
|
| 569 | + $xtpl->assign("MEETING_SUBJECT", trim($meeting->name)); |
|
| 570 | + $xtpl->assign("MEETING_STATUS",(isset($meeting->status)? $app_list_strings['meeting_status_dom'][$meeting->status]:"")); |
|
| 571 | + $typekey = strtolower($meeting->type); |
|
| 572 | + if(isset($meeting->type)) { |
|
| 573 | + if(!empty($app_list_strings['eapm_list'][$typekey])) { |
|
| 574 | + $typestring = $app_list_strings['eapm_list'][$typekey]; |
|
| 575 | + } else { |
|
| 576 | + $typestring = $app_list_strings['meeting_type_dom'][$meeting->type]; |
|
| 577 | + } |
|
| 578 | + } |
|
| 579 | + $xtpl->assign("MEETING_TYPE", isset($meeting->type)? $typestring:""); |
|
| 580 | + $startdate = $timedate->fromDb($meeting->date_start); |
|
| 581 | + $xtpl->assign("MEETING_STARTDATE", $timedate->asUser($startdate, $notifyUser)." ".TimeDate::userTimezoneSuffix($startdate, $notifyUser)); |
|
| 582 | + $enddate = $timedate->fromDb($meeting->date_end); |
|
| 583 | + $xtpl->assign("MEETING_ENDDATE", $timedate->asUser($enddate, $notifyUser)." ".TimeDate::userTimezoneSuffix($enddate, $notifyUser)); |
|
| 584 | + $xtpl->assign("MEETING_HOURS", $meeting->duration_hours); |
|
| 585 | + $xtpl->assign("MEETING_MINUTES", $meeting->duration_minutes); |
|
| 586 | + $xtpl->assign("MEETING_DESCRIPTION", $meeting->description); |
|
| 587 | 587 | if ( !empty($meeting->join_url) ) { |
| 588 | 588 | $xtpl->assign('MEETING_URL', $meeting->join_url); |
| 589 | 589 | $xtpl->parse('Meeting.Meeting_External_API'); |
| 590 | 590 | } |
| 591 | 591 | |
| 592 | - return $xtpl; |
|
| 593 | - } |
|
| 592 | + return $xtpl; |
|
| 593 | + } |
|
| 594 | 594 | |
| 595 | - /** |
|
| 596 | - * Redefine method to attach ics file to notification email |
|
| 597 | - */ |
|
| 598 | - public function create_notification_email($notify_user){ |
|
| 595 | + /** |
|
| 596 | + * Redefine method to attach ics file to notification email |
|
| 597 | + */ |
|
| 598 | + public function create_notification_email($notify_user){ |
|
| 599 | 599 | // reset acceptance status for non organizer if date is changed |
| 600 | 600 | if (($notify_user->id != $GLOBALS['current_user']->id) && $this->date_changed) { |
| 601 | 601 | $this->set_accept_status($notify_user, 'none'); |
| 602 | 602 | } |
| 603 | 603 | |
| 604 | - $notify_mail = parent::create_notification_email($notify_user); |
|
| 605 | - |
|
| 606 | - $path = SugarConfig::getInstance()->get('upload_dir','upload/') . $this->id; |
|
| 607 | - |
|
| 608 | - require_once("modules/vCals/vCal.php"); |
|
| 609 | - $content = vCal::get_ical_event($this, $GLOBALS['current_user']); |
|
| 610 | - |
|
| 611 | - if(file_put_contents($path,$content)){ |
|
| 612 | - $notify_mail->AddAttachment($path, 'meeting.ics', 'base64', 'text/calendar'); |
|
| 613 | - } |
|
| 614 | - return $notify_mail; |
|
| 615 | - } |
|
| 616 | - |
|
| 617 | - /** |
|
| 618 | - * Redefine method to remove ics after email is sent |
|
| 619 | - */ |
|
| 620 | - public function send_assignment_notifications($notify_user, $admin){ |
|
| 621 | - parent::send_assignment_notifications($notify_user, $admin); |
|
| 622 | - |
|
| 623 | - $path = SugarConfig::getInstance()->get('upload_dir','upload/') . $this->id; |
|
| 624 | - unlink($path); |
|
| 625 | - } |
|
| 626 | - |
|
| 627 | - function get_meeting_users() { |
|
| 628 | - $template = new User(); |
|
| 629 | - // First, get the list of IDs. |
|
| 630 | - $query = "SELECT meetings_users.required, meetings_users.accept_status, meetings_users.user_id from meetings_users where meetings_users.meeting_id='$this->id' AND meetings_users.deleted=0"; |
|
| 631 | - $GLOBALS['log']->debug("Finding linked records $this->object_name: ".$query); |
|
| 632 | - $result = $this->db->query($query, true); |
|
| 633 | - $list = Array(); |
|
| 634 | - |
|
| 635 | - while($row = $this->db->fetchByAssoc($result)) { |
|
| 636 | - $template = new User(); // PHP 5 will retrieve by reference, always over-writing the "old" one |
|
| 637 | - $record = $template->retrieve($row['user_id']); |
|
| 638 | - $template->required = $row['required']; |
|
| 639 | - $template->accept_status = $row['accept_status']; |
|
| 640 | - |
|
| 641 | - if($record != null) { |
|
| 642 | - // this copies the object into the array |
|
| 643 | - $list[] = $template; |
|
| 644 | - } |
|
| 645 | - } |
|
| 646 | - return $list; |
|
| 647 | - } |
|
| 648 | - |
|
| 649 | - function get_invite_meetings(&$user) { |
|
| 650 | - $template = $this; |
|
| 651 | - // First, get the list of IDs. |
|
| 652 | - $GLOBALS['log']->debug("Finding linked records $this->object_name: ".$query); |
|
| 653 | - $query = "SELECT meetings_users.required, meetings_users.accept_status, meetings_users.meeting_id from meetings_users where meetings_users.user_id='$user->id' AND( meetings_users.accept_status IS NULL OR meetings_users.accept_status='none') AND meetings_users.deleted=0"; |
|
| 654 | - $result = $this->db->query($query, true); |
|
| 655 | - $list = Array(); |
|
| 656 | - |
|
| 657 | - while($row = $this->db->fetchByAssoc($result)) { |
|
| 658 | - $record = $template->retrieve($row['meeting_id']); |
|
| 659 | - $template->required = $row['required']; |
|
| 660 | - $template->accept_status = $row['accept_status']; |
|
| 661 | - |
|
| 662 | - |
|
| 663 | - if($record != null) |
|
| 664 | - { |
|
| 665 | - // this copies the object into the array |
|
| 666 | - $list[] = $template; |
|
| 667 | - } |
|
| 668 | - } |
|
| 669 | - return $list; |
|
| 670 | - } |
|
| 671 | - |
|
| 672 | - |
|
| 673 | - function set_accept_status(&$user,$status) |
|
| 674 | - { |
|
| 675 | - if($user->object_name == 'User') |
|
| 676 | - { |
|
| 677 | - $relate_values = array('user_id'=>$user->id,'meeting_id'=>$this->id); |
|
| 678 | - $data_values = array('accept_status'=>$status); |
|
| 679 | - $this->set_relationship($this->rel_users_table, $relate_values, true, true,$data_values); |
|
| 680 | - global $current_user; |
|
| 681 | - |
|
| 682 | - if($this->update_vcal) |
|
| 683 | - { |
|
| 684 | - vCal::cache_sugar_vcal($user); |
|
| 685 | - } |
|
| 686 | - } |
|
| 687 | - else if($user->object_name == 'Contact') |
|
| 688 | - { |
|
| 689 | - $relate_values = array('contact_id'=>$user->id,'meeting_id'=>$this->id); |
|
| 690 | - $data_values = array('accept_status'=>$status); |
|
| 691 | - $this->set_relationship($this->rel_contacts_table, $relate_values, true, true,$data_values); |
|
| 692 | - } |
|
| 604 | + $notify_mail = parent::create_notification_email($notify_user); |
|
| 605 | + |
|
| 606 | + $path = SugarConfig::getInstance()->get('upload_dir','upload/') . $this->id; |
|
| 607 | + |
|
| 608 | + require_once("modules/vCals/vCal.php"); |
|
| 609 | + $content = vCal::get_ical_event($this, $GLOBALS['current_user']); |
|
| 610 | + |
|
| 611 | + if(file_put_contents($path,$content)){ |
|
| 612 | + $notify_mail->AddAttachment($path, 'meeting.ics', 'base64', 'text/calendar'); |
|
| 613 | + } |
|
| 614 | + return $notify_mail; |
|
| 615 | + } |
|
| 616 | + |
|
| 617 | + /** |
|
| 618 | + * Redefine method to remove ics after email is sent |
|
| 619 | + */ |
|
| 620 | + public function send_assignment_notifications($notify_user, $admin){ |
|
| 621 | + parent::send_assignment_notifications($notify_user, $admin); |
|
| 622 | + |
|
| 623 | + $path = SugarConfig::getInstance()->get('upload_dir','upload/') . $this->id; |
|
| 624 | + unlink($path); |
|
| 625 | + } |
|
| 626 | + |
|
| 627 | + function get_meeting_users() { |
|
| 628 | + $template = new User(); |
|
| 629 | + // First, get the list of IDs. |
|
| 630 | + $query = "SELECT meetings_users.required, meetings_users.accept_status, meetings_users.user_id from meetings_users where meetings_users.meeting_id='$this->id' AND meetings_users.deleted=0"; |
|
| 631 | + $GLOBALS['log']->debug("Finding linked records $this->object_name: ".$query); |
|
| 632 | + $result = $this->db->query($query, true); |
|
| 633 | + $list = Array(); |
|
| 634 | + |
|
| 635 | + while($row = $this->db->fetchByAssoc($result)) { |
|
| 636 | + $template = new User(); // PHP 5 will retrieve by reference, always over-writing the "old" one |
|
| 637 | + $record = $template->retrieve($row['user_id']); |
|
| 638 | + $template->required = $row['required']; |
|
| 639 | + $template->accept_status = $row['accept_status']; |
|
| 640 | + |
|
| 641 | + if($record != null) { |
|
| 642 | + // this copies the object into the array |
|
| 643 | + $list[] = $template; |
|
| 644 | + } |
|
| 645 | + } |
|
| 646 | + return $list; |
|
| 647 | + } |
|
| 648 | + |
|
| 649 | + function get_invite_meetings(&$user) { |
|
| 650 | + $template = $this; |
|
| 651 | + // First, get the list of IDs. |
|
| 652 | + $GLOBALS['log']->debug("Finding linked records $this->object_name: ".$query); |
|
| 653 | + $query = "SELECT meetings_users.required, meetings_users.accept_status, meetings_users.meeting_id from meetings_users where meetings_users.user_id='$user->id' AND( meetings_users.accept_status IS NULL OR meetings_users.accept_status='none') AND meetings_users.deleted=0"; |
|
| 654 | + $result = $this->db->query($query, true); |
|
| 655 | + $list = Array(); |
|
| 656 | + |
|
| 657 | + while($row = $this->db->fetchByAssoc($result)) { |
|
| 658 | + $record = $template->retrieve($row['meeting_id']); |
|
| 659 | + $template->required = $row['required']; |
|
| 660 | + $template->accept_status = $row['accept_status']; |
|
| 661 | + |
|
| 662 | + |
|
| 663 | + if($record != null) |
|
| 664 | + { |
|
| 665 | + // this copies the object into the array |
|
| 666 | + $list[] = $template; |
|
| 667 | + } |
|
| 668 | + } |
|
| 669 | + return $list; |
|
| 670 | + } |
|
| 671 | + |
|
| 672 | + |
|
| 673 | + function set_accept_status(&$user,$status) |
|
| 674 | + { |
|
| 675 | + if($user->object_name == 'User') |
|
| 676 | + { |
|
| 677 | + $relate_values = array('user_id'=>$user->id,'meeting_id'=>$this->id); |
|
| 678 | + $data_values = array('accept_status'=>$status); |
|
| 679 | + $this->set_relationship($this->rel_users_table, $relate_values, true, true,$data_values); |
|
| 680 | + global $current_user; |
|
| 681 | + |
|
| 682 | + if($this->update_vcal) |
|
| 683 | + { |
|
| 684 | + vCal::cache_sugar_vcal($user); |
|
| 685 | + } |
|
| 686 | + } |
|
| 687 | + else if($user->object_name == 'Contact') |
|
| 688 | + { |
|
| 689 | + $relate_values = array('contact_id'=>$user->id,'meeting_id'=>$this->id); |
|
| 690 | + $data_values = array('accept_status'=>$status); |
|
| 691 | + $this->set_relationship($this->rel_contacts_table, $relate_values, true, true,$data_values); |
|
| 692 | + } |
|
| 693 | 693 | else if($user->object_name == 'Lead') |
| 694 | - { |
|
| 695 | - $relate_values = array('lead_id'=>$user->id,'meeting_id'=>$this->id); |
|
| 696 | - $data_values = array('accept_status'=>$status); |
|
| 697 | - $this->set_relationship($this->rel_leads_table, $relate_values, true, true,$data_values); |
|
| 698 | - } |
|
| 699 | - } |
|
| 694 | + { |
|
| 695 | + $relate_values = array('lead_id'=>$user->id,'meeting_id'=>$this->id); |
|
| 696 | + $data_values = array('accept_status'=>$status); |
|
| 697 | + $this->set_relationship($this->rel_leads_table, $relate_values, true, true,$data_values); |
|
| 698 | + } |
|
| 699 | + } |
|
| 700 | 700 | |
| 701 | 701 | |
| 702 | - function get_notification_recipients() { |
|
| 703 | - if($this->special_notification) { |
|
| 704 | - return parent::get_notification_recipients(); |
|
| 705 | - } |
|
| 702 | + function get_notification_recipients() { |
|
| 703 | + if($this->special_notification) { |
|
| 704 | + return parent::get_notification_recipients(); |
|
| 705 | + } |
|
| 706 | 706 | |
| 707 | - $list = array(); |
|
| 708 | - if(!is_array($this->contacts_arr)) { |
|
| 709 | - $this->contacts_arr = array(); |
|
| 710 | - } |
|
| 707 | + $list = array(); |
|
| 708 | + if(!is_array($this->contacts_arr)) { |
|
| 709 | + $this->contacts_arr = array(); |
|
| 710 | + } |
|
| 711 | 711 | |
| 712 | - if(!is_array($this->users_arr)) { |
|
| 713 | - $this->users_arr = array(); |
|
| 714 | - } |
|
| 712 | + if(!is_array($this->users_arr)) { |
|
| 713 | + $this->users_arr = array(); |
|
| 714 | + } |
|
| 715 | 715 | |
| 716 | 716 | if(!is_array($this->leads_arr)) { |
| 717 | - $this->leads_arr = array(); |
|
| 718 | - } |
|
| 719 | - |
|
| 720 | - foreach($this->users_arr as $user_id) { |
|
| 721 | - $notify_user = new User(); |
|
| 722 | - $notify_user->retrieve($user_id); |
|
| 723 | - $notify_user->new_assigned_user_name = $notify_user->full_name; |
|
| 724 | - $GLOBALS['log']->info("Notifications: recipient is $notify_user->new_assigned_user_name"); |
|
| 725 | - $list[$notify_user->id] = $notify_user; |
|
| 726 | - } |
|
| 727 | - |
|
| 728 | - foreach($this->contacts_arr as $contact_id) { |
|
| 729 | - $notify_user = new Contact(); |
|
| 730 | - $notify_user->retrieve($contact_id); |
|
| 731 | - $notify_user->new_assigned_user_name = $notify_user->full_name; |
|
| 732 | - $GLOBALS['log']->info("Notifications: recipient is $notify_user->new_assigned_user_name"); |
|
| 733 | - $list[$notify_user->id] = $notify_user; |
|
| 734 | - } |
|
| 717 | + $this->leads_arr = array(); |
|
| 718 | + } |
|
| 719 | + |
|
| 720 | + foreach($this->users_arr as $user_id) { |
|
| 721 | + $notify_user = new User(); |
|
| 722 | + $notify_user->retrieve($user_id); |
|
| 723 | + $notify_user->new_assigned_user_name = $notify_user->full_name; |
|
| 724 | + $GLOBALS['log']->info("Notifications: recipient is $notify_user->new_assigned_user_name"); |
|
| 725 | + $list[$notify_user->id] = $notify_user; |
|
| 726 | + } |
|
| 727 | + |
|
| 728 | + foreach($this->contacts_arr as $contact_id) { |
|
| 729 | + $notify_user = new Contact(); |
|
| 730 | + $notify_user->retrieve($contact_id); |
|
| 731 | + $notify_user->new_assigned_user_name = $notify_user->full_name; |
|
| 732 | + $GLOBALS['log']->info("Notifications: recipient is $notify_user->new_assigned_user_name"); |
|
| 733 | + $list[$notify_user->id] = $notify_user; |
|
| 734 | + } |
|
| 735 | 735 | |
| 736 | 736 | foreach($this->leads_arr as $lead_id) { |
| 737 | - $notify_user = new Lead(); |
|
| 738 | - $notify_user->retrieve($lead_id); |
|
| 739 | - $notify_user->new_assigned_user_name = $notify_user->full_name; |
|
| 740 | - $GLOBALS['log']->info("Notifications: recipient is $notify_user->new_assigned_user_name"); |
|
| 741 | - $list[$notify_user->id] = $notify_user; |
|
| 742 | - } |
|
| 743 | - |
|
| 744 | - global $sugar_config; |
|
| 745 | - if(isset($sugar_config['disable_notify_current_user']) && $sugar_config['disable_notify_current_user']) { |
|
| 746 | - global $current_user; |
|
| 747 | - if(isset($list[$current_user->id])) |
|
| 748 | - unset($list[$current_user->id]); |
|
| 749 | - } |
|
| 750 | - return $list; |
|
| 751 | - } |
|
| 752 | - |
|
| 753 | - |
|
| 754 | - function bean_implements($interface) { |
|
| 755 | - switch($interface) { |
|
| 756 | - case 'ACL':return true; |
|
| 757 | - } |
|
| 758 | - return false; |
|
| 759 | - } |
|
| 760 | - |
|
| 761 | - function listviewACLHelper() { |
|
| 762 | - $array_assign = parent::listviewACLHelper(); |
|
| 763 | - $is_owner = false; |
|
| 764 | - $in_group = false; //SECURITY GROUPS |
|
| 765 | - if(!empty($this->parent_name)) { |
|
| 766 | - |
|
| 767 | - if(!empty($this->parent_name_owner)) { |
|
| 768 | - global $current_user; |
|
| 769 | - $is_owner = $current_user->id == $this->parent_name_owner; |
|
| 770 | - } |
|
| 771 | - /* BEGIN - SECURITY GROUPS */ |
|
| 772 | - //parent_name_owner not being set for whatever reason so we need to figure this out |
|
| 773 | - else if(!empty($this->parent_type) && !empty($this->parent_id)) { |
|
| 774 | - global $current_user; |
|
| 737 | + $notify_user = new Lead(); |
|
| 738 | + $notify_user->retrieve($lead_id); |
|
| 739 | + $notify_user->new_assigned_user_name = $notify_user->full_name; |
|
| 740 | + $GLOBALS['log']->info("Notifications: recipient is $notify_user->new_assigned_user_name"); |
|
| 741 | + $list[$notify_user->id] = $notify_user; |
|
| 742 | + } |
|
| 743 | + |
|
| 744 | + global $sugar_config; |
|
| 745 | + if(isset($sugar_config['disable_notify_current_user']) && $sugar_config['disable_notify_current_user']) { |
|
| 746 | + global $current_user; |
|
| 747 | + if(isset($list[$current_user->id])) |
|
| 748 | + unset($list[$current_user->id]); |
|
| 749 | + } |
|
| 750 | + return $list; |
|
| 751 | + } |
|
| 752 | + |
|
| 753 | + |
|
| 754 | + function bean_implements($interface) { |
|
| 755 | + switch($interface) { |
|
| 756 | + case 'ACL':return true; |
|
| 757 | + } |
|
| 758 | + return false; |
|
| 759 | + } |
|
| 760 | + |
|
| 761 | + function listviewACLHelper() { |
|
| 762 | + $array_assign = parent::listviewACLHelper(); |
|
| 763 | + $is_owner = false; |
|
| 764 | + $in_group = false; //SECURITY GROUPS |
|
| 765 | + if(!empty($this->parent_name)) { |
|
| 766 | + |
|
| 767 | + if(!empty($this->parent_name_owner)) { |
|
| 768 | + global $current_user; |
|
| 769 | + $is_owner = $current_user->id == $this->parent_name_owner; |
|
| 770 | + } |
|
| 771 | + /* BEGIN - SECURITY GROUPS */ |
|
| 772 | + //parent_name_owner not being set for whatever reason so we need to figure this out |
|
| 773 | + else if(!empty($this->parent_type) && !empty($this->parent_id)) { |
|
| 774 | + global $current_user; |
|
| 775 | 775 | $parent_bean = BeanFactory::getBean($this->parent_type,$this->parent_id); |
| 776 | 776 | if($parent_bean !== false) { |
| 777 | - $is_owner = $current_user->id == $parent_bean->assigned_user_id; |
|
| 777 | + $is_owner = $current_user->id == $parent_bean->assigned_user_id; |
|
| 778 | 778 | } |
| 779 | - } |
|
| 780 | - require_once("modules/SecurityGroups/SecurityGroup.php"); |
|
| 781 | - $in_group = SecurityGroup::groupHasAccess($this->parent_type, $this->parent_id, 'view'); |
|
| 782 | - /* END - SECURITY GROUPS */ |
|
| 783 | - } |
|
| 784 | - |
|
| 785 | - /* BEGIN - SECURITY GROUPS */ |
|
| 786 | - /** |
|
| 779 | + } |
|
| 780 | + require_once("modules/SecurityGroups/SecurityGroup.php"); |
|
| 781 | + $in_group = SecurityGroup::groupHasAccess($this->parent_type, $this->parent_id, 'view'); |
|
| 782 | + /* END - SECURITY GROUPS */ |
|
| 783 | + } |
|
| 784 | + |
|
| 785 | + /* BEGIN - SECURITY GROUPS */ |
|
| 786 | + /** |
|
| 787 | 787 | if(!ACLController::moduleSupportsACL($this->parent_type) || ACLController::checkAccess($this->parent_type, 'view', $is_owner)) { |
| 788 | - */ |
|
| 789 | - if(!ACLController::moduleSupportsACL($this->parent_type) || ACLController::checkAccess($this->parent_type, 'view', $is_owner, 'module', $in_group)){ |
|
| 788 | + */ |
|
| 789 | + if(!ACLController::moduleSupportsACL($this->parent_type) || ACLController::checkAccess($this->parent_type, 'view', $is_owner, 'module', $in_group)){ |
|
| 790 | 790 | /* END - SECURITY GROUPS */ |
| 791 | - $array_assign['PARENT'] = 'a'; |
|
| 792 | - } else { |
|
| 793 | - $array_assign['PARENT'] = 'span'; |
|
| 794 | - } |
|
| 795 | - |
|
| 796 | - $is_owner = false; |
|
| 797 | - $in_group = false; //SECURITY GROUPS |
|
| 798 | - |
|
| 799 | - if(!empty($this->contact_name)) { |
|
| 800 | - if(!empty($this->contact_name_owner)) { |
|
| 801 | - global $current_user; |
|
| 802 | - $is_owner = $current_user->id == $this->contact_name_owner; |
|
| 803 | - } |
|
| 804 | - /* BEGIN - SECURITY GROUPS */ |
|
| 805 | - //contact_name_owner not being set for whatever reason so we need to figure this out |
|
| 806 | - else { |
|
| 807 | - global $current_user; |
|
| 791 | + $array_assign['PARENT'] = 'a'; |
|
| 792 | + } else { |
|
| 793 | + $array_assign['PARENT'] = 'span'; |
|
| 794 | + } |
|
| 795 | + |
|
| 796 | + $is_owner = false; |
|
| 797 | + $in_group = false; //SECURITY GROUPS |
|
| 798 | + |
|
| 799 | + if(!empty($this->contact_name)) { |
|
| 800 | + if(!empty($this->contact_name_owner)) { |
|
| 801 | + global $current_user; |
|
| 802 | + $is_owner = $current_user->id == $this->contact_name_owner; |
|
| 803 | + } |
|
| 804 | + /* BEGIN - SECURITY GROUPS */ |
|
| 805 | + //contact_name_owner not being set for whatever reason so we need to figure this out |
|
| 806 | + else { |
|
| 807 | + global $current_user; |
|
| 808 | 808 | $parent_bean = BeanFactory::getBean('Contacts',$this->contact_id); |
| 809 | 809 | if($parent_bean !== false) { |
| 810 | - $is_owner = $current_user->id == $parent_bean->assigned_user_id; |
|
| 810 | + $is_owner = $current_user->id == $parent_bean->assigned_user_id; |
|
| 811 | 811 | } |
| 812 | - } |
|
| 813 | - require_once("modules/SecurityGroups/SecurityGroup.php"); |
|
| 814 | - $in_group = SecurityGroup::groupHasAccess('Contacts', $this->contact_id, 'view'); |
|
| 815 | - /* END - SECURITY GROUPS */ |
|
| 816 | - } |
|
| 817 | - |
|
| 818 | - /* BEGIN - SECURITY GROUPS */ |
|
| 819 | - /** |
|
| 812 | + } |
|
| 813 | + require_once("modules/SecurityGroups/SecurityGroup.php"); |
|
| 814 | + $in_group = SecurityGroup::groupHasAccess('Contacts', $this->contact_id, 'view'); |
|
| 815 | + /* END - SECURITY GROUPS */ |
|
| 816 | + } |
|
| 817 | + |
|
| 818 | + /* BEGIN - SECURITY GROUPS */ |
|
| 819 | + /** |
|
| 820 | 820 | if(ACLController::checkAccess('Contacts', 'view', $is_owner)) { |
| 821 | - */ |
|
| 822 | - if(ACLController::checkAccess('Contacts', 'view', $is_owner, 'module', $in_group)) { |
|
| 821 | + */ |
|
| 822 | + if(ACLController::checkAccess('Contacts', 'view', $is_owner, 'module', $in_group)) { |
|
| 823 | 823 | /* END - SECURITY GROUPS */ |
| 824 | - $array_assign['CONTACT'] = 'a'; |
|
| 825 | - } else { |
|
| 826 | - $array_assign['CONTACT'] = 'span'; |
|
| 827 | - } |
|
| 828 | - return $array_assign; |
|
| 829 | - } |
|
| 830 | - |
|
| 831 | - |
|
| 832 | - function save_relationship_changes($is_update, $exclude = array()) { |
|
| 833 | - if(empty($this->in_workflow)) { |
|
| 834 | - if(empty($this->in_import)){//if a meeting is being imported then contact_id should not be excluded |
|
| 835 | - //if the global soap_server_object variable is not empty (as in from a soap/OPI call), then process the assigned_user_id relationship, otherwise |
|
| 836 | - //add assigned_user_id to exclude list and let the logic from MeetingFormBase determine whether assigned user id gets added to the relationship |
|
| 837 | - if(!empty($GLOBALS['soap_server_object'])){ |
|
| 838 | - $exclude = array('contact_id', 'user_id'); |
|
| 839 | - }else{ |
|
| 840 | - $exclude = array('contact_id', 'user_id','assigned_user_id'); |
|
| 841 | - } |
|
| 842 | - } |
|
| 843 | - else{ |
|
| 844 | - $exclude = array('user_id'); |
|
| 845 | - } |
|
| 846 | - } |
|
| 847 | - parent::save_relationship_changes($is_update, $exclude); |
|
| 848 | - } |
|
| 849 | - |
|
| 850 | - |
|
| 851 | - /** |
|
| 852 | - * @see SugarBean::afterImportSave() |
|
| 853 | - */ |
|
| 854 | - public function afterImportSave() |
|
| 855 | - { |
|
| 856 | - if ( $this->parent_type == 'Contacts' ) { |
|
| 857 | - $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' ) { |
|
| 862 | - $this->load_relationship('leads'); |
|
| 863 | - if ( !$this->leads->relationship_exists('leads',array('id'=>$this->parent_id)) ) |
|
| 864 | - $this->leads->add($this->parent_id); |
|
| 865 | - } |
|
| 866 | - |
|
| 867 | - parent::afterImportSave(); |
|
| 868 | - } |
|
| 824 | + $array_assign['CONTACT'] = 'a'; |
|
| 825 | + } else { |
|
| 826 | + $array_assign['CONTACT'] = 'span'; |
|
| 827 | + } |
|
| 828 | + return $array_assign; |
|
| 829 | + } |
|
| 830 | + |
|
| 831 | + |
|
| 832 | + function save_relationship_changes($is_update, $exclude = array()) { |
|
| 833 | + if(empty($this->in_workflow)) { |
|
| 834 | + if(empty($this->in_import)){//if a meeting is being imported then contact_id should not be excluded |
|
| 835 | + //if the global soap_server_object variable is not empty (as in from a soap/OPI call), then process the assigned_user_id relationship, otherwise |
|
| 836 | + //add assigned_user_id to exclude list and let the logic from MeetingFormBase determine whether assigned user id gets added to the relationship |
|
| 837 | + if(!empty($GLOBALS['soap_server_object'])){ |
|
| 838 | + $exclude = array('contact_id', 'user_id'); |
|
| 839 | + }else{ |
|
| 840 | + $exclude = array('contact_id', 'user_id','assigned_user_id'); |
|
| 841 | + } |
|
| 842 | + } |
|
| 843 | + else{ |
|
| 844 | + $exclude = array('user_id'); |
|
| 845 | + } |
|
| 846 | + } |
|
| 847 | + parent::save_relationship_changes($is_update, $exclude); |
|
| 848 | + } |
|
| 849 | + |
|
| 850 | + |
|
| 851 | + /** |
|
| 852 | + * @see SugarBean::afterImportSave() |
|
| 853 | + */ |
|
| 854 | + public function afterImportSave() |
|
| 855 | + { |
|
| 856 | + if ( $this->parent_type == 'Contacts' ) { |
|
| 857 | + $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' ) { |
|
| 862 | + $this->load_relationship('leads'); |
|
| 863 | + if ( !$this->leads->relationship_exists('leads',array('id'=>$this->parent_id)) ) |
|
| 864 | + $this->leads->add($this->parent_id); |
|
| 865 | + } |
|
| 866 | + |
|
| 867 | + parent::afterImportSave(); |
|
| 868 | + } |
|
| 869 | 869 | |
| 870 | 870 | public function getDefaultStatus() |
| 871 | 871 | { |
| 872 | - $def = $this->field_defs['status']; |
|
| 873 | - if (isset($def['default'])) { |
|
| 874 | - return $def['default']; |
|
| 875 | - } else { |
|
| 872 | + $def = $this->field_defs['status']; |
|
| 873 | + if (isset($def['default'])) { |
|
| 874 | + return $def['default']; |
|
| 875 | + } else { |
|
| 876 | 876 | $app = return_app_list_strings_language($GLOBALS['current_language']); |
| 877 | 877 | if (isset($def['options']) && isset($app[$def['options']])) { |
| 878 | 878 | $keys = array_keys($app[$def['options']]); |
@@ -888,9 +888,9 @@ discard block |
||
| 888 | 888 | //TODO: do we really need focus, name and view params for this function |
| 889 | 889 | function getMeetingsExternalApiDropDown($focus = null, $name = null, $value = null, $view = null) |
| 890 | 890 | { |
| 891 | - global $dictionary, $app_list_strings; |
|
| 891 | + global $dictionary, $app_list_strings; |
|
| 892 | 892 | |
| 893 | - $cacheKeyName = 'meetings_type_drop_down'; |
|
| 893 | + $cacheKeyName = 'meetings_type_drop_down'; |
|
| 894 | 894 | |
| 895 | 895 | $apiList = sugar_cache_retrieve($cacheKeyName); |
| 896 | 896 | if ($apiList === null) |
@@ -902,17 +902,17 @@ discard block |
||
| 902 | 902 | sugar_cache_put($cacheKeyName, $apiList); |
| 903 | 903 | } |
| 904 | 904 | |
| 905 | - if(!empty($value) && empty($apiList[$value])) |
|
| 906 | - { |
|
| 907 | - $apiList[$value] = $value; |
|
| 905 | + if(!empty($value) && empty($apiList[$value])) |
|
| 906 | + { |
|
| 907 | + $apiList[$value] = $value; |
|
| 908 | 908 | } |
| 909 | - //bug 46294: adding list of options to dropdown list (if it is not the default list) |
|
| 909 | + //bug 46294: adding list of options to dropdown list (if it is not the default list) |
|
| 910 | 910 | if ($dictionary['Meeting']['fields']['type']['options'] != "eapm_list") |
| 911 | 911 | { |
| 912 | 912 | $apiList = array_merge(getMeetingTypeOptions($dictionary, $app_list_strings), $apiList); |
| 913 | 913 | } |
| 914 | 914 | |
| 915 | - return $apiList; |
|
| 915 | + return $apiList; |
|
| 916 | 916 | } |
| 917 | 917 | |
| 918 | 918 | /** |
@@ -923,20 +923,20 @@ discard block |
||
| 923 | 923 | */ |
| 924 | 924 | function getMeetingTypeOptions($dictionary, $app_list_strings) |
| 925 | 925 | { |
| 926 | - $result = array(); |
|
| 926 | + $result = array(); |
|
| 927 | 927 | |
| 928 | 928 | // getting name of meeting type to fill dropdown list by its values |
| 929 | 929 | if (isset($dictionary['Meeting']['fields']['type']['options'])) |
| 930 | - { |
|
| 931 | - $typeName = $dictionary['Meeting']['fields']['type']['options']; |
|
| 930 | + { |
|
| 931 | + $typeName = $dictionary['Meeting']['fields']['type']['options']; |
|
| 932 | 932 | |
| 933 | 933 | if (!empty($app_list_strings[$typeName])) |
| 934 | - { |
|
| 935 | - $typeList = $app_list_strings[$typeName]; |
|
| 934 | + { |
|
| 935 | + $typeList = $app_list_strings[$typeName]; |
|
| 936 | 936 | |
| 937 | 937 | foreach ($typeList as $key => $value) |
| 938 | - { |
|
| 939 | - $result[$value] = $value; |
|
| 938 | + { |
|
| 939 | + $result[$value] = $value; |
|
| 940 | 940 | } |
| 941 | 941 | } |
| 942 | 942 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 3 | 3 | /********************************************************************************* |
| 4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
| 5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | var $meetings_arr; |
| 94 | 94 | // when assoc w/ a user/contact: |
| 95 | 95 | var $minutes_value_default = 15; |
| 96 | - var $minutes_values = array('0'=>'00','15'=>'15','30'=>'30','45'=>'45'); |
|
| 96 | + var $minutes_values = array('0'=>'00', '15'=>'15', '30'=>'30', '45'=>'45'); |
|
| 97 | 97 | var $table_name = "meetings"; |
| 98 | 98 | var $rel_users_table = "meetings_users"; |
| 99 | 99 | var $rel_contacts_table = "meetings_contacts"; |
@@ -104,8 +104,8 @@ discard block |
||
| 104 | 104 | var $importable = true; |
| 105 | 105 | // This is used to retrieve related fields from form posts. |
| 106 | 106 | var $additional_column_fields = array('assigned_user_name', 'assigned_user_id', 'contact_id', 'user_id', 'contact_name', 'accept_status'); |
| 107 | - var $relationship_fields = array('account_id'=>'accounts','opportunity_id'=>'opportunity','case_id'=>'case', |
|
| 108 | - 'assigned_user_id'=>'users','contact_id'=>'contacts', 'user_id'=>'users', 'meeting_id'=>'meetings'); |
|
| 107 | + var $relationship_fields = array('account_id'=>'accounts', 'opportunity_id'=>'opportunity', 'case_id'=>'case', |
|
| 108 | + 'assigned_user_id'=>'users', 'contact_id'=>'contacts', 'user_id'=>'users', 'meeting_id'=>'meetings'); |
|
| 109 | 109 | // so you can run get_users() twice and run query only once |
| 110 | 110 | var $cached_get_users = null; |
| 111 | 111 | var $new_schema = true; |
@@ -117,11 +117,11 @@ discard block |
||
| 117 | 117 | public function __construct() { |
| 118 | 118 | parent::__construct(); |
| 119 | 119 | $this->setupCustomFields('Meetings'); |
| 120 | - foreach($this->field_defs as $field) { |
|
| 120 | + foreach ($this->field_defs as $field) { |
|
| 121 | 121 | $this->field_name_map[$field['name']] = $field; |
| 122 | 122 | } |
| 123 | 123 | // $this->fill_in_additional_detail_fields(); |
| 124 | - if(!empty($GLOBALS['app_list_strings']['duration_intervals'])) { |
|
| 124 | + if (!empty($GLOBALS['app_list_strings']['duration_intervals'])) { |
|
| 125 | 125 | $this->minutes_values = $GLOBALS['app_list_strings']['duration_intervals']; |
| 126 | 126 | } |
| 127 | 127 | } |
@@ -129,9 +129,9 @@ discard block |
||
| 129 | 129 | /** |
| 130 | 130 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 131 | 131 | */ |
| 132 | - public function Meeting(){ |
|
| 132 | + public function Meeting() { |
|
| 133 | 133 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 134 | - if(isset($GLOBALS['log'])) { |
|
| 134 | + if (isset($GLOBALS['log'])) { |
|
| 135 | 135 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 136 | 136 | } |
| 137 | 137 | else { |
@@ -145,21 +145,21 @@ discard block |
||
| 145 | 145 | * @param $view string |
| 146 | 146 | * @param $is_owner bool |
| 147 | 147 | */ |
| 148 | - function ACLAccess($view,$is_owner='not_set',$in_group='not_set'){ |
|
| 148 | + function ACLAccess($view, $is_owner = 'not_set', $in_group = 'not_set') { |
|
| 149 | 149 | // don't check if meeting is being synced from Outlook |
| 150 | - if($this->syncing == false){ |
|
| 150 | + if ($this->syncing == false) { |
|
| 151 | 151 | $view = strtolower($view); |
| 152 | - switch($view){ |
|
| 152 | + switch ($view) { |
|
| 153 | 153 | case 'edit': |
| 154 | 154 | case 'save': |
| 155 | 155 | case 'editview': |
| 156 | 156 | case 'delete': |
| 157 | - if(!empty($this->recurring_source) && $this->recurring_source != "Sugar"){ |
|
| 157 | + if (!empty($this->recurring_source) && $this->recurring_source != "Sugar") { |
|
| 158 | 158 | return false; |
| 159 | 159 | } |
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | - return parent::ACLAccess($view,$is_owner,$in_group); |
|
| 162 | + return parent::ACLAccess($view, $is_owner, $in_group); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /** |
@@ -178,14 +178,14 @@ discard block |
||
| 178 | 178 | |
| 179 | 179 | global $disable_date_format; |
| 180 | 180 | |
| 181 | - if(isset($this->date_start)) |
|
| 181 | + if (isset($this->date_start)) |
|
| 182 | 182 | { |
| 183 | 183 | $td = $timedate->fromDb($this->date_start); |
| 184 | - if(!$td){ |
|
| 184 | + if (!$td) { |
|
| 185 | 185 | $this->date_start = $timedate->to_db($this->date_start); |
| 186 | 186 | $td = $timedate->fromDb($this->date_start); |
| 187 | 187 | } |
| 188 | - if($td) |
|
| 188 | + if ($td) |
|
| 189 | 189 | { |
| 190 | 190 | if (isset($this->duration_hours) && $this->duration_hours != '') |
| 191 | 191 | { |
@@ -199,17 +199,17 @@ discard block |
||
| 199 | 199 | } |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - $check_notify =(!empty($_REQUEST['send_invites']) && $_REQUEST['send_invites'] == '1') ? true : false; |
|
| 203 | - if(empty($_REQUEST['send_invites'])) { |
|
| 204 | - if(!empty($this->id)) { |
|
| 202 | + $check_notify = (!empty($_REQUEST['send_invites']) && $_REQUEST['send_invites'] == '1') ? true : false; |
|
| 203 | + if (empty($_REQUEST['send_invites'])) { |
|
| 204 | + if (!empty($this->id)) { |
|
| 205 | 205 | $old_record = new Meeting(); |
| 206 | 206 | $old_record->retrieve($this->id); |
| 207 | 207 | $old_assigned_user_id = $old_record->assigned_user_id; |
| 208 | 208 | } |
| 209 | - if((empty($this->id) && isset($_REQUEST['assigned_user_id']) && !empty($_REQUEST['assigned_user_id']) && $GLOBALS['current_user']->id != $_REQUEST['assigned_user_id']) || (isset($old_assigned_user_id) && !empty($old_assigned_user_id) && isset($_REQUEST['assigned_user_id']) && !empty($_REQUEST['assigned_user_id']) && $old_assigned_user_id != $_REQUEST['assigned_user_id']) ){ |
|
| 209 | + if ((empty($this->id) && isset($_REQUEST['assigned_user_id']) && !empty($_REQUEST['assigned_user_id']) && $GLOBALS['current_user']->id != $_REQUEST['assigned_user_id']) || (isset($old_assigned_user_id) && !empty($old_assigned_user_id) && isset($_REQUEST['assigned_user_id']) && !empty($_REQUEST['assigned_user_id']) && $old_assigned_user_id != $_REQUEST['assigned_user_id'])) { |
|
| 210 | 210 | $this->special_notification = true; |
| 211 | 211 | $check_notify = true; |
| 212 | - if(isset($_REQUEST['assigned_user_name'])) { |
|
| 212 | + if (isset($_REQUEST['assigned_user_name'])) { |
|
| 213 | 213 | $this->new_assigned_user_name = $_REQUEST['assigned_user_name']; |
| 214 | 214 | } |
| 215 | 215 | } |
@@ -221,23 +221,23 @@ discard block |
||
| 221 | 221 | }*/ |
| 222 | 222 | |
| 223 | 223 | // 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)) |
|
| 224 | + if (empty($this->id) && !empty($_REQUEST['module']) && $_REQUEST['module'] == "Calendar" && !empty($_REQUEST['repeat_type']) && !empty($this->repeat_parent_id)) |
|
| 225 | 225 | $check_notify = false; |
| 226 | 226 | |
| 227 | - if (empty($this->status) ) { |
|
| 227 | + if (empty($this->status)) { |
|
| 228 | 228 | $this->status = $this->getDefaultStatus(); |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | // Do any external API saving |
| 232 | 232 | // Clear out the old external API stuff if we have changed types |
| 233 | - if (isset($this->fetched_row) && $this->fetched_row['type'] != $this->type ) { |
|
| 233 | + if (isset($this->fetched_row) && $this->fetched_row['type'] != $this->type) { |
|
| 234 | 234 | $this->join_url = ''; |
| 235 | 235 | $this->host_url = ''; |
| 236 | 236 | $this->external_id = ''; |
| 237 | 237 | $this->creator = ''; |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | - if (!empty($this->type) && $this->type != 'Sugar' ) { |
|
| 240 | + if (!empty($this->type) && $this->type != 'Sugar') { |
|
| 241 | 241 | require_once('include/externalAPI/ExternalAPIFactory.php'); |
| 242 | 242 | $api = ExternalAPIFactory::loadAPI($this->type); |
| 243 | 243 | } |
@@ -246,27 +246,27 @@ discard block |
||
| 246 | 246 | $this->type = 'Sugar'; |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | - if ( isset($api) && is_a($api,'WebMeeting') && empty($this->in_relationship_update) ) { |
|
| 249 | + if (isset($api) && is_a($api, 'WebMeeting') && empty($this->in_relationship_update)) { |
|
| 250 | 250 | // Make sure the API initialized and it supports Web Meetings |
| 251 | 251 | // Also make suer we have an ID, the external site needs something to reference |
| 252 | - if ( !isset($this->id) || empty($this->id) ) { |
|
| 252 | + if (!isset($this->id) || empty($this->id)) { |
|
| 253 | 253 | $this->id = create_guid(); |
| 254 | 254 | $this->new_with_id = true; |
| 255 | 255 | } |
| 256 | 256 | $response = $api->scheduleMeeting($this); |
| 257 | - if ( $response['success'] == TRUE ) { |
|
| 257 | + if ($response['success'] == TRUE) { |
|
| 258 | 258 | // Need to send out notifications |
| 259 | - if ( $api->canInvite ) { |
|
| 259 | + if ($api->canInvite) { |
|
| 260 | 260 | $notifyList = $this->get_notification_recipients(); |
| 261 | - foreach($notifyList as $person) { |
|
| 262 | - $api->inviteAttendee($this,$person,$check_notify); |
|
| 261 | + foreach ($notifyList as $person) { |
|
| 262 | + $api->inviteAttendee($this, $person, $check_notify); |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | } |
| 266 | 266 | } else { |
| 267 | 267 | // Generic Message Provides no value to End User - Log the issue with message detail and continue |
| 268 | 268 | // SugarApplication::appendErrorMessage($GLOBALS['app_strings']['ERR_EXTERNAL_API_SAVE_FAIL']); |
| 269 | - $GLOBALS['log']->warn('ERR_EXTERNAL_API_SAVE_FAIL' . ": " . $this->type . " - " . $response['errorMessage']); |
|
| 269 | + $GLOBALS['log']->warn('ERR_EXTERNAL_API_SAVE_FAIL'.": ".$this->type." - ".$response['errorMessage']); |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | $api->logoff(); |
@@ -274,11 +274,11 @@ discard block |
||
| 274 | 274 | |
| 275 | 275 | $return_id = parent::save($check_notify); |
| 276 | 276 | |
| 277 | - if($this->update_vcal) { |
|
| 277 | + if ($this->update_vcal) { |
|
| 278 | 278 | vCal::cache_sugar_vcal($current_user); |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | - if(isset($_REQUEST['reminders_data'])) { |
|
| 281 | + if (isset($_REQUEST['reminders_data'])) { |
|
| 282 | 282 | Reminder::saveRemindersDataJson('Meetings', $return_id, html_entity_decode($_REQUEST['reminders_data'])); |
| 283 | 283 | } |
| 284 | 284 | |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | |
| 297 | 297 | parent::mark_deleted($id); |
| 298 | 298 | |
| 299 | - if($this->update_vcal) { |
|
| 299 | + if ($this->update_vcal) { |
|
| 300 | 300 | vCal::cache_sugar_vcal($current_user); |
| 301 | 301 | } |
| 302 | 302 | } |
@@ -305,13 +305,13 @@ discard block |
||
| 305 | 305 | return "$this->name"; |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | - function create_export_query($order_by, $where, $relate_link_join='') |
|
| 308 | + function create_export_query($order_by, $where, $relate_link_join = '') |
|
| 309 | 309 | { |
| 310 | 310 | $custom_join = $this->getCustomJoin(true, true, $where); |
| 311 | 311 | $custom_join['join'] .= $relate_link_join; |
| 312 | 312 | $contact_required = stristr($where, "contacts"); |
| 313 | 313 | |
| 314 | - if($contact_required) { |
|
| 314 | + if ($contact_required) { |
|
| 315 | 315 | $query = "SELECT meetings.*, contacts.first_name, contacts.last_name, contacts.assigned_user_id contact_name_owner, users.user_name as assigned_user_name "; |
| 316 | 316 | $query .= $custom_join['select']; |
| 317 | 317 | $query .= " FROM contacts, meetings, meetings_contacts "; |
@@ -326,14 +326,14 @@ discard block |
||
| 326 | 326 | |
| 327 | 327 | $query .= $custom_join['join']; |
| 328 | 328 | |
| 329 | - if($where != "") |
|
| 329 | + if ($where != "") |
|
| 330 | 330 | $query .= " where $where AND ".$where_auto; |
| 331 | 331 | else |
| 332 | 332 | $query .= " where ".$where_auto; |
| 333 | 333 | |
| 334 | 334 | $order_by = $this->process_order_by($order_by); |
| 335 | 335 | if (!empty($order_by)) { |
| 336 | - $query .= ' ORDER BY ' . $order_by; |
|
| 336 | + $query .= ' ORDER BY '.$order_by; |
|
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | return $query; |
@@ -349,12 +349,12 @@ discard block |
||
| 349 | 349 | if (!empty($this->contact_id)) { |
| 350 | 350 | $query = "SELECT first_name, last_name FROM contacts "; |
| 351 | 351 | $query .= "WHERE id='$this->contact_id' AND deleted=0"; |
| 352 | - $result = $this->db->limitQuery($query,0,1,true," Error filling in additional detail fields: "); |
|
| 352 | + $result = $this->db->limitQuery($query, 0, 1, true, " Error filling in additional detail fields: "); |
|
| 353 | 353 | |
| 354 | 354 | // Get the contact name. |
| 355 | 355 | $row = $this->db->fetchByAssoc($result); |
| 356 | 356 | $GLOBALS['log']->info("additional call fields $query"); |
| 357 | - if($row != null) |
|
| 357 | + if ($row != null) |
|
| 358 | 358 | { |
| 359 | 359 | $this->contact_name = $locale->getLocaleFormattedName($row['first_name'], $row['last_name'], '', ''); |
| 360 | 360 | $GLOBALS['log']->debug("Call($this->id): contact_name = $this->contact_name"); |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | |
| 398 | 398 | global $timedate; |
| 399 | 399 | $this->time_meridiem = $timedate->AMPMMenu('', $this->time_start, 'onchange="SugarWidgetScheduler.update_time();"'); |
| 400 | - $hours_arr = array (); |
|
| 400 | + $hours_arr = array(); |
|
| 401 | 401 | $num_of_hours = 13; |
| 402 | 402 | $start_at = 1; |
| 403 | 403 | |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | $start_at = 0; |
| 407 | 407 | } //if |
| 408 | 408 | |
| 409 | - for ($i = $start_at; $i < $num_of_hours; $i ++) { |
|
| 409 | + for ($i = $start_at; $i < $num_of_hours; $i++) { |
|
| 410 | 410 | $i = $i.""; |
| 411 | 411 | if (strlen($i) == 1) { |
| 412 | 412 | $i = "0".$i; |
@@ -429,12 +429,12 @@ discard block |
||
| 429 | 429 | if (is_null($this->duration_minutes)) |
| 430 | 430 | $this->duration_minutes = "1"; |
| 431 | 431 | |
| 432 | - if(empty($this->id) && !empty($_REQUEST['date_start'])){ |
|
| 432 | + if (empty($this->id) && !empty($_REQUEST['date_start'])) { |
|
| 433 | 433 | $this->date_start = $_REQUEST['date_start']; |
| 434 | 434 | } |
| 435 | - if(!empty($this->date_start)) |
|
| 435 | + if (!empty($this->date_start)) |
|
| 436 | 436 | { |
| 437 | - $td = SugarDateTime::createFromFormat($GLOBALS['timedate']->get_date_time_format(),$this->date_start); |
|
| 437 | + $td = SugarDateTime::createFromFormat($GLOBALS['timedate']->get_date_time_format(), $this->date_start); |
|
| 438 | 438 | if (!empty($td)) |
| 439 | 439 | { |
| 440 | 440 | if (!empty($this->duration_hours) && $this->duration_hours != '') |
@@ -455,9 +455,9 @@ discard block |
||
| 455 | 455 | |
| 456 | 456 | global $app_list_strings; |
| 457 | 457 | $parent_types = $app_list_strings['record_type_display']; |
| 458 | - $disabled_parent_types = ACLController::disabledModuleList($parent_types,false, 'list'); |
|
| 459 | - foreach($disabled_parent_types as $disabled_parent_type){ |
|
| 460 | - if($disabled_parent_type != $this->parent_type){ |
|
| 458 | + $disabled_parent_types = ACLController::disabledModuleList($parent_types, false, 'list'); |
|
| 459 | + foreach ($disabled_parent_types as $disabled_parent_type) { |
|
| 460 | + if ($disabled_parent_type != $this->parent_type) { |
|
| 461 | 461 | unset($parent_types[$disabled_parent_type]); |
| 462 | 462 | } |
| 463 | 463 | } |
@@ -467,9 +467,9 @@ discard block |
||
| 467 | 467 | $this->reminder_time = -1; |
| 468 | 468 | } |
| 469 | 469 | |
| 470 | - if ( empty($this->id) ) { |
|
| 470 | + if (empty($this->id)) { |
|
| 471 | 471 | $reminder_t = $GLOBALS['current_user']->getPreference('reminder_time'); |
| 472 | - if ( isset($reminder_t) ) |
|
| 472 | + if (isset($reminder_t)) |
|
| 473 | 473 | $this->reminder_time = $reminder_t; |
| 474 | 474 | } |
| 475 | 475 | $this->reminder_checked = $this->reminder_time == -1 ? false : true; |
@@ -477,9 +477,9 @@ discard block |
||
| 477 | 477 | if (empty($this->email_reminder_time)) { |
| 478 | 478 | $this->email_reminder_time = -1; |
| 479 | 479 | } |
| 480 | - if(empty($this->id)){ |
|
| 480 | + if (empty($this->id)) { |
|
| 481 | 481 | $reminder_t = $GLOBALS['current_user']->getPreference('email_reminder_time'); |
| 482 | - if(isset($reminder_t)) |
|
| 482 | + if (isset($reminder_t)) |
|
| 483 | 483 | $this->email_reminder_time = $reminder_t; |
| 484 | 484 | } |
| 485 | 485 | $this->email_reminder_checked = $this->email_reminder_time == -1 ? false : true; |
@@ -496,15 +496,15 @@ discard block |
||
| 496 | 496 | $meeting_fields = $this->get_list_view_array(); |
| 497 | 497 | |
| 498 | 498 | global $app_list_strings, $focus, $action, $currentModule; |
| 499 | - if(isset($this->parent_type)) |
|
| 499 | + if (isset($this->parent_type)) |
|
| 500 | 500 | $meeting_fields['PARENT_MODULE'] = $this->parent_type; |
| 501 | - if($this->status == "Planned") { |
|
| 501 | + if ($this->status == "Planned") { |
|
| 502 | 502 | //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)) |
|
| 503 | + if (empty($action)) |
|
| 504 | 504 | $action = "index"; |
| 505 | 505 | $setCompleteUrl = "<a id='{$this->id}' onclick='SUGAR.util.closeActivityPanel.show(\"{$this->module_dir}\",\"{$this->id}\",\"Held\",\"listview\",\"1\");'>"; |
| 506 | 506 | if ($this->ACLAccess('edit')) { |
| 507 | - $meeting_fields['SET_COMPLETE'] = $setCompleteUrl . SugarThemeRegistry::current()->getImage("close_inline"," border='0'",null,null,'.gif',translate('LBL_CLOSEINLINE'))."</a>"; |
|
| 507 | + $meeting_fields['SET_COMPLETE'] = $setCompleteUrl.SugarThemeRegistry::current()->getImage("close_inline", " border='0'", null, null, '.gif', translate('LBL_CLOSEINLINE'))."</a>"; |
|
| 508 | 508 | } else { |
| 509 | 509 | $meeting_fields['SET_COMPLETE'] = ''; |
| 510 | 510 | } |
@@ -514,9 +514,9 @@ discard block |
||
| 514 | 514 | $nextday = $timedate->asDbDate($timedate->getNow()->get("+1 day")); |
| 515 | 515 | $mergeTime = $meeting_fields['DATE_START']; //$timedate->merge_date_time($meeting_fields['DATE_START'], $meeting_fields['TIME_START']); |
| 516 | 516 | $date_db = $timedate->to_db($mergeTime); |
| 517 | - if($date_db < $today ) { |
|
| 518 | - $meeting_fields['DATE_START']= "<font class='overdueTask'>".$meeting_fields['DATE_START']."</font>"; |
|
| 519 | - }else if($date_db < $nextday) { |
|
| 517 | + if ($date_db < $today) { |
|
| 518 | + $meeting_fields['DATE_START'] = "<font class='overdueTask'>".$meeting_fields['DATE_START']."</font>"; |
|
| 519 | + } else if ($date_db < $nextday) { |
|
| 520 | 520 | $meeting_fields['DATE_START'] = "<font class='todaysTask'>".$meeting_fields['DATE_START']."</font>"; |
| 521 | 521 | } else { |
| 522 | 522 | $meeting_fields['DATE_START'] = "<font class='futureTask'>".$meeting_fields['DATE_START']."</font>"; |
@@ -538,8 +538,8 @@ discard block |
||
| 538 | 538 | $meeting_fields['CONTACT_ID'] = $this->contact_id; |
| 539 | 539 | $meeting_fields['CONTACT_NAME'] = $this->contact_name; |
| 540 | 540 | $meeting_fields['PARENT_NAME'] = $this->parent_name; |
| 541 | - $meeting_fields['REMINDER_CHECKED'] = $this->reminder_time==-1 ? false : true; |
|
| 542 | - $meeting_fields['EMAIL_REMINDER_CHECKED'] = $this->email_reminder_time==-1 ? false : true; |
|
| 541 | + $meeting_fields['REMINDER_CHECKED'] = $this->reminder_time == -1 ? false : true; |
|
| 542 | + $meeting_fields['EMAIL_REMINDER_CHECKED'] = $this->email_reminder_time == -1 ? false : true; |
|
| 543 | 543 | |
| 544 | 544 | |
| 545 | 545 | return $meeting_fields; |
@@ -553,12 +553,12 @@ discard block |
||
| 553 | 553 | |
| 554 | 554 | |
| 555 | 555 | // cn: bug 9494 - passing a contact breaks this call |
| 556 | - $notifyUser =($meeting->current_notify_user->object_name == 'User') ? $meeting->current_notify_user : $current_user; |
|
| 556 | + $notifyUser = ($meeting->current_notify_user->object_name == 'User') ? $meeting->current_notify_user : $current_user; |
|
| 557 | 557 | // cn: bug 8078 - fixed call to $timedate |
| 558 | - if(strtolower(get_class($meeting->current_notify_user)) == 'contact') { |
|
| 558 | + if (strtolower(get_class($meeting->current_notify_user)) == 'contact') { |
|
| 559 | 559 | $xtpl->assign("ACCEPT_URL", $sugar_config['site_url']. |
| 560 | 560 | '/index.php?entryPoint=acceptDecline&module=Meetings&contact_id='.$meeting->current_notify_user->id.'&record='.$meeting->id); |
| 561 | - } elseif(strtolower(get_class($meeting->current_notify_user)) == 'lead') { |
|
| 561 | + } elseif (strtolower(get_class($meeting->current_notify_user)) == 'lead') { |
|
| 562 | 562 | $xtpl->assign("ACCEPT_URL", $sugar_config['site_url']. |
| 563 | 563 | '/index.php?entryPoint=acceptDecline&module=Meetings&lead_id='.$meeting->current_notify_user->id.'&record='.$meeting->id); |
| 564 | 564 | } else { |
@@ -567,16 +567,16 @@ discard block |
||
| 567 | 567 | } |
| 568 | 568 | $xtpl->assign("MEETING_TO", $meeting->current_notify_user->new_assigned_user_name); |
| 569 | 569 | $xtpl->assign("MEETING_SUBJECT", trim($meeting->name)); |
| 570 | - $xtpl->assign("MEETING_STATUS",(isset($meeting->status)? $app_list_strings['meeting_status_dom'][$meeting->status]:"")); |
|
| 570 | + $xtpl->assign("MEETING_STATUS", (isset($meeting->status) ? $app_list_strings['meeting_status_dom'][$meeting->status] : "")); |
|
| 571 | 571 | $typekey = strtolower($meeting->type); |
| 572 | - if(isset($meeting->type)) { |
|
| 573 | - if(!empty($app_list_strings['eapm_list'][$typekey])) { |
|
| 572 | + if (isset($meeting->type)) { |
|
| 573 | + if (!empty($app_list_strings['eapm_list'][$typekey])) { |
|
| 574 | 574 | $typestring = $app_list_strings['eapm_list'][$typekey]; |
| 575 | 575 | } else { |
| 576 | 576 | $typestring = $app_list_strings['meeting_type_dom'][$meeting->type]; |
| 577 | 577 | } |
| 578 | 578 | } |
| 579 | - $xtpl->assign("MEETING_TYPE", isset($meeting->type)? $typestring:""); |
|
| 579 | + $xtpl->assign("MEETING_TYPE", isset($meeting->type) ? $typestring : ""); |
|
| 580 | 580 | $startdate = $timedate->fromDb($meeting->date_start); |
| 581 | 581 | $xtpl->assign("MEETING_STARTDATE", $timedate->asUser($startdate, $notifyUser)." ".TimeDate::userTimezoneSuffix($startdate, $notifyUser)); |
| 582 | 582 | $enddate = $timedate->fromDb($meeting->date_end); |
@@ -584,7 +584,7 @@ discard block |
||
| 584 | 584 | $xtpl->assign("MEETING_HOURS", $meeting->duration_hours); |
| 585 | 585 | $xtpl->assign("MEETING_MINUTES", $meeting->duration_minutes); |
| 586 | 586 | $xtpl->assign("MEETING_DESCRIPTION", $meeting->description); |
| 587 | - if ( !empty($meeting->join_url) ) { |
|
| 587 | + if (!empty($meeting->join_url)) { |
|
| 588 | 588 | $xtpl->assign('MEETING_URL', $meeting->join_url); |
| 589 | 589 | $xtpl->parse('Meeting.Meeting_External_API'); |
| 590 | 590 | } |
@@ -595,7 +595,7 @@ discard block |
||
| 595 | 595 | /** |
| 596 | 596 | * Redefine method to attach ics file to notification email |
| 597 | 597 | */ |
| 598 | - public function create_notification_email($notify_user){ |
|
| 598 | + public function create_notification_email($notify_user) { |
|
| 599 | 599 | // reset acceptance status for non organizer if date is changed |
| 600 | 600 | if (($notify_user->id != $GLOBALS['current_user']->id) && $this->date_changed) { |
| 601 | 601 | $this->set_accept_status($notify_user, 'none'); |
@@ -603,12 +603,12 @@ discard block |
||
| 603 | 603 | |
| 604 | 604 | $notify_mail = parent::create_notification_email($notify_user); |
| 605 | 605 | |
| 606 | - $path = SugarConfig::getInstance()->get('upload_dir','upload/') . $this->id; |
|
| 606 | + $path = SugarConfig::getInstance()->get('upload_dir', 'upload/').$this->id; |
|
| 607 | 607 | |
| 608 | 608 | require_once("modules/vCals/vCal.php"); |
| 609 | 609 | $content = vCal::get_ical_event($this, $GLOBALS['current_user']); |
| 610 | 610 | |
| 611 | - if(file_put_contents($path,$content)){ |
|
| 611 | + if (file_put_contents($path, $content)) { |
|
| 612 | 612 | $notify_mail->AddAttachment($path, 'meeting.ics', 'base64', 'text/calendar'); |
| 613 | 613 | } |
| 614 | 614 | return $notify_mail; |
@@ -617,10 +617,10 @@ discard block |
||
| 617 | 617 | /** |
| 618 | 618 | * Redefine method to remove ics after email is sent |
| 619 | 619 | */ |
| 620 | - public function send_assignment_notifications($notify_user, $admin){ |
|
| 620 | + public function send_assignment_notifications($notify_user, $admin) { |
|
| 621 | 621 | parent::send_assignment_notifications($notify_user, $admin); |
| 622 | 622 | |
| 623 | - $path = SugarConfig::getInstance()->get('upload_dir','upload/') . $this->id; |
|
| 623 | + $path = SugarConfig::getInstance()->get('upload_dir', 'upload/').$this->id; |
|
| 624 | 624 | unlink($path); |
| 625 | 625 | } |
| 626 | 626 | |
@@ -632,13 +632,13 @@ discard block |
||
| 632 | 632 | $result = $this->db->query($query, true); |
| 633 | 633 | $list = Array(); |
| 634 | 634 | |
| 635 | - while($row = $this->db->fetchByAssoc($result)) { |
|
| 635 | + while ($row = $this->db->fetchByAssoc($result)) { |
|
| 636 | 636 | $template = new User(); // PHP 5 will retrieve by reference, always over-writing the "old" one |
| 637 | 637 | $record = $template->retrieve($row['user_id']); |
| 638 | 638 | $template->required = $row['required']; |
| 639 | 639 | $template->accept_status = $row['accept_status']; |
| 640 | 640 | |
| 641 | - if($record != null) { |
|
| 641 | + if ($record != null) { |
|
| 642 | 642 | // this copies the object into the array |
| 643 | 643 | $list[] = $template; |
| 644 | 644 | } |
@@ -654,13 +654,13 @@ discard block |
||
| 654 | 654 | $result = $this->db->query($query, true); |
| 655 | 655 | $list = Array(); |
| 656 | 656 | |
| 657 | - while($row = $this->db->fetchByAssoc($result)) { |
|
| 657 | + while ($row = $this->db->fetchByAssoc($result)) { |
|
| 658 | 658 | $record = $template->retrieve($row['meeting_id']); |
| 659 | 659 | $template->required = $row['required']; |
| 660 | 660 | $template->accept_status = $row['accept_status']; |
| 661 | 661 | |
| 662 | 662 | |
| 663 | - if($record != null) |
|
| 663 | + if ($record != null) |
|
| 664 | 664 | { |
| 665 | 665 | // this copies the object into the array |
| 666 | 666 | $list[] = $template; |
@@ -670,54 +670,54 @@ discard block |
||
| 670 | 670 | } |
| 671 | 671 | |
| 672 | 672 | |
| 673 | - function set_accept_status(&$user,$status) |
|
| 673 | + function set_accept_status(&$user, $status) |
|
| 674 | 674 | { |
| 675 | - if($user->object_name == 'User') |
|
| 675 | + if ($user->object_name == 'User') |
|
| 676 | 676 | { |
| 677 | - $relate_values = array('user_id'=>$user->id,'meeting_id'=>$this->id); |
|
| 677 | + $relate_values = array('user_id'=>$user->id, 'meeting_id'=>$this->id); |
|
| 678 | 678 | $data_values = array('accept_status'=>$status); |
| 679 | - $this->set_relationship($this->rel_users_table, $relate_values, true, true,$data_values); |
|
| 679 | + $this->set_relationship($this->rel_users_table, $relate_values, true, true, $data_values); |
|
| 680 | 680 | global $current_user; |
| 681 | 681 | |
| 682 | - if($this->update_vcal) |
|
| 682 | + if ($this->update_vcal) |
|
| 683 | 683 | { |
| 684 | 684 | vCal::cache_sugar_vcal($user); |
| 685 | 685 | } |
| 686 | 686 | } |
| 687 | - else if($user->object_name == 'Contact') |
|
| 687 | + else if ($user->object_name == 'Contact') |
|
| 688 | 688 | { |
| 689 | - $relate_values = array('contact_id'=>$user->id,'meeting_id'=>$this->id); |
|
| 689 | + $relate_values = array('contact_id'=>$user->id, 'meeting_id'=>$this->id); |
|
| 690 | 690 | $data_values = array('accept_status'=>$status); |
| 691 | - $this->set_relationship($this->rel_contacts_table, $relate_values, true, true,$data_values); |
|
| 691 | + $this->set_relationship($this->rel_contacts_table, $relate_values, true, true, $data_values); |
|
| 692 | 692 | } |
| 693 | - else if($user->object_name == 'Lead') |
|
| 693 | + else if ($user->object_name == 'Lead') |
|
| 694 | 694 | { |
| 695 | - $relate_values = array('lead_id'=>$user->id,'meeting_id'=>$this->id); |
|
| 695 | + $relate_values = array('lead_id'=>$user->id, 'meeting_id'=>$this->id); |
|
| 696 | 696 | $data_values = array('accept_status'=>$status); |
| 697 | - $this->set_relationship($this->rel_leads_table, $relate_values, true, true,$data_values); |
|
| 697 | + $this->set_relationship($this->rel_leads_table, $relate_values, true, true, $data_values); |
|
| 698 | 698 | } |
| 699 | 699 | } |
| 700 | 700 | |
| 701 | 701 | |
| 702 | 702 | function get_notification_recipients() { |
| 703 | - if($this->special_notification) { |
|
| 703 | + if ($this->special_notification) { |
|
| 704 | 704 | return parent::get_notification_recipients(); |
| 705 | 705 | } |
| 706 | 706 | |
| 707 | 707 | $list = array(); |
| 708 | - if(!is_array($this->contacts_arr)) { |
|
| 709 | - $this->contacts_arr = array(); |
|
| 708 | + if (!is_array($this->contacts_arr)) { |
|
| 709 | + $this->contacts_arr = array(); |
|
| 710 | 710 | } |
| 711 | 711 | |
| 712 | - if(!is_array($this->users_arr)) { |
|
| 713 | - $this->users_arr = array(); |
|
| 712 | + if (!is_array($this->users_arr)) { |
|
| 713 | + $this->users_arr = array(); |
|
| 714 | 714 | } |
| 715 | 715 | |
| 716 | - if(!is_array($this->leads_arr)) { |
|
| 717 | - $this->leads_arr = array(); |
|
| 716 | + if (!is_array($this->leads_arr)) { |
|
| 717 | + $this->leads_arr = array(); |
|
| 718 | 718 | } |
| 719 | 719 | |
| 720 | - foreach($this->users_arr as $user_id) { |
|
| 720 | + foreach ($this->users_arr as $user_id) { |
|
| 721 | 721 | $notify_user = new User(); |
| 722 | 722 | $notify_user->retrieve($user_id); |
| 723 | 723 | $notify_user->new_assigned_user_name = $notify_user->full_name; |
@@ -725,7 +725,7 @@ discard block |
||
| 725 | 725 | $list[$notify_user->id] = $notify_user; |
| 726 | 726 | } |
| 727 | 727 | |
| 728 | - foreach($this->contacts_arr as $contact_id) { |
|
| 728 | + foreach ($this->contacts_arr as $contact_id) { |
|
| 729 | 729 | $notify_user = new Contact(); |
| 730 | 730 | $notify_user->retrieve($contact_id); |
| 731 | 731 | $notify_user->new_assigned_user_name = $notify_user->full_name; |
@@ -733,7 +733,7 @@ discard block |
||
| 733 | 733 | $list[$notify_user->id] = $notify_user; |
| 734 | 734 | } |
| 735 | 735 | |
| 736 | - foreach($this->leads_arr as $lead_id) { |
|
| 736 | + foreach ($this->leads_arr as $lead_id) { |
|
| 737 | 737 | $notify_user = new Lead(); |
| 738 | 738 | $notify_user->retrieve($lead_id); |
| 739 | 739 | $notify_user->new_assigned_user_name = $notify_user->full_name; |
@@ -742,9 +742,9 @@ discard block |
||
| 742 | 742 | } |
| 743 | 743 | |
| 744 | 744 | global $sugar_config; |
| 745 | - if(isset($sugar_config['disable_notify_current_user']) && $sugar_config['disable_notify_current_user']) { |
|
| 745 | + if (isset($sugar_config['disable_notify_current_user']) && $sugar_config['disable_notify_current_user']) { |
|
| 746 | 746 | global $current_user; |
| 747 | - if(isset($list[$current_user->id])) |
|
| 747 | + if (isset($list[$current_user->id])) |
|
| 748 | 748 | unset($list[$current_user->id]); |
| 749 | 749 | } |
| 750 | 750 | return $list; |
@@ -752,7 +752,7 @@ discard block |
||
| 752 | 752 | |
| 753 | 753 | |
| 754 | 754 | function bean_implements($interface) { |
| 755 | - switch($interface) { |
|
| 755 | + switch ($interface) { |
|
| 756 | 756 | case 'ACL':return true; |
| 757 | 757 | } |
| 758 | 758 | return false; |
@@ -762,18 +762,18 @@ discard block |
||
| 762 | 762 | $array_assign = parent::listviewACLHelper(); |
| 763 | 763 | $is_owner = false; |
| 764 | 764 | $in_group = false; //SECURITY GROUPS |
| 765 | - if(!empty($this->parent_name)) { |
|
| 765 | + if (!empty($this->parent_name)) { |
|
| 766 | 766 | |
| 767 | - if(!empty($this->parent_name_owner)) { |
|
| 767 | + if (!empty($this->parent_name_owner)) { |
|
| 768 | 768 | global $current_user; |
| 769 | 769 | $is_owner = $current_user->id == $this->parent_name_owner; |
| 770 | 770 | } |
| 771 | 771 | /* BEGIN - SECURITY GROUPS */ |
| 772 | 772 | //parent_name_owner not being set for whatever reason so we need to figure this out |
| 773 | - else if(!empty($this->parent_type) && !empty($this->parent_id)) { |
|
| 773 | + else if (!empty($this->parent_type) && !empty($this->parent_id)) { |
|
| 774 | 774 | global $current_user; |
| 775 | - $parent_bean = BeanFactory::getBean($this->parent_type,$this->parent_id); |
|
| 776 | - if($parent_bean !== false) { |
|
| 775 | + $parent_bean = BeanFactory::getBean($this->parent_type, $this->parent_id); |
|
| 776 | + if ($parent_bean !== false) { |
|
| 777 | 777 | $is_owner = $current_user->id == $parent_bean->assigned_user_id; |
| 778 | 778 | } |
| 779 | 779 | } |
@@ -786,7 +786,7 @@ discard block |
||
| 786 | 786 | /** |
| 787 | 787 | if(!ACLController::moduleSupportsACL($this->parent_type) || ACLController::checkAccess($this->parent_type, 'view', $is_owner)) { |
| 788 | 788 | */ |
| 789 | - if(!ACLController::moduleSupportsACL($this->parent_type) || ACLController::checkAccess($this->parent_type, 'view', $is_owner, 'module', $in_group)){ |
|
| 789 | + if (!ACLController::moduleSupportsACL($this->parent_type) || ACLController::checkAccess($this->parent_type, 'view', $is_owner, 'module', $in_group)) { |
|
| 790 | 790 | /* END - SECURITY GROUPS */ |
| 791 | 791 | $array_assign['PARENT'] = 'a'; |
| 792 | 792 | } else { |
@@ -796,8 +796,8 @@ discard block |
||
| 796 | 796 | $is_owner = false; |
| 797 | 797 | $in_group = false; //SECURITY GROUPS |
| 798 | 798 | |
| 799 | - if(!empty($this->contact_name)) { |
|
| 800 | - if(!empty($this->contact_name_owner)) { |
|
| 799 | + if (!empty($this->contact_name)) { |
|
| 800 | + if (!empty($this->contact_name_owner)) { |
|
| 801 | 801 | global $current_user; |
| 802 | 802 | $is_owner = $current_user->id == $this->contact_name_owner; |
| 803 | 803 | } |
@@ -805,8 +805,8 @@ discard block |
||
| 805 | 805 | //contact_name_owner not being set for whatever reason so we need to figure this out |
| 806 | 806 | else { |
| 807 | 807 | global $current_user; |
| 808 | - $parent_bean = BeanFactory::getBean('Contacts',$this->contact_id); |
|
| 809 | - if($parent_bean !== false) { |
|
| 808 | + $parent_bean = BeanFactory::getBean('Contacts', $this->contact_id); |
|
| 809 | + if ($parent_bean !== false) { |
|
| 810 | 810 | $is_owner = $current_user->id == $parent_bean->assigned_user_id; |
| 811 | 811 | } |
| 812 | 812 | } |
@@ -819,7 +819,7 @@ discard block |
||
| 819 | 819 | /** |
| 820 | 820 | if(ACLController::checkAccess('Contacts', 'view', $is_owner)) { |
| 821 | 821 | */ |
| 822 | - if(ACLController::checkAccess('Contacts', 'view', $is_owner, 'module', $in_group)) { |
|
| 822 | + if (ACLController::checkAccess('Contacts', 'view', $is_owner, 'module', $in_group)) { |
|
| 823 | 823 | /* END - SECURITY GROUPS */ |
| 824 | 824 | $array_assign['CONTACT'] = 'a'; |
| 825 | 825 | } else { |
@@ -830,17 +830,17 @@ discard block |
||
| 830 | 830 | |
| 831 | 831 | |
| 832 | 832 | function save_relationship_changes($is_update, $exclude = array()) { |
| 833 | - if(empty($this->in_workflow)) { |
|
| 834 | - if(empty($this->in_import)){//if a meeting is being imported then contact_id should not be excluded |
|
| 833 | + if (empty($this->in_workflow)) { |
|
| 834 | + if (empty($this->in_import)) {//if a meeting is being imported then contact_id should not be excluded |
|
| 835 | 835 | //if the global soap_server_object variable is not empty (as in from a soap/OPI call), then process the assigned_user_id relationship, otherwise |
| 836 | 836 | //add assigned_user_id to exclude list and let the logic from MeetingFormBase determine whether assigned user id gets added to the relationship |
| 837 | - if(!empty($GLOBALS['soap_server_object'])){ |
|
| 837 | + if (!empty($GLOBALS['soap_server_object'])) { |
|
| 838 | 838 | $exclude = array('contact_id', 'user_id'); |
| 839 | - }else{ |
|
| 840 | - $exclude = array('contact_id', 'user_id','assigned_user_id'); |
|
| 839 | + } else { |
|
| 840 | + $exclude = array('contact_id', 'user_id', 'assigned_user_id'); |
|
| 841 | 841 | } |
| 842 | 842 | } |
| 843 | - else{ |
|
| 843 | + else { |
|
| 844 | 844 | $exclude = array('user_id'); |
| 845 | 845 | } |
| 846 | 846 | } |
@@ -853,14 +853,14 @@ discard block |
||
| 853 | 853 | */ |
| 854 | 854 | public function afterImportSave() |
| 855 | 855 | { |
| 856 | - if ( $this->parent_type == 'Contacts' ) { |
|
| 856 | + if ($this->parent_type == 'Contacts') { |
|
| 857 | 857 | $this->load_relationship('contacts'); |
| 858 | - if ( !$this->contacts->relationship_exists('contacts',array('id'=>$this->parent_id)) ) |
|
| 858 | + if (!$this->contacts->relationship_exists('contacts', array('id'=>$this->parent_id))) |
|
| 859 | 859 | $this->contacts->add($this->parent_id); |
| 860 | 860 | } |
| 861 | - elseif ( $this->parent_type == 'Leads' ) { |
|
| 861 | + elseif ($this->parent_type == 'Leads') { |
|
| 862 | 862 | $this->load_relationship('leads'); |
| 863 | - if ( !$this->leads->relationship_exists('leads',array('id'=>$this->parent_id)) ) |
|
| 863 | + if (!$this->leads->relationship_exists('leads', array('id'=>$this->parent_id))) |
|
| 864 | 864 | $this->leads->add($this->parent_id); |
| 865 | 865 | } |
| 866 | 866 | |
@@ -902,7 +902,7 @@ discard block |
||
| 902 | 902 | sugar_cache_put($cacheKeyName, $apiList); |
| 903 | 903 | } |
| 904 | 904 | |
| 905 | - if(!empty($value) && empty($apiList[$value])) |
|
| 905 | + if (!empty($value) && empty($apiList[$value])) |
|
| 906 | 906 | { |
| 907 | 907 | $apiList[$value] = $value; |
| 908 | 908 | } |
@@ -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(); |
@@ -15,9 +15,9 @@ |
||
| 15 | 15 | /** |
| 16 | 16 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 17 | 17 | */ |
| 18 | - function MeetingsJjwg_MapsLogicHook(){ |
|
| 18 | + function MeetingsJjwg_MapsLogicHook() { |
|
| 19 | 19 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 20 | - if(isset($GLOBALS['log'])) { |
|
| 20 | + if (isset($GLOBALS['log'])) { |
|
| 21 | 21 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 22 | 22 | } |
| 23 | 23 | else { |
@@ -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(); |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 3 | 3 | |
| 4 | 4 | /********************************************************************************* |
| 5 | 5 | * SugarCRM Community Edition is a customer relationship management program developed by |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | /** |
| 53 | 53 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 54 | 54 | */ |
| 55 | - function MeetingsViewListbytype(){ |
|
| 55 | + function MeetingsViewListbytype() { |
|
| 56 | 56 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 57 | - if(isset($GLOBALS['log'])) { |
|
| 57 | + if (isset($GLOBALS['log'])) { |
|
| 58 | 58 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 59 | 59 | } |
| 60 | 60 | else { |
@@ -64,20 +64,20 @@ discard block |
||
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | |
| 67 | - function listViewProcess(){ |
|
| 68 | - if (!$eapmBean = EAPM::getLoginInfo('IBMSmartCloud', true) ) { |
|
| 67 | + function listViewProcess() { |
|
| 68 | + if (!$eapmBean = EAPM::getLoginInfo('IBMSmartCloud', true)) { |
|
| 69 | 69 | $smarty = new Sugar_Smarty(); |
| 70 | 70 | echo $smarty->fetch('include/externalAPI/IBMSmartCloud/IBMSmartCloudSignup.'.$GLOBALS['current_language'].'.tpl'); |
| 71 | 71 | return; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | $apiName = 'IBMSmartCloud'; |
| 75 | - $api = ExternalAPIFactory::loadAPI($apiName,true); |
|
| 75 | + $api = ExternalAPIFactory::loadAPI($apiName, true); |
|
| 76 | 76 | $api->loadEAPM($eapmBean); |
| 77 | 77 | |
| 78 | 78 | $quickCheck = $api->quickCheckLogin(); |
| 79 | - if ( ! $quickCheck['success'] ) { |
|
| 80 | - $errorMessage = string_format(translate('LBL_ERR_FAILED_QUICKCHECK','EAPM'), array('IBM SmartCloud')); |
|
| 79 | + if (!$quickCheck['success']) { |
|
| 80 | + $errorMessage = string_format(translate('LBL_ERR_FAILED_QUICKCHECK', 'EAPM'), array('IBM SmartCloud')); |
|
| 81 | 81 | $errorMessage .= '<form method="POST" target="_EAPM_CHECK" action="index.php">'; |
| 82 | 82 | $errorMessage .= '<input type="hidden" name="module" value="EAPM">'; |
| 83 | 83 | $errorMessage .= '<input type="hidden" name="action" value="Save">'; |
@@ -102,18 +102,18 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | unset($this->searchForm->searchdefs['layout']['advanced_search']); |
| 104 | 104 | |
| 105 | - if(!$this->headers) { |
|
| 105 | + if (!$this->headers) { |
|
| 106 | 106 | return; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - if(empty($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] == false){ |
|
| 110 | - $this->lv->ss->assign("SEARCH",false); |
|
| 111 | - if ( !isset($_REQUEST['name_basic']) ) { |
|
| 109 | + if (empty($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] == false) { |
|
| 110 | + $this->lv->ss->assign("SEARCH", false); |
|
| 111 | + if (!isset($_REQUEST['name_basic'])) { |
|
| 112 | 112 | $_REQUEST['name_basic'] = ''; |
| 113 | 113 | } |
| 114 | - $this->lv->ss->assign('DCSEARCH',$_REQUEST['name_basic']); |
|
| 114 | + $this->lv->ss->assign('DCSEARCH', $_REQUEST['name_basic']); |
|
| 115 | 115 | $this->lv->setup($this->seed, 'include/ListView/ListViewDCMenu.tpl', $this->where, $this->params); |
| 116 | - $savedSearchName = empty($_REQUEST['saved_search_select_name']) ? '' : (' - ' . $_REQUEST['saved_search_select_name']); |
|
| 116 | + $savedSearchName = empty($_REQUEST['saved_search_select_name']) ? '' : (' - '.$_REQUEST['saved_search_select_name']); |
|
| 117 | 117 | echo $this->lv->display(); |
| 118 | 118 | } |
| 119 | 119 | } |
@@ -124,18 +124,18 @@ discard block |
||
| 124 | 124 | $_REQUEST = $oldRequest; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - function processSearchForm(){ |
|
| 127 | + function processSearchForm() { |
|
| 128 | 128 | // $type = 'LotusLiveDirect'; |
| 129 | 129 | $type = 'IBMSmartCloud'; |
| 130 | 130 | global $timedate; |
| 131 | 131 | |
| 132 | 132 | $two_hours_ago = $GLOBALS['db']->convert($GLOBALS['db']->quoted($timedate->asDb($timedate->getNow()->get("-2 hours"))), 'datetime'); |
| 133 | 133 | |
| 134 | - $where = " meetings.type = '$type' AND meetings.status != 'Held' AND meetings.status != 'Not Held' AND meetings.date_start > {$two_hours_ago} AND ( meetings.assigned_user_id = '".$GLOBALS['db']->quote($GLOBALS['current_user']->id)."' OR exists ( SELECT id FROM meetings_users WHERE meeting_id = meetings.id AND user_id = '".$GLOBALS['db']->quote($GLOBALS['current_user']->id)."' AND deleted = 0 ) ) "; |
|
| 134 | + $where = " meetings.type = '$type' AND meetings.status != 'Held' AND meetings.status != 'Not Held' AND meetings.date_start > {$two_hours_ago} AND ( meetings.assigned_user_id = '".$GLOBALS['db']->quote($GLOBALS['current_user']->id)."' OR exists ( SELECT id FROM meetings_users WHERE meeting_id = meetings.id AND user_id = '".$GLOBALS['db']->quote($GLOBALS['current_user']->id)."' AND deleted = 0 ) ) "; |
|
| 135 | 135 | |
| 136 | - if ( isset($_REQUEST['name_basic']) ) { |
|
| 136 | + if (isset($_REQUEST['name_basic'])) { |
|
| 137 | 137 | $name_search = trim($_REQUEST['name_basic']); |
| 138 | - if ( ! empty($name_search) ) { |
|
| 138 | + if (!empty($name_search)) { |
|
| 139 | 139 | $where .= " AND meetings.name LIKE '".$GLOBALS['db']->quote($name_search)."%' "; |
| 140 | 140 | } |
| 141 | 141 | } |
@@ -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(); |
@@ -14,9 +14,9 @@ discard block |
||
| 14 | 14 | /** |
| 15 | 15 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 16 | 16 | */ |
| 17 | - function MeetingsListViewSmarty(){ |
|
| 17 | + function MeetingsListViewSmarty() { |
|
| 18 | 18 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 19 | - if(isset($GLOBALS['log'])) { |
|
| 19 | + if (isset($GLOBALS['log'])) { |
|
| 20 | 20 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 21 | 21 | } |
| 22 | 22 | else { |
@@ -31,14 +31,14 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | global $app_strings; |
| 33 | 33 | |
| 34 | - $script = "<a href='javascript:void(0)' id='export_listview_top' " . |
|
| 35 | - "onclick=\"return sListView.send_form(true, '{$_REQUEST['module']}', " . |
|
| 36 | - "'index.php?entryPoint=export', " . |
|
| 37 | - "'{$app_strings['LBL_LISTVIEW_NO_SELECTED']}')\">{$app_strings['LBL_EXPORT']}</a>" . |
|
| 38 | - "</li><li>" . // List item hack |
|
| 39 | - "<a href='javascript:void(0)' id='map_listview_top' " . |
|
| 40 | - " onclick=\"return sListView.send_form(true, 'jjwg_Maps', " . |
|
| 41 | - "'index.php?entryPoint=jjwg_Maps&display_module={$_REQUEST['module']}', " . |
|
| 34 | + $script = "<a href='javascript:void(0)' id='export_listview_top' ". |
|
| 35 | + "onclick=\"return sListView.send_form(true, '{$_REQUEST['module']}', ". |
|
| 36 | + "'index.php?entryPoint=export', ". |
|
| 37 | + "'{$app_strings['LBL_LISTVIEW_NO_SELECTED']}')\">{$app_strings['LBL_EXPORT']}</a>". |
|
| 38 | + "</li><li>".// List item hack |
|
| 39 | + "<a href='javascript:void(0)' id='map_listview_top' ". |
|
| 40 | + " onclick=\"return sListView.send_form(true, 'jjwg_Maps', ". |
|
| 41 | + "'index.php?entryPoint=jjwg_Maps&display_module={$_REQUEST['module']}', ". |
|
| 42 | 42 | "'{$app_strings['LBL_LISTVIEW_NO_SELECTED']}')\">{$app_strings['LBL_MAP']}</a>"; |
| 43 | 43 | |
| 44 | 44 | return $script; |
@@ -23,8 +23,7 @@ |
||
| 23 | 23 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 24 | 24 | if(isset($GLOBALS['log'])) { |
| 25 | 25 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 26 | - } |
|
| 27 | - else { |
|
| 26 | + } else { |
|
| 28 | 27 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 29 | 28 | } |
| 30 | 29 | self::__construct($seed, $module, $subPanel, $options); |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 3 | 3 | /********************************************************************************* |
| 4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
| 5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -67,55 +67,55 @@ discard block |
||
| 67 | 67 | $replacements = array(); |
| 68 | 68 | $replacements[] = ''; |
| 69 | 69 | $replacements[] = ''; |
| 70 | - $this->idjs = preg_replace($pattern,$replacements,$this->id); |
|
| 70 | + $this->idjs = preg_replace($pattern, $replacements, $this->id); |
|
| 71 | 71 | // Add in some default categories. |
| 72 | - $this->categories['ALL'] = translate('LBL_ALL','SugarFeed'); |
|
| 72 | + $this->categories['ALL'] = translate('LBL_ALL', 'SugarFeed'); |
|
| 73 | 73 | // Need to get the rest of the active SugarFeed modules |
| 74 | 74 | $module_list = SugarFeed::getActiveFeedModules(); |
| 75 | 75 | |
| 76 | 76 | // Translate the category names |
| 77 | - if ( ! is_array($module_list) ) { $module_list = array(); } |
|
| 78 | - foreach ( $module_list as $module ) { |
|
| 79 | - if ( $module == 'UserFeed' ) { |
|
| 77 | + if (!is_array($module_list)) { $module_list = array(); } |
|
| 78 | + foreach ($module_list as $module) { |
|
| 79 | + if ($module == 'UserFeed') { |
|
| 80 | 80 | // Fake module, need to translate specially |
| 81 | - $this->categories[$module] = translate('LBL_USER_FEED','SugarFeed'); |
|
| 81 | + $this->categories[$module] = translate('LBL_USER_FEED', 'SugarFeed'); |
|
| 82 | 82 | } else { |
| 83 | 83 | $this->categories[$module] = $app_list_strings['moduleList'][$module]; |
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | // Need to add the external api's here |
| 88 | - $this->externalAPIList = ExternalAPIFactory::getModuleDropDown('SugarFeed',true); |
|
| 89 | - if ( !is_array($this->externalAPIList) ) { $this->externalAPIList = array(); } |
|
| 90 | - foreach ( $this->externalAPIList as $apiObj => $apiName ) { |
|
| 88 | + $this->externalAPIList = ExternalAPIFactory::getModuleDropDown('SugarFeed', true); |
|
| 89 | + if (!is_array($this->externalAPIList)) { $this->externalAPIList = array(); } |
|
| 90 | + foreach ($this->externalAPIList as $apiObj => $apiName) { |
|
| 91 | 91 | $this->categories[$apiObj] = $apiName; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | |
| 95 | - if(empty($def['title'])) $this->title = translate('LBL_HOMEPAGE_TITLE', 'SugarFeed'); |
|
| 96 | - if(!empty($def['rows']))$this->displayRows = $def['rows']; |
|
| 97 | - if(!empty($def['categories']))$this->selectedCategories = $def['categories']; |
|
| 98 | - if(!empty($def['userfeed_created'])) $this->userfeed_created = $def['userfeed_created']; |
|
| 95 | + if (empty($def['title'])) $this->title = translate('LBL_HOMEPAGE_TITLE', 'SugarFeed'); |
|
| 96 | + if (!empty($def['rows']))$this->displayRows = $def['rows']; |
|
| 97 | + if (!empty($def['categories']))$this->selectedCategories = $def['categories']; |
|
| 98 | + if (!empty($def['userfeed_created'])) $this->userfeed_created = $def['userfeed_created']; |
|
| 99 | 99 | $this->searchFields = $dashletData['SugarFeedDashlet']['searchFields']; |
| 100 | 100 | $this->columns = $dashletData['SugarFeedDashlet']['columns']; |
| 101 | 101 | |
| 102 | 102 | $twitter_enabled = $this->check_enabled('twitter'); |
| 103 | 103 | $facebook_enabled = $this->check_enabled('facebook'); |
| 104 | 104 | |
| 105 | - if($facebook_enabled){ |
|
| 105 | + if ($facebook_enabled) { |
|
| 106 | 106 | $this->categories["Facebook"] = "Facebook"; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - if($twitter_enabled){ |
|
| 109 | + if ($twitter_enabled) { |
|
| 110 | 110 | $this->categories["Twitter"] = "Twitter"; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | $catCount = count($this->categories); |
| 114 | 114 | ACLController::filterModuleList($this->categories, false); |
| 115 | - if(count($this->categories) < $catCount){ |
|
| 116 | - if(!empty($this->selectedCategories)){ |
|
| 115 | + if (count($this->categories) < $catCount) { |
|
| 116 | + if (!empty($this->selectedCategories)) { |
|
| 117 | 117 | ACLController::filterModuleList($this->selectedCategories, true); |
| 118 | - }else{ |
|
| 118 | + } else { |
|
| 119 | 119 | $this->selectedCategories = array_keys($this->categories); |
| 120 | 120 | unset($this->selectedCategories[0]); |
| 121 | 121 | } |
@@ -126,9 +126,9 @@ discard block |
||
| 126 | 126 | /** |
| 127 | 127 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 128 | 128 | */ |
| 129 | - function SugarFeedDashlet($id, $def = null){ |
|
| 129 | + function SugarFeedDashlet($id, $def = null) { |
|
| 130 | 130 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 131 | - if(isset($GLOBALS['log'])) { |
|
| 131 | + if (isset($GLOBALS['log'])) { |
|
| 132 | 132 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 133 | 133 | } |
| 134 | 134 | else { |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | $lvsParams['massupdate'] = false; |
| 148 | 148 | |
| 149 | 149 | // apply filters |
| 150 | - if(isset($this->filters) || $this->myItemsOnly) { |
|
| 150 | + if (isset($this->filters) || $this->myItemsOnly) { |
|
| 151 | 151 | $whereArray = $this->buildWhere(); |
| 152 | 152 | } |
| 153 | 153 | |
@@ -155,8 +155,8 @@ discard block |
||
| 155 | 155 | $this->lvs->multiSelect = false; |
| 156 | 156 | $this->lvs->quickViewLinks = false; |
| 157 | 157 | // columns |
| 158 | - foreach($this->columns as $name => $val) { |
|
| 159 | - if(!empty($val['default']) && $val['default']) { |
|
| 158 | + foreach ($this->columns as $name => $val) { |
|
| 159 | + if (!empty($val['default']) && $val['default']) { |
|
| 160 | 160 | $displayColumns[strtoupper($name)] = $val; |
| 161 | 161 | $displayColumns[strtoupper($name)]['label'] = trim($displayColumns[strtoupper($name)]['label'], ':'); |
| 162 | 162 | } |
@@ -173,39 +173,39 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | |
| 175 | 175 | // Get the real module list |
| 176 | - if (empty($this->selectedCategories)){ |
|
| 176 | + if (empty($this->selectedCategories)) { |
|
| 177 | 177 | $mod_list = $this->categories; |
| 178 | 178 | } else { |
| 179 | - $mod_list = array_flip($this->selectedCategories);//27949, here the key of $this->selectedCategories is not module name, the value is module name, so array_flip it. |
|
| 179 | + $mod_list = array_flip($this->selectedCategories); //27949, here the key of $this->selectedCategories is not module name, the value is module name, so array_flip it. |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | $external_modules = array(); |
| 183 | 183 | $admin_modules = array(); |
| 184 | 184 | $owner_modules = array(); |
| 185 | 185 | $regular_modules = array(); |
| 186 | - foreach($mod_list as $module => $ignore) { |
|
| 186 | + foreach ($mod_list as $module => $ignore) { |
|
| 187 | 187 | // Handle the UserFeed differently |
| 188 | - if ( $module == 'UserFeed') { |
|
| 188 | + if ($module == 'UserFeed') { |
|
| 189 | 189 | $regular_modules[] = 'UserFeed'; |
| 190 | 190 | continue; |
| 191 | 191 | } |
| 192 | - if($module == 'Facebook'){ |
|
| 192 | + if ($module == 'Facebook') { |
|
| 193 | 193 | $regular_modules[] = "Facebook"; |
| 194 | 194 | continue; |
| 195 | 195 | } |
| 196 | - if($module == 'Twitter'){ |
|
| 196 | + if ($module == 'Twitter') { |
|
| 197 | 197 | $regular_modules[] = 'Twitter'; |
| 198 | 198 | continue; |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | - if ( in_array($module,$this->externalAPIList) ) { |
|
| 201 | + if (in_array($module, $this->externalAPIList)) { |
|
| 202 | 202 | $external_modules[] = $module; |
| 203 | 203 | } |
| 204 | - if (ACLAction::getUserAccessLevel($current_user->id,$module,'view') <= ACL_ALLOW_NONE ) { |
|
| 204 | + if (ACLAction::getUserAccessLevel($current_user->id, $module, 'view') <= ACL_ALLOW_NONE) { |
|
| 205 | 205 | // Not enough access to view any records, don't add it to any lists |
| 206 | 206 | continue; |
| 207 | 207 | } |
| 208 | - if ( ACLAction::getUserAccessLevel($current_user->id,$module,'view') == ACL_ALLOW_OWNER ) { |
|
| 208 | + if (ACLAction::getUserAccessLevel($current_user->id, $module, 'view') == ACL_ALLOW_OWNER) { |
|
| 209 | 209 | $owner_modules[] = $module; |
| 210 | 210 | } else { |
| 211 | 211 | $regular_modules[] = $module; |
@@ -215,41 +215,41 @@ discard block |
||
| 215 | 215 | |
| 216 | 216 | |
| 217 | 217 | |
| 218 | - if(!empty($this->displayTpl)) |
|
| 218 | + if (!empty($this->displayTpl)) |
|
| 219 | 219 | { |
| 220 | 220 | //MFH BUG #14296 |
| 221 | 221 | $where = ''; |
| 222 | - if(!empty($whereArray)){ |
|
| 223 | - $where = '(' . implode(') AND (', $whereArray) . ')'; |
|
| 222 | + if (!empty($whereArray)) { |
|
| 223 | + $where = '('.implode(') AND (', $whereArray).')'; |
|
| 224 | 224 | |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | $additional_where = ''; |
| 228 | 228 | |
| 229 | 229 | |
| 230 | - $module_limiter = " sugarfeed.related_module in ('" . implode("','", $regular_modules) . "')"; |
|
| 230 | + $module_limiter = " sugarfeed.related_module in ('".implode("','", $regular_modules)."')"; |
|
| 231 | 231 | |
| 232 | - if( is_admin($GLOBALS['current_user'] ) ) |
|
| 232 | + if (is_admin($GLOBALS['current_user'])) |
|
| 233 | 233 | { |
| 234 | 234 | $all_modules = array_merge($regular_modules, $owner_modules, $admin_modules); |
| 235 | - $module_limiter = " sugarfeed.related_module in ('" . implode("','", $all_modules) . "')"; |
|
| 235 | + $module_limiter = " sugarfeed.related_module in ('".implode("','", $all_modules)."')"; |
|
| 236 | 236 | } |
| 237 | - else if ( count($owner_modules) > 0 |
|
| 237 | + else if (count($owner_modules) > 0 |
|
| 238 | 238 | ) { |
| 239 | 239 | $module_limiter = " ((sugarfeed.related_module IN ('".implode("','", $regular_modules)."') " |
| 240 | 240 | .") "; |
| 241 | - if ( count($owner_modules) > 0 ) { |
|
| 241 | + if (count($owner_modules) > 0) { |
|
| 242 | 242 | $module_limiter .= "OR (sugarfeed.related_module IN('".implode("','", $owner_modules)."') AND sugarfeed.assigned_user_id = '".$current_user->id."' " |
| 243 | 243 | .") "; |
| 244 | 244 | } |
| 245 | 245 | $module_limiter .= ")"; |
| 246 | 246 | } |
| 247 | - if(!empty($where)) { $where .= ' AND '; } |
|
| 247 | + if (!empty($where)) { $where .= ' AND '; } |
|
| 248 | 248 | |
| 249 | 249 | |
| 250 | 250 | $where .= $module_limiter; |
| 251 | 251 | |
| 252 | - $this->lvs->setup($this->seedBean, $this->displayTpl, $where , $lvsParams, 0, $this->displayRows, |
|
| 252 | + $this->lvs->setup($this->seedBean, $this->displayTpl, $where, $lvsParams, 0, $this->displayRows, |
|
| 253 | 253 | array('name', |
| 254 | 254 | 'description', |
| 255 | 255 | 'date_entered', |
@@ -266,35 +266,35 @@ discard block |
||
| 266 | 266 | 'link_url', |
| 267 | 267 | 'link_type')); |
| 268 | 268 | |
| 269 | - foreach($this->lvs->data['data'] as $row => $data) { |
|
| 269 | + foreach ($this->lvs->data['data'] as $row => $data) { |
|
| 270 | 270 | |
| 271 | - $this->lvs->data['data'][$row]['NAME'] = str_replace("{this.CREATED_BY}",get_assigned_user_name($this->lvs->data['data'][$row]['CREATED_BY']),$data['NAME']); |
|
| 271 | + $this->lvs->data['data'][$row]['NAME'] = str_replace("{this.CREATED_BY}", get_assigned_user_name($this->lvs->data['data'][$row]['CREATED_BY']), $data['NAME']); |
|
| 272 | 272 | |
| 273 | 273 | //Translate the SugarFeeds labels if necessary. |
| 274 | - preg_match('/\{([^\^ }]+)\.([^\}]+)\}/', $this->lvs->data['data'][$row]['NAME'] ,$modStringMatches ); |
|
| 275 | - if(count($modStringMatches) == 3 && $modStringMatches[1] == 'SugarFeed' && !empty($data['RELATED_MODULE']) ) |
|
| 274 | + preg_match('/\{([^\^ }]+)\.([^\}]+)\}/', $this->lvs->data['data'][$row]['NAME'], $modStringMatches); |
|
| 275 | + if (count($modStringMatches) == 3 && $modStringMatches[1] == 'SugarFeed' && !empty($data['RELATED_MODULE'])) |
|
| 276 | 276 | { |
| 277 | 277 | $modKey = $modStringMatches[2]; |
| 278 | 278 | $modString = translate($modKey, $modStringMatches[1]); |
| 279 | - if( strpos($modString, '{0}') === FALSE || !isset($GLOBALS['app_list_strings']['moduleListSingular'][$data['RELATED_MODULE']]) ) |
|
| 279 | + if (strpos($modString, '{0}') === FALSE || !isset($GLOBALS['app_list_strings']['moduleListSingular'][$data['RELATED_MODULE']])) |
|
| 280 | 280 | continue; |
| 281 | 281 | |
| 282 | 282 | $modStringSingular = $GLOBALS['app_list_strings']['moduleListSingular'][$data['RELATED_MODULE']]; |
| 283 | - $modString = string_format($modString, array($modStringSingular) ); |
|
| 284 | - $this->lvs->data['data'][$row]['NAME'] = preg_replace('/' . $modStringMatches[0] . '/', strtolower($modString), $this->lvs->data['data'][$row]['NAME']); |
|
| 283 | + $modString = string_format($modString, array($modStringSingular)); |
|
| 284 | + $this->lvs->data['data'][$row]['NAME'] = preg_replace('/'.$modStringMatches[0].'/', strtolower($modString), $this->lvs->data['data'][$row]['NAME']); |
|
| 285 | 285 | } |
| 286 | 286 | //if social then unless the user is the assigned user it wont show. IJD1986 |
| 287 | - if(($data['RELATED_MODULE'] == "facebook" || $data['RELATED_MODULE'] == "twitter" ) && $data['ASSIGNED_USER_ID'] != $current_user->id){ |
|
| 287 | + if (($data['RELATED_MODULE'] == "facebook" || $data['RELATED_MODULE'] == "twitter") && $data['ASSIGNED_USER_ID'] != $current_user->id) { |
|
| 288 | 288 | unset($this->lvs->data['data'][$row]); |
| 289 | 289 | } |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | // assign a baseURL w/ the action set as DisplayDashlet |
| 293 | - foreach($this->lvs->data['pageData']['urls'] as $type => $url) { |
|
| 293 | + foreach ($this->lvs->data['pageData']['urls'] as $type => $url) { |
|
| 294 | 294 | // awu Replacing action=DisplayDashlet with action=DynamicAction&DynamicAction=DisplayDashlet |
| 295 | 295 | $this->lvs->data['pageData']['urls'][$type] = $url.'&action=DynamicAction&DynamicAction=displayDashlet'; |
| 296 | - if($type != 'orderBy') |
|
| 297 | - $this->lvs->data['pageData']['urls'][$type] = $url.'&action=DynamicAction&DynamicAction=displayDashlet&sugar_body_only=1&id=' . $this->id; |
|
| 296 | + if ($type != 'orderBy') |
|
| 297 | + $this->lvs->data['pageData']['urls'][$type] = $url.'&action=DynamicAction&DynamicAction=displayDashlet&sugar_body_only=1&id='.$this->id; |
|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | $this->lvs->ss->assign('dashletId', $this->id); |
@@ -309,27 +309,27 @@ discard block |
||
| 309 | 309 | |
| 310 | 310 | $fetchRecordCount = $this->displayRows + $this->lvs->data['pageData']['offsets']['current']; |
| 311 | 311 | |
| 312 | - foreach ( $external_modules as $apiName ) { |
|
| 312 | + foreach ($external_modules as $apiName) { |
|
| 313 | 313 | $api = ExternalAPIFactory::loadAPI($apiName); |
| 314 | - if ( $api !== FALSE ) { |
|
| 314 | + if ($api !== FALSE) { |
|
| 315 | 315 | // FIXME: Actually calculate the oldest sugar feed we can see, once we get an API that supports this sort of filter. |
| 316 | - $reply = $api->getLatestUpdates(0,$fetchRecordCount); |
|
| 317 | - if ( $reply['success'] && count($reply['messages']) > 0 ) { |
|
| 316 | + $reply = $api->getLatestUpdates(0, $fetchRecordCount); |
|
| 317 | + if ($reply['success'] && count($reply['messages']) > 0) { |
|
| 318 | 318 | array_splice($resortQueue, count($resortQueue), 0, $reply['messages']); |
| 319 | - } else if ( !$reply['success'] ) { |
|
| 319 | + } else if (!$reply['success']) { |
|
| 320 | 320 | $feedErrors[] = $reply['errorMessage']; |
| 321 | 321 | } |
| 322 | 322 | } |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | - if ( count($feedErrors) > 0 ) { |
|
| 326 | - $this->lvs->ss->assign('feedErrors',$feedErrors); |
|
| 325 | + if (count($feedErrors) > 0) { |
|
| 326 | + $this->lvs->ss->assign('feedErrors', $feedErrors); |
|
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | // If we need to resort, get to work! |
| 330 | - foreach ( $this->lvs->data['data'] as $normalMessage ) { |
|
| 331 | - list($user_date,$user_time) = explode(' ',$normalMessage['DATE_ENTERED']); |
|
| 332 | - list($db_date,$db_time) = $td->to_db_date_time($user_date,$user_time); |
|
| 330 | + foreach ($this->lvs->data['data'] as $normalMessage) { |
|
| 331 | + list($user_date, $user_time) = explode(' ', $normalMessage['DATE_ENTERED']); |
|
| 332 | + list($db_date, $db_time) = $td->to_db_date_time($user_date, $user_time); |
|
| 333 | 333 | |
| 334 | 334 | $unix_timestamp = strtotime($db_date.' '.$db_time); |
| 335 | 335 | |
@@ -339,31 +339,31 @@ discard block |
||
| 339 | 339 | $resortQueue[] = $normalMessage; |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | - usort($resortQueue,create_function('$a,$b','return $a["sort_key"]<$b["sort_key"];')); |
|
| 342 | + usort($resortQueue, create_function('$a,$b', 'return $a["sort_key"]<$b["sort_key"];')); |
|
| 343 | 343 | |
| 344 | 344 | // Trim it down to the necessary number of records |
| 345 | 345 | $numRecords = count($resortQueue); |
| 346 | 346 | $numRecords = $numRecords - $this->lvs->data['pageData']['offsets']['current']; |
| 347 | - $numRecords = min($this->displayRows,$numRecords); |
|
| 347 | + $numRecords = min($this->displayRows, $numRecords); |
|
| 348 | 348 | |
| 349 | 349 | $this->lvs->data['data'] = $resortQueue; |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | function deleteUserFeed() { |
| 353 | - if(!empty($_REQUEST['record'])) { |
|
| 353 | + if (!empty($_REQUEST['record'])) { |
|
| 354 | 354 | $feed = new SugarFeed(); |
| 355 | 355 | $feed->retrieve($_REQUEST['record']); |
| 356 | - if(is_admin($GLOBALS['current_user']) || $feed->created_by == $GLOBALS['current_user']->id){ |
|
| 356 | + if (is_admin($GLOBALS['current_user']) || $feed->created_by == $GLOBALS['current_user']->id) { |
|
| 357 | 357 | $feed->mark_deleted($_REQUEST['record']); |
| 358 | 358 | |
| 359 | 359 | } |
| 360 | 360 | } |
| 361 | 361 | } |
| 362 | 362 | function pushUserFeed() { |
| 363 | - if(!empty($_REQUEST['text']) || (!empty($_REQUEST['link_url']) && !empty($_REQUEST['link_type']))) { |
|
| 363 | + if (!empty($_REQUEST['text']) || (!empty($_REQUEST['link_url']) && !empty($_REQUEST['link_type']))) { |
|
| 364 | 364 | $text = htmlspecialchars($_REQUEST['text']); |
| 365 | 365 | //allow for bold and italic user tags |
| 366 | - $text = preg_replace('/&lt;(\/*[bi])&gt;/i','<$1>', $text); |
|
| 366 | + $text = preg_replace('/&lt;(\/*[bi])&gt;/i', '<$1>', $text); |
|
| 367 | 367 | SugarFeed::pushFeed($text, 'UserFeed', $GLOBALS['current_user']->id, |
| 368 | 368 | $GLOBALS['current_user']->id, |
| 369 | 369 | $_REQUEST['link_type'], $_REQUEST['link_url'] |
@@ -373,10 +373,10 @@ discard block |
||
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | function pushUserFeedReply( ) { |
| 376 | - if(!empty($_REQUEST['text'])&&!empty($_REQUEST['parentFeed'])) { |
|
| 376 | + if (!empty($_REQUEST['text']) && !empty($_REQUEST['parentFeed'])) { |
|
| 377 | 377 | $text = htmlspecialchars($_REQUEST['text']); |
| 378 | 378 | //allow for bold and italic user tags |
| 379 | - $text = preg_replace('/&lt;(\/*[bi])&gt;/i','<$1>', $text); |
|
| 379 | + $text = preg_replace('/&lt;(\/*[bi])&gt;/i', '<$1>', $text); |
|
| 380 | 380 | SugarFeed::pushFeed($text, 'SugarFeed', $_REQUEST['parentFeed'], |
| 381 | 381 | $GLOBALS['current_user']->id, |
| 382 | 382 | '', '' |
@@ -397,22 +397,22 @@ discard block |
||
| 397 | 397 | $ss->assign('clearLBL', $app_strings['LBL_CLEAR_BUTTON_LABEL']); |
| 398 | 398 | $ss->assign('title', $this->title); |
| 399 | 399 | $ss->assign('categories', $this->categories); |
| 400 | - if ( empty($this->selectedCategories) ) { |
|
| 400 | + if (empty($this->selectedCategories)) { |
|
| 401 | 401 | $this->selectedCategories['ALL'] = 'ALL'; |
| 402 | 402 | } |
| 403 | 403 | $ss->assign('selectedCategories', $this->selectedCategories); |
| 404 | 404 | $ss->assign('rows', $this->displayRows); |
| 405 | 405 | $externalApis = array(); |
| 406 | - foreach ( $this->externalAPIList as $apiObj => $apiName ) { |
|
| 406 | + foreach ($this->externalAPIList as $apiObj => $apiName) { |
|
| 407 | 407 | //only show external APis that the user has not created |
| 408 | - if ( ! EAPM::getLoginInfo($apiName) ) { |
|
| 408 | + if (!EAPM::getLoginInfo($apiName)) { |
|
| 409 | 409 | $externalApis[] = $apiObj; |
| 410 | 410 | } |
| 411 | 411 | } |
| 412 | 412 | $ss->assign('externalApiList', JSON::encode($externalApis)); |
| 413 | 413 | $ss->assign('authenticateLBL', translate('LBL_AUTHENTICATE', 'SugarFeed')); |
| 414 | 414 | $ss->assign('id', $this->id); |
| 415 | - if($this->isAutoRefreshable()) { |
|
| 415 | + if ($this->isAutoRefreshable()) { |
|
| 416 | 416 | $ss->assign('isRefreshable', true); |
| 417 | 417 | $ss->assign('autoRefresh', $GLOBALS['app_strings']['LBL_DASHLET_CONFIGURE_AUTOREFRESH']); |
| 418 | 418 | $ss->assign('autoRefreshOptions', $this->getAutoRefreshOptions()); |
@@ -432,18 +432,18 @@ discard block |
||
| 432 | 432 | $options = array(); |
| 433 | 433 | $options['title'] = $req['title']; |
| 434 | 434 | $rows = intval($_REQUEST['rows']); |
| 435 | - if($rows <= 0) { |
|
| 435 | + if ($rows <= 0) { |
|
| 436 | 436 | $rows = 15; |
| 437 | 437 | } |
| 438 | - if($rows > 100){ |
|
| 438 | + if ($rows > 100) { |
|
| 439 | 439 | $rows = 100; |
| 440 | 440 | } |
| 441 | - if ( isset($req['autoRefresh']) ) |
|
| 441 | + if (isset($req['autoRefresh'])) |
|
| 442 | 442 | $options['autoRefresh'] = $req['autoRefresh']; |
| 443 | 443 | $options['rows'] = $rows; |
| 444 | 444 | $options['categories'] = $req['categories']; |
| 445 | - foreach($options['categories'] as $cat){ |
|
| 446 | - if($cat == 'ALL'){ |
|
| 445 | + foreach ($options['categories'] as $cat) { |
|
| 446 | + if ($cat == 'ALL') { |
|
| 447 | 447 | unset($options['categories']); |
| 448 | 448 | } |
| 449 | 449 | } |
@@ -479,14 +479,14 @@ discard block |
||
| 479 | 479 | * |
| 480 | 480 | * @return the fully rendered dashlet |
| 481 | 481 | */ |
| 482 | - function display(){ |
|
| 482 | + function display() { |
|
| 483 | 483 | |
| 484 | 484 | $listview = parent::display(); |
| 485 | 485 | $GLOBALS['current_sugarfeed'] = $this; |
| 486 | 486 | $listview = preg_replace_callback('/\{([^\^ }]+)\.([^\}]+)\}/', create_function( |
| 487 | 487 | '$matches', |
| 488 | 488 | 'if($matches[1] == "this"){$var = $matches[2]; return $GLOBALS[\'current_sugarfeed\']->$var;}else{return translate($matches[2], $matches[1]);}' |
| 489 | - ),$listview); |
|
| 489 | + ), $listview); |
|
| 490 | 490 | |
| 491 | 491 | |
| 492 | 492 | //grab each token and store the module for later processing |
@@ -498,10 +498,10 @@ discard block |
||
| 498 | 498 | |
| 499 | 499 | //process each module for the singular version so we can populate the alt tag on the image |
| 500 | 500 | $altStrings = array(); |
| 501 | - foreach($alt_modules[1] as $alt){ |
|
| 501 | + foreach ($alt_modules[1] as $alt) { |
|
| 502 | 502 | //create the alt string and replace the alt token |
| 503 | - $altString = 'alt="'.translate('LBL_VIEW','SugarFeed').' '.$GLOBALS['app_list_strings']['moduleListSingular'][$alt].'"'; |
|
| 504 | - $listview = preg_replace('/REPLACE_ALT/', $altString, $listview,1); |
|
| 503 | + $altString = 'alt="'.translate('LBL_VIEW', 'SugarFeed').' '.$GLOBALS['app_list_strings']['moduleListSingular'][$alt].'"'; |
|
| 504 | + $listview = preg_replace('/REPLACE_ALT/', $altString, $listview, 1); |
|
| 505 | 505 | } |
| 506 | 506 | |
| 507 | 507 | |
@@ -516,8 +516,8 @@ discard block |
||
| 516 | 516 | * @return the title and the user post form |
| 517 | 517 | * @param $text Object |
| 518 | 518 | */ |
| 519 | - function getHeader($text='') { |
|
| 520 | - return parent::getHeader($text) . $this->getPostForm().$this->getDisabledWarning().$this->sugarFeedDisplayScript().'<div class="sugarFeedDashlet"><div id="contentScroller'.$this->idjs.'">'; |
|
| 519 | + function getHeader($text = '') { |
|
| 520 | + return parent::getHeader($text).$this->getPostForm().$this->getDisabledWarning().$this->sugarFeedDisplayScript().'<div class="sugarFeedDashlet"><div id="contentScroller'.$this->idjs.'">'; |
|
| 521 | 521 | } |
| 522 | 522 | |
| 523 | 523 | |
@@ -525,11 +525,11 @@ discard block |
||
| 525 | 525 | * |
| 526 | 526 | * @return a warning message if the sugar feed system is not enabled currently |
| 527 | 527 | */ |
| 528 | - function getDisabledWarning(){ |
|
| 528 | + function getDisabledWarning() { |
|
| 529 | 529 | /* Check to see if the sugar feed system is enabled */ |
| 530 | - if ( ! $this->shouldDisplay() ) { |
|
| 530 | + if (!$this->shouldDisplay()) { |
|
| 531 | 531 | // The Sugar Feeds are disabled, populate the warning message |
| 532 | - return translate('LBL_DASHLET_DISABLED','SugarFeed'); |
|
| 532 | + return translate('LBL_DASHLET_DISABLED', 'SugarFeed'); |
|
| 533 | 533 | } else { |
| 534 | 534 | return ''; |
| 535 | 535 | } |
@@ -539,17 +539,17 @@ discard block |
||
| 539 | 539 | * |
| 540 | 540 | * @return the form for users posting custom messages to the feed stream |
| 541 | 541 | */ |
| 542 | - function getPostForm(){ |
|
| 542 | + function getPostForm() { |
|
| 543 | 543 | global $current_user; |
| 544 | 544 | |
| 545 | - if ( (!empty($this->selectedCategories) && !in_array('UserFeed',$this->selectedCategories)) |
|
| 545 | + if ((!empty($this->selectedCategories) && !in_array('UserFeed', $this->selectedCategories)) |
|
| 546 | 546 | ) { |
| 547 | 547 | // The user feed system isn't enabled, don't let them post notes |
| 548 | 548 | return ''; |
| 549 | 549 | } |
| 550 | 550 | $user_name = ucfirst($GLOBALS['current_user']->user_name); |
| 551 | - $moreimg = SugarThemeRegistry::current()->getImage('advanced_search' , 'onclick="toggleDisplay(\'more_' . $this->id . '\'); toggleDisplay(\'more_img_'.$this->id.'\'); toggleDisplay(\'less_img_'.$this->id.'\');"',null,null,'.gif',translate('LBL_SHOW_MORE_OPTIONS','SugarFeed')); |
|
| 552 | - $lessimg = SugarThemeRegistry::current()->getImage('basic_search' , 'onclick="toggleDisplay(\'more_' . $this->id . '\'); toggleDisplay(\'more_img_'.$this->id.'\'); toggleDisplay(\'less_img_'.$this->id.'\');"',null,null,'.gif',translate('LBL_HIDE_OPTIONS','SugarFeed')); |
|
| 551 | + $moreimg = SugarThemeRegistry::current()->getImage('advanced_search', 'onclick="toggleDisplay(\'more_'.$this->id.'\'); toggleDisplay(\'more_img_'.$this->id.'\'); toggleDisplay(\'less_img_'.$this->id.'\');"', null, null, '.gif', translate('LBL_SHOW_MORE_OPTIONS', 'SugarFeed')); |
|
| 552 | + $lessimg = SugarThemeRegistry::current()->getImage('basic_search', 'onclick="toggleDisplay(\'more_'.$this->id.'\'); toggleDisplay(\'more_img_'.$this->id.'\'); toggleDisplay(\'less_img_'.$this->id.'\');"', null, null, '.gif', translate('LBL_HIDE_OPTIONS', 'SugarFeed')); |
|
| 553 | 553 | $ss = new Sugar_Smarty(); |
| 554 | 554 | $ss->assign('LBL_TO', translate('LBL_TO', 'SugarFeed')); |
| 555 | 555 | $ss->assign('LBL_POST', translate('LBL_POST', 'SugarFeed')); |
@@ -560,9 +560,9 @@ discard block |
||
| 560 | 560 | $ss->assign('less_img', $lessimg); |
| 561 | 561 | |
| 562 | 562 | include_once("include/social/get_feed_data.php"); |
| 563 | - $ss->assign('facebook', $html ); |
|
| 563 | + $ss->assign('facebook', $html); |
|
| 564 | 564 | |
| 565 | - if($current_user->getPreference('use_real_names') == 'on'){ |
|
| 565 | + if ($current_user->getPreference('use_real_names') == 'on') { |
|
| 566 | 566 | $ss->assign('user_name', $current_user->full_name); |
| 567 | 567 | } |
| 568 | 568 | else { |
@@ -570,8 +570,8 @@ discard block |
||
| 570 | 570 | } |
| 571 | 571 | $linkTypesIn = SugarFeed::getLinkTypes(); |
| 572 | 572 | $linkTypes = array(); |
| 573 | - foreach ( $linkTypesIn as $key => $value ) { |
|
| 574 | - $linkTypes[$key] = translate('LBL_LINK_TYPE_'.$value,'SugarFeed'); |
|
| 573 | + foreach ($linkTypesIn as $key => $value) { |
|
| 574 | + $linkTypes[$key] = translate('LBL_LINK_TYPE_'.$value, 'SugarFeed'); |
|
| 575 | 575 | } |
| 576 | 576 | $ss->assign('link_types', $linkTypes); |
| 577 | 577 | |
@@ -586,16 +586,16 @@ discard block |
||
| 586 | 586 | $admin = new Administration(); |
| 587 | 587 | $admin->retrieveSettings(); |
| 588 | 588 | |
| 589 | - if ( !isset($admin->settings['sugarfeed_enabled']) || $admin->settings['sugarfeed_enabled'] != '1' ) { |
|
| 589 | + if (!isset($admin->settings['sugarfeed_enabled']) || $admin->settings['sugarfeed_enabled'] != '1') { |
|
| 590 | 590 | return false; |
| 591 | 591 | } else { |
| 592 | 592 | return true; |
| 593 | 593 | } |
| 594 | 594 | } |
| 595 | 595 | |
| 596 | - function check_enabled($type){ |
|
| 596 | + function check_enabled($type) { |
|
| 597 | 597 | global $db; |
| 598 | - $query = "SELECT * FROM config where name = 'module_" .$type . "' and value = 1;"; |
|
| 598 | + $query = "SELECT * FROM config where name = 'module_".$type."' and value = 1;"; |
|
| 599 | 599 | $results = $db->query($query); |
| 600 | 600 | |
| 601 | 601 | while ($row = $db->fetchByAssoc($results)) { |
@@ -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. |
@@ -92,10 +94,18 @@ discard block |
||
| 92 | 94 | } |
| 93 | 95 | |
| 94 | 96 | |
| 95 | - if(empty($def['title'])) $this->title = translate('LBL_HOMEPAGE_TITLE', 'SugarFeed'); |
|
| 96 | - if(!empty($def['rows']))$this->displayRows = $def['rows']; |
|
| 97 | - if(!empty($def['categories']))$this->selectedCategories = $def['categories']; |
|
| 98 | - if(!empty($def['userfeed_created'])) $this->userfeed_created = $def['userfeed_created']; |
|
| 97 | + if(empty($def['title'])) { |
|
| 98 | + $this->title = translate('LBL_HOMEPAGE_TITLE', 'SugarFeed'); |
|
| 99 | + } |
|
| 100 | + if(!empty($def['rows'])) { |
|
| 101 | + $this->displayRows = $def['rows']; |
|
| 102 | + } |
|
| 103 | + if(!empty($def['categories'])) { |
|
| 104 | + $this->selectedCategories = $def['categories']; |
|
| 105 | + } |
|
| 106 | + if(!empty($def['userfeed_created'])) { |
|
| 107 | + $this->userfeed_created = $def['userfeed_created']; |
|
| 108 | + } |
|
| 99 | 109 | $this->searchFields = $dashletData['SugarFeedDashlet']['searchFields']; |
| 100 | 110 | $this->columns = $dashletData['SugarFeedDashlet']['columns']; |
| 101 | 111 | |
@@ -115,7 +125,7 @@ discard block |
||
| 115 | 125 | if(count($this->categories) < $catCount){ |
| 116 | 126 | if(!empty($this->selectedCategories)){ |
| 117 | 127 | ACLController::filterModuleList($this->selectedCategories, true); |
| 118 | - }else{ |
|
| 128 | + } else{ |
|
| 119 | 129 | $this->selectedCategories = array_keys($this->categories); |
| 120 | 130 | unset($this->selectedCategories[0]); |
| 121 | 131 | } |
@@ -130,8 +140,7 @@ discard block |
||
| 130 | 140 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 131 | 141 | if(isset($GLOBALS['log'])) { |
| 132 | 142 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 133 | - } |
|
| 134 | - else { |
|
| 143 | + } else { |
|
| 135 | 144 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 136 | 145 | } |
| 137 | 146 | self::__construct($id, $def); |
@@ -233,8 +242,7 @@ discard block |
||
| 233 | 242 | { |
| 234 | 243 | $all_modules = array_merge($regular_modules, $owner_modules, $admin_modules); |
| 235 | 244 | $module_limiter = " sugarfeed.related_module in ('" . implode("','", $all_modules) . "')"; |
| 236 | - } |
|
| 237 | - else if ( count($owner_modules) > 0 |
|
| 245 | + } else if ( count($owner_modules) > 0 |
|
| 238 | 246 | ) { |
| 239 | 247 | $module_limiter = " ((sugarfeed.related_module IN ('".implode("','", $regular_modules)."') " |
| 240 | 248 | .") "; |
@@ -276,8 +284,9 @@ discard block |
||
| 276 | 284 | { |
| 277 | 285 | $modKey = $modStringMatches[2]; |
| 278 | 286 | $modString = translate($modKey, $modStringMatches[1]); |
| 279 | - if( strpos($modString, '{0}') === FALSE || !isset($GLOBALS['app_list_strings']['moduleListSingular'][$data['RELATED_MODULE']]) ) |
|
| 280 | - continue; |
|
| 287 | + if( strpos($modString, '{0}') === FALSE || !isset($GLOBALS['app_list_strings']['moduleListSingular'][$data['RELATED_MODULE']]) ) { |
|
| 288 | + continue; |
|
| 289 | + } |
|
| 281 | 290 | |
| 282 | 291 | $modStringSingular = $GLOBALS['app_list_strings']['moduleListSingular'][$data['RELATED_MODULE']]; |
| 283 | 292 | $modString = string_format($modString, array($modStringSingular) ); |
@@ -293,8 +302,9 @@ discard block |
||
| 293 | 302 | foreach($this->lvs->data['pageData']['urls'] as $type => $url) { |
| 294 | 303 | // awu Replacing action=DisplayDashlet with action=DynamicAction&DynamicAction=DisplayDashlet |
| 295 | 304 | $this->lvs->data['pageData']['urls'][$type] = $url.'&action=DynamicAction&DynamicAction=displayDashlet'; |
| 296 | - if($type != 'orderBy') |
|
| 297 | - $this->lvs->data['pageData']['urls'][$type] = $url.'&action=DynamicAction&DynamicAction=displayDashlet&sugar_body_only=1&id=' . $this->id; |
|
| 305 | + if($type != 'orderBy') { |
|
| 306 | + $this->lvs->data['pageData']['urls'][$type] = $url.'&action=DynamicAction&DynamicAction=displayDashlet&sugar_body_only=1&id=' . $this->id; |
|
| 307 | + } |
|
| 298 | 308 | } |
| 299 | 309 | |
| 300 | 310 | $this->lvs->ss->assign('dashletId', $this->id); |
@@ -438,8 +448,9 @@ discard block |
||
| 438 | 448 | if($rows > 100){ |
| 439 | 449 | $rows = 100; |
| 440 | 450 | } |
| 441 | - if ( isset($req['autoRefresh']) ) |
|
| 442 | - $options['autoRefresh'] = $req['autoRefresh']; |
|
| 451 | + if ( isset($req['autoRefresh']) ) { |
|
| 452 | + $options['autoRefresh'] = $req['autoRefresh']; |
|
| 453 | + } |
|
| 443 | 454 | $options['rows'] = $rows; |
| 444 | 455 | $options['categories'] = $req['categories']; |
| 445 | 456 | foreach($options['categories'] as $cat){ |
@@ -564,8 +575,7 @@ discard block |
||
| 564 | 575 | |
| 565 | 576 | if($current_user->getPreference('use_real_names') == 'on'){ |
| 566 | 577 | $ss->assign('user_name', $current_user->full_name); |
| 567 | - } |
|
| 568 | - else { |
|
| 578 | + } else { |
|
| 569 | 579 | $ss->assign('user_name', $user_name); |
| 570 | 580 | } |
| 571 | 581 | $linkTypesIn = SugarFeed::getLinkTypes(); |