grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026type = 'compose'; if (empty($_REQUEST['return_module'])) { $this->options['show_title'] = false; $this->options['show_header'] = false; $this->options['show_footer'] = false; $this->options['show_javascript'] = false; $this->options['show_subpanels'] = false; $this->options['show_search'] = false; } } /** * @see SugarView::preDisplay() */ public function preDisplay() { global $current_user, $mod_strings, $log; $metadataFile = $this->getMetaDataFile(); $this->ev = $this->getEditView(); $this->ev->ss =& $this->ss; if (!isset($this->bean->mailbox_id) || empty($this->bean->mailbox_id)) { $inboundEmailID = $current_user->getPreference('defaultIEAccount', 'Emails'); $this->ev->ss->assign('INBOUND_ID', $inboundEmailID); } else { $this->ev->ss->assign('INBOUND_ID', $this->bean->mailbox_id); } $this->ev->ss->assign('TEMP_ID', create_guid()); $record = isset($_REQUEST['record']) ? $_REQUEST['record'] : ''; if (empty($record) && !empty($this->bean->id)) { $record = $this->bean->id; } $this->ev->ss->assign('RECORD', $record); $this->ev->ss->assign('ACTION', isset($_REQUEST['action']) ? $_REQUEST['action'] : 'send'); $this->ev->ss->assign('RETURN_MODULE', isset($_GET['return_module']) ? $_GET['return_module'] : ''); $this->ev->ss->assign('RETURN_ACTION', isset($_GET['return_action']) ? $_GET['return_action'] : ''); $this->ev->ss->assign('RETURN_ID', isset($_GET['return_id']) ? $_GET['return_id'] : ''); $this->ev->ss->assign('IS_MODAL', isset($_GET['in_popup']) ? $_GET['in_popup'] : false); $attachmentName = $mod_strings['LBL_ATTACHMENT']; if (isset($_GET['return_module']) && isset($_GET['return_id'])) { $attachmentName = $attachmentName . ' (' . $_GET['return_module'] . ')'; $attachment = BeanFactory::getBean($_GET['return_module'], $_GET['return_id']); if (!$attachment) { SugarApplication::appendErrorMessage($mod_strings['ERR_NO_RETURN_ID']); $log->fatal('Attachment not found. Requested return ID is not related to an existing Bean.'); } else { if (isset($attachment->name) && $attachment->name) { $attachmentName = $attachment->name; } else { if (isset($attachment->title) && $attachment->title) { $attachmentName = $attachment->title; } else { if (isset($attachment->subject) && $attachment->subject) { $attachmentName = $attachment->subject; } } } } } $this->ev->ss->assign('ATTACHMENT_NAME', $attachmentName); $this->ev->setup( $this->module, $this->bean, $metadataFile, get_custom_file_if_exists('modules/Emails/include/ComposeView/ComposeView.tpl') ); } /** * Get EditView object * @return EditView */ public function getEditView() { $a = dirname(dirname(__FILE__)) . '/include/ComposeView/ComposeView.php'; require_once 'modules/Emails/include/ComposeView/ComposeView.php'; return new ComposeView(); } /** * Prepends body with $user's default signature * @param Email $email * @param User $user * @return bool|Email * @throws SugarControllerException */ public function getSignatures(User $user) { if (empty($user->id) || $user->new_with_id === true) { throw new \SugarControllerException( 'EmailsController::composeSignature() requires an existing User and not a new User object. '. 'This is typically the $current_user global' ); } $emailSignatures = unserialize(base64_decode($user->getPreference('account_signatures', 'Emails'))); if (isset($emailSignatures[$email->mailbox_id])) { $emailSignatureId = $emailSignatures[$email->mailbox_id]; } else { $emailSignatureId = $user->getPreference('signature_default'); } if (gettype($emailSignatureId) === 'string') { $emailSignatures = $user->getSignature($emailSignatureId); $email->description .= $emailSignatures['signature']; $email->description_html .= html_entity_decode($emailSignatures['signature_html']); return $email; } else { $GLOBALS['log']->warn( 'EmailsController::composeSignature() was unable to get the signature id for user: '. $user->name ); return false; } } }