PMCORE-959
This commit is contained in:
@@ -364,6 +364,46 @@ class EmailServerTest extends TestCase
|
|||||||
$emailServer->sendTestMail($data);
|
$emailServer->sendTestMail($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It test the delete method
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\BusinessModel\EmailServer::delete()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_should_test_the_delete_method()
|
||||||
|
{
|
||||||
|
$email = factory(EmailServerModel::class)->create();
|
||||||
|
|
||||||
|
$emailServer = new EmailServer();
|
||||||
|
$res = $emailServer->delete($email['MESS_UID']);
|
||||||
|
|
||||||
|
$this->assertNull($res);
|
||||||
|
|
||||||
|
$this->expectExceptionMessage("**ID_EMAIL_SERVER_DOES_NOT_EXIST**");
|
||||||
|
$emailServer->getEmailServer($email['MESS_UID']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It test the delete method with an IMAP email server
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\BusinessModel\EmailServer::delete()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_should_test_the_delete_method_with_imap()
|
||||||
|
{
|
||||||
|
$email = factory(EmailServerModel::class)->create([
|
||||||
|
'MESS_ENGINE' => 'IMAP'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$emailServer = new EmailServer();
|
||||||
|
$res = $emailServer->delete($email['MESS_UID']);
|
||||||
|
|
||||||
|
$this->assertNull($res);
|
||||||
|
|
||||||
|
$this->expectExceptionMessage("**ID_EMAIL_SERVER_DOES_NOT_EXIST**");
|
||||||
|
$emailServer->getEmailServer($email['MESS_UID']);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call the tearDown method
|
* Call the tearDown method
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Tests\unit\workflow\engine\src\ProcessMaker\Model;
|
namespace Tests\unit\workflow\engine\src\ProcessMaker\Model;
|
||||||
|
|
||||||
|
use EmailServer;
|
||||||
use ProcessMaker\Model\Application;
|
use ProcessMaker\Model\Application;
|
||||||
use ProcessMaker\Model\AbeConfiguration;
|
use ProcessMaker\Model\AbeConfiguration;
|
||||||
use ProcessMaker\Model\AbeRequest;
|
use ProcessMaker\Model\AbeRequest;
|
||||||
@@ -105,4 +106,82 @@ class AbeConfigurationTest extends TestCase
|
|||||||
//Asserts the result has one record
|
//Asserts the result has one record
|
||||||
$this->assertEmpty($res);
|
$this->assertEmpty($res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It should test the updateReceiverUidToEmpty method
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\Model\AbeConfiguration::updateReceiverUidToEmpty()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_should_test_the_update_abe_configuration_receiver_uid_method()
|
||||||
|
{
|
||||||
|
$emailServer = factory(EmailServerModel::class)->create();
|
||||||
|
|
||||||
|
$abeConfigurationFactory = factory(AbeConfiguration::class)->create([
|
||||||
|
'ABE_EMAIL_SERVER_UID' => $emailServer['MESS_UID']
|
||||||
|
]);
|
||||||
|
|
||||||
|
$abeConfiguration = new AbeConfiguration();
|
||||||
|
$abeConfiguration->updateReceiverUidToEmpty($emailServer['MESS_UID']);
|
||||||
|
|
||||||
|
$query = AbeConfiguration::query()->select();
|
||||||
|
$query->where('ABE_UID', $abeConfigurationFactory['ABE_UID']);
|
||||||
|
$updatedAbe = $query->get()->values()->toArray();
|
||||||
|
|
||||||
|
$this->assertEquals($updatedAbe[0]['ABE_EMAIL_SERVER_RECEIVER_UID'], '');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It should test the updateEmailServerUidToDefaultOrEmpty method when there is not a default server
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\Model\AbeConfiguration::updateEmailServerUidToDefaultOrEmpty()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_should_test_the_update_abe_configuration_email_server_uid_method_when_there_is_not_a_default_server()
|
||||||
|
{
|
||||||
|
EmailServerModel::query()->delete();
|
||||||
|
$emailServer = factory(EmailServerModel::class)->create();
|
||||||
|
|
||||||
|
$abeConfigurationFactory = factory(AbeConfiguration::class)->create([
|
||||||
|
'ABE_EMAIL_SERVER_UID' => $emailServer['MESS_UID']
|
||||||
|
]);
|
||||||
|
|
||||||
|
$abeConfiguration = new AbeConfiguration();
|
||||||
|
$abeConfiguration->updateEmailServerUidToDefaultOrEmpty($emailServer['MESS_UID']);
|
||||||
|
|
||||||
|
$query = AbeConfiguration::query()->select();
|
||||||
|
$query->where('ABE_UID', $abeConfigurationFactory['ABE_UID']);
|
||||||
|
$updatedAbe = $query->get()->values()->toArray();
|
||||||
|
|
||||||
|
$this->assertEquals($updatedAbe[0]['ABE_EMAIL_SERVER_UID'], '');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It should test the updateEmailServerUidToDefaultOrEmpty method when there is a default server
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\Model\AbeConfiguration::updateEmailServerUidToDefaultOrEmpty()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_should_test_the_update_abe_configuration_email_server_uid_method_when_there_is_a_default_server()
|
||||||
|
{
|
||||||
|
EmailServerModel::query()->delete();
|
||||||
|
$emailServer = factory(EmailServerModel::class)->create();
|
||||||
|
|
||||||
|
$defaultServer = factory(EmailServerModel::class)->create([
|
||||||
|
'MESS_DEFAULT' => 1
|
||||||
|
]);
|
||||||
|
|
||||||
|
$abeConfigurationFactory = factory(AbeConfiguration::class)->create([
|
||||||
|
'ABE_EMAIL_SERVER_UID' => $emailServer['MESS_UID']
|
||||||
|
]);
|
||||||
|
|
||||||
|
$abeConfiguration = new AbeConfiguration();
|
||||||
|
$abeConfiguration->updateEmailServerUidToDefaultOrEmpty($emailServer['MESS_UID']);
|
||||||
|
|
||||||
|
$query = AbeConfiguration::query()->select();
|
||||||
|
$query->where('ABE_UID', $abeConfigurationFactory['ABE_UID']);
|
||||||
|
$updatedAbe = $query->get()->values()->toArray();
|
||||||
|
|
||||||
|
$this->assertEquals($updatedAbe[0]['ABE_EMAIL_SERVER_UID'], $defaultServer['MESS_UID']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\unit\workflow\engine\src\ProcessMaker\Model;
|
||||||
|
|
||||||
|
use ProcessMaker\Model\EmailEvent;
|
||||||
|
use ProcessMaker\Model\EmailServerModel;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class EmailEventTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Call the setUp parent method
|
||||||
|
*/
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
parent::setUp(); // TODO: Change the autogenerated stub
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It tests the updateServerAndFromToDefaultOrEmpty method
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\Model\EmailEvent::updateServerAndFromToDefaultOrEmpty()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_should_test_the_update_event_method()
|
||||||
|
{
|
||||||
|
EmailServerModel::query()->delete();
|
||||||
|
$emailServer = factory(EmailServerModel::class)->create();
|
||||||
|
$emailEventFactory = factory(EmailEvent::class)->create([
|
||||||
|
'EMAIL_SERVER_UID' => $emailServer['MESS_UID']
|
||||||
|
]);
|
||||||
|
|
||||||
|
$emailEvent = new EmailEvent();
|
||||||
|
$emailEvent->updateServerAndFromToDefaultOrEmpty($emailServer['MESS_UID']);
|
||||||
|
|
||||||
|
$query = EmailEvent::query()->select();
|
||||||
|
$query->where('EMAIL_EVENT_UID', $emailEventFactory['EMAIL_EVENT_UID']);
|
||||||
|
$updatedEmailEvent = $query->get()->values()->toArray();
|
||||||
|
|
||||||
|
$this->assertEquals($updatedEmailEvent[0]['EMAIL_SERVER_UID'], '');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It tests the updateServerAndFromToDefaultOrEmpty method with a default email server
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\Model\EmailEvent::updateServerAndFromToDefaultOrEmpty()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_should_test_the_update_event_method_with_a_default_email_server()
|
||||||
|
{
|
||||||
|
EmailServerModel::query()->delete();
|
||||||
|
$emailServer = factory(EmailServerModel::class)->create();
|
||||||
|
$emailServerDefault = factory(EmailServerModel::class)->create([
|
||||||
|
'MESS_DEFAULT' => 1
|
||||||
|
]);
|
||||||
|
$emailEventFactory = factory(EmailEvent::class)->create([
|
||||||
|
'EMAIL_SERVER_UID' => $emailServer['MESS_UID']
|
||||||
|
]);
|
||||||
|
|
||||||
|
$emailEvent = new EmailEvent();
|
||||||
|
$emailEvent->updateServerAndFromToDefaultOrEmpty($emailServer['MESS_UID']);
|
||||||
|
|
||||||
|
$query = EmailEvent::query()->select();
|
||||||
|
$query->where('EMAIL_EVENT_UID', $emailEventFactory['EMAIL_EVENT_UID']);
|
||||||
|
$updatedEmailEvent = $query->get()->values()->toArray();
|
||||||
|
|
||||||
|
$this->assertEquals($updatedEmailEvent[0]['EMAIL_SERVER_UID'], $emailServerDefault['MESS_UID']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call the tearDown parent method
|
||||||
|
*/
|
||||||
|
public function tearDown()
|
||||||
|
{
|
||||||
|
parent::tearDown(); // TODO: Change the autogenerated stub
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -86,4 +86,38 @@ class EmailServerModelTest extends TestCase
|
|||||||
//Assert the result es not empty
|
//Assert the result es not empty
|
||||||
$this->assertNotEmpty($res);
|
$this->assertNotEmpty($res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It tests the isImap method when there is an IMAP server
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\Model\EmailServerModel::isImap()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_should_test_the_is_imap_method_when_there_is_an_imap_server()
|
||||||
|
{
|
||||||
|
EmailServerModel::query()->delete();
|
||||||
|
$emailServer = factory(EmailServerModel::class)->create([
|
||||||
|
'MESS_ENGINE' => 'IMAP'
|
||||||
|
]);
|
||||||
|
$emailServerModel = new EmailServerModel();
|
||||||
|
$r = $emailServerModel->isImap($emailServer['MESS_UID']);
|
||||||
|
|
||||||
|
$this->assertTrue($r);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It tests the isImap method when there is not an IMAP server
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\Model\EmailServerModel::isImap()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_should_test_the_is_imap_method_when_there_is_not_an_imap_server()
|
||||||
|
{
|
||||||
|
EmailServerModel::query()->delete();
|
||||||
|
$emailServer = factory(EmailServerModel::class)->create();
|
||||||
|
$emailServerModel = new EmailServerModel();
|
||||||
|
$r = $emailServerModel->isImap($emailServer['MESS_UID']);
|
||||||
|
|
||||||
|
$this->assertFalse($r);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -7100,8 +7100,8 @@ msgstr "Delete data..."
|
|||||||
# TRANSLATION
|
# TRANSLATION
|
||||||
# LABEL/ID_EMAIL_SERVER_DELETE_WARNING_MESSAGE
|
# LABEL/ID_EMAIL_SERVER_DELETE_WARNING_MESSAGE
|
||||||
#: LABEL/ID_EMAIL_SERVER_DELETE_WARNING_MESSAGE
|
#: LABEL/ID_EMAIL_SERVER_DELETE_WARNING_MESSAGE
|
||||||
msgid "[LABEL/ID_EMAIL_SERVER_DELETE_WARNING_MESSAGE] Do you want to delete the Email Server?"
|
msgid "[LABEL/ID_EMAIL_SERVER_DELETE_WARNING_MESSAGE] Are you sure you want to delete this Email Server? the components that were using it will now use the default email server."
|
||||||
msgstr "Do you want to delete the Email Server?"
|
msgstr "Are you sure you want to delete this Email Server? the components that were using it will now use the default email server."
|
||||||
|
|
||||||
# TRANSLATION
|
# TRANSLATION
|
||||||
# LABEL/ID_EMAIL_SERVER_DOES_NOT_EXIST
|
# LABEL/ID_EMAIL_SERVER_DOES_NOT_EXIST
|
||||||
|
|||||||
@@ -58003,7 +58003,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
|
|||||||
( 'LABEL','ID_EMAIL_SERVER_CONFIRM_DELETE','en','Do you want to delete the Email Server?','2014-12-24') ,
|
( 'LABEL','ID_EMAIL_SERVER_CONFIRM_DELETE','en','Do you want to delete the Email Server?','2014-12-24') ,
|
||||||
( 'LABEL','ID_EMAIL_SERVER_DEFAULT','en','Default','2014-12-24') ,
|
( 'LABEL','ID_EMAIL_SERVER_DEFAULT','en','Default','2014-12-24') ,
|
||||||
( 'LABEL','ID_EMAIL_SERVER_DELETE_DATA','en','Delete data...','2014-12-24') ,
|
( 'LABEL','ID_EMAIL_SERVER_DELETE_DATA','en','Delete data...','2014-12-24') ,
|
||||||
( 'LABEL','ID_EMAIL_SERVER_DELETE_WARNING_MESSAGE','en','Do you want to delete the Email Server?','2015-01-15') ,
|
( 'LABEL','ID_EMAIL_SERVER_DELETE_WARNING_MESSAGE','en','Are you sure you want to delete this Email Server? the components that were using it will now use the default email server.','2015-01-15') ,
|
||||||
( 'LABEL','ID_EMAIL_SERVER_DOES_NOT_EXIST','en','The email server with {0}: {1} does not exist.','2014-12-24') ,
|
( 'LABEL','ID_EMAIL_SERVER_DOES_NOT_EXIST','en','The email server with {0}: {1} does not exist.','2014-12-24') ,
|
||||||
( 'LABEL','ID_EMAIL_SERVER_EDIT','en','Edit Email Server','2014-12-24') ,
|
( 'LABEL','ID_EMAIL_SERVER_EDIT','en','Edit Email Server','2014-12-24') ,
|
||||||
( 'LABEL','ID_EMAIL_SERVER_FROM_MAIL_EMPTY','en','The email has not been sent because configuration email in the Email Server Settings (admin/settings/email) is empty. Please fill this information.','2016-03-13') ,
|
( 'LABEL','ID_EMAIL_SERVER_FROM_MAIL_EMPTY','en','The email has not been sent because configuration email in the Email Server Settings (admin/settings/email) is empty. Please fill this information.','2016-03-13') ,
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ use Exception;
|
|||||||
use G;
|
use G;
|
||||||
use Illuminate\Support\Facades\Crypt;
|
use Illuminate\Support\Facades\Crypt;
|
||||||
use ProcessMaker\Core\System;
|
use ProcessMaker\Core\System;
|
||||||
|
use ProcessMaker\Model\AbeConfiguration;
|
||||||
|
use ProcessMaker\Model\EmailEvent;
|
||||||
|
use ProcessMaker\Model\EmailServerModel;
|
||||||
use SpoolRun;
|
use SpoolRun;
|
||||||
use TemplatePower;
|
use TemplatePower;
|
||||||
use WsBase;
|
use WsBase;
|
||||||
@@ -1071,6 +1074,11 @@ class EmailServer
|
|||||||
public function delete($emailServerUid)
|
public function delete($emailServerUid)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
$emailServerModel = new EmailServerModel();
|
||||||
|
//Verify if the email server is IMAP
|
||||||
|
$isImap = $emailServerModel->isImap($emailServerUid);
|
||||||
|
$abeConfiguration = new AbeConfiguration();
|
||||||
|
|
||||||
//Verify data
|
//Verify data
|
||||||
$this->throwExceptionIfNotExistsEmailServer($emailServerUid, $this->arrayFieldNameForException["emailServerUid"]);
|
$this->throwExceptionIfNotExistsEmailServer($emailServerUid, $this->arrayFieldNameForException["emailServerUid"]);
|
||||||
$this->throwExceptionIfIsDefault($emailServerUid, $this->arrayFieldNameForException["emailServerUid"]);
|
$this->throwExceptionIfIsDefault($emailServerUid, $this->arrayFieldNameForException["emailServerUid"]);
|
||||||
@@ -1078,6 +1086,18 @@ class EmailServer
|
|||||||
$criteria->add(\EmailServerPeer::MESS_UID, $emailServerUid, \Criteria::EQUAL);
|
$criteria->add(\EmailServerPeer::MESS_UID, $emailServerUid, \Criteria::EQUAL);
|
||||||
\EmailServerPeer::doDelete($criteria);
|
\EmailServerPeer::doDelete($criteria);
|
||||||
|
|
||||||
|
//If the email server protocol is IMAP, then the field Receiver account of the Email Response option in Actions by Email will be empty.
|
||||||
|
if ($isImap) {
|
||||||
|
$abeConfiguration->updateReceiverUidToEmpty($emailServerUid);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Update the ABE_CONFIGURATION email server
|
||||||
|
$abeConfiguration->updateEmailServerUidToDefaultOrEmpty($emailServerUid);
|
||||||
|
|
||||||
|
//Update the events that use this server
|
||||||
|
$emailEvent = new EmailEvent();
|
||||||
|
$emailEvent->updateServerAndFromToDefaultOrEmpty($emailServerUid);
|
||||||
|
|
||||||
//Logging the delete action
|
//Logging the delete action
|
||||||
$this->getDefaultContextLog();
|
$this->getDefaultContextLog();
|
||||||
$info = array(
|
$info = array(
|
||||||
|
|||||||
@@ -97,4 +97,41 @@ class AbeConfiguration extends model
|
|||||||
|
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the Receiver Uid when the email server is deleted
|
||||||
|
*
|
||||||
|
* @param string $emailServerUid
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function updateReceiverUidToEmpty($emailServerUid)
|
||||||
|
{
|
||||||
|
$query = AbeConfiguration::query();
|
||||||
|
|
||||||
|
$query->where('ABE_EMAIL_SERVER_RECEIVER_UID', '=', $emailServerUid);
|
||||||
|
|
||||||
|
$query->update(['ABE_EMAIL_SERVER_RECEIVER_UID' => '']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the Email Server Uid when the email server is deleted
|
||||||
|
*
|
||||||
|
* @param string $emailServerUid
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function updateEmailServerUidToDefaultOrEmpty($emailServerUid)
|
||||||
|
{
|
||||||
|
$emailServerModel = new EmailServerModel();
|
||||||
|
$emailServerDefault = $emailServerModel->getEmailServerDefault();
|
||||||
|
|
||||||
|
$query = AbeConfiguration::query();
|
||||||
|
|
||||||
|
$query->where('ABE_EMAIL_SERVER_UID', '=', $emailServerUid);
|
||||||
|
|
||||||
|
if (!empty($emailServerDefault)) {
|
||||||
|
$query->update(['ABE_EMAIL_SERVER_UID' => $emailServerDefault['MESS_UID']]);
|
||||||
|
} else {
|
||||||
|
$query->update(['ABE_EMAIL_SERVER_UID' => '']);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,31 @@
|
|||||||
namespace ProcessMaker\Model;
|
namespace ProcessMaker\Model;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Support\Facades\DB;
|
use ProcessMaker\Model\EmailServerModel;
|
||||||
|
|
||||||
class EmailEvent extends Model
|
class EmailEvent extends Model
|
||||||
{
|
{
|
||||||
protected $table = 'EMAIL_EVENT';
|
protected $table = 'EMAIL_EVENT';
|
||||||
public $timestamps = false;
|
public $timestamps = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the email event when the email server is deleted
|
||||||
|
*
|
||||||
|
* @param $emailServerUid
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function updateServerAndFromToDefaultOrEmpty($emailServerUid)
|
||||||
|
{
|
||||||
|
$emailServerModel = new EmailServerModel();
|
||||||
|
$emailServerDefault = $emailServerModel->getEmailServerDefault();
|
||||||
|
$query = EmailEvent::query();
|
||||||
|
|
||||||
|
$query->where('EMAIL_SERVER_UID', '=', $emailServerUid);
|
||||||
|
|
||||||
|
if (!empty($emailServerDefault)) {
|
||||||
|
$query->update(['EMAIL_SERVER_UID' => $emailServerDefault['MESS_UID'], 'EMAIL_EVENT_FROM' => $emailServerDefault['MESS_ACCOUNT']]);
|
||||||
|
} else {
|
||||||
|
$query->update(['EMAIL_SERVER_UID' => '', 'EMAIL_EVENT_FROM' => '']);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,4 +103,22 @@ class EmailServerModel extends Model
|
|||||||
|
|
||||||
return $firstElement;
|
return $firstElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the email server is IMAP
|
||||||
|
*
|
||||||
|
* @param string $emailServerUid
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isImap($emailServerUid)
|
||||||
|
{
|
||||||
|
$query = EmailServerModel::query()->select(['EMAIL_SERVER.MESS_UID']);
|
||||||
|
$query->where('EMAIL_SERVER.MESS_UID', '=', $emailServerUid);
|
||||||
|
$query->where('MESS_ENGINE', '=', 'IMAP');
|
||||||
|
$res = $query->get()->values()->toArray();
|
||||||
|
if (!empty($res)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user