PMC-778
This commit is contained in:
committed by
Paula Quispe
parent
5344dc7f32
commit
90a8150bd7
100
workflow/engine/src/ProcessMaker/Model/AbeConfiguration.php
Normal file
100
workflow/engine/src/ProcessMaker/Model/AbeConfiguration.php
Normal file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class AbeConfiguration extends model
|
||||
{
|
||||
protected $table = "ABE_CONFIGURATION";
|
||||
// We do not have create/update timestamps for this table
|
||||
public $timestamps = false;
|
||||
|
||||
/**
|
||||
* Relation between process
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function process()
|
||||
{
|
||||
return $this->belongsTo(Process::class, 'PRO_UID', 'PRO_UID');
|
||||
}
|
||||
|
||||
/**
|
||||
* Relation between task
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function task()
|
||||
{
|
||||
return $this->belongsTo(Task::class, 'TAS_UID', 'TAS_UID');
|
||||
}
|
||||
|
||||
/**
|
||||
* Relation between emailServer
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function emailServer()
|
||||
{
|
||||
return $this->belongsTo(EmailServer::class, 'MESS_UID', 'MESS_UID');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get information about the notification sent
|
||||
*
|
||||
* @param string $abeRequestUid
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getAbeRequest($abeRequestUid)
|
||||
{
|
||||
$selectedColumns = [
|
||||
'ABE_CONFIGURATION.ABE_UID',
|
||||
'ABE_CONFIGURATION.PRO_UID',
|
||||
'ABE_CONFIGURATION.TAS_UID',
|
||||
'ABE_CONFIGURATION.ABE_EMAIL_SERVER_UID',
|
||||
'ABE_CONFIGURATION.ABE_TYPE',
|
||||
'ABE_CONFIGURATION.ABE_MAILSERVER_OR_MAILCURRENT',
|
||||
'TASK.TAS_ID',
|
||||
'PROCESS.PRO_ID',
|
||||
'ABE_REQUESTS.ABE_REQ_UID',
|
||||
'ABE_REQUESTS.APP_UID',
|
||||
'ABE_REQUESTS.DEL_INDEX',
|
||||
'ABE_REQUESTS.ABE_REQ_SENT_TO',
|
||||
'ABE_REQUESTS.ABE_REQ_SUBJECT',
|
||||
'ABE_REQUESTS.ABE_REQ_BODY',
|
||||
'ABE_REQUESTS.ABE_REQ_ANSWERED',
|
||||
'ABE_REQUESTS.ABE_REQ_STATUS',
|
||||
'APP_DELEGATION.DEL_FINISH_DATE',
|
||||
'APP_DELEGATION.APP_NUMBER'
|
||||
];
|
||||
$query = AbeConfiguration::query()->select($selectedColumns);
|
||||
|
||||
$query->leftJoin('TASK', function ($join) {
|
||||
$join->on('ABE_CONFIGURATION.TAS_UID', '=', 'TASK.TAS_UID');
|
||||
});
|
||||
$query->leftJoin('PROCESS', function ($join) {
|
||||
$join->on('ABE_CONFIGURATION.PRO_UID', '=', 'PROCESS.PRO_UID');
|
||||
});
|
||||
$query->leftJoin('ABE_REQUESTS', function ($join) {
|
||||
$join->on('ABE_CONFIGURATION.ABE_UID', '=', 'ABE_REQUESTS.ABE_UID');
|
||||
});
|
||||
$query->leftJoin('APP_DELEGATION', function ($join) {
|
||||
$join->on('ABE_REQUESTS.APP_UID', '=', 'APP_DELEGATION.APP_UID')
|
||||
->on('ABE_REQUESTS.DEL_INDEX', '=', 'APP_DELEGATION.DEL_INDEX');
|
||||
});
|
||||
$query->where('ABE_REQUESTS.ABE_REQ_UID', '=', $abeRequestUid);
|
||||
|
||||
$query->limit(1);
|
||||
|
||||
$res = $query->get()->values()->toArray();
|
||||
|
||||
if (!empty($res)) {
|
||||
return $res[0];
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
33
workflow/engine/src/ProcessMaker/Model/AbeRequest.php
Normal file
33
workflow/engine/src/ProcessMaker/Model/AbeRequest.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class AbeRequest extends Model
|
||||
{
|
||||
protected $table = "ABE_REQUESTS";
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
/**
|
||||
* Relation between application
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
*/
|
||||
public function application()
|
||||
{
|
||||
return $this->hasOne(Application::class, 'APP_UID', 'APP_UID');
|
||||
}
|
||||
|
||||
/**
|
||||
* Relation between abeConfiguration
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
*/
|
||||
public function abeConfiguration()
|
||||
{
|
||||
return $this->hasOne(AbeConfiguration::class, 'ABE_UID', 'ABE_UID');
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class EmailServer extends Model
|
||||
{
|
||||
protected $table = 'EMAIL_SERVER';
|
||||
protected $primaryKey = 'MESS_UID';
|
||||
public $timestamps = false;
|
||||
|
||||
}
|
||||
84
workflow/engine/src/ProcessMaker/Model/EmailServerModel.php
Normal file
84
workflow/engine/src/ProcessMaker/Model/EmailServerModel.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class EmailServerModel extends Model
|
||||
{
|
||||
protected $table = 'EMAIL_SERVER';
|
||||
public $timestamps = false;
|
||||
|
||||
/**
|
||||
* Obtain the selected columns of the EMAIL_SERVER table
|
||||
*
|
||||
* @param string $messUid
|
||||
* @return array
|
||||
* @see ProcessMaker\BusinessModel\ActionsByEmail::forwardMail()
|
||||
*/
|
||||
public function getEmailServer($messUid)
|
||||
{
|
||||
$selectedColumns = [
|
||||
'EMAIL_SERVER.MESS_UID',
|
||||
'EMAIL_SERVER.MESS_ENGINE',
|
||||
'EMAIL_SERVER.MESS_SERVER',
|
||||
'EMAIL_SERVER.MESS_PORT',
|
||||
'EMAIL_SERVER.MESS_RAUTH',
|
||||
'EMAIL_SERVER.MESS_ACCOUNT',
|
||||
'EMAIL_SERVER.MESS_PASSWORD',
|
||||
'EMAIL_SERVER.MESS_FROM_MAIL',
|
||||
'EMAIL_SERVER.MESS_FROM_NAME',
|
||||
'EMAIL_SERVER.SMTPSECURE',
|
||||
'EMAIL_SERVER.MESS_TRY_SEND_INMEDIATLY',
|
||||
'EMAIL_SERVER.MAIL_TO',
|
||||
'EMAIL_SERVER.MESS_DEFAULT'
|
||||
];
|
||||
$query = EmailServerModel::query()->select($selectedColumns);
|
||||
$query->where('EMAIL_SERVER.MESS_UID', '=', $messUid);
|
||||
$res = $query->get()->values()->toArray();
|
||||
$firstElement = head($res);
|
||||
|
||||
return $firstElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain the default EMAI_SERVER configuration
|
||||
*
|
||||
* @return array
|
||||
* @see ProcessMaker\BusinessModel\ActionsByEmail::forwardMail()
|
||||
*/
|
||||
public function getEmailServerDefault()
|
||||
{
|
||||
$selectedColumns = [
|
||||
'EMAIL_SERVER.MESS_UID',
|
||||
'EMAIL_SERVER.MESS_ENGINE',
|
||||
'EMAIL_SERVER.MESS_SERVER',
|
||||
'EMAIL_SERVER.MESS_PORT',
|
||||
'EMAIL_SERVER.MESS_INCOMING_SERVER',
|
||||
'EMAIL_SERVER.MESS_INCOMING_PORT',
|
||||
'EMAIL_SERVER.MESS_RAUTH',
|
||||
'EMAIL_SERVER.MESS_ACCOUNT',
|
||||
'EMAIL_SERVER.MESS_PASSWORD',
|
||||
'EMAIL_SERVER.MESS_FROM_MAIL',
|
||||
'EMAIL_SERVER.MESS_FROM_NAME',
|
||||
'EMAIL_SERVER.SMTPSECURE',
|
||||
'EMAIL_SERVER.MESS_TRY_SEND_INMEDIATLY',
|
||||
'EMAIL_SERVER.MAIL_TO',
|
||||
'EMAIL_SERVER.MESS_DEFAULT'
|
||||
];
|
||||
$query = EmailServerModel::query()->select($selectedColumns)
|
||||
->where('MESS_DEFAULT', '=', 1);
|
||||
$firstElement = $query->get()->values()->toArray();
|
||||
|
||||
if (!empty($firstElement)) {
|
||||
$firstElement = head($firstElement);
|
||||
// @todo these index are been keep due to compatibility reasons
|
||||
$firstElement['MESS_BACKGROUND'] = '';
|
||||
$firstElement['MESS_PASSWORD_HIDDEN'] = '';
|
||||
$firstElement['MESS_EXECUTE_EVERY'] = '';
|
||||
$firstElement['MESS_SEND_MAX'] = '';
|
||||
}
|
||||
|
||||
return $firstElement;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user