本文整理汇总了PHP中SugarApplication::appendErrorMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP SugarApplication::appendErrorMessage方法的具体用法?PHP SugarApplication::appendErrorMessage怎么用?PHP SugarApplication::appendErrorMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SugarApplication
的用法示例。
在下文中一共展示了SugarApplication::appendErrorMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
public function save(&$bean, $params, $field, $vardef, $prefix = '')
{
$fakeDisplayParams = array();
$this->fillInOptions($vardef, $fakeDisplayParams);
require_once 'include/upload_file.php';
$upload_file = new UploadFile($prefix . $field . '_file');
//remove file
if (isset($_REQUEST['remove_file_' . $field]) && $params['remove_file_' . $field] == 1) {
$upload_file->unlink_file($bean->{$field});
$bean->{$field} = "";
}
$move = false;
if (isset($_FILES[$prefix . $field . '_file']) && $upload_file->confirm_upload()) {
if ($this->verify_image($upload_file)) {
$bean->{$field} = $upload_file->get_stored_file_name();
$move = true;
} else {
//not valid image.
$GLOBALS['log']->fatal("Image Field : Not a Valid Image.");
$temp = $vardef['vname'];
$temp = translate($temp, $bean->module_name);
SugarApplication::appendErrorMessage($temp . " Field : Not a valid image format.");
}
}
if (empty($bean->id)) {
$bean->id = create_guid();
$bean->new_with_id = true;
}
if ($move) {
$upload_file->final_move($bean->id . '_' . $field);
//BEAN ID IS THE FILE NAME IN THE INSTANCE.
$upload_file->upload_doc($bean, $bean->id, $params[$prefix . $vardef['docType']], $bean->{$field}, $upload_file->mime_type);
} else {
if (!empty($old_id)) {
// It's a duplicate, I think
if (empty($params[$prefix . $vardef['docUrl']])) {
$upload_file->duplicate_file($old_id, $bean->id, $bean->{$field});
} else {
$docType = $vardef['docType'];
$bean->{$docType} = $params[$prefix . $field . '_old_doctype'];
}
} else {
if (!empty($params[$prefix . $field . '_remoteName'])) {
// We aren't moving, we might need to do some remote linking
$displayParams = array();
$this->fillInOptions($vardef, $displayParams);
if (isset($params[$prefix . $vardef['docId']]) && !empty($params[$prefix . $vardef['docId']]) && isset($params[$prefix . $vardef['docType']]) && !empty($params[$prefix . $vardef['docType']])) {
$bean->{$field} = $params[$prefix . $field . '_remoteName'];
require_once 'include/utils/file_utils.php';
$extension = get_file_extension($bean->{$field});
if (!empty($extension)) {
$bean->file_ext = $extension;
$bean->file_mime_type = get_mime_content_type_from_filename($bean->{$field});
}
}
}
}
}
}
示例2: preDisplay
public function preDisplay()
{
?>
<link rel="stylesheet" href="modules/Nexmo/views/style.css" /><?php
if (isset($this->view_object_map['val_error'])) {
SugarApplication::appendErrorMessage($this->view_object_map['val_error']);
}
}
示例3: pre_save
public function pre_save()
{
parent::pre_save();
$this->api = ExternalAPIFactory::loadAPI($this->bean->application, true);
if (empty($this->api)) {
return $this->failed(translate('LBL_AUTH_UNSUPPORTED', $this->bean->module_dir));
}
if (empty($this->bean->id)) {
$eapmBean = EAPM::getLoginInfo($this->bean->application, true);
if ($eapmBean) {
SugarApplication::appendErrorMessage(translate('LBL_APPLICATION_FOUND_NOTICE', $this->bean->module_dir));
$this->bean->id = $eapmBean->id;
}
}
$this->bean->validated = false;
$this->bean->save_cleanup();
$this->api->loadEAPM($this->bean);
}
示例4: action_sendinvitemails
public function action_sendinvitemails()
{
global $db;
global $sugar_config;
global $mod_strings;
$id = $_GET['record'];
//get event
$event = new FP_events();
$event->retrieve($id);
$event->load_relationship('fp_events_contacts');
// get related contacts
$event->load_relationship('fp_events_prospects_1');
//get related targets
$event->load_relationship('fp_events_leads_1');
//get related leads
//Count the number of delegates linked to the event that have not yet been invited
$query = "SELECT * FROM fp_events_contacts_c WHERE fp_events_contactsfp_events_ida='" . $event->id . "' AND (invite_status='Not Invited' OR invite_status='' OR invite_status IS NULL) AND deleted='0'";
$result = $db->query($query);
$contact_count = $db->getRowCount($result);
//count contacts
$query = "SELECT * FROM fp_events_prospects_1_c WHERE fp_events_prospects_1fp_events_ida='" . $event->id . "' AND (invite_status='Not Invited' OR invite_status='' OR invite_status IS NULL) AND deleted='0'";
$result = $db->query($query);
$prospect_count = $db->getRowCount($result);
//count targets
$query = "SELECT * FROM fp_events_leads_1_c WHERE fp_events_leads_1fp_events_ida='" . $event->id . "' AND (invite_status='Not Invited' OR invite_status='' OR invite_status IS NULL) AND deleted='0'";
$result = $db->query($query);
$lead_count = $db->getRowCount($result);
//count leads
$delegate_count = $contact_count + $prospect_count + $lead_count;
//Total up delegates
$invite_count = 0;
//used to count the number of emails sent
$error_count = 0;
//used to count the number of failed email attempts
//loop through related contacts
foreach ($event->fp_events_contacts->getBeans() as $contact) {
//Get accept status of contact
$query = 'SELECT invite_status FROM fp_events_contacts_c WHERE fp_events_contactsfp_events_ida="' . $event->id . '" AND fp_events_contactscontacts_idb="' . $contact->id . '"';
$status = $db->getOne($query);
if ($status == null || $status == '' || $status == 'Not Invited') {
$invite_count++;
//set email links
$event->link = "<a href='" . $sugar_config['site_url'] . "/index.php?entryPoint=responseEntryPoint&event=" . $event->id . "&delegate=" . $contact->id . "&type=c&response=accept'>Accept</a>";
$event->link_declined = "<a href='" . $sugar_config['site_url'] . "/index.php?entryPoint=responseEntryPoint&event=" . $event->id . "&delegate=" . $contact->id . "&type=c&response=decline'>Decline</a>";
//Get the TO name and e-mail address for the message
$rcpt_name = $contact->first_name . ' ' . $contact->last_name;
$rcpt_email = $contact->email1;
$emailTemp = new EmailTemplate();
$emailTemp->disable_row_level_security = true;
$emailTemp->retrieve($event->invite_templates);
//Use the ID value of the email template record
//check email template is set, if not return error
if ($emailTemp->id == '') {
SugarApplication::appendErrorMessage($mod_strings['LBL_ERROR_MSG_5']);
SugarApplication::redirect("index.php?module=FP_events&return_module=FP_events&action=DetailView&record=" . $event->id);
die;
}
//parse the lead varibales first
$firstpass = $emailTemp->parse_template_bean($emailTemp->body_html, 'Contacts', $contact);
$email_subject = $emailTemp->parse_template_bean($emailTemp->subject, 'FP_events', $event);
$email_body = from_html($emailTemp->parse_template_bean($firstpass, 'FP_events', $event));
$alt_emailbody = wordwrap($emailTemp->parse_template_bean($firstpass, 'FP_events', $event), 900);
//get attachments
$attachmentBean = new Note();
$attachment_list = $attachmentBean->get_full_list('', "parent_type = 'Emails' AND parent_id = '" . $event->invite_templates . "'");
$attachments = array();
if ($attachment_list != null) {
foreach ($attachment_list as $attachment) {
$attachments[] = $attachment;
}
}
//send the email
$send_invite = $this->sendEmail($rcpt_email, $email_subject, $rcpt_name, $email_body, $alt_emailbody, $contact, $attachments);
//Send the message, log if error occurs
if (!$send_invite) {
$GLOBALS['log']->fatal('ERROR: Invite email failed to send to: ' . $rcpt_name . ' at ' . $rcpt_email);
$error_count++;
} else {
//update contact to invites
$query = 'UPDATE fp_events_contacts_c SET invite_status="Invited" WHERE fp_events_contactsfp_events_ida="' . $event->id . '" AND fp_events_contactscontacts_idb="' . $contact->id . '"';
$res = $db->query($query);
}
}
}
//loop through related targets
foreach ($event->fp_events_prospects_1->getBeans() as $target) {
//Get accept status of contact
$query = 'SELECT invite_status FROM fp_events_prospects_1_c WHERE fp_events_prospects_1fp_events_ida="' . $event->id . '" AND fp_events_prospects_1prospects_idb="' . $target->id . '"';
$status = $db->getOne($query);
if ($status == null || $status == '' || $status == 'Not Invited') {
$invite_count++;
//set email links
$event->link = "<a href='" . $sugar_config['site_url'] . "/index.php?entryPoint=responseEntryPoint&event=" . $event->id . "&delegate=" . $target->id . "&type=t&response=accept'>Accept</a>";
$event->link_declined = "<a href='" . $sugar_config['site_url'] . "/index.php?entryPoint=responseEntryPoint&event=" . $event->id . "&delegate=" . $target->id . "&type=t&response=decline'>Decline</a>";
//Get the TO name and e-mail address for the message
$rcpt_name = $target->first_name . ' ' . $target->last_name;
$rcpt_email = $target->email1;
$emailTemp = new EmailTemplate();
$emailTemp->disable_row_level_security = true;
$emailTemp->retrieve($event->invite_templates);
//.........这里部分代码省略.........
示例5: sync_from_API
function sync_from_API($mode = '')
{
global $beanFiles;
require_once $beanFiles['TILKEE_PROJECTS'];
$associated_project = new TILKEE_PROJECTS();
$projects_array = $this->get_linked_beans('tilkee_projects_tilkee_tilks', 'TILKEE_PROJECTS');
$tilkee_project_id = 0;
foreach ($projects_array as $project) {
$tilkee_project_id = $project->tilkee_id;
}
if (!empty($tilkee_project_id)) {
require_once 'custom/include/externalAPI/Tilkee/ExtAPITilkee.php';
$tilkee = new ExtAPITilkee();
$result = $tilkee->infos_tilk($tilkee_project_id, $this->tilkee_id);
if ($result != -1 && !empty($result)) {
// project updated : init bean
$this->name = $result->title;
$this->tilk_url = $result->url;
$this->won = $result->won == 1 ? 'true' : 'false';
$this->archived = !empty($result->archived_at) ? 'true' : 'false';
$this->created_at = !empty($result->created_at) ? date('Y-m-d H:i:s', strtotime($result->created_at)) : '';
$this->archived_at = !empty($result->archived_at) ? date('Y-m-d H:i:s', strtotime($result->archived_at)) : '';
$this->last_sign_in_at = !empty($result->last_sign_in_at) ? date('Y-m-d H:i:s', strtotime($result->last_sign_in_at)) : '';
$this->total_time = $this->convert_time($result->total_time);
$this->total_connexion = $result->total_connexion;
$this->save();
// UPDATE LINKED CONNEXIONS
if ($mode == 'update_connexions') {
global $beanFiles;
require_once $beanFiles['TILKEE_CONNEXIONS'];
$cur_connexions = new TILKEE_CONNEXIONS();
$cur_connexions->updateFromArray($this->id, $result->connexions);
}
} else {
global $mod_strings;
SugarApplication::appendErrorMessage($mod_strings['LBL_ERROR_SYNC_ON_TILKEE']);
$GLOBALS['log']->fatal('TILKS sync_from_API -> ERROR RETRIEVE TILK INFOS FOR TILK : ' . $this->tilkee_id . ' - PROJECT : ' . $associated_project->tilkee_id);
}
}
return 0;
}
示例6: action_create_project
//.........这里部分代码省略.........
//Get project start date
if ($project_start != '') {
$dateformat = $current_user->getPreference('datef');
$startdate = DateTime::createFromFormat($dateformat, $project_start);
$start = $startdate->format('Y-m-d');
}
$duration_unit = 'Days';
//Get the project template
$template = new AM_ProjectTemplates();
$template->retrieve($template_id);
//create project from template
$project = new Project();
$project->name = $project_name;
$project->estimated_start_date = $start;
$project->status = $template->status;
$project->priority = strtolower($template->priority);
$project->description = $template->description;
$project->assigned_user_id = $template->assigned_user_id;
$project->save();
//copy all resources from template to project
$template->load_relationship('am_projecttemplates_users_1');
$template_users = $template->get_linked_beans('am_projecttemplates_users_1', 'User');
$template->load_relationship('am_projecttemplates_contacts_1');
$template_contacts = $template->get_linked_beans('am_projecttemplates_contacts_1', 'Contact');
$project->load_relationship('project_users_1');
foreach ($template_users as $user) {
$project->project_users_1->add($user->id);
}
$project->load_relationship('project_contacts_1');
foreach ($template_contacts as $contact) {
$project->project_contacts_1->add($contact->id);
}
$template->load_relationship('am_projecttemplates_project_1');
$template->am_projecttemplates_project_1->add($project->id);
//Get related project template tasks. Using sql query so that the results can be ordered.
$get_tasks = "SELECT * FROM am_tasktemplates\n WHERE id\n IN (\n SELECT am_tasktemplates_am_projecttemplatesam_tasktemplates_idb\n FROM am_tasktemplates_am_projecttemplates_c\n WHERE am_tasktemplates_am_projecttemplatesam_projecttemplates_ida = '" . $template_id . "'\n AND deleted =0\n )\n AND deleted =0\n ORDER BY am_tasktemplates.order_number ASC";
$tasks = $db->query($get_tasks);
//Create new project tasks from the template tasks
$count = 1;
while ($row = $db->fetchByAssoc($tasks)) {
$project_task = new ProjectTask();
$project_task->name = $row['name'];
$project_task->status = $row['status'];
$project_task->priority = strtolower($row['priority']);
$project_task->percent_complete = $row['percent_complete'];
$project_task->predecessors = $row['predecessors'];
$project_task->milestone_flag = $row['milestone_flag'];
$project_task->relationship_type = $row['relationship_type'];
$project_task->task_number = $row['task_number'];
$project_task->order_number = $row['order_number'];
$project_task->estimated_effort = $row['estimated_effort'];
$project_task->utilization = $row['utilization'];
if ($copy_all == 0 && !in_array($row['id'], $copy_tasks)) {
$project_task->assigned_user_id = NULL;
} else {
$project_task->assigned_user_id = $row['assigned_user_id'];
}
$project_task->description = $row['description'];
$project_task->duration = $row['duration'];
$project_task->duration_unit = $duration_unit;
$project_task->project_task_id = $count;
//Flag to prevent after save logichook running when project_tasks are created (see custom/modules/ProjectTask/updateProject.php)
$project_task->set_project_end_date = 0;
if ($count == '1') {
$project_task->date_start = $start;
$enddate = $startdate->modify('+' . $row['duration'] . ' ' . $duration_unit);
$end = $enddate->format('Y-m-d');
$project_task->date_finish = $end;
$enddate_array[$count] = $end;
$GLOBALS['log']->fatal("DATE:" . $end);
} else {
$start_date = $count - 1;
$startdate = DateTime::createFromFormat('Y-m-d', $enddate_array[$start_date]);
$GLOBALS['log']->fatal("DATE:" . $enddate_array[$start_date]);
$start = $startdate->format('Y-m-d');
$project_task->date_start = $start;
$enddate = $startdate->modify('+' . $row['duration'] . ' ' . $duration_unit);
$end = $enddate->format('Y-m-d');
$project_task->date_finish = $end;
$enddate = $end;
$enddate_array[$count] = $end;
}
$project_task->save();
//link tasks to the newly created project
$project_task->load_relationship('projects');
$project_task->projects->add($project->id);
//Add assinged users from each task to the project resourses subpanel
$project->load_relationship('project_users_1');
$project->project_users_1->add($row['assigned_user_id']);
$count++;
}
//set project end date to the same as end date of the last task
$GLOBALS['log']->fatal("project end -- DATE:" . $end);
$project->estimated_end_date = $end;
$project->save();
//redirct to new project
SugarApplication::appendErrorMessage($mod_strings["LBL_NEW_PROJECT_CREATED"]);
$params = array('module' => 'Project', 'action' => 'DetailView', 'record' => $project->id);
SugarApplication::redirect('index.php?' . http_build_query($params));
}
示例7: SendToERP
function SendToERP($bean)
{
if ($bean->sales_stage === "Closed Won" && $bean->sales_stage != $bean->fetched_row['sales_stage']) {
$account = new Account();
if (!is_null($account->retrieve($bean->account_id))) {
$url = "<your-erp-rest-url>";
$fields = array('account_id' => $account->id, 'account_name' => $account->name, 'opportunity_id' => $bean->id, 'opportunity_name' => $bean->name, 'opportunity_amount' => $bean->amount);
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $fields);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($curl);
SugarApplication::appendErrorMessage('The Opportunity ' . $bean->name . ' has been sent to ERP');
}
}
}
示例8: save
function save($check_notify = FALSE)
{
global $timedate;
global $current_user;
global $disable_date_format;
if (isset($this->date_start) && isset($this->duration_hours) && isset($this->duration_minutes)) {
if (isset($this->date_start) && isset($this->duration_hours) && isset($this->duration_minutes)) {
$td = $timedate->fromDb($this->date_start);
if (!$td) {
$this->date_start = $timedate->to_db($this->date_start);
$td = $timedate->fromDb($this->date_start);
}
if ($td) {
$this->date_end = $td->modify("+{$this->duration_hours} hours {$this->duration_minutes} mins")->asDb();
}
}
}
$check_notify = !empty($_REQUEST['send_invites']) && $_REQUEST['send_invites'] == '1' ? true : false;
if (empty($_REQUEST['send_invites'])) {
if (!empty($this->id)) {
$old_record = new Meeting();
$old_record->retrieve($this->id);
$old_assigned_user_id = $old_record->assigned_user_id;
}
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']) {
$this->special_notification = true;
$check_notify = true;
if (isset($_REQUEST['assigned_user_name'])) {
$this->new_assigned_user_name = $_REQUEST['assigned_user_name'];
}
}
}
/*nsingh 7/3/08 commenting out as bug #20814 is invalid
if($current_user->getPreference('reminder_time')!= -1 && isset($_POST['reminder_checked']) && isset($_POST['reminder_time']) && $_POST['reminder_checked']==0 && $_POST['reminder_time']==-1){
$this->reminder_checked = '1';
$this->reminder_time = $current_user->getPreference('reminder_time');
}*/
// prevent a mass mailing for recurring meetings created in Calendar module
if (empty($this->id) && !empty($_REQUEST['module']) && $_REQUEST['module'] == "Calendar" && !empty($_REQUEST['repeat_type']) && !empty($this->repeat_parent_id)) {
$check_notify = false;
}
if (empty($this->status)) {
$this->status = $this->getDefaultStatus();
}
// Do any external API saving
// Clear out the old external API stuff if we have changed types
if (isset($this->fetched_row) && $this->fetched_row['type'] != $this->type) {
$this->join_url = '';
$this->host_url = '';
$this->external_id = '';
$this->creator = '';
}
if (!empty($this->type) && $this->type != 'Sugar') {
require_once 'include/externalAPI/ExternalAPIFactory.php';
$api = ExternalAPIFactory::loadAPI($this->type);
}
if (empty($this->type)) {
$this->type = 'Sugar';
}
if (isset($api) && is_a($api, 'WebMeeting') && empty($this->in_relationship_update)) {
// Make sure the API initialized and it supports Web Meetings
// Also make suer we have an ID, the external site needs something to reference
if (!isset($this->id) || empty($this->id)) {
$this->id = create_guid();
$this->new_with_id = true;
}
$response = $api->scheduleMeeting($this);
if ($response['success'] == TRUE) {
// Need to send out notifications
if ($api->canInvite) {
$notifyList = $this->get_notification_recipients();
foreach ($notifyList as $person) {
$api->inviteAttendee($this, $person, $check_notify);
}
}
} else {
SugarApplication::appendErrorMessage($GLOBALS['app_strings']['ERR_EXTERNAL_API_SAVE_FAIL']);
return $this->id;
}
$api->logoff();
}
$return_id = parent::save($check_notify);
if ($this->update_vcal) {
vCal::cache_sugar_vcal($current_user);
}
return $return_id;
}
示例9: define
* Fifth Floor, Boston, MA 02110-1301 USA
*
* @author Salesagility Ltd <support@salesagility.com>
*/
if (!defined('sugarEntry')) {
define('sugarEntry', true);
}
require_once 'modules/AOP_Case_Updates/util.php';
if (!isAOPEnabled()) {
return;
}
global $sugar_config, $mod_strings;
require_once 'modules/Contacts/Contact.php';
$bean = new Contact();
$bean->retrieve($_REQUEST['record']);
if (array_key_exists("aop", $sugar_config) && array_key_exists("joomla_url", $sugar_config['aop'])) {
$portalURL = $sugar_config['aop']['joomla_url'];
$wbsv = file_get_contents($portalURL . '/index.php?option=com_advancedopenportal&task=enable_user&sug=' . $_REQUEST['record'] . '&uid=' . $bean->joomla_account_id);
$res = json_decode($wbsv);
if (!$res->success) {
$msg = $res->error ? $res->error : $mod_strings['LBL_ENABLE_PORTAL_USER_FAILED'];
SugarApplication::appendErrorMessage($msg);
} else {
$bean->portal_account_disabled = 0;
$bean->save(false);
SugarApplication::appendErrorMessage($mod_strings['LBL_ENABLE_PORTAL_USER_SUCCESS']);
}
} else {
SugarApplication::appendErrorMessage($mod_strings['LBL_NO_JOOMLA_URL']);
}
SugarApplication::redirect("index.php?module=Contacts&action=DetailView&record=" . $_REQUEST['record']);
示例10: sync_from_API
function sync_from_API($mode = '')
{
if (!empty($this->tilkee_id)) {
require_once 'custom/include/externalAPI/Tilkee/ExtAPITilkee.php';
$tilkee = new ExtAPITilkee();
$result = $tilkee->infos_project($this->tilkee_id);
if ($result != -1 && !empty($result)) {
// project created : init bean
$this->set_result_to_bean($result);
// Create or update tilks from return data
if ($mode == 'update_tilks') {
global $beanFiles;
require_once $beanFiles['TILKEE_TILKS'];
$cur_tilks = new TILKEE_TILKS();
$cur_tilks->updateFromArray($this->id, $result->tilks);
}
// TBD
} else {
global $mod_strings;
SugarApplication::appendErrorMessage($mod_strings['LBL_ERROR_UPDATE_ON_TILKEE']);
}
}
}
示例11: action_config
public function action_config()
{
$this->view_object_map['error_1'] = false;
$this->view_object_map['error_2'] = false;
$this->view_object_map['error_3'] = false;
$api_and_secret_saved = false;
if (isset($_POST) && !empty($_POST)) {
require_once 'modules/Administration/Administration.php';
$administration = new Administration();
$clean_api_key = trim($_REQUEST['api_key']);
$clean_api_secret = trim($_REQUEST['api_secret']);
$clean_budget = trim($_REQUEST['budget']);
if ($clean_api_key != "" && $clean_api_secret != "") {
$response = @file_get_contents('https://rest.nexmo.com/account/numbers/' . $clean_api_key . '/' . $clean_api_secret);
//fetching from number
$msg_from = (array) json_decode($response);
if (isset($msg_from['numbers'][0]->msisdn) && $msg_from['numbers'][0]->msisdn != "") {
$administration->saveSetting('Nexmo', 'api_key', $clean_api_key);
$administration->saveSetting('Nexmo', 'api_secret', $clean_api_secret);
$api_and_secret_saved = true;
//SugarApplication::appendErrorMessage("<span style='color:green'>Nexmo key and secret saved successfully.</span>");
} else {
$this->view_object_map['error_1'] = true;
$this->view_object_map['error_2'] = true;
$administration->saveSetting('Nexmo', 'api_key', $clean_api_key);
$administration->saveSetting('Nexmo', 'api_secret', $clean_api_secret);
//$administration->saveSetting('Nexmo', 'budget', "");
SugarApplication::appendErrorMessage("Please enter valid Nexmo Key and Secret.");
}
} else {
if ($clean_api_key == "" && $clean_api_secret == "") {
$this->view_object_map['error_1'] = true;
$this->view_object_map['error_2'] = true;
SugarApplication::appendErrorMessage("Please enter Nexmo Key and Secret.");
} else {
$administration->saveSetting('Nexmo', 'api_key', $clean_api_key);
$administration->saveSetting('Nexmo', 'api_secret', $clean_api_secret);
$this->view_object_map['error_1'] = true;
$this->view_object_map['error_2'] = true;
SugarApplication::appendErrorMessage("Please enter valid Nexmo Key and Secret.");
}
}
if (!empty($clean_budget)) {
if (is_numeric($clean_budget) && $clean_budget > 0) {
if ($api_and_secret_saved == true) {
$administration->saveSetting('Nexmo', 'budget', $clean_budget);
//SugarApplication::appendErrorMessage("<span style='color:green'>Threshold saved successfully.</span>");
SugarApplication::appendErrorMessage("<span style='color:green'>Configuration settings saved successfully.</span>");
} else {
$administration->saveSetting('Nexmo', 'budget', "");
}
} else {
$administration->saveSetting('Nexmo', 'budget', "");
SugarApplication::appendErrorMessage("Please enter a valid Threshold.");
$this->view_object_map['error_3'] = true;
}
} else {
$this->view_object_map['error_3'] = true;
$administration->saveSetting('Nexmo', 'budget', "");
SugarApplication::appendErrorMessage("Please enter the Threshold value.");
}
if (isset($_REQUEST['send_msg']) && $_REQUEST['send_msg'] == true && $api_and_secret_saved == true) {
$administration->saveSetting('Nexmo', 'send_msg', true);
} else {
$administration->saveSetting('Nexmo', 'send_msg', false);
}
$this->view = 'config';
} else {
$this->view = 'config';
}
}
示例12: delete_team
/**
* Delete a team and all team memberships. This method will only work if no items are assigned to the team.
*/
function delete_team()
{
//todo: Verify that no items are still assigned to this team.
if ($this->id == $this->global_team) {
$msg = $GLOBALS['app_strings']['LBL_MASSUPDATE_DELETE_GLOBAL_TEAM'];
$GLOBALS['log']->fatal($msg);
die($msg);
}
//Check if the associated user is deleted
$user = BeanFactory::getBean('Users', $this->associated_user_id);
if ($this->private == 1 && (!empty($user->id) && $user->deleted != 1)) {
$msg = string_format($GLOBALS['app_strings']['LBL_MASSUPDATE_DELETE_USER_EXISTS'], array(Team::getDisplayName($this->name, $this->name_2), $user->full_name));
$GLOBALS['log']->error($msg);
SugarApplication::appendErrorMessage($msg);
return false;
}
// Update team_memberships table and set deleted = 1
$query = "UPDATE team_memberships SET deleted = 1 WHERE team_id='{$this->id}'";
$this->db->query($query, true, "Error deleting memberships while deleting team: ");
// Update teams and set deleted = 1
$this->deleted = 1;
$this->save();
require_once 'modules/Teams/TeamSetManager.php';
TeamSetManager::flushBackendCache();
//clean up any team sets that use this team id
TeamSetManager::removeTeamFromSets($this->id);
// Take the item off the recently viewed lists
$tracker = BeanFactory::getBean('Trackers');
$tracker->makeInvisibleForAll($this->id);
}
示例13: testappendErrorMessage
public function testappendErrorMessage()
{
//execute the method and check that the method adds the message to user_error_message array.
//there should be one more array element after method execution.
$user_error_message_count = count($_SESSION['user_error_message']);
SugarApplication::appendErrorMessage('some error');
$this->assertGreaterThan($user_error_message_count, count($_SESSION['user_error_message']));
}
示例14: set_log_error
protected function set_log_error($result_error, $error_level = "fatal")
{
if (!isset($result_error->status)) {
return;
}
if ($error_level == "fatal") {
$GLOBALS['log']->fatal("TILKEE CONNECTOR ACCESS ERROR - " . print_r($result_error->body->error, true));
} else {
$GLOBALS['log']->info("TILKEE CONNECTOR INFO - " . print_r($result_error->body->error, true));
}
SugarApplication::appendErrorMessage('TILKEE ERROR : ' . $result_error->body->error->message);
}
示例15: header
}
global $mod_strings;
global $app_strings;
$focus = BeanFactory::getBean('Teams', $_REQUEST['record']);
//Check if there are module records where this team is assigned to in a team_set_id
//if so, redirect to prompt the Administrator to select a new team
if ($focus->has_records_in_modules()) {
header("Location: index.php?module=Teams&action=ReassignTeams&record={$focus->id}");
} else {
//todo: Verify that no items are still assigned to this team.
if ($focus->id == $focus->global_team) {
$msg = $GLOBALS['app_strings']['LBL_MASSUPDATE_DELETE_GLOBAL_TEAM'];
$GLOBALS['log']->fatal($msg);
$error_message = $app_strings['LBL_MASSUPDATE_DELETE_GLOBAL_TEAM'];
SugarApplication::appendErrorMessage($error_message);
header('Location: index.php?module=Teams&action=DetailView&record=' . $focus->id);
return;
}
//Check if the associated user is deleted
$user = BeanFactory::getBean('Users', $focus->associated_user_id);
if ($focus->private == 1 && (!empty($user->id) && $user->deleted != 1)) {
$msg = string_format($GLOBALS['app_strings']['LBL_MASSUPDATE_DELETE_USER_EXISTS'], array(Team::getDisplayName($focus->name, $focus->name_2), $user->full_name));
$GLOBALS['log']->error($msg);
SugarApplication::appendErrorMessage($msg);
header('Location: index.php?module=Teams&action=DetailView&record=' . $focus->id);
return;
}
//Call mark_deleted function
$focus->mark_deleted();
header("Location: index.php?module=Teams&action=index");
}