public static function retrieve($key)
 {
     if (empty($key)) {
         AddonBoilerplate_Helper::log('warning', 'AddonBoilerplate_Setting::get key is required to retrieve a setting value');
         return false;
     }
     $admin = BeanFactory::getBean('Administration');
     $admin->retrieveSettings(static::$setting_group);
     $full_key = static::$setting_group . '_' . $key;
     if (!isset($admin->settings[$full_key])) {
         // in the case the logger level isn't set, set it to the default value
         // otherwise it will get in infinite loop in the log method when it comes back here
         if ($key == "logger") {
             static::set('logger', static::$default_logger_value);
             return static::$default_logger_value;
         }
         AddonBoilerplate_Helper::log('error', 'AddonBoilerplate_Setting::get a setting value does not exist for ' . $full_key);
         return false;
     }
     return $admin->settings[$full_key];
 }
 public function getSetting($api, $args)
 {
     if (empty($args['key'])) {
         AddonBoilerplate_Helper::log('error', 'AddonBoilerplateAPI->updateSetting a key is required to update the setting.');
         return array('success' => false, 'message' => 'A key is required to update a setting.');
     }
     $key = $args['key'];
     require_once 'modules/AddonBoilerplate/includes/classes/AddonBoilerplate/Setting.php';
     $result = AddonBoilerplate_Setting::retrieve($key);
     if ($result === false) {
         return array('success' => false, 'message' => 'The setting could not be retrieved.', 'value' => $result);
     }
     return array('success' => true, 'message' => 'The setting was retrieved successfully.', 'value' => $result);
 }
 /**
  * @param $email_to email address to send to
  * @param $subject subject of the email
  * @param $bodyHTML HTML body content
  * @param $bcc (Optional) email address to bcc
  */
 public static function send_email($email_to, $subject, $bodyHTML, $bcc = null)
 {
     try {
         global $sugar_config, $sugar_version, $sugar_flavor;
         require_once "modules/Emails/Email.php";
         $body = wordwrap($bodyHTML, 900);
         $_REQUEST['sendDescription'] = htmlentities($body);
         // Email Settings
         $send_config = array('sendTo' => $email_to, 'saveToSugar' => false, 'sendSubject' => $subject, 'sendCc' => '', 'sendBcc' => '');
         if (!empty($bcc)) {
             $send_config['sendBcc'] = $bcc;
         }
         $email = new Email();
         $email->email2init();
         //sending email
         if (!$email->email2Send($send_config)) {
             AddonBoilerplate_Helper::log('fatal', "AddonBoilerplate error. Something pretty major is going on and we are trying to email " . $email_to . " about something pretty major. Please forward this message along: Subject: " . $subject . " Body: " . $body);
             return false;
         }
     } catch (Exception $e) {
         AddonBoilerplate_Helper::log('fatal', "AddonBoilerplate error. Something pretty major is going on and we are trying to email " . $email_to . " about something pretty major. Please forward this message along: Subject: " . $subject . " Body: " . $body . ". General email error: " . $e->getMessage());
         return false;
     }
     return true;
 }