Skip to content

Instantly share code, notes, and snippets.

@ApatheticCosmos
Created November 12, 2019 17:50
Show Gist options
  • Save ApatheticCosmos/72d75b9bf2fde915e1f82d9b2906edfa to your computer and use it in GitHub Desktop.
Save ApatheticCosmos/72d75b9bf2fde915e1f82d9b2906edfa to your computer and use it in GitHub Desktop.
<?php
# Save this in the root of your SuiteCRM install, and run "php ./create_test_alerts.php"
# The alerts will be created for the Admin user (id=1)
if (!defined('sugarEntry')) {
define('sugarEntry', true);
}
chdir(dirname(__FILE__));
require_once('include/entryPoint.php');
$sapi_type = php_sapi_name();
if (substr($sapi_type, 0, 3) != 'cli') {
sugar_die("testpoint.php is CLI only.");
}
if (empty($current_language)) {
$current_language = $sugar_config['default_language'];
}
$app_list_strings = return_app_list_strings_language($current_language);
$app_strings = return_application_language($current_language);
global $current_user;
$current_user = new User();
$current_user->getSystemUser();
$GLOBALS['log']->debug('--------------------------------------------> at testpoint.php <--------------------------------------------');
$alert = BeanFactory::newBean('Alerts');
$alert->name = 'Info Alert Title';
$alert->description = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\nUt enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.";
$alert->assigned_user_id = 1;
$alert->type = 'info';
$alert->is_read = 0;
$alert->save();
$alert = BeanFactory::newBean('Alerts');
$alert->name = 'Danger Alert Title';
$alert->description = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\nUt enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.";
$alert->assigned_user_id = 1;
$alert->type = 'danger';
$alert->is_read = 0;
$alert->save();
$alert = BeanFactory::newBean('Alerts');
$alert->name = 'Success Alert Title';
$alert->description = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\nUt enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.";
$alert->assigned_user_id = 1;
$alert->type = 'success';
$alert->is_read = 0;
$alert->save();
$alert = BeanFactory::newBean('Alerts');
$alert->name = 'Primary Alert Title';
$alert->description = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\nUt enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.";
$alert->assigned_user_id = 1;
$alert->type = 'primary';
$alert->is_read = 0;
$alert->save();
$alert = BeanFactory::newBean('Alerts');
$alert->name = 'Warning Alert Title';
$alert->description = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\nUt enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.";
$alert->assigned_user_id = 1;
$alert->type = 'warning';
$alert->is_read = 0;
$alert->save();
$alert = BeanFactory::newBean('Alerts');
$alert->name = 'No Type Alert Title';
$alert->description = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\nUt enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.";
$alert->assigned_user_id = 1;
$alert->is_read = 0;
$alert->save();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment