Ejemplo n.º 1
0
 protected function setupEmailSettings()
 {
     global $current_user, $app_list_strings;
     $this->ss->assign("MAIL_SENDTYPE", get_select_options_with_id($app_list_strings['notifymail_sendtype'], $this->bean->getPreference('mail_sendtype')));
     ///////////////////////////////////////////////////////////////////////////////
     ////	EMAIL OPTIONS
     // We need to turn off the requiredness of emails if it is a group or portal user
     if ($this->usertype == 'GROUP' || $this->usertype == 'PORTAL_ONLY') {
         global $dictionary;
         $dictionary['User']['fields']['email1']['required'] = false;
     }
     // hack to disable email field being required if it shouldn't be required
     if ($this->ss->get_template_vars("REQUIRED_EMAIL_ADDRESS") == '0') {
         $GLOBALS['dictionary']['User']['fields']['email1']['required'] = false;
     }
     $this->ss->assign("NEW_EMAIL", '<span id="email_span">' . getEmailAddressWidget($this->bean, "email1", $this->bean->email1, $this->viewType) . '</span>');
     // hack to undo that previous hack
     if ($this->ss->get_template_vars("REQUIRED_EMAIL_ADDRESS") == '0') {
         $GLOBALS['dictionary']['User']['fields']['email1']['required'] = true;
     }
     $raw_email_link_type = $this->bean->getPreference('email_link_type');
     $mailerPreferenceStatus = OutboundEmailConfigurationPeer::getMailConfigurationStatusForUser($current_user);
     $options = $app_list_strings['dom_email_link_type'];
     if ($this->viewType == 'EditView') {
         if ($mailerPreferenceStatus === OutboundEmailConfigurationPeer::STATUS_INVALID_SYSTEM_CONFIG) {
             $raw_email_link_type = 'mailto';
         }
         $this->ss->assign('EMAIL_LINK_TYPE', get_select_options_with_id($options, $raw_email_link_type));
     } else {
         $this->ss->assign('EMAIL_LINK_TYPE', $options[$raw_email_link_type]);
     }
     /////	END EMAIL OPTIONS
     ///////////////////////////////////////////////////////////////////////////////
     /////////////////////////////////////////////
     /// Handle email account selections for users
     /////////////////////////////////////////////
     $hide_if_can_use_default = true;
     $disableSugarClient = false;
     if (!($this->usertype == 'GROUP' || $this->usertype == 'PORTAL_ONLY')) {
         // email smtp
         $systemOutboundEmail = new OutboundEmail();
         $systemOutboundEmail = $systemOutboundEmail->getSystemMailerSettings();
         $mail_smtpserver = $systemOutboundEmail->mail_smtpserver;
         $mail_smtptype = $systemOutboundEmail->mail_smtptype;
         $mail_smtpport = $systemOutboundEmail->mail_smtpport;
         $mail_smtpssl = $systemOutboundEmail->mail_smtpssl;
         $mail_smtpuser = "";
         $mail_smtppass = "";
         $mail_smtpdisplay = $systemOutboundEmail->mail_smtpdisplay;
         $mail_smtpauth_req = true;
         $mail_haspass = empty($systemOutboundEmail->mail_smtppass) ? 0 : 1;
         if (!$systemOutboundEmail->isAllowUserAccessToSystemDefaultOutbound()) {
             $mail_smtpauth_req = $systemOutboundEmail->mail_smtpauth_req;
             $userOverrideOE = $systemOutboundEmail->getUsersMailerForSystemOverride($this->bean->id);
             if ($userOverrideOE != null) {
                 $mail_smtpuser = $userOverrideOE->mail_smtpuser;
                 $mail_smtppass = $userOverrideOE->mail_smtppass;
                 $mail_haspass = empty($userOverrideOE->mail_smtppass) ? 0 : 1;
             }
             if (!$mail_smtpauth_req && (empty($systemOutboundEmail->mail_smtpserver) || empty($systemOutboundEmail->mail_smtpuser) || empty($systemOutboundEmail->mail_smtppass))) {
                 $hide_if_can_use_default = true;
             } else {
                 $hide_if_can_use_default = false;
             }
         }
         $this->ss->assign("mail_smtpdisplay", $mail_smtpdisplay);
         $this->ss->assign("mail_smtpserver", $mail_smtpserver);
         $this->ss->assign("mail_smtpuser", $mail_smtpuser);
         $this->ss->assign("mail_smtppass", "");
         $this->ss->assign("mail_haspass", $mail_haspass);
         $this->ss->assign("mail_smtpauth_req", $mail_smtpauth_req);
         $this->ss->assign('MAIL_SMTPPORT', $mail_smtpport);
         $this->ss->assign('MAIL_SMTPSSL', $mail_smtpssl);
     }
     if ($mailerPreferenceStatus === OutboundEmailConfigurationPeer::STATUS_INVALID_SYSTEM_CONFIG) {
         $disableSugarClient = true;
         $hide_if_can_use_default = true;
         //to hide the username/password fields
     }
     $this->ss->assign('DISABLE_SUGAR_CLIENT', $disableSugarClient);
     $this->ss->assign('HIDE_IF_CAN_USE_DEFAULT_OUTBOUND', $hide_if_can_use_default);
 }
Ejemplo n.º 2
0
$chooser->args['title'] = $mod_strings['LBL_EDIT_TABS'] . ' <img border="0" src="themes/default/images/helpInline.gif" onmouseover="return overlib(\'Choose which tabs are displayed.\', FGCLASS, \'olFgClass\', CGCLASS, \'olCgClass\', BGCLASS, \'olBgClass\', TEXTFONTCLASS, \'olFontClass\', CAPTIONFONTCLASS, \'olCapFontClass\', CLOSEFONTCLASS, \'olCloseFontClass\', WIDTH, -1, NOFOLLOW, \'ol_nofollow\' );" onmouseout="return nd();"/>';
$sugar_smarty->assign('TAB_CHOOSER', $chooser->display());
$sugar_smarty->assign('CHOOSER_SCRIPT', 'set_chooser();');
$sugar_smarty->assign('CHOOSE_WHICH', $mod_strings['LBL_CHOOSE_WHICH']);
///////////////////////////////////////////////////////////////////////////////
////	EMAIL OPTIONS
// We need to turn off the requiredness of emails if it is a group or portal user
if ($usertype == 'GROUP' || $usertype == 'PORTAL_ONLY') {
    global $dictionary;
    $dictionary['User']['fields']['email1']['required'] = false;
}
// hack to disable email field being required if it shouldn't be required
if ($sugar_smarty->get_template_vars("REQUIRED_EMAIL_ADDRESS") == '0') {
    $GLOBALS['dictionary']['User']['fields']['email1']['required'] = false;
}
$sugar_smarty->assign("NEW_EMAIL", getEmailAddressWidget($focus, "email1", $focus->email1, "EditView"));
// hack to undo that previous hack
if ($sugar_smarty->get_template_vars("REQUIRED_EMAIL_ADDRESS") == '0') {
    $GLOBALS['dictionary']['User']['fields']['email1']['required'] = true;
}
$sugar_smarty->assign('EMAIL_LINK_TYPE', get_select_options_with_id($app_list_strings['dom_email_link_type'], $focus->getPreference('email_link_type')));
/////	END EMAIL OPTIONS
///////////////////////////////////////////////////////////////////////////////
if ($is_current_admin) {
    $employee_status = '<select tabindex="5" name="employee_status">';
    $employee_status .= get_select_options_with_id($app_list_strings['employee_status_dom'], $focus->employee_status);
    $employee_status .= '</select>';
} else {
    $employee_status = $focus->employee_status;
}
$sugar_smarty->assign('EMPLOYEE_STATUS_OPTIONS', $employee_status);