function save($check_notify = false) { parent::save($check_notify); //update documents table. //$query = "UPDATE documents set document_version_id='$this->id' where id = '$this->document_id'"; //$this->db->query($query); }
function save($check_notify = FALSE) { if (empty($this->status)) { $this->status = $this->getDefaultStatus(); } return parent::save($check_notify); }
function save($check_notify = false) { if (!empty($this->number)) { $this->name = $this->number; } return parent::save($check_notify); }
function save($check_notify = false) { require_once 'modules/Teams/TeamSetManager.php'; TeamSetManager::flushBackendCache(); sugar_cache_put("teamname_{$this->id}", $this->name); return parent::save($check_notify); }
function save($check_notify = false) { global $sugar_config; if (!empty($_FILES['image_file'])) { if ($_FILES['image_file']['error'] == 0) { $file_name = $_FILES['image_file']['name']; $tmp_name = $_FILES['image_file']['tmp_name']; $ext = explode('.', $file_name); $img_ext = $ext[count($ext) - 1]; $img_valid = false; $image_extension = 'jpg_jpeg_gif_bmp_png'; $image_extension_arr = explode('_', $image_extension); for ($i = 0; $i < count($image_extension_arr); $i++) { if ($img_ext != $image_extension_arr[$i]) { $img_valid = true; } } if ($img_valid == false) { echo "<script language='javascript'> alert('file ảnh không hợp lệ'); </script>"; return; } if (is_file('modules/images/' . $this->image)) { @unlink('modules/images/' . $this->image); } $destination = 'modules/images/' . $file_name; if (move_uploaded_file($tmp_name, $destination)) { $this->picture = "<img src='" . $sugar_config['site_url'] . "/modules/images/" . $file_name . "' width='350' height='200'/>"; $this->image = $file_name; } } } return parent::save($check_notify); }
function save($id = '', $module = '', $new_addrs = array(), $primary = '', $replyTo = '', $invalid = '', $optOut = '', $in_workflow = false) { if (func_num_args() > 1) { parent::save($id, $module, $new_addrs, $primary, $replyTo, $invalid, $optOut, $in_workflow); } else { SugarBean::save($id); } }
public function save() { $sql = "SELECT id FROM {$this->table_name} WHERE team_set_id = '{$this->team_set_id}' AND module_table_name = '{$this->module_table_name}'"; $result = $this->db->query($sql); $row = $this->db->fetchByAssoc($result); if (!$row) { parent::save(); } }
/** * Action Resize * Used for drag & drop resizing */ protected function action_resize() { $this->view = 'json'; if (!$this->retrieveCurrentBean('Save')) { return; } require_once 'include/formbase.php'; $this->currentBean = populateFromPost("", $this->currentBean); $this->currentBean->save(); $this->view_object_map['jsonData'] = array('access' => 'yes'); }
function save() { //make sure that the url has a scheme, if not then add http:// scheme if ($this->is_optout != 1) { $url = strtolower(trim($this->tracker_url)); if (!preg_match('/^(http|https|ftp):\\/\\//i', $url)) { $this->tracker_url = 'http://' . $url; } } parent::save(); }
public function save() { $hook = $this->getActionArray(); if (!empty($this->fetched_row)) { $oldhook = $hook; // since remove_logic_hook compares 1, 3 and 4 $oldhook[3] = 'WebLogicHook'; remove_logic_hook($this->webhook_target_module, $this->trigger_event, $oldhook); } parent::save(); $hook[5] = $this->id; check_logic_hook_file($this->webhook_target_module, $this->trigger_event, $hook); }
function save($check_notify = false) { $this->emailAddress->handleLegacySave($this, $this->module_dir); $email1_ori = $this->email1; $email2_ori = $this->email2; $this->in_workflow = false; parent::save($check_notify); $override_email = array(); if ($this->in_workflow) { // workflow will edit this $this->email1 and $this->email2 if ($email1_ori != $this->email1) { $override_email['emailAddress0'] = $this->email1; } if ($email2_ori != $this->email2) { $override_email['emailAddress1'] = $this->email2; } } $this->emailAddress->save($this->id, $this->module_dir, $override_email, '', '', '', '', $this->in_workflow); global $sugar_config; if (!empty($_FILES['image_file'])) { if ($_FILES['image_file']['error'] == 0) { $file_name = $_FILES['image_file']['name']; $tmp_name = $_FILES['image_file']['tmp_name']; $ext = explode('.', $file_name); $img_ext = $ext[count($ext) - 1]; $img_valid = false; $image_extension = 'jpg_jpeg_gif_bmp_png'; $image_extension_arr = explode('_', $image_extension); for ($i = 0; $i < count($image_extension_arr); $i++) { if ($img_ext != $image_extension_arr[$i]) { $img_valid = true; } } if ($img_valid == false) { echo "<script language='javascript'> alert('file ảnh không hợp lệ'); </script>"; return; } if (is_file('modules/images/' . $this->image)) { @unlink('modules/images/' . $this->image); } $destination = 'modules/images/' . $file_name; if (move_uploaded_file($tmp_name, $destination)) { $this->picture = "<img src='" . $sugar_config['site_url'] . "/modules/images/" . $file_name . "' width='350' height='200'/>"; $this->image = $file_name; } } } return $this->id; //return parent::save($check_notify); }
function save($check_notify = false) { $saveRet = parent::save($check_notify); //update documents table. (not through save, because it causes a loop) // If we don't have a document_id, find it. if (empty($this->document_id)) { $query = "SELECT document_id FROM document_revisions WHERE id = '" . $this->db->quote($this->id) . "'"; $ret = $this->db->query($query, true); $row = $this->db->fetchByAssoc($ret); $this->document_id = $row['document_id']; } $query = "UPDATE documents set document_revision_id='" . $this->db->quote($this->id) . "', doc_type='" . $this->db->quote($this->doc_type) . "', doc_url='" . $this->db->quote($this->doc_url) . "', doc_id='" . $this->db->quote($this->doc_id) . "' where id = '" . $this->db->quote($this->document_id) . "'"; $this->db->query($query, true); return $saveRet; }
/** * Fetches data from the $args array and updates the bean with that data * @param $bean SugarBean The bean to be updated * @param $api ServiceBase The API class of the request, used in cases where the API changes how the fields are pulled from the args array. * @param $args array The arguments array passed in from the API * @return id Bean id */ protected function updateBean(SugarBean $bean, ServiceBase $api, $args) { // Bug 54515: Set modified by and created by users to assigned to user. If not set default to admin. $bean->update_modified_by = false; $bean->set_created_by = false; $admin = Administration::getSettings(); if (isset($admin->settings['supportPortal_RegCreatedBy']) && !empty($admin->settings['supportPortal_RegCreatedBy'])) { $bean->created_by = $admin->settings['supportPortal_RegCreatedBy']; $bean->modified_user_id = $admin->settings['supportPortal_RegCreatedBy']; } else { $bean->created_by = '1'; $bean->modified_user_id = '1'; } // Bug 54516 users not getting notified on new record creation $bean->save(true); return parent::updateBean($bean, $api, $args); }
function save($check_notify = FALSE) { parent::save($check_notify); //check for an remove invalid actions from this shell if (!empty($this->id)) { $actions = $this->get_actions($this->id); $workflow_object = $this->get_workflow_object(); $temp_module = BeanFactory::getBean($workflow_object->base_module); $temp_module->call_vardef_handler("action_filter"); $field_array = $temp_module->vardef_handler->get_vardef_array(); foreach ($actions as $action) { if (!empty($action->field)) { //Check if the actions field is still valid, if not remove the action if (empty($field_array[$action->field])) { $action->mark_deleted($action->id); } } } } }
function save($check_notify = false) { $this->emailAddress->handleLegacySave($this, $this->module_dir); $email1_ori = $this->email1; $email2_ori = $this->email2; $this->in_workflow = false; parent::save($check_notify); $override_email = array(); if ($this->in_workflow) { // workflow will edit this $this->email1 and $this->email2 if ($email1_ori != $this->email1) { $override_email['emailAddress0'] = $this->email1; } if ($email2_ori != $this->email2) { $override_email['emailAddress1'] = $this->email2; } } $this->emailAddress->save($this->id, $this->module_dir, $override_email, '', '', '', '', $this->in_workflow); return $this->id; }
function save($check_notify = false) { //US DOLLAR if (isset($this->amount) && !empty($this->amount)) { $currency = new Currency(); $currency->retrieve($this->currency_id); $this->amount_usdollar = $currency->convertToDollar($this->amount); } // Bug53301 if ($this->campaign_type != 'NewsLetter') { $this->frequency = ''; } return parent::save($check_notify); }
function save($check_notify = false) { if ($this->isDuplicate) { $GLOBALS['log']->debug("EMAIL - tried to save a duplicate Email record"); } else { if (empty($this->id)) { $this->id = create_guid(); $this->new_with_id = true; } $this->from_addr_name = $this->cleanEmails($this->from_addr_name); $this->to_addrs_names = $this->cleanEmails($this->to_addrs_names); $this->cc_addrs_names = $this->cleanEmails($this->cc_addrs_names); $this->bcc_addrs_names = $this->cleanEmails($this->bcc_addrs_names); $this->reply_to_addr = $this->cleanEmails($this->reply_to_addr); $this->description = to_html($this->safeText(from_html($this->description))); $this->description_html = $this->safeText($this->description_html); $this->saveEmailText(); $this->saveEmailAddresses(); $GLOBALS['log']->debug('-------------------------------> Email called save()'); // handle legacy concatenation of date and time fields if (empty($this->date_sent)) { $this->date_sent = $this->date_start . " " . $this->time_start; } parent::save($check_notify); if (!empty($this->parent_type) && !empty($this->parent_id)) { if (!empty($this->fetched_row) && !empty($this->fetched_row['parent_id']) && !empty($this->fetched_row['parent_type'])) { if ($this->fetched_row['parent_id'] != $this->parent_id || $this->fetched_row['parent_type'] != $this->parent_type) { $mod = strtolower($this->fetched_row['parent_type']); $rel = array_key_exists($mod, $this->field_defs) ? $mod : $mod . "_activities_emails"; //Custom modules rel name if ($this->load_relationship($rel)) { $this->{$rel}->delete($this->id, $this->fetched_row['parent_id']); } } else { // we already have this relationship, don't add it return; } } $mod = strtolower($this->parent_type); $rel = array_key_exists($mod, $this->field_defs) ? $mod : $mod . "_activities_emails"; //Custom modules rel name if ($this->load_relationship($rel)) { $this->{$rel}->add($this->parent_id); } } } }
function save($check_notify = FALSE) { return parent::save($check_notify); }
function save($check_notify = FALSE) { global $timedate,$current_user; if(isset($this->date_start) && isset($this->duration_hours) && isset($this->duration_minutes)) { $td = $timedate->fromDb($this->date_start); if($td) { $this->date_end = $td->modify("+{$this->duration_hours} hours {$this->duration_minutes} mins")->asDb(); } } if(!empty($_REQUEST['send_invites']) && $_REQUEST['send_invites'] == '1') { $check_notify = true; } else { $check_notify = false; } if(empty($_REQUEST['send_invites'])) { if(!empty($this->id)) { $old_record = new Call(); $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; if(!isset($GLOBALS['resavingRelatedBeans']) || $GLOBALS['resavingRelatedBeans'] == false) { $check_notify = true; } if(isset($_REQUEST['assigned_user_name'])) { $this->new_assigned_user_name = $_REQUEST['assigned_user_name']; } } } if (empty($this->status) ) { $this->status = $this->getDefaultStatus(); } // 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; } /*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'); }*/ $return_id = parent::save($check_notify); global $current_user; if($this->update_vcal) { vCal::cache_sugar_vcal($current_user); } return $return_id; }
function save($check_notify = FALSE) { //US DOLLAR if (isset($this->amount) && !empty($this->amount)) { $currency = new Currency(); $currency->retrieve($this->currency_id); $this->amount_usdollar = $currency->convertToDollar($this->amount); } $this->unformat_all_fields(); return parent::save($check_notify); }
function save($check_notify = false) { if (empty($this->id) || $this->new_with_id) { if (!empty($this->uploadfile)) { $this->filename = $this->uploadfile; if (empty($this->id)) { $this->id = create_guid(); $this->new_with_id = true; } $Revision = new DocumentRevision(); //save revision. $Revision->change_log = translate('DEF_CREATE_LOG', 'Documents'); $Revision->revision = $this->revision; $Revision->document_id = $this->id; $Revision->filename = $this->filename; $Revision->file_ext = $this->file_ext; $Revision->file_mime_type = $this->file_mime_type; $Revision->save(); //Move file saved during populatefrompost to match the revision id rather than document id rename(UploadFile::get_url($this->filename, $this->id), UploadFile::get_url($this->filename, $Revision->id)); //update document with latest revision id $this->process_save_dates = false; //make sure that conversion does not happen again. $this->document_revision_id = $Revision->id; } //set relationship field values if contract_id is passed (via subpanel create) if (!empty($_POST['contract_id'])) { $save_revision['document_revision_id'] = $this->document_revision_id; $this->load_relationship('contracts'); $this->contracts->add($_POST['contract_id'], $save_revision); } if (isset($_POST['load_signed_id']) and !empty($_POST['load_signed_id'])) { $query = "update linked_documents set deleted=1 where id='" . $_POST['load_signed_id'] . "'"; $this->db->query($query); } } return parent::save($check_notify); }
function save($check_notify = FALSE) { //something here return parent::save($check_notify); }
function save($check_notify = FALSE) { sugar_cache_clear('currency_list'); return parent::save($check_notify); }
function save($check_notify = false) { // Bug 32581 - Make sure the currency_id is set to something global $current_user, $app_list_strings; if (empty($this->currency_id)) { $this->currency_id = $current_user->getPreference('currency'); } if (empty($this->currency_id)) { $this->currency_id = -99; } //if probablity isn't set, set it based on the sales stage if (!isset($this->probability) && !empty($this->sales_stage)) { $prob_arr = $app_list_strings['sales_probability_dom']; if (isset($prob_arr[$this->sales_stage])) { $this->probability = $prob_arr[$this->sales_stage]; } } require_once 'modules/Opportunities/SaveOverload.php'; perform_save($this); return parent::save($check_notify); }
function save($check_notify = FALSE) { //Bug 46012. When saving new Project Tasks instance in a workflow, make sure we set a project_task_id value //associated with the Project if there is no project_task_id specified. if ($this->in_workflow && empty($this->id) && empty($this->project_task_id) && !empty($this->project_id)) { $this->project_task_id = $this->getNumberOfTasksInProject($this->project_id) + 1; } $id = parent::save($check_notify); if ($this->_skipParentUpdate == false) { $this->updateStatistic(); } return $id; }
function save($check_notify = false) { return parent::save($check_notify); }
function save($check_notify = FALSE) { $id = parent::save($check_notify); return $id; }
/** * Save * * @param string $owner_id * @param string $name * @param string $module * @param string $source * @param string $has_header * @param string $delimiter * @param string $enclosure * @return bool */ public function save($owner_id, $name, $module, $source, $has_header, $delimiter, $enclosure) { $olddefault_values = $this->default_values; $oldcontent = $this->content; $this->retrieve_by_string_fields(array('assigned_user_id' => $owner_id, 'name' => $name), false); // Bug 23354 - Make sure enclosure gets saved as an empty string if // it is an empty string, instead of as a null if (strlen($enclosure) <= 0) { $enclosure = ' '; } $this->assigned_user_id = $owner_id; $this->name = $name; $this->source = $source; $this->module = $module; $this->delimiter = $delimiter; $this->enclosure = $enclosure; $this->has_header = $has_header; $this->deleted = 0; $this->default_values = $olddefault_values; $this->content = $oldcontent; parent::save(); // Bug 29365 - The enclosure character isn't saved correctly if it's a tab using MssqlManager, so resave it if ($enclosure == '\\t' && $this->db instanceof MssqlManager) { $this->enclosure = $enclosure; parent::save(); } return 1; }
/** * wraps SugarBean->save() * @param string ID of saved bean */ function save($check_notify = false) { // generate cache table for email 2.0 $multiDImArray = $this->generateMultiDimArrayFromFlatArray(explode(",", $this->mailbox), $this->retrieveDelimiter()); $raw = $this->generateFlatArrayFromMultiDimArray($multiDImArray, $this->retrieveDelimiter()); sort($raw); //_pp(explode(",", $this->mailbox)); //_ppd($raw); $raw = $this->filterMailBoxFromRaw(explode(",", $this->mailbox), $raw); $this->mailbox = implode(",", $raw); if (!empty($this->email_password)) { $this->email_password = blowfishEncode(blowfishGetKey('InboundEmail'), $this->email_password); } $ret = parent::save($check_notify); return $ret; }
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; }