PMCORE-1814

This commit is contained in:
Paula.Quispe
2022-06-20 12:20:37 -04:00
parent d026aec10e
commit a3599ddc92
4 changed files with 53 additions and 25 deletions

View File

@@ -6137,6 +6137,12 @@ msgstr "Delegation Date"
msgid "Delete" msgid "Delete"
msgstr "Delete" msgstr "Delete"
# TRANSLATION
# LABEL/ID_DELETE_EMAIL_SETTINGS
#: LABEL/ID_DELETE_EMAIL_SETTINGS
msgid "Delete Email Settings"
msgstr "Delete Email Settings"
# TRANSLATION # TRANSLATION
# LABEL/ID_DELETED # LABEL/ID_DELETED
#: LABEL/ID_DELETED #: LABEL/ID_DELETED

View File

@@ -57850,6 +57850,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
( 'LABEL','ID_DELEGATE_USER','en','Delegated User','2014-01-15') , ( 'LABEL','ID_DELEGATE_USER','en','Delegated User','2014-01-15') ,
( 'LABEL','ID_DELEGATION_DATE','en','Delegation Date','2014-01-15') , ( 'LABEL','ID_DELEGATION_DATE','en','Delegation Date','2014-01-15') ,
( 'LABEL','ID_DELETE','en','Delete','2014-01-15') , ( 'LABEL','ID_DELETE','en','Delete','2014-01-15') ,
( 'LABEL','ID_DELETE_EMAIL_SETTINGS','en','Delete Email Settings','2022-06-29') ,
( 'LABEL','ID_DELETED','en','Deleted','2014-01-15') , ( 'LABEL','ID_DELETED','en','Deleted','2014-01-15') ,
( 'LABEL','ID_DELETED_SUCCESSFULLY','en','Deleted Successfully','2014-01-15') , ( 'LABEL','ID_DELETED_SUCCESSFULLY','en','Deleted Successfully','2014-01-15') ,
( 'LABEL','ID_DELETE_ACTION','en','Delete case','2020-01-15') , ( 'LABEL','ID_DELETE_ACTION','en','Delete case','2020-01-15') ,

View File

@@ -1,5 +1,6 @@
<?php <?php
use ProcessMaker\BusinessModel\EmailServer;
use ProcessMaker\Core\System; use ProcessMaker\Core\System;
use ProcessMaker\GmailOAuth\GmailOAuth; use ProcessMaker\GmailOAuth\GmailOAuth;
use ProcessMaker\Office365OAuth\Office365OAuth; use ProcessMaker\Office365OAuth\Office365OAuth;
@@ -11,7 +12,6 @@ $RBAC->allows(basename(__FILE__), $option);
switch ($option) { switch ($option) {
case "INS": case "INS":
$arrayData = []; $arrayData = [];
$server = ""; $server = "";
$port = ""; $port = "";
$incomingServer = ""; $incomingServer = "";
@@ -19,7 +19,6 @@ switch ($option) {
$reqAuthentication = 0; $reqAuthentication = 0;
$password = ""; $password = "";
$smtpSecure = ""; $smtpSecure = "";
$cboEmailEngine = $_POST["cboEmailEngine"]; $cboEmailEngine = $_POST["cboEmailEngine"];
$accountFrom = (isset($_POST["accountFrom"])) ? $_POST["accountFrom"] : ""; $accountFrom = (isset($_POST["accountFrom"])) ? $_POST["accountFrom"] : "";
$fromName = $_POST["fromName"]; $fromName = $_POST["fromName"];
@@ -45,7 +44,7 @@ switch ($option) {
} }
try { try {
$arrayData = array( $arrayData = [
"MESS_ENGINE" => $cboEmailEngine, "MESS_ENGINE" => $cboEmailEngine,
"MESS_SERVER" => $server, "MESS_SERVER" => $server,
"MESS_PORT" => $port, "MESS_PORT" => $port,
@@ -60,11 +59,22 @@ switch ($option) {
"MESS_TRY_SEND_INMEDIATLY" => $sendTestMail, "MESS_TRY_SEND_INMEDIATLY" => $sendTestMail,
"MAIL_TO" => $mailTo, "MAIL_TO" => $mailTo,
"MESS_DEFAULT" => $emailServerDefault "MESS_DEFAULT" => $emailServerDefault
); ];
$emailSever = new \ProcessMaker\BusinessModel\EmailServer();
$emailSever = new EmailServer();
$arrayEmailServerData = $emailSever->create($arrayData); $arrayEmailServerData = $emailSever->create($arrayData);
// Register the log
G::auditLog(
"CreateEmailSettings",
"SetDefaultConfiguration-> " . $emailServerDefault .
", EmailEngine-> " . $cboEmailEngine .
", Server-> " . $server .
", Port-> " . $port .
", RequireAuthentication-> " . $reqAuthentication .
", FromMail-> " . $fromMail .
", FromName-> " . $fromName .
", UseSecureConnection-> " . $smtpSecure
);
$response["status"] = "OK"; $response["status"] = "OK";
$response["data"] = $arrayEmailServerData; $response["data"] = $arrayEmailServerData;
@@ -75,9 +85,7 @@ switch ($option) {
break; break;
case "UPD": case "UPD":
$arrayData = []; $arrayData = [];
$emailServerUid = $_POST["emailServerUid"]; $emailServerUid = $_POST["emailServerUid"];
$server = ""; $server = "";
$port = ""; $port = "";
$incomingServer = ""; $incomingServer = "";
@@ -85,7 +93,6 @@ switch ($option) {
$reqAuthentication = 0; $reqAuthentication = 0;
$password = ""; $password = "";
$smtpSecure = ""; $smtpSecure = "";
$cboEmailEngine = $_POST["cboEmailEngine"]; $cboEmailEngine = $_POST["cboEmailEngine"];
$accountFrom = (isset($_POST["accountFrom"])) ? $_POST["accountFrom"] : ""; $accountFrom = (isset($_POST["accountFrom"])) ? $_POST["accountFrom"] : "";
$fromName = $_POST["fromName"]; $fromName = $_POST["fromName"];
@@ -111,7 +118,7 @@ switch ($option) {
} }
try { try {
$arrayData = array( $arrayData = [
"MESS_ENGINE" => $cboEmailEngine, "MESS_ENGINE" => $cboEmailEngine,
"MESS_SERVER" => $server, "MESS_SERVER" => $server,
"MESS_PORT" => $port, "MESS_PORT" => $port,
@@ -126,11 +133,23 @@ switch ($option) {
"MESS_TRY_SEND_INMEDIATLY" => $sendTestMail, "MESS_TRY_SEND_INMEDIATLY" => $sendTestMail,
"MAIL_TO" => $mailTo, "MAIL_TO" => $mailTo,
"MESS_DEFAULT" => $emailServerDefault "MESS_DEFAULT" => $emailServerDefault
); ];
$emailSever = new \ProcessMaker\BusinessModel\EmailServer();
$emailSever = new EmailServer();
$arrayEmailServerData = $emailSever->update($emailServerUid, $arrayData); $arrayEmailServerData = $emailSever->update($emailServerUid, $arrayData);
// Register the log
G::auditLog(
"UpdateEmailSettings",
"EmailServer-> " . $emailServerUid .
", SetDefaultConfiguration-> " . $emailServerDefault .
", EmailEngine-> " . $cboEmailEngine .
", Server-> " . $server .
", Port-> " . $port .
", RequireAuthentication-> " . $reqAuthentication .
", FromMail-> " . $fromMail .
", FromName-> " . $fromName .
", UseSecureConnection-> " . $smtpSecure
);
$response["status"] = "OK"; $response["status"] = "OK";
$response["data"] = $arrayEmailServerData; $response["data"] = $arrayEmailServerData;
@@ -144,9 +163,13 @@ switch ($option) {
$emailServerUid = $_POST["emailServerUid"]; $emailServerUid = $_POST["emailServerUid"];
try { try {
$emailSever = new \ProcessMaker\BusinessModel\EmailServer(); $emailSever = new EmailServer();
$result = $emailSever->delete($emailServerUid); $result = $emailSever->delete($emailServerUid);
// Register the log
G::auditLog(
"DeleteEmailSettings",
"EmailServer-> " . $emailServerUid
);
$response["status"] = "OK"; $response["status"] = "OK";
} catch (Exception $e) { } catch (Exception $e) {
@@ -157,16 +180,14 @@ switch ($option) {
case "LST": case "LST":
$pageSize = $_POST["pageSize"]; $pageSize = $_POST["pageSize"];
$search = $_POST["search"]; $search = $_POST["search"];
$sortField = (isset($_POST["sort"])) ? $_POST["sort"] : ""; $sortField = (isset($_POST["sort"])) ? $_POST["sort"] : "";
$sortDir = (isset($_POST["dir"])) ? $_POST["dir"] : ""; $sortDir = (isset($_POST["dir"])) ? $_POST["dir"] : "";
$start = (isset($_POST["start"])) ? $_POST["start"] : 0; $start = (isset($_POST["start"])) ? $_POST["start"] : 0;
$limit = (isset($_POST["limit"])) ? $_POST["limit"] : $pageSize; $limit = (isset($_POST["limit"])) ? $_POST["limit"] : $pageSize;
try { try {
$emailSever = new \ProcessMaker\BusinessModel\EmailServer(); $emailSever = new EmailServer();
$result = $emailSever->getEmailServers(["filter" => $search], $sortField, $sortDir, $start, $limit);
$result = $emailSever->getEmailServers(array("filter" => $search), $sortField, $sortDir, $start, $limit);
$response["status"] = "OK"; $response["status"] = "OK";
$response["success"] = true; $response["success"] = true;
@@ -205,7 +226,7 @@ switch ($option) {
} }
try { try {
$arrayData = array( $arrayData = [
"MESS_ENGINE" => $cboEmailEngine, "MESS_ENGINE" => $cboEmailEngine,
"MESS_SERVER" => $server, "MESS_SERVER" => $server,
"MESS_PORT" => $port, "MESS_PORT" => $port,
@@ -218,10 +239,9 @@ switch ($option) {
"MESS_TRY_SEND_INMEDIATLY" => $sendTestMail, "MESS_TRY_SEND_INMEDIATLY" => $sendTestMail,
"MAIL_TO" => $mailTo, "MAIL_TO" => $mailTo,
"MESS_DEFAULT" => $emailServerDefault "MESS_DEFAULT" => $emailServerDefault
); ];
$emailSever = new \ProcessMaker\BusinessModel\EmailServer();
$emailSever = new EmailServer();
$arrayEmailServerData = $emailSever->testConnection($arrayData); $arrayEmailServerData = $emailSever->testConnection($arrayData);
$response["data"] = $arrayEmailServerData; $response["data"] = $arrayEmailServerData;

View File

@@ -104,9 +104,10 @@ class AuditLog
"ExportLanguage" => G::LoadTranslation("ID_EXPORT_LANGUAGE"), "ExportLanguage" => G::LoadTranslation("ID_EXPORT_LANGUAGE"),
"DeleteLanguage" => G::LoadTranslation("ID_DELETE_LAGUAGE"), "DeleteLanguage" => G::LoadTranslation("ID_DELETE_LAGUAGE"),
// Settings // Settings
"UploadSystemSettings" => G::LoadTranslation("ID_UPLOAD_SYSTEM_SETTINGS"),
"UpdateEmailSettings" => G::LoadTranslation("ID_UPDATE_EMAIL_SETTINGS"),
"CreateEmailSettings" => G::LoadTranslation("ID_CREATE_EMAIL_SETTINGS"), "CreateEmailSettings" => G::LoadTranslation("ID_CREATE_EMAIL_SETTINGS"),
"DeleteEmailSettings" => G::LoadTranslation("ID_DELETE_EMAIL_SETTINGS"),
"UpdateEmailSettings" => G::LoadTranslation("ID_UPDATE_EMAIL_SETTINGS"),
"UploadSystemSettings" => G::LoadTranslation("ID_UPLOAD_SYSTEM_SETTINGS"),
// Logo // Logo
"UploadLogo" => G::LoadTranslation("ID_UPLOAD_LOGO"), "UploadLogo" => G::LoadTranslation("ID_UPLOAD_LOGO"),
"DeleteLogo" => G::LoadTranslation("ID_DELETE_LOGO"), "DeleteLogo" => G::LoadTranslation("ID_DELETE_LOGO"),