Merged in luisfernandosl/processmaker/PM-940 (pull request #1329)
PM 940 "ProcessMaker" Email Server Frontend" SOLVED
This commit is contained in:
@@ -314,40 +314,50 @@ function database_upgrade($command, $args) {
|
||||
}
|
||||
}
|
||||
|
||||
//There records in table "EMAIL_SERVER"
|
||||
$criteria = new Criteria("workflow");
|
||||
//There records in table "EMAIL_SERVER"
|
||||
$criteria = new Criteria("workflow");
|
||||
|
||||
$criteria->addSelectColumn(EmailServerPeer::MESS_UID);
|
||||
$criteria->setOffset(0);
|
||||
$criteria->setLimit(1);
|
||||
$criteria->addSelectColumn(EmailServerPeer::MESS_UID);
|
||||
$criteria->setOffset(0);
|
||||
$criteria->setLimit(1);
|
||||
|
||||
$rsCriteria = EmailServerPeer::doSelectRS($criteria);
|
||||
$rsCriteria = EmailServerPeer::doSelectRS($criteria);
|
||||
|
||||
if (!$rsCriteria->next()) {
|
||||
//Insert the first record
|
||||
$emailConfiguration = System::getEmailConfiguration();
|
||||
if (!$rsCriteria->next()) {
|
||||
//Insert the first record
|
||||
$emailSever = new \ProcessMaker\BusinessModel\EmailServer();
|
||||
|
||||
if (count($emailConfiguration) > 0) {
|
||||
$arrayData = array();
|
||||
$emailConfiguration = System::getEmailConfiguration();
|
||||
|
||||
$arrayData["MESS_ENGINE"] = $emailConfiguration["MESS_ENGINE"];
|
||||
$arrayData["MESS_SERVER"] = $emailConfiguration["MESS_SERVER"];
|
||||
$arrayData["MESS_PORT"] = (int)($emailConfiguration["MESS_PORT"]);
|
||||
$arrayData["MESS_RAUTH"] = (int)($emailConfiguration["MESS_RAUTH"]);
|
||||
$arrayData["MESS_ACCOUNT"] = $emailConfiguration["MESS_ACCOUNT"];
|
||||
$arrayData["MESS_PASSWORD"] = $emailConfiguration["MESS_PASSWORD"];
|
||||
$arrayData["MESS_FROM_MAIL"] = $emailConfiguration["MESS_FROM_MAIL"];
|
||||
$arrayData["MESS_FROM_NAME"] = $emailConfiguration["MESS_FROM_NAME"];
|
||||
$arrayData["SMTPSECURE"] = $emailConfiguration["SMTPSecure"];
|
||||
$arrayData["MESS_TRY_SEND_INMEDIATLY"] = (int)($emailConfiguration["MESS_TRY_SEND_INMEDIATLY"]);
|
||||
$arrayData["MAIL_TO"] = $emailConfiguration["MAIL_TO"];
|
||||
$arrayData["MESS_DEFAULT"] = (isset($emailConfiguration["MESS_ENABLED"]) && $emailConfiguration["MESS_ENABLED"] . "" == "1")? 1 : 0;
|
||||
if (count($emailConfiguration) > 0) {
|
||||
$arrayData = array();
|
||||
|
||||
$emailSever = new ProcessMaker\BusinessModel\EmailServer();
|
||||
$arrayData["MESS_ENGINE"] = $emailConfiguration["MESS_ENGINE"];
|
||||
$arrayData["MESS_SERVER"] = $emailConfiguration["MESS_SERVER"];
|
||||
$arrayData["MESS_PORT"] = (int)($emailConfiguration["MESS_PORT"]);
|
||||
$arrayData["MESS_RAUTH"] = (int)($emailConfiguration["MESS_RAUTH"]);
|
||||
$arrayData["MESS_ACCOUNT"] = $emailConfiguration["MESS_ACCOUNT"];
|
||||
$arrayData["MESS_PASSWORD"] = $emailConfiguration["MESS_PASSWORD"];
|
||||
$arrayData["MESS_FROM_MAIL"] = $emailConfiguration["MESS_FROM_MAIL"];
|
||||
$arrayData["MESS_FROM_NAME"] = $emailConfiguration["MESS_FROM_NAME"];
|
||||
$arrayData["SMTPSECURE"] = $emailConfiguration["SMTPSecure"];
|
||||
$arrayData["MESS_TRY_SEND_INMEDIATLY"] = (int)($emailConfiguration["MESS_TRY_SEND_INMEDIATLY"]);
|
||||
$arrayData["MAIL_TO"] = $emailConfiguration["MAIL_TO"];
|
||||
$arrayData["MESS_DEFAULT"] = (isset($emailConfiguration["MESS_ENABLED"]) && $emailConfiguration["MESS_ENABLED"] . "" == "1")? 1 : 0;
|
||||
|
||||
$emailSever->create($arrayData);
|
||||
}
|
||||
}
|
||||
$arrayData = $emailSever->create($arrayData);
|
||||
} else {
|
||||
/*----------------------------------********---------------------------------*/
|
||||
if (true) {
|
||||
//
|
||||
} else {
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$arrayData = $emailSever->create2(array("MESS_ENGINE" => "MAIL"));
|
||||
/*----------------------------------********---------------------------------*/
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function delete_app_from_table($con, $tableName, $appUid, $col="APP_UID") {
|
||||
|
||||
@@ -224,6 +224,17 @@ class Installer
|
||||
fclose($fp);
|
||||
$this->setPartner();
|
||||
$this->setAdmin();
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
if (true) {
|
||||
//
|
||||
} else {
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$querySql = ("INSERT INTO EMAIL_SERVER(MESS_ENGINE) VALUES('MAIL')");
|
||||
$this->run_query($querySql);
|
||||
/*----------------------------------********---------------------------------*/
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
}
|
||||
return $test;
|
||||
}
|
||||
|
||||
@@ -968,7 +968,7 @@ class System
|
||||
|
||||
public function getEmailConfiguration ()
|
||||
{
|
||||
$emailServer = new ProcessMaker\BusinessModel\EmailServer();
|
||||
$emailServer = new \ProcessMaker\BusinessModel\EmailServer();
|
||||
|
||||
$arrayEmailServerDefault = $emailServer->getEmailServerDefault();
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ abstract class BaseEmailServer extends BaseObject implements Persistent
|
||||
* The value for the smtpsecure field.
|
||||
* @var string
|
||||
*/
|
||||
protected $smtpsecure = '';
|
||||
protected $smtpsecure = 'No';
|
||||
|
||||
/**
|
||||
* The value for the mess_try_send_inmediatly field.
|
||||
@@ -475,7 +475,7 @@ abstract class BaseEmailServer extends BaseObject implements Persistent
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->smtpsecure !== $v || $v === '') {
|
||||
if ($this->smtpsecure !== $v || $v === 'No') {
|
||||
$this->smtpsecure = $v;
|
||||
$this->modifiedColumns[] = EmailServerPeer::SMTPSECURE;
|
||||
}
|
||||
|
||||
@@ -4204,7 +4204,7 @@
|
||||
<column name="MESS_PASSWORD" type="VARCHAR" size="256" required="true" default="" />
|
||||
<column name="MESS_FROM_MAIL" type="VARCHAR" size="256" required="true" default="" />
|
||||
<column name="MESS_FROM_NAME" type="VARCHAR" size="256" required="true" default="" />
|
||||
<column name="SMTPSECURE" type="VARCHAR" size="3" required="true" default="" />
|
||||
<column name="SMTPSECURE" type="VARCHAR" size="3" required="true" default="No" />
|
||||
<column name="MESS_TRY_SEND_INMEDIATLY" type="INTEGER" required="true" default="0" />
|
||||
<column name="MAIL_TO" type="VARCHAR" size="256" required="true" default="" />
|
||||
<column name="MESS_DEFAULT" type="INTEGER" required="true" default="0" />
|
||||
|
||||
@@ -784,6 +784,16 @@ class Installer extends Controller
|
||||
'" . mysql_real_escape_string( serialize( array ('LANG' => 'en','STATUS' => 'active'
|
||||
) ) ) . "'
|
||||
)" );
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
if (true) {
|
||||
//
|
||||
} else {
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$this->mysqlQuery("INSERT INTO EMAIL_SERVER(MESS_ENGINE) VALUES('MAIL')");
|
||||
/*----------------------------------********---------------------------------*/
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
}
|
||||
|
||||
// Change admin user
|
||||
@@ -927,7 +937,7 @@ class Installer extends Controller
|
||||
return $info;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->installLog( G::LoadTranslation('ID_INDEX_FILE_UPDATED', SYS_LANG, Array($indexFileUpdated, $sysConf['default_lang'],$sysConf['default_skin'])));
|
||||
$this->installLog( G::LoadTranslation('ID_INSTALL_SUCESS') );
|
||||
|
||||
@@ -1080,6 +1090,16 @@ class Installer extends Controller
|
||||
'" . addslashes( serialize( array ('LANG' => 'en','STATUS' => 'active'
|
||||
) ) ) . "'
|
||||
)" );
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
if (true) {
|
||||
//
|
||||
} else {
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$this->mssqlQuery("INSERT INTO EMAIL_SERVER(MESS_ENGINE) VALUES('MAIL')");
|
||||
/*----------------------------------********---------------------------------*/
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
}
|
||||
|
||||
//change admin user
|
||||
|
||||
@@ -2427,7 +2427,7 @@ CREATE TABLE `EMAIL_SERVER`
|
||||
`MESS_PASSWORD` VARCHAR(256) default '' NOT NULL,
|
||||
`MESS_FROM_MAIL` VARCHAR(256) default '' NOT NULL,
|
||||
`MESS_FROM_NAME` VARCHAR(256) default '' NOT NULL,
|
||||
`SMTPSECURE` VARCHAR(3) default 'NO' NOT NULL,
|
||||
`SMTPSECURE` VARCHAR(3) default 'No' NOT NULL,
|
||||
`MESS_TRY_SEND_INMEDIATLY` INTEGER default 0 NOT NULL,
|
||||
`MAIL_TO` VARCHAR(256) default '' NOT NULL,
|
||||
`MESS_DEFAULT` INTEGER default 0 NOT NULL,
|
||||
|
||||
@@ -36,7 +36,7 @@ if ($RBAC->userCanAccess('PM_SETUP') == 1 ) {
|
||||
//settings options
|
||||
// $G_TMP_MENU->AddIdRawOption('LOGO', 'uplogo', G::LoadTranslation('ID_LOGO'), 'icon-pmlogo.png', '', 'settings');
|
||||
$G_TMP_MENU->AddIdRawOption('LOGO', '../admin/pmLogo', G::LoadTranslation('ID_LOGO'), 'icon-pmlogo.png','', 'settings');
|
||||
$G_TMP_MENU->AddIdRawOption('EMAILS','../admin/emails', G::LoadTranslation('ID_EMAIL'), 'icon-email-settings1.png', '', 'settings');
|
||||
$G_TMP_MENU->AddIdRawOption("EMAIL_SERVER", "../emailServer/emailServer", G::LoadTranslation("ID_EMAIL_SERVER_TITLE"), "icon-email-settings1.png", "", "settings");
|
||||
$G_TMP_MENU->AddIdRawOption('CALENDAR', 'calendarList', G::LoadTranslation('ID_CALENDAR'), 'icon-calendar.png', '', 'settings' );
|
||||
//if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') == 1)
|
||||
// $G_TMP_MENU->AddIdRawOption('CASES_LIST_SETUP', '../cases/casesListSetup', G::LoadTranslation('ID_CASES_LIST_SETUP'), "",'', 'settings');
|
||||
@@ -103,7 +103,7 @@ if ($RBAC->userCanAccess('PM_SETUP') == 1) {
|
||||
$G_TMP_MENU->AddIdRawOption('EMAILS', '../mails/emailList', ucfirst (strtolower ( G::LoadTranslation('ID_EMAILS'))), '', '', 'logs');
|
||||
/*----------------------------------********---------------------------------*/
|
||||
if (isset($sAudit) && $sAudit != false && $licensedFeatures->verifyfeature('vtSeHNhT0JnSmo1bTluUVlTYUxUbUFSVStEeXVqc1pEUG5EeXc0MGd2Q3ErYz0=')) {
|
||||
$G_TMP_MENU->AddIdRawOption('AUDIT_LOG', '../setup/auditLog', ucfirst (G::LoadTranslation('ID_AUDITLOG_DISPLAY')), '', '', 'logs');
|
||||
$G_TMP_MENU->AddIdRawOption('AUDIT_LOG', '../setup/auditLog', ucfirst (G::LoadTranslation('ID_AUDITLOG_DISPLAY')), '', '', 'logs');
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
}
|
||||
|
||||
22
workflow/engine/methods/emailServer/emailServer.php
Normal file
22
workflow/engine/methods/emailServer/emailServer.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
global $RBAC;
|
||||
|
||||
if ($RBAC->userCanAccess("PM_SETUP") != 1) {
|
||||
G::SendTemporalMessage("ID_USER_HAVENT_RIGHTS_PAGE", "error", "labels");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
//Data
|
||||
$configuration = new Configurations();
|
||||
$arrayConfigPage = $configuration->getConfiguration("emailServerList", "pageSize", null, $_SESSION["USER_LOGGED"]);
|
||||
|
||||
$arrayConfig = array();
|
||||
$arrayConfig["pageSize"] = (isset($arrayConfigPage["pageSize"]))? $arrayConfigPage["pageSize"] : 20;
|
||||
|
||||
$headPublisher = &headPublisher::getSingleton();
|
||||
$headPublisher->addContent("emailServer/emailServer"); //Adding a HTML file
|
||||
$headPublisher->addExtJsScript("emailServer/emailServer", false); //Adding a JavaScript file
|
||||
$headPublisher->assign("CONFIG", $arrayConfig);
|
||||
|
||||
G::RenderPage("publish", "extJs");
|
||||
|
||||
205
workflow/engine/methods/emailServer/emailServerAjax.php
Normal file
205
workflow/engine/methods/emailServer/emailServerAjax.php
Normal file
@@ -0,0 +1,205 @@
|
||||
<?php
|
||||
$option = (isset($_POST["option"]))? $_POST["option"] : "";
|
||||
|
||||
$response = array();
|
||||
|
||||
switch ($option) {
|
||||
case "INS":
|
||||
$arrayData = array();
|
||||
|
||||
$server = "";
|
||||
$port = "";
|
||||
$reqAuthentication = 0;
|
||||
$password = "";
|
||||
$smtpSecure = "";
|
||||
|
||||
$cboEmailEngine = $_POST["cboEmailEngine"];
|
||||
$accountFrom = (isset($_POST["accountFrom"]))? $_POST["accountFrom"] : "";
|
||||
$fromName = $_POST["fromName"];
|
||||
$fromMail = $_POST["fromMail"];
|
||||
$sendTestMail = (int)($_POST["sendTestMail"]);
|
||||
$mailTo = ($sendTestMail == 1)? $_POST["mailTo"] : "";
|
||||
$emailServerDefault = (int)($_POST["emailServerDefault"]);
|
||||
|
||||
if ($cboEmailEngine == "PHPMAILER") {
|
||||
$server = $_POST["server"];
|
||||
$port = (int)($_POST["port"]);
|
||||
$reqAuthentication = (int)($_POST["reqAuthentication"]);
|
||||
$password = ($reqAuthentication == 1)? $_POST["password"] : "";
|
||||
$smtpSecure = $_POST["smtpSecure"];
|
||||
}
|
||||
|
||||
try {
|
||||
$arrayData = array(
|
||||
"MESS_ENGINE" => $cboEmailEngine,
|
||||
"MESS_SERVER" => $server,
|
||||
"MESS_PORT" => $port,
|
||||
"MESS_RAUTH" => $reqAuthentication,
|
||||
"MESS_ACCOUNT" => $accountFrom,
|
||||
"MESS_PASSWORD" => $password,
|
||||
"MESS_FROM_MAIL" => $fromMail,
|
||||
"MESS_FROM_NAME" => $fromName,
|
||||
"SMTPSECURE" => $smtpSecure,
|
||||
"MESS_TRY_SEND_INMEDIATLY" => $sendTestMail,
|
||||
"MAIL_TO" => $mailTo,
|
||||
"MESS_DEFAULT" => $emailServerDefault
|
||||
);
|
||||
|
||||
$emailSever = new \ProcessMaker\BusinessModel\EmailServer();
|
||||
|
||||
$arrayEmailServerData = $emailSever->create($arrayData);
|
||||
|
||||
$response["status"] = "OK";
|
||||
$response["data"] = $arrayEmailServerData;
|
||||
} catch (Exception $e) {
|
||||
$response["status"] = "ERROR";
|
||||
$response["message"] = $e->getMessage();
|
||||
}
|
||||
break;
|
||||
case "UPD":
|
||||
$arrayData = array();
|
||||
|
||||
$emailServerUid = $_POST["emailServerUid"];
|
||||
|
||||
$server = "";
|
||||
$port = "";
|
||||
$reqAuthentication = 0;
|
||||
$password = "";
|
||||
$smtpSecure = "";
|
||||
|
||||
$cboEmailEngine = $_POST["cboEmailEngine"];
|
||||
$accountFrom = (isset($_POST["accountFrom"]))? $_POST["accountFrom"] : "";
|
||||
$fromName = $_POST["fromName"];
|
||||
$fromMail = $_POST["fromMail"];
|
||||
$sendTestMail = (int)($_POST["sendTestMail"]);
|
||||
$mailTo = ($sendTestMail == 1)? $_POST["mailTo"] : "";
|
||||
$emailServerDefault = (int)($_POST["emailServerDefault"]);
|
||||
|
||||
if ($cboEmailEngine == "PHPMAILER") {
|
||||
$server = $_POST["server"];
|
||||
$port = (int)($_POST["port"]);
|
||||
$reqAuthentication = (int)($_POST["reqAuthentication"]);
|
||||
$password = ($reqAuthentication == 1)? $_POST["password"] : "";
|
||||
$smtpSecure = $_POST["smtpSecure"];
|
||||
}
|
||||
|
||||
try {
|
||||
$arrayData = array(
|
||||
"MESS_ENGINE" => $cboEmailEngine,
|
||||
"MESS_SERVER" => $server,
|
||||
"MESS_PORT" => $port,
|
||||
"MESS_RAUTH" => $reqAuthentication,
|
||||
"MESS_ACCOUNT" => $accountFrom,
|
||||
"MESS_PASSWORD" => $password,
|
||||
"MESS_FROM_MAIL" => $fromMail,
|
||||
"MESS_FROM_NAME" => $fromName,
|
||||
"SMTPSECURE" => $smtpSecure,
|
||||
"MESS_TRY_SEND_INMEDIATLY" => $sendTestMail,
|
||||
"MAIL_TO" => $mailTo,
|
||||
"MESS_DEFAULT" => $emailServerDefault
|
||||
);
|
||||
|
||||
$emailSever = new \ProcessMaker\BusinessModel\EmailServer();
|
||||
|
||||
$arrayEmailServerData = $emailSever->update($emailServerUid, $arrayData);
|
||||
|
||||
$response["status"] = "OK";
|
||||
$response["data"] = $arrayEmailServerData;
|
||||
} catch (Exception $e) {
|
||||
$response["status"] = "ERROR";
|
||||
$response["message"] = $e->getMessage();
|
||||
}
|
||||
|
||||
break;
|
||||
case "DEL":
|
||||
$emailServerUid = $_POST["emailServerUid"];
|
||||
|
||||
try {
|
||||
$emailSever = new \ProcessMaker\BusinessModel\EmailServer();
|
||||
|
||||
$result = $emailSever->delete($emailServerUid);
|
||||
|
||||
$response["status"] = "OK";
|
||||
} catch (Exception $e) {
|
||||
$response["status"] = "ERROR";
|
||||
$response["message"] = $e->getMessage();
|
||||
}
|
||||
break;
|
||||
case "LST":
|
||||
$pageSize = $_POST["pageSize"];
|
||||
$search = $_POST["search"];
|
||||
|
||||
$sortField = (isset($_POST["sort"]))? $_POST["sort"]: "";
|
||||
$sortDir = (isset($_POST["dir"]))? $_POST["dir"]: "";
|
||||
$start = (isset($_POST["start"]))? $_POST["start"]: 0;
|
||||
$limit = (isset($_POST["limit"]))? $_POST["limit"]: $pageSize;
|
||||
|
||||
try {
|
||||
$emailSever = new \ProcessMaker\BusinessModel\EmailServer();
|
||||
|
||||
$result = $emailSever->getEmailServers(array("filter" => $search), $sortField, $sortDir, $start, $limit);
|
||||
|
||||
$response["status"] = "OK";
|
||||
$response["success"] = true;
|
||||
$response["resultTotal"] = $result["total"];
|
||||
$response["resultRoot"] = $result["data"];
|
||||
} catch (Exception $e) {
|
||||
$response["status"] = "ERROR";
|
||||
$response["message"] = $e->getMessage();
|
||||
}
|
||||
break;
|
||||
case "TEST":
|
||||
$arrayData = array();
|
||||
|
||||
$server = "";
|
||||
$port = "";
|
||||
$reqAuthentication = 0;
|
||||
$password = "";
|
||||
$smtpSecure = "";
|
||||
|
||||
$cboEmailEngine = $_POST["cboEmailEngine"];
|
||||
$accountFrom = (isset($_POST["accountFrom"]))? $_POST["accountFrom"] : "";
|
||||
$fromName = $_POST["fromName"];
|
||||
$fromMail = $_POST["fromMail"];
|
||||
$sendTestMail = (int)($_POST["sendTestMail"]);
|
||||
$mailTo = ($sendTestMail == 1)? $_POST["mailTo"] : "";
|
||||
$emailServerDefault = (int)($_POST["emailServerDefault"]);
|
||||
|
||||
if ($cboEmailEngine == "PHPMAILER") {
|
||||
$server = $_POST["server"];
|
||||
$port = (int)($_POST["port"]);
|
||||
$reqAuthentication = (int)($_POST["reqAuthentication"]);
|
||||
$password = ($reqAuthentication == 1)? $_POST["password"] : "";
|
||||
$smtpSecure = $_POST["smtpSecure"];
|
||||
}
|
||||
|
||||
try {
|
||||
$arrayData = array(
|
||||
"MESS_ENGINE" => $cboEmailEngine,
|
||||
"MESS_SERVER" => $server,
|
||||
"MESS_PORT" => $port,
|
||||
"MESS_RAUTH" => $reqAuthentication,
|
||||
"MESS_ACCOUNT" => $accountFrom,
|
||||
"MESS_PASSWORD" => $password,
|
||||
"MESS_FROM_MAIL" => $fromMail,
|
||||
"MESS_FROM_NAME" => $fromName,
|
||||
"SMTPSECURE" => $smtpSecure,
|
||||
"MESS_TRY_SEND_INMEDIATLY" => $sendTestMail,
|
||||
"MAIL_TO" => $mailTo,
|
||||
"MESS_DEFAULT" => $emailServerDefault
|
||||
);
|
||||
|
||||
$emailSever = new \ProcessMaker\BusinessModel\EmailServer();
|
||||
|
||||
$arrayEmailServerData = $emailSever->testConnection($arrayData);
|
||||
|
||||
$response["data"] = $arrayEmailServerData;
|
||||
} catch (Exception $e) {
|
||||
$response["status"] = "ERROR";
|
||||
$response["message"] = $e->getMessage();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
echo G::json_encode($response);
|
||||
|
||||
@@ -5,21 +5,16 @@ class EmailServer
|
||||
{
|
||||
private $arrayFieldDefinition = array(
|
||||
"MESS_UID" => array("type" => "string", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "emailServerUid"),
|
||||
|
||||
"MESS_ENGINE" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array("PHPMAILER", "MAIL"), "fieldNameAux" => "emailServerEngine"),
|
||||
"MESS_SERVER" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "emailServerServer"),
|
||||
"MESS_PORT" => array("type" => "int", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "emailServerPort"),
|
||||
|
||||
"MESS_RAUTH" => array("type" => "int", "required" => false, "empty" => false, "defaultValues" => array(0, 1), "fieldNameAux" => "emailServerRauth"),
|
||||
|
||||
"MESS_ACCOUNT" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "emailServerUserName"),
|
||||
"MESS_PASSWORD" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "emailServerPassword"),
|
||||
"MESS_FROM_MAIL" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "emailServerFromMail"),
|
||||
"MESS_FROM_NAME" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "emailServerFromName"),
|
||||
"SMTPSECURE" => array("type" => "string", "required" => false, "empty" => false, "defaultValues" => array("No", "tls", "ssl"), "fieldNameAux" => "emailServerSecureConnection"),
|
||||
|
||||
"MESS_TRY_SEND_INMEDIATLY" => array("type" => "int", "required" => false, "empty" => false, "defaultValues" => array(0, 1), "fieldNameAux" => "emailServerSendTestMail"),
|
||||
|
||||
"MAIL_TO" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "emailServerMailTo"),
|
||||
"MESS_DEFAULT" => array("type" => "int", "required" => false, "empty" => false, "defaultValues" => array(0, 1), "fieldNameAux" => "emailServerDefault")
|
||||
);
|
||||
@@ -732,6 +727,80 @@ class EmailServer
|
||||
//Create
|
||||
$cnn = \Propel::getConnection("workflow");
|
||||
|
||||
try {
|
||||
$emailServer = new \EmailServer();
|
||||
|
||||
$passwd = $arrayData["MESS_PASSWORD"];
|
||||
$passwdDec = \G::decrypt($passwd, "EMAILENCRYPT");
|
||||
$auxPass = explode("hash:", $passwdDec);
|
||||
|
||||
if (count($auxPass) > 1) {
|
||||
if (count($auxPass) == 2) {
|
||||
$passwd = $auxPass[1];
|
||||
} else {
|
||||
array_shift($auxPass);
|
||||
$passwd = implode("", $auxPass);
|
||||
}
|
||||
}
|
||||
|
||||
$arrayData["MESS_PASSWORD"] = $passwd;
|
||||
|
||||
if ($arrayData["MESS_PASSWORD"] != "") {
|
||||
$arrayData["MESS_PASSWORD"] = "hash:" . $arrayData["MESS_PASSWORD"];
|
||||
$arrayData["MESS_PASSWORD"] = \G::encrypt($arrayData["MESS_PASSWORD"], "EMAILENCRYPT");
|
||||
}
|
||||
|
||||
$emailServer->fromArray($arrayData, \BasePeer::TYPE_FIELDNAME);
|
||||
|
||||
$emailServerUid = \ProcessMaker\Util\Common::generateUID();
|
||||
|
||||
$emailServer->setMessUid($emailServerUid);
|
||||
|
||||
if ($emailServer->validate()) {
|
||||
$cnn->begin();
|
||||
|
||||
$result = $emailServer->save();
|
||||
|
||||
$cnn->commit();
|
||||
|
||||
if (isset($arrayData["MESS_DEFAULT"]) && (int)($arrayData["MESS_DEFAULT"]) == 1) {
|
||||
$this->setEmailServerDefaultByUid($emailServerUid);
|
||||
}
|
||||
|
||||
//Return
|
||||
return $this->getEmailServer($emailServerUid);
|
||||
} else {
|
||||
$msg = "";
|
||||
|
||||
foreach ($emailServer->getValidationFailures() as $validationFailure) {
|
||||
$msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage();
|
||||
}
|
||||
|
||||
throw new \Exception(\G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . (($msg != "")? "\n" . $msg : ""));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$cnn->rollback();
|
||||
|
||||
throw $e;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Email Server by data
|
||||
*
|
||||
* @param array $arrayData Data
|
||||
*
|
||||
* return array Return data of the new Email Server created
|
||||
*/
|
||||
public function create2(array $arrayData)
|
||||
{
|
||||
try {
|
||||
//Create
|
||||
$cnn = \Propel::getConnection("workflow");
|
||||
|
||||
try {
|
||||
$emailServer = new \EmailServer();
|
||||
|
||||
@@ -804,6 +873,27 @@ class EmailServer
|
||||
|
||||
try {
|
||||
$emailServer = \EmailServerPeer::retrieveByPK($emailServerUid);
|
||||
|
||||
$passwd = $arrayData["MESS_PASSWORD"];
|
||||
$passwdDec = \G::decrypt($passwd, "EMAILENCRYPT");
|
||||
$auxPass = explode("hash:", $passwdDec);
|
||||
|
||||
if (count($auxPass) > 1) {
|
||||
if (count($auxPass) == 2) {
|
||||
$passwd = $auxPass[1];
|
||||
} else {
|
||||
array_shift($auxPass);
|
||||
$passwd = implode("", $auxPass);
|
||||
}
|
||||
}
|
||||
|
||||
$arrayData["MESS_PASSWORD"] = $passwd;
|
||||
|
||||
if ($arrayData["MESS_PASSWORD"] != "") {
|
||||
$arrayData["MESS_PASSWORD"] = "hash:" . $arrayData["MESS_PASSWORD"];
|
||||
$arrayData["MESS_PASSWORD"] = \G::encrypt($arrayData["MESS_PASSWORD"], "EMAILENCRYPT");
|
||||
}
|
||||
|
||||
$emailServer->fromArray($arrayData, \BasePeer::TYPE_FIELDNAME);
|
||||
|
||||
if ($emailServer->validate()) {
|
||||
@@ -1056,6 +1146,21 @@ class EmailServer
|
||||
while ($rsCriteria->next()) {
|
||||
$row = $rsCriteria->getRow();
|
||||
|
||||
$passwd = $row["MESS_PASSWORD"];
|
||||
$passwdDec = \G::decrypt($passwd, "EMAILENCRYPT");
|
||||
$auxPass = explode("hash:", $passwdDec);
|
||||
|
||||
if (count($auxPass) > 1) {
|
||||
if (count($auxPass) == 2) {
|
||||
$passwd = $auxPass[1];
|
||||
} else {
|
||||
array_shift($auxPass);
|
||||
$passwd = implode("", $auxPass);
|
||||
}
|
||||
}
|
||||
|
||||
$row["MESS_PASSWORD"] = $passwd;
|
||||
|
||||
$arrayEmailServer[] = $this->getEmailServerDataFromRecord($row);
|
||||
}
|
||||
|
||||
|
||||
2
workflow/engine/templates/emailServer/emailServer.html
Normal file
2
workflow/engine/templates/emailServer/emailServer.html
Normal file
@@ -0,0 +1,2 @@
|
||||
<div></div>
|
||||
|
||||
1120
workflow/engine/templates/emailServer/emailServer.js
Normal file
1120
workflow/engine/templates/emailServer/emailServer.js
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user