Merge branch 'develop' of https://bitbucket.org/colosa/processmaker into feature/PMCORE-1444
This commit is contained in:
@@ -50,11 +50,10 @@ Internet Explorer 7 or later
|
|||||||
|* PHP Configuration *|
|
|* PHP Configuration *|
|
||||||
-----------------------
|
-----------------------
|
||||||
In the PHP configuration file (php.ini), set the following settings:
|
In the PHP configuration file (php.ini), set the following settings:
|
||||||
memory_limit = 120M
|
memory_limit = 256M
|
||||||
file_uploads = On
|
file_uploads = On
|
||||||
short_open_tag = On
|
short_open_tag = On
|
||||||
The memory_limit may be a minimum of 80MB, but it is recommended to set it to
|
If planning on uploading large Input Documents and attached files, then
|
||||||
120MB. If planning on uploading large Input Documents and attached files, then
|
|
||||||
increase the max_post_size and upload_max_filesize to larger than the default
|
increase the max_post_size and upload_max_filesize to larger than the default
|
||||||
2MB:
|
2MB:
|
||||||
max_post_size = 2M
|
max_post_size = 2M
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ $factory->define(\ProcessMaker\Model\AbeConfiguration::class, function (Faker $f
|
|||||||
'ABE_UPDATE_DATE' => $faker->dateTime(),
|
'ABE_UPDATE_DATE' => $faker->dateTime(),
|
||||||
'ABE_SUBJECT_FIELD' => '',
|
'ABE_SUBJECT_FIELD' => '',
|
||||||
'ABE_MAILSERVER_OR_MAILCURRENT' => 0,
|
'ABE_MAILSERVER_OR_MAILCURRENT' => 0,
|
||||||
'ABE_CUSTOM_GRID' => '',
|
'ABE_CUSTOM_GRID' => serialize([]),
|
||||||
'ABE_EMAIL_SERVER_UID' => $emailServer->MESS_UID,
|
'ABE_EMAIL_SERVER_UID' => $emailServer->MESS_UID,
|
||||||
'ABE_ACTION_BODY_FIELD' => '',
|
'ABE_ACTION_BODY_FIELD' => '',
|
||||||
'ABE_EMAIL_SERVER_RECEIVER_UID' => ''
|
'ABE_EMAIL_SERVER_RECEIVER_UID' => ''
|
||||||
|
|||||||
@@ -536,7 +536,6 @@ class WebApplication
|
|||||||
ini_set('error_reporting', $arraySystemConfiguration['error_reporting']);
|
ini_set('error_reporting', $arraySystemConfiguration['error_reporting']);
|
||||||
ini_set('short_open_tag', 'On'); //??
|
ini_set('short_open_tag', 'On'); //??
|
||||||
ini_set('default_charset', 'UTF-8'); //??
|
ini_set('default_charset', 'UTF-8'); //??
|
||||||
ini_set('memory_limit', $arraySystemConfiguration['memory_limit']);
|
|
||||||
ini_set('soap.wsdl_cache_enabled', $arraySystemConfiguration['wsdl_cache']);
|
ini_set('soap.wsdl_cache_enabled', $arraySystemConfiguration['wsdl_cache']);
|
||||||
ini_set('date.timezone', TIME_ZONE); //Set Time Zone
|
ini_set('date.timezone', TIME_ZONE); //Set Time Zone
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
/*** enable display_error On to caught even fatal errors ***/
|
/*** enable display_error On to caught even fatal errors ***/
|
||||||
ini_set('display_errors','On');
|
ini_set('display_errors','On');
|
||||||
ini_set('error_reporting', E_ALL );
|
ini_set('error_reporting', E_ALL );
|
||||||
ini_set('memory_limit', '80M');
|
|
||||||
|
|
||||||
$path = Array();
|
$path = Array();
|
||||||
$sf = $_SERVER['SCRIPT_FILENAME'];
|
$sf = $_SERVER['SCRIPT_FILENAME'];
|
||||||
|
|||||||
@@ -436,7 +436,6 @@ class DataBaseMaintenance
|
|||||||
*/
|
*/
|
||||||
public function restoreFromSql($sqlFile, $type = 'file')
|
public function restoreFromSql($sqlFile, $type = 'file')
|
||||||
{
|
{
|
||||||
ini_set('memory_limit', '64M');
|
|
||||||
if ($type == 'file' && !is_file($sqlFile)) {
|
if ($type == 'file' && !is_file($sqlFile)) {
|
||||||
throw new Exception("the $sqlFile doesn't exist!");
|
throw new Exception("the $sqlFile doesn't exist!");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2750,11 +2750,6 @@ class G
|
|||||||
if (!array_key_exists("channels", $imageInfo)) {
|
if (!array_key_exists("channels", $imageInfo)) {
|
||||||
$imageInfo["channels"] = 3;
|
$imageInfo["channels"] = 3;
|
||||||
}
|
}
|
||||||
$memoryNeeded = Round(($imageInfo[0] * $imageInfo[1] * $imageInfo['bits'] * $imageInfo['channels'] + Pow(2, 16)) * 1.95) / (1024 * 1024);
|
|
||||||
if ($memoryNeeded < 80) {
|
|
||||||
$memoryNeeded = 80;
|
|
||||||
}
|
|
||||||
ini_set('memory_limit', intval($memoryNeeded) . 'M');
|
|
||||||
|
|
||||||
$functions = array(IMAGETYPE_GIF => array('imagecreatefromgif', 'imagegif'
|
$functions = array(IMAGETYPE_GIF => array('imagecreatefromgif', 'imagegif'
|
||||||
), IMAGETYPE_JPEG => array('imagecreatefromjpeg', 'imagejpeg'), IMAGETYPE_PNG => array('imagecreatefrompng', 'imagepng'));
|
), IMAGETYPE_JPEG => array('imagecreatefromjpeg', 'imagejpeg'), IMAGETYPE_PNG => array('imagecreatefrompng', 'imagepng'));
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ class DBQueryTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify the execution of a common SQL statement.
|
* Verify the execution of a common SQL statement.
|
||||||
|
* Note, this test is now using Laravel DB backend work
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function testStandardExecuteQuery()
|
public function testStandardExecuteQuery()
|
||||||
|
|||||||
@@ -0,0 +1,534 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use ProcessMaker\Model\AbeConfiguration;
|
||||||
|
use ProcessMaker\Model\Application;
|
||||||
|
use ProcessMaker\Model\Delegation;
|
||||||
|
use ProcessMaker\Model\Dynaform;
|
||||||
|
use ProcessMaker\Model\Process;
|
||||||
|
use ProcessMaker\Model\Task;
|
||||||
|
use ProcessMaker\Model\User;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class ActionsByEmailCoreClassTest extends TestCase
|
||||||
|
{
|
||||||
|
private $actionsByEmailCoreClass;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method set up.
|
||||||
|
*/
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
if (!defined('PATH_IMAGES_ENVIRONMENT_USERS')) {
|
||||||
|
define('PATH_IMAGES_ENVIRONMENT_USERS', PATH_DATA_SITE . 'usersPhotographies' . PATH_SEP);
|
||||||
|
}
|
||||||
|
|
||||||
|
$path = PATH_HOME . 'public_html' . PATH_SEP . 'lib';
|
||||||
|
if (!file_exists($path)) {
|
||||||
|
mkdir($path);
|
||||||
|
}
|
||||||
|
$path = $path . PATH_SEP . 'pmdynaform';
|
||||||
|
if (!file_exists($path)) {
|
||||||
|
mkdir($path);
|
||||||
|
}
|
||||||
|
$path = $path . PATH_SEP . 'build';
|
||||||
|
if (!file_exists($path)) {
|
||||||
|
mkdir($path);
|
||||||
|
}
|
||||||
|
$path = $path . PATH_SEP . 'pmdynaform.html';
|
||||||
|
if (!file_exists($path)) {
|
||||||
|
file_put_contents($path, '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test checks if the sendActionsByEmail method throws an exception.
|
||||||
|
* @test
|
||||||
|
* @covers \ActionsByEmailCoreClass::sendActionsByEmail
|
||||||
|
*/
|
||||||
|
public function it_should_test_send_actions_by_email_with_exception()
|
||||||
|
{
|
||||||
|
$user = User::where('USR_UID', '=', '00000000000000000000000000000001')
|
||||||
|
->get()
|
||||||
|
->first();
|
||||||
|
$process = factory(Process::class)->create();
|
||||||
|
$task = factory(Task::class)->create([
|
||||||
|
'PRO_UID' => $process->PRO_UID
|
||||||
|
]);
|
||||||
|
$application = factory(Application::class)->create([
|
||||||
|
'PRO_UID' => $process->PRO_UID
|
||||||
|
]);
|
||||||
|
$delegation = factory(Delegation::class)->create([
|
||||||
|
'APP_UID' => $application->APP_UID,
|
||||||
|
'PRO_UID' => $process->PRO_UID,
|
||||||
|
'TAS_UID' => $task->TAS_UID,
|
||||||
|
'USR_UID' => $user->USR_UID
|
||||||
|
]);
|
||||||
|
$data = [
|
||||||
|
'TAS_UID' => $task->TAS_UID,
|
||||||
|
'APP_UID' => $application->APP_UID,
|
||||||
|
'DEL_INDEX' => $delegation->DEL_INDEX,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'PREVIOUS_USR_UID' => $user->USR_UID
|
||||||
|
];
|
||||||
|
$data = (object) $data;
|
||||||
|
|
||||||
|
//assertion Exception
|
||||||
|
$this->expectException(Exception::class);
|
||||||
|
|
||||||
|
$this->actionsByEmailCoreClass = new ActionsByEmailCoreClass();
|
||||||
|
$this->actionsByEmailCoreClass->sendActionsByEmail($data, []);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test checks if the sendActionsByEmail method handles an undefined configuration.
|
||||||
|
* @test
|
||||||
|
* @covers \ActionsByEmailCoreClass::sendActionsByEmail
|
||||||
|
*/
|
||||||
|
public function it_should_test_send_actions_by_email_if_abe_configuration_is_undefined()
|
||||||
|
{
|
||||||
|
$user = User::where('USR_UID', '=', '00000000000000000000000000000001')
|
||||||
|
->get()
|
||||||
|
->first();
|
||||||
|
$process = factory(Process::class)->create();
|
||||||
|
$task = factory(Task::class)->create([
|
||||||
|
'PRO_UID' => $process->PRO_UID
|
||||||
|
]);
|
||||||
|
$abeConfiguration = [
|
||||||
|
'ABE_EMAIL_SERVER_UID' => ''
|
||||||
|
];
|
||||||
|
$application = factory(Application::class)->create([
|
||||||
|
'PRO_UID' => $process->PRO_UID
|
||||||
|
]);
|
||||||
|
$delegation = factory(Delegation::class)->create([
|
||||||
|
'APP_UID' => $application->APP_UID,
|
||||||
|
'PRO_UID' => $process->PRO_UID,
|
||||||
|
'TAS_UID' => $task->TAS_UID,
|
||||||
|
'USR_UID' => $user->USR_UID
|
||||||
|
]);
|
||||||
|
$data = [
|
||||||
|
'TAS_UID' => $task->TAS_UID,
|
||||||
|
'APP_UID' => $application->APP_UID,
|
||||||
|
'DEL_INDEX' => $delegation->DEL_INDEX,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'PREVIOUS_USR_UID' => $user->USR_UID
|
||||||
|
];
|
||||||
|
$data = (object) $data;
|
||||||
|
|
||||||
|
$this->actionsByEmailCoreClass = new ActionsByEmailCoreClass();
|
||||||
|
$result = $this->actionsByEmailCoreClass->sendActionsByEmail($data, $abeConfiguration);
|
||||||
|
|
||||||
|
$this->assertNull($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test checks if the sendActionsByEmail method throws an exception if
|
||||||
|
* the task properties do not exist.
|
||||||
|
* @test
|
||||||
|
* @covers \ActionsByEmailCoreClass::sendActionsByEmail
|
||||||
|
*/
|
||||||
|
public function it_should_test_send_actions_by_email_with_exception_if_task_property_is_undefined()
|
||||||
|
{
|
||||||
|
$user = User::where('USR_UID', '=', '00000000000000000000000000000001')
|
||||||
|
->get()
|
||||||
|
->first();
|
||||||
|
$process = factory(Process::class)->create();
|
||||||
|
$task = factory(Task::class)->create([
|
||||||
|
'PRO_UID' => $process->PRO_UID
|
||||||
|
]);
|
||||||
|
$dynaform = factory(Dynaform::class)->create([
|
||||||
|
'PRO_UID' => $process->PRO_UID
|
||||||
|
]);
|
||||||
|
$emailServer = factory(ProcessMaker\Model\EmailServerModel::class)->create();
|
||||||
|
$abeConfiguration = factory(AbeConfiguration::class)->create([
|
||||||
|
'PRO_UID' => $process->PRO_UID,
|
||||||
|
'TAS_UID' => '',
|
||||||
|
'DYN_UID' => $dynaform->DYN_UID,
|
||||||
|
'ABE_EMAIL_SERVER_UID' => $emailServer->MESS_UID,
|
||||||
|
'ABE_TYPE' => 'CUSTOM',
|
||||||
|
'ABE_CUSTOM_GRID' => serialize([])
|
||||||
|
]);
|
||||||
|
$abeConfiguration = $abeConfiguration->toArray();
|
||||||
|
|
||||||
|
$application = factory(Application::class)->create([
|
||||||
|
'PRO_UID' => $process->PRO_UID
|
||||||
|
]);
|
||||||
|
$delegation = factory(Delegation::class)->create([
|
||||||
|
'APP_UID' => $application->APP_UID,
|
||||||
|
'PRO_UID' => $process->PRO_UID,
|
||||||
|
'TAS_UID' => $task->TAS_UID,
|
||||||
|
'USR_UID' => $user->USR_UID
|
||||||
|
]);
|
||||||
|
$data = [
|
||||||
|
'TAS_UID' => $task->TAS_UID,
|
||||||
|
'APP_UID' => $application->APP_UID,
|
||||||
|
'DEL_INDEX' => $delegation->DEL_INDEX,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'PREVIOUS_USR_UID' => $user->USR_UID
|
||||||
|
];
|
||||||
|
$data = (object) $data;
|
||||||
|
|
||||||
|
$_SERVER["REQUEST_URI"] = '';
|
||||||
|
|
||||||
|
//assertion Exception
|
||||||
|
$this->expectException(Exception::class);
|
||||||
|
|
||||||
|
$this->actionsByEmailCoreClass = new ActionsByEmailCoreClass();
|
||||||
|
$this->actionsByEmailCoreClass->sendActionsByEmail($data, $abeConfiguration);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test checks if the sendActionsByEmail method throws an exception if the
|
||||||
|
* email address is empty.
|
||||||
|
* @test
|
||||||
|
* @covers \ActionsByEmailCoreClass::sendActionsByEmail
|
||||||
|
*/
|
||||||
|
public function it_should_test_send_actions_by_email_with_exception_if_email_to_is_empty()
|
||||||
|
{
|
||||||
|
$user = factory(User::class)->create([
|
||||||
|
'USR_EMAIL' => ''
|
||||||
|
]);
|
||||||
|
|
||||||
|
$process = factory(Process::class)->create();
|
||||||
|
$task = factory(Task::class)->create([
|
||||||
|
'PRO_UID' => $process->PRO_UID
|
||||||
|
]);
|
||||||
|
$dynaform = factory(Dynaform::class)->create([
|
||||||
|
'PRO_UID' => $process->PRO_UID
|
||||||
|
]);
|
||||||
|
$emailServer = factory(ProcessMaker\Model\EmailServerModel::class)->create();
|
||||||
|
$abeConfiguration = factory(AbeConfiguration::class)->create([
|
||||||
|
'PRO_UID' => $process->PRO_UID,
|
||||||
|
'TAS_UID' => $task->TAS_UID,
|
||||||
|
'DYN_UID' => $dynaform->DYN_UID,
|
||||||
|
'ABE_EMAIL_SERVER_UID' => $emailServer->MESS_UID,
|
||||||
|
'ABE_TYPE' => 'CUSTOM',
|
||||||
|
'ABE_CUSTOM_GRID' => serialize([]),
|
||||||
|
'ABE_EMAIL_FIELD' => ''
|
||||||
|
]);
|
||||||
|
$abeConfiguration = $abeConfiguration->toArray();
|
||||||
|
|
||||||
|
$application = factory(Application::class)->create([
|
||||||
|
'PRO_UID' => $process->PRO_UID
|
||||||
|
]);
|
||||||
|
$delegation = factory(Delegation::class)->create([
|
||||||
|
'APP_UID' => $application->APP_UID,
|
||||||
|
'PRO_UID' => $process->PRO_UID,
|
||||||
|
'TAS_UID' => $task->TAS_UID,
|
||||||
|
'USR_UID' => $user->USR_UID
|
||||||
|
]);
|
||||||
|
$data = [
|
||||||
|
'TAS_UID' => $task->TAS_UID,
|
||||||
|
'APP_UID' => $application->APP_UID,
|
||||||
|
'DEL_INDEX' => $delegation->DEL_INDEX,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'PREVIOUS_USR_UID' => $user->USR_UID
|
||||||
|
];
|
||||||
|
$data = (object) $data;
|
||||||
|
|
||||||
|
$_SERVER["REQUEST_URI"] = '';
|
||||||
|
|
||||||
|
$this->actionsByEmailCoreClass = new ActionsByEmailCoreClass();
|
||||||
|
$this->actionsByEmailCoreClass->setUser($user->USR_UID);
|
||||||
|
$this->actionsByEmailCoreClass->setIndex($delegation->DEL_INDEX);
|
||||||
|
$result = $this->actionsByEmailCoreClass->sendActionsByEmail($data, $abeConfiguration);
|
||||||
|
|
||||||
|
$this->assertNull($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test checks if the sendActionsByEmail method throws an exception if
|
||||||
|
* the email type is empty.
|
||||||
|
* @test
|
||||||
|
* @covers \ActionsByEmailCoreClass::sendActionsByEmail
|
||||||
|
*/
|
||||||
|
public function it_should_test_send_actions_by_email_with_exception_if_email_type_is_empty()
|
||||||
|
{
|
||||||
|
$user = factory(User::class)->create();
|
||||||
|
|
||||||
|
$process = factory(Process::class)->create();
|
||||||
|
$task = factory(Task::class)->create([
|
||||||
|
'PRO_UID' => $process->PRO_UID
|
||||||
|
]);
|
||||||
|
$dynaform = factory(Dynaform::class)->create([
|
||||||
|
'PRO_UID' => $process->PRO_UID
|
||||||
|
]);
|
||||||
|
$emailServer = factory(ProcessMaker\Model\EmailServerModel::class)->create();
|
||||||
|
$abeConfiguration = factory(AbeConfiguration::class)->create([
|
||||||
|
'PRO_UID' => $process->PRO_UID,
|
||||||
|
'TAS_UID' => $task->TAS_UID,
|
||||||
|
'DYN_UID' => $dynaform->DYN_UID,
|
||||||
|
'ABE_EMAIL_SERVER_UID' => $emailServer->MESS_UID,
|
||||||
|
'ABE_TYPE' => '',
|
||||||
|
'ABE_CUSTOM_GRID' => serialize([]),
|
||||||
|
'ABE_EMAIL_FIELD' => ''
|
||||||
|
]);
|
||||||
|
$abeConfiguration = $abeConfiguration->toArray();
|
||||||
|
|
||||||
|
$application = factory(Application::class)->create([
|
||||||
|
'PRO_UID' => $process->PRO_UID
|
||||||
|
]);
|
||||||
|
$delegation = factory(Delegation::class)->create([
|
||||||
|
'APP_UID' => $application->APP_UID,
|
||||||
|
'PRO_UID' => $process->PRO_UID,
|
||||||
|
'TAS_UID' => $task->TAS_UID,
|
||||||
|
'USR_UID' => $user->USR_UID
|
||||||
|
]);
|
||||||
|
$data = [
|
||||||
|
'TAS_UID' => $task->TAS_UID,
|
||||||
|
'APP_UID' => $application->APP_UID,
|
||||||
|
'DEL_INDEX' => $delegation->DEL_INDEX,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'PREVIOUS_USR_UID' => $user->USR_UID
|
||||||
|
];
|
||||||
|
$data = (object) $data;
|
||||||
|
|
||||||
|
$_SERVER["REQUEST_URI"] = '';
|
||||||
|
|
||||||
|
$this->actionsByEmailCoreClass = new ActionsByEmailCoreClass();
|
||||||
|
$this->actionsByEmailCoreClass->setUser($user->USR_UID);
|
||||||
|
$this->actionsByEmailCoreClass->setIndex($delegation->DEL_INDEX);
|
||||||
|
$result = $this->actionsByEmailCoreClass->sendActionsByEmail($data, $abeConfiguration);
|
||||||
|
|
||||||
|
$this->assertNull($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test verifies if the sendActionsByEmail method supports the 'CUSTOM' setting.
|
||||||
|
* @test
|
||||||
|
* @covers \ActionsByEmailCoreClass::sendActionsByEmail
|
||||||
|
*/
|
||||||
|
public function it_should_test_send_actions_by_email_custom()
|
||||||
|
{
|
||||||
|
$user = User::where('USR_UID', '=', '00000000000000000000000000000001')
|
||||||
|
->get()
|
||||||
|
->first();
|
||||||
|
$process = factory(Process::class)->create();
|
||||||
|
$task = factory(Task::class)->create([
|
||||||
|
'PRO_UID' => $process->PRO_UID
|
||||||
|
]);
|
||||||
|
$dynaform = factory(Dynaform::class)->create([
|
||||||
|
'PRO_UID' => $process->PRO_UID
|
||||||
|
]);
|
||||||
|
$emailServer = factory(ProcessMaker\Model\EmailServerModel::class)->create();
|
||||||
|
$abeConfiguration = factory(AbeConfiguration::class)->create([
|
||||||
|
'PRO_UID' => $process->PRO_UID,
|
||||||
|
'TAS_UID' => $task->TAS_UID,
|
||||||
|
'DYN_UID' => $dynaform->DYN_UID,
|
||||||
|
'ABE_EMAIL_SERVER_UID' => $emailServer->MESS_UID,
|
||||||
|
'ABE_TYPE' => 'CUSTOM',
|
||||||
|
'ABE_CUSTOM_GRID' => serialize([])
|
||||||
|
]);
|
||||||
|
$abeConfiguration = $abeConfiguration->toArray();
|
||||||
|
|
||||||
|
$application = factory(Application::class)->create([
|
||||||
|
'PRO_UID' => $process->PRO_UID
|
||||||
|
]);
|
||||||
|
|
||||||
|
$delegation = factory(Delegation::class)->create([
|
||||||
|
'APP_UID' => $application->APP_UID,
|
||||||
|
'PRO_UID' => $process->PRO_UID,
|
||||||
|
'TAS_UID' => $task->TAS_UID,
|
||||||
|
'USR_UID' => $user->USR_UID
|
||||||
|
]);
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'TAS_UID' => $task->TAS_UID,
|
||||||
|
'APP_UID' => $application->APP_UID,
|
||||||
|
'DEL_INDEX' => $delegation->DEL_INDEX,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'PREVIOUS_USR_UID' => $user->USR_UID
|
||||||
|
];
|
||||||
|
$data = (object) $data;
|
||||||
|
|
||||||
|
$_SERVER["REQUEST_URI"] = '';
|
||||||
|
|
||||||
|
$this->actionsByEmailCoreClass = new ActionsByEmailCoreClass();
|
||||||
|
$this->actionsByEmailCoreClass->setUser($user->USR_UID);
|
||||||
|
$this->actionsByEmailCoreClass->setIndex($delegation->DEL_INDEX);
|
||||||
|
$this->actionsByEmailCoreClass->sendActionsByEmail($data, $abeConfiguration);
|
||||||
|
$result = $this->actionsByEmailCoreClass->getAbeRequest();
|
||||||
|
|
||||||
|
$this->assertArrayHasKey('ABE_REQ_UID', $result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test verifies if the sendActionsByEmail method supports the 'RESPONSE' setting.
|
||||||
|
* @test
|
||||||
|
* @covers \ActionsByEmailCoreClass::sendActionsByEmail
|
||||||
|
*/
|
||||||
|
public function it_should_test_send_actions_by_email_response()
|
||||||
|
{
|
||||||
|
$user = User::where('USR_UID', '=', '00000000000000000000000000000001')
|
||||||
|
->get()
|
||||||
|
->first();
|
||||||
|
$process = factory(Process::class)->create();
|
||||||
|
$task = factory(Task::class)->create([
|
||||||
|
'PRO_UID' => $process->PRO_UID
|
||||||
|
]);
|
||||||
|
$dynaform = factory(Dynaform::class)->create([
|
||||||
|
'PRO_UID' => $process->PRO_UID
|
||||||
|
]);
|
||||||
|
$emailServer = factory(ProcessMaker\Model\EmailServerModel::class)->create();
|
||||||
|
$abeConfiguration = factory(AbeConfiguration::class)->create([
|
||||||
|
'PRO_UID' => $process->PRO_UID,
|
||||||
|
'TAS_UID' => $task->TAS_UID,
|
||||||
|
'DYN_UID' => $dynaform->DYN_UID,
|
||||||
|
'ABE_EMAIL_SERVER_UID' => $emailServer->MESS_UID,
|
||||||
|
'ABE_TYPE' => 'RESPONSE',
|
||||||
|
'ABE_CUSTOM_GRID' => serialize([]),
|
||||||
|
'ABE_EMAIL_SERVER_RECEIVER_UID' => $emailServer->MESS_UID
|
||||||
|
]);
|
||||||
|
$abeConfiguration = $abeConfiguration->toArray();
|
||||||
|
|
||||||
|
$application = factory(Application::class)->create([
|
||||||
|
'PRO_UID' => $process->PRO_UID
|
||||||
|
]);
|
||||||
|
|
||||||
|
$delegation = factory(Delegation::class)->create([
|
||||||
|
'APP_UID' => $application->APP_UID,
|
||||||
|
'PRO_UID' => $process->PRO_UID,
|
||||||
|
'TAS_UID' => $task->TAS_UID,
|
||||||
|
'USR_UID' => $user->USR_UID
|
||||||
|
]);
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'TAS_UID' => $task->TAS_UID,
|
||||||
|
'APP_UID' => $application->APP_UID,
|
||||||
|
'DEL_INDEX' => $delegation->DEL_INDEX,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'PREVIOUS_USR_UID' => $user->USR_UID
|
||||||
|
];
|
||||||
|
$data = (object) $data;
|
||||||
|
|
||||||
|
$_SERVER["REQUEST_URI"] = '';
|
||||||
|
|
||||||
|
$this->actionsByEmailCoreClass = new ActionsByEmailCoreClass();
|
||||||
|
$this->actionsByEmailCoreClass->setUser($user->USR_UID);
|
||||||
|
$this->actionsByEmailCoreClass->setIndex($delegation->DEL_INDEX);
|
||||||
|
$this->actionsByEmailCoreClass->sendActionsByEmail($data, $abeConfiguration);
|
||||||
|
$result = $this->actionsByEmailCoreClass->getAbeRequest();
|
||||||
|
|
||||||
|
$this->assertArrayHasKey('ABE_REQ_UID', $result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test verifies if the sendActionsByEmail method supports the 'FIELD' setting.
|
||||||
|
* @test
|
||||||
|
* @covers \ActionsByEmailCoreClass::sendActionsByEmail
|
||||||
|
*/
|
||||||
|
public function it_should_test_send_actions_by_email_link()
|
||||||
|
{
|
||||||
|
$user = User::where('USR_UID', '=', '00000000000000000000000000000001')
|
||||||
|
->get()
|
||||||
|
->first();
|
||||||
|
$process = factory(Process::class)->create();
|
||||||
|
$task = factory(Task::class)->create([
|
||||||
|
'PRO_UID' => $process->PRO_UID
|
||||||
|
]);
|
||||||
|
$dynaform = factory(Dynaform::class)->create([
|
||||||
|
'PRO_UID' => $process->PRO_UID
|
||||||
|
]);
|
||||||
|
$emailServer = factory(ProcessMaker\Model\EmailServerModel::class)->create();
|
||||||
|
$abeConfiguration = factory(AbeConfiguration::class)->create([
|
||||||
|
'PRO_UID' => $process->PRO_UID,
|
||||||
|
'TAS_UID' => $task->TAS_UID,
|
||||||
|
'DYN_UID' => $dynaform->DYN_UID,
|
||||||
|
'ABE_EMAIL_SERVER_UID' => $emailServer->MESS_UID,
|
||||||
|
'ABE_TYPE' => 'LINK',
|
||||||
|
'ABE_CUSTOM_GRID' => serialize([]),
|
||||||
|
'ABE_EMAIL_SERVER_RECEIVER_UID' => $emailServer->MESS_UID
|
||||||
|
]);
|
||||||
|
$abeConfiguration = $abeConfiguration->toArray();
|
||||||
|
|
||||||
|
$application = factory(Application::class)->create([
|
||||||
|
'PRO_UID' => $process->PRO_UID
|
||||||
|
]);
|
||||||
|
|
||||||
|
$delegation = factory(Delegation::class)->create([
|
||||||
|
'APP_UID' => $application->APP_UID,
|
||||||
|
'PRO_UID' => $process->PRO_UID,
|
||||||
|
'TAS_UID' => $task->TAS_UID,
|
||||||
|
'USR_UID' => $user->USR_UID
|
||||||
|
]);
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'TAS_UID' => $task->TAS_UID,
|
||||||
|
'APP_UID' => $application->APP_UID,
|
||||||
|
'DEL_INDEX' => $delegation->DEL_INDEX,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'PREVIOUS_USR_UID' => $user->USR_UID
|
||||||
|
];
|
||||||
|
$data = (object) $data;
|
||||||
|
|
||||||
|
$_SERVER["REQUEST_URI"] = '';
|
||||||
|
|
||||||
|
$this->actionsByEmailCoreClass = new ActionsByEmailCoreClass();
|
||||||
|
$this->actionsByEmailCoreClass->setUser($user->USR_UID);
|
||||||
|
$this->actionsByEmailCoreClass->setIndex($delegation->DEL_INDEX);
|
||||||
|
$this->actionsByEmailCoreClass->sendActionsByEmail($data, $abeConfiguration);
|
||||||
|
$result = $this->actionsByEmailCoreClass->getAbeRequest();
|
||||||
|
|
||||||
|
$this->assertArrayHasKey('ABE_REQ_UID', $result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test verifies if the sendActionsByEmail method supports the 'FIELD' setting.
|
||||||
|
* @test
|
||||||
|
* @covers \ActionsByEmailCoreClass::sendActionsByEmail
|
||||||
|
*/
|
||||||
|
public function it_should_test_send_actions_by_email_field()
|
||||||
|
{
|
||||||
|
$user = User::where('USR_UID', '=', '00000000000000000000000000000001')
|
||||||
|
->get()
|
||||||
|
->first();
|
||||||
|
$process = factory(Process::class)->create();
|
||||||
|
$task = factory(Task::class)->create([
|
||||||
|
'PRO_UID' => $process->PRO_UID
|
||||||
|
]);
|
||||||
|
$dynaform = factory(Dynaform::class)->create([
|
||||||
|
'PRO_UID' => $process->PRO_UID
|
||||||
|
]);
|
||||||
|
$emailServer = factory(ProcessMaker\Model\EmailServerModel::class)->create();
|
||||||
|
$abeConfiguration = factory(AbeConfiguration::class)->create([
|
||||||
|
'PRO_UID' => $process->PRO_UID,
|
||||||
|
'TAS_UID' => $task->TAS_UID,
|
||||||
|
'DYN_UID' => $dynaform->DYN_UID,
|
||||||
|
'ABE_EMAIL_SERVER_UID' => $emailServer->MESS_UID,
|
||||||
|
'ABE_TYPE' => 'FIELD',
|
||||||
|
'ABE_CUSTOM_GRID' => serialize([]),
|
||||||
|
'ABE_EMAIL_SERVER_RECEIVER_UID' => $emailServer->MESS_UID
|
||||||
|
]);
|
||||||
|
$abeConfiguration = $abeConfiguration->toArray();
|
||||||
|
|
||||||
|
$application = factory(Application::class)->create([
|
||||||
|
'PRO_UID' => $process->PRO_UID
|
||||||
|
]);
|
||||||
|
|
||||||
|
$delegation = factory(Delegation::class)->create([
|
||||||
|
'APP_UID' => $application->APP_UID,
|
||||||
|
'PRO_UID' => $process->PRO_UID,
|
||||||
|
'TAS_UID' => $task->TAS_UID,
|
||||||
|
'USR_UID' => $user->USR_UID
|
||||||
|
]);
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'TAS_UID' => $task->TAS_UID,
|
||||||
|
'APP_UID' => $application->APP_UID,
|
||||||
|
'DEL_INDEX' => $delegation->DEL_INDEX,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'PREVIOUS_USR_UID' => $user->USR_UID
|
||||||
|
];
|
||||||
|
$data = (object) $data;
|
||||||
|
|
||||||
|
$_SERVER["REQUEST_URI"] = '';
|
||||||
|
|
||||||
|
$this->actionsByEmailCoreClass = new ActionsByEmailCoreClass();
|
||||||
|
$this->actionsByEmailCoreClass->setUser($user->USR_UID);
|
||||||
|
$this->actionsByEmailCoreClass->setIndex($delegation->DEL_INDEX);
|
||||||
|
$this->actionsByEmailCoreClass->sendActionsByEmail($data, $abeConfiguration);
|
||||||
|
$result = $this->actionsByEmailCoreClass->getAbeRequest();
|
||||||
|
|
||||||
|
$this->assertArrayHasKey('ABE_REQ_UID', $result);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,7 +12,6 @@ use ProcessMaker\Model\Process;
|
|||||||
use ProcessMaker\Model\Task;
|
use ProcessMaker\Model\Task;
|
||||||
use ProcessMaker\Model\User;
|
use ProcessMaker\Model\User;
|
||||||
use ProcessMaker\Model\UserReporting;
|
use ProcessMaker\Model\UserReporting;
|
||||||
use ProcessMaker\Util\WsMessageResponse;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -22,6 +21,7 @@ use Tests\TestCase;
|
|||||||
*/
|
*/
|
||||||
class WsBaseTest extends TestCase
|
class WsBaseTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -65,21 +65,20 @@ class WsBaseTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
private function createNewCase($applicationNumber = null)
|
private function createNewCase($applicationNumber = null)
|
||||||
{
|
{
|
||||||
|
$userUid = G::generateUniqueID();
|
||||||
|
$processUid = G::generateUniqueID();
|
||||||
|
$applicationUid = G::generateUniqueID();
|
||||||
if (empty($applicationNumber)) {
|
if (empty($applicationNumber)) {
|
||||||
$faker = Factory::create();
|
$faker = Factory::create();
|
||||||
$applicationNumber = $faker->unique()->numberBetween(1, 10000000);
|
$applicationNumber = $faker->unique()->numberBetween(1, 10000000);
|
||||||
}
|
}
|
||||||
$userUid = G::generateUniqueID();
|
|
||||||
$processUid = G::generateUniqueID();
|
|
||||||
$taskUid = G::generateUniqueID();
|
|
||||||
$applicationUid = G::generateUniqueID();
|
|
||||||
|
|
||||||
$appData = [
|
$appData = [
|
||||||
'SYS_LANG' => 'en',
|
'SYS_LANG' => 'en',
|
||||||
'SYS_SKIN' => 'neoclassic',
|
'SYS_SKIN' => 'neoclassic',
|
||||||
'SYS_SYS' => 'workflow',
|
'SYS_SYS' => 'workflow',
|
||||||
'APPLICATION' => G::generateUniqueID(),
|
'APPLICATION' => $applicationUid,
|
||||||
'PROCESS' => G::generateUniqueID(),
|
'PROCESS' => $processUid,
|
||||||
'TASK' => '',
|
'TASK' => '',
|
||||||
'INDEX' => 2,
|
'INDEX' => 2,
|
||||||
'USER_LOGGED' => $userUid,
|
'USER_LOGGED' => $userUid,
|
||||||
@@ -108,16 +107,9 @@ class WsBaseTest extends TestCase
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
$result = new stdClass();
|
$result = new stdClass();
|
||||||
$result->userUid = $userUid;
|
$result->application = $application;
|
||||||
$result->processUid = $processUid;
|
|
||||||
$result->taskUid = $taskUid;
|
|
||||||
$result->applicationUid = $applicationUid;
|
|
||||||
$result->applicationNumber = $applicationNumber;
|
|
||||||
$result->appData = $appData;
|
|
||||||
$result->user = $user;
|
$result->user = $user;
|
||||||
$result->process = $process;
|
$result->process = $process;
|
||||||
$result->task = $task;
|
|
||||||
$result->application = $application;
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,7 +221,7 @@ class WsBaseTest extends TestCase
|
|||||||
$template = $this->createTemplate($case->process->PRO_UID, $case->user->USR_UID);
|
$template = $this->createTemplate($case->process->PRO_UID, $case->user->USR_UID);
|
||||||
|
|
||||||
//parameters
|
//parameters
|
||||||
$appUid = $case->applicationUid;
|
$appUid = $case->application->APP_UID;
|
||||||
$from = $emailServer->MESS_ACCOUNT;
|
$from = $emailServer->MESS_ACCOUNT;
|
||||||
$to = $emailServer->MESS_ACCOUNT;
|
$to = $emailServer->MESS_ACCOUNT;
|
||||||
$cc = "";
|
$cc = "";
|
||||||
@@ -269,7 +261,7 @@ class WsBaseTest extends TestCase
|
|||||||
$template = $this->createTemplate($case->process->PRO_UID, $case->user->USR_UID);
|
$template = $this->createTemplate($case->process->PRO_UID, $case->user->USR_UID);
|
||||||
|
|
||||||
//parameters
|
//parameters
|
||||||
$appUid = $case->applicationUid;
|
$appUid = $case->application->APP_UID;
|
||||||
$from = $emailServer->MESS_ACCOUNT;
|
$from = $emailServer->MESS_ACCOUNT;
|
||||||
$to = "";
|
$to = "";
|
||||||
$cc = "";
|
$cc = "";
|
||||||
@@ -308,7 +300,7 @@ class WsBaseTest extends TestCase
|
|||||||
$template = $this->createTemplate($case->process->PRO_UID, $case->user->USR_UID);
|
$template = $this->createTemplate($case->process->PRO_UID, $case->user->USR_UID);
|
||||||
|
|
||||||
//parameters
|
//parameters
|
||||||
$appUid = $case->applicationUid;
|
$appUid = $case->application->APP_UID;
|
||||||
$from = $emailServer->MESS_ACCOUNT;
|
$from = $emailServer->MESS_ACCOUNT;
|
||||||
$to = $emailServer->MESS_ACCOUNT;
|
$to = $emailServer->MESS_ACCOUNT;
|
||||||
$cc = "";
|
$cc = "";
|
||||||
@@ -347,7 +339,7 @@ class WsBaseTest extends TestCase
|
|||||||
$template = $this->createTemplate($case->process->PRO_UID, $case->user->USR_UID);
|
$template = $this->createTemplate($case->process->PRO_UID, $case->user->USR_UID);
|
||||||
|
|
||||||
//parameters
|
//parameters
|
||||||
$appUid = $case->applicationUid;
|
$appUid = $case->application->APP_UID;
|
||||||
$from = $emailServer->MESS_ACCOUNT;
|
$from = $emailServer->MESS_ACCOUNT;
|
||||||
$to = "";
|
$to = "";
|
||||||
$cc = "";
|
$cc = "";
|
||||||
@@ -386,7 +378,7 @@ class WsBaseTest extends TestCase
|
|||||||
$template = $this->createTemplate($case->process->PRO_UID, $case->user->USR_UID);
|
$template = $this->createTemplate($case->process->PRO_UID, $case->user->USR_UID);
|
||||||
|
|
||||||
//parameters
|
//parameters
|
||||||
$appUid = $case->applicationUid;
|
$appUid = $case->application->APP_UID;
|
||||||
$from = $emailServer->MESS_ACCOUNT;
|
$from = $emailServer->MESS_ACCOUNT;
|
||||||
$to = $emailServer->MESS_ACCOUNT;
|
$to = $emailServer->MESS_ACCOUNT;
|
||||||
$cc = "";
|
$cc = "";
|
||||||
@@ -425,7 +417,7 @@ class WsBaseTest extends TestCase
|
|||||||
$template = $this->createTemplate($case->process->PRO_UID, $case->user->USR_UID);
|
$template = $this->createTemplate($case->process->PRO_UID, $case->user->USR_UID);
|
||||||
|
|
||||||
//parameters
|
//parameters
|
||||||
$appUid = $case->applicationUid;
|
$appUid = $case->application->APP_UID;
|
||||||
$from = $emailServer->MESS_ACCOUNT;
|
$from = $emailServer->MESS_ACCOUNT;
|
||||||
$to = "";
|
$to = "";
|
||||||
$cc = "";
|
$cc = "";
|
||||||
@@ -464,7 +456,7 @@ class WsBaseTest extends TestCase
|
|||||||
$template = $this->createTemplate($case->process->PRO_UID, $case->user->USR_UID);
|
$template = $this->createTemplate($case->process->PRO_UID, $case->user->USR_UID);
|
||||||
|
|
||||||
//parameters
|
//parameters
|
||||||
$appUid = $case->applicationUid;
|
$appUid = $case->application->APP_UID;
|
||||||
$from = $emailServer->MESS_ACCOUNT;
|
$from = $emailServer->MESS_ACCOUNT;
|
||||||
$to = "";
|
$to = "";
|
||||||
$cc = "";
|
$cc = "";
|
||||||
@@ -644,7 +636,7 @@ class WsBaseTest extends TestCase
|
|||||||
$template = $this->createTemplate($case->process->PRO_UID, $case->user->USR_UID);
|
$template = $this->createTemplate($case->process->PRO_UID, $case->user->USR_UID);
|
||||||
|
|
||||||
//parameters
|
//parameters
|
||||||
$appUid = $case->applicationUid;
|
$appUid = $case->application->APP_UID;
|
||||||
$from = $faker->email;
|
$from = $faker->email;
|
||||||
$to = "";
|
$to = "";
|
||||||
$cc = "";
|
$cc = "";
|
||||||
@@ -659,7 +651,131 @@ class WsBaseTest extends TestCase
|
|||||||
$result = $wsBase->sendMessage($appUid, $from, $to, $cc, $bcc, $subject, $templateName, $appFields);
|
$result = $wsBase->sendMessage($appUid, $from, $to, $cc, $bcc, $subject, $templateName, $appFields);
|
||||||
|
|
||||||
//assertions
|
//assertions
|
||||||
$this->assertInstanceOf(WsMessageResponse::class, $result);
|
$this->assertInstanceOf(WsResponse::class, $result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test ensures the response when the default configuration does not exist.
|
||||||
|
* @test
|
||||||
|
* @covers WsBase::sendMessage
|
||||||
|
*/
|
||||||
|
public function it_should_test_an_send_message_without_default_configuration()
|
||||||
|
{
|
||||||
|
//data
|
||||||
|
$emailServer = $this->createEmailServer();
|
||||||
|
$case = $this->createNewCase();
|
||||||
|
$template = $this->createTemplate($case->process->PRO_UID, $case->user->USR_UID);
|
||||||
|
|
||||||
|
//parameters
|
||||||
|
$appUid = $case->application->APP_UID;
|
||||||
|
$from = $emailServer->MESS_ACCOUNT;
|
||||||
|
$to = $emailServer->MESS_ACCOUNT;
|
||||||
|
$cc = "";
|
||||||
|
$bcc = "";
|
||||||
|
$subject = "test";
|
||||||
|
$templateName = basename($template->PRF_PATH);
|
||||||
|
$appFields = [];
|
||||||
|
$attachment = [];
|
||||||
|
$showMessage = true;
|
||||||
|
$delIndex = 0;
|
||||||
|
$config = [];
|
||||||
|
$gmail = 0;
|
||||||
|
$appMsgType = '';
|
||||||
|
|
||||||
|
//for empty configuration
|
||||||
|
EmailServerModel::truncate();
|
||||||
|
|
||||||
|
$wsBase = new WsBase();
|
||||||
|
$result = $wsBase->sendMessage($appUid, $from, $to, $cc, $bcc, $subject, $templateName, $appFields, $attachment, $showMessage, $delIndex, $config, $gmail, $appMsgType);
|
||||||
|
|
||||||
|
//assertions
|
||||||
|
$this->assertObjectHasAttribute('status_code', $result);
|
||||||
|
$this->assertObjectHasAttribute('message', $result);
|
||||||
|
$this->assertObjectHasAttribute('timestamp', $result);
|
||||||
|
$this->assertObjectHasAttribute('extraParams', $result);
|
||||||
|
$this->assertEquals(29, $result->status_code);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test ensures the response when the template is not found.
|
||||||
|
* @test
|
||||||
|
* @covers WsBase::sendMessage
|
||||||
|
*/
|
||||||
|
public function it_should_test_an_send_message_missing_template()
|
||||||
|
{
|
||||||
|
//data
|
||||||
|
$emailServer = $this->createEmailServer();
|
||||||
|
$case = $this->createNewCase();
|
||||||
|
$template = $this->createTemplate($case->process->PRO_UID, $case->user->USR_UID);
|
||||||
|
|
||||||
|
//parameters
|
||||||
|
$appUid = $case->application->APP_UID;
|
||||||
|
$from = $emailServer->MESS_ACCOUNT;
|
||||||
|
$to = $emailServer->MESS_ACCOUNT;
|
||||||
|
$cc = "";
|
||||||
|
$bcc = "";
|
||||||
|
$subject = "test";
|
||||||
|
$templateName = basename($template->PRF_PATH);
|
||||||
|
$appFields = [];
|
||||||
|
$attachment = [];
|
||||||
|
$showMessage = true;
|
||||||
|
$delIndex = 0;
|
||||||
|
$config = $emailServer->toArray();
|
||||||
|
$gmail = 0;
|
||||||
|
$appMsgType = '';
|
||||||
|
|
||||||
|
//for a missing template
|
||||||
|
$templateName = 'MissingFile';
|
||||||
|
G::rm_dir(PATH_DATA_SITE . 'mailTemplates');
|
||||||
|
|
||||||
|
$wsBase = new WsBase();
|
||||||
|
$result = $wsBase->sendMessage($appUid, $from, $to, $cc, $bcc, $subject, $templateName, $appFields, $attachment, $showMessage, $delIndex, $config, $gmail, $appMsgType);
|
||||||
|
|
||||||
|
//assertions
|
||||||
|
$this->assertObjectHasAttribute('status_code', $result);
|
||||||
|
$this->assertObjectHasAttribute('message', $result);
|
||||||
|
$this->assertObjectHasAttribute('timestamp', $result);
|
||||||
|
$this->assertObjectHasAttribute('extraParams', $result);
|
||||||
|
$this->assertEquals(28, $result->status_code);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test ensures the response when there is an exception.
|
||||||
|
* @test
|
||||||
|
* @covers WsBase::sendMessage
|
||||||
|
*/
|
||||||
|
public function it_should_test_an_send_message_when_appears_an_exception()
|
||||||
|
{
|
||||||
|
//data
|
||||||
|
$emailServer = $this->createEmailServer();
|
||||||
|
$case = $this->createNewCase();
|
||||||
|
$template = $this->createTemplate($case->process->PRO_UID, $case->user->USR_UID);
|
||||||
|
|
||||||
|
//parameters
|
||||||
|
$appUid = null;
|
||||||
|
$from = $emailServer->MESS_ACCOUNT;
|
||||||
|
$to = $emailServer->MESS_ACCOUNT;
|
||||||
|
$cc = "";
|
||||||
|
$bcc = "";
|
||||||
|
$subject = "test";
|
||||||
|
$templateName = basename($template->PRF_PATH);
|
||||||
|
$appFields = [];
|
||||||
|
$attachment = [];
|
||||||
|
$showMessage = true;
|
||||||
|
$delIndex = 0;
|
||||||
|
$config = $emailServer->toArray();
|
||||||
|
$gmail = 0;
|
||||||
|
$appMsgType = '';
|
||||||
|
|
||||||
|
$wsBase = new WsBase();
|
||||||
|
$result = $wsBase->sendMessage($appUid, $from, $to, $cc, $bcc, $subject, $templateName, $appFields, $attachment, $showMessage, $delIndex, $config, $gmail, $appMsgType);
|
||||||
|
|
||||||
|
//assertions
|
||||||
|
$this->assertObjectHasAttribute('status_code', $result);
|
||||||
|
$this->assertObjectHasAttribute('message', $result);
|
||||||
|
$this->assertObjectHasAttribute('timestamp', $result);
|
||||||
|
$this->assertObjectHasAttribute('extraParams', $result);
|
||||||
|
$this->assertEquals(100, $result->status_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -680,7 +796,7 @@ class WsBaseTest extends TestCase
|
|||||||
]);
|
]);
|
||||||
$_SESSION["APPLICATION"] = $delegation->APP_UID;
|
$_SESSION["APPLICATION"] = $delegation->APP_UID;
|
||||||
$ws = new WsBase();
|
$ws = new WsBase();
|
||||||
$response = (object)$ws->cancelCase($delegation->APP_UID, $delegation->DEL_INDEX, $delegation->APP_UID);
|
$response = (object) $ws->cancelCase($delegation->APP_UID, $delegation->DEL_INDEX, $delegation->APP_UID);
|
||||||
$this->assertEquals($ws->getFlagSameCase(), true);
|
$this->assertEquals($ws->getFlagSameCase(), true);
|
||||||
$this->assertNotEmpty($response);
|
$this->assertNotEmpty($response);
|
||||||
}
|
}
|
||||||
@@ -695,7 +811,7 @@ class WsBaseTest extends TestCase
|
|||||||
{
|
{
|
||||||
$delegation = factory(Delegation::class)->states('foreign_keys')->create();
|
$delegation = factory(Delegation::class)->states('foreign_keys')->create();
|
||||||
$ws = new WsBase();
|
$ws = new WsBase();
|
||||||
$response = (object)$ws->cancelCase('', $delegation->DE_INDEX, $delegation->URS_UID);
|
$response = (object) $ws->cancelCase('', $delegation->DE_INDEX, $delegation->URS_UID);
|
||||||
$this->assertEquals($response->status_code, 100);
|
$this->assertEquals($response->status_code, 100);
|
||||||
$this->assertEquals($response->message, G::LoadTranslation("ID_REQUIRED_FIELD") . ' caseUid');
|
$this->assertEquals($response->message, G::LoadTranslation("ID_REQUIRED_FIELD") . ' caseUid');
|
||||||
}
|
}
|
||||||
@@ -718,7 +834,7 @@ class WsBaseTest extends TestCase
|
|||||||
'APP_UID' => $application->APP_UID,
|
'APP_UID' => $application->APP_UID,
|
||||||
]);
|
]);
|
||||||
$ws = new WsBase();
|
$ws = new WsBase();
|
||||||
$response = (object)$ws->cancelCase($delegation->APP_UID, $delegation->DE_INDEX, $delegation->URS_UID);
|
$response = (object) $ws->cancelCase($delegation->APP_UID, $delegation->DE_INDEX, $delegation->URS_UID);
|
||||||
$this->assertEquals($response->status_code, 100);
|
$this->assertEquals($response->status_code, 100);
|
||||||
$this->assertEquals($response->message, G::LoadTranslation("ID_CASE_IN_STATUS") . ' DRAFT');
|
$this->assertEquals($response->message, G::LoadTranslation("ID_CASE_IN_STATUS") . ' DRAFT');
|
||||||
|
|
||||||
@@ -732,7 +848,7 @@ class WsBaseTest extends TestCase
|
|||||||
'APP_UID' => $application->APP_UID,
|
'APP_UID' => $application->APP_UID,
|
||||||
]);
|
]);
|
||||||
$ws = new WsBase();
|
$ws = new WsBase();
|
||||||
$response = (object)$ws->cancelCase($delegation->APP_UID, $delegation->DE_INDEX, $delegation->URS_UID);
|
$response = (object) $ws->cancelCase($delegation->APP_UID, $delegation->DE_INDEX, $delegation->URS_UID);
|
||||||
$this->assertEquals($response->status_code, 100);
|
$this->assertEquals($response->status_code, 100);
|
||||||
$this->assertEquals($response->message, G::LoadTranslation("ID_CASE_IN_STATUS") . ' COMPLETED');
|
$this->assertEquals($response->message, G::LoadTranslation("ID_CASE_IN_STATUS") . ' COMPLETED');
|
||||||
|
|
||||||
@@ -746,7 +862,7 @@ class WsBaseTest extends TestCase
|
|||||||
'APP_UID' => $application->APP_UID,
|
'APP_UID' => $application->APP_UID,
|
||||||
]);
|
]);
|
||||||
$ws = new WsBase();
|
$ws = new WsBase();
|
||||||
$response = (object)$ws->cancelCase($delegation->APP_UID, $delegation->DE_INDEX, $delegation->URS_UID);
|
$response = (object) $ws->cancelCase($delegation->APP_UID, $delegation->DE_INDEX, $delegation->URS_UID);
|
||||||
$this->assertEquals($response->status_code, 100);
|
$this->assertEquals($response->status_code, 100);
|
||||||
$this->assertEquals($response->message, G::LoadTranslation("ID_CASE_IN_STATUS") . ' CANCELLED');
|
$this->assertEquals($response->message, G::LoadTranslation("ID_CASE_IN_STATUS") . ' CANCELLED');
|
||||||
}
|
}
|
||||||
@@ -768,7 +884,7 @@ class WsBaseTest extends TestCase
|
|||||||
'APP_UID' => $application->APP_UID,
|
'APP_UID' => $application->APP_UID,
|
||||||
]);
|
]);
|
||||||
$ws = new WsBase();
|
$ws = new WsBase();
|
||||||
$response = (object)$ws->cancelCase($delegation->APP_UID, '', $delegation->USR_UID);
|
$response = (object) $ws->cancelCase($delegation->APP_UID, '', $delegation->USR_UID);
|
||||||
$this->assertEquals($response->status_code, 100);
|
$this->assertEquals($response->status_code, 100);
|
||||||
$this->assertEquals($response->message, G::LoadTranslation("ID_REQUIRED_FIELD") . ' delIndex');
|
$this->assertEquals($response->message, G::LoadTranslation("ID_REQUIRED_FIELD") . ' delIndex');
|
||||||
}
|
}
|
||||||
@@ -791,7 +907,7 @@ class WsBaseTest extends TestCase
|
|||||||
'DEL_THREAD_STATUS' => 'CLOSED'
|
'DEL_THREAD_STATUS' => 'CLOSED'
|
||||||
]);
|
]);
|
||||||
$ws = new WsBase();
|
$ws = new WsBase();
|
||||||
$response = (object)$ws->cancelCase($delegation->APP_UID, $delegation->DEL_INDEX, '');
|
$response = (object) $ws->cancelCase($delegation->APP_UID, $delegation->DEL_INDEX, '');
|
||||||
$this->assertEquals($response->status_code, 100);
|
$this->assertEquals($response->status_code, 100);
|
||||||
$this->assertEquals($response->message, G::LoadTranslation("ID_CASE_DELEGATION_ALREADY_CLOSED"));
|
$this->assertEquals($response->message, G::LoadTranslation("ID_CASE_DELEGATION_ALREADY_CLOSED"));
|
||||||
}
|
}
|
||||||
@@ -813,7 +929,7 @@ class WsBaseTest extends TestCase
|
|||||||
'APP_UID' => $application->APP_UID,
|
'APP_UID' => $application->APP_UID,
|
||||||
]);
|
]);
|
||||||
$ws = new WsBase();
|
$ws = new WsBase();
|
||||||
$response = (object)$ws->cancelCase($delegation->APP_UID, $delegation->DEL_INDEX, '');
|
$response = (object) $ws->cancelCase($delegation->APP_UID, $delegation->DEL_INDEX, '');
|
||||||
$this->assertEquals($response->status_code, 100);
|
$this->assertEquals($response->status_code, 100);
|
||||||
$this->assertEquals($response->message, G::LoadTranslation("ID_REQUIRED_FIELD") . ' userUid');
|
$this->assertEquals($response->message, G::LoadTranslation("ID_REQUIRED_FIELD") . ' userUid');
|
||||||
}
|
}
|
||||||
@@ -857,7 +973,7 @@ class WsBaseTest extends TestCase
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
$ws = new WsBase();
|
$ws = new WsBase();
|
||||||
$response = (object)$ws->cancelCase($delegation->APP_UID, $delegation->DEL_INDEX, $delegation->USR_UID);
|
$response = (object) $ws->cancelCase($delegation->APP_UID, $delegation->DEL_INDEX, $delegation->USR_UID);
|
||||||
$this->assertEquals($response->status_code, 100);
|
$this->assertEquals($response->status_code, 100);
|
||||||
$this->assertEquals($response->message, G::LoadTranslation("ID_CASE_CANCELLED_PARALLEL"));
|
$this->assertEquals($response->message, G::LoadTranslation("ID_CASE_CANCELLED_PARALLEL"));
|
||||||
}
|
}
|
||||||
@@ -904,7 +1020,7 @@ class WsBaseTest extends TestCase
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
$ws = new WsBase();
|
$ws = new WsBase();
|
||||||
$response = (object)$ws->cancelCase($delegation->APP_UID, $delegation->DEL_INDEX, $delegation->USR_UID);
|
$response = (object) $ws->cancelCase($delegation->APP_UID, $delegation->DEL_INDEX, $delegation->USR_UID);
|
||||||
$this->assertNotEmpty($response);
|
$this->assertNotEmpty($response);
|
||||||
$this->assertObjectHasAttribute('status_code', $response);
|
$this->assertObjectHasAttribute('status_code', $response);
|
||||||
$this->assertEquals($response->message, G::LoadTranslation("ID_COMMAND_EXECUTED_SUCCESSFULLY"));
|
$this->assertEquals($response->message, G::LoadTranslation("ID_COMMAND_EXECUTED_SUCCESSFULLY"));
|
||||||
@@ -969,7 +1085,7 @@ class WsBaseTest extends TestCase
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
$ws = new WsBase();
|
$ws = new WsBase();
|
||||||
$response = (object)$ws->cancelCase($delegation->APP_UID, null, null);
|
$response = (object) $ws->cancelCase($delegation->APP_UID, null, null);
|
||||||
$this->assertNotEmpty($response);
|
$this->assertNotEmpty($response);
|
||||||
$this->assertObjectHasAttribute('status_code', $response);
|
$this->assertObjectHasAttribute('status_code', $response);
|
||||||
$this->assertEquals($response->message, G::LoadTranslation("ID_COMMAND_EXECUTED_SUCCESSFULLY"));
|
$this->assertEquals($response->message, G::LoadTranslation("ID_COMMAND_EXECUTED_SUCCESSFULLY"));
|
||||||
@@ -1002,7 +1118,7 @@ class WsBaseTest extends TestCase
|
|||||||
'DEL_INDEX' => 2,
|
'DEL_INDEX' => 2,
|
||||||
]);
|
]);
|
||||||
$ws = new WsBase();
|
$ws = new WsBase();
|
||||||
$response = (object)$ws->cancelCase($fakeApp, $delegation->DEL_INDEX, $delegation->USR_UID);
|
$response = (object) $ws->cancelCase($fakeApp, $delegation->DEL_INDEX, $delegation->USR_UID);
|
||||||
$this->assertEquals($response->status_code, 100);
|
$this->assertEquals($response->status_code, 100);
|
||||||
$this->assertEquals($response->message, "The Application row '$fakeApp' doesn't exist!");
|
$this->assertEquals($response->message, "The Application row '$fakeApp' doesn't exist!");
|
||||||
}
|
}
|
||||||
|
|||||||
86
tests/unit/workflow/engine/classes/WsResponseTest.php
Normal file
86
tests/unit/workflow/engine/classes/WsResponseTest.php
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class WsResponseTest extends TestCase
|
||||||
|
{
|
||||||
|
private $wsResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set up method.
|
||||||
|
*/
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test get a extra param.
|
||||||
|
* @test
|
||||||
|
* @covers \WsResponse::__construct
|
||||||
|
* @covers \WsResponse::getExtraParam
|
||||||
|
*/
|
||||||
|
public function it_should_test_get_extra_param()
|
||||||
|
{
|
||||||
|
$this->wsResponse = new WsResponse(0, '');
|
||||||
|
|
||||||
|
//assert
|
||||||
|
$actual = $this->wsResponse->getExtraParam('');
|
||||||
|
$this->assertEmpty($actual);
|
||||||
|
|
||||||
|
//assert
|
||||||
|
$actual = $this->wsResponse->getExtraParam('test');
|
||||||
|
$this->assertEmpty($actual);
|
||||||
|
|
||||||
|
//assert
|
||||||
|
$expected = 'test';
|
||||||
|
$this->wsResponse->addExtraParam('test', $expected);
|
||||||
|
$actual = $this->wsResponse->getExtraParam('test');
|
||||||
|
$this->assertEquals($expected, $actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test the add extra param.
|
||||||
|
* @test
|
||||||
|
* @covers \WsResponse::addExtraParam
|
||||||
|
*/
|
||||||
|
public function it_should_test_add_extra_param()
|
||||||
|
{
|
||||||
|
$this->wsResponse = new WsResponse(0, '');
|
||||||
|
|
||||||
|
//assert
|
||||||
|
$expected = 'test';
|
||||||
|
$this->wsResponse->addExtraParam('test', $expected);
|
||||||
|
$actual = $this->wsResponse->getExtraParam('test');
|
||||||
|
$this->assertEquals($expected, $actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test a get payload string.
|
||||||
|
* @test
|
||||||
|
* @covers \WsResponse::getPayloadString
|
||||||
|
*/
|
||||||
|
public function it_should_test_get_payload_string()
|
||||||
|
{
|
||||||
|
$this->wsResponse = new WsResponse(0, '');
|
||||||
|
|
||||||
|
//assert
|
||||||
|
$actual = $this->wsResponse->getPayloadString('test');
|
||||||
|
$this->assertContains('test', $actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @test
|
||||||
|
* @covers \WsResponse::getPayloadArray
|
||||||
|
*/
|
||||||
|
public function it_should_test_payload_array()
|
||||||
|
{
|
||||||
|
$this->wsResponse = new WsResponse(0, '');
|
||||||
|
|
||||||
|
//assert
|
||||||
|
$actual = $this->wsResponse->getPayloadArray();
|
||||||
|
$this->assertArrayHasKey('status_code', $actual);
|
||||||
|
$this->assertArrayHasKey('message', $actual);
|
||||||
|
$this->assertArrayHasKey('timestamp', $actual);
|
||||||
|
}
|
||||||
|
}
|
||||||
6
thirdparty/phing/Phing.php
vendored
6
thirdparty/phing/Phing.php
vendored
@@ -1111,12 +1111,6 @@ class Phing {
|
|||||||
ini_set('default_charset', 'iso-8859-1');
|
ini_set('default_charset', 'iso-8859-1');
|
||||||
ini_set('register_globals', 'off');
|
ini_set('register_globals', 'off');
|
||||||
ini_set('allow_call_time_pass_reference', 'on');
|
ini_set('allow_call_time_pass_reference', 'on');
|
||||||
|
|
||||||
// should return memory limit in MB
|
|
||||||
$mem_limit = (int) ini_get('memory_limit');
|
|
||||||
if ($mem_limit < 32) {
|
|
||||||
ini_set('memory_limit', '32M'); // nore: this may need to be higher for many projects
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ class PmBootstrap extends Bootstrap
|
|||||||
ini_set('error_reporting', $e_all);
|
ini_set('error_reporting', $e_all);
|
||||||
ini_set('short_open_tag', 'On');
|
ini_set('short_open_tag', 'On');
|
||||||
ini_set('default_charset', "UTF-8");
|
ini_set('default_charset', "UTF-8");
|
||||||
ini_set('memory_limit', $this->pmConfig['memory_limit']);
|
|
||||||
ini_set('soap.wsdl_cache_enabled', $this->pmConfig['wsdl_cache']);
|
ini_set('soap.wsdl_cache_enabled', $this->pmConfig['wsdl_cache']);
|
||||||
ini_set('date.timezone', (isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__'])? 'UTC' : $this->pmConfig['time_zone']); //Set Time Zone
|
ini_set('date.timezone', (isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__'])? 'UTC' : $this->pmConfig['time_zone']); //Set Time Zone
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,6 @@ try {
|
|||||||
ini_set('error_reporting', $e_all);
|
ini_set('error_reporting', $e_all);
|
||||||
ini_set('short_open_tag', 'On');
|
ini_set('short_open_tag', 'On');
|
||||||
ini_set('default_charset', 'UTF-8');
|
ini_set('default_charset', 'UTF-8');
|
||||||
ini_set('memory_limit', $arraySystemConfiguration['memory_limit']);
|
|
||||||
ini_set('soap.wsdl_cache_enabled', $arraySystemConfiguration['wsdl_cache']);
|
ini_set('soap.wsdl_cache_enabled', $arraySystemConfiguration['wsdl_cache']);
|
||||||
ini_set('date.timezone', $systemUtcTimeZone ? 'UTC' : $arraySystemConfiguration['time_zone']);
|
ini_set('date.timezone', $systemUtcTimeZone ? 'UTC' : $arraySystemConfiguration['time_zone']);
|
||||||
|
|
||||||
|
|||||||
@@ -95,7 +95,6 @@ try {
|
|||||||
restore_error_handler();
|
restore_error_handler();
|
||||||
|
|
||||||
// Do not change any of these settings directly, use env.ini instead
|
// Do not change any of these settings directly, use env.ini instead
|
||||||
ini_set('memory_limit', $arraySystemConfiguration['memory_limit']);
|
|
||||||
ini_set('display_errors', $arraySystemConfiguration['debug']);
|
ini_set('display_errors', $arraySystemConfiguration['debug']);
|
||||||
ini_set('error_reporting', $e_all);
|
ini_set('error_reporting', $e_all);
|
||||||
ini_set('short_open_tag', 'On');
|
ini_set('short_open_tag', 'On');
|
||||||
|
|||||||
@@ -87,8 +87,6 @@ if(count ($argv) > 3) {
|
|||||||
$debug = 1;
|
$debug = 1;
|
||||||
|
|
||||||
ini_set ('display_errors', 1);
|
ini_set ('display_errors', 1);
|
||||||
//error_reporting (E_ALL);
|
|
||||||
ini_set ('memory_limit', '256M'); // set enough memory for the script
|
|
||||||
|
|
||||||
$e_all = defined( 'E_DEPRECATED' ) ? E_ALL & ~ E_DEPRECATED : E_ALL;
|
$e_all = defined( 'E_DEPRECATED' ) ? E_ALL & ~ E_DEPRECATED : E_ALL;
|
||||||
$e_all = defined( 'E_STRICT' ) ? $e_all & ~ E_STRICT : $e_all;
|
$e_all = defined( 'E_STRICT' ) ? $e_all & ~ E_STRICT : $e_all;
|
||||||
|
|||||||
@@ -52,8 +52,6 @@ $debug = 1;//enable o disable notice, this mechanism is inherited from '/process
|
|||||||
|
|
||||||
ini_set ('display_errors', 1);
|
ini_set ('display_errors', 1);
|
||||||
|
|
||||||
ini_set ('memory_limit', '256M'); // set enough memory for the script
|
|
||||||
|
|
||||||
$e_all = defined( 'E_DEPRECATED' ) ? E_ALL & ~ E_DEPRECATED : E_ALL;
|
$e_all = defined( 'E_DEPRECATED' ) ? E_ALL & ~ E_DEPRECATED : E_ALL;
|
||||||
$e_all = defined( 'E_STRICT' ) ? $e_all & ~ E_STRICT : $e_all;
|
$e_all = defined( 'E_STRICT' ) ? $e_all & ~ E_STRICT : $e_all;
|
||||||
$e_all = $debug ? $e_all : $e_all & ~ E_NOTICE;
|
$e_all = $debug ? $e_all : $e_all & ~ E_NOTICE;
|
||||||
|
|||||||
@@ -437,18 +437,6 @@ class ActionsByEmailCoreClass extends PMPlugin
|
|||||||
return $emailSetup;
|
return $emailSetup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Define the properties in the task related the action by email configuration
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
private function defineTaskAbeProperties()
|
|
||||||
{
|
|
||||||
$actionEmailTable = new AbeConfiguration();
|
|
||||||
$properties = $actionEmailTable->getTaskConfiguration($this->getCasePropertiesKey('PRO_UID'), $this->getTask());
|
|
||||||
$this->setTaskAbeProperties($properties);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define the email from
|
* Define the email from
|
||||||
*
|
*
|
||||||
@@ -623,79 +611,94 @@ class ActionsByEmailCoreClass extends PMPlugin
|
|||||||
self::validateAndSetValues($data);
|
self::validateAndSetValues($data);
|
||||||
|
|
||||||
$emailServerSetup = $this->getEmailServer($dataAbe['ABE_EMAIL_SERVER_UID']);
|
$emailServerSetup = $this->getEmailServer($dataAbe['ABE_EMAIL_SERVER_UID']);
|
||||||
if (!empty($emailServerSetup)) {
|
if (empty($emailServerSetup)) {
|
||||||
$cases = new Cases();
|
return;
|
||||||
$caseFields = $cases->loadCase($this->getAppUid(), $this->getIndex());
|
|
||||||
$this->setCaseProperties($caseFields);
|
|
||||||
$this->defineTaskAbeProperties();
|
|
||||||
$caseFields['APP_DATA']['PRO_ID'] = $this->getItemAbeProperties('PRO_ID');
|
|
||||||
$caseFields['APP_DATA']['TAS_ID'] = $this->getItemAbeProperties('TAS_ID');
|
|
||||||
if (!empty($this->getTaskAbeProperties())) {
|
|
||||||
$this->defineEmailTo($this->getItemAbeProperties('ABE_EMAIL_FIELD'), $caseFields['APP_DATA']);
|
|
||||||
|
|
||||||
if (!empty($this->getEmailTo())) {
|
|
||||||
$this->defineSubject($this->getItemAbeProperties('ABE_SUBJECT_FIELD'), $caseFields['APP_DATA']);
|
|
||||||
|
|
||||||
$request = [
|
|
||||||
'ABE_REQ_UID' => '',
|
|
||||||
'ABE_UID' => $this->getItemAbeProperties('ABE_UID'),
|
|
||||||
'APP_UID' => $this->getAppUid(),
|
|
||||||
'DEL_INDEX' => $this->getIndex(),
|
|
||||||
'ABE_REQ_SENT_TO' => $this->getEmailTo(),
|
|
||||||
'ABE_REQ_SUBJECT' => $this->getSubject(),
|
|
||||||
'ABE_REQ_BODY' => '',
|
|
||||||
'ABE_REQ_ANSWERED' => 0,
|
|
||||||
'ABE_REQ_STATUS' => 'PENDING'
|
|
||||||
];
|
|
||||||
$this->setAbeRequest($request);
|
|
||||||
$this->registerRequest();
|
|
||||||
|
|
||||||
if (!empty($this->getItemAbeProperties('ABE_TYPE'))) {
|
|
||||||
// Email
|
|
||||||
$_SESSION['CURRENT_DYN_UID'] = $this->getItemAbeProperties('DYN_UID');
|
|
||||||
$__ABE__ = '';
|
|
||||||
|
|
||||||
switch ($this->getItemAbeProperties('ABE_TYPE')) {
|
|
||||||
case 'CUSTOM':
|
|
||||||
$__ABE__ .= $this->getCustomTemplate();
|
|
||||||
break;
|
|
||||||
case 'RESPONSE':
|
|
||||||
$this->defineReplyTo($dataAbe['ABE_EMAIL_SERVER_RECEIVER_UID']);
|
|
||||||
$__ABE__ .= $this->getResponseTemplate();
|
|
||||||
break;
|
|
||||||
case 'LINK':
|
|
||||||
$__ABE__ .= $this->getServicePathTemplate();
|
|
||||||
break;
|
|
||||||
case 'FIELD':
|
|
||||||
$__ABE__ .= $this->getFieldTemplate();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
$__ABE__ = preg_replace('/\<img src=\"\/js\/maborak\/core\/images\/(.+?)\>/', '', $__ABE__);
|
|
||||||
$__ABE__ = preg_replace('/\<input\b[^>]*\/>/', '', $__ABE__);
|
|
||||||
$__ABE__ = preg_replace('/<select\b[^>]*>(.*?)<\/select>/is', "", $__ABE__);
|
|
||||||
$__ABE__ = preg_replace('/align=\"center\"/', '', $__ABE__);
|
|
||||||
$__ABE__ = preg_replace('/class="tableGrid_view" /', 'class="tableGrid_view" width="100%" ',
|
|
||||||
$__ABE__);
|
|
||||||
$caseFields['APP_DATA']['__ABE__'] = $__ABE__;
|
|
||||||
|
|
||||||
$this->defineEmailFrom($emailServerSetup);
|
|
||||||
$result = $this->abeSendMessage(
|
|
||||||
$this->getItemAbeProperties('ABE_TEMPLATE'),
|
|
||||||
$caseFields['APP_DATA'],
|
|
||||||
$emailServerSetup
|
|
||||||
);
|
|
||||||
$request = [];
|
|
||||||
$request['ABE_REQ_STATUS'] = ($result->status_code == 0 ? 'SENT' : 'ERROR');
|
|
||||||
|
|
||||||
$request['ABE_REQ_BODY'] = empty($result->getAppMessUid()) ? '' : AppMessage::getAppMsgBodyByKey($result->getAppMessUid());
|
|
||||||
$this->addItemAbeRequest($request);
|
|
||||||
$this->registerRequest();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new Exception('Task does not have an action by email configuration.');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$cases = new Cases();
|
||||||
|
$caseFields = $cases->loadCase($this->getAppUid(), $this->getIndex());
|
||||||
|
$this->setCaseProperties($caseFields);
|
||||||
|
|
||||||
|
$actionEmailTable = new AbeConfiguration();
|
||||||
|
$properties = $actionEmailTable->getTaskConfiguration($this->getCasePropertiesKey('PRO_UID'), $this->getTask());
|
||||||
|
if (empty($properties)) {
|
||||||
|
throw new Exception('Task does not have an action by email configuration.');
|
||||||
|
}
|
||||||
|
$this->setTaskAbeProperties($properties);
|
||||||
|
|
||||||
|
$caseFields['APP_DATA']['PRO_ID'] = $this->getItemAbeProperties('PRO_ID');
|
||||||
|
$caseFields['APP_DATA']['TAS_ID'] = $this->getItemAbeProperties('TAS_ID');
|
||||||
|
|
||||||
|
$this->defineEmailTo($this->getItemAbeProperties('ABE_EMAIL_FIELD'), $caseFields['APP_DATA']);
|
||||||
|
if (empty($this->getEmailTo())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->defineSubject($this->getItemAbeProperties('ABE_SUBJECT_FIELD'), $caseFields['APP_DATA']);
|
||||||
|
|
||||||
|
$request = [
|
||||||
|
'ABE_REQ_UID' => '',
|
||||||
|
'ABE_UID' => $this->getItemAbeProperties('ABE_UID'),
|
||||||
|
'APP_UID' => $this->getAppUid(),
|
||||||
|
'DEL_INDEX' => $this->getIndex(),
|
||||||
|
'ABE_REQ_SENT_TO' => $this->getEmailTo(),
|
||||||
|
'ABE_REQ_SUBJECT' => $this->getSubject(),
|
||||||
|
'ABE_REQ_BODY' => '',
|
||||||
|
'ABE_REQ_ANSWERED' => 0,
|
||||||
|
'ABE_REQ_STATUS' => 'PENDING'
|
||||||
|
];
|
||||||
|
$this->setAbeRequest($request);
|
||||||
|
$this->registerRequest();
|
||||||
|
|
||||||
|
if (empty($this->getItemAbeProperties('ABE_TYPE'))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Email
|
||||||
|
$_SESSION['CURRENT_DYN_UID'] = $this->getItemAbeProperties('DYN_UID');
|
||||||
|
|
||||||
|
$__ABE__ = '';
|
||||||
|
switch ($this->getItemAbeProperties('ABE_TYPE')) {
|
||||||
|
case 'CUSTOM':
|
||||||
|
$__ABE__ .= $this->getCustomTemplate();
|
||||||
|
break;
|
||||||
|
case 'RESPONSE':
|
||||||
|
$this->defineReplyTo($dataAbe['ABE_EMAIL_SERVER_RECEIVER_UID']);
|
||||||
|
$__ABE__ .= $this->getResponseTemplate();
|
||||||
|
break;
|
||||||
|
case 'LINK':
|
||||||
|
$__ABE__ .= $this->getServicePathTemplate();
|
||||||
|
break;
|
||||||
|
case 'FIELD':
|
||||||
|
$__ABE__ .= $this->getFieldTemplate();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$__ABE__ = preg_replace('/\<img src=\"\/js\/maborak\/core\/images\/(.+?)\>/', '', $__ABE__);
|
||||||
|
$__ABE__ = preg_replace('/\<input\b[^>]*\/>/', '', $__ABE__);
|
||||||
|
$__ABE__ = preg_replace('/<select\b[^>]*>(.*?)<\/select>/is', "", $__ABE__);
|
||||||
|
$__ABE__ = preg_replace('/align=\"center\"/', '', $__ABE__);
|
||||||
|
$__ABE__ = preg_replace('/class="tableGrid_view" /', 'class="tableGrid_view" width="100%" ', $__ABE__);
|
||||||
|
|
||||||
|
$caseFields['APP_DATA']['__ABE__'] = $__ABE__;
|
||||||
|
|
||||||
|
$this->defineEmailFrom($emailServerSetup);
|
||||||
|
|
||||||
|
$params = [
|
||||||
|
$this->getItemAbeProperties('ABE_TEMPLATE'),
|
||||||
|
$caseFields['APP_DATA'],
|
||||||
|
$emailServerSetup
|
||||||
|
];
|
||||||
|
$result = $this->abeSendMessage(...$params);
|
||||||
|
|
||||||
|
$request = [
|
||||||
|
'ABE_REQ_STATUS' => $result->status_code == 0 ? 'SENT' : 'ERROR',
|
||||||
|
'ABE_REQ_BODY' => '',
|
||||||
|
];
|
||||||
|
if (!empty($result->getExtraParam('AppMessUid'))) {
|
||||||
|
$request['ABE_REQ_BODY'] = AppMessage::getAppMsgBodyByKey($result->getExtraParam('AppMessUid'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->addItemAbeRequest($request);
|
||||||
|
$this->registerRequest();
|
||||||
} catch (Exception $error) {
|
} catch (Exception $error) {
|
||||||
throw $error;
|
throw $error;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -206,6 +206,7 @@ class DbConnections
|
|||||||
});
|
});
|
||||||
foreach ($externalDbs as $externalDb) {
|
foreach ($externalDbs as $externalDb) {
|
||||||
$conf['datasources'][$externalDb->DBS_UID] = [];
|
$conf['datasources'][$externalDb->DBS_UID] = [];
|
||||||
|
$laravelConfig = [];
|
||||||
$flagTns = ($externalDb->DBS_TYPE == "oracle" && $externalDb->DBS_CONNECTION_TYPE == "TNS")? 1 : 0;
|
$flagTns = ($externalDb->DBS_TYPE == "oracle" && $externalDb->DBS_CONNECTION_TYPE == "TNS")? 1 : 0;
|
||||||
// Build the appropriate items to add to our Propel configuration
|
// Build the appropriate items to add to our Propel configuration
|
||||||
// Let's grab the decrypted password
|
// Let's grab the decrypted password
|
||||||
@@ -235,12 +236,26 @@ class DbConnections
|
|||||||
. $externalDb->DBS_USERNAME . ':' . $passw . '@' . $externalDb->DBS_SERVER . $dbsPort . '/'
|
. $externalDb->DBS_USERNAME . ':' . $passw . '@' . $externalDb->DBS_SERVER . $dbsPort . '/'
|
||||||
. $externalDb->DBS_DATABASE_NAME . $encoding;
|
. $externalDb->DBS_DATABASE_NAME . $encoding;
|
||||||
}
|
}
|
||||||
|
$laravelConfig = [
|
||||||
|
'driver' => $externalDb->DBS_TYPE === 'mssql' ? 'sqlsrv' : $externalDb->DBS_TYPE, // MSSQL driver is not supported anymore, only SQLSRV
|
||||||
|
'host' => $externalDb->DBS_SERVER,
|
||||||
|
'port' => $externalDb->DBS_PORT == '' ? null : $externalDb->DBS_PORT,
|
||||||
|
'database' => $externalDb->DBS_DATABASE_NAME,
|
||||||
|
'username' => $externalDb->DBS_USERNAME,
|
||||||
|
'password' => $passw,
|
||||||
|
'charset' => trim($externalDb->DBS_ENCODE) == '' ? null : trim($externalDb->DBS_ENCODE),
|
||||||
|
'options' => [PDO::ATTR_STRINGIFY_FETCHES => true] // For keep the old behaviour, all values are transformed to strings
|
||||||
|
];
|
||||||
} else {
|
} else {
|
||||||
// Is oracle and TNS, let's provide a TNS based DSN
|
// Is oracle and TNS, let's provide a TNS based DSN
|
||||||
$conf["datasources"][$externalDb->DBS_UID]["connection"] = $externalDb->DBS_TYPE . "://"
|
$conf["datasources"][$externalDb->DBS_UID]["connection"] = $externalDb->DBS_TYPE . "://"
|
||||||
. $externalDb->DBS_USERNAME . ":" . $passw . "@" . $externalDb->DBS_TNS;
|
. $externalDb->DBS_USERNAME . ":" . $passw . "@" . $externalDb->DBS_TNS;
|
||||||
}
|
}
|
||||||
$conf['datasources'][$externalDb->DBS_UID]['adapter'] = $externalDb->DBS_TYPE;
|
$conf['datasources'][$externalDb->DBS_UID]['adapter'] = $externalDb->DBS_TYPE;
|
||||||
|
// Load the config for the external database into laravel
|
||||||
|
config([
|
||||||
|
'database.connections.' . $externalDb->DBS_UID => $laravelConfig
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
Propel::initConfiguration($conf);
|
Propel::initConfiguration($conf);
|
||||||
$lastProcessId = $_SESSION['PROCESS'];
|
$lastProcessId = $_SESSION['PROCESS'];
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ use ProcessMaker\ChangeLog\ChangeLog;
|
|||||||
use ProcessMaker\Core\JobsManager;
|
use ProcessMaker\Core\JobsManager;
|
||||||
use ProcessMaker\Core\System;
|
use ProcessMaker\Core\System;
|
||||||
use ProcessMaker\Model\Delegation;
|
use ProcessMaker\Model\Delegation;
|
||||||
use ProcessMaker\Util\WsMessageResponse;
|
|
||||||
|
|
||||||
class WsBase
|
class WsBase
|
||||||
{
|
{
|
||||||
@@ -910,6 +909,7 @@ class WsBase
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
$setup = [];
|
||||||
|
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
if (!empty($config)) {
|
if (!empty($config)) {
|
||||||
@@ -972,9 +972,7 @@ class WsBase
|
|||||||
|
|
||||||
if (!file_exists($fileTemplate)) {
|
if (!file_exists($fileTemplate)) {
|
||||||
$data['FILE_TEMPLATE'] = $fileTemplate;
|
$data['FILE_TEMPLATE'] = $fileTemplate;
|
||||||
$result = new WsResponse(28, G::LoadTranslation('ID_TEMPLATE_FILE_NOT_EXIST', SYS_LANG, $data));
|
return new WsResponse(28, G::LoadTranslation('ID_TEMPLATE_FILE_NOT_EXIST', SYS_LANG, $data));
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($appFields == null) {
|
if ($appFields == null) {
|
||||||
@@ -1002,45 +1000,46 @@ class WsBase
|
|||||||
(preg_match("/^.+\.html?$/i", $fileTemplate)) ? true : false,
|
(preg_match("/^.+\.html?$/i", $fileTemplate)) ? true : false,
|
||||||
isset($fieldsCase['APP_NUMBER']) ? $fieldsCase['APP_NUMBER'] : 0,
|
isset($fieldsCase['APP_NUMBER']) ? $fieldsCase['APP_NUMBER'] : 0,
|
||||||
isset($fieldsCase['PRO_ID']) ? $fieldsCase['PRO_ID'] : 0,
|
isset($fieldsCase['PRO_ID']) ? $fieldsCase['PRO_ID'] : 0,
|
||||||
$this->getTaskId() ?$this->getTaskId():(isset($oldFields['TAS_ID'])? $oldFields['TAS_ID'] : 0)
|
$this->getTaskId() ? $this->getTaskId() : (isset($oldFields['TAS_ID']) ? $oldFields['TAS_ID'] : 0)
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = "";
|
if ($gmail === 1) {
|
||||||
if ($gmail != 1) {
|
return new WsResponse(0, G::loadTranslation('ID_PMGMAIL'));
|
||||||
// Create always the record in APP_MESSAGE table
|
}
|
||||||
|
|
||||||
|
// Create always the record in APP_MESSAGE table
|
||||||
|
$spool = new SpoolRun();
|
||||||
|
$spool->setConfig($setup);
|
||||||
|
$spool->create($messageArray);
|
||||||
|
|
||||||
|
// Get the data of the record created
|
||||||
|
$fileData = $spool->getFileData();
|
||||||
|
$fileData['spoolId'] = $spool->getSpoolId();
|
||||||
|
|
||||||
|
// Create the closure and send the required data
|
||||||
|
$closure = function() use ($setup, $fileData, $gmail, $to) {
|
||||||
$spool = new SpoolRun();
|
$spool = new SpoolRun();
|
||||||
$spool->setConfig($setup);
|
$spool->setConfig($setup);
|
||||||
$spool->create($messageArray);
|
$spool->setSpoolId($fileData['spoolId']);
|
||||||
|
$spool->setFileData($fileData);
|
||||||
// Get the data of the record created
|
$spool->sendMail();
|
||||||
$fileData = $spool->getFileData();
|
return $spool;
|
||||||
$fileData['spoolId'] = $spool->getSpoolId();
|
};
|
||||||
|
switch ($appMsgType) {
|
||||||
// Create the closure and send the required data
|
case WsBase::MESSAGE_TYPE_EMAIL_EVENT:
|
||||||
$closure = function() use ($setup, $fileData, $gmail, $to) {
|
case WsBase::MESSAGE_TYPE_PM_FUNCTION:
|
||||||
$spool = new SpoolRun();
|
JobsManager::getSingleton()->dispatch('EmailEvent', $closure);
|
||||||
$spool->setConfig($setup);
|
$result = new WsResponse(0, G::loadTranslation('ID_MESSAGE_SENT') . ": " . $to);
|
||||||
$spool->setSpoolId($fileData['spoolId']);
|
break;
|
||||||
$spool->setFileData($fileData);
|
default :
|
||||||
$spool->sendMail();
|
$spool = $closure();
|
||||||
return $spool;
|
if ($spool->status == 'sent') {
|
||||||
};
|
$result = new WsResponse(0, G::loadTranslation('ID_MESSAGE_SENT') . ": " . $to);
|
||||||
$result = new WsMessageResponse(0, G::loadTranslation('ID_MESSAGE_SENT') . ": " . $to);
|
$result->addExtraParam('AppMessUid', $spool->getSpoolId());
|
||||||
switch ($appMsgType) {
|
} else {
|
||||||
case WsBase::MESSAGE_TYPE_EMAIL_EVENT:
|
$result = new WsResponse(29, $spool->status . ' ' . $spool->error . PHP_EOL . print_r($setup, 1));
|
||||||
case WsBase::MESSAGE_TYPE_PM_FUNCTION:
|
}
|
||||||
JobsManager::getSingleton()->dispatch('EmailEvent', $closure);
|
break;
|
||||||
break;
|
|
||||||
default :
|
|
||||||
$spool = $closure();
|
|
||||||
if ($spool->status == 'sent') {
|
|
||||||
$result = new WsMessageResponse(0, G::loadTranslation('ID_MESSAGE_SENT') . ": " . $to);
|
|
||||||
$result->setAppMessUid($spool->getSpoolId());
|
|
||||||
} else {
|
|
||||||
$result = new WsResponse(29, $spool->status . ' ' . $spool->error . PHP_EOL . print_r($setup, 1));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
|||||||
@@ -43,10 +43,11 @@ class WsResponse
|
|||||||
* 36 ID_CASE_COULD_NOT_REASSIGNED
|
* 36 ID_CASE_COULD_NOT_REASSIGNED
|
||||||
*
|
*
|
||||||
* 100 Exception
|
* 100 Exception
|
||||||
*/
|
*/
|
||||||
public $status_code = 0;
|
public $status_code = 0;
|
||||||
public $message = '';
|
public $message = '';
|
||||||
public $timestamp = '';
|
public $timestamp = '';
|
||||||
|
private $extraParams = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function __construct
|
* Function __construct
|
||||||
@@ -56,11 +57,31 @@ class WsResponse
|
|||||||
* @param string $message
|
* @param string $message
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function __construct ($status, $message)
|
public function __construct($status, $message)
|
||||||
{
|
{
|
||||||
$this->status_code = $status;
|
$this->status_code = $status;
|
||||||
$this->message = $message;
|
$this->message = $message;
|
||||||
$this->timestamp = date( 'Y-m-d H:i:s' );
|
$this->timestamp = date('Y-m-d H:i:s');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get extra parameters for message response.
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getExtraParam(string $name)
|
||||||
|
{
|
||||||
|
return isset($this->extraParams[$name]) ? $this->extraParams[$name] : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add extra parameters for message response.
|
||||||
|
* @param string $name
|
||||||
|
* @param mixed $value
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function addExtraParam(string $name, $value): void
|
||||||
|
{
|
||||||
|
$this->extraParams[$name] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -69,13 +90,12 @@ class WsResponse
|
|||||||
* @param string $operation
|
* @param string $operation
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function getPayloadString ($operation)
|
public function getPayloadString($operation)
|
||||||
{
|
{
|
||||||
$res = "<$operation>\n";
|
$res = "<$operation>\n";
|
||||||
$res .= "<status_code>" . $this->status_code . "</status_code>";
|
$res .= "<status_code>" . $this->status_code . "</status_code>";
|
||||||
$res .= "<message>" . $this->message . "</message>";
|
$res .= "<message>" . $this->message . "</message>";
|
||||||
$res .= "<timestamp>" . $this->timestamp . "</timestamp>";
|
$res .= "<timestamp>" . $this->timestamp . "</timestamp>";
|
||||||
// $res .= "<array>" . $this->timestamp . "</array>";
|
|
||||||
$res .= "<$operation>";
|
$res .= "<$operation>";
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
@@ -85,9 +105,8 @@ class WsResponse
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getPayloadArray ()
|
public function getPayloadArray()
|
||||||
{
|
{
|
||||||
return array ("status_code" => $this->status_code,'message' => $this->message,'timestamp' => $this->timestamp
|
return ["status_code" => $this->status_code, 'message' => $this->message, 'timestamp' => $this->timestamp];
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ use ProcessMaker\BusinessModel\Cases as BusinessModelCases;
|
|||||||
use ProcessMaker\Core\System;
|
use ProcessMaker\Core\System;
|
||||||
use ProcessMaker\Plugins\PluginRegistry;
|
use ProcessMaker\Plugins\PluginRegistry;
|
||||||
use ProcessMaker\Util\ElementTranslation;
|
use ProcessMaker\Util\ElementTranslation;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ProcessMaker has made a number of its PHP functions available be used in triggers and conditions.
|
* ProcessMaker has made a number of its PHP functions available be used in triggers and conditions.
|
||||||
@@ -243,8 +244,22 @@ function executeQuery ($SqlStatement, $DBConnectionUID = 'workflow', $aParameter
|
|||||||
{
|
{
|
||||||
$sysSys = (!empty(config("system.workspace")))? config("system.workspace") : "Undefined";
|
$sysSys = (!empty(config("system.workspace")))? config("system.workspace") : "Undefined";
|
||||||
$aContext = \Bootstrap::getDefaultContextLog();
|
$aContext = \Bootstrap::getDefaultContextLog();
|
||||||
$con = Propel::getConnection( $DBConnectionUID );
|
|
||||||
$con->begin();
|
// This means the DBConnectionUID is not loaded yet, so we'll force DbConnections::loadAdditionalConnections
|
||||||
|
if (is_null(config('database.connections.' . $DBConnectionUID . '.driver'))) {
|
||||||
|
// Force to load the external connections
|
||||||
|
DbConnections::loadAdditionalConnections();
|
||||||
|
if (config('database.connections.' . $DBConnectionUID . '.driver') !== 'oracle') {
|
||||||
|
// If the connections drivers are "mysql", "pgsql" or "sqlsrv" we're using Laravel
|
||||||
|
$con = DB::connection($DBConnectionUID);
|
||||||
|
$con->beginTransaction();
|
||||||
|
} else {
|
||||||
|
// If the connection driver is "oracle" we're using the native oci8 functions
|
||||||
|
$con = Propel::getConnection($DBConnectionUID);
|
||||||
|
$con->begin();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$blackList = System::getQueryBlackList();
|
$blackList = System::getQueryBlackList();
|
||||||
$listQueries = explode('|', isset($blackList['queries']) ? $blackList['queries'] : '');
|
$listQueries = explode('|', isset($blackList['queries']) ? $blackList['queries'] : '');
|
||||||
$aListAllTables = explode(
|
$aListAllTables = explode(
|
||||||
@@ -299,36 +314,34 @@ function executeQuery ($SqlStatement, $DBConnectionUID = 'workflow', $aParameter
|
|||||||
$statement = str_replace( '(', '', $statement );
|
$statement = str_replace( '(', '', $statement );
|
||||||
|
|
||||||
$result = false;
|
$result = false;
|
||||||
if (getEngineDataBaseName( $con ) != 'oracle') {
|
|
||||||
|
// Check to see if we're not running oracle, which is usually a safe default
|
||||||
|
if (config('database.connections.' . $DBConnectionUID . '.driver') != 'oracle') {
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case preg_match( "/^(SELECT|EXECUTE|EXEC|SHOW|DESCRIBE|EXPLAIN|BEGIN)\s/i", $statement ):
|
case preg_match( "/^(SELECT|EXECUTE|EXEC|SHOW|DESCRIBE|EXPLAIN|BEGIN)\s/i", $statement ):
|
||||||
$rs = $con->executeQuery( $SqlStatement );
|
$result = $con->select( $SqlStatement );
|
||||||
$result = Array ();
|
|
||||||
$i = 1;
|
// Convert to 1 index key array of array results
|
||||||
while ($rs->next()) {
|
$result = collect($result)->map(function($x) { return (array)$x; })->toArray();
|
||||||
$result[$i ++] = $rs->getRow();
|
array_unshift($result, []);
|
||||||
}
|
unset($result[0]);
|
||||||
$rs->close();
|
|
||||||
$con->commit();
|
$con->commit();
|
||||||
break;
|
break;
|
||||||
case preg_match( "/^INSERT\s/i", $statement ):
|
case preg_match( "/^INSERT\s/i", $statement ):
|
||||||
$rs = $con->executeUpdate( $SqlStatement );
|
$result = $con->insert( $SqlStatement );
|
||||||
$result = $con->getUpdateCount();
|
|
||||||
$con->commit();
|
$con->commit();
|
||||||
break;
|
break;
|
||||||
case preg_match( "/^REPLACE\s/i", $statement ):
|
case preg_match( "/^REPLACE\s/i", $statement ):
|
||||||
$rs = $con->executeUpdate( $SqlStatement );
|
$result = $con->update( $SqlStatement );
|
||||||
$result = $con->getUpdateCount();
|
|
||||||
$con->commit();
|
$con->commit();
|
||||||
break;
|
break;
|
||||||
case preg_match( "/^UPDATE\s/i", $statement ):
|
case preg_match( "/^UPDATE\s/i", $statement ):
|
||||||
$rs = $con->executeUpdate( $SqlStatement );
|
$result = $con->update( $SqlStatement );
|
||||||
$result = $con->getUpdateCount();
|
|
||||||
$con->commit();
|
$con->commit();
|
||||||
break;
|
break;
|
||||||
case preg_match( "/^DELETE\s/i", $statement ):
|
case preg_match( "/^DELETE\s/i", $statement ):
|
||||||
$rs = $con->executeUpdate( $SqlStatement );
|
$result = $con->delete( $SqlStatement );
|
||||||
$result = $con->getUpdateCount();
|
|
||||||
$con->commit();
|
$con->commit();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -947,9 +960,8 @@ function PMFSendMessage(
|
|||||||
$delIndex = 0,
|
$delIndex = 0,
|
||||||
$config = []
|
$config = []
|
||||||
) {
|
) {
|
||||||
ini_set ( "pcre.backtrack_limit", 1000000 );
|
ini_set("pcre.backtrack_limit", 1000000);
|
||||||
ini_set ( 'memory_limit', '-1' );
|
@set_time_limit(100000);
|
||||||
@set_time_limit ( 100000 );
|
|
||||||
|
|
||||||
global $oPMScript;
|
global $oPMScript;
|
||||||
|
|
||||||
|
|||||||
@@ -1181,7 +1181,6 @@ class InstallerModule extends Controller
|
|||||||
{
|
{
|
||||||
$filter = new InputFilter();
|
$filter = new InputFilter();
|
||||||
ini_set('max_execution_time', '0');
|
ini_set('max_execution_time', '0');
|
||||||
ini_set('memory_limit', '256M');
|
|
||||||
|
|
||||||
$serv = 'http://';
|
$serv = 'http://';
|
||||||
if (isset($_SERVER['HTTPS']) && !empty(trim($_SERVER['HTTPS']))) {
|
if (isset($_SERVER['HTTPS']) && !empty(trim($_SERVER['HTTPS']))) {
|
||||||
|
|||||||
@@ -65,11 +65,6 @@ class adminProxy extends HttpProxyController
|
|||||||
$updatedConf['expiration_year'] = $httpData->expiration_year;
|
$updatedConf['expiration_year'] = $httpData->expiration_year;
|
||||||
}
|
}
|
||||||
|
|
||||||
$httpData->memory_limit .= 'M';
|
|
||||||
if ($sysConf['memory_limit'] != $httpData->memory_limit) {
|
|
||||||
$updatedConf['memory_limit'] = $httpData->memory_limit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($sysConf['proxy_host'] != $httpData->proxy_host) {
|
if ($sysConf['proxy_host'] != $httpData->proxy_host) {
|
||||||
$updatedConf['proxy_host'] = $httpData->proxy_host;
|
$updatedConf['proxy_host'] = $httpData->proxy_host;
|
||||||
}
|
}
|
||||||
@@ -126,7 +121,7 @@ class adminProxy extends HttpProxyController
|
|||||||
$msg = ", Host -> " . $httpData->proxy_host . ", Port -> " . $httpData->proxy_port . ", User -> " . $httpData->proxy_user;
|
$msg = ", Host -> " . $httpData->proxy_host . ", Port -> " . $httpData->proxy_port . ", User -> " . $httpData->proxy_user;
|
||||||
}
|
}
|
||||||
|
|
||||||
G::auditLog("UploadSystemSettings", "Time Zone -> " . $httpData->time_zone . ", Memory Limit -> " . $httpData->memory_limit . ", Cookie lifetime -> " . $httpData->max_life_time . ", Default Skin -> " . $httpData->default_skin . ", Default Language -> " . $httpData->default_lang . $msg);
|
G::auditLog("UploadSystemSettings", "Time Zone -> " . $httpData->time_zone . ", Cookie lifetime -> " . $httpData->max_life_time . ", Default Skin -> " . $httpData->default_skin . ", Default Language -> " . $httpData->default_lang . $msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function uxUserUpdate($httpData)
|
public function uxUserUpdate($httpData)
|
||||||
@@ -1584,12 +1579,6 @@ class adminProxy extends HttpProxyController
|
|||||||
*/
|
*/
|
||||||
public static function validateDataSystemConf($httpData, $envFile)
|
public static function validateDataSystemConf($httpData, $envFile)
|
||||||
{
|
{
|
||||||
if (!((is_numeric($httpData->memory_limit)) && ((int)$httpData->memory_limit == $httpData->memory_limit) &&
|
|
||||||
((int)$httpData->memory_limit >= -1))
|
|
||||||
) {
|
|
||||||
throw new Exception(G::LoadTranslation('ID_MEMORY_LIMIT_VALIDATE'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!((is_numeric($httpData->max_life_time)) && ((int)$httpData->max_life_time == $httpData->max_life_time) &&
|
if (!((is_numeric($httpData->max_life_time)) && ((int)$httpData->max_life_time == $httpData->max_life_time) &&
|
||||||
((int)$httpData->max_life_time > 0))
|
((int)$httpData->max_life_time > 0))
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -376,9 +376,7 @@ class Installer
|
|||||||
}
|
}
|
||||||
|
|
||||||
//ACTIVE ENTERPRISE
|
//ACTIVE ENTERPRISE
|
||||||
|
|
||||||
ini_set('max_execution_time', '0');
|
ini_set('max_execution_time', '0');
|
||||||
ini_set('memory_limit', '256M');
|
|
||||||
|
|
||||||
$serv = 'http://';
|
$serv = 'http://';
|
||||||
if (isset($_SERVER['HTTPS']) && trim($_SERVER['HTTPS']) != '') {
|
if (isset($_SERVER['HTTPS']) && trim($_SERVER['HTTPS']) != '') {
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ class System
|
|||||||
'debug_time' => 0,
|
'debug_time' => 0,
|
||||||
'debug_calendar' => 0,
|
'debug_calendar' => 0,
|
||||||
'wsdl_cache' => 1,
|
'wsdl_cache' => 1,
|
||||||
'memory_limit' => "256M",
|
|
||||||
'time_zone' => 'America/New_York',
|
'time_zone' => 'America/New_York',
|
||||||
'expiration_year' => '1',
|
'expiration_year' => '1',
|
||||||
'memcached' => 0,
|
'memcached' => 0,
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace ProcessMaker\Util;
|
|
||||||
|
|
||||||
use WsResponse;
|
|
||||||
|
|
||||||
class WsMessageResponse extends WsResponse
|
|
||||||
{
|
|
||||||
private $appMessUid = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the appMessUid
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function getAppMessUid()
|
|
||||||
{
|
|
||||||
return $this->appMessUid;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the appMessUid
|
|
||||||
*
|
|
||||||
* @param string $v
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function setAppMessUid($v)
|
|
||||||
{
|
|
||||||
$this->appMessUid = $v;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -96,21 +96,6 @@ Ext.onReady(function(){
|
|||||||
items: [
|
items: [
|
||||||
cmbTimeZone,
|
cmbTimeZone,
|
||||||
{
|
{
|
||||||
xtype: 'numberfield',
|
|
||||||
id: 'memory_limit',
|
|
||||||
name: 'memory_limit',
|
|
||||||
fieldLabel: _('ID_MEMORY_LIMIT'),
|
|
||||||
allowBlank: false,
|
|
||||||
allowDecimals: false,
|
|
||||||
minValue: -1,
|
|
||||||
autoCreate: {tag: "input", type: "text", autocomplete: "off", maxlength: 15},
|
|
||||||
value: sysConf.memory_limit,
|
|
||||||
listeners: {
|
|
||||||
change: function () {
|
|
||||||
changeSettings();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
xtype: 'numberfield',
|
xtype: 'numberfield',
|
||||||
id: 'max_life_time',
|
id: 'max_life_time',
|
||||||
name: 'max_life_time',
|
name: 'max_life_time',
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ $config = PmSystem::getSystemConfiguration();
|
|||||||
$filter = new InputFilter();
|
$filter = new InputFilter();
|
||||||
$config['display_errors'] = $filter->validateInput($config['display_errors']);
|
$config['display_errors'] = $filter->validateInput($config['display_errors']);
|
||||||
$config['error_reporting'] = $filter->validateInput($config['error_reporting']);
|
$config['error_reporting'] = $filter->validateInput($config['error_reporting']);
|
||||||
$config['memory_limit'] = $filter->validateInput($config['memory_limit']);
|
|
||||||
$config['wsdl_cache'] = $filter->validateInput($config['wsdl_cache'], 'int');
|
$config['wsdl_cache'] = $filter->validateInput($config['wsdl_cache'], 'int');
|
||||||
$config['time_zone'] = $filter->validateInput($config['time_zone']);
|
$config['time_zone'] = $filter->validateInput($config['time_zone']);
|
||||||
// Do not change any of these settings directly, use env.ini instead
|
// Do not change any of these settings directly, use env.ini instead
|
||||||
@@ -60,7 +59,6 @@ ini_set('display_errors', $filter->validateInput($config['display_errors']));
|
|||||||
ini_set('error_reporting', $filter->validateInput($config['error_reporting']));
|
ini_set('error_reporting', $filter->validateInput($config['error_reporting']));
|
||||||
ini_set('short_open_tag', 'On');
|
ini_set('short_open_tag', 'On');
|
||||||
ini_set('default_charset', "UTF-8");
|
ini_set('default_charset', "UTF-8");
|
||||||
ini_set('memory_limit', $filter->validateInput($config['memory_limit']));
|
|
||||||
ini_set('soap.wsdl_cache_enabled', $config['wsdl_cache']);
|
ini_set('soap.wsdl_cache_enabled', $config['wsdl_cache']);
|
||||||
ini_set('date.timezone',
|
ini_set('date.timezone',
|
||||||
(isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__']) ? 'UTC' : $config['time_zone']); //Set Time Zone
|
(isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__']) ? 'UTC' : $config['time_zone']); //Set Time Zone
|
||||||
|
|||||||
@@ -315,7 +315,6 @@ ini_set('display_errors', $config['display_errors']);
|
|||||||
ini_set('error_reporting', $config['error_reporting']);
|
ini_set('error_reporting', $config['error_reporting']);
|
||||||
ini_set('short_open_tag', 'On');
|
ini_set('short_open_tag', 'On');
|
||||||
ini_set('default_charset', "UTF-8");
|
ini_set('default_charset', "UTF-8");
|
||||||
ini_set('memory_limit', $config['memory_limit']);
|
|
||||||
ini_set('soap.wsdl_cache_enabled', $config['wsdl_cache']);
|
ini_set('soap.wsdl_cache_enabled', $config['wsdl_cache']);
|
||||||
ini_set('date.timezone',
|
ini_set('date.timezone',
|
||||||
(isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__']) ? 'UTC' : $config['time_zone']); //Set Time Zone
|
(isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__']) ? 'UTC' : $config['time_zone']); //Set Time Zone
|
||||||
@@ -572,7 +571,6 @@ ini_set('display_errors', $config['display_errors']);
|
|||||||
ini_set('error_reporting', $config['error_reporting']);
|
ini_set('error_reporting', $config['error_reporting']);
|
||||||
ini_set('short_open_tag', 'On');
|
ini_set('short_open_tag', 'On');
|
||||||
ini_set('default_charset', "UTF-8");
|
ini_set('default_charset', "UTF-8");
|
||||||
ini_set('memory_limit', $config['memory_limit']);
|
|
||||||
ini_set('soap.wsdl_cache_enabled', $config['wsdl_cache']);
|
ini_set('soap.wsdl_cache_enabled', $config['wsdl_cache']);
|
||||||
ini_set('date.timezone', TIME_ZONE); //Set Time Zone
|
ini_set('date.timezone', TIME_ZONE); //Set Time Zone
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user