//User is alloweed to clear username and pass so no need to check for blanks. $userOverrideOE->mail_smtpuser = $_REQUEST['mail_smtpuser']; $userOverrideOE->mail_smtppass = $_REQUEST['mail_smtppass']; $userOverrideOE->save(); } else { //If a user name and password for the mail account is set, create the users override account. if (!(empty($_REQUEST['mail_smtpuser']) || empty($_REQUEST['mail_smtppass']))) { $sysOutboundAccunt->createUserSystemOverrideAccount($focus->id, $_REQUEST['mail_smtpuser'], $_REQUEST['mail_smtppass']); } } } /////////////////////////////////////////////////////////////////////////// //// INBOUND EMAIL SAVES if (isset($_REQUEST['server_url']) && !empty($_REQUEST['server_url'])) { $ie = new InboundEmail(); if (false === $ie->savePersonalEmailAccount($return_id, $focus->user_name)) { header("Location: index.php?action=Error&module=Users&error_string=&ie_error=true&id=" . $return_id); die; // die here, else the header redirect below takes over. } } elseif (isset($_REQUEST['ie_id']) && !empty($_REQUEST['ie_id']) && empty($_REQUEST['server_url'])) { // user is deleting their I-E $ie = new InboundEmail(); $ie->deletePersonalEmailAccount($_REQUEST['ie_id'], $focus->user_name); } //// END INBOUND EMAIL SAVES /////////////////////////////////////////////////////////////////////////// if ($newUser && !$focus->is_group && !$focus->portal_only && isset($sugar_config['passwordsetting']['SystemGeneratedPasswordON']) && $sugar_config['passwordsetting']['SystemGeneratedPasswordON']) { $new_pwd = '2'; require_once 'modules/Users/GeneratePassword.php'; }
public function testsavePersonalEmailAccountAndOthers() { $inboundEmail = new InboundEmail(); $_REQUEST['ie_name'] = 'test'; $_REQUEST['ie_status'] = 'Active'; $_REQUEST['server_url'] = ''; $_REQUEST['email_user'] = '******'; $_REQUEST['email_password'] = '******'; $_REQUEST['mailbox'] = 'INBOX'; $result = $inboundEmail->savePersonalEmailAccount(1, 'admin', true); $this->assertTrue(isset($inboundEmail->id)); $this->assertEquals(36, strlen($inboundEmail->id)); //test handleIsPersonal method $this->handleIsPersonal($inboundEmail->id); //test getUserPersonalAccountCount method $this->getUserPersonalAccountCount(); //test retrieveByGroupFolderId method $this->retrieveByGroupFolderId(); //test getUserNameFromGroupId method $this->getUserNameFromGroupId($inboundEmail->id); //test deletePersonalEmailAccount method $this->deletePersonalEmailAccount($inboundEmail->id); }